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);
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]));
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]));
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]++;
377 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[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];
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]) );
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]) );
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]++;
670 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[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];
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]++;
789 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[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];
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]++;
895 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[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_) {
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_) {
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 NavierStokes3DUpwindFdFRoe(double *fI, double *fL, double *fR, double *uL, double *uR, double *u, int dir, void *s, double t)
int NavierStokes3DUpwindRusanov(double *fI, double *fL, double *fR, double *uL, double *uR, double *u, int dir, void *s, double t)
#define _NavierStokes3DRightEigenvectors_(u, stride, R, ga, dir)
#define _NavierStokes3DLeftEigenvectors_(u, stride, L, ga, dir)
Contains function definitions for common mathematical functions.
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.
Some basic definitions and macros.
int NavierStokes3DUpwindRoe(double *fI, double *fL, double *fR, double *uL, double *uR, double *u, int dir, void *s, double t)
#define _NavierStokes3DRoeAverage_(uavg, stride, uL, uR, gamma)
3D Navier Stokes equations (compressible flows)
#define _ArraySubtract1D_(x, a, b, size)
#define _ArrayIndex1D3_(N, imax, i, ghost, index)
Structure containing all solver-specific variables and functions.
#define _NavierStokes3DEigenvalues_(u, stride, D, gamma, dir)
Contains structure definition for hypar.
#define _ArrayCopy1D3_(x, y, size)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
int NavierStokes3DUpwindRusanovModified(double *fI, double *fL, double *fR, double *uL, double *uR, double *u, int dir, void *s, double t)
static const int _NavierStokes3D_stride_
#define _ArraySetValue_(x, size, value)
#define _ArrayIncrementIndex_(N, imax, i, done)
#define MatMult5(N, A, X, Y)
Contains macros and function definitions for common matrix multiplication.
int NavierStokes3DUpwindRF(double *fI, double *fL, double *fR, double *uL, double *uR, double *u, int dir, void *s, double t)
int NavierStokes3DUpwindFdFRusanovModified(double *fI, double *fL, double *fR, double *uL, double *uR, double *u, int dir, void *s, double t)
#define MatVecMult5(N, y, A, x)
int NavierStokes3DUpwinddFRusanovModified(double *fI, double *fL, double *fR, double *uL, double *uR, double *u, int dir, void *s, double t)
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.
int NavierStokes3DUpwindLLF(double *fI, double *fL, double *fR, double *uL, double *uR, double *u, int dir, void *s, double t)
int NavierStokes3DUpwinddFRoe(double *fI, double *fL, double *fR, double *uL, double *uR, double *u, int dir, void *s, double t)
#define _NavierStokes3DGetFlowVar_(u, stride, rho, vx, vy, vz, e, P, gamma)