Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Div mpdata dyn (do not merge) #378

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
81f8bbe
adding fourth order gradient and div formulae
mwarusz Jul 26, 2017
0409807
add an option for fourth order pressure solver
mwarusz Jul 26, 2017
8cf562d
fix pressure order option name
mwarusz Sep 8, 2017
da659fc
choose correct velocity interpolation scheme in vip solvers
mwarusz Sep 8, 2017
49ab8f5
Merge branch 'master' into div_mpdata_dyn
mwarusz Sep 8, 2017
8612396
fix parent_t designation in mpdata_rhs_vip_common
mwarusz Sep 11, 2017
e5a2c1e
default to second-order gradient
mwarusz Sep 11, 2017
b661c30
fix specification of boundary values in pressure solver with open bcs
mwarusz Sep 13, 2017
62bfbab
adding a function calculating max_abs_div of a given vector field
mwarusz Sep 13, 2017
a65d89c
adding bconds_div unit test
mwarusz Sep 13, 2017
a131f04
limit vctr_alng exchange for antidiffusive velocities in open and rig…
mwarusz Sep 13, 2017
41c298d
fixing fill_halos_vctr_alng signature in rigid_2d
mwarusz Sep 13, 2017
f021c3f
make open and rigid bcs in mpdata_rhs_vip consistent with the pressur…
mwarusz Sep 13, 2017
01e2e45
get rid of return_macro in boussinesq solver to make gcc happy
mwarusz Sep 14, 2017
a076728
move bconds_div test to sandbox and run it on travis
mwarusz Sep 15, 2017
674cda5
update refdata in paper tests using open bcs
mwarusz Sep 15, 2017
73d74a9
Merge branch 'master' into div_mpdata_dyn
mwarusz Sep 23, 2017
be839a7
adding a function calculating max_abs_div of a given vector field
mwarusz Sep 13, 2017
980534b
determine halo based on the whole ct_params_t not only opts
mwarusz Sep 25, 2017
40ac9ab
special boundary handling for cyclic bcs in rhs_vip solver
mwarusz Sep 25, 2017
3e773a5
Merge branch 'master' into bc_fixes
mwarusz Sep 25, 2017
d8d277b
fix infinite recursive calls in cyclic_3d
mwarusz Sep 26, 2017
b309e93
adding bconds_div test in 3D
mwarusz Sep 26, 2017
f2d2669
Merge branch 'bc_fixes' into div_mpdata_dyn
mwarusz Sep 26, 2017
bb92334
wip on rigid bcs that work with 4th order pressure solver (2D version)
mwarusz Sep 27, 2017
857ea6d
choose correct velocity sptl_intrp scheme based on prs_order
mwarusz Sep 27, 2017
d7eab39
adding ex parameter to xchng_vctr_alng
mwarusz Sep 27, 2017
976e3c7
correct sptl_intrp and bc handling for 4th order pressure solver in 2d
mwarusz Sep 27, 2017
f1f1f7b
promote prev_dt to an array, keep dt_{n-2} for div_3rd mpdata option
mwarusz Sep 28, 2017
2b086e3
fix prev_dt initialization
mwarusz Sep 28, 2017
0c5fe6c
introduce vip_state to ease stash management
mwarusz Sep 28, 2017
63e97bd
dimension independent fill_stash
mwarusz Sep 28, 2017
37b362f
fix var_dt gc scaling in ante_loop
mwarusz Sep 29, 2017
a8ed9ec
fix fill stash t_lev, initialize vip_state with zeros
mwarusz Sep 29, 2017
f14686e
fix fill_stash t_lev again
mwarusz Sep 29, 2017
fd8a977
add output argument to interpolate_in_space
mwarusz Sep 29, 2017
dd829f1
remove leftover variable
mwarusz Sep 29, 2017
0dfa269
first pass at calculating gc time derivatives for dynamics with third…
mwarusz Sep 29, 2017
771a9b3
fix velocity extrapolation with const dt and third-order MPDATA
mwarusz Sep 29, 2017
6520c84
add calculation of second time-derivative of gc
mwarusz Sep 29, 2017
d77121c
rigid bcs for 4th order pressure solver (3D version)
mwarusz Oct 4, 2017
aeeccbd
velocity interpolation for 4th order pressure solver in 3D & 2D fixes
mwarusz Oct 4, 2017
fe2f736
Merge branch 'master' into div_mpdata_dyn
mwarusz Oct 23, 2017
4f15aed
Merge branch 'master' into bc_fixes
mwarusz Nov 7, 2017
f39ca7a
perform nrml halo exchange for all bcs in mpdata_rhs_vip
mwarusz Nov 7, 2017
248eef5
enforce zero advective flux rigid bc in every MPDATA iteration
mwarusz Nov 7, 2017
30e8a8b
change rigid pressure bcs
mwarusz Nov 7, 2017
d55871a
work around flux exchange unimplemented in 1d
mwarusz Nov 7, 2017
8f2ea04
reorder parameters in xchng_vctr_nrml
mwarusz Nov 7, 2017
f8f57cf
Merge branch 'bc_fixes' into div_mpdata_dyn
mwarusz Nov 7, 2017
8b96424
fix broken merge
mwarusz Nov 7, 2017
9766f58
yet another merge fix
mwarusz Nov 8, 2017
449b2fc
change panel plot slightly in reversing_def test
mwarusz Nov 30, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis_scripts/sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ VERBOSE=1 $make_j
OMP_NUM_THREADS=4 ctest -R tgv_2d || cat Testing/Temporary/LastTest.log /
OMP_NUM_THREADS=4 make -C convergence_2d_3d test || cat convergence_2d_3d/Testing/Temporary/LastTest.log /
if [[ $TRAVIS_OS_NAME == 'linux' ]]; then OMP_NUM_THREADS=4 make -C convergence_spacetime test || cat convergence_spacetime/Testing/Temporary/LastTest.log /; fi
OMP_NUM_THREADS=4 make -C bconds_div test || cat bconds_div/Testing/Temporary/LastTest.log /
cd ../../..
9 changes: 9 additions & 0 deletions libmpdata++/bcond/cyclic_1d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ namespace libmpdataxx
{
av[0](this->left_halo_vctr) = av[0](this->rght_intr_vctr);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const bool ad = false)
{
fill_halos_vctr_alng(av, ad);
}
};

