10 int Euler2DUpwindRoe(
double *fI,
double *fL,
double *fR,
double *uL,
double *uR,
double *u,
int dir,
void *s,
double t)
18 int bounds_outer[2], bounds_inter[2];
19 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
20 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
22 L[_MODEL_NVARS_*_MODEL_NVARS_], DL[_MODEL_NVARS_*_MODEL_NVARS_],
23 modA[_MODEL_NVARS_*_MODEL_NVARS_];
25 done = 0;
int index_outer[2] = {0,0};
int index_inter[2];
27 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
28 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
47 double delta = 0.000001, delta2 = delta*delta;
48 k=0; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
49 k=5; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
50 k=10; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
51 k=15; D[k] = (
absolute(D[k]) < delta ? (D[k]*D[k]+delta2)/(2*delta) :
absolute(D[k]) );
68 int Euler2DUpwindRF(
double *fI,
double *fL,
double *fR,
double *uL,
double *uR,
double *u,
int dir,
void *s,
double t)
76 int bounds_outer[2], bounds_inter[2];
77 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
78 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
80 L[_MODEL_NVARS_*_MODEL_NVARS_];
82 done = 0;
int index_outer[2] = {0,0}, index_inter[2];
84 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
85 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
104 double eigL[4],eigC[4],eigR[4];
122 if ((eigL[k] > 0) && (eigC[k] > 0) && (eigR[k] > 0)) fc[k] = fcL[k];
123 else if ((eigL[k] < 0) && (eigC[k] < 0) && (eigR[k] < 0)) fc[k] = fcR[k];
126 fc[k] = 0.5 * (fcL[k] + fcR[k] + alpha * (ucL[k]-ucR[k]));
131 MatVecMult4(_MODEL_NVARS_,(fI+_MODEL_NVARS_*p),R,fc);
139 int Euler2DUpwindLLF(
double *fI,
double *fL,
double *fR,
double *uL,
double *uR,
double *u,
int dir,
void *s,
double t)
147 int bounds_outer[2], bounds_inter[2];
148 bounds_outer[0] = dim[0]; bounds_outer[1] = dim[1]; bounds_outer[dir] = 1;
149 bounds_inter[0] = dim[0]; bounds_inter[1] = dim[1]; bounds_inter[dir]++;
150 static double R[_MODEL_NVARS_*_MODEL_NVARS_], D[_MODEL_NVARS_*_MODEL_NVARS_],
151 L[_MODEL_NVARS_*_MODEL_NVARS_];
153 done = 0;
int index_outer[2] = {0,0}, index_inter[2];
155 index_inter[0] = index_outer[0]; index_inter[1] = index_outer[1];
156 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
170 MatVecMult4(_MODEL_NVARS_,ucL,L,(uL+_MODEL_NVARS_*p));
171 MatVecMult4(_MODEL_NVARS_,ucR,L,(uR+_MODEL_NVARS_*p));
172 MatVecMult4(_MODEL_NVARS_,fcL,L,(fL+_MODEL_NVARS_*p));
173 MatVecMult4(_MODEL_NVARS_,fcR,L,(fR+_MODEL_NVARS_*p));
175 double eigL[4],eigC[4],eigR[4];
194 fc[0] = 0.5 * (fcL[0] + fcR[0] + alpha * (ucL[0]-ucR[0]));
196 fc[1] = 0.5 * (fcL[1] + fcR[1] + alpha * (ucL[1]-ucR[1]));
198 fc[2] = 0.5 * (fcL[2] + fcR[2] + alpha * (ucL[2]-ucR[2]));
200 fc[3] = 0.5 * (fcL[3] + fcR[3] + alpha * (ucL[3]-ucR[3]));
203 MatVecMult4(_MODEL_NVARS_,(fI+_MODEL_NVARS_*p),R,fc);
211 int Euler2DUpwindSWFS(
double *fI,
double *fL,
double *fR,
double *uL,
double *uR,
double *u,
int dir,
void *s,
double t)
218 int ndims = solver->
ndims;
221 int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
222 _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
223 _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
229 for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
231 double rho,vx,vy,e,P,c,gamma=param->
gamma,term,Mach,lp[
_MODEL_NVARS_],lm[
_MODEL_NVARS_];
236 Mach = (dir==
_XDIR_ ? vx : vy) / sqrt(gamma*P/rho);
240 _ArrayCopy1D_((fR+_MODEL_NVARS_*p),(fI+_MODEL_NVARS_*p),_MODEL_NVARS_);
242 }
else if (Mach < 1.0) {
244 double kx = 0, ky = 0;
245 kx = (dir==
_XDIR_ ? 1.0 : 0.0);
246 ky = (dir==
_YDIR_ ? 1.0 : 0.0);
249 c = sqrt(gamma*P/rho);
250 term = rho/(2.0*gamma);
251 lp[0] = lp[1] = kx*vx + ky*vy;
254 for (k=0; k<
_MODEL_NVARS_; k++)
if (lp[k] < 0.0) lp[k] = 0.0;
256 fp[0] = term * (2.0*(gamma-1.0)*lp[0] + lp[2] + lp[3]);
257 fp[1] = term * (2.0*(gamma-1.0)*lp[0]*vx + lp[2]*(vx+c*kx) + lp[3]*(vx-c*kx));
258 fp[2] = term * (2.0*(gamma-1.0)*lp[0]*vy + lp[2]*(vy+c*ky) + lp[3]*(vy-c*ky));
259 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))
260 + 0.5*lp[3]*((vx-c*kx)*(vx-c*kx) + (vy-c*ky)*(vy-c*ky))
261 + ((3.0-gamma)*(lp[2]+lp[3])*c*c)/(2.0*(gamma-1.0)) );
264 c = sqrt(gamma*P/rho);
265 term = rho/(2.0*gamma);
266 lm[0] = lm[1] = kx*vx + ky*vy;
269 for (k=0; k<_MODEL_NVARS_; k++) if (lm[k] > 0.0) lm[k] = 0.0;
271 fm[0] = term * (2.0*(gamma-1.0)*lm[0] + lm[2] + lm[3]);
272 fm[1] = term * (2.0*(gamma-1.0)*lm[0]*vx + lm[2]*(vx+c*kx) + lm[3]*(vx-c*kx));
273 fm[2] = term * (2.0*(gamma-1.0)*lm[0]*vy + lm[2]*(vy+c*ky) + lm[3]*(vy-c*ky));
274 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))
275 + 0.5*lm[3]*((vx-c*kx)*(vx-c*kx) + (vy-c*ky)*(vy-c*ky))
276 + ((3.0-gamma)*(lm[2]+lm[3])*c*c)/(2.0*(gamma-1.0)) );
282 _ArrayCopy1D_((fL+_MODEL_NVARS_*p),(fI+_MODEL_NVARS_*p),_MODEL_NVARS_);
#define _ArraySetValue_(x, size, value)
int Euler2DUpwindLLF(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _Euler2DRoeAverage_(uavg, uL, uR, p)
#define _Euler2DEigenvalues_(u, D, p, dir)
#define _ArrayIncrementIndex_(N, imax, i, done)
#define MatMult4(N, A, X, Y)
#define _Euler2DGetFlowVar_(u, rho, vx, vy, e, P, p)
#define _ArrayIndex1D2_(N, imax, i, ghost, index)
#define _Euler2DRightEigenvectors_(u, R, p, dir)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
int Euler2DUpwindSWFS(double *, double *, double *, double *, double *, double *, int, void *, double)
Contains function definitions for common mathematical functions.
#define _ArrayCopy1D_(x, y, size)
#define _Euler2DLeftEigenvectors_(u, L, p, dir)
int Euler2DUpwindRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
Contains structure definition for hypar.
#define MatVecMult4(N, y, A, x)
Some basic definitions and macros.
Contains macros and function definitions for common array operations.
int Euler2DUpwindRF(double *, double *, double *, double *, double *, double *, int, void *, double)
Structure containing all solver-specific variables and functions.
#define _ArrayAdd1D_(x, a, b, size)
Contains macros and function definitions for common matrix multiplication.