HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FPDoubleWellComputeDiffNumber.c File Reference
#include <physicalmodels/fpdoublewell.h>
#include <mpivars.h>
#include <hypar.h>

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 5 of file FPDoubleWellComputeDiffNumber.c.

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 }
void * physics
Definition: hypar.h:266
int * dim_local
Definition: hypar.h:37
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