55 int nv, dir, beg_dir, end_dir;
58 static double ***
T, ***C_dt[
NVAR], **dcoeff;
63 #if DIMENSIONAL_SPLITTING == YES
64 beg_dir = end_dir =
g_dir;
78 #if (PARABOLIC_FLUX & EXPLICIT)
93 #if DIMENSIONAL_SPLITTING == NO
94 if (C_dt[
RHO] == NULL){
102 memset ((
void *)C_dt[nv][k][j],
'\0',
NX1_TOT*
sizeof(
double));
111 #if (RESISTIVITY == EXPLICIT) && (defined STAGGERED_MHD)
119 #if THERMAL_CONDUCTION == EXPLICIT
128 for (dir = beg_dir; dir <= end_dir; dir++){
134 #if (RESISTIVITY == EXPLICIT) && !(defined STAGGERED_MHD)
140 for ((*ip) = 0; (*ip) < indx.
ntot; (*ip)++) {
149 Riemann (&state, indx.
beg - 1, indx.
end, Dts->
cmax, grid);
153 #if (PARABOLIC_FLUX & EXPLICIT)
156 #if UPDATE_VECTOR_POTENTIAL == YES
167 for ((*ip) = indx.
beg; (*ip) <= indx.
end; (*ip)++) {
172 for ((*ip) = indx.
beg; (*ip) <= indx.
end; (*ip)++) {
182 for ((*ip) = indx.
beg; (*ip) <= indx.
end; (*ip)++) {
183 #if DIMENSIONAL_SPLITTING == NO
186 C_dt[0][
k][
j][
i] += 0.5*( Dts->
cmax[(*ip)-1]
187 + Dts->
cmax[*ip])*inv_dl[*ip];
189 #if (PARABOLIC_FLUX & EXPLICIT)
190 dl2 = 0.5*inv_dl[*ip]*inv_dl[*ip];
192 C_dt[nv][
k][
j][
i] += (dcoeff[*ip][nv]+dcoeff[(*ip)-1][nv])*dl2;
196 #elif DIMENSIONAL_SPLITTING == YES
201 #if (PARABOLIC_FLUX & EXPLICIT)
202 dl2 = inv_dl[*ip]*inv_dl[*ip];
216 #if (ENTROPY_SWITCH) && (RESISTIVITY == EXPLICIT)
228 #if DIMENSIONAL_SPLITTING == YES
244 #if (PARABOLIC_FLUX & EXPLICIT)
254 #if (PARABOLIC_FLUX & EXPLICIT)
263 int beg,
int end,
Grid *grid)
270 int i,
j,
k, nv, *in;
274 double wflux, r, area;
276 for (i = beg; i <= end; i++) state->
flux[i][
MXn] += state->
press[i];
279 if ((
g_dir ==
IDIR) && (g_stretch_fact != 1.)) {
280 for (i = beg; i <= end; i++) {
281 NVAR_LOOP(nv) state->flux[i][nv] *= g_stretch_fact;
284 #if (CH_SPACEDIM == 3)
285 if ((
g_dir ==
JDIR) && (g_x3stretch != 1.)) {
286 for (i = beg; i <= end; i++) {
287 NVAR_LOOP(nv) state->flux[i][nv] *= g_x3stretch;
291 for (i = beg; i <= end; i++) {
292 NVAR_LOOP(nv) state->flux[i][nv] *= g_x2stretch;
298 #if GEOMETRY == CYLINDRICAL
300 for (i = beg; i <= end; i++) {
304 state->
flux[
i][nv] *= g_x2stretch;
309 area = fabs(grid[
IDIR].x[
g_i]);
310 for (i = beg; i <= end; i++) {
311 NVAR_LOOP(nv) state->flux[i][nv] *= area;
316 #if GEOMETRY == SPHERICAL
324 for (i = beg; i <= end; i++) {
328 state->
flux[
i][nv] *= area;
331 #if (COMPONENTS == 3) && CHOMBO_CONS_AM
337 area = fabs(grid[
IDIR].x[
g_i]);
338 #if CHOMBO_LOGR == YES
344 for (i = beg; i <= end; i++) {
348 #if (COMPONENTS == 3) && CHOMBO_CONS_AM
354 for (i = beg; i <= end; i++) {
355 area = g_x2stretch* fabs(grid[
IDIR].x[
g_i]);
356 #if CHOMBO_LOGR == YES
360 state->
flux[
i][nv] *= area;
362 #if (COMPONENTS == 3) && CHOMBO_CONS_AM
369 #if GEOMETRY == POLAR
371 for (i = beg; i <= end; i++) {
375 state->
flux[
i][nv] *= g_x2stretch;
378 state->
flux[
i][nv] *= g_x3stretch;
381 #if (COMPONENTS > 1) && CHOMBO_CONS_AM
388 #if CHOMBO_LOGR == YES
395 for (i = beg; i <= end; i++) {
397 state->
flux[
i][nv] *= area;
401 #if (COMPONENTS > 1) && CHOMBO_CONS_AM
406 for (i = beg; i <= end; i++) {
407 area = g_x2stretch*fabs(grid[
IDIR].x[
g_i]);
408 #if CHOMBO_LOGR == YES
412 state->
flux[
i][nv] *= area;
414 #if (COMPONENTS > 1) && CHOMBO_CONS_AM
431 #if TIME_STEPPING == RK2
442 for ((*in) = beg; (*in) <= end; (*in)++) {
443 #if HAVE_ENERGY && ENTROPY_SWITCH
444 state->
flux[*in][ENTR] = 0.0;
447 indf = nv*nzf*nyf*nxf + (k - nzb)*nyf*nxf + (j - nyb)*nxf + (i - nxb);
448 aflux[
g_dir][indf] = wflux*state->
flux[(*in)][nv];
466 #if VISCOSITY == EXPLICIT
469 #if RESISTIVITY == EXPLICIT
474 #if THERMAL_CONDUCTION == EXPLICIT
static void SaveAMRFluxes(const State_1D *, double **, int, int, Grid *)
void CT_StoreEMF(const State_1D *state, int beg, int end, Grid *grid)
double ** v
Cell-centered primitive varables at the base time level, v[i] = .
double **** Vs
The main four-index data array used for face-centered staggered magnetic fields.
void ResetState(const Data *, State_1D *, Grid *)
void EntropyOhmicHeating(const Data *, Data_Arr, double, Grid *)
double **** J
Electric current defined as curl(B).
void GetCurrent(const Data *d, int dir, Grid *grid)
double ** flux
upwind flux computed with the Riemann solver
void Riemann_Solver(const State_1D *, int, int, double *, Grid *)
double ** rhs
Conservative right hand side.
void States(const State_1D *, int, int, Grid *)
int g_intStage
Gives the current integration stage of the time stepping method (predictor = 0, 1st corrector = 1...
double **** Vc
The main four-index data array used for cell-centered primitive variables.
int lbeg
Local start index for the local array.
double * GetInverse_dl(const Grid *)
void SB_CorrectFluxes(Data_Arr U, double t, double dt, Grid *grid)
void CT_Update(const Data *d, Data_Arr Bs, double dt, Grid *grid)
#define ARRAY_3D(nx, ny, nz, type)
double * cmax
Maximum signal velocity for hyperbolic eqns.
#define FOR_EACH(nv, beg, list)
unsigned char *** flag
Pointer to a 3D array setting useful integration flags that are retrieved during integration.
int nvar
Number of variables.
void MakeState(State_1D *)
double inv_dtp
Inverse of diffusion (parabolic) time step .
double inv_dta
Inverse of advection (hyperbolic) time step, .
int g_i
x1 grid index when sweeping along the x2 or x3 direction.
int CheckNaN(double **, int, int, int)
#define TOT_LOOP(k, j, i)
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.
long int IEND
Upper grid index of the computational domain in the the X1 direction for the local processor...
void SetIndexes(Index *indx, Grid *grid)
void RightHandSide(const State_1D *state, Time_Step *Dts, int beg, int end, double dt, Grid *grid)
int g_k
x3 grid index when sweeping along the x1 or x2 direction.
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
int indx[2046]
Array of integers containg variables indices.
double * bn
Face magentic field, bn = bx(i+1/2)
void SB_SaveFluxes(State_1D *state, Grid *grid)
void ParabolicFlux(Data_Arr V, Data_Arr J, double ***T, const State_1D *state, double **dcoeff, int beg, int end, Grid *grid)
double * press
Upwind pressure term computed with the Riemann solver.
long int KBEG
Lower grid index of the computational domain in the the X3 direction for the local processor...
#define ARRAY_2D(nx, ny, type)
static intList TimeStepIndexList()
long int KEND
Upper grid index of the computational domain in the the X3 direction for the local processor...
void VectorPotentialUpdate(const Data *d, const void *vp, const State_1D *state, const Grid *grid)
long int JBEG
Lower grid index of the computational domain in the the X2 direction for the local processor...
void UpdateStage(const Data *d, Data_Arr UU, double **aflux, Riemann_Solver *Riemann, double dt, Time_Step *Dts, Grid *grid)
long int JEND
Upper grid index of the computational domain in the the X2 direction for the local processor...
#define TRANSVERSE_LOOP(indx, ip, i, j, k)
long int NX1_TOT
Total number of zones in the X1 direction (boundaries included) for the local processor.
long int IBEG
Lower grid index of the computational domain in the the X1 direction for the local processor...
double * A
Right interface area, A[i] = .
int np_int
Total number of points in the local domain (boundaries excluded).