Loading [MathJax]/extensions/tex2jax.js
HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
NavierStokes3DJacobian.c File Reference

Contains the functions compute flux Jacobians for the 3D Navier-Stokes system. More...

Go to the source code of this file.

Functions

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

Detailed Description

Contains the functions compute flux Jacobians for the 3D Navier-Stokes system.

Author
Debojyoti Ghosh

Definition in file NavierStokes3DJacobian.c.

Function Documentation

◆ NavierStokes3DJacobian()

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

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

Parameters
JacJacobian matrix: 1D array of size nvar^2 = 25
usolution at a grid point (array of size nvar = 5)
pobject containing the physics-related parameters
dirdimension (0 -> x, 1 -> y, 2 -> z)
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 15 of file NavierStokes3DJacobian.c.

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 }
#define absolute(a)
Definition: math_ops.h:32
#define _NavierStokes3DRightEigenvectors_(u, stride, R, ga, dir)
#define _NavierStokes3DLeftEigenvectors_(u, stride, L, ga, dir)
#define min(a, b)
Definition: math_ops.h:14
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.
#define _NavierStokes3DEigenvalues_(u, stride, D, gamma, dir)
static const int _NavierStokes3D_stride_
#define MatMult5(N, A, X, Y)
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define max(a, b)
Definition: math_ops.h:18

◆ NavierStokes3DStiffJacobian()

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

Function to compute the Jacobian of the fast flux (representing the acoustic waves) of the 3D Navier-Stokes equations, given the solution at a grid point. The Jacobian is square matrix of size nvar=5, and is returned as a 1D array (double) of 25 elements in row-major format.

Parameters
JacJacobian matrix: 1D array of size nvar^2 = 25
usolution at a grid point (array of size nvar = 5)
pobject containing the physics-related parameters
dirdimension (0 -> x, 1 -> y, 2 -> z)
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 53 of file NavierStokes3DJacobian.c.

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
#define _NavierStokes3DRightEigenvectors_(u, stride, R, ga, dir)
#define _NavierStokes3DLeftEigenvectors_(u, stride, L, ga, dir)
#define min(a, b)
Definition: math_ops.h:14
#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.
#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
#define _MODEL_NVARS_
Definition: euler1d.h:58
#define max(a, b)
Definition: math_ops.h:18