44 #ifndef TC_SATURATED_FLUX
47 #define TC_SATURATED_FLUX YES
54 #define HYPERBOLIC_SAT_FLUX YES
58 double **dcoeff,
int beg,
int end,
Grid *grid)
75 double bgradT, Bmag, dTmag;
76 double Fc, Fcmag, Fsat, g1 =
g_gamma - 1.0;
78 double alpha, uL, uR, suL, suR, bn;
79 double vi[
NVAR], kpar=0.0, knor=0.0, phi;
81 static double **gradT;
101 for (i = beg; i <= end; i++){
103 for (nv = 0; nv <
NVAR; nv++) {
104 vi[nv] = 0.5*(state->
vh[
i][nv] + state->
vh[i+1][nv]);
117 #if PHYSICS == MHD && BACKGROUND_FIELD == YES
119 EXPAND(vi[
BX1] += bck_fld[0]; ,
120 vi[
BX2] += bck_fld[1]; ,
121 vi[
BX3] += bck_fld[2];)
124 TC_kappa(vi, x1, x2, x3, &kpar, &knor, &phi);
125 dTmag =
D_EXPAND( gradT[i][0]*gradT[i][0],
126 + gradT[i][1]*gradT[i][1],
127 + gradT[i][2]*gradT[i][2]);
128 dTmag = sqrt(dTmag) + 1.e-12;
135 #if TC_SATURATED_FLUX == YES
136 #if HYPERBOLIC_SAT_FLUX == YES
147 uL = state->
vL[
i][PRS];
148 uR = state->
vR[
i][PRS];
149 if (gradT[i][
g_dir] > 0.0) Fsat = 5.0*phi/sqrt(vi[
RHO])*uR*sqrt(uR);
150 else if (gradT[i][
g_dir] < 0.0) Fsat = 5.0*phi/sqrt(vi[RHO])*uL*sqrt(uL);
151 else Fsat = 5.0*phi*vi[PRS]*sqrt(vi[PRS]/vi[RHO]);
153 Fsat = 5.0*phi*vi[PRS]*sqrt(vi[PRS]/vi[RHO]);
164 Fc = kpar*gradT[
i][
g_dir];
174 #if TC_SATURATED_FLUX == YES
175 alpha = Fsat/(Fsat + kpar*dTmag);
180 dcoeff[
i][ENG] = fabs(alpha*kpar/vi[RHO])*g1;
185 Bmag = sqrt(Bmag) + 1.e-12;
187 bgradT =
D_EXPAND( vi[BX1]*gradT[i][0],
188 + vi[BX2]*gradT[i][1],
189 + vi[BX3]*gradT[i][2]);
192 bn = vi[BX1 +
g_dir]/Bmag;
193 Fc = kpar*bgradT*bn + knor*(gradT[
i][
g_dir] - bn*bgradT);
194 Fcmag = sqrt((kpar*kpar - knor*knor)*bgradT*bgradT +
195 knor*knor*dTmag*dTmag);
197 #if TC_SATURATED_FLUX == YES
198 alpha = Fsat/(Fsat + Fcmag);
203 dcoeff[
i][ENG] = fabs(Fcmag/dTmag*bn*alpha/vi[RHO])*g1;
207 #undef HYPERBOLIC_SAT_FLUX
double ** vh
Primitive state at n+1/2 (only for one step method)
void BackgroundField(double x1, double x2, double x3, double *B0)
double ** vR
Primitive variables to the right of the interface, .
void TC_Flux(double ***T, const State_1D *state, double **dcoeff, int beg, int end, Grid *grid)
void TC_kappa(double *, double, double, double, double *, double *, double *)
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.
double ** tc_flux
Thermal conduction flux.
int g_k
x3 grid index when sweeping along the x1 or x2 direction.
void GetGradient(double ***, double **, int, int, Grid *)
D_EXPAND(tot/[n]=(double) grid[IDIR].np_int_glob;, tot/[n]=(double) grid[JDIR].np_int_glob;, tot/[n]=(double) grid[KDIR].np_int_glob;)
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
double ** vL
Primitive variables to the left of the interface, .
#define ARRAY_2D(nx, ny, type)