30 void PrimRHS (
double *v,
double *dv,
double cs2,
double h,
double *Adv)
66 #if EOS == IDEAL || EOS == PVTE_LAW
68 #elif EOS == ISOTHERMAL
71 print (
"! PRIM_RHS: not defined for this EoS\n");
81 #elif DIVB_CONTROL == DIV_CLEANING
105 #elif EOS == PVTE_LAW
106 Adv[PRS] = cs2*v[
RHO]*dv[
VXn] + v[
VXn]*dv[PRS];
121 double *h,
double **src,
Grid *grid)
164 double tau, dA_dV, th;
166 double *v, *vp, *A, *dV, r_inv, ct;
167 double *x1, *x2, *x3;
168 double *x1p, *x2p, *x3p;
169 double *dx1, *dx2, *dx3;
170 static double *phi_p;
171 double g[3], ch2, db,
scrh;
173 #if ROTATING_FRAME == YES
174 print1 (
"! PrimSource: does not work with rotations\n");
184 #if GEOMETRY == CYLINDRICAL
214 #if GEOMETRY == CYLINDRICAL
217 for (i = beg; i <= end; i++){
230 src[i][PRS] = a2[i]*src[i][
RHO];
239 #elif GEOMETRY == POLAR
242 for (i = beg; i <= end; i++){
255 src[i][PRS] = a2[i]*src[i][
RHO];
264 #elif GEOMETRY == SPHERICAL
266 print1 (
"! PrimSource: not implemented in Spherical geometry\n");
280 for (i = beg; i <= end; i++) {
284 for (j = beg; j <= end; j++) {
296 #if (BODY_FORCE != NO)
302 #if BODY_FORCE & POTENTIAL
305 for (i = beg; i <= end; i++){
306 #if BODY_FORCE & VECTOR
311 #if BODY_FORCE & POTENTIAL
313 src[
i][
VX1] -= (phi_p[
i] - phi_p[i-1])/(hscale*dx1[i]);
330 #if BODY_FORCE & POTENTIAL
333 #if GEOMETRY == POLAR || GEOMETRY == SPHERICAL
336 for (j = beg; j <= end; j++){
337 #if BODY_FORCE & VECTOR
342 #if BODY_FORCE & POTENTIAL
344 src[
j][
VX2] -= (phi_p[
j] - phi_p[j-1])/(hscale*dx2[j]);
349 #if DIMENSIONS == 2 && COMPONENTS == 3
359 #if BODY_FORCE & POTENTIAL
362 #if GEOMETRY == SPHERICAL
364 hscale = x1[
i]*sin(th);
366 for (k = beg; k <= end; k++){
367 #if BODY_FORCE & VECTOR
372 #if BODY_FORCE & POTENTIAL
374 src[
k][
VX3] -= (phi_p[
k] - phi_p[k-1])/(hscale*dx3[k]);
385 #if GEOMETRY == POLAR || GEOMETRY == SPHERICAL
386 print1 (
"! Error: Div. Cleaning does not work in this configuration.\n");
387 print1 (
"! Try RK integrator instead\n");
390 for (i = beg; i <= end; i++){
394 db = 0.5*( A[
i] *(state->
v[i+1][
BXn] + state->
v[
i][
BXn])
395 - A[i-1]*(state->
v[i-1][
BXn] + state->
v[i][
BXn]))/dV[i];
396 #if GLM_EXTENDED == NO
397 EXPAND(src[i][
VXn] += v[BXn]*tau*db; ,
398 src[
i][
VXt] += v[
BXt]*tau*db; ,
402 src[i][
BXt] += v[
VXt]*db; ,
407 src[
i][PRS] += (1.0 -
g_gamma)*scrh*db;
408 #if GLM_EXTENDED == NO
422 #if (defined FARGO && !defined SHEARINGBOX)
423 #if GEOMETRY == POLAR || GEOMETRY == SPHERICAL
424 print1 (
"! Time Stepping works only in Cartesian or cylindrical coords\n");
425 print1 (
"! Use RK instead\n");
429 double **
wA, *dx, *dz;
434 for (i = beg; i <= end; i++){
436 src[
i][
VX2] -= 0.5*v[
VX1]*(wA[
k][i+1] - wA[
k][i-1])/dx[i];
441 for (k = beg; k <= end; k++){
443 src[
k][
VX2] -= 0.5*v[
VX3]*(wA[k+1][
i] - wA[k-1][
i])/dz[k];
double ** v
Cell-centered primitive varables at the base time level, v[i] = .
void print1(const char *fmt,...)
int g_i
x1 grid index when sweeping along the x2 or x3 direction.
void PrimSource(const State_1D *state, int beg, int end, double *a2, double *h, double **src, Grid *grid)
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 SB_OMEGA
Disk local orbital frequency .
void print(const char *fmt,...)
double * xgc
Cell volumetric centroid (!= x when geometry != CARTESIAN).
double BodyForcePotential(double, double, double)
int g_k
x3 grid index when sweeping along the x1 or x2 direction.
#define SB_Q
The shear parameter, .
void PrimRHS(double *v, double *dv, double cs2, double h, double *Adv)
#define ARRAY_1D(nx, type)
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
double ** FARGO_GetVelocity(void)
void BodyForceVector(double *, double *, double, double, double)
double glm_ch
The propagation speed of divergence error.
#define QUIT_PLUTO(e_code)
double * A
Right interface area, A[i] = .