HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Euler1DFlux.c
Go to the documentation of this file.
1 
6 #include <stdlib.h>
7 #include <arrayfunctions.h>
9 #include <hypar.h>
10 
17  double *f,
18  double *u,
19  int dir,
20  void *s,
21  double t
22  )
23 {
24  HyPar *solver = (HyPar*) s;
25  Euler1D *param = (Euler1D*) solver->physics;
26  int *dim = solver->dim_local;
27  int ghosts = solver->ghosts;
28  static const int ndims = _MODEL_NDIMS_;
29  static const int nvars = _MODEL_NVARS_;
30  static int index[_MODEL_NDIMS_], bounds[_MODEL_NDIMS_], offset[_MODEL_NDIMS_];
31 
32  /* set bounds for array index to include ghost points */
33  _ArrayAddCopy1D_(dim,(2*ghosts),bounds,ndims);
34  /* set offset such that index is compatible with ghost point arrangement */
35  _ArraySetValue_(offset,ndims,-ghosts);
36 
37  int done = 0; _ArraySetValue_(index,ndims,0);
38  while (!done) {
39  int p; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,p);
40  double rho, v, e, P;
41  _Euler1DGetFlowVar_((u+nvars*p),rho,v,e,P,param);
42  _Euler1DSetFlux_((f+nvars*p),rho,v,e,P);
43  _ArrayIncrementIndex_(ndims,bounds,index,done);
44  }
45 
46  return(0);
47 }
48 
65  double *f,
66  double *u,
67  int dir,
68  void *s,
69  double t
70  )
71 {
72  HyPar *solver = (HyPar*) s;
73  Euler1D *param = (Euler1D*) solver->physics;
74  int *dim = solver->dim_local;
75  int ghosts = solver->ghosts;
76  static const int ndims = _MODEL_NDIMS_;
77  static const int nvars = _MODEL_NVARS_;
78  static int index[_MODEL_NDIMS_], bounds[_MODEL_NDIMS_], offset[_MODEL_NDIMS_];
79 
80  /* set bounds for array index to include ghost points */
81  _ArrayAddCopy1D_(dim,(2*ghosts),bounds,ndims);
82  /* set offset such that index is compatible with ghost point arrangement */
83  _ArraySetValue_(offset,ndims,-ghosts);
84 
85  int done = 0; _ArraySetValue_(index,ndims,0);
86  while (!done) {
87  int p; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,p);
88  _Euler1DSetLinearizedStiffFlux_((f+nvars*p),(u+nvars*p),(param->fast_jac+nvars*nvars*p));
89  _ArrayIncrementIndex_(ndims,bounds,index,done);
90  }
91 
92  return(0);
93 }
#define _ArraySetValue_(x, size, value)
#define _Euler1DGetFlowVar_(u, rho, v, e, P, p)
Definition: euler1d.h:81
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _MODEL_NVARS_
Definition: euler1d.h:58
void * physics
Definition: hypar.h:266
int * dim_local
Definition: hypar.h:37
#define _MODEL_NDIMS_
Definition: euler1d.h:56
int ghosts
Definition: hypar.h:52
int Euler1DStiffFlux(double *f, double *u, int dir, void *s, double t)
Definition: Euler1DFlux.c:64
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
double * fast_jac
Definition: euler1d.h:289
Contains structure definition for hypar.
#define _Euler1DSetFlux_(f, rho, v, e, P)
Definition: euler1d.h:94
int Euler1DFlux(double *f, double *u, int dir, void *s, double t)
Definition: Euler1DFlux.c:16
Contains macros and function definitions for common array operations.
#define _ArrayAddCopy1D_(x, a, y, size)
1D Euler Equations (inviscid, compressible flows)
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
#define _Euler1DSetLinearizedStiffFlux_(f, u, J)
Definition: euler1d.h:134