52 int bounds_outer[2], bounds_inter[2];
53 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
54 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
56 L[_MODEL_NVARS_*_MODEL_NVARS_], DL[_MODEL_NVARS_*_MODEL_NVARS_],
57 modA[_MODEL_NVARS_*_MODEL_NVARS_];
59 done = 0;
int index_outer[2] = {0,0};
int index_inter[2];
61 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
62 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
84 double delta = 0.000001, delta2 = delta*delta;
85 double kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
86 k=0; D[k] = kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
87 k=5; D[k] = kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
88 k=10; D[k] = kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
89 k=15; D[k] = kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
138 int bounds_outer[2], bounds_inter[2];
139 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
140 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
142 L[_MODEL_NVARS_*_MODEL_NVARS_];
144 done = 0;
int index_outer[2] = {0,0}, index_inter[2];
146 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
147 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
166 double eigL[4],eigC[4],eigR[4];
184 if ((eigL[k] > 0) && (eigC[k] > 0) && (eigR[k] > 0)) fc[k] = fcL[k];
185 else if ((eigL[k] < 0) && (eigC[k] < 0) && (eigR[k] < 0)) fc[k] = fcR[k];
188 fc[k] = 0.5 * (fcL[k] + fcR[k] + alpha * (ucL[k]-ucR[k]));
193 MatVecMult4(_MODEL_NVARS_,(fI+_MODEL_NVARS_*p),R,fc);
241 int bounds_outer[2], bounds_inter[2];
242 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
243 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
244 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
245 L[_MODEL_NVARS_*_MODEL_NVARS_];
247 done = 0;
int index_outer[2] = {0,0}, index_inter[2];
249 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
250 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
258 double kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
268 MatVecMult4(_MODEL_NVARS_,ucL,L,(uL+_MODEL_NVARS_*p));
269 MatVecMult4(_MODEL_NVARS_,ucR,L,(uR+_MODEL_NVARS_*p));
270 MatVecMult4(_MODEL_NVARS_,fcL,L,(fL+_MODEL_NVARS_*p));
271 MatVecMult4(_MODEL_NVARS_,fcR,L,(fR+_MODEL_NVARS_*p));
273 double eigL[4],eigC[4],eigR[4];
292 fc[0] = 0.5 * (fcL[0] + fcR[0] + alpha * (ucL[0]-ucR[0]));
294 fc[1] = 0.5 * (fcL[1] + fcR[1] + alpha * (ucL[1]-ucR[1]));
296 fc[2] = 0.5 * (fcL[2] + fcR[2] + alpha * (ucL[2]-ucR[2]));
298 fc[3] = 0.5 * (fcL[3] + fcR[3] + alpha * (ucL[3]-ucR[3]));
301 MatVecMult4(_MODEL_NVARS_,(fI+_MODEL_NVARS_*p),R,fc);
333 int ndims = solver->
ndims;
336 int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
337 _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
338 _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
344 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
346 double rho,vx,vy,e,P,c,gamma=param->
gamma,term,Mach,lp[
_MODEL_NVARS_],lm[
_MODEL_NVARS_];
351 Mach = (dir==
_XDIR_ ? vx : vy) / sqrt(gamma*P/rho);
355 _ArrayCopy1D_((fR+_MODEL_NVARS_*p),(fI+_MODEL_NVARS_*p),_MODEL_NVARS_);
357 }
else if (Mach < 1.0) {
359 double kx = 0, ky = 0;
360 kx = (dir==
_XDIR_ ? 1.0 : 0.0);
361 ky = (dir==
_YDIR_ ? 1.0 : 0.0);
364 c = sqrt(gamma*P/rho);
365 term = rho/(2.0*gamma);
366 lp[0] = lp[1] = kx*vx + ky*vy;
369 for (k=0; k<
_MODEL_NVARS_; k++)
if (lp[k] < 0.0) lp[k] = 0.0;
371 fp[0] = term * (2.0*(gamma-1.0)*lp[0] + lp[2] + lp[3]);
372 fp[1] = term * (2.0*(gamma-1.0)*lp[0]*vx + lp[2]*(vx+c*kx) + lp[3]*(vx-c*kx));
373 fp[2] = term * (2.0*(gamma-1.0)*lp[0]*vy + lp[2]*(vy+c*ky) + lp[3]*(vy-c*ky));
374 fp[3] = term * ((gamma-1.0)*lp[0]*(vx*vx+vy*vy) + 0.5*lp[2]*((vx+c*kx)*(vx+c*kx) + (vy+c*ky)*(vy+c*ky))
375 + 0.5*lp[3]*((vx-c*kx)*(vx-c*kx) + (vy-c*ky)*(vy-c*ky))
376 + ((3.0-gamma)*(lp[2]+lp[3])*c*c)/(2.0*(gamma-1.0)) );
379 c = sqrt(gamma*P/rho);
380 term = rho/(2.0*gamma);
381 lm[0] = lm[1] = kx*vx + ky*vy;
384 for (k=0; k<_MODEL_NVARS_; k++) if (lm[k] > 0.0) lm[k] = 0.0;
386 fm[0] = term * (2.0*(gamma-1.0)*lm[0] + lm[2] + lm[3]);
387 fm[1] = term * (2.0*(gamma-1.0)*lm[0]*vx + lm[2]*(vx+c*kx) + lm[3]*(vx-c*kx));
388 fm[2] = term * (2.0*(gamma-1.0)*lm[0]*vy + lm[2]*(vy+c*ky) + lm[3]*(vy-c*ky));
389 fm[3] = term * ((gamma-1.0)*lm[0]*(vx*vx+vy*vy) + 0.5*lm[2]*((vx+c*kx)*(vx+c*kx) + (vy+c*ky)*(vy+c*ky))
390 + 0.5*lm[3]*((vx-c*kx)*(vx-c*kx) + (vy-c*ky)*(vy-c*ky))
391 + ((3.0-gamma)*(lm[2]+lm[3])*c*c)/(2.0*(gamma-1.0)) );
397 _ArrayCopy1D_((fL+_MODEL_NVARS_*p),(fI+_MODEL_NVARS_*p),_MODEL_NVARS_);
444 int bounds_outer[2], bounds_inter[2];
445 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
446 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
448 done = 0;
int index_outer[2] = {0,0};
int index_inter[2];
450 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
451 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
461 udiff[0] = 0.5 * (uR[_MODEL_NVARS_*p+0] - uL[_MODEL_NVARS_*p+0]);
462 udiff[1] = 0.5 * (uR[_MODEL_NVARS_*p+1] - uL[_MODEL_NVARS_*p+1]);
463 udiff[2] = 0.5 * (uR[_MODEL_NVARS_*p+2] - uL[_MODEL_NVARS_*p+2]);
464 udiff[3] = 0.5 * (uR[_MODEL_NVARS_*p+3] - uL[_MODEL_NVARS_*p+3]);
470 c = sqrt(param->gamma*P/rho);
473 c = sqrt(param->gamma*P/rho);
476 c = sqrt(param->gamma*P/rho);
479 double kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
480 double alpha = kappa*
max3(alphaL,alphaR,alphaavg);
482 fI[_MODEL_NVARS_*p+0] = 0.5*(fL[_MODEL_NVARS_*p+0]+fR[_MODEL_NVARS_*p+0])-alpha*udiff[0];
483 fI[_MODEL_NVARS_*p+1] = 0.5*(fL[_MODEL_NVARS_*p+1]+fR[_MODEL_NVARS_*p+1])-alpha*udiff[1];
484 fI[_MODEL_NVARS_*p+2] = 0.5*(fL[_MODEL_NVARS_*p+2]+fR[_MODEL_NVARS_*p+2])-alpha*udiff[2];
485 fI[_MODEL_NVARS_*p+3] = 0.5*(fL[_MODEL_NVARS_*p+3]+fR[_MODEL_NVARS_*p+3])-alpha*udiff[3];
517 int bounds_outer[2], bounds_inter[2];
518 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
519 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
520 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
521 L[_MODEL_NVARS_*_MODEL_NVARS_], DL[_MODEL_NVARS_*_MODEL_NVARS_],
522 modA[_MODEL_NVARS_*_MODEL_NVARS_];
524 done = 0;
int index_outer[2] = {0,0};
int index_inter[2];
526 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
527 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
537 udiff[0] = 0.5 * (uR[_MODEL_NVARS_*p+0] - uL[_MODEL_NVARS_*p+0]);
538 udiff[1] = 0.5 * (uR[_MODEL_NVARS_*p+1] - uL[_MODEL_NVARS_*p+1]);
539 udiff[2] = 0.5 * (uR[_MODEL_NVARS_*p+2] - uL[_MODEL_NVARS_*p+2]);
540 udiff[3] = 0.5 * (uR[_MODEL_NVARS_*p+3] - uL[_MODEL_NVARS_*p+3]);
548 c = sqrt(param->gamma*P/rho);
551 c = sqrt(param->gamma*P/rho);
554 c = sqrt(param->gamma*P/rho);
557 double kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
558 double alpha = kappa*
max3(alphaL,alphaR,alphaavg);
559 double beta = kappa*
max3(betaL,betaR,betaavg);
563 D[5] = (dir ==
_XDIR_ ? alpha : beta);
564 D[10] = (dir ==
_YDIR_ ? alpha : beta);
570 fI[_MODEL_NVARS_*p+0] = 0.5*(fL[_MODEL_NVARS_*p+0]+fR[_MODEL_NVARS_*p+0])-udiss[0];
571 fI[_MODEL_NVARS_*p+1] = 0.5*(fL[_MODEL_NVARS_*p+1]+fR[_MODEL_NVARS_*p+1])-udiss[1];
572 fI[_MODEL_NVARS_*p+2] = 0.5*(fL[_MODEL_NVARS_*p+2]+fR[_MODEL_NVARS_*p+2])-udiss[2];
573 fI[_MODEL_NVARS_*p+3] = 0.5*(fL[_MODEL_NVARS_*p+3]+fR[_MODEL_NVARS_*p+3])-udiss[3];
608 int bounds_outer[2], bounds_inter[2];
609 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
610 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
611 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
612 L[_MODEL_NVARS_*_MODEL_NVARS_], DL[_MODEL_NVARS_*_MODEL_NVARS_],
613 modA[_MODEL_NVARS_*_MODEL_NVARS_];
615 done = 0;
int index_outer[2] = {0,0};
int index_inter[2];
617 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
618 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
628 udiff[0] = 0.5 * (uR[_MODEL_NVARS_*p+0] - uL[_MODEL_NVARS_*p+0]);
629 udiff[1] = 0.5 * (uR[_MODEL_NVARS_*p+1] - uL[_MODEL_NVARS_*p+1]);
630 udiff[2] = 0.5 * (uR[_MODEL_NVARS_*p+2] - uL[_MODEL_NVARS_*p+2]);
631 udiff[3] = 0.5 * (uR[_MODEL_NVARS_*p+3] - uL[_MODEL_NVARS_*p+3]);
640 double delta = 0.000001, delta2 = delta*delta;
641 double kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
642 k=0; D[k] = kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
643 k=5; D[k] = (dir ==
_YDIR_ ? 0.0 : kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) ) );
644 k=10; D[k] = (dir ==
_XDIR_ ? 0.0 : kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) ) );
651 fI[_MODEL_NVARS_*p+0] = 0.5 * (fL[_MODEL_NVARS_*p+0]+fR[_MODEL_NVARS_*p+0]) - udiss[0];
652 fI[_MODEL_NVARS_*p+1] = 0.5 * (fL[_MODEL_NVARS_*p+1]+fR[_MODEL_NVARS_*p+1]) - udiss[1];
653 fI[_MODEL_NVARS_*p+2] = 0.5 * (fL[_MODEL_NVARS_*p+2]+fR[_MODEL_NVARS_*p+2]) - udiss[2];
654 fI[_MODEL_NVARS_*p+3] = 0.5 * (fL[_MODEL_NVARS_*p+3]+fR[_MODEL_NVARS_*p+3]) - udiss[3];
689 int bounds_outer[2], bounds_inter[2];
690 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
691 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
692 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
693 L[_MODEL_NVARS_*_MODEL_NVARS_];
695 done = 0;
int index_outer[2] = {0,0}, index_inter[2];
697 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
698 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
716 MatVecMult4(_MODEL_NVARS_,ucL,L,(uL+_MODEL_NVARS_*p));
717 MatVecMult4(_MODEL_NVARS_,ucR,L,(uR+_MODEL_NVARS_*p));
718 MatVecMult4(_MODEL_NVARS_,fcL,L,(fL+_MODEL_NVARS_*p));
719 MatVecMult4(_MODEL_NVARS_,fcR,L,(fR+_MODEL_NVARS_*p));
721 double eigL[4],eigC[4],eigR[4];
724 eigL[1] = (dir ==
_YDIR_ ? 0.0 : D[5]);
725 eigL[2] = (dir ==
_XDIR_ ? 0.0 : D[10]);
729 eigR[1] = (dir ==
_YDIR_ ? 0.0 : D[5]);
730 eigR[2] = (dir ==
_XDIR_ ? 0.0 : D[10]);
734 eigC[1] = (dir ==
_YDIR_ ? 0.0 : D[5]);
735 eigC[2] = (dir ==
_XDIR_ ? 0.0 : D[10]);
739 if ((eigL[k] > 0) && (eigC[k] > 0) && (eigR[k] > 0)) fc[k] = fcL[k];
740 else if ((eigL[k] < 0) && (eigC[k] < 0) && (eigR[k] < 0)) fc[k] = fcR[k];
743 fc[k] = 0.5 * (fcL[k] + fcR[k] + alpha * (ucL[k]-ucR[k]));
748 MatVecMult4(_MODEL_NVARS_,(fI+_MODEL_NVARS_*p),R,fc);
783 int bounds_outer[2], bounds_inter[2];
784 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
785 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
786 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
787 L[_MODEL_NVARS_*_MODEL_NVARS_];
789 done = 0;
int index_outer[2] = {0,0}, index_inter[2];
791 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
792 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
800 double kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
810 MatVecMult4(_MODEL_NVARS_,ucL,L,(uL+_MODEL_NVARS_*p));
811 MatVecMult4(_MODEL_NVARS_,ucR,L,(uR+_MODEL_NVARS_*p));
812 MatVecMult4(_MODEL_NVARS_,fcL,L,(fL+_MODEL_NVARS_*p));
813 MatVecMult4(_MODEL_NVARS_,fcR,L,(fR+_MODEL_NVARS_*p));
815 double eigL[4],eigC[4],eigR[4];
818 eigL[1] = (dir ==
_YDIR_ ? 0.0 : D[5]);
819 eigL[2] = (dir ==
_XDIR_ ? 0.0 : D[10]);
823 eigR[1] = (dir ==
_YDIR_ ? 0.0 : D[5]);
824 eigR[2] = (dir ==
_XDIR_ ? 0.0 : D[10]);
828 eigC[1] = (dir ==
_YDIR_ ? 0.0 : D[5]);
829 eigC[2] = (dir ==
_XDIR_ ? 0.0 : D[10]);
834 fc[0] = 0.5 * (fcL[0] + fcR[0] + alpha * (ucL[0]-ucR[0]));
836 fc[1] = 0.5 * (fcL[1] + fcR[1] + alpha * (ucL[1]-ucR[1]));
838 fc[2] = 0.5 * (fcL[2] + fcR[2] + alpha * (ucL[2]-ucR[2]));
840 fc[3] = 0.5 * (fcL[3] + fcR[3] + alpha * (ucL[3]-ucR[3]));
843 MatVecMult4(_MODEL_NVARS_,(fI+_MODEL_NVARS_*p),R,fc);
878 int bounds_outer[2], bounds_inter[2];
879 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
880 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
881 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
882 L[_MODEL_NVARS_*_MODEL_NVARS_], DL[_MODEL_NVARS_*_MODEL_NVARS_],
883 modA[_MODEL_NVARS_*_MODEL_NVARS_];
885 done = 0;
int index_outer[2] = {0,0};
int index_inter[2];
887 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
888 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
898 udiff[0] = 0.5 * (uR[_MODEL_NVARS_*p+0] - uL[_MODEL_NVARS_*p+0]);
899 udiff[1] = 0.5 * (uR[_MODEL_NVARS_*p+1] - uL[_MODEL_NVARS_*p+1]);
900 udiff[2] = 0.5 * (uR[_MODEL_NVARS_*p+2] - uL[_MODEL_NVARS_*p+2]);
901 udiff[3] = 0.5 * (uR[_MODEL_NVARS_*p+3] - uL[_MODEL_NVARS_*p+3]);
909 c = sqrt(param->gamma*P/rho);
910 double alphaL = c +
absolute(vel[dir]);
912 c = sqrt(param->gamma*P/rho);
913 double alphaR = c +
absolute(vel[dir]);
915 c = sqrt(param->gamma*P/rho);
916 double alphaavg = c +
absolute(vel[dir]);
918 double kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
919 double alpha = kappa*
max3(alphaL,alphaR,alphaavg);
923 D[5] = (dir ==
_YDIR_ ? 0.0 : alpha);
924 D[10] = (dir ==
_XDIR_ ? 0.0 : alpha);
931 fI[_MODEL_NVARS_*p+0] = 0.5*(fL[_MODEL_NVARS_*p+0]+fR[_MODEL_NVARS_*p+0]) - udiss[0];
932 fI[_MODEL_NVARS_*p+1] = 0.5*(fL[_MODEL_NVARS_*p+1]+fR[_MODEL_NVARS_*p+1]) - udiss[1];
933 fI[_MODEL_NVARS_*p+2] = 0.5*(fL[_MODEL_NVARS_*p+2]+fR[_MODEL_NVARS_*p+2]) - udiss[2];
934 fI[_MODEL_NVARS_*p+3] = 0.5*(fL[_MODEL_NVARS_*p+3]+fR[_MODEL_NVARS_*p+3]) - udiss[3];
969 int bounds_outer[2], bounds_inter[2];
970 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
971 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
972 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
973 L[_MODEL_NVARS_*_MODEL_NVARS_], DL[_MODEL_NVARS_*_MODEL_NVARS_],
974 modA[_MODEL_NVARS_*_MODEL_NVARS_];
976 done = 0;
int index_outer[2] = {0,0};
int index_inter[2];
978 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
979 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
988 double delta = 0.000001, delta2 = delta*delta;
989 double kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
993 udiff[0] = 0.5 * (uR[_MODEL_NVARS_*p+0] - uL[_MODEL_NVARS_*p+0]);
994 udiff[1] = 0.5 * (uR[_MODEL_NVARS_*p+1] - uL[_MODEL_NVARS_*p+1]);
995 udiff[2] = 0.5 * (uR[_MODEL_NVARS_*p+2] - uL[_MODEL_NVARS_*p+2]);
996 udiff[3] = 0.5 * (uR[_MODEL_NVARS_*p+3] - uL[_MODEL_NVARS_*p+3]);
1003 k=0; D[k] = kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
1004 k=5; D[k] = kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
1005 k=10; D[k] = kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
1006 k=15; D[k] = kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
1009 MatVecMult4(_MODEL_NVARS_,udiss_total,modA,udiff);
1016 k=0; D[k] = kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
1017 k=5; D[k] = (dir ==
_YDIR_ ? 0.0 : kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) ) );
1018 k=10; D[k] = (dir ==
_XDIR_ ? 0.0 : kappa * (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) ) );
1022 MatVecMult4(_MODEL_NVARS_,udiss_stiff,modA,udiff);
1027 fI[_MODEL_NVARS_*p+0] = 0.5 * (fL[_MODEL_NVARS_*p+0]+fR[_MODEL_NVARS_*p+0]) - udiss[0];
1028 fI[_MODEL_NVARS_*p+1] = 0.5 * (fL[_MODEL_NVARS_*p+1]+fR[_MODEL_NVARS_*p+1]) - udiss[1];
1029 fI[_MODEL_NVARS_*p+2] = 0.5 * (fL[_MODEL_NVARS_*p+2]+fR[_MODEL_NVARS_*p+2]) - udiss[2];
1030 fI[_MODEL_NVARS_*p+3] = 0.5 * (fL[_MODEL_NVARS_*p+3]+fR[_MODEL_NVARS_*p+3]) - udiss[3];
1065 int bounds_outer[2], bounds_inter[2];
1066 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
1067 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
1068 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
1069 L[_MODEL_NVARS_*_MODEL_NVARS_];
1071 done = 0;
int index_outer[2] = {0,0}, index_inter[2];
1073 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
1074 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
1092 MatVecMult4(_MODEL_NVARS_,ucL,L,(uL+_MODEL_NVARS_*p));
1093 MatVecMult4(_MODEL_NVARS_,ucR,L,(uR+_MODEL_NVARS_*p));
1094 MatVecMult4(_MODEL_NVARS_,fcL,L,(fL+_MODEL_NVARS_*p));
1095 MatVecMult4(_MODEL_NVARS_,fcR,L,(fR+_MODEL_NVARS_*p));
1097 double eigL[4],eigC[4],eigR[4];
1100 eigL[1] = (dir ==
_XDIR_ ? 0.0 : D[5]);
1101 eigL[2] = (dir ==
_YDIR_ ? 0.0 : D[10]);
1105 eigR[1] = (dir ==
_XDIR_ ? 0.0 : D[5]);
1106 eigR[2] = (dir ==
_YDIR_ ? 0.0 : D[10]);
1110 eigC[1] = (dir ==
_XDIR_ ? 0.0 : D[5]);
1111 eigC[2] = (dir ==
_YDIR_ ? 0.0 : D[10]);
1115 if ((eigL[k] > 0) && (eigC[k] > 0) && (eigR[k] > 0)) fc[k] = fcL[k];
1116 else if ((eigL[k] < 0) && (eigC[k] < 0) && (eigR[k] < 0)) fc[k] = fcR[k];
1119 fc[k] = 0.5 * (fcL[k] + fcR[k] + alpha * (ucL[k]-ucR[k]));
1124 MatVecMult4(_MODEL_NVARS_,(fI+_MODEL_NVARS_*p),R,fc);
1159 int bounds_outer[2], bounds_inter[2];
1160 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
1161 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
1162 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
1163 L[_MODEL_NVARS_*_MODEL_NVARS_];
1165 done = 0;
int index_outer[2] = {0,0}, index_inter[2];
1167 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
1168 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
1176 double kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
1186 MatVecMult4(_MODEL_NVARS_,ucL,L,(uL+_MODEL_NVARS_*p));
1187 MatVecMult4(_MODEL_NVARS_,ucR,L,(uR+_MODEL_NVARS_*p));
1188 MatVecMult4(_MODEL_NVARS_,fcL,L,(fL+_MODEL_NVARS_*p));
1189 MatVecMult4(_MODEL_NVARS_,fcR,L,(fR+_MODEL_NVARS_*p));
1191 double eigL[4],eigC[4],eigR[4];
1194 eigL[1] = (dir ==
_XDIR_ ? 0.0 : D[5]);
1195 eigL[2] = (dir ==
_YDIR_ ? 0.0 : D[10]);
1199 eigR[1] = (dir ==
_XDIR_ ? 0.0 : D[5]);
1200 eigR[2] = (dir ==
_YDIR_ ? 0.0 : D[10]);
1204 eigC[1] = (dir ==
_XDIR_ ? 0.0 : D[5]);
1205 eigC[2] = (dir ==
_YDIR_ ? 0.0 : D[10]);
1210 fc[0] = 0.5 * (fcL[0] + fcR[0] + alpha * (ucL[0]-ucR[0]));
1212 fc[1] = 0.5 * (fcL[1] + fcR[1] + alpha * (ucL[1]-ucR[1]));
1214 fc[2] = 0.5 * (fcL[2] + fcR[2] + alpha * (ucL[2]-ucR[2]));
1216 fc[3] = 0.5 * (fcL[3] + fcR[3] + alpha * (ucL[3]-ucR[3]));
1219 MatVecMult4(_MODEL_NVARS_,(fI+_MODEL_NVARS_*p),R,fc);
1254 int bounds_outer[2], bounds_inter[2];
1255 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
1256 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
1257 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
1258 L[_MODEL_NVARS_*_MODEL_NVARS_], DL[_MODEL_NVARS_*_MODEL_NVARS_],
1259 modA[_MODEL_NVARS_*_MODEL_NVARS_];
1261 done = 0;
int index_outer[2] = {0,0};
int index_inter[2];
1263 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
1264 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
1274 double c, vel[
_MODEL_NDIMS_], rho,E,P, alphaL, alphaR, alphaavg,
1275 betaL, betaR, betaavg, alpha, beta,
1276 kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
1279 udiff[0] = 0.5 * (uR[_MODEL_NVARS_*p+0] - uL[_MODEL_NVARS_*p+0]);
1280 udiff[1] = 0.5 * (uR[_MODEL_NVARS_*p+1] - uL[_MODEL_NVARS_*p+1]);
1281 udiff[2] = 0.5 * (uR[_MODEL_NVARS_*p+2] - uL[_MODEL_NVARS_*p+2]);
1282 udiff[3] = 0.5 * (uR[_MODEL_NVARS_*p+3] - uL[_MODEL_NVARS_*p+3]);
1289 c = sqrt(param->gamma*P/rho);
1293 c = sqrt(param->gamma*P/rho);
1297 c = sqrt(param->gamma*P/rho);
1300 alpha = kappa*
max3(alphaL,alphaR,alphaavg);
1301 beta = kappa*
max3(betaL,betaR,betaavg);
1304 D[5] = (dir ==
_XDIR_ ? alpha : beta);
1305 D[10] = (dir ==
_YDIR_ ? alpha : beta);
1309 MatVecMult4(_MODEL_NVARS_,udiss_total,modA,udiff);
1316 c = sqrt(param->gamma*P/rho);
1319 c = sqrt(param->gamma*P/rho);
1322 c = sqrt(param->gamma*P/rho);
1324 kappa =
max(param->grav_field_g[pL],param->grav_field_g[pR]);
1325 alpha = kappa*
max3(alphaL,alphaR,alphaavg);
1328 D[5] = (dir ==
_YDIR_ ? 0.0 : alpha);
1329 D[10] = (dir ==
_XDIR_ ? 0.0 : alpha);
1333 MatVecMult4(_MODEL_NVARS_,udiss_acoustic,modA,udiff);
1338 fI[_MODEL_NVARS_*p+0] = 0.5*(fL[_MODEL_NVARS_*p+0]+fR[_MODEL_NVARS_*p+0]) - udiss[0];
1339 fI[_MODEL_NVARS_*p+1] = 0.5*(fL[_MODEL_NVARS_*p+1]+fR[_MODEL_NVARS_*p+1]) - udiss[1];
1340 fI[_MODEL_NVARS_*p+2] = 0.5*(fL[_MODEL_NVARS_*p+2]+fR[_MODEL_NVARS_*p+2]) - udiss[2];
1341 fI[_MODEL_NVARS_*p+3] = 0.5*(fL[_MODEL_NVARS_*p+3]+fR[_MODEL_NVARS_*p+3]) - udiss[3];
#define _ArraySetValue_(x, size, value)
#define _NavierStokes2DEigenvalues_(u, D, gamma, dir)
int NavierStokes2DUpwindRF(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _ArrayIncrementIndex_(N, imax, i, done)
int NavierStokes2DUpwinddFRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
#define MatMult4(N, A, X, Y)
int NavierStokes2DUpwinddFLLF(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _NavierStokes2DRightEigenvectors_(u, R, ga, dir)
#define _NavierStokes2DRoeAverage_(uavg, uL, uR, gamma)
#define _ArrayIndex1D2_(N, imax, i, ghost, index)
#define _ArraySubtract1D_(x, a, b, size)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
int NavierStokes2DUpwindRusanov(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DUpwindFdFLLF(double *, double *, double *, double *, double *, double *, int, void *, double)
2D Navier Stokes equations (compressible flows)
int NavierStokes2DUpwindFdFRF(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DUpwindFdFRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
Contains function definitions for common mathematical functions.
#define _ArrayCopy1D_(x, y, size)
int NavierStokes2DUpwindRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DUpwinddFRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DUpwindRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
Contains structure definition for hypar.
#define MatVecMult4(N, y, A, x)
#define _NavierStokes2DGetFlowVar_(u, rho, vx, vy, e, P, gamma)
#define _NavierStokes2DLeftEigenvectors_(u, L, ga, dir)
Some basic definitions and macros.
Structure containing variables and parameters specific to the 2D Navier Stokes equations. This structure contains the physical parameters, variables, and function pointers specific to the 2D Navier-Stokes equations.
int NavierStokes2DUpwinddFRF(double *, double *, double *, double *, double *, double *, int, void *, double)
Contains macros and function definitions for common array operations.
int NavierStokes2DUpwindSWFS(double *, double *, double *, double *, double *, double *, int, void *, double)
Structure containing all solver-specific variables and functions.
int NavierStokes2DUpwindFdFRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _ArrayAdd1D_(x, a, b, size)
Contains macros and function definitions for common matrix multiplication.
int NavierStokes2DUpwindLLF(double *, double *, double *, double *, double *, double *, int, void *, double)