HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
Euler1DInitialize.c File Reference

Initialize the 1D Euler equations module. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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

double Euler1DComputeCFL (void *, void *, double, double)
 
int Euler1DFlux (double *, double *, int, void *, double)
 
int Euler1DStiffFlux (double *, double *, int, void *, double)
 
int Euler1DSource (double *, double *, void *, void *, double)
 
int Euler1DUpwindRoe (double *, double *, double *, double *, double *, double *, int, void *, double)
 
int Euler1DUpwinddFRoe (double *, double *, double *, double *, double *, double *, int, void *, double)
 
int Euler1DUpwindRF (double *, double *, double *, double *, double *, double *, int, void *, double)
 
int Euler1DUpwinddFRF (double *, double *, double *, double *, double *, double *, int, void *, double)
 
int Euler1DUpwindLLF (double *, double *, double *, double *, double *, double *, int, void *, double)
 
int Euler1DUpwinddFLLF (double *, double *, double *, double *, double *, double *, int, void *, double)
 
int Euler1DUpwindSWFS (double *, double *, double *, double *, double *, double *, int, void *, double)
 
int Euler1DUpwindRusanov (double *, double *, double *, double *, double *, double *, int, void *, double)
 
int Euler1DJacobian (double *, double *, void *, int, int, int)
 
int Euler1DStiffJacobian (double *, double *, void *, int, int, int)
 
int Euler1DRoeAverage (double *, double *, double *, void *)
 
int Euler1DLeftEigenvectors (double *, double *, void *, int)
 
int Euler1DRightEigenvectors (double *, double *, void *, int)
 
int Euler1DGravityField (void *, void *)
 
int Euler1DSourceUpwindLLF (double *, double *, double *, double *, int, void *, double)
 
int Euler1DSourceUpwindRoe (double *, double *, double *, double *, int, void *, double)
 
int Euler1DModifiedSolution (double *, double *, int, void *, void *, double)
 
int Euler1DPreStep (double *, void *, void *, double)
 
int Euler1DInitialize (void *s, void *m)
 

Detailed Description

Initialize the 1D Euler equations module.

Author
Debojyoti Ghosh

Definition in file Euler1DInitialize.c.

Function Documentation

◆ Euler1DComputeCFL()

double Euler1DComputeCFL ( void *  s,
void *  m,
double  dt,
double  t 
)

Computes the maximum CFL number over the domain. Note that the CFL is computed over the local domain on this processor only.

Parameters
sSolver object of type HyPar
mMPI object of type MPIVariables
dtTime step size for which to compute the CFL
tTime

Definition at line 17 of file Euler1DComputeCFL.c.

23 {
24  HyPar *solver = (HyPar*) s;
25  Euler1D *param = (Euler1D*) solver->physics;
26 
27  int *dim = solver->dim_local;
28  int ghosts = solver->ghosts;
29  int ndims = solver->ndims;
30  int index[ndims];
31  double *u = solver->u;
32 
33  double max_cfl = 0;
34  int done = 0; _ArraySetValue_(index,ndims,0);
35  while (!done) {
36  int p; _ArrayIndex1D_(ndims,dim,index,ghosts,p);
37  double rho, v, e, P, c, dxinv, local_cfl;
38  _Euler1DGetFlowVar_((u+_MODEL_NVARS_*p),rho,v,e,P,param);
39  _GetCoordinate_(0,index[0],dim,ghosts,solver->dxinv,dxinv); /* 1/dx */
40  c = sqrt(param->gamma*P/rho); /* speed of sound */
41  local_cfl = (absolute(v)+c)*dt*dxinv; /* local cfl for this grid point */
42  if (local_cfl > max_cfl) max_cfl = local_cfl;
43  _ArrayIncrementIndex_(ndims,dim,index,done);
44  }
45 
46  return(max_cfl);
47 }
double gamma
Definition: euler1d.h:274
#define absolute(a)
Definition: math_ops.h:32
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
double * u
Definition: hypar.h:116
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _ArraySetValue_(x, size, value)
int * dim_local
Definition: hypar.h:37
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Definition: basic.h:31
void * physics
Definition: hypar.h:266
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _Euler1DGetFlowVar_(u, rho, v, e, P, p)
Definition: euler1d.h:81
double * dxinv
Definition: hypar.h:110

◆ Euler1DFlux()

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

Compute the hyperbolic flux over the local domain.

\begin{equation} {\bf F}\left({\bf u}\right) = \left[\begin{array}{c} \rho u \\ \rho u^2 + p \\ (e+p) u \end{array}\right] \end{equation}

Parameters
fArray to hold the computed flux (same size and layout as u)
uArray containing the conserved solution
dirSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
tCurrent time

Definition at line 16 of file Euler1DFlux.c.

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 }
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
#define _ArrayAddCopy1D_(x, a, y, size)
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _MODEL_NDIMS_
Definition: euler1d.h:56
#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 _Euler1DSetFlux_(f, rho, v, e, P)
Definition: euler1d.h:94
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _Euler1DGetFlowVar_(u, rho, v, e, P, p)
Definition: euler1d.h:81

◆ Euler1DStiffFlux()

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

Compute the stiff component of the hyperbolic flux over the local domain.

\begin{equation} {\bf F}_F\left({\bf u}\right) = A_f\left({\bf u}\right){\bf u} \end{equation}

where \(A_f\left({\bf u}\right) \) is the fast Jacobian representing the acoustic waves only. A linearized formulation is used where the fast Jacobian \(A_f\) is computed for the solution at the beginning of each time step in Euler1DPreStep.

See also
_Euler1DSetStiffFlux_, _Euler1DSetLinearizedStiffFlux_, _Euler1DSetStiffJac_

Reference:

  • Ghosh, D., Constantinescu, E. M., Semi-Implicit Time Integration of Atmospheric Flows with Characteristic-Based Flux Partitioning, SIAM Journal on Scientific Computing, 38 (3), 2016, A1848-A1875, http://dx.doi.org/10.1137/15M1044369
Parameters
fArray to hold the computed flux (same size and layout as u)
uArray containing the conserved solution
dirSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
tCurrent time

Definition at line 64 of file Euler1DFlux.c.

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 }
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
double * fast_jac
Definition: euler1d.h:289
#define _ArrayAddCopy1D_(x, a, y, size)
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _MODEL_NDIMS_
Definition: euler1d.h:56
#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

◆ Euler1DSource()

int Euler1DSource ( double *  source,
double *  u,
void *  s,
void *  m,
double  t 
)

Compute the gravitational source terms for the 1D Euler equations. The source term is computed according to the balanced formulation introduced in the reference below. The source term is reformulated and "discretized" in a similar fashion as the hyperbolic flux to ensure that the hydrostatic balance is maintained to machine precision.

Parameters
sourceComputed source terms (array size & layout same as u)
uSolution (conserved variables)
sSolver object of type HyPar
mMPI object of type MPIVariables
tCurrent solution time

Definition at line 23 of file Euler1DSource.c.

30 {
31  HyPar *solver = (HyPar* ) s;
32  MPIVariables *mpi = (MPIVariables*) m;
33  Euler1D *param = (Euler1D*) solver->physics;
34 
35  if (param->grav == 0.0) return(0); /* no gravitational forces */
36 
37  int v, done, p, p1, p2;
38  double *SourceI = solver->fluxI; /* interace source term */
39  double *SourceC = solver->fluxC; /* cell-centered source term */
40  double *SourceL = solver->fL;
41  double *SourceR = solver->fR;
42 
43  int ndims = solver->ndims;
44  int ghosts = solver->ghosts;
45  int *dim = solver->dim_local;
46  double *x = solver->x;
47  double *dxinv = solver->dxinv;
48  int index[ndims],index1[ndims],index2[ndims],dim_interface[ndims];
49 
50  /* set interface dimensions */
51  _ArrayCopy1D_(dim,dim_interface,ndims); dim_interface[_XDIR_]++;
52  /* calculate the split source function exp(-phi/RT) */
53  IERR Euler1DSourceFunction(SourceC,u,x,solver,mpi,t); CHECKERR(ierr);
54  /* calculate the left and right interface source terms */
55  IERR solver->InterpolateInterfacesHyp(SourceL,SourceC,u,x, 1,_XDIR_,solver,mpi,0); CHECKERR(ierr);
56  IERR solver->InterpolateInterfacesHyp(SourceR,SourceC,u,x,-1,_XDIR_,solver,mpi,0); CHECKERR(ierr);
57  /* calculate the final interface source term */
58  IERR param->SourceUpwind(SourceI,SourceL,SourceR,u,_XDIR_,solver,t);
59  /* calculate the final cell-centered source term */
60  done = 0; _ArraySetValue_(index,ndims,0);
61  while (!done) {
62  _ArrayCopy1D_(index,index1,ndims);
63  _ArrayCopy1D_(index,index2,ndims); index2[_XDIR_]++;
64  _ArrayIndex1D_(ndims,dim ,index ,ghosts,p );
65  _ArrayIndex1D_(ndims,dim_interface,index1,0 ,p1);
66  _ArrayIndex1D_(ndims,dim_interface,index2,0 ,p2);
67  double dx_inverse; _GetCoordinate_(_XDIR_,index[_XDIR_],dim,ghosts,dxinv,dx_inverse);
68  double rho, vel, e, P; _Euler1DGetFlowVar_((u+_MODEL_NVARS_*p),rho,vel,e,P,param);
69  double term[_MODEL_NVARS_] = {0.0, rho, rho*vel};
70  for (v=0; v<_MODEL_NVARS_; v++) {
71  source[_MODEL_NVARS_*p+v] += ( (term[v]*(1.0/param->grav_field[p]))
72  * (SourceI[_MODEL_NVARS_*p2+v]-SourceI[_MODEL_NVARS_*p1+v])*dx_inverse );
73  }
74  vel = P; /* useless statement to avoid compiler warning */
75  _ArrayIncrementIndex_(ndims,dim,index,done);
76  }
77 
78  return(0);
79 }
#define IERR
Definition: basic.h:16
#define CHECKERR(ierr)
Definition: basic.h:18
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int(* SourceUpwind)(double *, double *, double *, double *, int, void *, double)
Definition: euler1d.h:300
double * x
Definition: hypar.h:107
double * fluxI
Definition: hypar.h:136
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
int(* InterpolateInterfacesHyp)(double *, double *, double *, double *, int, int, void *, void *, int)
Definition: hypar.h:224
#define _ArrayIndex1D_(N, imax, i, ghost, index)
double grav
Definition: euler1d.h:275
#define _ArraySetValue_(x, size, value)
int * dim_local
Definition: hypar.h:37
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Definition: basic.h:31
void * physics
Definition: hypar.h:266
double * fR
Definition: hypar.h:139
double * fL
Definition: hypar.h:139
#define _XDIR_
Definition: euler1d.h:75
int ghosts
Definition: hypar.h:52
Structure of MPI-related variables.
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _Euler1DGetFlowVar_(u, rho, v, e, P, p)
Definition: euler1d.h:81
#define _ArrayCopy1D_(x, y, size)
double * grav_field
Definition: euler1d.h:288
double * fluxC
Definition: hypar.h:128
static int Euler1DSourceFunction(double *, double *, double *, void *, void *, double)
Definition: Euler1DSource.c:89
double * dxinv
Definition: hypar.h:110

