Skip to content

Commit

Permalink
fix ICs for mag energy
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWibking committed Nov 25, 2024
1 parent 68210ae commit b1c3359
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pgen/precipitator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,7 @@ void ProblemGenerator(MeshBlock *pmb, parthenon::ParameterInput *pin) {
const Real Bx = bfield_hse(0, k, j, i);
const Real By = 0;
const Real Bz = 0;
const Real B_sq = SQR(Bx) + SQR(By) + SQR(Bz);

Real drho_over_rho = 0.0;
if (amp > 0.) {
Expand All @@ -1104,7 +1105,7 @@ void ProblemGenerator(MeshBlock *pmb, parthenon::ParameterInput *pin) {
u_dev(IM1, k, j, i) = 0.0;
u_dev(IM2, k, j, i) = 0.0;
u_dev(IM3, k, j, i) = 0.0;
u_dev(IEN, k, j, i) = P / gm1;
u_dev(IEN, k, j, i) = P / gm1 + 0.5 * B_sq; // this is the *total* energy density, including magnetic energy density
u_dev(IB1, k, j, i) = Bx;
u_dev(IB2, k, j, i) = By;
u_dev(IB3, k, j, i) = Bz;
Expand Down

0 comments on commit b1c3359

Please sign in to comment.