Skip to content

Commit

Permalink
Philipp comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lroberts36 committed Nov 12, 2024
1 parent 0f6cec4 commit 5272708
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions example/fine_advection/advection_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ TaskStatus FillDerived(MeshData<Real> *md) {
const int fi = (ndim > 0) ? (i - nghost) * 2 + nghost : i;
pack(b, Conserved::phi_fine_restricted(), k, j, i) = 0.0;
Real ntot = 0.0;
for (int ioff = 0; ioff <= (ndim > 0); ++ioff)
for (int koff = 0; koff <= (ndim > 2); ++koff)
for (int joff = 0; joff <= (ndim > 1); ++joff)
for (int koff = 0; koff <= (ndim > 2); ++koff) {
for (int ioff = 0; ioff <= (ndim > 0); ++ioff) {
ntot += 1.0;
pack(b, Conserved::phi_fine_restricted(), k, j, i) +=
pack(b, Conserved::phi_fine(), kf + koff, jf + joff, fi + ioff);
Expand Down
9 changes: 5 additions & 4 deletions example/fine_advection/advection_package.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ TaskStatus CalculateFluxes(pack_desc_t &desc, parthenon::TopologicalElement FACE
IndexRange ib = md->GetBoundsI(cl, IndexDomain::interior, FACE);
IndexRange jb = md->GetBoundsJ(cl, IndexDomain::interior, FACE);
IndexRange kb = md->GetBoundsK(cl, IndexDomain::interior, FACE);
constexpr int scratch_size = 0;
constexpr int scratch_level = 1;
constexpr int unused_scratch_size = 0;
constexpr int unused_scratch_level = 1;
parthenon::par_for_outer(
PARTHENON_AUTO_LABEL, scratch_size, scratch_level, 0, pack.GetNBlocks() - 1, kb.s,
kb.e, KOKKOS_LAMBDA(parthenon::team_mbr_t member, const int b, const int k) {
PARTHENON_AUTO_LABEL, unused_scratch_size, unused_scratch_level, 0,
pack.GetNBlocks() - 1, kb.s, kb.e,
KOKKOS_LAMBDA(parthenon::team_mbr_t member, const int b, const int k) {
parthenon::Indexer2D idxer({jb.s, jb.e}, {ib.s, ib.e});
for (int l = pack.GetLowerBound(b); l <= pack.GetUpperBound(b); ++l) {
parthenon::par_for_inner(member, 0, idxer.size() - 1, [&](const int idx) {
Expand Down
12 changes: 6 additions & 6 deletions example/fine_advection/parthenon_app_inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,26 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
Real rsq = coords.Xc<1>(i) * coords.Xc<1>(i) +
coords.Xc<2>(j) * coords.Xc<2>(j) +
coords.Xc<3>(k) * coords.Xc<3>(k);
for (int ioff = 0; ioff <= (ndim > 0); ++ioff)
for (int koff = 0; koff <= (ndim > 2); ++koff)
for (int joff = 0; joff <= (ndim > 1); ++joff)
for (int koff = 0; koff <= (ndim > 2); ++koff) {
for (int ioff = 0; ioff <= (ndim > 0); ++ioff) {
pack(b, phi_fine(), kf + koff, jf + joff, fi + ioff) =
1. + amp * exp(-100.0 * rsq);
}
} else if (profile_type == 2) {
Real rsq = coords.Xc<1>(i) * coords.Xc<1>(i) +
coords.Xc<2>(j) * coords.Xc<2>(j) +
coords.Xc<3>(k) * coords.Xc<3>(k);
for (int ioff = 0; ioff <= (ndim > 0); ++ioff)
for (int koff = 0; koff <= (ndim > 2); ++koff)
for (int joff = 0; joff <= (ndim > 1); ++joff)
for (int koff = 0; koff <= (ndim > 2); ++koff) {
for (int ioff = 0; ioff <= (ndim > 0); ++ioff) {
pack(b, phi_fine(), kf + koff, jf + joff, fi + ioff) =
(rsq < 0.15 * 0.15 ? 1.0 : 0.0);
}
} else {
for (int ioff = 0; ioff <= (ndim > 0); ++ioff)
for (int koff = 0; koff <= (ndim > 2); ++koff)
for (int joff = 0; joff <= (ndim > 1); ++joff)
for (int koff = 0; koff <= (ndim > 2); ++koff) {
for (int ioff = 0; ioff <= (ndim > 0); ++ioff) {
pack(b, phi_fine(), kf + koff, jf + joff, fi + ioff) = 0.0;
}
}
Expand Down

0 comments on commit 5272708

Please sign in to comment.