52 int ghosts = solver->
ghosts;
56 int nvars = solver->
nvars;
57 int ndims = solver->
ndims;
58 int size = (imax+2*ghosts)*(jmax+2*ghosts)*nvars;
61 if (physics->
Re <= 0)
return(0);
64 static double two_third = 2.0/3.0;
65 double inv_gamma_m1 = 1.0 / (physics->
gamma-1.0);
66 double inv_Re = 1.0 / physics->
Re;
67 double inv_Pr = 1.0 / physics->
Pr;
70 Q = (
double*) calloc (size,
sizeof(
double));
71 for (i=-ghosts; i<(imax+ghosts); i++) {
72 for (j=-ghosts; j<(jmax+ghosts); j++) {
73 int p,index[2]; index[0]=i; index[1]=j;
74 double energy,pressure;
77 pressure,physics->
gamma);
78 Q[p+3] = physics->
gamma*pressure/Q[p+0];
82 double *QDerivX = (
double*) calloc (size,
sizeof(
double));
83 double *QDerivY = (
double*) calloc (size,
sizeof(
double));
93 for (i=-ghosts; i<(imax+ghosts); i++) {
94 for (j=-ghosts; j<(jmax+ghosts); j++) {
95 int p,index[2]; index[0]=i; index[1]=j;
105 double *FViscous = (
double*) calloc (size,
sizeof(
double));
106 double *FDeriv = (
double*) calloc (size,
sizeof(
double));
109 for (i=-ghosts; i<(imax+ghosts); i++) {
110 for (j=-ghosts; j<(jmax+ghosts); j++) {
111 int p,index[2]; index[0]=i; index[1]=j;;
114 double uvel, vvel, T, Tx, ux, uy, vx, vy;
127 double tau_xx, tau_xy, qx;
128 tau_xx = two_third * (mu*inv_Re) * (2*ux - vy);
129 tau_xy = (mu*inv_Re) * (uy + vx);
130 qx = ( (mu*inv_Re) * inv_gamma_m1 * inv_Pr ) * Tx;
132 (FViscous+p)[0] = 0.0;
133 (FViscous+p)[1] = tau_xx;
134 (FViscous+p)[2] = tau_xy;
135 (FViscous+p)[3] = uvel*tau_xx + vvel*tau_xy + qx;
139 for (i=0; i<imax; i++) {
140 for (j=0; j<jmax; j++) {
141 int p,index[2]; index[0]=i; index[1]=j;
145 for (v=0; v<nvars; v++) (par+p)[v] += (dxinv * (FDeriv+p)[v] );
150 for (i=-ghosts; i<(imax+ghosts); i++) {
151 for (j=-ghosts; j<(jmax+ghosts); j++) {
152 int p,index[2]; index[0]=i; index[1]=j;
155 double uvel, vvel, T, Ty, ux, uy, vx, vy;
168 double tau_yx, tau_yy, qy;
169 tau_yx = (mu*inv_Re) * (uy + vx);
170 tau_yy = two_third * (mu*inv_Re) * (-ux + 2*vy);
171 qy = ( (mu*inv_Re) * inv_gamma_m1 * inv_Pr ) * Ty;
173 (FViscous+p)[0] = 0.0;
174 (FViscous+p)[1] = tau_yx;
175 (FViscous+p)[2] = tau_yy;
176 (FViscous+p)[3] = uvel*tau_yx + vvel*tau_yy + qy;
180 for (i=0; i<imax; i++) {
181 for (j=0; j<jmax; j++) {
182 int p,index[2]; index[0]=i; index[1]=j;
186 for (v=0; v<nvars; v++) (par+p)[v] += (dyinv * (FDeriv+p)[v] );
MPI related function definitions.
Contains function definitions for common mathematical functions.
#define _NavierStokes2DGetFlowVar_(u, rho, vx, vy, e, P, gamma)
int MPIExchangeBoundariesnD(int, int, int *, int, void *, double *)
Some basic definitions and macros.
int NavierStokes2DParabolicFunction(double *par, double *u, void *s, void *m, double t)
Structure containing all solver-specific variables and functions.
Contains structure definition for hypar.
2D Navier Stokes equations (compressible flows)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
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.
#define _ArraySetValue_(x, size, value)
int(* FirstDerivativePar)(double *, double *, int, int, void *, void *)
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Structure of MPI-related variables.
#define _ArrayScale1D_(x, a, size)
Contains macros and function definitions for common array operations.