59 _ArrayCopy1D3_(dim,bounds_outer,_MODEL_NDIMS_); bounds_outer[dir] = 1;
60 _ArrayCopy1D3_(dim,bounds_inter,_MODEL_NDIMS_); bounds_inter[dir] += 1;
65 done = 0;
int index_outer[3] = {0,0,0}, index_inter[3];
68 clock_t startEvent, stopEvent;
74 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
97 double delta = 0.000001, delta2 = delta*delta;
98 k=0; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
99 k=6; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
100 k=12; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
101 k=18; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
102 k=24; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
117 #if defined(CPU_STAT)
119 printf(
"%-50s CPU time (secs) = %.6f dir = %d\n",
120 "NavierStokes3DUpwindRoe", (
double)(stopEvent-startEvent)/CLOCKS_PER_SEC, dir);
158 int bounds_outer[
_MODEL_NDIMS_], bounds_inter[_MODEL_NDIMS_];
159 _ArrayCopy1D3_(dim,bounds_outer,_MODEL_NDIMS_); bounds_outer[dir] = 1;
160 _ArrayCopy1D3_(dim,bounds_inter,_MODEL_NDIMS_); bounds_inter[dir] += 1;
163 done = 0;
int index_outer[3] = {0,0,0}, index_inter[3];
166 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
205 if ((eigL[k] > 0) && (eigC[k] > 0) && (eigR[k] > 0)) fc[k] = fcL[k];
206 else if ((eigL[k] < 0) && (eigC[k] < 0) && (eigR[k] < 0)) fc[k] = fcR[k];
209 fc[k] = 0.5 * (fcL[k] + fcR[k] + alpha * (ucL[k]-ucR[k]));
214 MatVecMult5(_MODEL_NVARS_,(fI+_MODEL_NVARS_*p),R,fc);
262 int bounds_outer[
_MODEL_NDIMS_], bounds_inter[_MODEL_NDIMS_];
263 _ArrayCopy1D3_(dim,bounds_outer,_MODEL_NDIMS_); bounds_outer[dir] = 1;
264 _ArrayCopy1D3_(dim,bounds_inter,_MODEL_NDIMS_); bounds_inter[dir] += 1;
267 done = 0;
int index_outer[3] = {0,0,0}, index_inter[3];
270 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
310 fc[0] = 0.5 * (fcL[0] + fcR[0] + alpha * (ucL[0]-ucR[0]));
312 fc[1] = 0.5 * (fcL[1] + fcR[1] + alpha * (ucL[1]-ucR[1]));
314 fc[2] = 0.5 * (fcL[2] + fcR[2] + alpha * (ucL[2]-ucR[2]));
316 fc[3] = 0.5 * (fcL[3] + fcR[3] + alpha * (ucL[3]-ucR[3]));
318 fc[4] = 0.5 * (fcL[4] + fcR[4] + alpha * (ucL[4]-ucR[4]));
365 int bounds_outer[
_MODEL_NDIMS_], bounds_inter[_MODEL_NDIMS_];
366 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[2] = dim[2]; bounds_outer[dir] = 1;
367 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[2] = dim[2]; bounds_inter[dir]++;
371 static int index_outer[_MODEL_NDIMS_], index_inter[_MODEL_NDIMS_],
372 indexL[_MODEL_NDIMS_], indexR[_MODEL_NDIMS_];
377 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
379 int p;
_ArrayIndex1D_(_MODEL_NDIMS_,bounds_inter,index_inter,0,p);
380 _ArrayCopy1D_(index_inter,indexL,_MODEL_NDIMS_); indexL[dir]--;
388 udiff[0] = 0.5 * (uR[q+0] - uL[q+0]);
389 udiff[1] = 0.5 * (uR[q+1] - uL[q+1]);
390 udiff[2] = 0.5 * (uR[q+2] - uL[q+2]);
391 udiff[3] = 0.5 * (uR[q+3] - uL[q+3]);
392 udiff[4] = 0.5 * (uR[q+4] - uL[q+4]);
398 c = sqrt(param->
gamma*P/rho);
399 double alphaL = c +
absolute(vel[dir]);
401 c = sqrt(param->
gamma*P/rho);
402 double alphaR = c +
absolute(vel[dir]);
404 c = sqrt(param->
gamma*P/rho);
405 double alphaavg = c +
absolute(vel[dir]);
408 double alpha = kappa*
max3(alphaL,alphaR,alphaavg);
410 fI[q+0] = 0.5*(fL[q+0]+fR[q+0])-alpha*udiff[0];
411 fI[q+1] = 0.5*(fL[q+1]+fR[q+1])-alpha*udiff[1];
412 fI[q+2] = 0.5*(fL[q+2]+fR[q+2])-alpha*udiff[2];
413 fI[q+3] = 0.5*(fL[q+3]+fR[q+3])-alpha*udiff[3];
414 fI[q+4] = 0.5*(fL[q+4]+fR[q+4])-alpha*udiff[4];
449 int bounds_outer[
_MODEL_NDIMS_], bounds_inter[_MODEL_NDIMS_];
450 _ArrayCopy1D3_(dim,bounds_outer,_MODEL_NDIMS_); bounds_outer[dir] = 1;
451 _ArrayCopy1D3_(dim,bounds_inter,_MODEL_NDIMS_); bounds_inter[dir] += 1;
456 done = 0;
int index_outer[3] = {0,0,0}, index_inter[3];
459 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
482 double delta = 0.000001, delta2 = delta*delta;
485 k=6; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
488 k=24; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
489 }
else if (dir ==
_YDIR_) {
492 k=12; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
494 k=24; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
495 }
else if (dir ==
_ZDIR_) {
499 k=18; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
500 k=24; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
546 int bounds_outer[
_MODEL_NDIMS_], bounds_inter[_MODEL_NDIMS_];
547 _ArrayCopy1D3_(dim,bounds_outer,_MODEL_NDIMS_); bounds_outer[dir] = 1;
548 _ArrayCopy1D3_(dim,bounds_inter,_MODEL_NDIMS_); bounds_inter[dir] += 1;
553 done = 0;
int index_outer[3] = {0,0,0}, index_inter[3];
556 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
565 double delta = 0.000001, delta2 = delta*delta;
580 k=0; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
581 k=6; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
582 k=12; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
583 k=18; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
584 k=24; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
596 k=6; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
599 k=24; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
600 }
else if (dir ==
_YDIR_) {
603 k=12; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
605 k=24; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
606 }
else if (dir ==
_ZDIR_) {
610 k=18; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
611 k=24; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
654 static int bounds_outer[
_MODEL_NDIMS_], bounds_inter[_MODEL_NDIMS_];
655 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[2] = dim[2]; bounds_outer[dir] = 1;
656 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[2] = dim[2]; bounds_inter[dir]++;
659 L[_MODEL_NVARS_*_MODEL_NVARS_], DL[_MODEL_NVARS_*_MODEL_NVARS_],
660 modA[_MODEL_NVARS_*_MODEL_NVARS_];
662 static int indexL[_MODEL_NDIMS_], indexR[_MODEL_NDIMS_],
663 index_outer[_MODEL_NDIMS_], index_inter[_MODEL_NDIMS_];
665 static double udiff[_MODEL_NVARS_],uavg[_MODEL_NVARS_],udiss[_MODEL_NVARS_];
670 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
672 int p;
_ArrayIndex1D_(_MODEL_NDIMS_,bounds_inter,index_inter,0,p);
673 _ArrayCopy1D_(index_inter,indexL,_MODEL_NDIMS_); indexL[dir]--;
681 udiff[0] = 0.5 * (uR[q+0] - uL[q+0]);
682 udiff[1] = 0.5 * (uR[q+1] - uL[q+1]);
683 udiff[2] = 0.5 * (uR[q+2] - uL[q+2]);
684 udiff[3] = 0.5 * (uR[q+3] - uL[q+3]);
685 udiff[4] = 0.5 * (uR[q+4] - uL[q+4]);
694 c = sqrt(param->
gamma*P/rho);
695 double alphaL = c +
absolute(vel[dir]);
699 c = sqrt(param->
gamma*P/rho);
700 double alphaR = c +
absolute(vel[dir]);
704 c = sqrt(param->
gamma*P/rho);
705 double alphaavg = c +
absolute(vel[dir]);
706 double betaavg =
absolute(vel[dir]);
709 double alpha = kappa*
max3(alphaL,alphaR,alphaavg);
710 double beta = kappa*
max3(betaL,betaR,betaavg);
719 }
else if (dir ==
_YDIR_) {
725 }
else if (dir ==
_ZDIR_) {
736 fI[q+0] = 0.5*(fL[q+0]+fR[q+0])-udiss[0];
737 fI[q+1] = 0.5*(fL[q+1]+fR[q+1])-udiss[1];
738 fI[q+2] = 0.5*(fL[q+2]+fR[q+2])-udiss[2];
739 fI[q+3] = 0.5*(fL[q+3]+fR[q+3])-udiss[3];
740 fI[q+4] = 0.5*(fL[q+4]+fR[q+4])-udiss[4];
773 static int bounds_outer[
_MODEL_NDIMS_], bounds_inter[_MODEL_NDIMS_];
774 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[2] = dim[2]; bounds_outer[dir] = 1;
775 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[2] = dim[2]; bounds_inter[dir]++;
778 L[_MODEL_NVARS_*_MODEL_NVARS_], DL[_MODEL_NVARS_*_MODEL_NVARS_],
779 modA[_MODEL_NVARS_*_MODEL_NVARS_];
781 static int indexL[_MODEL_NDIMS_], indexR[_MODEL_NDIMS_],
782 index_outer[_MODEL_NDIMS_], index_inter[_MODEL_NDIMS_];
784 static double udiff[_MODEL_NVARS_],uavg[_MODEL_NVARS_],udiss[_MODEL_NVARS_];
789 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
791 int p;
_ArrayIndex1D_(_MODEL_NDIMS_,bounds_inter,index_inter,0,p);
792 _ArrayCopy1D_(index_inter,indexL,_MODEL_NDIMS_); indexL[dir]--;
800 udiff[0] = 0.5 * (uR[q+0] - uL[q+0]);
801 udiff[1] = 0.5 * (uR[q+1] - uL[q+1]);
802 udiff[2] = 0.5 * (uR[q+2] - uL[q+2]);
803 udiff[3] = 0.5 * (uR[q+3] - uL[q+3]);
804 udiff[4] = 0.5 * (uR[q+4] - uL[q+4]);
813 c = sqrt(param->
gamma*P/rho);
814 double alphaL = c +
absolute(vel[dir]);
817 c = sqrt(param->
gamma*P/rho);
818 double alphaR = c +
absolute(vel[dir]);
821 c = sqrt(param->
gamma*P/rho);
822 double alphaavg = c +
absolute(vel[dir]);
825 double alpha = kappa*
max3(alphaL,alphaR,alphaavg);
831 }
else if (dir ==
_YDIR_) {
834 }
else if (dir ==
_ZDIR_) {
842 fI[q+0] = 0.5*(fL[q+0]+fR[q+0])-udiss[0];
843 fI[q+1] = 0.5*(fL[q+1]+fR[q+1])-udiss[1];
844 fI[q+2] = 0.5*(fL[q+2]+fR[q+2])-udiss[2];
845 fI[q+3] = 0.5*(fL[q+3]+fR[q+3])-udiss[3];
846 fI[q+4] = 0.5*(fL[q+4]+fR[q+4])-udiss[4];
879 static int bounds_outer[
_MODEL_NDIMS_], bounds_inter[_MODEL_NDIMS_];
880 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[2] = dim[2]; bounds_outer[dir] = 1;
881 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[2] = dim[2]; bounds_inter[dir]++;
884 L[_MODEL_NVARS_*_MODEL_NVARS_], DL[_MODEL_NVARS_*_MODEL_NVARS_],
885 modA[_MODEL_NVARS_*_MODEL_NVARS_];
887 static int indexL[_MODEL_NDIMS_], indexR[_MODEL_NDIMS_],
888 index_outer[_MODEL_NDIMS_], index_inter[_MODEL_NDIMS_];
890 static double udiff[_MODEL_NVARS_],uavg[_MODEL_NVARS_],udiss[_MODEL_NVARS_];
895 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
897 int p;
_ArrayIndex1D_(_MODEL_NDIMS_,bounds_inter,index_inter,0,p);
898 _ArrayCopy1D_(index_inter,indexL,_MODEL_NDIMS_); indexL[dir]--;
908 double c, vel[
_MODEL_NDIMS_], rho,E,P, alphaL, alphaR, alphaavg,
909 betaL, betaR, betaavg, alpha, beta,
912 udiff[0] = 0.5 * (uR[q+0] - uL[q+0]);
913 udiff[1] = 0.5 * (uR[q+1] - uL[q+1]);
914 udiff[2] = 0.5 * (uR[q+2] - uL[q+2]);
915 udiff[3] = 0.5 * (uR[q+3] - uL[q+3]);
916 udiff[4] = 0.5 * (uR[q+4] - uL[q+4]);
924 c = sqrt(param->
gamma*P/rho);
929 c = sqrt(param->
gamma*P/rho);
934 c = sqrt(param->
gamma*P/rho);
939 alpha = kappa*
max3(alphaL,alphaR,alphaavg);
940 beta = kappa*
max3(betaL,betaR,betaavg);
949 }
else if (dir ==
_YDIR_) {
955 }
else if (dir ==
_ZDIR_) {
964 MatVecMult5 (_MODEL_NVARS_,udiss_total,modA,udiff);
972 c = sqrt(param->
gamma*P/rho);
976 c = sqrt(param->
gamma*P/rho);
980 c = sqrt(param->
gamma*P/rho);
984 alpha = kappa*
max3(alphaL,alphaR,alphaavg);
990 }
else if (dir ==
_YDIR_) {
993 }
else if (dir ==
_ZDIR_) {
999 MatVecMult5 (_MODEL_NVARS_,udiss_acoustic,modA,udiff);
1004 fI[q+0] = 0.5*(fL[q+0]+fR[q+0])-udiss[0];
1005 fI[q+1] = 0.5*(fL[q+1]+fR[q+1])-udiss[1];
1006 fI[q+2] = 0.5*(fL[q+2]+fR[q+2])-udiss[2];
1007 fI[q+3] = 0.5*(fL[q+3]+fR[q+3])-udiss[3];
1008 fI[q+4] = 0.5*(fL[q+4]+fR[q+4])-udiss[4];
int NavierStokes3DUpwindRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _NavierStokes3DGetFlowVar_(u, stride, rho, vx, vy, vz, e, P, gamma)
#define _ArrayIndex1D3_(N, imax, i, ghost, index)
#define _ArraySetValue_(x, size, value)
3D Navier Stokes equations (compressible flows)
#define _NavierStokes3DLeftEigenvectors_(u, stride, L, ga, dir)
#define _ArrayIncrementIndex_(N, imax, i, done)
int NavierStokes3DUpwindRusanov(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes3DUpwindFdFRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _ArrayCopy1D3_(x, y, size)
#define _ArraySubtract1D_(x, a, b, size)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define MatVecMult5(N, y, A, x)
int NavierStokes3DUpwinddFRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _NavierStokes3DEigenvalues_(u, stride, D, gamma, dir)
int NavierStokes3DUpwindRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
Contains function definitions for common mathematical functions.
#define _ArrayCopy1D_(x, y, size)
int NavierStokes3DUpwindLLF(double *, double *, double *, double *, double *, double *, int, void *, double)
Contains structure definition for hypar.
#define MatMult5(N, A, X, Y)
int NavierStokes3DUpwindRF(double *, double *, double *, double *, double *, double *, int, void *, double)
Structure containing variables and parameters specific to the 3D Navier Stokes equations. This structure contains the physical parameters, variables, and function pointers specific to the 3D Navier-Stokes equations.
#define _NavierStokes3DRightEigenvectors_(u, stride, R, ga, dir)
Some basic definitions and macros.
Contains macros and function definitions for common array operations.
#define _NavierStokes3DRoeAverage_(uavg, stride, uL, uR, gamma)
int NavierStokes3DUpwinddFRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes3DUpwindFdFRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
Structure containing all solver-specific variables and functions.
Contains macros and function definitions for common matrix multiplication.
static const int _NavierStokes3D_stride_