Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement reference state in MHD PLM #1021

Draft
wants to merge 95 commits into
base: development
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
a73c96f
port primtocons and prim_half to C++
zingale May 20, 2020
a958e57
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 20, 2020
1067d9e
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 21, 2020
4ac4eea
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 21, 2020
f90440b
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 21, 2020
f19a376
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale May 21, 2020
a63553f
we don't need NHYP in Fortran, so just define NUM_GROW in C++
zingale May 21, 2020
5ad38f8
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 22, 2020
ae57a16
we need 6 ghost cells for MHD + flattening
zingale May 22, 2020
1b40ecb
add comment
zingale May 22, 2020
8718d24
Merge branch 'development' into mhd_flattening
zingale May 22, 2020
ff14776
add the computation of qptot for MHD
zingale May 22, 2020
57671d9
don't let any coarse grid have < NUM_GROW cells
zingale May 22, 2020
e5ec8f4
remove debugging prints
zingale May 22, 2020
5fb18e2
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 22, 2020
3c4cb19
Merge branch 'development' into num_grow
zingale May 22, 2020
309e408
Merge branch 'num_grow' into mhd_flattening
zingale May 22, 2020
6e9b1cf
remove old headers
zingale May 22, 2020
41a769b
start working on the PLM conversion
zingale May 22, 2020
145271f
more work on the eigensystem
zingale May 22, 2020
03dd305
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale May 22, 2020
8011c33
port the eigenstuff to C++
zingale May 22, 2020
f6fec91
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 23, 2020
3839f40
Merge branch 'development' into mhd_flattening
zingale May 23, 2020
3fc63f9
Merge branch 'mhd_flattening' into mhd_plm
zingale May 23, 2020
ea27c20
remove more headers
zingale May 23, 2020
d280f6b
finish first pass
zingale May 23, 2020
1c2718a
this compiles now
zingale May 23, 2020
5c0edb5
add missing file
zingale May 23, 2020
a247579
fix index bug
zingale May 23, 2020
3f0c5d2
remove unneeded Fortran
zingale May 23, 2020
a1da931
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 23, 2020
2b7c681
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 23, 2020
d0833fb
fix some compiler warnings
zingale May 23, 2020
0c7917d
fix an index
zingale May 23, 2020
311b446
Merge branch 'mhd_plm' of github.com:zingale/Castro into mhd_plm
zingale May 23, 2020
3be7a18
fix location of qualifiers
zingale May 23, 2020
60d54ee
convert some arrays to Array1D
zingale May 23, 2020
fe46d20
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 23, 2020
2c587ac
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 23, 2020
02e1bb2
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 23, 2020
1315c10
Merge branch 'development' into mhd_plm
zingale May 23, 2020
ed28248
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale May 23, 2020
3345707
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 23, 2020
fc631c9
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 23, 2020
add7d99
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 24, 2020
1011159
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 24, 2020
7c61f5d
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 24, 2020
2fd8695
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale May 24, 2020
51dece4
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 24, 2020
230053c
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 25, 2020
855ac24
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 25, 2020
7db1f29
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 25, 2020
afebb1c
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 25, 2020
360de51
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 25, 2020
6d49d16
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 25, 2020
5c5edc4
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 25, 2020
62ab207
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 25, 2020
1acd8bb
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale May 25, 2020
b956d25
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 25, 2020
9ccb5a4
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 25, 2020
bcafc0e
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 26, 2020
52f2f66
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 26, 2020
7b2777b
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 26, 2020
d1d9283
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 26, 2020
a108ee6
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale May 26, 2020
631fa96
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 28, 2020
255b654
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 28, 2020
8179a37
Merge branch 'development' of github.com:zingale/Castro into development
zingale May 29, 2020
9bcd86b
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale May 29, 2020
dfd4ba1
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale May 30, 2020
01a2fc1
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale Jun 1, 2020
4c13af8
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale Jun 2, 2020
718f5f6
Merge branch 'development' of github.com:zingale/Castro into development
zingale Jun 3, 2020
5c356c1
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale Jun 4, 2020
f728392
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale Jun 5, 2020
0ae2d78
Merge branch 'development' of github.com:zingale/Castro into development
zingale Jun 5, 2020
284def0
Merge branch 'development' of github.com:zingale/Castro into development
zingale Jun 5, 2020
802dfd6
Merge branch 'development' into mhd_plm
zingale Jun 6, 2020
d8a3301
this implements a reference state in MHD PLM
zingale Jun 7, 2020
0ed2843
fix indexing
zingale Jun 7, 2020
e1d5da9
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale Jun 8, 2020
b72cb25
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale Jun 8, 2020
8b19e60
Merge branch 'development' of github.com:zingale/Castro into development
zingale Jun 9, 2020
60280ba
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale Jun 9, 2020
966391e
Merge branch 'development' of github.com:zingale/Castro into development
zingale Jun 10, 2020
1c0df95
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale Jun 10, 2020
0f5a6ce
Merge branch 'development' of github.com:AMReX-Astro/Castro into deve…
zingale Jun 10, 2020
3d9e0ef
Merge branch 'development' of github.com:zingale/Castro into development
zingale Jun 11, 2020
50f44b8
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale Jun 11, 2020
ce449c2
Merge branch 'development' into mhd_plm
zingale Jun 11, 2020
79a7a85
Merge branch 'development' of github.com:zingale/Castro into development
zingale Jun 12, 2020
676ff93
Merge branch 'development' of github.com:amrex-astro/Castro into deve…
zingale Jun 12, 2020
28ac10d
Merge branch 'development' into mhd_plm
zingale Jun 22, 2020
1297413
Merge branch 'development' into mhd_plm
zingale Jul 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 105 additions & 36 deletions Source/mhd/mhd_plm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,16 @@ Castro::plm(const Box& bx,

// Perform the characteristic projection. Since we are using
// Using HLLD, we sum over all eigenvalues -- see the discussion after Eq. 31
Real summ_p[NEIGN] = {0.0_rt};
Real summ_m[NEIGN] = {0.0_rt};

// We'll follow the method from Colella 1990 (as also written in Stone 2008)
// where we first compute a reference state using the fastest moving eigenvalue
// toward the interface and the project the difference of the waves from that

// compute the limited primitive variable slopes where we limit on
// the characteristic variables. Note, we need this final result
// ahead of time to compute the reference states

Real dq_lim[NEIGN] = {};
for (int ii = 0; ii < NEIGN; ii++) {
Real dL = 0.0;
Real dR = 0.0;
Expand All @@ -184,75 +191,137 @@ Castro::plm(const Box& bx,
slope(dW, dL, dR, flatn(i,j,k));

for (int n = 0; n < NEIGN; n++) {
summ_p[n] += (1.0_rt - dtdx * lam(ii)) * dW * reig(n,ii);
summ_m[n] -= (1.0_rt + dtdx * lam(ii)) * dW * reig(n,ii);
dq_lim[n] += dW * reig(n,ii);
}
}


Real q_ref_left[NEIGN];
Real ref_term = 0.5_rt * (1.0_rt - amrex::max(lam(NEIGN-1), 0.0_rt) * dtdx);

q_ref_left[IEIGN_RHO] = q_zone(QRHO) + ref_term * dq_lim[QRHO];
q_ref_left[IEIGN_U] = q_zone(QU) + ref_term * dq_lim[QU];
q_ref_left[IEIGN_V] = q_zone(QV) + ref_term * dq_lim[QV];
q_ref_left[IEIGN_W] = q_zone(QW) + ref_term * dq_lim[QW];
q_ref_left[IEIGN_P] = q_zone(QPRES) + ref_term * dq_lim[QPRES];
if (idir == 0) {
q_ref_left[IEIGN_BT] = q_zone(QMAGY) + ref_term * dq_lim[IEIGN_BT];
q_ref_left[IEIGN_BTT] = q_zone(QMAGZ) + ref_term * dq_lim[IEIGN_BTT];

} else if (idir == 1) {
q_ref_left[IEIGN_BT] = q_zone(QMAGX) + ref_term * dq_lim[IEIGN_BT];
q_ref_left[IEIGN_BTT] = q_zone(QMAGZ) + ref_term * dq_lim[IEIGN_BTT];

} else if (idir == 2) {
q_ref_left[IEIGN_BT] = q_zone(QMAGX) + ref_term * dq_lim[IEIGN_BT];
q_ref_left[IEIGN_BTT] = q_zone(QMAGY) + ref_term * dq_lim[IEIGN_BTT];

}

Real q_ref_right[NEIGN];
// note: Stone et al. 2008 Eq. 41 has a sign error, compare to
// Colella 1990 Eq. 2.11
ref_term = 0.5_rt * (1.0_rt + amrex::min(lam(0), 0.0_rt) * dtdx);

q_ref_right[IEIGN_RHO] = q_zone(QRHO) - ref_term * dq_lim[QRHO];
q_ref_right[IEIGN_U] = q_zone(QU) - ref_term * dq_lim[QU];
q_ref_right[IEIGN_V] = q_zone(QV) - ref_term * dq_lim[QV];
q_ref_right[IEIGN_W] = q_zone(QW) - ref_term * dq_lim[QW];
q_ref_right[IEIGN_P] = q_zone(QPRES) - ref_term * dq_lim[QPRES];
if (idir == 0) {
q_ref_right[IEIGN_BT] = q_zone(QMAGY) - ref_term * dq_lim[IEIGN_BT];
q_ref_right[IEIGN_BTT] = q_zone(QMAGZ) - ref_term * dq_lim[IEIGN_BTT];

} else if (idir == 1) {
q_ref_right[IEIGN_BT] = q_zone(QMAGX) - ref_term * dq_lim[IEIGN_BT];
q_ref_right[IEIGN_BTT] = q_zone(QMAGZ) - ref_term * dq_lim[IEIGN_BTT];

} else if (idir == 2) {
q_ref_right[IEIGN_BT] = q_zone(QMAGX) - ref_term * dq_lim[IEIGN_BT];
q_ref_right[IEIGN_BTT] = q_zone(QMAGY) - ref_term * dq_lim[IEIGN_BTT];

}

Real summ_p[NEIGN] = {0.0_rt};
Real summ_m[NEIGN] = {0.0_rt};

for (int ii = 0; ii < NEIGN; ii++) {
Real Ldq = 0.0;

for (int n = 0; n < NEIGN; n++) {
Ldq += leig(ii,n) * dq_lim[n];
}

for (int n = 0; n < NEIGN; n++) {
summ_p[n] += 0.5_rt * dtdx * (lam(NEIGN-1) - lam(ii)) * Ldq * reig(n,ii);
summ_m[n] += 0.5_rt * dtdx * (lam(0) - lam(ii)) * Ldq * reig(n,ii);
}
}

// left state at i+1/2

if (idir == 0) {
qleft(i+1,j,k,QRHO) = amrex::max(small_dens,
q_zone(QRHO) + 0.5_rt*summ_p[IEIGN_RHO] + 0.5_rt*dt*smhd[IEIGN_RHO]);
qleft(i+1,j,k,QU) = q_zone(QU) + 0.5_rt*summ_p[IEIGN_U] + 0.5_rt*dt*smhd[IEIGN_U];
qleft(i+1,j,k,QV) = q_zone(QV) + 0.5_rt*summ_p[IEIGN_V] + 0.5_rt*dt*smhd[IEIGN_V];
qleft(i+1,j,k,QW) = q_zone(QW) + 0.5_rt*summ_p[IEIGN_W] + 0.5_rt*dt*smhd[IEIGN_W];
q_ref_left[IEIGN_RHO] + summ_p[IEIGN_RHO] + 0.5_rt*dt*smhd[IEIGN_RHO]);
qleft(i+1,j,k,QU) = q_ref_left[IEIGN_U] + summ_p[IEIGN_U] + 0.5_rt*dt*smhd[IEIGN_U];
qleft(i+1,j,k,QV) = q_ref_left[IEIGN_V] + summ_p[IEIGN_V] + 0.5_rt*dt*smhd[IEIGN_V];
qleft(i+1,j,k,QW) = q_ref_left[IEIGN_W] + summ_p[IEIGN_W] + 0.5_rt*dt*smhd[IEIGN_W];
qleft(i+1,j,k,QPRES) = amrex::max(small_pres,
q_zone(QPRES) + 0.5_rt*summ_p[IEIGN_P] + 0.5_rt*dt*smhd[IEIGN_P]);
q_ref_left[IEIGN_P] + summ_p[IEIGN_P] + 0.5_rt*dt*smhd[IEIGN_P]);

qleft(i+1,j,k,QMAGX) = Bx(i+1,j,k); // Bx stuff
qleft(i+1,j,k,QMAGY) = q_zone(QMAGY) + 0.5_rt*summ_p[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qleft(i+1,j,k,QMAGZ) = q_zone(QMAGZ) + 0.5_rt*summ_p[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];
qleft(i+1,j,k,QMAGY) = q_ref_left[IEIGN_BT] + summ_p[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qleft(i+1,j,k,QMAGZ) = q_ref_left[IEIGN_BTT] + summ_p[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];

} else if (idir == 1) {
qleft(i,j+1,k,QRHO) = amrex::max(small_dens,
q_zone(QRHO) + 0.5_rt*summ_p[IEIGN_RHO] + 0.5_rt*dt*smhd[IEIGN_RHO]);
qleft(i,j+1,k,QU) = q_zone(QU) + 0.5_rt*summ_p[IEIGN_U] + 0.5_rt*dt*smhd[IEIGN_U];
qleft(i,j+1,k,QV) = q_zone(QV) + 0.5_rt*summ_p[IEIGN_V] + 0.5_rt*dt*smhd[IEIGN_V];
qleft(i,j+1,k,QW) = q_zone(QW) + 0.5_rt*summ_p[IEIGN_W] + 0.5_rt*dt*smhd[IEIGN_W];
q_ref_left[IEIGN_RHO] + summ_p[IEIGN_RHO] + 0.5_rt*dt*smhd[IEIGN_RHO]);
qleft(i,j+1,k,QU) = q_ref_left[IEIGN_U] + summ_p[IEIGN_U] + 0.5_rt*dt*smhd[IEIGN_U];
qleft(i,j+1,k,QV) = q_ref_left[IEIGN_V] + summ_p[IEIGN_V] + 0.5_rt*dt*smhd[IEIGN_V];
qleft(i,j+1,k,QW) = q_ref_left[IEIGN_W] + summ_p[IEIGN_W] + 0.5_rt*dt*smhd[IEIGN_W];
qleft(i,j+1,k,QPRES) = amrex::max(small_pres,
q_zone(QPRES) + 0.5_rt*summ_p[IEIGN_P] + 0.5_rt*dt*smhd[IEIGN_P]);
q_ref_left[IEIGN_P] + summ_p[IEIGN_P] + 0.5_rt*dt*smhd[IEIGN_P]);

qleft(i,j+1,k,QMAGX) = q_zone(QMAGX) + 0.5_rt*summ_p[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qleft(i,j+1,k,QMAGX) = q_ref_left[IEIGN_BT] + summ_p[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qleft(i,j+1,k,QMAGY) = By(i,j+1,k); // By stuff
qleft(i,j+1,k,QMAGZ) = q_zone(QMAGZ) + 0.5_rt*summ_p[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];
qleft(i,j+1,k,QMAGZ) = q_ref_left[IEIGN_BTT] + summ_p[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];

} else {
qleft(i,j,k+1,QRHO) = amrex::max(small_dens,
q_zone(QRHO) + 0.5_rt*summ_p[IEIGN_RHO] + 0.5_rt*dt*smhd[IEIGN_RHO]);
qleft(i,j,k+1,QU) = q_zone(QU) + 0.5_rt*summ_p[IEIGN_U] + 0.5_rt*dt*smhd[IEIGN_U];
qleft(i,j,k+1,QV) = q_zone(QV) + 0.5_rt*summ_p[IEIGN_V] + 0.5_rt*dt*smhd[IEIGN_V];
qleft(i,j,k+1,QW) = q_zone(QW) + 0.5_rt*summ_p[IEIGN_W] + 0.5_rt*dt*smhd[IEIGN_W];
q_ref_left[IEIGN_RHO] + summ_p[IEIGN_RHO] + 0.5_rt*dt*smhd[IEIGN_RHO]);
qleft(i,j,k+1,QU) = q_ref_left[IEIGN_U] + summ_p[IEIGN_U] + 0.5_rt*dt*smhd[IEIGN_U];
qleft(i,j,k+1,QV) = q_ref_left[IEIGN_V] + summ_p[IEIGN_V] + 0.5_rt*dt*smhd[IEIGN_V];
qleft(i,j,k+1,QW) = q_ref_left[IEIGN_W] + summ_p[IEIGN_W] + 0.5_rt*dt*smhd[IEIGN_W];
qleft(i,j,k+1,QPRES) = amrex::max(small_pres,
q_zone(QPRES) + 0.5_rt*summ_p[IEIGN_P] + 0.5_rt*dt*smhd[IEIGN_P]);
q_ref_left[IEIGN_P] + summ_p[IEIGN_P] + 0.5_rt*dt*smhd[IEIGN_P]);

qleft(i,j,k+1,QMAGX) = q_zone(QMAGX) + 0.5_rt*summ_p[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qleft(i,j,k+1,QMAGY) = q_zone(QMAGY) + 0.5_rt*summ_p[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];
qleft(i,j,k+1,QMAGX) = q_ref_left[IEIGN_BT] + summ_p[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qleft(i,j,k+1,QMAGY) = q_ref_left[IEIGN_BTT] + summ_p[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];
qleft(i,j,k+1,QMAGZ) = Bz(i,j,k+1); // Bz stuff
}

// right state at i-1/2
qright(i,j,k,QRHO) = amrex::max(small_dens,
q_zone(QRHO) + 0.5_rt*summ_m[IEIGN_RHO] + 0.5_rt*dt*smhd[IEIGN_RHO]);
qright(i,j,k,QU) = q_zone(QU) + 0.5_rt*summ_m[IEIGN_U] + 0.5_rt*dt*smhd[IEIGN_U];
qright(i,j,k,QV) = q_zone(QV) + 0.5_rt*summ_m[IEIGN_V] + 0.5_rt*dt*smhd[IEIGN_V];
qright(i,j,k,QW) = q_zone(QW) + 0.5_rt*summ_m[IEIGN_W] + 0.5_rt*dt*smhd[IEIGN_W];
q_ref_right[IEIGN_RHO] + summ_m[IEIGN_RHO] + 0.5_rt*dt*smhd[IEIGN_RHO]);
qright(i,j,k,QU) = q_ref_right[IEIGN_U] + summ_m[IEIGN_U] + 0.5_rt*dt*smhd[IEIGN_U];
qright(i,j,k,QV) = q_ref_right[IEIGN_V] + summ_m[IEIGN_V] + 0.5_rt*dt*smhd[IEIGN_V];
qright(i,j,k,QW) = q_ref_right[IEIGN_W] + summ_m[IEIGN_W] + 0.5_rt*dt*smhd[IEIGN_W];
qright(i,j,k,QPRES) = amrex::max(small_pres,
q_zone(QPRES) + 0.5_rt*summ_m[IEIGN_P] + 0.5_rt*dt*smhd[IEIGN_P]);
q_ref_right[IEIGN_P] + summ_m[IEIGN_P] + 0.5_rt*dt*smhd[IEIGN_P]);

