HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
NavierStokes3DFunctions.c
Go to the documentation of this file.
1 
5 #include <stdio.h>
6 #include <math.h>
7 #include <basic.h>
8 #include <arrayfunctions.h>
10 #include <hypar.h>
11 
19  double *uavg,
20  double *uL,
21  double *uR,
22  void *p
23  )
24 {
25  NavierStokes3D *param = (NavierStokes3D*) p;
27  return(0);
28 }
29 
32  const double* const u,
33  void* s
34  )
35 {
36  HyPar *solver = (HyPar*) s;
37  NavierStokes3D *param = (NavierStokes3D*) solver->physics;
38  int i;
39 
40  int *dim = solver->dim_local;
41  int ghosts = solver->ghosts;
42  int ndims = solver->ndims;
43  int index[ndims], bounds[ndims], offset[ndims];
44 
45  /* set bounds for array index to include ghost points */
46  _ArrayCopy1D_(dim,bounds,ndims);
47  for (i=0; i<ndims; i++) bounds[i] += 2*ghosts;
48 
49  /* set offset such that index is compatible with ghost point arrangement */
50  _ArraySetValue_(offset,ndims,-ghosts);
51 
52  int done = 0; _ArraySetValue_(index,ndims,0);
53  while (!done) {
54  int idx; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,idx);
55  double rho, vx, vy, vz, e, pressure;
56  _NavierStokes3DGetFlowVar_((u+_MODEL_NVARS_*idx),_NavierStokes3D_stride_,rho,vx,vy,vz,e,pressure,param->gamma);
57  P[idx] = pressure;
58  _ArrayIncrementIndex_(ndims,bounds,index,done);
59  }
60 
61  return(0);
62 }
63 
66  const double* const u,
67  void* s
68  )
69 {
70  HyPar *solver = (HyPar*) s;
71  NavierStokes3D *param = (NavierStokes3D*) solver->physics;
72  int i;
73 
74  int *dim = solver->dim_local;
75  int ghosts = solver->ghosts;
76  int ndims = solver->ndims;
77  int index[ndims], bounds[ndims], offset[ndims];
78 
79  /* set bounds for array index to include ghost points */
80  _ArrayCopy1D_(dim,bounds,ndims);
81  for (i=0; i<ndims; i++) bounds[i] += 2*ghosts;
82 
83  /* set offset such that index is compatible with ghost point arrangement */
84  _ArraySetValue_(offset,ndims,-ghosts);
85 
86  int done = 0; _ArraySetValue_(index,ndims,0);
87  while (!done) {
88  int idx; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,idx);
89  double rho, vx, vy, vz, e, pressure;
90  _NavierStokes3DGetFlowVar_((u+_MODEL_NVARS_*idx),_NavierStokes3D_stride_,rho,vx,vy,vz,e,pressure,param->gamma);
91  T[idx] = pressure/rho;
92  _ArrayIncrementIndex_(ndims,bounds,index,done);
93  }
94 
95  return(0);
96 }
int NavierStokes3DComputeTemperature(double *T, const double *const u, void *s)
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.
#define _NavierStokes3DRoeAverage_(uavg, stride, uL, uR, gamma)
3D Navier Stokes equations (compressible flows)
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
Contains structure definition for hypar.
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
static const int _NavierStokes3D_stride_
#define _ArraySetValue_(x, size, value)
int * dim_local
Definition: hypar.h:37
#define _ArrayIncrementIndex_(N, imax, i, done)
int NavierStokes3DRoeAverage(double *uavg, double *uL, double *uR, void *p)
void * physics
Definition: hypar.h:266
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.
int NavierStokes3DComputePressure(double *P, const double *const u, void *s)
#define _NavierStokes3DGetFlowVar_(u, stride, rho, vx, vy, vz, e, P, gamma)