Skip to content

Commit a07596d

Browse files
authored
Merge pull request #431 from mwarusz/fix
remove some magic
2 parents ddc51a8 + cdc2210 commit a07596d

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ install:
109109
# hdf5
110110
- 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
111111
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install hdf5-tools; fi
112-
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install hdf5 --with-cxx; fi
112+
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install hdf5; fi
113113

114114
# gnuplot-iostream
115115
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo $apt_get_install gnuplot-nox; fi

tests/sandbox/convergence_adv_diffusion/convergence_adv_diffusion.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ err_t test(int np)
4141
time = 1.0,
4242
dx = 2.0 * pi / (np - 1),
4343
dt = 0.4 * dx,
44+
advective_vel = 1.0,
4445
mu = 0.001;
4546

4647
int nt = time / dt;
@@ -54,6 +55,7 @@ err_t test(int np)
5455
p.di = dx;
5556
p.dt = dt;
5657
p.mu = mu;
58+
p.advective_vel = advective_vel;
5759

5860
concurr::serial<
5961
slv_t,
@@ -62,11 +64,11 @@ err_t test(int np)
6264

6365
blitz::firstIndex i;
6466

65-
run.advectee(0) = exact_f{0., mu}(i * dx);
67+
run.advectee(0) = exact_f{0., mu, advective_vel}(i * dx);
6668
run.advectee(1) = 0;
6769

6870
decltype(run.advectee()) true_solution(run.advectee().shape());
69-
true_solution = exact_f{time, mu}(i * dx);
71+
true_solution = exact_f{time, mu, advective_vel}(i * dx);
7072

7173
run.advance(nt);
7274

tests/sandbox/convergence_adv_diffusion/solver.hpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ using real_t = double;
1818

1919
struct exact_f
2020
{
21-
real_t t, mu;
21+
real_t t, mu, advective_vel;
2222

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

2727
}
2828
BZ_DECLARE_FUNCTOR(exact_f);
@@ -71,7 +71,7 @@ class adv_diffusion_solver : public libmpdataxx::solvers::mpdata_rhs_vip<ct_para
7171

7272
protected:
7373

74-
real_t mu;
74+
real_t mu, advective_vel;
7575

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

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

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

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

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

121121
struct rt_params_t : parent_t::rt_params_t
122122
{
123-
real_t mu;
123+
real_t mu, advective_vel;
124124
};
125125

126126
adv_diffusion_solver(
127127
typename parent_t::ctor_args_t args,
128128
const rt_params_t &p
129129
) :
130130
parent_t(args, p),
131-
mu(p.mu)
131+
mu(p.mu),
132+
advective_vel(p.advective_vel)
132133
{}
133134
};

0 commit comments

Comments
 (0)