◆ Euler1DUpwindRoe()

int Euler1DUpwindRoe ( double *  fI,
double *  fL,
double *  fR,
double *  uL,
double *  uR,
double *  u,
int  dir,
void *  s,
double  t 
)

Roe's upwinding scheme.

\begin{equation} {\bf f}_{j+1/2} = \frac{1}{2}\left[ {\bf f}_{j+1/2}^L + {\bf f}_{j+1/2}^R - \left| A\left({\bf u}_{j+1/2}^L,{\bf u}_{j+1/2}^R\right) \right| \left( {\bf u}_{j+1/2}^R - {\bf u}_{j+1/2}^L \right)\right] \end{equation}

This upwinding scheme is modified for the balanced discretization of the 1D Euler equations when there is a non-zero gravitational force. See the reference below. For flows without any gravitational forces, it reduces to its original form.

Parameters
fIComputed upwind interface flux
fLLeft-biased reconstructed interface flux
fRRight-biased reconstructed interface flux
uLLeft-biased reconstructed interface solution
uRRight-biased reconstructed interface solution
uCell-centered solution
dirSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
tCurrent solution time

Definition at line 30 of file Euler1DUpwind.c.

41 {
42  HyPar *solver = (HyPar*) s;
43  Euler1D *param = (Euler1D*) solver->physics;
44  int done,k;
46 
47  int ndims = solver->ndims;
48  int ghosts= solver->ghosts;
49  int *dim = solver->dim_local;
50 
51  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
52  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
53  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
56 
57  done = 0; _ArraySetValue_(index_outer,ndims,0);
58  while (!done) {
59  _ArrayCopy1D_(index_outer,index_inter,ndims);
60  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
61  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
62  int indexL[ndims]; _ArrayCopy1D_(index_inter,indexL,ndims); indexL[dir]--;
63  int indexR[ndims]; _ArrayCopy1D_(index_inter,indexR,ndims);
64  int pL; _ArrayIndex1D_(ndims,dim,indexL,ghosts,pL);
65  int pR; _ArrayIndex1D_(ndims,dim,indexR,ghosts,pR);
66  double udiff[_MODEL_NVARS_], uavg[_MODEL_NVARS_],udiss[_MODEL_NVARS_];
67 
68  /* Roe's upwinding scheme */
69 
70  udiff[0] = 0.5 * (uR[_MODEL_NVARS_*p+0] - uL[_MODEL_NVARS_*p+0]);
71  udiff[1] = 0.5 * (uR[_MODEL_NVARS_*p+1] - uL[_MODEL_NVARS_*p+1]);
72  udiff[2] = 0.5 * (uR[_MODEL_NVARS_*p+2] - uL[_MODEL_NVARS_*p+2]);
73 
74  _Euler1DRoeAverage_ (uavg,(u+_MODEL_NVARS_*pL),(u+_MODEL_NVARS_*pR),param);
75  _Euler1DEigenvalues_ (uavg,D,param,0);
76  _Euler1DLeftEigenvectors_ (uavg,L,param,0);
77  _Euler1DRightEigenvectors_ (uavg,R,param,0);
78 
79  double kappa = max(param->grav_field[pL],param->grav_field[pR]);
80  k = 0; D[k] = kappa*absolute(D[k]);
81  k = 4; D[k] = kappa*absolute(D[k]);
82  k = 8; D[k] = kappa*absolute(D[k]);
83 
84  MatMult3(3,DL,D,L);
85  MatMult3(3,modA,R,DL);
86 
87  udiss[0] = modA[0*_MODEL_NVARS_+0]*udiff[0] + modA[0*_MODEL_NVARS_+1]*udiff[1] + modA[0*_MODEL_NVARS_+2]*udiff[2];
88  udiss[1] = modA[1*_MODEL_NVARS_+0]*udiff[0] + modA[1*_MODEL_NVARS_+1]*udiff[1] + modA[1*_MODEL_NVARS_+2]*udiff[2];
89  udiss[2] = modA[2*_MODEL_NVARS_+0]*udiff[0] + modA[2*_MODEL_NVARS_+1]*udiff[1] + modA[2*_MODEL_NVARS_+2]*udiff[2];
90 
91  fI[_MODEL_NVARS_*p+0] = 0.5 * (fL[_MODEL_NVARS_*p+0]+fR[_MODEL_NVARS_*p+0]) - udiss[0];
92  fI[_MODEL_NVARS_*p+1] = 0.5 * (fL[_MODEL_NVARS_*p+1]+fR[_MODEL_NVARS_*p+1]) - udiss[1];
93  fI[_MODEL_NVARS_*p+2] = 0.5 * (fL[_MODEL_NVARS_*p+2]+fR[_MODEL_NVARS_*p+2]) - udiss[2];
94  }
95  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
96  }
97 
98  return(0);
99 }
#define absolute(a)
Definition: math_ops.h:32
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int ndims
Definition: hypar.h:26
#define _Euler1DLeftEigenvectors_(u, L, p, dir)
Definition: euler1d.h:225
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _Euler1DEigenvalues_(u, D, p, dir)
Definition: euler1d.h:207
#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 _Euler1DRightEigenvectors_(u, R, p, dir)
Definition: euler1d.h:249
int ghosts
Definition: hypar.h:52
#define MatMult3(N, A, X, Y)
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _DECLARE_IERR_
Definition: basic.h:17
#define _ArrayCopy1D_(x, y, size)
#define max(a, b)
Definition: math_ops.h:18
#define _Euler1DRoeAverage_(uavg, uL, uR, p)
Definition: euler1d.h:169
double * grav_field
Definition: euler1d.h:288

◆ Euler1DUpwinddFRoe()

int Euler1DUpwinddFRoe ( double *  fI,
double *  fL,
double *  fR,
double *  uL,
double *  uR,
double *  u,
int  dir,
void *  s,
double  t 
)

The Roe upwinding scheme (Euler1DUpwindRoe) for the partitioned hyperbolic flux that comprises of the acoustic waves only (see Euler1DStiffFlux, _Euler1DSetStiffFlux_). Thus, only the characteristic fields / eigen-modes corresponding to \( u\pm a\) are used.

Parameters
fIComputed upwind interface flux
fLLeft-biased reconstructed interface flux
fRRight-biased reconstructed interface flux
uLLeft-biased reconstructed interface solution
uRRight-biased reconstructed interface solution
uCell-centered solution
dirSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
tCurrent solution time

Definition at line 453 of file Euler1DUpwind.c.

464 {
465  HyPar *solver = (HyPar*) s;
466  Euler1D *param = (Euler1D*) solver->physics;
467  int done,k;
469 
470  int ndims = solver->ndims;
471  int ghosts= solver->ghosts;
472  int *dim = solver->dim_local;
473  double *uref = param->solution;
474 
475  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
476  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
477  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
480 
481  done = 0; _ArraySetValue_(index_outer,ndims,0);
482  while (!done) {
483  _ArrayCopy1D_(index_outer,index_inter,ndims);
484  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
485  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
486  int indexL[ndims]; _ArrayCopy1D_(index_inter,indexL,ndims); indexL[dir]--;
487  int indexR[ndims]; _ArrayCopy1D_(index_inter,indexR,ndims);
488  int pL; _ArrayIndex1D_(ndims,dim,indexL,ghosts,pL);
489  int pR; _ArrayIndex1D_(ndims,dim,indexR,ghosts,pR);
490  double udiff[_MODEL_NVARS_], uavg[_MODEL_NVARS_],udiss[_MODEL_NVARS_];
491 
492  /* Roe's upwinding scheme */
493 
494  udiff[0] = 0.5 * (uR[_MODEL_NVARS_*p+0] - uL[_MODEL_NVARS_*p+0]);
495  udiff[1] = 0.5 * (uR[_MODEL_NVARS_*p+1] - uL[_MODEL_NVARS_*p+1]);
496  udiff[2] = 0.5 * (uR[_MODEL_NVARS_*p+2] - uL[_MODEL_NVARS_*p+2]);
497 
498  _Euler1DRoeAverage_ (uavg,(uref+_MODEL_NVARS_*pL),(uref+_MODEL_NVARS_*pR),param);
499  _Euler1DEigenvalues_ (uavg,D,param,0);
500  _Euler1DLeftEigenvectors_ (uavg,L,param,0);
501  _Euler1DRightEigenvectors_ (uavg,R,param,0);
502 
503  double kappa = max(param->grav_field[pL],param->grav_field[pR]);
504  k = 0; D[k] = 0.0;
505  k = 4; D[k] = kappa*absolute(D[k]);
506  k = 8; D[k] = kappa*absolute(D[k]);
507 
508  MatMult3(3,DL,D,L);
509  MatMult3(3,modA,R,DL);
510 
511  udiss[0] = modA[0*_MODEL_NVARS_+0]*udiff[0] + modA[0*_MODEL_NVARS_+1]*udiff[1] + modA[0*_MODEL_NVARS_+2]*udiff[2];
512  udiss[1] = modA[1*_MODEL_NVARS_+0]*udiff[0] + modA[1*_MODEL_NVARS_+1]*udiff[1] + modA[1*_MODEL_NVARS_+2]*udiff[2];
513  udiss[2] = modA[2*_MODEL_NVARS_+0]*udiff[0] + modA[2*_MODEL_NVARS_+1]*udiff[1] + modA[2*_MODEL_NVARS_+2]*udiff[2];
514 
515  fI[_MODEL_NVARS_*p+0] = 0.5 * (fL[_MODEL_NVARS_*p+0]+fR[_MODEL_NVARS_*p+0]) - udiss[0];
516  fI[_MODEL_NVARS_*p+1] = 0.5 * (fL[_MODEL_NVARS_*p+1]+fR[_MODEL_NVARS_*p+1]) - udiss[1];
517  fI[_MODEL_NVARS_*p+2] = 0.5 * (fL[_MODEL_NVARS_*p+2]+fR[_MODEL_NVARS_*p+2]) - udiss[2];
518  }
519  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
520  }
521 
522  return(0);
523 }
#define absolute(a)
Definition: math_ops.h:32
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int ndims
Definition: hypar.h:26
#define _Euler1DLeftEigenvectors_(u, L, p, dir)
Definition: euler1d.h:225
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _Euler1DEigenvalues_(u, D, p, dir)
Definition: euler1d.h:207
#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 _Euler1DRightEigenvectors_(u, R, p, dir)
Definition: euler1d.h:249
double * solution
Definition: euler1d.h:290
int ghosts
Definition: hypar.h:52
#define MatMult3(N, A, X, Y)
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _DECLARE_IERR_
Definition: basic.h:17
#define _ArrayCopy1D_(x, y, size)
#define max(a, b)
Definition: math_ops.h:18
#define _Euler1DRoeAverage_(uavg, uL, uR, p)
Definition: euler1d.h:169
double * grav_field
Definition: euler1d.h:288