if (idir == 0) {
qright(i,j,k,QMAGX) = Bx(i,j,k); // Bx stuff
qright(i,j,k,QMAGY) = q_zone(QMAGY) + 0.5_rt*summ_m[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qright(i,j,k,QMAGZ) = q_zone(QMAGZ) + 0.5_rt*summ_m[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];
qright(i,j,k,QMAGY) = q_ref_right[IEIGN_BT] + summ_m[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qright(i,j,k,QMAGZ) = q_ref_right[IEIGN_BTT] + summ_m[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];

} else if (idir == 1) {
qright(i,j,k,QMAGX) = q_zone(QMAGX) + 0.5_rt*summ_m[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qright(i,j,k,QMAGX) = q_ref_right[IEIGN_BT] + summ_m[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qright(i,j,k,QMAGY) = By(i,j,k); // By stuff
qright(i,j,k,QMAGZ) = q_zone(QMAGZ) + 0.5_rt*summ_m[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];
qright(i,j,k,QMAGZ) = q_ref_right[IEIGN_BTT] + summ_m[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];

} else {
qright(i,j,k,QMAGX) = q_zone(QMAGX) + 0.5_rt*summ_m[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qright(i,j,k,QMAGY) = q_zone(QMAGY) + 0.5_rt*summ_m[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];
qright(i,j,k,QMAGX) = q_ref_right[IEIGN_BT] + summ_m[IEIGN_BT] + 0.5_rt*dt*smhd[IEIGN_BT];
qright(i,j,k,QMAGY) = q_ref_right[IEIGN_BTT] + summ_m[IEIGN_BTT] + 0.5_rt*dt*smhd[IEIGN_BTT];
qright(i,j,k,QMAGZ) = Bz(i,j,k); // Bz stuff
}

Expand Down