Skip to content

Commit

Permalink
updates to metadata none var test
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroBarker committed Nov 12, 2024
1 parent 20abe85 commit a064a26
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 1 addition & 5 deletions example/advection/advection_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,10 @@ void PreFill(MeshBlockData<Real> *rc) {
PackIndexMap imap;
const auto &v = rc->PackVariables(vars, imap);

const int ivar_lo = imap.get("metadata_none_var").first;
const int ivar_hi = imap.get("metadata_none_var").second;
pmb->par_for(
PARTHENON_AUTO_LABEL, 0, 2, 0, nx3, 0, nx2, 0, nx1,
KOKKOS_LAMBDA(const int n, const int k, const int j, const int i) {
v(ivar_lo, n, k, j, i) = n + k * j * i;
v(ivar_lo + 1, n, k, j, i) = 1 + n + k * j * i;
v(ivar_hi, n, k, j, i) = 2 + n + k * j * i;
v(n, k, j, i) = n + k + j + i;
});
}
}
Expand Down
12 changes: 12 additions & 0 deletions tst/regression/test_suites/output_hdf5/output_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,18 @@ def Analyse(self, parameters):
)
analyze_status = False

# check contents of matadata_none_var
for dim in [2, 3]:
data = phdf.phdf(f"advection_{dim}d.out0.final.phdf")
profile = data.Get("metadata_none_var", flatten=False)
for index in np.ndindex(profile.shape):
ib, j, k, l, m = index
expected_value = l + k + j + m
actual_value = profile[ib, j, k, l, m]
if expected_value != actual_value:
print("metadata_none_var is incorrect")
analyze_status = False

# Checking Parthenon histograms versus numpy ones
for dim in [2, 3]:
# 1D histogram with binning of a variable with bins defined by a var
Expand Down

0 comments on commit a064a26

Please sign in to comment.