HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LinearADRJacobian.c File Reference

Function to compute the hyperbolic flux Jacobian for the linear advection-diffusion-reaction system. More...

Go to the source code of this file.

Functions

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

Detailed Description

Function to compute the hyperbolic flux Jacobian for the linear advection-diffusion-reaction system.

Author
Debojyoti Ghosh

Definition in file LinearADRJacobian.c.

Function Documentation

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

Function to compute the flux Jacobian for the hyperbolic (advection) part of the linear-advection-diffusion-reaction model.

Parameters
JacJacobian matrix of size 1 (nvar = 1)
usolution at a grid point
pobject containing physics-related parameters
dirdimension (x/y/z)
nvarsnumber of 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 11 of file LinearADRJacobian.c.

19 {
20  LinearADR *param = (LinearADR*) p;
21 
22  if (param->a) {
23  *Jac = (1-absolute(upw))*absolute(param->a[dir])
24  + absolute(upw) * (1+upw) * max(0,param->a[dir]) * 0.5
25  - absolute(upw) * (1-upw) * min(0,param->a[dir]) * 0.5 ;
26  } else {
27  /* no advection term */
28  *Jac = 0.0;
29  }
30 
31  return 0;
32 }
Structure containing variables and parameters specific to the linear advection-diffusion-reaction mod...
Definition: linearadr.h:37
double * a
Definition: linearadr.h:50
#define absolute(a)
Definition: math_ops.h:32
#define max(a, b)
Definition: math_ops.h:18
#define min(a, b)
Definition: math_ops.h:14
int LinearADRDiffusionJacobian ( double *  Jac,
double *  u,
void *  p,
int  dir,
int  nvars 
)

Function to compute the Jacobian for the parabolic (diffusion) part of the linear-advection-diffusion-reaction model.

Parameters
JacJacobian matrix of size 1 (nvar = 1)
usolution at a grid point
pobject containing physics-related parameters
dirdimension (x/y/z)
nvarsnumber of components

Definition at line 36 of file LinearADRJacobian.c.

41 {
42  LinearADR *param = (LinearADR*) p;
43 
44  int v;
45  for (v = 0; v < nvars; v++) {
46  Jac[nvars*v+v] = -param->d[nvars*dir+v];
47  }
48 
49  return 0;
50 }
double * d
Definition: linearadr.h:53
Structure containing variables and parameters specific to the linear advection-diffusion-reaction mod...
Definition: linearadr.h:37