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

Function Documentation

◆ Numa3DFlux()

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

Definition at line 7 of file Numa3DFlux.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,dP,rho0,T0,P0,EP,zcoord;
29 
30  _GetCoordinate_(_ZDIR_,index[_ZDIR_]-ghosts,dim,ghosts,solver->x,zcoord);
31  param->StandardAtmosphere(param,zcoord,&EP,&P0,&rho0,&T0);
32 
33  _Numa3DGetFlowVars_ ((u+_MODEL_NVARS_*p),drho,uvel,vvel,wvel,dT,rho0);
34  _Numa3DComputePressure_ (param,T0,dT,P0,dP);
35  _Numa3DSetFlux_ ((f+_MODEL_NVARS_*p),dir,drho,uvel,vvel,wvel,dT,dP,rho0,T0);
36 
37  _ArrayIncrementIndex_(ndims,bounds,index,done);
38  }
39 
40  return(0);
41 }
#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 _Numa3DSetFlux_(f, dir, drho, uvel, vvel, wvel, dT, dP, rho0, T0)
Definition: numa3d.h:48
#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
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _ArrayCopy1D_(x, y, size)
#define _Numa3DComputePressure_(params, T0, dT, P0, dP)
Definition: numa3d.h:103

◆ Numa3DStiffFlux()

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

Definition at line 43 of file Numa3DFlux.c.

44 {
45  HyPar *solver = (HyPar*) s;
46  Numa3D *param = (Numa3D*) 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,wvel,dT,dP,rho0,T0,P0,EP,zcoord;
65 
66  _GetCoordinate_(_ZDIR_,index[_ZDIR_]-ghosts,dim,ghosts,solver->x,zcoord);
67  param->StandardAtmosphere(param,zcoord,&EP,&P0,&rho0,&T0);
68 
69  _Numa3DGetFlowVars_ ((u+_MODEL_NVARS_*p),drho,uvel,vvel,wvel,dT,rho0);
70  _Numa3DComputeLinearizedPressure_ (param,T0,dT,P0,dP);
71  _Numa3DSetLinearFlux_ ((f+_MODEL_NVARS_*p),dir,drho,uvel,vvel,wvel,dT,dP,rho0,T0);
72 
73  _ArrayIncrementIndex_(ndims,bounds,index,done);
74  }
75 
76  return(0);
77 }
#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
#define _Numa3DSetLinearFlux_(f, dir, drho, uvel, vvel, wvel, dT, dP, rho0, T0)
Definition: numa3d.h:71
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 _Numa3DComputeLinearizedPressure_(params, T0, dT, P0, dP)
Definition: numa3d.h:112
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _ArrayCopy1D_(x, y, size)