◆ Euler1DUpwindRF()

int Euler1DUpwindRF ( double *  fI,
double *  fL,
double *  fR,
double *  uL,
double *  uR,
double *  u,
int  dir,
void *  s,
double  t 
)

Characteristic-based Roe-fixed upwinding scheme.

\begin{align} \alpha_{j+1/2}^{k,L} &= \sum_{k=1}^3 {\bf l}_{j+1/2}^k \cdot {\bf f}_{j+1/2}^{k,L}, \\ \alpha_{j+1/2}^{k,R} &= \sum_{k=1}^3 {\bf l}_{j+1/2}^k \cdot {\bf f}_{j+1/2}^{k,R}, \\ v_{j+1/2}^{k,L} &= \sum_{k=1}^3 {\bf l}_{j+1/2}^k \cdot {\bf u}_{j+1/2}^{k,L}, \\ v_{j+1/2}^{k,R} &= \sum_{k=1}^3 {\bf l}_{j+1/2}^k \cdot {\bf u}_{j+1/2}^{k,R}, \\ \alpha_{j+1/2}^k &= \left\{ \begin{array}{cc} \alpha_{j+1/2}^{k,L} & {\rm if}\ \lambda_{j,j+1/2,j+1} > 0 \\ \alpha_{j+1/2}^{k,R} & {\rm if}\ \lambda_{j,j+1/2,j+1} < 0 \\ \frac{1}{2}\left[ \alpha_{j+1/2}^{k,L} + \alpha_{j+1/2}^{k,R} - \left(\max_{\left[j,j+1\right]} \lambda\right) \left( v_{j+1/2}^{k,R} - v_{j+1/2}^{k,L} \right) \right] & {\rm otherwise} \end{array}\right., \\ {\bf f}_{j+1/2} &= \sum_{k=1}^3 \alpha_{j+1/2}^k {\bf r}_{j+1/2}^k \end{align}

where \({\bf l}\), \({\bf r}\), and \(\lambda\) are the left-eigenvectors, right-eigenvectors and eigenvalues. The subscripts denote the grid locations.

Note that this upwinding scheme cannot be used for solving flows with non-zero gravitational forces.

Parameters
fIComputed upwind interface flux
fLLeft-biased reconstructed interface flux
fRRight-biased reconstructed interface flux
uLLeft-biased reconstructed interface solution
uRRight-biased reconstructed interface solution
uCell-centered solution
dirSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
tCurrent solution time

Definition at line 115 of file Euler1DUpwind.c.

126 {
127  HyPar *solver = (HyPar*) s;
128  Euler1D *param = (Euler1D*) solver->physics;
129  int done,k;
131 
132  int ndims = solver->ndims;
133  int *dim = solver->dim_local;
134  int ghosts = solver->ghosts;
135 
136  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
137  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
138  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
140 
141  done = 0; _ArraySetValue_(index_outer,ndims,0);
142  while (!done) {
143  _ArrayCopy1D_(index_outer,index_inter,ndims);
144  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
145  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
146  int indexL[ndims]; _ArrayCopy1D_(index_inter,indexL,ndims); indexL[dir]--;
147  int indexR[ndims]; _ArrayCopy1D_(index_inter,indexR,ndims);
148  int pL; _ArrayIndex1D_(ndims,dim,indexL,ghosts,pL);
149  int pR; _ArrayIndex1D_(ndims,dim,indexR,ghosts,pR);
150  double uavg[_MODEL_NVARS_], fcL[_MODEL_NVARS_], fcR[_MODEL_NVARS_],
151  ucL[_MODEL_NVARS_], ucR[_MODEL_NVARS_], fc[_MODEL_NVARS_];
152  double kappa = max(param->grav_field[pL],param->grav_field[pR]);
153 
154  /* Roe-Fixed upwinding scheme */
155 
156  _Euler1DRoeAverage_ (uavg,(u+_MODEL_NVARS_*pL),(u+_MODEL_NVARS_*pR),param);
157  _Euler1DEigenvalues_ (uavg,D,param,0);
158  _Euler1DLeftEigenvectors_ (uavg,L,param,0);
159  _Euler1DRightEigenvectors_(uavg,R,param,0);
160 
161  /* calculate characteristic fluxes and variables */
166 
167  for (k = 0; k < _MODEL_NVARS_; k++) {
168  double eigL,eigC,eigR;
169  _Euler1DEigenvalues_((u+_MODEL_NVARS_*pL),D,param,0);
170  eigL = D[k*_MODEL_NVARS_+k];
171  _Euler1DEigenvalues_((u+_MODEL_NVARS_*pR),D,param,0);
172  eigR = D[k*_MODEL_NVARS_+k];
173  _Euler1DEigenvalues_(uavg,D,param,0);
174  eigC = D[k*_MODEL_NVARS_+k];
175 
176  if ((eigL > 0) && (eigC > 0) && (eigR > 0)) fc[k] = fcL[k];
177  else if ((eigL < 0) && (eigC < 0) && (eigR < 0)) fc[k] = fcR[k];
178  else {
179  double alpha = kappa * max3(absolute(eigL),absolute(eigC),absolute(eigR));
180  fc[k] = 0.5 * (fcL[k] + fcR[k] + alpha * (ucL[k]-ucR[k]));
181  }
182 
183  }
184 
185  /* calculate the interface flux from the characteristic flux */
187  }
188  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
189  }
190 
191  return(0);
192 }
#define max3(a, b, c)
Definition: math_ops.h:27
#define absolute(a)
Definition: math_ops.h:32
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int ndims
Definition: hypar.h:26
#define _Euler1DLeftEigenvectors_(u, L, p, dir)
Definition: euler1d.h:225
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define MatVecMult3(N, y, A, x)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _Euler1DEigenvalues_(u, D, p, dir)
Definition: euler1d.h:207
#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 _Euler1DRightEigenvectors_(u, R, p, dir)
Definition: euler1d.h:249
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _DECLARE_IERR_
Definition: basic.h:17
#define _ArrayCopy1D_(x, y, size)
#define max(a, b)
Definition: math_ops.h:18
#define _Euler1DRoeAverage_(uavg, uL, uR, p)
Definition: euler1d.h:169
double * grav_field
Definition: euler1d.h:288

◆ Euler1DUpwinddFRF()

int Euler1DUpwinddFRF ( double *  fI,
double *  fL,
double *  fR,
double *  uL,
double *  uR,
double *  u,
int  dir,
void *  s,
double  t 
)

The characteristic-based Roe-fixed upwinding scheme (Euler1DUpwindRF) for the partitioned hyperbolic flux that comprises of the acoustic waves only (see Euler1DStiffFlux, _Euler1DSetStiffFlux_). Thus, only the characteristic fields / eigen-modes corresponding to \( u\pm a\) are used.

Reference:

  • Ghosh, D., Constantinescu, E. M., Semi-Implicit Time Integration of Atmospheric Flows with Characteristic-Based Flux Partitioning, SIAM Journal on Scientific Computing, 38 (3), 2016, A1848-A1875, http://dx.doi.org/10.1137/15M1044369
Parameters
fIComputed upwind interface flux
fLLeft-biased reconstructed interface flux
fRRight-biased reconstructed interface flux
uLLeft-biased reconstructed interface solution
uRRight-biased reconstructed interface solution
uCell-centered solution
dirSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
tCurrent solution time

Definition at line 534 of file Euler1DUpwind.c.