template <typename real_t, int halo, bcond_e knd, drctn_e dir, int n_dims, int dim>
Expand Down Expand Up @@ -62,6 +67,10 @@ namespace libmpdataxx
av[0](this->rght_halo_vctr) = av[0](this->left_intr_vctr);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const bool ad = false)
{
fill_halos_vctr_alng(av, ad);
}
};
} // namespace bcond
} // namespace libmpdataxx
20 changes: 20 additions & 0 deletions libmpdata++/bcond/cyclic_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ namespace libmpdataxx
{
fill_halos_sclr(a, j);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const rng_t &j, const bool ad = false)
{
fill_halos_vctr_alng(av, j, ad);
}

void fill_halos_vctr_nrml_cyclic(arr_t &a, const rng_t &j)
{
fill_halos_vctr_nrml(a, j);
}
};

template <typename real_t, int halo, bcond_e knd, drctn_e dir, int n_dims, int d>
Expand Down Expand Up @@ -127,6 +137,16 @@ namespace libmpdataxx
{
fill_halos_sclr(a, j);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const rng_t &j, const bool ad = false)
{
fill_halos_vctr_alng(av, j, ad);
}

void fill_halos_vctr_nrml_cyclic(arr_t &a, const rng_t &j)
{
fill_halos_vctr_nrml(a, j);
}
};
} // namespace bcond
} // namespace libmpdataxx
20 changes: 20 additions & 0 deletions libmpdata++/bcond/cyclic_3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ namespace libmpdataxx
{
fill_halos_sclr(a, j, k);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const rng_t &j, const rng_t &k, const bool ad = false)
{
fill_halos_vctr_alng(av, j, k, ad);
}

void fill_halos_vctr_nrml_cyclic(arr_t &a, const rng_t &j, const rng_t &k)
{
fill_halos_vctr_nrml(a, j, k);
}
};

template <typename real_t, int halo, bcond_e knd, drctn_e dir, int n_dims, int d>
Expand Down Expand Up @@ -127,6 +137,16 @@ namespace libmpdataxx
{
fill_halos_sclr(a, j, k);
}

