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.
Compute states using piecewise linear interpolation.
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.
24 double **v, **vp, **vm, *dvp, *dvm, *
dx;
25 double **Lv, **Rv, *lambda;
26 double *R, *L, *P, *M;
27 double b0, S0, wp, tau;
32 static double **Rg, **Lg, **Pg, **Mg;
64 #if CHAR_LIMITING == NO
67 for (i =
beg-1; i <=
end; i++){
68 for (nv =
NVAR; nv--; ){
69 dv[
i][nv] = v[i+1][nv] - v[
i][nv];
72 for (i =
beg; i <=
end; i++){
76 #if SHOCK_FLATTENING == MULTID
78 for (nv =
NVAR; nv--; ) {
79 dmm =
MINMOD(dvp[nv], dvm[nv]);
80 vp[
i][nv] = v[
i][nv] + 0.5*dmm;
81 vm[
i][nv] = v[
i][nv] - 0.5*dmm;
88 for (nv = 0; nv <
NVAR; nv++){
89 b0 = dvp[nv]*dvp[nv] + dx2;
90 b1 = dvm[nv]*dvm[nv] + dx2;
92 tau = dvp[nv] - dvm[nv];
104 vp[
i][nv] = v[
i][nv] + (S0*R[
i]*dvp[nv] + P[
i]*S1*R[i-1]*dvm[nv])
106 vm[
i][nv] = v[
i][nv] - (M[
i]*S0*L[
i]*dvp[nv] + S1*L[i-1]*dvm[nv])
118 for (nv =
NVAR; nv--; ) dv[i][nv] = v[i+1][nv] - v[i][nv];
120 for (i =
beg; i <=
end; i++){
122 NVAR_LOOP(nv) dv[i][nv] = v[i+1][nv] - v[i][nv];
126 lambda = state->lambda[i];
139 #if SHOCK_FLATTENING == MULTID
140 if (state->
flag[i] & FLAG_MINMOD){
141 for (nv =
NVAR; nv--; ) {
142 dmm =
MINMOD(dvp[nv], dvm[nv]);
143 vp[
i][nv] = v[
i][nv] + 0.5*dmm;
144 vm[
i][nv] = v[
i][nv] - 0.5*dmm;
151 for (k =
NVAR; k--; ){
152 b0 = dwp[
k]*dwp[
k] + dx2;
153 b1 = dwm[
k]*dwm[
k] + dx2;
155 tau = dwp[
k] - dwm[
k];
161 dwp_lim[
k] = (S0*dwp[
k] + 0.5*S1*dwm[
k])/(2.0*S0 + S1);
162 dwm_lim[
k] = (S1*dwm[
k] + 0.5*S0*dwp[
k])/(2.0*S1 + S0);
169 for (nv =
NFLX; nv--; ){
172 if (nv ==
BXn)
continue;
174 for (k =
NFLX; k--; ){
175 dvpR += dwp_lim[
k]*Rv[nv][
k];
176 dvmR += dwm_lim[
k]*Rv[nv][
k];
178 vp[
i][nv] = v[
i][nv] + dvpR;
179 vm[
i][nv] = v[
i][nv] - dvmR;
191 vp[
i][nv] = v[
i][nv] + dwp_lim[nv];
192 vm[
i][nv] = v[
i][nv] - dwm_lim[nv];
204 for (i =
beg; i <=
end; i++){
207 if (vp[i][
RHO] < 0.0 || vm[i][
RHO] < 0.0){
208 for (nv =
NFLX; nv--; ){
216 if (vp[i][PRS] < 0.0 || vm[i][PRS] < 0.0){
217 for (nv =
NFLX; nv--; ){
218 dmm =
MINMOD(dvp[PRS], dvm[PRS]);
219 vp[
i][PRS] = v[
i][PRS] + 0.5*dmm;
220 vm[
i][PRS] = v[
i][PRS] - 0.5*dmm;
225 if (vp[i][ENTR] < 0.0 || vm[i][ENTR] < 0.0){
226 dmm =
MINMOD(dvp[ENTR], dvm[ENTR]);
227 vp[
i][ENTR] = v[
i][ENTR] + 0.5*dmm;
228 vm[
i][ENTR] = v[
i][ENTR] - 0.5*dmm;
234 #if PHYSICS == RHD || PHYSICS == RMHD
244 #if SHOCK_FLATTENING == ONED
253 for (i =
beg - 1; i <=
end; i++) {
262 #if TIME_STEPPING == CHARACTERISTIC_TRACING
264 #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.
static void WENO3_COEFF(double **, double **, double **, double **, Grid *)
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)
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 *)