545 {
546  HyPar *solver = (HyPar*) s;
547  Euler1D *param = (Euler1D*) solver->physics;
548  int done,k;
550 
551  int ndims = solver->ndims;
552  int *dim = solver->dim_local;
553  int ghosts = solver->ghosts;
554  double *uref = param->solution;
555 
556  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
557  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
558  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
560 
561  done = 0; _ArraySetValue_(index_outer,ndims,0);
562  while (!done) {
563  _ArrayCopy1D_(index_outer,index_inter,ndims);
564  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
565  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
566  int indexL[ndims]; _ArrayCopy1D_(index_inter,indexL,ndims); indexL[dir]--;
567  int indexR[ndims]; _ArrayCopy1D_(index_inter,indexR,ndims);
568  int pL; _ArrayIndex1D_(ndims,dim,indexL,ghosts,pL);
569  int pR; _ArrayIndex1D_(ndims,dim,indexR,ghosts,pR);
570  double uavg[_MODEL_NVARS_], fcL[_MODEL_NVARS_], fcR[_MODEL_NVARS_],
571  ucL[_MODEL_NVARS_], ucR[_MODEL_NVARS_], fc[_MODEL_NVARS_];
572  double kappa = max(param->grav_field[pL],param->grav_field[pR]);
573 
574  /* Roe-Fixed upwinding scheme */
575 
576  _Euler1DRoeAverage_ (uavg,(uref+_MODEL_NVARS_*pL),(uref+_MODEL_NVARS_*pR),param);
577  _Euler1DEigenvalues_ (uavg,D,param,0);
578  _Euler1DLeftEigenvectors_ (uavg,L,param,0);
579  _Euler1DRightEigenvectors_(uavg,R,param,0);
580 
581  /* calculate characteristic fluxes and variables */
586 
587  for (k = 0; k < _MODEL_NVARS_; k++) {
588  double eigL,eigC,eigR;
589  _Euler1DEigenvalues_((u+_MODEL_NVARS_*pL),D,param,0);
590  eigL = (k == 0? 0.0 : D[k*_MODEL_NVARS_+k]);
591  _Euler1DEigenvalues_((u+_MODEL_NVARS_*pR),D,param,0);
592  eigR = (k == 0? 0.0 : D[k*_MODEL_NVARS_+k]);
593  _Euler1DEigenvalues_(uavg,D,param,0);
594  eigC = (k == 0? 0.0 : D[k*_MODEL_NVARS_+k]);
595 
596  if ((eigL > 0) && (eigC > 0) && (eigR > 0)) fc[k] = fcL[k];
597  else if ((eigL < 0) && (eigC < 0) && (eigR < 0)) fc[k] = fcR[k];
598  else {
599  double alpha = kappa * max3(absolute(eigL),absolute(eigC),absolute(eigR));
600  fc[k] = 0.5 * (fcL[k] + fcR[k] + alpha * (ucL[k]-ucR[k]));
601  }
602 
603  }
604 
605  /* calculate the interface flux from the characteristic flux */
607  }
608  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
609  }
610 
611  return(0);
612 }
#define max3(a, b, c)
Definition: math_ops.h:27
#define absolute(a)
Definition: math_ops.h:32
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int ndims
Definition: hypar.h:26
#define _Euler1DLeftEigenvectors_(u, L, p, dir)
Definition: euler1d.h:225
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define MatVecMult3(N, y, A, x)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _Euler1DEigenvalues_(u, D, p, dir)
Definition: euler1d.h:207
#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 _Euler1DRightEigenvectors_(u, R, p, dir)
Definition: euler1d.h:249
double * solution
Definition: euler1d.h:290
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _DECLARE_IERR_
Definition: basic.h:17
#define _ArrayCopy1D_(x, y, size)
#define max(a, b)
Definition: math_ops.h:18
#define _Euler1DRoeAverage_(uavg, uL, uR, p)
Definition: euler1d.h:169
double * grav_field
Definition: euler1d.h:288

◆ Euler1DUpwindLLF()

int Euler1DUpwindLLF ( double *  fI,
double *  fL,
double *  fR,
double *  uL,
double *  uR,
double *  u,
int  dir,
void *  s,
double  t 
)

Characteristic-based local Lax-Friedrich upwinding scheme.

\begin{align} \alpha_{j+1/2}^{k,L} &= \sum_{k=1}^3 {\bf l}_{j+1/2}^k \cdot {\bf f}_{j+1/2}^{k,L}, \\ \alpha_{j+1/2}^{k,R} &= \sum_{k=1}^3 {\bf l}_{j+1/2}^k \cdot {\bf f}_{j+1/2}^{k,R}, \\ v_{j+1/2}^{k,L} &= \sum_{k=1}^3 {\bf l}_{j+1/2}^k \cdot {\bf u}_{j+1/2}^{k,L}, \\ v_{j+1/2}^{k,R} &= \sum_{k=1}^3 {\bf l}_{j+1/2}^k \cdot {\bf u}_{j+1/2}^{k,R}, \\ \alpha_{j+1/2}^k &= \frac{1}{2}\left[ \alpha_{j+1/2}^{k,L} + \alpha_{j+1/2}^{k,R} - \left(\max_{\left[j,j+1\right]} \lambda\right) \left( v_{j+1/2}^{k,R} - v_{j+1/2}^{k,L} \right) \right], \\ {\bf f}_{j+1/2} &= \sum_{k=1}^3 \alpha_{j+1/2}^k {\bf r}_{j+1/2}^k \end{align}

where \({\bf l}\), \({\bf r}\), and \(\lambda\) are the left-eigenvectors, right-eigenvectors and eigenvalues. The subscripts denote the grid locations.

This upwinding scheme is modified for the balanced discretization of the 1D Euler equations when there is a non-zero gravitational force. See the reference below. For flows without any gravitational forces, it reduces to its original form.

Parameters
fIComputed upwind interface flux
fLLeft-biased reconstructed interface flux
fRRight-biased reconstructed interface flux
uLLeft-biased reconstructed interface solution
uRRight-biased reconstructed interface solution
uCell-centered solution
dirSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
tCurrent solution time

Definition at line 212 of file Euler1DUpwind.c.

223 {
224  HyPar *solver = (HyPar*) s;
225  Euler1D *param = (Euler1D*) solver->physics;
226  int done,k;
228 
229  int ndims = solver->ndims;
230  int *dim = solver->dim_local;
231  int ghosts = solver->ghosts;
232 
233  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
234  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
235  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
237 
238  done = 0; _ArraySetValue_(index_outer,ndims,0);
239  while (!done) {
240  _ArrayCopy1D_(index_outer,index_inter,ndims);
241  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
242  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
243  int indexL[ndims]; _ArrayCopy1D_(index_inter,indexL,ndims); indexL[dir]--;
244  int indexR[ndims]; _ArrayCopy1D_(index_inter,indexR,ndims);
245  int pL; _ArrayIndex1D_(ndims,dim,indexL,ghosts,pL);
246  int pR; _ArrayIndex1D_(ndims,dim,indexR,ghosts,pR);
247  double uavg[_MODEL_NVARS_], fcL[_MODEL_NVARS_], fcR[_MODEL_NVARS_],
248  ucL[_MODEL_NVARS_], ucR[_MODEL_NVARS_], fc[_MODEL_NVARS_];
249  double kappa = max(param->grav_field[pL],param->grav_field[pR]);
250 
251  /* Local Lax-Friedrich upwinding scheme */
252 
253  _Euler1DRoeAverage_ (uavg,(u+_MODEL_NVARS_*pL),(u+_MODEL_NVARS_*pR),param);
254  _Euler1DEigenvalues_ (uavg,D,param,0);
255  _Euler1DLeftEigenvectors_ (uavg,L,param,0);
256  _Euler1DRightEigenvectors_(uavg,R,param,0);
257 
258  /* calculate characteristic fluxes and variables */
263 
264  for (k = 0; k < _MODEL_NVARS_; k++) {
265  double eigL,eigC,eigR;
266  _Euler1DEigenvalues_((u+_MODEL_NVARS_*pL),D,param,0);
267  eigL = D[k*_MODEL_NVARS_+k];
268  _Euler1DEigenvalues_((u+_MODEL_NVARS_*pR),D,param,0);
269  eigR = D[k*_MODEL_NVARS_+k];
270  _Euler1DEigenvalues_(uavg,D,param,0);
271  eigC = D[k*_MODEL_NVARS_+k];
272 
273  double alpha = kappa * max3(absolute(eigL),absolute(eigC),absolute(eigR));
274  fc[k] = 0.5 * (fcL[k] + fcR[k] + alpha * (ucL[k]-ucR[k]));
275  }
276 
277  /* calculate the interface flux from the characteristic flux */
279  }
280  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
281  }
282 
283  return(0);
284 }
#define max3(a, b, c)
Definition: math_ops.h:27
#define absolute(a)
Definition: math_ops.h:32
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int ndims
Definition: hypar.h:26
#define _Euler1DLeftEigenvectors_(u, L, p, dir)
Definition: euler1d.h:225
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define MatVecMult3(N, y, A, x)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _Euler1DEigenvalues_(u, D, p, dir)
Definition: euler1d.h:207
#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 _Euler1DRightEigenvectors_(u, R, p, dir)
Definition: euler1d.h:249
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _DECLARE_IERR_
Definition: basic.h:17
#define _ArrayCopy1D_(x, y, size)
#define max(a, b)
Definition: math_ops.h:18
#define _Euler1DRoeAverage_(uavg, uL, uR, p)
Definition: euler1d.h:169
double * grav_field
Definition: euler1d.h:288

◆ Euler1DUpwinddFLLF()

int Euler1DUpwinddFLLF ( double *  fI,
double *  fL,
double *  fR,
double *  uL,
double *  uR,
double *  u,
int  dir,
void *  s,
double  t 
)

The characteristic-based local Lax-Friedrich upwinding scheme (Euler1DUpwindLLF) for the partitioned hyperbolic flux that comprises of the acoustic waves only (see Euler1DStiffFlux, _Euler1DSetStiffFlux_). Thus, only the characteristic fields / eigen-modes corresponding to \( u\pm a\) are used.

Reference:

  • Ghosh, D., Constantinescu, E. M., Semi-Implicit Time Integration of Atmospheric Flows with Characteristic-Based Flux Partitioning, SIAM Journal on Scientific Computing, 38 (3), 2016, A1848-A1875, http://dx.doi.org/10.1137/15M1044369
Parameters
fIComputed upwind interface flux
fLLeft-biased reconstructed interface flux
fRRight-biased reconstructed interface flux
uLLeft-biased reconstructed interface solution
uRRight-biased reconstructed interface solution
uCell-centered solution
dirSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
tCurrent solution time

Definition at line 623 of file Euler1DUpwind.c.

