HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
LinearADRComputeDiffNumber.c
Go to the documentation of this file.
1 
6 #include <basic.h>
8 #include <mpivars.h>
9 #include <hypar.h>
10 
14 double LinearADRComputeDiffNumber( void *s,
15  void *m,
16  double dt,
17  double t
18  )
19 {
20  HyPar *solver = (HyPar*) s;
21  LinearADR *params = (LinearADR*) solver->physics;
22  int d, i, v;
23 
24  int ndims = solver->ndims;
25  int nvars = solver->nvars;
26  int ghosts = solver->ghosts;
27  int *dim = solver->dim_local;
28 
29  double max_diffno = 0;
30  for (d = 0; d < ndims; d++) {
31  for (i = 0; i < dim[d]; i++) {
32  for (v = 0; v < nvars; v++) {
33  double dxinv; _GetCoordinate_(d,i,dim,ghosts,solver->dxinv,dxinv);
34  double local_diffno = params->d[nvars*d+v] * dt * dxinv * dxinv;
35  if (local_diffno > max_diffno) max_diffno = local_diffno;
36  }
37  }
38  }
39 
40  return(max_diffno);
41 }
int nvars
Definition: hypar.h:29
MPI related function definitions.
Some basic definitions and macros.
int ndims
Definition: hypar.h:26
Structure containing variables and parameters specific to the linear advection-diffusion-reaction mod...
Definition: linearadr.h:37
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
Contains structure definition for hypar.
Linear Advection-Diffusion-Reaction model.
int * dim_local
Definition: hypar.h:37
double LinearADRComputeDiffNumber(void *s, void *m, double dt, double t)
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Definition: basic.h:31
void * physics
Definition: hypar.h:266
int ghosts
Definition: hypar.h:52
double * d
Definition: linearadr.h:53
double * dxinv
Definition: hypar.h:110