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

Contains the 1D Euler-specific function to be called at the beginning of each time step. More...

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

Go to the source code of this file.

Functions

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

Detailed Description

Contains the 1D Euler-specific function to be called at the beginning of each time step.

Author
Debojyoti Ghosh

Definition in file Euler1DPreStep.c.

Function Documentation

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 }
int npoints_local_wghosts
Definition: hypar.h:42
#define _ArraySetValue_(x, size, value)
#define _Euler1DGetFlowVar_(u, rho, v, e, P, p)
Definition: euler1d.h:81
#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
#define _MODEL_NDIMS_
Definition: euler1d.h:56
int ghosts
Definition: hypar.h:52
#define _Euler1DSetStiffJac_(J, rho, v, e, P, gamma)
Definition: euler1d.h:149
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
double * fast_jac
Definition: euler1d.h:289
#define _ArrayCopy1D_(x, y, size)
double * solution
Definition: euler1d.h:290
#define _ArrayAddCopy1D_(x, a, y, size)
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
double gamma
Definition: euler1d.h:274