634 {
635  HyPar *solver = (HyPar*) s;
636  Euler1D *param = (Euler1D*) solver->physics;
637  int done,k;
639 
640  int ndims = solver->ndims;
641  int *dim = solver->dim_local;
642  int ghosts = solver->ghosts;
643  double *uref = param->solution;
644 
645  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
646  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
647  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
649 
650  done = 0; _ArraySetValue_(index_outer,ndims,0);
651  while (!done) {
652  _ArrayCopy1D_(index_outer,index_inter,ndims);
653  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
654  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
655  int indexL[ndims]; _ArrayCopy1D_(index_inter,indexL,ndims); indexL[dir]--;
656  int indexR[ndims]; _ArrayCopy1D_(index_inter,indexR,ndims);
657  int pL; _ArrayIndex1D_(ndims,dim,indexL,ghosts,pL);
658  int pR; _ArrayIndex1D_(ndims,dim,indexR,ghosts,pR);
659  double uavg[_MODEL_NVARS_], fcL[_MODEL_NVARS_], fcR[_MODEL_NVARS_],
660  ucL[_MODEL_NVARS_], ucR[_MODEL_NVARS_], fc[_MODEL_NVARS_];
661  double kappa = max(param->grav_field[pL],param->grav_field[pR]);
662 
663  /* Local Lax-Friedrich upwinding scheme */
664 
665  _Euler1DRoeAverage_ (uavg,(uref+_MODEL_NVARS_*pL),(uref+_MODEL_NVARS_*pR),param);
666  _Euler1DEigenvalues_ (uavg,D,param,0);
667  _Euler1DLeftEigenvectors_ (uavg,L,param,0);
668  _Euler1DRightEigenvectors_(uavg,R,param,0);
669 
670  /* calculate characteristic fluxes and variables */
675 
676  for (k = 0; k < _MODEL_NVARS_; k++) {
677  double eigL,eigC,eigR;
678  _Euler1DEigenvalues_((u+_MODEL_NVARS_*pL),D,param,0);
679  eigL = (k == 0? 0.0 : D[k*_MODEL_NVARS_+k]);
680  _Euler1DEigenvalues_((u+_MODEL_NVARS_*pR),D,param,0);
681  eigR = (k == 0? 0.0 : D[k*_MODEL_NVARS_+k]);
682  _Euler1DEigenvalues_(uavg,D,param,0);
683  eigC = (k == 0? 0.0 : D[k*_MODEL_NVARS_+k]);
684 
685  double alpha = kappa * max3(absolute(eigL),absolute(eigC),absolute(eigR));
686  fc[k] = 0.5 * (fcL[k] + fcR[k] + alpha * (ucL[k]-ucR[k]));
687  }
688 
689  /* calculate the interface flux from the characteristic flux */
691  }
692  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
693  }
694 
695  return(0);
696 }
#define max3(a, b, c)
Definition: math_ops.h:27
#define absolute(a)
Definition: math_ops.h:32
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int ndims
Definition: hypar.h:26
#define _Euler1DLeftEigenvectors_(u, L, p, dir)
Definition: euler1d.h:225
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define MatVecMult3(N, y, A, x)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _Euler1DEigenvalues_(u, D, p, dir)
Definition: euler1d.h:207
#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 _Euler1DRightEigenvectors_(u, R, p, dir)
Definition: euler1d.h:249
double * solution
Definition: euler1d.h:290
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _DECLARE_IERR_
Definition: basic.h:17
#define _ArrayCopy1D_(x, y, size)
#define max(a, b)
Definition: math_ops.h:18
#define _Euler1DRoeAverage_(uavg, uL, uR, p)
Definition: euler1d.h:169
double * grav_field
Definition: euler1d.h:288

◆ Euler1DUpwindSWFS()

int Euler1DUpwindSWFS ( double *  fI,
double *  fL,
double *  fR,
double *  uL,
double *  uR,
double *  u,
int  dir,
void *  s,
double  t 
)

Steger-Warming Flux-Splitting scheme

  • Steger, J.L., Warming, R.F., "Flux vector splitting of the inviscid gasdynamic equations with application to finite-difference methods", J. Comput. Phys., 40(2), 1981, pp. 263-293, http://dx.doi.org/10.1016/0021-9991(81)90210-2.

Note that this method cannot be used for flows with non-zero gravitational forces.

Parameters
fIComputed upwind interface flux
fLLeft-biased reconstructed interface flux
fRRight-biased reconstructed interface flux
uLLeft-biased reconstructed interface solution
uRRight-biased reconstructed interface solution
uCell-centered solution
dirSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
tCurrent solution time

Definition at line 293 of file Euler1DUpwind.c.

304 {
305  HyPar *solver = (HyPar*) s;
306  Euler1D *param = (Euler1D*) solver->physics;
307  int done;
309 
310  int ndims = solver->ndims;
311  int *dim = solver->dim_local;
312 
313  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
314  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
315  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
316  static double fp[_MODEL_NVARS_], fm[_MODEL_NVARS_],uavg[_MODEL_NVARS_];
317 
318  done = 0; _ArraySetValue_(index_outer,ndims,0);
319  while (!done) {
320  _ArrayCopy1D_(index_outer,index_inter,ndims);
321  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
322  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
323  double rho,v,e,P,c,gamma=param->gamma,term,Mach;
324 
325  /* Steger Warming flux splitting */
326  _Euler1DRoeAverage_(uavg,(uL+_MODEL_NVARS_*p),(uR+_MODEL_NVARS_*p),param);
327  _Euler1DGetFlowVar_(uavg,rho,v,e,P,param);
328  Mach = v/sqrt(gamma*P/rho);
329 
330  if (Mach < -1.0) {
331 
333 
334  } else if (Mach < 1.0) {
335 
336  _Euler1DGetFlowVar_((uL+_MODEL_NVARS_*p),rho,v,e,P,param);
337  c = sqrt(gamma*P/rho);
338  term = rho/(2.0*gamma);
339 
340  fp[0] = term * (2*gamma*v + c - v);
341  fp[1] = term * (2*(gamma-1.0)*v*v + (v+c)*(v+c));
342  fp[2] = term * ((gamma-1.0)*v*v*v + 0.5*(v+c)*(v+c)*(v+c) + ((3.0-gamma)*(v+c)*c*c)/(2.0*(gamma-1.0)));
343 
344  _Euler1DGetFlowVar_((uR+_MODEL_NVARS_*p),rho,v,e,P,param);
345  c = sqrt(gamma*P/rho);
346  term = rho/(2.0*gamma);
347 
348  fm[0] = term * (v - c);
349  fm[1] = term * (v-c) * (v-c);
350  fm[2] = term * (0.5*(v-c)*(v-c)*(v-c) + ((3.0-gamma)*(v-c)*c*c)/(2.0*(gamma-1.0)));
351 
353 
354  } else {
355 
357 
358  }
359 
360  }
361  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
362  }
363 
364  return(0);
365 }
double gamma
Definition: euler1d.h:274
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _ArrayAdd1D_(x, a, b, size)
#define _ArrayCopy1D3_(x, y, size)
#define _ArrayIndex1D_(N, imax, i, 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 _MODEL_NVARS_
Definition: euler1d.h:58
#define _Euler1DGetFlowVar_(u, rho, v, e, P, p)
Definition: euler1d.h:81
#define _DECLARE_IERR_
Definition: basic.h:17
#define _ArrayCopy1D_(x, y, size)
#define _Euler1DRoeAverage_(uavg, uL, uR, p)
Definition: euler1d.h:169

◆ Euler1DUpwindRusanov()

int Euler1DUpwindRusanov ( double *  fI,
double *  fL,
double *  fR,
double *  uL,
double *  uR,
double *  u,
int  dir,
void *  s,
double  t 
)

Rusanov's upwinding scheme.

\begin{equation} {\bf f}_{j+1/2} = \frac{1}{2}\left[ {\bf f}_{j+1/2}^L + {\bf f}_{j+1/2}^R - \max_{j,j+1} \nu_j \left( {\bf u}_{j+1/2}^R - {\bf u}_{j+1/2}^L \right)\right] \end{equation}

where \(\nu = c + \left|u\right|\).

  • Rusanov, V. V., "The calculation of the interaction of non-stationary shock waves and obstacles," USSR Computational Mathematics and Mathematical Physics, Vol. 1, No. 2, 1962, pp. 304–320
Parameters
fIComputed upwind interface flux
fLLeft-biased reconstructed interface flux
fRRight-biased reconstructed interface flux
uLLeft-biased reconstructed interface solution
uRRight-biased reconstructed interface solution
uCell-centered solution
dirSpatial dimension (unused since this is a 1D system)
sSolver object of type HyPar
tCurrent solution time

Definition at line 376 of file Euler1DUpwind.c.

