From a4155c927af6f56e63999fd346a3a61a08e6881c Mon Sep 17 00:00:00 2001 From: Philipp Grete Date: Thu, 14 Nov 2024 15:23:13 +0100 Subject: [PATCH] Fix reset of dt_diff --- src/hydro/hydro_driver.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/hydro/hydro_driver.cpp b/src/hydro/hydro_driver.cpp index f01e4c2d..afcba1d8 100644 --- a/src/hydro/hydro_driver.cpp +++ b/src/hydro/hydro_driver.cpp @@ -660,8 +660,24 @@ TaskCollection HydroDriver::MakeTaskCollection(BlockList_t &blocks, int stage) { pmesh->multilevel); } + TaskRegion &single_tasklist_per_pack_region_3 = tc.AddRegion(num_partitions); + for (int i = 0; i < num_partitions; i++) { + auto &tl = single_tasklist_per_pack_region_3[i]; + auto &mu0 = pmesh->mesh_data.GetOrAdd("base", i); + auto fill_derived = + tl.AddTask(none, parthenon::Update::FillDerived>, mu0.get()); + } + const auto &diffint = hydro_pkg->Param("diffint"); + // If any tasks modify the conserved variables before this place and after FillDerived, + // then the STS tasks should be updated to not assume prim and cons are in sync. + if (diffint == DiffInt::rkl2 && stage == integrator->nstages) { + AddSTSTasks(&tc, pmesh, blocks, 0.5 * tm.dt); + } + // Single task in single (serial) region to reset global vars used in reductions in the // first stage. + // TODO(pgrete) check if we logically need this reset or if we can reset within the + // timestep task if (stage == integrator->nstages && (hydro_pkg->Param("calc_c_h") || hydro_pkg->Param("diffint") != DiffInt::none)) { @@ -678,20 +694,6 @@ TaskCollection HydroDriver::MakeTaskCollection(BlockList_t &blocks, int stage) { hydro_pkg.get()); } - TaskRegion &single_tasklist_per_pack_region_3 = tc.AddRegion(num_partitions); - for (int i = 0; i < num_partitions; i++) { - auto &tl = single_tasklist_per_pack_region_3[i]; - auto &mu0 = pmesh->mesh_data.GetOrAdd("base", i); - auto fill_derived = - tl.AddTask(none, parthenon::Update::FillDerived>, mu0.get()); - } - const auto &diffint = hydro_pkg->Param("diffint"); - // If any tasks modify the conserved variables before this place and after FillDerived, - // then the STS tasks should be updated to not assume prim and cons are in sync. - if (diffint == DiffInt::rkl2 && stage == integrator->nstages) { - AddSTSTasks(&tc, pmesh, blocks, 0.5 * tm.dt); - } - if (stage == integrator->nstages) { TaskRegion &tr = tc.AddRegion(num_partitions); for (int i = 0; i < num_partitions; i++) {