HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ShallowWater2DModifiedSolution.c
Go to the documentation of this file.
1 
6 #include <basic.h>
7 #include <arrayfunctions.h>
9 #include <mpivars.h>
10 #include <hypar.h>
11 
22  double *uC,
23  double *u,
24  int d,
25  void *s,
26  void *m,
27  double waqt
28  )
29 {
30  HyPar *solver = (HyPar*) s;
31  ShallowWater2D *param = (ShallowWater2D*) solver->physics;
32 
33  int ghosts = solver->ghosts;
34  int *dim = solver->dim_local;
35  int ndims = solver->ndims;
36  int index[ndims], bounds[ndims], offset[ndims];
37 
38  /* set bounds for array index to include ghost points */
39  _ArrayCopy1D_(dim,bounds,ndims);
40  int i; for (i=0; i<ndims; i++) bounds[i] += 2*ghosts;
41 
42  /* set offset such that index is compatible with ghost point arrangement */
43  _ArraySetValue_(offset,ndims,-ghosts);
44 
45  int done = 0; _ArraySetValue_(index,ndims,0);
46  while (!done) {
47  int p; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,p);
48  double h,uvel,vvel;
49  _ShallowWater2DGetFlowVar_((u+_MODEL_NVARS_*p),h,uvel,vvel);
50  uC[_MODEL_NVARS_*p+0] = h + param->b[p];
51  uC[_MODEL_NVARS_*p+1] = h * uvel;
52  uC[_MODEL_NVARS_*p+2] = h * vvel;
53  _ArrayIncrementIndex_(ndims,bounds,index,done);
54  }
55  return(0);
56 }
#define _ArraySetValue_(x, size, value)
#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
MPI related function definitions.
int ghosts
Definition: hypar.h:52
2D Shallow Water Equations
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArrayCopy1D_(x, y, size)
int ShallowWater2DModifiedSolution(double *, double *, int, void *, void *, double)
#define _ShallowWater2DGetFlowVar_(u, h, uvel, vvel)
Contains structure definition for hypar.
Some basic definitions and macros.
int ndims
Definition: hypar.h:26
Contains macros and function definitions for common array operations.
Structure containing variables and parameters specific to the 2D Shallow Water equations. This structure contains the physical parameters, variables, and function pointers specific to the 2D ShallowWater equations.
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23