void fill_halos_vctr_alng_cyclic(arrvec_t<arr_t> &av, const rng_t &j, const rng_t &k, const bool ad = false)
{
fill_halos_vctr_alng(av, j, k, ad);
}

void fill_halos_vctr_nrml_cyclic(arr_t &a, const rng_t &j, const rng_t &k)
{
fill_halos_vctr_nrml(a, j, k);
}
};
} // namespace bcond
} // namespace libmpdataxx
21 changes: 21 additions & 0 deletions libmpdata++/bcond/detail/bcond_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ namespace libmpdataxx
{
assert(false && "bcond::fill_halos_vctr() called!");
};

virtual void fill_halos_vctr_alng_cyclic(arrvec_t<blitz::Array<real_t, 1>> &, const bool ad = false)
{};

// 2D
virtual void fill_halos_sclr(arr_2d_t &, const rng_t &, const bool deriv = false)
Expand Down Expand Up @@ -98,6 +101,15 @@ namespace libmpdataxx
{
assert(false && "bcond::fill_halos_vctr_nrml() called!");
};

virtual void fill_halos_vctr_alng_cyclic(arrvec_t<blitz::Array<real_t, 2>> &, const rng_t &, const bool ad = false)
{};

virtual void fill_halos_vctr_nrml_cyclic(blitz::Array<real_t, 2> &, const rng_t &)
{};

virtual void fill_halos_flux(arrvec_t<blitz::Array<real_t, 2>> &, const rng_t &)
{};

// 3D
virtual void fill_halos_sclr(arr_3d_t &, const rng_t &, const rng_t &, const bool deriv = false)
Expand Down Expand Up @@ -153,6 +165,15 @@ namespace libmpdataxx
{
assert(false && "bcond::fill_halos_vctr_nrml() called!");
};

virtual void fill_halos_vctr_alng_cyclic(arrvec_t<blitz::Array<real_t, 3>> &, const rng_t &, const rng_t &, const bool ad = false)
{};

virtual void fill_halos_vctr_nrml_cyclic(blitz::Array<real_t, 3> &, const rng_t &, const rng_t &)
{};

virtual void fill_halos_flux(arrvec_t<blitz::Array<real_t, 3>> &, const rng_t &, const rng_t &)
{};

protected:
// sclr
Expand Down
4 changes: 2 additions & 2 deletions libmpdata++/bcond/open_1d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace libmpdataxx

void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const bool ad = false)
{
for (int i = this->left_halo_vctr.first(); i <= this->left_halo_vctr.last(); ++i)
for (int i = this->left_halo_vctr.first(); i <= this->left_halo_vctr.last() - (ad ? 1 : 0); ++i)
av[0](rng_t(i, i)) = av[0](this->left_intr_vctr.first());
}
};
Expand Down Expand Up @@ -72,7 +72,7 @@ namespace libmpdataxx

void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const bool ad = false)
{
for (int i = this->rght_halo_vctr.first(); i <= this->rght_halo_vctr.last(); ++i)
for (int i = this->rght_halo_vctr.first() + (ad ? 1 : 0); i <= this->rght_halo_vctr.last(); ++i)
av[0](rng_t(i, i)) = av[0](this->rght_intr_vctr.first());
}
};
Expand Down
16 changes: 14 additions & 2 deletions libmpdata++/bcond/open_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ namespace libmpdataxx
{
using namespace idxperm;
a(pi<d>(this->left_edge_sclr, j)) = sign * edge_velocity(pi<d>(0, j));

if (halo > 1)
{
a(pi<d>(this->left_halo_sclr.last() - 1, j)) = 3 * a(pi<d>(this->left_edge_sclr, j))
- 2 * a(pi<d>(this->left_edge_sclr + 1, j));
}
}

void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const rng_t &j, const bool ad = false)
Expand All @@ -77,7 +83,7 @@ namespace libmpdataxx
}