387 {
388  HyPar *solver = (HyPar*) s;
389  Euler1D *param = (Euler1D*) solver->physics;
390  int done,k;
392 
393  int ndims = solver->ndims;
394  int ghosts= solver->ghosts;
395  int *dim = solver->dim_local;
396 
397  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
398  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
399  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
400 
401  static double udiff[_MODEL_NVARS_], uavg[_MODEL_NVARS_];
402 
403  done = 0; _ArraySetValue_(index_outer,ndims,0);
404  while (!done) {
405 
406  _ArrayCopy1D_(index_outer,index_inter,ndims);
407 
408  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
409 
410  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
411  int indexL[ndims]; _ArrayCopy1D_(index_inter,indexL,ndims); indexL[dir]--;
412  int indexR[ndims]; _ArrayCopy1D_(index_inter,indexR,ndims);
413  int pL; _ArrayIndex1D_(ndims,dim,indexL,ghosts,pL);
414  int pR; _ArrayIndex1D_(ndims,dim,indexR,ghosts,pR);
415 
416  _Euler1DRoeAverage_(uavg,(u+_MODEL_NVARS_*pL),(u+_MODEL_NVARS_*pR),param);
417  for (k = 0; k < _MODEL_NVARS_; k++) udiff[k] = 0.5 * (uR[_MODEL_NVARS_*p+k] - uL[_MODEL_NVARS_*p+k]);
418 
419  double rho, uvel, E, P, c;
420 
421  _Euler1DGetFlowVar_((u+_MODEL_NVARS_*pL),rho,uvel,E,P,param);
422  c = param->gamma*P/rho;
423  double alphaL = c + absolute(uvel);
424 
425  _Euler1DGetFlowVar_((u+_MODEL_NVARS_*pR),rho,uvel,E,P,param);
426  c = param->gamma*P/rho;
427  double alphaR = c + absolute(uvel);
428 
429  _Euler1DGetFlowVar_(uavg,rho,uvel,E,P,param);
430  c = param->gamma*P/rho;
431  double alphaavg = c + absolute(uvel);
432 
433  double kappa = max(param->grav_field[pL],param->grav_field[pR]);
434  double alpha = kappa*max3(alphaL,alphaR,alphaavg);
435 
436  for (k = 0; k < _MODEL_NVARS_; k++) {
437  fI[_MODEL_NVARS_*p+k] = 0.5 * (fL[_MODEL_NVARS_*p+k]+fR[_MODEL_NVARS_*p+k]) - alpha*udiff[k];
438  }
439 
440  }
441 
442  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
443 
444  }
445 
446  return(0);
447 }
#define max3(a, b, c)
Definition: math_ops.h:27
double gamma
Definition: euler1d.h:274
#define absolute(a)
Definition: math_ops.h:32
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _ArrayIndex1D_(N, imax, i, 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 _Euler1DGetFlowVar_(u, rho, v, e, P, p)
Definition: euler1d.h:81
#define _DECLARE_IERR_
Definition: basic.h:17
#define _ArrayCopy1D_(x, y, size)
#define max(a, b)
Definition: math_ops.h:18
#define _Euler1DRoeAverage_(uavg, uL, uR, p)
Definition: euler1d.h:169
double * grav_field
Definition: euler1d.h:288

◆ Euler1DJacobian()

int Euler1DJacobian ( double *  Jac,
double *  u,
void *  p,
int  dir,
int  nvars,
int  upw 
)

Function to compute the flux Jacobian of the 1D Euler equations, given the solution at a grid point. The Jacobian is square matrix of size nvar=3, and is returned as a 1D array (double) of 9 elements in row-major format.

Parameters
JacJacobian matrix: 1D array of size nvar^2 = 9
usolution at a grid point (array of size nvar = 3)
pobject containing the physics-related parameters
dirdimension (x/y/z) (not used, since this is 1D system)
nvarsnumber of vector components
upw0 -> send back complete Jacobian, 1 -> send back Jacobian of right(+)-moving flux, -1 -> send back Jacobian of left(-)-moving flux

Definition at line 14 of file Euler1DJacobian.c.

22 {
23  Euler1D *param = (Euler1D*) p;
26 
27  /* get the eigenvalues and left,right eigenvectors */
28  _Euler1DEigenvalues_ (u,D,param,0);
29  _Euler1DLeftEigenvectors_ (u,L,param,0);
30  _Euler1DRightEigenvectors_(u,R,param,0);
31 
32  int aupw = absolute(upw), k;
33  k = 0; D[k] = absolute( (1-aupw)*D[k] + 0.5*aupw*(1+upw)*max(0,D[k]) + 0.5*aupw*(1-upw)*min(0,D[k]) );
34  k = 4; D[k] = absolute( (1-aupw)*D[k] + 0.5*aupw*(1+upw)*max(0,D[k]) + 0.5*aupw*(1-upw)*min(0,D[k]) );
35  k = 8; D[k] = absolute( (1-aupw)*D[k] + 0.5*aupw*(1+upw)*max(0,D[k]) + 0.5*aupw*(1-upw)*min(0,D[k]) );
36 
37  MatMult3(3,DL,D,L);
38  MatMult3(3,Jac,R,DL);
39 
40  return(0);
41 }
#define absolute(a)
Definition: math_ops.h:32
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
#define min(a, b)
Definition: math_ops.h:14
#define _Euler1DLeftEigenvectors_(u, L, p, dir)
Definition: euler1d.h:225
#define _Euler1DEigenvalues_(u, D, p, dir)
Definition: euler1d.h:207
#define _Euler1DRightEigenvectors_(u, R, p, dir)
Definition: euler1d.h:249
#define MatMult3(N, A, X, Y)
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define max(a, b)
Definition: math_ops.h:18

◆ Euler1DStiffJacobian()

int Euler1DStiffJacobian ( double *  Jac,
double *  u,
void *  p,
int  dir,
int  nvars,
int  upw 
)

Function to compute the Jacobian of the fast flux (representing the acoustic waves) of the 1D Euler equations, given the solution at a grid point (see _Euler1DSetStiffFlux_, _Euler1DSetStiffJac_). The Jacobian is square matrix of size nvar=3, and is returned as a 1D array (double) of 9 elements in row-major format.

Parameters
JacJacobian matrix: 1D array of size nvar^2 = 9
usolution at a grid point (array of size nvar = 3)
pobject containing the physics-related parameters
dirdimension (x/y/z) (not used, since this is 1D system)
nvarsnumber of vector components
upw0 -> send back complete Jacobian, 1 -> send back Jacobian of right(+)-moving flux, -1 -> send back Jacobian of left(-)-moving flux

Definition at line 48 of file Euler1DJacobian.c.

56 {
57  Euler1D *param = (Euler1D*) p;
60 
61  /* get the eigenvalues and left,right eigenvectors */
62  _Euler1DEigenvalues_ (u,D,param,0);
63  _Euler1DLeftEigenvectors_ (u,L,param,0);
64  _Euler1DRightEigenvectors_(u,R,param,0);
65 
66  int aupw = absolute(upw), k;
67  k = 0; D[k] = 0.0; /* remove the entropy eigenmode */
68  k = 4; D[k] = absolute( (1-aupw)*D[k] + 0.5*aupw*(1+upw)*max(0,D[k]) + 0.5*aupw*(1-upw)*min(0,D[k]) );
69  k = 8; D[k] = absolute( (1-aupw)*D[k] + 0.5*aupw*(1+upw)*max(0,D[k]) + 0.5*aupw*(1-upw)*min(0,D[k]) );
70 
71  MatMult3(3,DL,D,L);
72  MatMult3(3,Jac,R,DL);
73 
74  return(0);
75 }
#define absolute(a)
Definition: math_ops.h:32
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
#define min(a, b)
Definition: math_ops.h:14
#define _Euler1DLeftEigenvectors_(u, L, p, dir)
Definition: euler1d.h:225
#define _Euler1DEigenvalues_(u, D, p, dir)
Definition: euler1d.h:207
#define _Euler1DRightEigenvectors_(u, R, p, dir)
Definition: euler1d.h:249
#define MatMult3(N, A, X, Y)
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define max(a, b)
Definition: math_ops.h:18

◆ Euler1DRoeAverage()

int Euler1DRoeAverage ( double *  uavg,
double *  uL,
double *  uR,
void *  p 
)

Compute the Roe-averaged state for the 1D Euler equations. This function just calls the macro _Euler1DRoeAverage_ and is not used by any functions within the 1D Euler module. However, it's necessary to define it and provide it to the the solver object (HyPar) so that it can then send it to interpolation functions for a characteristic-based reconstruction.

Parameters
uavgThe computed Roe-averaged state
uLLeft state (conserved variables)
uRRight state (conserved variables)
pObject of type Euler1D with physics-related variables

Definition at line 16 of file Euler1DFunctions.c.

22 {
23  Euler1D *param = (Euler1D*) p;
24  _Euler1DRoeAverage_(uavg,uL,uR,param);
25  return(0);
26 }
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
#define _Euler1DRoeAverage_(uavg, uL, uR, p)
Definition: euler1d.h:169

◆ Euler1DLeftEigenvectors()

int Euler1DLeftEigenvectors ( double *  u,
double *  L,
void *  p,
int  dir 
)

Compute the left eigenvections for the 1D Euler equations. This function just calls the macro _Euler1DLeftEigenvectors_ and is not used by any functions within the 1D Euler module. However, it's necessary to define it and provide it to the the solver object (HyPar) so that it can then send it to interpolation functions for a characteristic-based reconstruction.

Parameters
uConserved solution at a grid point
LArray of size nvar^2 = 3^2 to save the matrix of left eigenvectors in (row-major format).
pObject of type Euler1D with physics-related variables
dirSpatial dimension (not used, since this is a 1D system)

Definition at line 19 of file Euler1DEigen.c.

26 {
27  Euler1D *param = (Euler1D*) p;
28  _Euler1DLeftEigenvectors_(u,L,param,dir);
29  return(0);
30 }
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
#define _Euler1DLeftEigenvectors_(u, L, p, dir)
Definition: euler1d.h:225

◆ Euler1DRightEigenvectors()

int Euler1DRightEigenvectors ( double *  u,
double *  R,
void *  p,
int  dir 
)

Compute the right eigenvections for the 1D Euler equations. This function just calls the macro _Euler1DRightEigenvectors_ and is not used by any functions within the 1D Euler module. However, it's necessary to define it and provide it to the the solver object (HyPar) so that it can then send it to interpolation functions for a characteristic-based reconstruction.

Parameters
uConserved solution at a grid point
RArray of size nvar^2 = 3^2 to save the matrix of right eigenvectors in (row-major format).
pObject of type Euler1D with physics-related variables
dirSpatial dimension (not used, since this is a 1D system)

Definition at line 38 of file Euler1DEigen.c.

45 {
46  Euler1D *param = (Euler1D*) p;
47  _Euler1DRightEigenvectors_(u,R,param,dir);
48  return(0);
49 }
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
#define _Euler1DRightEigenvectors_(u, R, p, dir)
Definition: euler1d.h:249

◆ Euler1DGravityField()

int Euler1DGravityField ( void *  s,
void *  m 
)

Compute the gravitational field over the domain. See

  • 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
    for details on the treatment of the gravitational source term. This function computes the graviational potential function. If there is no gravity, the gravitational field is 1.0 all over the domain.
Parameters
sSolver object of type HyPar
mMPI object of type MPIVariables

Definition at line 23 of file Euler1DGravityField.c.

27 {
28  HyPar *solver = (HyPar*) s;
29  MPIVariables *mpi = (MPIVariables*) m;
30  Euler1D *param = (Euler1D*) solver->physics;
31 
32  double *S = param->grav_field;
33  int *dim = solver->dim_local;
34  int ghosts = solver->ghosts;
35  int index[_MODEL_NDIMS_], bounds[_MODEL_NDIMS_],
36  offset[_MODEL_NDIMS_], d, done;
37 
38  /* set bounds for array index to include ghost points */
39  _ArrayCopy1D_(dim,bounds,_MODEL_NDIMS_);
40  for (d=0; d<_MODEL_NDIMS_; d++) bounds[d] += 2*ghosts;
41  /* set offset such that index is compatible with ghost point arrangement */
42  _ArraySetValue_(offset,_MODEL_NDIMS_,-ghosts);
43 
44  /* set the value of the gravity field */
45  done = 0; _ArraySetValue_(index,_MODEL_NDIMS_,0);
46  while (!done) {
47  int p; _ArrayIndex1DWO_(_MODEL_NDIMS_,dim,index,offset,ghosts,p);
48  double xcoord; _GetCoordinate_(_XDIR_,index[_XDIR_]-ghosts,dim,ghosts,solver->x,xcoord);
49  if (param->grav_type == 0) {
50  S[p] = exp(-param->grav*xcoord);
51  } else if (param->grav_type == 1) {
52  double pi = 4.0 * atan(1.0);
53  double phi = -sin(2*pi*xcoord)/(2*pi);
54  S[p] = exp(-phi);
55  }
56  _ArrayIncrementIndex_(_MODEL_NDIMS_,bounds,index,done);
57  }
58 
59  if (param->grav_type != 1) {
60  /* a sensible simulation will not specify peridic boundary conditions
61  * along a direction in which gravity acts (unless the gravitational field
62  * itself is sinusoidal), so extrapolate the gravity field at the boundaries */
63  int indexb[_MODEL_NDIMS_], indexi[_MODEL_NDIMS_];
64  for (d = 0; d < _MODEL_NDIMS_; d++) {
65  /* left boundary */
66  if (!mpi->ip[d]) {
67  _ArrayCopy1D_(dim,bounds,_MODEL_NDIMS_); bounds[d] = ghosts;
68  _ArraySetValue_(offset,_MODEL_NDIMS_,0); offset[d] = -ghosts;
69  done = 0; _ArraySetValue_(indexb,_MODEL_NDIMS_,0);
70  while (!done) {
71  _ArrayCopy1D_(indexb,indexi,_MODEL_NDIMS_); indexi[d] = ghosts-1-indexb[d];
72  int p1; _ArrayIndex1DWO_(_MODEL_NDIMS_,dim,indexb,offset,ghosts,p1);
73  int p2; _ArrayIndex1D_ (_MODEL_NDIMS_,dim,indexi,ghosts,p2);
74  S[p1] = S[p2];
75  _ArrayIncrementIndex_(_MODEL_NDIMS_,bounds,indexb,done);
76  }
77  }
78  /* right boundary */
79  if (mpi->ip[d] == mpi->iproc[d]-1) {
80  _ArrayCopy1D_(dim,bounds,_MODEL_NDIMS_); bounds[d] = ghosts;
81  _ArraySetValue_(offset,_MODEL_NDIMS_,0); offset[d] = dim[d];
82  done = 0; _ArraySetValue_(indexb,_MODEL_NDIMS_,0);
83  while (!done) {
84  _ArrayCopy1D_(indexb,indexi,_MODEL_NDIMS_); indexi[d] = dim[d]-1-indexb[d];
85  int p1; _ArrayIndex1DWO_(_MODEL_NDIMS_,dim,indexb,offset,ghosts,p1);
86  int p2; _ArrayIndex1D_ (_MODEL_NDIMS_,dim,indexi,ghosts,p2);
87  S[p1] = S[p2];
88  _ArrayIncrementIndex_(_MODEL_NDIMS_,bounds,indexb,done);
89  }
90  }
91  }
92  }
93 
94  return(0);
95 }
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
double * x
Definition: hypar.h:107
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _MODEL_NDIMS_
Definition: euler1d.h:56
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
double grav
Definition: euler1d.h:275
#define _ArraySetValue_(x, size, value)
int * dim_local
Definition: hypar.h:37
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Definition: basic.h:31
void * physics
Definition: hypar.h:266
#define _XDIR_
Definition: euler1d.h:75
int ghosts
Definition: hypar.h:52
Structure of MPI-related variables.
int grav_type
Definition: euler1d.h:286
#define _ArrayCopy1D_(x, y, size)
double * grav_field
Definition: euler1d.h:288

◆ Euler1DSourceUpwindLLF()

int Euler1DSourceUpwindLLF ( double *  fI,
double *  fL,
double *  fR,
double *  u,
int  dir,
void *  s,
double  t 
)

Compute the "upwind" source term in the balanced formulation introduced in the reference below. The "upwind" state is just the arithmetic average of the left and right states.

Parameters
fIComputed interface source term ("upwinded")
fLLeft-biased interface source term
fRRight-biased interface source term
uSolution (conserved variables)
dirSpatial dimension (unused since this is a 1D case)
sSolver object of type HyPar
tCurrent solution time

Definition at line 21 of file Euler1DSourceUpwind.c.

30 {
31  HyPar *solver = (HyPar*) s;
32  int done,k;
34 
35  int ndims = solver->ndims;
36  int *dim = solver->dim_local;
37 
38  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
39  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
40  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
41 
42  done = 0; _ArraySetValue_(index_outer,ndims,0);
43  while (!done) {
44  _ArrayCopy1D_(index_outer,index_inter,ndims);
45  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
46  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
47  /* Local Lax-Friedrich upwinding scheme */
48  for (k = 0; k < _MODEL_NVARS_; k++)
49  (fI+_MODEL_NVARS_*p)[k] = 0.5 * ((fL+_MODEL_NVARS_*p)[k] + (fR+_MODEL_NVARS_*p)[k]);
50  }
51  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
52  }
53 
54  return(0);
55 }
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _ArraySetValue_(x, size, value)
int * dim_local
Definition: hypar.h:37
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _DECLARE_IERR_
Definition: basic.h:17
#define _ArrayCopy1D_(x, y, size)

