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

Contains the functions compute flux Jacobians for the 1D shallow water system. More...

Go to the source code of this file.

Functions

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

Detailed Description

Contains the functions compute flux Jacobians for the 1D shallow water system.

Author
Debojyoti Ghosh

Definition in file ShallowWater1DJacobian.c.

Function Documentation

◆ ShallowWater1DJacobian()

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

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

Parameters
JacJacobian matrix: 1D array of size nvar^2 = 4
usolution at a grid point (array of size nvar = 2)
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 ShallowWater1DJacobian.c.

24 {
25  ShallowWater1D *param = (ShallowWater1D*) p;
28 
29  /* get the eigenvalues and left,right eigenvectors */
30  _ShallowWater1DEigenvalues_ (u,D,param,0);
33 
34  int aupw = absolute(upw), k;
35  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]) );
36  k = 3; 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]) );
37 
38  MatMult2(2,DL,D,L);
39  MatMult2(2,Jac,R,DL);
40 
41  return(0);
42 }
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.
#define absolute(a)
Definition: math_ops.h:32
#define min(a, b)
Definition: math_ops.h:14
#define _ShallowWater1DRightEigenvectors_(u, R, p, dir)
#define _ShallowWater1DEigenvalues_(u, D, p, dir)
#define MatMult2(N, A, X, Y)
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define max(a, b)
Definition: math_ops.h:18
#define _ShallowWater1DLeftEigenvectors_(u, L, p, dir)