HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Euler1DJacobian.c
Go to the documentation of this file.
1 
6 #include <mathfunctions.h>
7 #include <matmult_native.h>
9 
14 int Euler1DJacobian(double *Jac,
15  double *u,
16  void *p,
17  int dir,
18  int nvars,
19  int upw )
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 }
42 
48 int Euler1DStiffJacobian( double *Jac,
49  double *u,
50  void *p,
51  int dir,
52  int nvars,
53  int upw )
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 _MODEL_NVARS_
Definition: euler1d.h:58
#define _Euler1DRightEigenvectors_(u, R, p, dir)
Definition: euler1d.h:249
#define MatMult3(N, A, X, Y)
Contains function definitions for common mathematical functions.
#define _Euler1DEigenvalues_(u, D, p, dir)
Definition: euler1d.h:207
#define absolute(a)
Definition: math_ops.h:32
int Euler1DStiffJacobian(double *, double *, void *, int, int, int)
#define max(a, b)
Definition: math_ops.h:18
1D Euler Equations (inviscid, compressible flows)
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
Contains macros and function definitions for common matrix multiplication.
int Euler1DJacobian(double *, double *, void *, int, int, int)
#define _Euler1DLeftEigenvectors_(u, L, p, dir)
Definition: euler1d.h:225