HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
ShallowWater1DModifiedSolution.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  ShallowWater1D *param = (ShallowWater1D*) 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,v;
50  uC[_MODEL_NVARS_*p+0] = h + param->b[p];
51  uC[_MODEL_NVARS_*p+1] = h * v;
52  _ArrayIncrementIndex_(ndims,bounds,index,done);
53  }
54  return(0);
55 }
Structure containing variables and parameters specific to the 1D Shallow Water equations. This structure contains the physical parameters, variables, and function pointers specific to the 1D ShallowWater equations.
1D Shallow Water Equations
MPI related function definitions.
Some basic definitions and macros.
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
Contains structure definition for hypar.
#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
#define _ShallowWater1DGetFlowVar_(u, h, v)
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.
int ShallowWater1DModifiedSolution(double *uC, double *u, int d, void *s, void *m, double waqt)