// zero-divergence condition
for (int ii = this->left_halo_vctr.first(); ii <= this->left_halo_vctr.last(); ++ii)
for (int ii = this->left_halo_vctr.first(); ii <= this->left_halo_vctr.last() - (ad ? 1 : 0); ++ii)
{
av[d](pi<d>(ii, j)) =
av[d](pi<d>(i+h, j))
Expand Down Expand Up @@ -133,6 +139,12 @@ namespace libmpdataxx
// equivalent to one-sided derivatives at the boundary
a(pi<d>(this->rght_halo_sclr.first(), j)) = 2 * a(pi<d>(this->rght_edge_sclr, j))
- a(pi<d>(this->rght_edge_sclr - 1, j));
if (halo > 1)
{
a(pi<d>(this->rght_halo_sclr.first() + 1, j)) = 3 * a(pi<d>(this->rght_edge_sclr, j))
- 2 * a(pi<d>(this->rght_edge_sclr - 1, j));
}

}

void save_edge_vel(const arr_t &a, const rng_t &j)
Expand Down Expand Up @@ -163,7 +175,7 @@ namespace libmpdataxx
}

// zero-divergence condition
for (int ii = this->rght_halo_vctr.first(); ii <= this->rght_halo_vctr.last(); ++ii)
for (int ii = this->rght_halo_vctr.first() + (ad ? 1 : 0); ii <= this->rght_halo_vctr.last(); ++ii)
{
av[d](pi<d>(ii, j)) =
av[d](pi<d>(i-h, j)) + (
Expand Down
15 changes: 13 additions & 2 deletions libmpdata++/bcond/open_3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ namespace libmpdataxx
// equivalent to one-sided derivatives at the boundary
a(pi<d>(this->left_halo_sclr.last(), j, k)) = 2 * a(pi<d>(this->left_edge_sclr, j, k))
- a(pi<d>(this->left_edge_sclr + 1, j, k));
if (halo > 1)
{
a(pi<d>(this->left_halo_sclr.last() - 1, j, k)) = 3 * a(pi<d>(this->left_edge_sclr, j, k))
- 2 * a(pi<d>(this->left_edge_sclr + 1, j, k));
}
}

void save_edge_vel(const arr_t &a, const rng_t &j, const rng_t &k)
Expand Down Expand Up @@ -93,7 +98,7 @@ namespace libmpdataxx
assert(std::isfinite(sum(av[d+2](pi<d>(i, j, k+h)))));

// zero-divergence condition
for (int ii = this->left_halo_vctr.first(); ii <= this->left_halo_vctr.last(); ++ii)
for (int ii = this->left_halo_vctr.first(); ii <= this->left_halo_vctr.last() - (ad ? 1 : 0); ++ii)
{
av[d](pi<d>(ii, j, k)) =
av[d](pi<d>(i+h, j, k))
Expand Down Expand Up @@ -153,6 +158,12 @@ namespace libmpdataxx
// equivalent to one-sided derivatives at the boundary
a(pi<d>(this->rght_halo_sclr.first(), j, k)) = 2 * a(pi<d>(this->rght_edge_sclr, j, k))
- a(pi<d>(this->rght_edge_sclr - 1, j, k));

if (halo > 1)
{
a(pi<d>(this->rght_halo_sclr.first() + 1, j, k)) = 3 * a(pi<d>(this->rght_edge_sclr, j, k))
- 2 * a(pi<d>(this->rght_edge_sclr - 1, j, k));
}
}

void save_edge_vel(const arr_t &a, const rng_t &j, const rng_t &k)
Expand Down Expand Up @@ -197,7 +208,7 @@ namespace libmpdataxx
assert(std::isfinite(sum(av[d+2](pi<d>(i, j, k-h)))));
assert(std::isfinite(sum(av[d+2](pi<d>(i, j, k+h)))));

for (int ii = this->rght_halo_vctr.first(); ii <= this->rght_halo_vctr.last(); ++ii)
for (int ii = this->rght_halo_vctr.first() + (ad ? 1 : 0); ii <= this->rght_halo_vctr.last(); ++ii)
{
av[d](pi<d>(ii, j, k)) =
av[d](pi<d>(i-h, j, k))
Expand Down
63 changes: 51 additions & 12 deletions libmpdata++/bcond/rigid_2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ namespace libmpdataxx
a(pi<d>(i, j)) = a(pi<d>(this->left_edge_sclr + n, j));
}
}

