HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
Numa2DFlux.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 Numa2DFlux (double *f, double *u, int dir, void *s, double t)
 
int Numa2DStiffFlux (double *f, double *u, int dir, void *s, double t)
 

Function Documentation

◆ Numa2DFlux()

int Numa2DFlux ( double *  f,
double *  u,
int  dir,
void *  s,
double  t 
)

Definition at line 7 of file Numa2DFlux.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,dP,rho0,T0,P0,EP,ycoord;
29 
30  _GetCoordinate_(_YDIR_,index[_YDIR_]-ghosts,dim,ghosts,solver->x,ycoord);
31  param->StandardAtmosphere(param,ycoord,&EP,&P0,&rho0,&T0);
32 
33  _Numa2DGetFlowVars_ ((u+_MODEL_NVARS_*p),drho,uvel,vvel,dT,rho0);
34  _Numa2DComputePressure_ (param,T0,dT,P0,dP);
35  _Numa2DSetFlux_ ((f+_MODEL_NVARS_*p),dir,drho,uvel,vvel,dT,dP,rho0,T0);
36 
37  _ArrayIncrementIndex_(ndims,bounds,index,done);
38  }
39 
40  return(0);
41 }
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 _Numa2DComputePressure_(params, T0, dT, P0, dP)
Definition: numa2d.h:79
#define _Numa2DSetFlux_(f, dir, drho, uvel, vvel, dT, dP, rho0, T0)
Definition: numa2d.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)

◆ Numa2DStiffFlux()

int Numa2DStiffFlux ( double *  f,
double *  u,
int  dir,
void *  s,
double  t 
)

Definition at line 43 of file Numa2DFlux.c.

44 {
45  HyPar *solver = (HyPar*) s;
46  Numa2D *param = (Numa2D*) solver->physics;
47  int i;
48 
49  int *dim = solver->dim_local;
50  int ghosts = solver->ghosts;
51  int ndims = solver->ndims;
52  int index[ndims], bounds[ndims], offset[ndims];
53 
54  /* set bounds for array index to include ghost points */
55  _ArrayCopy1D_(dim,bounds,ndims);
56  for (i=0; i<ndims; i++) bounds[i] += 2*ghosts;
57 
58  /* set offset such that index is compatible with ghost point arrangement */
59  _ArraySetValue_(offset,ndims,-ghosts);
60 
61  int done = 0; _ArraySetValue_(index,ndims,0);
62  while (!done) {
63  int p; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,p);
64  double drho,uvel,vvel,dT,dP,rho0,T0,P0,EP,ycoord;
65 
66  _GetCoordinate_(_YDIR_,index[_YDIR_]-ghosts,dim,ghosts,solver->x,ycoord);
67  param->StandardAtmosphere(param,ycoord,&EP,&P0,&rho0,&T0);
68 
69  _Numa2DGetFlowVars_ ((u+_MODEL_NVARS_*p),drho,uvel,vvel,dT,rho0);
70  _Numa2DComputeLinearizedPressure_ (param,T0,dT,P0,dP);
71  _Numa2DSetLinearFlux_ ((f+_MODEL_NVARS_*p),dir,drho,uvel,vvel,dT,dP,rho0,T0);
72 
73  _ArrayIncrementIndex_(ndims,bounds,index,done);
74  }
75 
76  return(0);
77 }
#define _Numa2DComputeLinearizedPressure_(params, T0, dT, P0, dP)
Definition: numa2d.h:88
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 _Numa2DSetLinearFlux_(f, dir, drho, uvel, vvel, dT, dP, rho0, T0)
Definition: numa2d.h:56
#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)