From 97004f4f2f5ce4d20dc03dc2cca3770bc7448c1d Mon Sep 17 00:00:00 2001 From: Philipp Grete Date: Fri, 6 Sep 2024 09:32:58 +0200 Subject: [PATCH] Fix logical location --- CHANGELOG.md | 1 + src/utils/few_modes_ft.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9259a727..29c5c226 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - Order of operations in flux-correction has changed (expect round-off error differences to previous results for AMR sims) - History outputs now carry the output block number, i.e., a file previously called parthenon.hst might now be called parthenon.out1.hst - History outputs now contain two additional columns (cycle number and meshblock counts), which changes/shifts the column indices (hint: use the column headers to parse the contents and do not rely on fixed indices as they may also vary between different pgen due to custom/pgen-dependent content in the history file) + - Given the introduction of a forrest of tree (rather than a single tree), the logical locations are each meshblock (`pmb->loc`) are now local to the tree and not global any more. To recover the original global index use `auto loc = pmb->pmy_mesh->Forest().GetLegacyTreeLocation(pmb->loc);` - [[PR 97]](https://github.com/parthenon-hpc-lab/athenapk/pull/97) - Removes original `schure.cooling` cooling curve as it had unknown origin. - To avoid confusion, only cooling table for a single solar metallicity are supported diff --git a/src/utils/few_modes_ft.cpp b/src/utils/few_modes_ft.cpp index e42edde2..5d22d042 100644 --- a/src/utils/few_modes_ft.cpp +++ b/src/utils/few_modes_ft.cpp @@ -9,18 +9,15 @@ // C++ headers #include -#include // Parthenon headers #include "basic_types.hpp" #include "config.hpp" #include "globals.hpp" #include "kokkos_abstraction.hpp" -#include "mesh/domain.hpp" #include "mesh/meshblock_pack.hpp" // AthenaPK headers -#include "../main.hpp" #include "few_modes_ft.hpp" #include "utils/error_checking.hpp" @@ -130,9 +127,12 @@ void FewModesFT::SetPhases(MeshBlock *pmb, ParameterInput *pin) { const auto nx2 = pmb->block_size.nx(X2DIR); const auto nx3 = pmb->block_size.nx(X3DIR); - const auto gis = pmb->loc.lx1() * pmb->block_size.nx(X1DIR); - const auto gjs = pmb->loc.lx2() * pmb->block_size.nx(X2DIR); - const auto gks = pmb->loc.lx3() * pmb->block_size.nx(X3DIR); + // Need to use legacy locations (which are global) because locations now are local + // to the tree, which results in inconsistencies for meshes with multiple trees. + const auto loc = pmb->pmy_mesh->Forest().GetLegacyTreeLocation(pmb->loc); + const auto gis = loc.lx1() * pmb->block_size.nx(X1DIR); + const auto gjs = loc.lx2() * pmb->block_size.nx(X2DIR); + const auto gks = loc.lx3() * pmb->block_size.nx(X3DIR); // make local ref to capure in lambda const auto num_modes = num_modes_;