Skip to content

Commit

Permalink
fix integrated tests: Check for fields subsection
Browse files Browse the repository at this point in the history
Fluid models without phi or Apar don't have a state["fields"] section
so trying to access this failed.
  • Loading branch information
bendudson committed Aug 14, 2024
1 parent b1d627f commit 6a8def9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/evolve_density.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void EvolveDensity::finally(const Options& state) {

ddt(N) -= FV::Div_par_mod<hermes::Limiter>(N, V, fastest_wave);

if (state["fields"].isSet("Apar_flutter")) {
if (state.isSection("fields") and state["fields"].isSet("Apar_flutter")) {
// Magnetic flutter term
const Field3D Apar_flutter = get<Field3D>(state["fields"]["Apar_flutter"]);
// Note: Using -Apar_flutter rather than reversing sign in front,
Expand Down
4 changes: 2 additions & 2 deletions src/evolve_energy.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ void EvolveEnergy::finally(const Options& state) {

ddt(E) -= FV::Div_par_mod<hermes::Limiter>(E + P, V, fastest_wave);

if (state["fields"].isSet("Apar_flutter")) {
if (state.isSection("fields") and state["fields"].isSet("Apar_flutter")) {
// Magnetic flutter term
const Field3D Apar_flutter = get<Field3D>(state["fields"]["Apar_flutter"]);
ddt(E) -= Div_n_g_bxGrad_f_B_XZ(E + P, V, -Apar_flutter);
Expand Down Expand Up @@ -329,7 +329,7 @@ void EvolveEnergy::finally(const Options& state) {
// is calculated and removed separately
ddt(E) += FV::Div_par_K_Grad_par(kappa_par, T, false);

if (state["fields"].isSet("Apar_flutter")) {
if (state.isSection("fields") and state["fields"].isSet("Apar_flutter")) {
// Magnetic flutter term. The operator splits into 4 pieces:
// Div(k b b.Grad(T)) = Div(k b0 b0.Grad(T)) + Div(k d0 db.Grad(T))
// + Div(k db b0.Grad(T)) + Div(k db db.Grad(T))
Expand Down
2 changes: 1 addition & 1 deletion src/evolve_momentum.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void EvolveMomentum::finally(const Options &state) {
ddt(NV) -= Grad_par(P);
}

if (state["fields"].isSet("Apar_flutter")) {
if (state.isSection("fields") and state["fields"].isSet("Apar_flutter")) {
// Magnetic flutter term
const Field3D Apar_flutter = get<Field3D>(state["fields"]["Apar_flutter"]);
ddt(NV) -= Div_n_g_bxGrad_f_B_XZ(NV, V, -Apar_flutter);
Expand Down
4 changes: 2 additions & 2 deletions src/evolve_pressure.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void EvolvePressure::finally(const Options& state) {
ddt(P) += (2. / 3) * V * Grad_par(P);
}

if (state["fields"].isSet("Apar_flutter")) {
if (state.isSection("fields") and state["fields"].isSet("Apar_flutter")) {
// Magnetic flutter term
const Field3D Apar_flutter = get<Field3D>(state["fields"]["Apar_flutter"]);
ddt(P) -= (5. / 3) * Div_n_g_bxGrad_f_B_XZ(P, V, -Apar_flutter);
Expand Down Expand Up @@ -347,7 +347,7 @@ void EvolvePressure::finally(const Options& state) {
// is calculated and removed separately
ddt(P) += (2. / 3) * FV::Div_par_K_Grad_par(kappa_par, T, false);

if (state["fields"].isSet("Apar_flutter")) {
if (state.isSection("fields") and state["fields"].isSet("Apar_flutter")) {
// Magnetic flutter term. The operator splits into 4 pieces:
// Div(k b b.Grad(T)) = Div(k b0 b0.Grad(T)) + Div(k d0 db.Grad(T))
// + Div(k db b0.Grad(T)) + Div(k db db.Grad(T))
Expand Down

0 comments on commit 6a8def9

Please sign in to comment.