HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
NavierStokes2DJacobian.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  NavierStokes2D *param = (NavierStokes2D*) p;
28 
29  /* get the eigenvalues and left,right eigenvectors */
30  _NavierStokes2DEigenvalues_ (u,D,param->gamma,dir);
31  _NavierStokes2DLeftEigenvectors_ (u,L,param->gamma,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 = 5; 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 = 10; 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  k = 15; 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]) );
39 
40  MatMult4(_MODEL_NVARS_,DL,D,L);
41  MatMult4(_MODEL_NVARS_,Jac,R,DL);
42 
43  return(0);
44 }
45 
52  double *Jac,
53  double *u,
54  void *p,
55  int dir,
56  int nvars,
57  int upw
60  )
61 {
62  NavierStokes2D *param = (NavierStokes2D*) p;
65 
66  /* get the eigenvalues and left,right eigenvectors */
67  _NavierStokes2DEigenvalues_ (u,D,param->gamma,dir);
68  _NavierStokes2DLeftEigenvectors_ (u,L,param->gamma,dir);
70 
71  int aupw = absolute(upw), k;
72  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]) );
73  k = 5; D[k] = ( dir == _YDIR_ ? 0.0 : absolute( (1-aupw)*D[k] + 0.5*aupw*(1+upw)*max(0,D[k]) + 0.5*aupw*(1-upw)*min(0,D[k]) ) );
74  k = 10; D[k] = ( dir == _XDIR_ ? 0.0 : absolute( (1-aupw)*D[k] + 0.5*aupw*(1+upw)*max(0,D[k]) + 0.5*aupw*(1-upw)*min(0,D[k]) ) );
75  k = 15; D[k] = 0.0;
76 
77  MatMult4(_MODEL_NVARS_,DL,D,L);
78  MatMult4(_MODEL_NVARS_,Jac,R,DL);
79 
80  return(0);
81 }
#define absolute(a)
Definition: math_ops.h:32
Contains function definitions for common mathematical functions.
#define min(a, b)
Definition: math_ops.h:14
#define _NavierStokes2DLeftEigenvectors_(u, L, ga, dir)
#define _NavierStokes2DEigenvalues_(u, D, gamma, dir)
int NavierStokes2DStiffJacobian(double *Jac, double *u, void *p, int dir, int nvars, int upw)
#define _NavierStokes2DRightEigenvectors_(u, R, ga, dir)
#define _YDIR_
Definition: euler2d.h:41
2D Navier Stokes equations (compressible flows)
Structure containing variables and parameters specific to the 2D Navier Stokes equations. This structure contains the physical parameters, variables, and function pointers specific to the 2D Navier-Stokes equations.
#define MatMult4(N, A, X, Y)
#define _XDIR_
Definition: euler1d.h:75
Contains macros and function definitions for common matrix multiplication.
#define _MODEL_NVARS_
Definition: euler1d.h:58
int NavierStokes2DJacobian(double *Jac, double *u, void *p, int dir, int nvars, int upw)
#define max(a, b)
Definition: math_ops.h:18