Skip to content

Commit

Permalink
fix: ensure that net_field_totals reducers are created even when hydr…
Browse files Browse the repository at this point in the history
…o=false
  • Loading branch information
AstroBarker committed Dec 2, 2023
1 parent 5621d23 commit f29e0d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/fluid/fluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
physics->AddField(c::ye, mcons_scalar);
}

AllReduce<std::vector<Real>> net_field_totals;
AllReduce<std::vector<Real>> net_field_totals_2;
physics->AddParam<>("net_field_totals", net_field_totals, true);
physics->AddParam<>("net_field_totals_2", net_field_totals_2, true);

// If fluid is not active, still don't add reconstruction variables
if (!active) return physics;

Expand Down Expand Up @@ -318,11 +323,6 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
HstSum, ReduceMom, "total X" + std::to_string(d + 1) + " momentum"));
}

AllReduce<std::vector<Real>> net_field_totals;
AllReduce<std::vector<Real>> net_field_totals_2;
physics->AddParam<>("net_field_totals", net_field_totals, true);
physics->AddParam<>("net_field_totals_2", net_field_totals_2, true);

params.Add(parthenon::hist_param_key, hst_vars);

// Fill Derived and Estimate Timestep
Expand Down

0 comments on commit f29e0d2

Please sign in to comment.