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

Go to the source code of this file.

Functions

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

Function Documentation

◆ Numa2DSource()

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

Definition at line 7 of file Numa2DSource.c.

8 {
9  HyPar *solver = (HyPar*) s;
10  Numa2D *param = (Numa2D*) 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,dT,rho0,P0,EP,T0,ycoord;
29 
30  _GetCoordinate_(_YDIR_,index[_YDIR_]-ghosts,dim,ghosts,solver->x,ycoord);
31  param->StandardAtmosphere (param,ycoord,&EP,&P0,&rho0,&T0);
32  _Numa2DGetFlowVars_ ((u+_MODEL_NVARS_*p),drho,uvel,vvel,dT,rho0);
33  _Numa2DSetSource_ ((S+_MODEL_NVARS_*p),param,drho);
34 
35  /* some useless statements to avoid compiler warnings */
36  uvel = dT;
37  vvel = uvel;
38  dT = vvel;
39 
40  _ArrayIncrementIndex_(ndims,bounds,index,done);
41  }
42 
43  return(0);
44 }
#define _Numa2DSetSource_(s, param, drho)
Definition: numa2d.h:71
double * x
Definition: hypar.h:107
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
Definition: numa2d.h:109
#define _YDIR_
Definition: euler2d.h:41
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArraySetValue_(x, size, value)
int * dim_local
Definition: hypar.h:37
#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 _Numa2DGetFlowVars_(u, drho, uvel, vvel, dT, rho0)
Definition: numa2d.h:33
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
void(* StandardAtmosphere)(void *, double, double *, double *, double *, double *)
Definition: numa2d.h:120
#define _ArrayCopy1D_(x, y, size)