HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
Numa3DSource.c File Reference
#include <stdlib.h>
#include <basic.h>
#include <arrayfunctions.h>
#include <physicalmodels/numa3d.h>
#include <hypar.h>

Go to the source code of this file.

Functions

int Numa3DSource (double *S, double *u, void *s, void *m, double t)
 

Function Documentation

◆ Numa3DSource()

int Numa3DSource ( double *  S,
double *  u,
void *  s,
void *  m,
double  t 
)

Definition at line 7 of file Numa3DSource.c.

8 {
9  HyPar *solver = (HyPar*) s;
10  Numa3D *param = (Numa3D*) solver->physics;
11  int i;
12 
13  int *dim = solver->dim_local;
14  int ghosts = solver->ghosts;
15  int ndims = solver->ndims;
16  int index[ndims], bounds[ndims], offset[ndims];
17 
18  /* set bounds for array index to include ghost points */
19  _ArrayCopy1D_(dim,bounds,ndims);
20  for (i=0; i<ndims; i++) bounds[i] += 2*ghosts;
21 
22  /* set offset such that index is compatible with ghost point arrangement */
23  _ArraySetValue_(offset,ndims,-ghosts);
24 
25  int done = 0; _ArraySetValue_(index,ndims,0);
26  while (!done) {
27  int p; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,p);
28  double drho,uvel,vvel,wvel,dT,rho0,P0,EP,T0,zcoord;
29 
30  _GetCoordinate_(_ZDIR_,index[_ZDIR_]-ghosts,dim,ghosts,solver->x,zcoord);
31  param->StandardAtmosphere(param,zcoord,&EP,&P0,&rho0,&T0);
32  _Numa3DGetFlowVars_((u+_MODEL_NVARS_*p),drho,uvel,vvel,wvel,dT,rho0);
33  _Numa3DSetSource_ ((S+_MODEL_NVARS_*p),param,uvel,vvel,drho,rho0);
34 
35  _ArrayIncrementIndex_(ndims,bounds,index,done);
36 
37  /* some useless statements to avoid compiler warnings */
38  dT = wvel;
39  wvel = dT;
40  }
41 
42  return(0);
43 }
#define _ZDIR_
#define _Numa3DGetFlowVars_(u, drho, uvel, vvel, wvel, dT, rho0)
Definition: numa3d.h:39
double * x
Definition: hypar.h:107
Definition: numa3d.h:128
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArraySetValue_(x, size, value)
int * dim_local
Definition: hypar.h:37
void(* StandardAtmosphere)(void *, double, double *, double *, double *, double *)
Definition: numa3d.h:139
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Definition: basic.h:31
void * physics
Definition: hypar.h:266
#define _Numa3DSetSource_(s, param, uvel, vvel, drho, rho0)
Definition: numa3d.h:94
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _ArrayCopy1D_(x, y, size)