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

Compute the diffusion number. More...

#include <basic.h>
#include <physicalmodels/linearadr.h>
#include <mpivars.h>
#include <hypar.h>

Go to the source code of this file.

Functions

double LinearADRComputeDiffNumber (void *s, void *m, double dt, double t)
 

Detailed Description

Compute the diffusion number.

Author
Debojyoti Ghosh

Definition in file LinearADRComputeDiffNumber.c.

Function Documentation

double LinearADRComputeDiffNumber ( void *  s,
void *  m,
double  dt,
double  t 
)

Computes the maximum diffusion number over the domain. Note that the diffusion number is computed over the local domain on this processor only.

Parameters
sSolver object of type HyPar
mMPI object of type MPIVariables
dtTime step size for which to compute the CFL
tTime

Definition at line 14 of file LinearADRComputeDiffNumber.c.

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 }
double * d
Definition: linearadr.h:53
void * physics
Definition: hypar.h:266
Structure containing variables and parameters specific to the linear advection-diffusion-reaction mod...
Definition: linearadr.h:37
int * dim_local
Definition: hypar.h:37
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Definition: basic.h:31
int ghosts
Definition: hypar.h:52
int nvars
Definition: hypar.h:29
double * dxinv
Definition: hypar.h:110
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23