◆ Euler1DSourceUpwindRoe()

int Euler1DSourceUpwindRoe ( double *  fI,
double *  fL,
double *  fR,
double *  u,
int  dir,
void *  s,
double  t 
)

Compute the "upwind" source term in the balanced formulation introduced in the reference below. The "upwind" state is just the arithmetic average of the left and right states.

Parameters
fIComputed interface source term ("upwinded")
fLLeft-biased interface source term
fRRight-biased interface source term
uSolution (conserved variables)
dirSpatial dimension (unused since this is a 1D case)
sSolver object of type HyPar
tCurrent solution time

Definition at line 64 of file Euler1DSourceUpwind.c.

73 {
74  HyPar *solver = (HyPar*) s;
75  int done,k;
77 
78  int ndims = solver->ndims;
79  int *dim = solver->dim_local;
80 
81  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
82  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
83  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
84 
85  done = 0; _ArraySetValue_(index_outer,ndims,0);
86  while (!done) {
87  _ArrayCopy1D_(index_outer,index_inter,ndims);
88  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
89  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
90  /* Local Lax-Friedrich upwinding scheme */
91  for (k = 0; k < _MODEL_NVARS_; k++)
92  (fI+_MODEL_NVARS_*p)[k] = 0.5 * ((fL+_MODEL_NVARS_*p)[k] + (fR+_MODEL_NVARS_*p)[k]);
93  }
94  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
95  }
96 
97  return(0);
98 }
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _ArraySetValue_(x, size, value)
int * dim_local
Definition: hypar.h:37
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _DECLARE_IERR_
Definition: basic.h:17
#define _ArrayCopy1D_(x, y, size)

◆ Euler1DModifiedSolution()

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 }
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int ndims
Definition: hypar.h:26
#define _ArrayScaleCopy1D_(x, a, y, size)
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#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)
double * grav_field
Definition: euler1d.h:288

◆ Euler1DPreStep()

int Euler1DPreStep ( double *  u,
void *  s,
void *  m,
double  waqt 
)

1D Euler-specific function called at the beginning of each time-step: For a simulation that splits the hyperbolic flux into its acoustic and entropy components for implicit- explicit time-integration, this function computes the fast Jacobian at the beginning of a time step for the linearized formulation.

See also
_Euler1DSetLinearizedStiffFlux_, _Euler1DSetStiffJac_, Euler1DStiffFlux
Parameters
uSolution (conserved variables)
sSolver object of type HyPar
mMPI object of type MPIVariables
waqtCurrent solution time

Definition at line 16 of file Euler1DPreStep.c.

22 {
23  HyPar *solver = (HyPar*) s;
24  Euler1D *param = (Euler1D*) solver->physics;
25  int *dim = solver->dim_local;
26  int ghosts = solver->ghosts;
27  static const int ndims = _MODEL_NDIMS_;
28  static const int JacSize = _MODEL_NVARS_*_MODEL_NVARS_;
29  static int index[_MODEL_NDIMS_], bounds[_MODEL_NDIMS_], offset[_MODEL_NDIMS_];
30 
31  /* set bounds for array index to include ghost points */
32  _ArrayAddCopy1D_(dim,(2*ghosts),bounds,ndims);
33  /* set offset such that index is compatible with ghost point arrangement */
34  _ArraySetValue_(offset,ndims,-ghosts);
35  /* copy the solution to act as a reference for linearization */
37 
38  int done = 0; _ArraySetValue_(index,ndims,0);
39  while (!done) {
40  int p; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,p);
41  double rho, v, e, P;
42  _Euler1DGetFlowVar_((u+_MODEL_NVARS_*p),rho,v,e,P,param);
43  _Euler1DSetStiffJac_((param->fast_jac+JacSize*p),rho,v,e,P,param->gamma);
44  _ArrayIncrementIndex_(ndims,bounds,index,done);
45  }
46 
47  return(0);
48 }
double gamma
Definition: euler1d.h:274
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
double * fast_jac
Definition: euler1d.h:289
#define _ArrayAddCopy1D_(x, a, y, size)
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _MODEL_NDIMS_
Definition: euler1d.h:56
#define _Euler1DSetStiffJac_(J, rho, v, e, P, gamma)
Definition: euler1d.h:149
#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
double * solution
Definition: euler1d.h:290
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
int npoints_local_wghosts
Definition: hypar.h:42
#define _Euler1DGetFlowVar_(u, rho, v, e, P, p)
Definition: euler1d.h:81
#define _ArrayCopy1D_(x, y, size)

◆ Euler1DInitialize()

int Euler1DInitialize ( void *  s,
void *  m 
)

Function to initialize the 1D inviscid Euler equations (Euler1D) module: Sets the default parameters, read in and set physics-related parameters, and set the physics-related function pointers in HyPar.

This file reads the file "physics.inp" that must have the following format:

begin
    <keyword>   <value>
    <keyword>   <value>
    <keyword>   <value>
    ...
    <keyword>   <value>
end

where the list of keywords are:

Keyword name Type Variable Default value -------—
gamma double Euler1D::gamma 1.4
gravity double Euler1D::grav 0.0
grav_type int Euler1D::grav_type 0
upwinding char[] Euler1D::upw_choice "roe" (_ROE_)

Note: "physics.inp" is optional; if absent, default values will be used.

Parameters
sSolver object of type HyPar
mObject of type MPIVariables containing MPI-related info

Definition at line 71 of file Euler1DInitialize.c.

