50 #define _EULER_1D_ "euler1d" 56 #define _MODEL_NDIMS_ 1 58 #define _MODEL_NVARS_ 3 64 #define _RF_ "rf-char" 66 #define _LLF_ "llf-char" 68 #define _SWFS_ "steger-warming" 70 #define _RUSANOV_ "rusanov" 81 #define _Euler1DGetFlowVar_(u,rho,v,e,P,p) \ 83 double gamma = p->gamma; \ 87 P = (e - 0.5*rho*v*v) * (gamma-1.0); \ 94 #define _Euler1DSetFlux_(f,rho,v,e,P) \ 97 f[1] = (rho) * (v) * (v) + (P); \ 98 f[2] = ((e) + (P)) * (v); \ 115 #define _Euler1DSetStiffFlux_(f,rho,v,e,P,gamma) \ 117 double gamma_inv = 1.0 / (gamma); \ 118 f[0] = gamma_inv * (rho)*(v); \ 119 f[1] = gamma_inv * (rho)*(v)*(v) + (P); \ 120 f[2] = ((e)+(P)) * (v) - 0.5*gamma_inv*((gamma)-1)*(rho)*(v)*(v)*(v); \ 134 #define _Euler1DSetLinearizedStiffFlux_(f,u,J) \ 136 _MatVecMultiply_((J),(u),(f),(_MODEL_NVARS_)); \ 149 #define _Euler1DSetStiffJac_(J,rho,v,e,P,gamma) \ 151 double gm1 = (gamma)-1; \ 152 double inv_gm = 1.0/(gamma); \ 153 double gm1_inv_gm = gm1 * inv_gm; \ 154 J[0] = 0.5*gm1_inv_gm*(rho)*(v)*(v)*(v)/(P) - (v); \ 155 J[1] = 1.0 - gm1_inv_gm*(rho)*(v)*(v)/(P); \ 156 J[2] = gm1_inv_gm*(rho)*(v)/(P); \ 157 J[3] = 0.5*gm1_inv_gm*(rho)*(v)*(v)*(v)*(v)/(P) + 0.5*((gamma)-5.0)*(v)*(v); \ 158 J[4] = (3.0-(gamma))*(v) - gm1_inv_gm*(rho)*(v)*(v)*(v)/(P); \ 159 J[5] = gm1_inv_gm*(rho)*(v)*(v)/(P) + gm1; \ 160 J[6] = 0.25*gm1_inv_gm*(rho)*(v)*(v)*(v)*(v)*(v)/(P) - (gamma)*(v)*(e)/(rho) + 0.5*(2.0*(gamma)-3.0)*(v)*(v)*(v); \ 161 J[7] = (gamma)*(e)/(rho) - 1.5*gm1*(v)*(v) - 0.5*gm1_inv_gm*(rho)*(v)*(v)*(v)*(v)/(P); \ 162 J[8] = 0.5*gm1_inv_gm*(rho)*(v)*(v)*(v)/(P) + (gamma)*(v); \ 169 #define _Euler1DRoeAverage_(uavg,uL,uR,p) \ 171 double rho ,v ,e ,P ,H ,csq; \ 172 double rhoL,vL,eL,PL,HL,cLsq; \ 173 double rhoR,vR,eR,PR,HR,cRsq; \ 174 double gamma = p->gamma; \ 178 PL = (eL - 0.5*rhoL*vL*vL) * (gamma-1.0); \ 179 cLsq = gamma * PL/rhoL; \ 180 HL = 0.5*vL*vL + cLsq / (gamma-1.0); \ 184 PR = (eR - 0.5*rhoR*vR*vR) * (gamma-1.0); \ 185 cRsq = gamma * PR/rhoR; \ 186 HR = 0.5*vR*vR + cRsq / (gamma-1.0); \ 187 double tL = sqrt(rhoL); \ 188 double tR = sqrt(rhoR); \ 190 v = (tL*vL + tR*vR) / (tL + tR); \ 191 H = (tL*HL + tR*HR) / (tL + tR); \ 192 csq = (gamma-1.0) * (H-0.5*v*v); \ 193 P = csq * rho / gamma; \ 194 e = P/(gamma-1.0) + 0.5*rho*v*v; \ 207 #define _Euler1DEigenvalues_(u,D,p,dir) \ 209 double gamma = p->gamma; \ 210 double rho,v,e,P,c; \ 214 P = (e - 0.5*rho*v*v) * (gamma-1.0); \ 215 c = sqrt(gamma*P/rho); \ 216 D[0*_MODEL_NVARS_+0] = v; D[0*_MODEL_NVARS_+1] = 0; D[0*_MODEL_NVARS_+2] = 0; \ 217 D[1*_MODEL_NVARS_+0] = 0; D[1*_MODEL_NVARS_+1] = (v-c); D[1*_MODEL_NVARS_+2] = 0; \ 218 D[2*_MODEL_NVARS_+0] = 0; D[2*_MODEL_NVARS_+1] = 0; D[2*_MODEL_NVARS_+2] = (v+c); \ 225 #define _Euler1DLeftEigenvectors_(u,L,p,dir) \ 227 double gamma = p->gamma; \ 228 double rho,v,e,P,c; \ 232 P = (e - 0.5*rho*v*v) * (gamma-1.0); \ 233 c = sqrt(gamma*P/rho); \ 234 L[1*_MODEL_NVARS_+0] = ((gamma - 1)/(rho*c)) * (-(v*v)/2 - c*v/(gamma-1)); \ 235 L[1*_MODEL_NVARS_+1] = ((gamma - 1)/(rho*c)) * (v + c/(gamma-1)); \ 236 L[1*_MODEL_NVARS_+2] = ((gamma - 1)/(rho*c)) * (-1); \ 237 L[0*_MODEL_NVARS_+0] = ((gamma - 1)/(rho*c)) * (rho*(-(v*v)/2+c*c/(gamma-1))/c); \ 238 L[0*_MODEL_NVARS_+1] = ((gamma - 1)/(rho*c)) * (rho*v/c); \ 239 L[0*_MODEL_NVARS_+2] = ((gamma - 1)/(rho*c)) * (-rho/c); \ 240 L[2*_MODEL_NVARS_+0] = ((gamma - 1)/(rho*c)) * ((v*v)/2 - c*v/(gamma-1)); \ 241 L[2*_MODEL_NVARS_+1] = ((gamma - 1)/(rho*c)) * (-v + c/(gamma-1)); \ 242 L[2*_MODEL_NVARS_+2] = ((gamma - 1)/(rho*c)) * (1); \ 249 #define _Euler1DRightEigenvectors_(u,R,p,dir) \ 251 double gamma = p->gamma; \ 252 double rho,v,e,P,c; \ 256 P = (e - 0.5*rho*v*v) * (gamma-1.0); \ 257 c = sqrt(gamma*P/rho); \ 258 R[0*_MODEL_NVARS_+1] = - rho/(2*c); R[1*_MODEL_NVARS_+1] = -rho*(v-c)/(2*c); R[2*_MODEL_NVARS_+1] = -rho*((v*v)/2+(c*c)/(gamma-1)-c*v)/(2*c); \ 259 R[0*_MODEL_NVARS_+0] = 1; R[1*_MODEL_NVARS_+0] = v; R[2*_MODEL_NVARS_+0] = v*v / 2; \ 260 R[0*_MODEL_NVARS_+2] = rho/(2*c); R[1*_MODEL_NVARS_+2] = rho*(v+c)/(2*c); R[2*_MODEL_NVARS_+2] = rho*((v*v)/2+(c*c)/(gamma-1)+c*v)/(2*c); \ 273 typedef struct euler1d_parameters {
300 int (*SourceUpwind)(
double*,
double*,
double*,
double*,int,
void*,double);
Contains macros and function definitions for common matrix operations.
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Some basic definitions and macros.
#define _MAX_STRING_SIZE_
int Euler1DInitialize(void *, void *)
int Euler1DCleanup(void *)