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

Go to the source code of this file.

Functions

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

Function Documentation

◆ Euler2DFlux()

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

Definition at line 7 of file Euler2DFlux.c.

8 {
9  HyPar *solver = (HyPar*) s;
10  Euler2D *param = (Euler2D*) solver->physics;
11  int i;
12 
13  int *dim = solver->dim_local;
14  int ghosts = solver->ghosts;
15  int ndims = solver->ndims;
16 
17  int index[ndims], bounds[ndims], offset[ndims];
18 
19  /* set bounds for array index to include ghost points */
20  _ArrayCopy1D_(dim,bounds,ndims);
21  for (i=0; i<ndims; i++) bounds[i] += 2*ghosts;
22 
23  /* set offset such that index is compatible with ghost point arrangement */
24  _ArraySetValue_(offset,ndims,-ghosts);
25 
26  int done = 0; _ArraySetValue_(index,ndims,0);
27  while (!done) {
28  int p; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,p);
29  double rho, vx, vy, e, P;
30  _Euler2DGetFlowVar_((u+_MODEL_NVARS_*p),rho,vx,vy,e,P,param);
31  _Euler2DSetFlux_((f+_MODEL_NVARS_*p),rho,vx,vy,e,P,param,dir);
32  _ArrayIncrementIndex_(ndims,bounds,index,done);
33  }
34 
35  return(0);
36 }
int ndims
Definition: hypar.h:26
#define _Euler2DGetFlowVar_(u, rho, vx, vy, e, P, p)
Definition: euler2d.h:44
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _Euler2DSetFlux_(f, rho, vx, vy, e, P, p, dir)
Definition: euler2d.h:55
#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)
void * physics
Definition: hypar.h:266
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _ArrayCopy1D_(x, y, size)