@@ -289,21 +289,24 @@ void EvolvePressure::finally(const Options& state) {
289289
290290 if (p_div_v) {
291291 // Use the P * Div(V) form
292- ddt (P) -= FV::Div_par_mod<hermes::Limiter>(P, V, fastest_wave, flow_ylow );
292+ 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
299300 // Note: A mixed form has been tried (on 1D neon example)
300301 // -(4/3)*FV::Div_par(P,V) + (1/3)*(V * Grad_par(P) - P * Div_par(V))
301302 // Caused heating of charged species near sheath like p_div_v
302- ddt (P) -= (5 . / 3 ) * FV::Div_par_mod<hermes::Limiter>(P, V, fastest_wave, flow_ylow );
303+ 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 }
306- flow_ylow *= 5 . / 2 ; // Energy flow
308+ flow_ylow_advection *= 5 . / 2 ; // Energy flow
309+ flow_ylow = flow_ylow_advection;
307310
308311 if (state.isSection (" fields" ) and state[" fields" ].isSet (" Apar_flutter" )) {
309312 // Magnetic flutter term
@@ -313,12 +316,12 @@ void EvolvePressure::finally(const Options& state) {
313316 }
314317
315318 if (numerical_viscous_heating || diagnose) {
316- // Viscous heating coming from numerical viscosity
319+ // Viscous heating coming from numerical viscosity from the Lax flux
317320 Field3D Nlim = softFloor (N, density_floor);
318321 const BoutReal AA = get<BoutReal>(species[" AA" ]); // Atomic mass
319- Sp_nvh = (2 . / 3 ) * AA * FV::Div_par_fvv_heating (Nlim, V, fastest_wave, flow_ylow_kinetic , fix_momentum_boundary_flux);
320- flow_ylow_kinetic *= AA;
321- flow_ylow += flow_ylow_kinetic ;
322+ Sp_nvh = (2 . / 3 ) * AA * FV::Div_par_fvv_heating (Nlim, V, fastest_wave, flow_ylow_viscous_heating , fix_momentum_boundary_flux);
323+ flow_ylow_viscous_heating *= AA;
324+ flow_ylow += flow_ylow_viscous_heating ;
322325 if (numerical_viscous_heating) {
323326 ddt (P) += Sp_nvh;
324327 }
@@ -652,6 +655,30 @@ void EvolvePressure::outputVars(Options& state) {
652655 {" species" , name},
653656 {" source" , " evolve_pressure" }});
654657
658+ if (p_div_v) {
659+
660+ set_with_attrs (state[" E" + name + " _PdivV" ], E_PdivV,
661+ {{" time_dimension" , " t" },
662+ {" units" , " W / m^-3" },
663+ {" conversion" , Pnorm * Omega_ci},
664+ {" standard_name" , " energy source" },
665+ {" long_name" , name + " energy source due to pressure gradient" },
666+ {" species" , name},
667+ {" source" , " evolve_pressure" }});
668+ } else {
669+
670+ set_with_attrs (state[" E" + name + " _VgradP" ], E_VgradP,
671+ {{" time_dimension" , " t" },
672+ {" units" , " W / m^-3" },
673+ {" conversion" , Pnorm * Omega_ci},
674+ {" standard_name" , " energy source" },
675+ {" long_name" , name + " energy source due to pressure gradient" },
676+ {" species" , name},
677+ {" source" , " evolve_pressure" }});
678+
679+ }
680+
681+
655682 if (flow_xlow.isAllocated ()) {
656683 set_with_attrs (state[fmt::format (" ef{}_tot_xlow" , name)], flow_xlow,
657684 {{" time_dimension" , " t" },
@@ -679,22 +706,34 @@ void EvolvePressure::outputVars(Options& state) {
679706 {" units" , " W" },
680707 {" conversion" , rho_s0 * SQ (rho_s0) * Pnorm * Omega_ci},
681708 {" standard_name" , " power" },
682- {" long_name" , name + " conduction through Y cell face. Note: May be incomplete. " },
709+ {" long_name" , name + " conduction through Y cell face." },
683710 {" species" , name},
684711 {" source" , " evolve_pressure" }});
685712 }
686713
687- if (flow_ylow_kinetic .isAllocated ()) {
688- set_with_attrs (state[fmt::format (" ef{}_kin_ylow " , name)], flow_ylow_kinetic ,
714+ if (flow_ylow_advection .isAllocated ()) {
715+ set_with_attrs (state[fmt::format (" ef{}_adv_ylow " , name)], flow_ylow_advection ,
689716 {{" time_dimension" , " t" },
690717 {" units" , " W" },
691718 {" conversion" , rho_s0 * SQ (rho_s0) * Pnorm * Omega_ci},
692719 {" standard_name" , " power" },
693- {" long_name" , name + " kinetic energy flow through Y cell face. Note: May be incomplete ." },
720+ {" long_name" , name + " advected energy flow through Y cell face." },
694721 {" species" , name},
695722 {" source" , " evolve_pressure" }});
696723 }
697724
725+ if (flow_ylow_viscous_heating.isAllocated ()) {
726+ set_with_attrs (state[fmt::format (" ef{}_visc_heat_ylow" , name)], flow_ylow_viscous_heating,
727+ {{" time_dimension" , " t" },
728+ {" units" , " W" },
729+ {" conversion" , rho_s0 * SQ (rho_s0) * Pnorm * Omega_ci},
730+ {" standard_name" , " power" },
731+ {" long_name" , name + " energy flow due to Lax flux numerical viscosity through Y cell face" },
732+ {" species" , name},
733+ {" source" , " evolve_pressure" }});
734+ }
735+
736+
698737 if (numerical_viscous_heating) {
699738 set_with_attrs (state[std::string (" E" ) + name + std::string (" _nvh" )], Sp_nvh * 3 /.2 ,
700739 {{" time_dimension" , " t" },
0 commit comments