Skip to content

Commit 5e32dae

Browse files
committed
Add diagnostic for gradP term in P eqn
1 parent b021a7d commit 5e32dae

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

include/evolve_pressure.hxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ private:
122122
bool numerical_viscous_heating; ///< Include heating due to numerical viscosity?
123123
bool fix_momentum_boundary_flux; ///< Fix momentum flux to boundary condition?
124124
Field3D Sp_nvh; ///< Pressure source due to artificial viscosity
125+
Field3D E_PdivV, E_VgradP; ///< Diagnostic energy source terms for p*Div(V) and V*Grad(P)
125126
};
126127

127128
namespace {

src/evolve_pressure.cxx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ void EvolvePressure::finally(const Options& state) {
292292
ddt(P) -= FV::Div_par_mod<hermes::Limiter>(P, V, fastest_wave, flow_ylow_advection);
293293

294294
// Work done. This balances energetically a term in the momentum equation
295-
ddt(P) -= (2. / 3) * Pfloor * Div_par(V);
295+
E_PdivV = -Pfloor * Div_par(V);
296+
ddt(P) += (2. / 3) * E_PdivV;
296297

297298
} else {
298299
// Use V * Grad(P) form
@@ -301,7 +302,8 @@ void EvolvePressure::finally(const Options& state) {
301302
// Caused heating of charged species near sheath like p_div_v
302303
ddt(P) -= (5. / 3) * FV::Div_par_mod<hermes::Limiter>(P, V, fastest_wave, flow_ylow_advection);
303304

304-
ddt(P) += (2. / 3) * V * Grad_par(P);
305+
E_VgradP = V * Grad_par(P);
306+
ddt(P) += (2. / 3) * E_VgradP;
305307
}
306308
flow_ylow_advection *= 5. / 2; // Energy flow
307309
flow_ylow = flow_ylow_advection;
@@ -651,6 +653,30 @@ void EvolvePressure::outputVars(Options& state) {
651653
{"species", name},
652654
{"source", "evolve_pressure"}});
653655

656+
if (p_div_v) {
657+
658+
set_with_attrs(state["E" + name + "_PdivV"], E_PdivV,
659+
{{"time_dimension", "t"},
660+
{"units", "W / m^-3"},
661+
{"conversion", Pnorm * Omega_ci},
662+
{"standard_name", "energy source"},
663+
{"long_name", name + " energy source due to pressure gradient"},
664+
{"species", name},
665+
{"source", "evolve_pressure"}});
666+
} else {
667+
668+
set_with_attrs(state["E" + name + "_VgradP"], E_VgradP,
669+
{{"time_dimension", "t"},
670+
{"units", "W / m^-3"},
671+
{"conversion", Pnorm * Omega_ci},
672+
{"standard_name", "energy source"},
673+
{"long_name", name + " energy source due to pressure gradient"},
674+
{"species", name},
675+
{"source", "evolve_pressure"}});
676+
677+
}
678+
679+
654680
if (flow_xlow.isAllocated()) {
655681
set_with_attrs(state[fmt::format("ef{}_tot_xlow", name)], flow_xlow,
656682
{{"time_dimension", "t"},

0 commit comments

Comments
 (0)