HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
FPDoubleWellComputeCFL.c
Go to the documentation of this file.
1 #include <basic.h>
2 #include <mathfunctions.h>
4 #include <mpivars.h>
5 #include <hypar.h>
6 
7 double FPDoubleWellComputeCFL(void *s,void *m,double dt,double t)
8 {
9  HyPar *solver = (HyPar*) s;
10  int d, i, v;
11 
12  int ndims = solver->ndims;
13  int nvars = solver->nvars;
14  int ghosts = solver->ghosts;
15  int *dim = solver->dim_local;
16  double *dxinv = solver->dxinv;
17 
18  int offset = 0;
19  double max_cfl = 0;
20  for (d = 0; d < ndims; d++) {
21  for (i = 0; i < dim[d]; i++) {
22  for (v = 0; v < nvars; v++) {
23  double x; _GetCoordinate_(0,i,dim,ghosts,solver->x,x);
24  double local_cfl = absolute(drift(x)) * dt
25  * dxinv[offset+ghosts+i];
26  if (local_cfl > max_cfl) max_cfl = local_cfl;
27  }
28  }
29  offset += dim[d] + 2*ghosts;
30  }
31 
32  return(max_cfl);
33 }
#define absolute(a)
Definition: math_ops.h:32
int nvars
Definition: hypar.h:29
MPI related function definitions.
Contains function definitions for common mathematical functions.
double FPDoubleWellComputeCFL(void *s, void *m, double dt, double t)
Some basic definitions and macros.
double * x
Definition: hypar.h:107
#define drift(x)
Definition: fpdoublewell.h:31
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
Contains structure definition for hypar.
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
double * dxinv
Definition: hypar.h:110