Skip to content

Commit

Permalink
Fix swarm interface
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrete committed Sep 9, 2024
1 parent 14976c1 commit da769ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/hydro/hydro_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "basic_types.hpp"
#include "bvals/comms/bvals_in_one.hpp"
#include "prolong_restrict/prolong_restrict.hpp"
#include <parthenon/parthenon.hpp>
#include "utils/error_checking.hpp"
#include <parthenon/parthenon.hpp>
// AthenaPK headers
#include "../eos/adiabatic_hydro.hpp"
#include "../pgen/cluster/agn_triggering.hpp"
Expand Down Expand Up @@ -705,7 +705,7 @@ TaskCollection HydroDriver::MakeTaskCollection(BlockList_t &blocks, int stage) {
{
for (auto &pmb : blocks) {
auto &tl = sync_region_tr[0];
auto &sd = pmb->swarm_data.Get();
auto &sd = pmb->meshblock_data.Get()->GetSwarmData();
auto reset_comms =
tl.AddTask(none, &SwarmContainer::ResetCommunication, sd.get());
}
Expand All @@ -715,7 +715,7 @@ TaskCollection HydroDriver::MakeTaskCollection(BlockList_t &blocks, int stage) {
for (int n = 0; n < blocks.size(); n++) {
auto &tl = async_region_tr[n];
auto &pmb = blocks[n];
auto &sd = pmb->swarm_data.Get();
auto &sd = pmb->meshblock_data.Get()->GetSwarmData();
auto &mbd0 = pmb->meshblock_data.Get("base");
auto tracer_advect =
tl.AddTask(none, Tracers::AdvectTracers, mbd0.get(), integrator->dt);
Expand Down
3 changes: 1 addition & 2 deletions src/pgen/turbulence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ void ProblemGenerator(Mesh *pmesh, ParameterInput *pin, MeshData<Real> *md) {

for (int b = 0; b < md->NumBlocks(); b++) {
pmb = md->GetBlockData(b)->GetBlockPointer();
auto &sd = pmb->swarm_data.Get();
auto &swarm = pmb->swarm_data.Get()->Get("tracers");
auto &swarm = pmb->meshblock_data.Get()->GetSwarmData()->Get("tracers");
auto rng_pool = tracer_pkg->Param<RNGPool>("rng_pool");

const Real &x_min = pmb->coords.Xf<1>(ib.s);
Expand Down
10 changes: 5 additions & 5 deletions src/tracers/tracers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
// one, but we should check if there's direct way to access Params of other packages.
const bool mhd = pin->GetString("hydro", "fluid") == "glmmhd";

PARTHENON_REQUIRE_THROWS(pin->GetOrAddString("parthenon/mesh", "refinement", "none") ==
"none",
"Tracers/swarms currently only supported on uniform meshes.");
PARTHENON_REQUIRE_THROWS(
pin->GetString("parthenon/mesh", "refinement") != "adaptive",
"Tracers/swarms currently only supported on non-adaptive meshes.");

if (mhd) {
tracer_pkg->AddSwarmValue("B_x", swarm_name, real_swarmvalue_metadata);
Expand Down Expand Up @@ -116,7 +116,7 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {

TaskStatus AdvectTracers(MeshBlockData<Real> *mbd, const Real dt) {
auto *pmb = mbd->GetParentPointer();
auto &sd = pmb->swarm_data.Get();
auto &sd = pmb->meshblock_data.Get()->GetSwarmData();
auto &swarm = sd->Get("tracers");

auto &x = swarm->Get<Real>(swarm_position::x::name()).Get();
Expand Down Expand Up @@ -211,7 +211,7 @@ TaskStatus FillTracers(MeshData<Real> *md, parthenon::SimTime &tm) {
const auto &prim_pack = md->PackVariables(std::vector<std::string>{"prim"});
for (int b = 0; b < md->NumBlocks(); b++) {
auto *pmb = md->GetBlockData(b)->GetBlockPointer();
auto &sd = pmb->swarm_data.Get();
auto &sd = pmb->meshblock_data.Get()->GetSwarmData();
auto &swarm = sd->Get("tracers");

// TODO(pgrete) cleanup once get swarm packs (currently in development upstream)
Expand Down

0 comments on commit da769ad

Please sign in to comment.