Compute 1D left and right interface states using piecewise linear reconstruction and the characteristic decomposition of the quasi-linear form of the equations.
This is done by first extrapolating the cell center value to the interface using piecewise limited linear reconstruction on the characteristic variables.
Left and right states are then evolved for the half time step using characteristic tracing if necessary.
29 double **v, **vp, **vm, *dvp, *dvm, *
dx;
30 double **L, **R, *lambda;
58 #if CHAR_LIMITING == NO
61 for (i =
beg-1; i <=
end; i++){
62 for (nv =
NVAR; nv--; ){
63 dv[
i][nv] = v[i+1][nv] - v[
i][nv];
66 for (i =
beg; i <=
end; i++){
70 #if SHOCK_FLATTENING == MULTID
72 for (nv =
NVAR; nv--; ) {
73 dmm =
MINMOD(dvp[nv], dvm[nv]);
74 vp[
i][nv] = v[
i][nv] + 0.5*dmm;
75 vm[
i][nv] = v[
i][nv] - 0.5*dmm;
81 for (nv =
NVAR; nv--; ){
82 vp[
i][nv] = v[
i][nv] + 0.5*dvp[nv]*
LimO3Func(dvp[nv], dvm[nv], dx[i]);
83 vm[
i][nv] = v[
i][nv] - 0.5*dvm[nv]*
LimO3Func(dvm[nv], dvp[nv], dx[i]);
93 NVAR_LOOP(nv) dv[i][nv] = v[i+1][nv] - v[i][nv];
95 for (i =
beg; i <=
end; i++){
97 NVAR_LOOP(nv) dv[i][nv] = v[i+1][nv] - v[i][nv];
100 lambda = state->lambda[i];
113 #if SHOCK_FLATTENING == MULTID
114 if (state->
flag[i] & FLAG_MINMOD){
115 for (nv =
NVAR; nv--; ) {
116 dmm =
MINMOD(dvp[nv], dvm[nv]);
117 vp[
i][nv] = v[
i][nv] + 0.5*dmm;
118 vm[
i][nv] = v[
i][nv] - 0.5*dmm;
128 for (k =
NFLX; k--; ){
129 dwp_lim[
k] = dwp[
k]*
LimO3Func(dwp[k], dwm[k], dx[i]);
130 dwm_lim[
k] = dwm[
k]*
LimO3Func(dwm[k], dwp[k], dx[i]);
132 for (nv =
NFLX; nv--; ){
135 if (nv ==
BXn)
continue;
137 for (k =
NFLX; k--; ){
138 dvpR += dwp_lim[
k]*R[nv][
k];
139 dvmR += dwm_lim[
k]*R[nv][
k];
141 vp[
i][nv] = v[
i][nv] + 0.5*dvpR;
142 vm[
i][nv] = v[
i][nv] - 0.5*dvmR;
153 dvpR = dvp[nv]*
LimO3Func(dvp[nv], dvm[nv], dx[i]);
154 dvmR = dvm[nv]*
LimO3Func(dvm[nv], dvp[nv], dx[i]);
155 vp[
i][nv] = v[
i][nv] + 0.5*dvpR;
156 vm[
i][nv] = v[
i][nv] - 0.5*dvmR;
168 for (i = beg; i <=
end; i++){
171 if (vp[i][
RHO] < 0.0 || vm[i][
RHO] < 0.0){
178 if (vp[i][PRS] < 0.0 || vm[i][PRS] < 0.0){
179 dmm =
MINMOD(dvp[PRS], dvm[PRS]);
180 vp[
i][PRS] = v[
i][PRS] + 0.5*dmm;
181 vm[
i][PRS] = v[
i][PRS] - 0.5*dmm;
185 if (vp[i][ENTR] < 0.0 || vm[i][ENTR] < 0.0){
186 dmm =
MINMOD(dvp[ENTR], dvm[ENTR]);
187 vp[
i][ENTR] = v[
i][ENTR] + 0.5*dmm;
188 vm[
i][ENTR] = v[
i][ENTR] - 0.5*dmm;
194 #if PHYSICS == RHD || PHYSICS == RMHD
203 #if SHOCK_FLATTENING == ONED
204 Flatten (state, beg, end, grid);
212 for (i = beg - 1; i <=
end; i++) {
221 #if TIME_STEPPING == CHARACTERISTIC_TRACING
223 #elif TIME_STEPPING == HANCOCK
double ** v
Cell-centered primitive varables at the base time level, v[i] = .
void VelocityLimiter(double *, double *, double *)
void ConvertTo4vel(double **, int, int)
int end
Global end index for the local array.
void Flatten(const State_1D *, int, int, Grid *)
void PrimEigenvectors(double *q, double cs2, double h, double *lambda, double **LL, double **RR)
void CharTracingStep(const State_1D *, int, int, Grid *)
double ** vR
Primitive variables to the right of the interface, .
#define FLAG_MINMOD
Reconstruct using MINMOD limiter.
void SoundSpeed2(double **v, double *cs2, double *h, int beg, int end, int pos, Grid *grid)
double ** vp
prim vars at i+1/2 edge, vp[i] = vL(i+1/2)
int g_dir
Specifies the current sweep or direction of integration.
int beg
Global start index for the local array.
void ConvertTo3vel(double **, int, int)
void PrimToChar(double **L, double *v, double *w)
double ** vm
prim vars at i-1/2 edge, vm[i] = vR(i-1/2)
static double LimO3Func(double, double, double)
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
void PrimToCons(double **uprim, double **ucons, int ibeg, int iend)
double * bn
Face magentic field, bn = bx(i+1/2)
double ** um
same as vm, in conservative vars
double ** vL
Primitive variables to the left of the interface, .
double * a2
Sound speed squared.
double ** up
same as vp, in conservative vars
#define ARRAY_2D(nx, ny, type)
void HancockStep(const State_1D *, int, int, Grid *)