75 {
76  HyPar *solver = (HyPar*) s;
77  MPIVariables *mpi = (MPIVariables*) m;
78  Euler1D *physics = (Euler1D*) solver->physics;
79  int ferr, d;
80 
81  static int count = 0;
82 
83  if (solver->nvars != _MODEL_NVARS_) {
84  fprintf(stderr,"Error in Euler1DInitialize(): nvars has to be %d.\n",_MODEL_NVARS_);
85  return(1);
86  }
87  if (solver->ndims != _MODEL_NDIMS_) {
88  fprintf(stderr,"Error in Euler1DInitialize(): ndims has to be %d.\n",_MODEL_NDIMS_);
89  return(1);
90  }
91 
92  /* default values */
93  physics->gamma = 1.4;
94  physics->grav = 0.0;
95  physics->grav_type = 0;
96  strcpy(physics->upw_choice,"roe");
97 
98  /* reading physical model specific inputs */
99  if (!mpi->rank) {
100  FILE *in;
101  if (!count) printf("Reading physical model inputs from file \"physics.inp\".\n");
102  in = fopen("physics.inp","r");
103  if (!in) printf("Warning: File \"physics.inp\" not found. Using default values.\n");
104  else {
105  char word[_MAX_STRING_SIZE_];
106  ferr = fscanf(in,"%s",word); if (ferr != 1) return(1);
107  if (!strcmp(word, "begin")){
108  while (strcmp(word, "end")){
109  ferr = fscanf(in,"%s",word); if (ferr != 1) return(1);
110  if (!strcmp(word, "gamma")) {
111  ferr = fscanf(in,"%lf",&physics->gamma);
112  if (ferr != 1) return(1);
113  } else if (!strcmp(word, "gravity")) {
114  ferr = fscanf(in,"%lf",&physics->grav);
115  if (ferr != 1) return(1);
116  } else if (!strcmp(word, "gravity_type")) {
117  ferr = fscanf(in,"%d",&physics->grav_type);
118  if (ferr != 1) return(1);
119  } else if (!strcmp(word,"upwinding")) {
120  ferr = fscanf(in,"%s",physics->upw_choice);
121  if (ferr != 1) return(1);
122  } else if (strcmp(word,"end")) {
123  char useless[_MAX_STRING_SIZE_];
124  ferr = fscanf(in,"%s",useless); if (ferr != 1) return(ferr);
125  printf("Warning: keyword %s in file \"physics.inp\" with value %s not ",word,useless);
126  printf("recognized or extraneous. Ignoring.\n");
127  }
128  }
129  } else {
130  fprintf(stderr,"Error: Illegal format in file \"physics.inp\".\n");
131  return(1);
132  }
133  }
134  fclose(in);
135  }
136 
137 #ifndef serial
138  IERR MPIBroadcast_double (&physics->gamma ,1,0,&mpi->world); CHECKERR(ierr);
139  IERR MPIBroadcast_double (&physics->grav ,1,0,&mpi->world); CHECKERR(ierr);
140  IERR MPIBroadcast_integer (&physics->grav_type,1,0,&mpi->world); CHECKERR(ierr);
142 #endif
143 
144  if ((physics->grav != 0.0) && (strcmp(physics->upw_choice,_LLF_)) && (strcmp(physics->upw_choice,_ROE_))) {
145  if (!mpi->rank) {
146  fprintf(stderr,"Error in Euler1DInitialize: %s or %s upwinding is needed for flows ",_LLF_,_ROE_);
147  fprintf(stderr,"with gravitational forces.\n");
148  }
149  return(1);
150  }
151 
152  /* initializing physical model-specific functions */
153  solver->PreStep = Euler1DPreStep;
154  solver->ComputeCFL = Euler1DComputeCFL;
155  solver->FFunction = Euler1DFlux;
156  solver->SFunction = Euler1DSource;
158  if (!strcmp(physics->upw_choice,_ROE_ )) solver->Upwind = Euler1DUpwindRoe;
159  else if (!strcmp(physics->upw_choice,_RF_ )) solver->Upwind = Euler1DUpwindRF;
160  else if (!strcmp(physics->upw_choice,_LLF_ )) solver->Upwind = Euler1DUpwindLLF;
161  else if (!strcmp(physics->upw_choice,_SWFS_ )) solver->Upwind = Euler1DUpwindSWFS;
162  else if (!strcmp(physics->upw_choice,_RUSANOV_)) solver->Upwind = Euler1DUpwindRusanov;
163  else {
164  if (!mpi->rank) fprintf(stderr,"Error in Euler1DInitialize(): %s is not a valid upwinding scheme.\n",
165  physics->upw_choice);
166  return(1);
167  }
168  if (!strcmp(solver->SplitHyperbolicFlux,"yes")) {
169  solver->dFFunction = Euler1DStiffFlux;
171  if (!strcmp(physics->upw_choice,_ROE_ )) solver->UpwinddF = Euler1DUpwinddFRoe;
172  else if (!strcmp(physics->upw_choice,_RF_ )) solver->UpwinddF = Euler1DUpwinddFRF;
173  else if (!strcmp(physics->upw_choice,_LLF_ )) solver->UpwinddF = Euler1DUpwinddFLLF;
174  else {
175  if (!mpi->rank) {
176  fprintf(stderr,"Error in Euler1DInitialize(): %s is not a valid upwinding scheme ",
177  physics->upw_choice);
178  fprintf(stderr,"when split form of the hyperbolic flux is used. Use %s, %s or %s.\n",
179  _ROE_,_RF_,_LLF_);
180  }
181  return(1);
182  }
183  } else {
184  solver->dFFunction = NULL;
185  solver->UpwinddF = NULL;
186  solver->JFunction = Euler1DJacobian;
187  }
191 
192  if (!strcmp(physics->upw_choice,_LLF_ )) physics->SourceUpwind = Euler1DSourceUpwindLLF;
193  else if (!strcmp(physics->upw_choice,_ROE_ )) physics->SourceUpwind = Euler1DSourceUpwindRoe;
194 
195  /* allocate array to hold the gravity field */
196  int *dim = solver->dim_local;
197  int ghosts = solver->ghosts;
198  int size = 1; for (d=0; d<_MODEL_NDIMS_; d++) size *= (dim[d] + 2*ghosts);
199  physics->grav_field = (double*) calloc (size, sizeof(double));
200  physics->fast_jac = (double*) calloc (size*_MODEL_NVARS_*_MODEL_NVARS_, sizeof(double));
201  physics->solution = (double*) calloc (size*_MODEL_NVARS_, sizeof(double));
202  IERR Euler1DGravityField(solver,mpi); CHECKERR(ierr);
203 
204  count++;
205  return(0);
206 }
double Euler1DComputeCFL(void *, void *, double, double)
int Euler1DStiffFlux(double *, double *, int, void *, double)
Definition: Euler1DFlux.c:64
int Euler1DRoeAverage(double *, double *, double *, void *)
double gamma
Definition: euler1d.h:274
int nvars
Definition: hypar.h:29
#define IERR
Definition: basic.h:16
int Euler1DSourceUpwindRoe(double *, double *, double *, double *, int, void *, double)
#define CHECKERR(ierr)
Definition: basic.h:18
Structure containing variables and parameters specific to the 1D Euler equations. This structure cont...
Definition: euler1d.h:273
int Euler1DUpwinddFRF(double *, double *, double *, double *, double *, double *, int, void *, double)
char SplitHyperbolicFlux[_MAX_STRING_SIZE_]
Definition: hypar.h:92
int(* SourceUpwind)(double *, double *, double *, double *, int, void *, double)
Definition: euler1d.h:300
int Euler1DUpwindRusanov(double *, double *, double *, double *, double *, double *, int, void *, double)
int Euler1DUpwindLLF(double *, double *, double *, double *, double *, double *, int, void *, double)
int MPIBroadcast_integer(int *, int, int, void *)
Definition: MPIBroadcast.c:23
int Euler1DJacobian(double *, double *, void *, int, int, int)
double * fast_jac
Definition: euler1d.h:289
int(* AveragingFunction)(double *, double *, double *, void *)
Definition: hypar.h:354
int Euler1DGravityField(void *, void *)
int(* SFunction)(double *, double *, void *, void *, double)
Definition: hypar.h:317
int(* Upwind)(double *, double *, double *, double *, double *, double *, int, void *, double)
Definition: hypar.h:295
int Euler1DUpwinddFRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
int ndims
Definition: hypar.h:26
int MPIBroadcast_character(char *, int, int, void *)
Definition: MPIBroadcast.c:37
int Euler1DRightEigenvectors(double *, double *, void *, int)
Definition: Euler1DEigen.c:38
int(* FFunction)(double *, double *, int, void *, double)
Definition: hypar.h:276
int MPIBroadcast_double(double *, int, int, void *)
Definition: MPIBroadcast.c:9
double(* ComputeCFL)(void *, void *, double, double)
Definition: hypar.h:269
int Euler1DPreStep(double *, void *, void *, double)
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
int Euler1DUpwindSWFS(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _MAX_STRING_SIZE_
Definition: basic.h:14
#define _ROE_
Definition: euler1d.h:62
int Euler1DUpwindRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
Definition: Euler1DUpwind.c:30
#define _MODEL_NDIMS_
Definition: euler1d.h:56
int Euler1DLeftEigenvectors(double *, double *, void *, int)
Definition: Euler1DEigen.c:19
#define _RUSANOV_
Definition: euler1d.h:70
MPI_Comm world
int(* PreStep)(double *, void *, void *, double)
Definition: hypar.h:339
double grav
Definition: euler1d.h:275
int * dim_local
Definition: hypar.h:37
int(* dFFunction)(double *, double *, int, void *, double)
Definition: hypar.h:280
void * physics
Definition: hypar.h:266
int(* JFunction)(double *, double *, void *, int, int, int)
Definition: hypar.h:326
double * solution
Definition: euler1d.h:290
int Euler1DSource(double *, double *, void *, void *, double)
Definition: Euler1DSource.c:23
int Euler1DUpwinddFLLF(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* UpwinddF)(double *, double *, double *, double *, double *, double *, int, void *, double)
Definition: hypar.h:300
int ghosts
Definition: hypar.h:52
int Euler1DUpwindRF(double *, double *, double *, double *, double *, double *, int, void *, double)
#define _SWFS_
Definition: euler1d.h:68
Structure of MPI-related variables.
#define _MODEL_NVARS_
Definition: euler1d.h:58
int Euler1DStiffJacobian(double *, double *, void *, int, int, int)
int grav_type
Definition: euler1d.h:286
int(* GetRightEigenvectors)(double *, double *, void *, int)
Definition: hypar.h:359
int Euler1DModifiedSolution(double *, double *, int, void *, void *, double)
#define _RF_
Definition: euler1d.h:64
int Euler1DFlux(double *, double *, int, void *, double)
Definition: Euler1DFlux.c:16
int(* GetLeftEigenvectors)(double *, double *, void *, int)
Definition: hypar.h:357
double * grav_field
Definition: euler1d.h:288
int(* UFunction)(double *, double *, int, void *, void *, double)
Definition: hypar.h:321
int Euler1DSourceUpwindLLF(double *, double *, double *, double *, int, void *, double)
#define _LLF_
Definition: euler1d.h:66
char upw_choice[_MAX_STRING_SIZE_]
Definition: euler1d.h:291