3 #if DIVB_CONTROL == EIGHT_WAVES
22 for (i = is; i <= ie; i++) {
29 (state->
vR[i - 1][
BXn] + state->
vL[i - 1][
BXn])*GG->
A[i - 1];
33 divB /= 2.0*GG->
dV[
i];
39 EXPAND (state->
src[i][
MX1] = -divB*(vc[BX1]*g_2 + vB*vc[VX1]); ,
40 state->
src[i][
MX2] = -divB*(vc[BX2]*g_2 + vB*vc[VX2]); ,
41 state->
src[i][
MX3] = -divB*(vc[BX3]*g_2 + vB*vc[VX3]);)
43 state->
src[
i][ENG] = -divB*vB;
45 EXPAND (state->
src[i][BX1] = -divB*vc[VX1]; ,
46 state->
src[i][BX2] = -divB*vc[VX2]; ,
47 state->
src[i][BX3] = -divB*vc[VX3];)
70 double vc[
NVAR], *A, *src, *vm;
72 static double *
divB, *vp;
88 for (i = beg - 1; i <= end; i++) {
98 #if GEOMETRY == CARTESIAN
100 for (i = beg; i <= end; i++) {
101 divB[
i] = (vp[
i] - vm[
i])/GG->
dx[i];
104 #elif GEOMETRY == CYLINDRICAL
107 for (i = beg; i <= end; i++) {
108 divB[
i] = (vp[
i]*A[
i] - vm[
i]*A[i - 1])/GG->
dV[i];
110 }
else if (g_dir ==
JDIR){
111 for (i = beg; i <= end; i++) {
112 divB[
i] = (vp[
i] - vm[
i])/GG->
dx[i];
116 #elif GEOMETRY == POLAR
120 for (i = beg; i <= end; i++) {
121 divB[
i] = (vp[
i]*A[
i] - vm[
i]*A[i - 1])/GG->
dV[i];
123 }
else if (g_dir ==
JDIR){
125 for (i = beg; i <= end; i++) {
126 divB[
i] = (vp[
i] - vm[
i])/(r*GG->
dx[i]);
128 }
else if (g_dir ==
KDIR){
129 for (i = beg; i <= end; i++) {
130 divB[
i] = (vp[
i] - vm[
i])/GG->
dx[i];
134 #elif GEOMETRY == SPHERICAL
137 for (i = beg; i <= end; i++) {
138 divB[
i] = (vp[
i]*A[
i] - vm[
i]*A[i - 1])/GG->
dV[i];
140 }
else if (g_dir ==
JDIR){
142 for (i = beg; i <= end; i++) {
143 divB[
i] = (vp[
i]*A[
i] - vm[
i]*A[i - 1])/(r*GG->
dV[i]);
145 }
else if (g_dir ==
KDIR){
148 for (i = beg; i <= end; i++) {
149 divB[
i] = (vp[
i] - vm[
i])/(r*s*GG->
dx[i]);
159 for (i = beg; i <= end; i++) {
162 for (nv =
NFLX; nv--; ) vc[nv] = state->
vh[i][nv];
166 EXPAND(src[
MX1] = 0.0; ,
170 EXPAND(src[BX1] = -vc[
VX1]*divB[i]; ,
double ** vh
Primitive state at n+1/2 (only for one step method)
double ** flux
upwind flux computed with the Riemann solver
void HLL_DIVB_SOURCE(const State_1D *state, double **Uhll, int beg, int end, Grid *grid)
void POWELL_DIVB_SOURCE(const State_1D *state, int is, int ie, Grid *grid)
double ** vR
Primitive variables to the right of the interface, .
int g_i
x1 grid index when sweeping along the x2 or x3 direction.
int g_dir
Specifies the current sweep or direction of integration.
int g_j
x2 grid index when sweeping along the x1 or x3 direction.
#define ARRAY_1D(nx, type)
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
double ** vL
Primitive variables to the left of the interface, .
double * A
Right interface area, A[i] = .