HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
FPDoubleWellComputeDiffNumber.c
Go to the documentation of this file.
2 #include <mpivars.h>
3 #include <hypar.h>
4 
5 double FPDoubleWellComputeDiffNumber(void *s,void *m,double dt,double t)
6 {
7  HyPar *solver = (HyPar*) s;
8  FPDoubleWell *params = (FPDoubleWell*) solver->physics;
9  int d, i, v;
10 
11  int ndims = solver->ndims;
12  int nvars = solver->nvars;
13  int ghosts = solver->ghosts;
14  int *dim = solver->dim_local;
15  double *dxinv = solver->dxinv;
16 
17  int offset = 0;
18  double max_diffno = 0;
19  for (d = 0; d < ndims; d++) {
20  for (i = 0; i < dim[d]; i++) {
21  for (v = 0; v < nvars; v++) {
22  double local_diffno = 0.5 * params->q * dt
23  * dxinv[offset+ghosts+i]
24  * dxinv[offset+ghosts+i];
25  if (local_diffno > max_diffno) max_diffno = local_diffno;
26  }
27  }
28  offset += dim[d] + 2*ghosts;
29  }
30 
31  return(max_diffno);
32 }
int nvars
Definition: hypar.h:29
MPI related function definitions.
int ndims
Definition: hypar.h:26
double FPDoubleWellComputeDiffNumber(void *s, void *m, double dt, double t)
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
Contains structure definition for hypar.
int * dim_local
Definition: hypar.h:37
void * physics
Definition: hypar.h:266
int ghosts
Definition: hypar.h:52
double * dxinv
Definition: hypar.h:110