void fill_halos_pres(arr_t &a, const rng_t &j)
{
using namespace idxperm;
// equivalent to one-sided derivatives at the boundary
a(pi<d>(this->left_halo_sclr.last(), j)) = 2 * a(pi<d>(this->left_edge_sclr, j))
- a(pi<d>(this->left_edge_sclr + 1, j));
}
for (int i = this->left_halo_sclr.first(), n = halo; i <= this->left_halo_sclr.last(); ++i, --n)
{
a(pi<d>(i, j)) = 2 * a(pi<d>(this->left_edge_sclr, j))
- a(pi<d>(this->left_edge_sclr + n, j));
}
}

void save_edge_vel(const arr_t &, const rng_t &) {}

Expand All @@ -55,10 +58,20 @@ namespace libmpdataxx
void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const rng_t &j, const bool ad = false)
{
using namespace idxperm;
// zero velocity condition
for (int i = this->left_halo_vctr.first(), n = halo; i <= this->left_halo_vctr.last(); ++i, --n)
int i = this->left_halo_vctr.last();

if (!ad)
{
av[d](pi<d>(i, j)) = -av[d](pi<d>(this->left_edge_sclr + n - h, j));
// zero velocity condition
av[d](pi<d>(i, j)) = -av[d](pi<d>(this->left_edge_sclr + h, j));
}
if (halo > 1)
{
// extrapolation
av[d](pi<d>(i - 1, j)) = av[d](pi<d>(this->left_edge_sclr + 1 + h, j)) + 3 * (
av[d](pi<d>(this->left_edge_sclr - h, j))
- av[d](pi<d>(this->left_edge_sclr + h, j))
);
}
}

Expand All @@ -67,6 +80,12 @@ namespace libmpdataxx
// note intentional sclr
fill_halos_sclr(a, j);
}

void fill_halos_flux(arrvec_t<arr_t> &av, const rng_t &j)
{
using namespace idxperm;
av[d](pi<d>(this->left_halo_vctr.last(), j)) = -av[d](pi<d>(this->left_edge_sclr + h, j));
}
};

template <typename real_t, int halo, bcond_e knd, drctn_e dir, int n_dims, int d>
Expand Down Expand Up @@ -98,8 +117,11 @@ namespace libmpdataxx
{
using namespace idxperm;
// equivalent to one-sided derivatives at the boundary
a(pi<d>(this->rght_halo_sclr.first(), j)) = 2 * a(pi<d>(this->rght_edge_sclr, j))
- a(pi<d>(this->rght_edge_sclr - 1, j));
for (int i = this->rght_halo_sclr.first(), n = 1; i <= this->rght_halo_sclr.last(); ++i, ++n)
{
a(pi<d>(i, j)) = 2 * a(pi<d>(this->rght_edge_sclr, j))
- a(pi<d>(this->rght_edge_sclr - n, j));
}
}

void save_edge_vel(const arr_t &, const rng_t &) {}
Expand All @@ -113,10 +135,20 @@ namespace libmpdataxx
void fill_halos_vctr_alng(arrvec_t<arr_t> &av, const rng_t &j, const bool ad = false)
{
using namespace idxperm;
// zero velocity condition
for (int i = this->rght_halo_vctr.first(), n = 1; i <= this->rght_halo_vctr.last(); ++i, ++n)

int i = this->rght_halo_vctr.first();
if (!ad)
{
// zero velocity condition
av[d](pi<d>(i, j)) = -av[d](pi<d>(this->rght_edge_sclr - h, j));
}
if (halo > 1)
{
av[d](pi<d>(i, j)) = -av[d](pi<d>(this->rght_edge_sclr - n + h, j));
// extrapolation
av[d](pi<d>(i + 1, j)) = av[d](pi<d>(this->rght_edge_sclr - 1 - h, j)) + 3 * (
av[d](pi<d>(this->rght_edge_sclr + h, j))
- av[d](pi<d>(this->rght_edge_sclr - h, j))
);
}
}

Expand All @@ -125,6 +157,13 @@ namespace libmpdataxx
// note intentional sclr
fill_halos_sclr(a, j);
}

void fill_halos_flux(arrvec_t<arr_t> &av, const rng_t &j)
{
using namespace idxperm;
// zero flux condition
av[d](pi<d>(this->rght_halo_vctr.first(), j)) = -av[d](pi<d>(this->rght_edge_sclr - h, j));
}
};
} // namespace bcond
} // namespace libmpdataxx
Loading