HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
ShallowWater2DJacobian.c
Go to the documentation of this file.
1 
6 #include <mathfunctions.h>
7 #include <matmult_native.h>
9 
15  double *Jac,
16  double *u,
17  void *p,
18  int dir,
19  int nvars,
20  int upw
23  )
24 {
25  ShallowWater2D *param = (ShallowWater2D*) p;
28 
29  /* get the eigenvalues and left,right eigenvectors */
30  _ShallowWater2DEigenvalues_ (u,D,param,dir);
31  _ShallowWater2DLeftEigenvectors_ (u,L,param,dir);
32  _ShallowWater2DRightEigenvectors_(u,R,param,dir);
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 = 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]) );
37  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]) );
38 
39  MatMult3(_MODEL_NVARS_,DL,D,L);
40  MatMult3(_MODEL_NVARS_,Jac,R,DL);
41 
42  return(0);
43 }
#define absolute(a)
Definition: math_ops.h:32
Contains function definitions for common mathematical functions.
#define min(a, b)
Definition: math_ops.h:14
2D Shallow Water Equations
Structure containing variables and parameters specific to the 2D Shallow Water equations. This structure contains the physical parameters, variables, and function pointers specific to the 2D ShallowWater equations.
#define _ShallowWater2DLeftEigenvectors_(u, L, p, dir)
#define _ShallowWater2DEigenvalues_(u, D, p, dir)
int ShallowWater2DJacobian(double *Jac, double *u, void *p, int dir, int nvars, int upw)
Contains macros and function definitions for common matrix multiplication.
#define MatMult3(N, A, X, Y)
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define _ShallowWater2DRightEigenvectors_(u, R, p, dir)
#define max(a, b)
Definition: math_ops.h:18