HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
NavierStokes3DJacobian.c
Go to the documentation of this file.
1 
6 #include <arrayfunctions.h>
7 #include <mathfunctions.h>
8 #include <matmult_native.h>
10 
16  double *Jac,
17  double *u,
18  void *p,
19  int dir,
20  int nvars,
21  int upw
24  )
25 {
26  NavierStokes3D *param = (NavierStokes3D*) p;
29 
30  /* get the eigenvalues and left,right eigenvectors */
34 
35  int aupw = absolute(upw), k;
36  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]) );
37  k = 6; 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 = 12; 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  k = 18; 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]) );
40  k = 24; 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]) );
41 
42  MatMult5(_MODEL_NVARS_,DL,D,L);
43  MatMult5(_MODEL_NVARS_,Jac,R,DL);
44 
45  return(0);
46 }
47 
54  double *Jac,
55  double *u,
56  void *p,
57  int dir,
58  int nvars,
59  int upw
62  )
63 {
64  NavierStokes3D *param = (NavierStokes3D*) p;
67 
68  /* get the eigenvalues and left,right eigenvectors */
72 
73  int aupw = absolute(upw), k;
74  if (dir == _XDIR_) {
75  k = 0; D[k] = 0.0;
76  k = 6; 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]) );
77  k = 12; D[k] = 0.0;
78  k = 18; D[k] = 0.0;
79  k = 24; 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]) );
80  } else if (dir == _YDIR_) {
81  k = 0; D[k] = 0.0;
82  k = 6; D[k] = 0.0;
83  k = 12; 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]) );
84  k = 18; D[k] = 0.0;
85  k = 24; 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]) );
86  } else if (dir == _ZDIR_) {
87  k = 0; D[k] = 0.0;
88  k = 6; D[k] = 0.0;
89  k = 12; D[k] = 0.0;
90  k = 18; 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]) );
91  k = 24; 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]) );
92  }
93 
94  MatMult5(_MODEL_NVARS_,DL,D,L);
95  MatMult5(_MODEL_NVARS_,Jac,R,DL);
96 
97  return(0);
98 }
#define absolute(a)
Definition: math_ops.h:32
int NavierStokes3DJacobian(double *Jac, double *u, void *p, int dir, int nvars, int upw)
#define _NavierStokes3DRightEigenvectors_(u, stride, R, ga, dir)
#define _NavierStokes3DLeftEigenvectors_(u, stride, L, ga, dir)
Contains function definitions for common mathematical functions.
#define min(a, b)
Definition: math_ops.h:14
int NavierStokes3DStiffJacobian(double *Jac, double *u, void *p, int dir, int nvars, int upw)
#define _ZDIR_
Structure containing variables and parameters specific to the 3D Navier Stokes equations. This structure contains the physical parameters, variables, and function pointers specific to the 3D Navier-Stokes equations.
3D Navier Stokes equations (compressible flows)
#define _YDIR_
Definition: euler2d.h:41
#define _NavierStokes3DEigenvalues_(u, stride, D, gamma, dir)
static const int _NavierStokes3D_stride_
#define MatMult5(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
#define max(a, b)
Definition: math_ops.h:18
Contains macros and function definitions for common array operations.