diff --git a/CHANGELOG.md b/CHANGELOG.md index 98a1c06741e8..976bf37d3454 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ - [[PR 1004]](https://github.com/parthenon-hpc-lab/parthenon/pull/1004) Allow parameter modification from an input file for restarts ### Fixed (not changing behavior/API/variables/...) +- [[PR 1131]](https://github.com/parthenon-hpc-lab/parthenon/pull/1131) Make deallocation of fine and sparse fields work - [[PR 1127]](https://github.com/parthenon-hpc-lab/parthenon/pull/1127) Add WithFluxes to IsRefined check - [[PR 1111]](https://github.com/parthenon-hpc-lab/parthenon/pull/1111) Fix undefined behavior due to bitshift of negative number in LogicalLocation - [[PR 1092]](https://github.com/parthenon-hpc-lab/parthenon/pull/1092) Updates to DataCollection and MeshData to remove requirement of predefining MeshBlockData diff --git a/src/interface/metadata.cpp b/src/interface/metadata.cpp index ed87a00f8345..fce88334c652 100644 --- a/src/interface/metadata.cpp +++ b/src/interface/metadata.cpp @@ -263,15 +263,6 @@ bool Metadata::IsValid(bool throw_on_fail) const { } } - // Limitations on fine fields - if (CountSet({Fine, Sparse}) > 1) { - valid = false; - if (throw_on_fail) { - PARTHENON_THROW( - "Sparse deallocation routine is not written to handle fine fields."); - } - } - return valid; } diff --git a/src/interface/update.cpp b/src/interface/update.cpp index 508071c951ca..cf79d9980cba 100644 --- a/src/interface/update.cpp +++ b/src/interface/update.cpp @@ -174,13 +174,11 @@ TaskStatus SparseDealloc(MeshData *md) { const auto &var = pack(b, v); const Real threshold = var.deallocation_threshold; bool all_zero = true; + const auto &var_raw = var.data(); Kokkos::parallel_reduce( - Kokkos::TeamThreadRange<>(team_member, NkNjNi), + Kokkos::TeamThreadRange<>(team_member, var.size()), [&](const int idx, bool &lall_zero) { - const int k = kb.s + idx / NjNi; - const int j = jb.s + (idx % NjNi) / Ni; - const int i = ib.s + idx % Ni; - if (std::abs(var(k, j, i)) > threshold) { + if (std::abs(var_raw[idx]) > threshold) { lall_zero = false; return; }