Skip to content

Commit

Permalink
Merge pull request #431 from mwarusz/fix
Browse files Browse the repository at this point in the history
remove some magic
  • Loading branch information
pdziekan authored Feb 8, 2019
2 parents ddc51a8 + cdc2210 commit a07596d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ install:
# hdf5
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" libpango-1.0-0 libpangocairo-1.0-0 libhdf5-dev; fi
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install hdf5-tools; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install hdf5 --with-cxx; fi
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install hdf5; fi

# gnuplot-iostream
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install gnuplot-nox; fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ err_t test(int np)
time = 1.0,
dx = 2.0 * pi / (np - 1),
dt = 0.4 * dx,
advective_vel = 1.0,
mu = 0.001;

int nt = time / dt;
Expand All @@ -54,6 +55,7 @@ err_t test(int np)
p.di = dx;
p.dt = dt;
p.mu = mu;
p.advective_vel = advective_vel;

concurr::serial<
slv_t,
Expand All @@ -62,11 +64,11 @@ err_t test(int np)

blitz::firstIndex i;

run.advectee(0) = exact_f{0., mu}(i * dx);
run.advectee(0) = exact_f{0., mu, advective_vel}(i * dx);
run.advectee(1) = 0;

decltype(run.advectee()) true_solution(run.advectee().shape());
true_solution = exact_f{time, mu}(i * dx);
true_solution = exact_f{time, mu, advective_vel}(i * dx);

run.advance(nt);

Expand Down
17 changes: 9 additions & 8 deletions tests/sandbox/convergence_adv_diffusion/solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ using real_t = double;

struct exact_f
{
real_t t, mu;
real_t t, mu, advective_vel;

real_t operator()(const real_t x) const
{
return 2 + std::sin(x - t) * std::exp(-mu * t);
return 2 + std::sin(x - advective_vel * t) * std::exp(-mu * t);

}
BZ_DECLARE_FUNCTOR(exact_f);
Expand Down Expand Up @@ -71,7 +71,7 @@ class adv_diffusion_solver : public libmpdataxx::solvers::mpdata_rhs_vip<ct_para

protected:

real_t mu;
real_t mu, advective_vel;

void hook_ante_loop(const typename parent_t::advance_arg_t nt)
{
Expand All @@ -91,7 +91,7 @@ class adv_diffusion_solver : public libmpdataxx::solvers::mpdata_rhs_vip<ct_para
tmp(ii) = exact_f{-this->dt, mu}(ii * this->di);
}
this->xchng_sclr(tmp);
this->vip_stash(-1)[0](i) = 1 + diffusive_vel<diffusive_vel_ord>(tmp, i, this->di, mu);
this->vip_stash(-1)[0](i) = advective_vel + diffusive_vel<diffusive_vel_ord>(tmp, i, this->di, mu);

if (parent_t::div3_mpdata)
{
Expand All @@ -101,7 +101,7 @@ class adv_diffusion_solver : public libmpdataxx::solvers::mpdata_rhs_vip<ct_para
tmp(ii) = exact_f{-2 * this->dt, mu}(ii * this->di);
}
this->xchng_sclr(tmp);
this->vip_stash(-2)[0](i) = 1 + diffusive_vel<diffusive_vel_ord>(tmp, i, this->di, mu);
this->vip_stash(-2)[0](i) = advective_vel + diffusive_vel<diffusive_vel_ord>(tmp, i, this->di, mu);
}
}

Expand All @@ -111,7 +111,7 @@ class adv_diffusion_solver : public libmpdataxx::solvers::mpdata_rhs_vip<ct_para
const auto &i = this->i;

this->xchng_sclr(psi);
this->vips()[0](i) = 1 + diffusive_vel<diffusive_vel_ord>(psi, i, this->di, mu);
this->vips()[0](i) = advective_vel + diffusive_vel<diffusive_vel_ord>(psi, i, this->di, mu);

return parent_t::calc_gc();
}
Expand All @@ -120,14 +120,15 @@ class adv_diffusion_solver : public libmpdataxx::solvers::mpdata_rhs_vip<ct_para

struct rt_params_t : parent_t::rt_params_t
{
real_t mu;
real_t mu, advective_vel;
};

adv_diffusion_solver(
typename parent_t::ctor_args_t args,
const rt_params_t &p
) :
parent_t(args, p),
mu(p.mu)
mu(p.mu),
advective_vel(p.advective_vel)
{}
};

0 comments on commit a07596d

Please sign in to comment.