HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Euler1DModifiedSolution.c File Reference

Contains the function to compute the modified solution for a balanced discretization scheme. More...

#include <basic.h>
#include <arrayfunctions.h>
#include <physicalmodels/euler1d.h>
#include <mpivars.h>
#include <hypar.h>

Go to the source code of this file.

Functions

int Euler1DModifiedSolution (double *uC, double *u, int d, void *s, void *m, double waqt)
 

Detailed Description

Contains the function to compute the modified solution for a balanced discretization scheme.

Author
Debojyoti Ghosh

Definition in file Euler1DModifiedSolution.c.

Function Documentation

int Euler1DModifiedSolution ( double *  uC,
double *  u,
int  d,
void *  s,
void *  m,
double  waqt 
)

Compute the modified solution for the upwinding step in a balanced conservative finite-difference algorithm for the 1D Euler equations with gravitational sources. If no gravitational forces exist, the modified solution is identical to the solution.

Refer to

  • Xing, Y., Shu, C.-W., "High Order Well-Balanced WENO Scheme for the Gas Dynamics Equations Under Gravitational Fields", Journal of Scientific Computing, 54, 2013, pp. 645-662, http://dx.doi.org/10.1007/s10915-012-9585-8. See Eq. (3.8) on Page 651 on why this modification is needed.
Parameters
uCThe modified solution (same array size and layout as u)
uThe solution (conserved variables)
dSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
mMPI object of type MPIVariables
waqtCurrent solution time

Definition at line 23 of file Euler1DModifiedSolution.c.

31 {
32  HyPar *solver = (HyPar*) s;
33  Euler1D *param = (Euler1D*) solver->physics;
34 
35  int ghosts = solver->ghosts;
36  int *dim = solver->dim_local;
37  int ndims = solver->ndims;
38  int index[ndims], bounds[ndims], offset[ndims];
39 
40  /* set bounds for array index to include ghost points */
41  _ArrayCopy1D_(dim,bounds,ndims);
42  int i; for (i=0; i<ndims; i++) bounds[i] += 2*ghosts;
43 
44  /* set offset such that index is compatible with ghost point arrangement */
45  _ArraySetValue_(offset,ndims,-ghosts);
46 
47  int done = 0; _ArraySetValue_(index,ndims,0);
48  while (!done) {
49  int p; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,p); p *= _MODEL_NVARS_;
50  _ArrayScaleCopy1D_((u+p),(1.0/param->grav_field[p/_MODEL_NVARS_]),(uC+p),_MODEL_NVARS_);
51  _ArrayIncrementIndex_(ndims,bounds,index,done);
52  }
53  return(0);
54 }
#define _ArraySetValue_(x, size, value)
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _ArrayScaleCopy1D_(x, a, y, size)
void * physics
Definition: hypar.h:266
int * dim_local
Definition: hypar.h:37
int ghosts
Definition: hypar.h:52
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArrayCopy1D_(x, y, size)
double * grav_field
Definition: euler1d.h:288
int ndims
Definition: hypar.h:26
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