HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
FPDoubleWellDiffusion.c File Reference
#include <stdlib.h>
#include <basic.h>
#include <arrayfunctions.h>
#include <physicalmodels/fpdoublewell.h>
#include <hypar.h>

Go to the source code of this file.

Functions

int FPDoubleWellDiffusion (double *f, double *u, int dir, void *s, double t)
 

Function Documentation

◆ FPDoubleWellDiffusion()

int FPDoubleWellDiffusion ( double *  f,
double *  u,
int  dir,
void *  s,
double  t 
)

Definition at line 7 of file FPDoubleWellDiffusion.c.

8 {
9  HyPar *solver = (HyPar*) s;
10  FPDoubleWell *param = (FPDoubleWell*) solver->physics;
11  int i, v;
12 
13  int *dim = solver->dim_local;
14  int ghosts = solver->ghosts;
15  int ndims = solver->ndims;
16  int nvars = solver->nvars;
17  int index[ndims], bounds[ndims], offset[ndims];
18 
19  /* set bounds for array index to include ghost points */
20  _ArrayCopy1D_(dim,bounds,ndims);
21  for (i=0; i<ndims; i++) bounds[i] += 2*ghosts;
22 
23  /* set offset such that index is compatible with ghost point arrangement */
24  _ArraySetValue_(offset,ndims,-ghosts);
25 
26  int done = 0; _ArraySetValue_(index,ndims,0);
27  while (!done) {
28  int p; _ArrayIndex1DWO_(ndims,dim,index,offset,ghosts,p);
29  for (v = 0; v < nvars; v++) f[nvars*p+v] = 0.5*param->q * u[nvars*p+v];
30  _ArrayIncrementIndex_(ndims,bounds,index,done);
31  }
32 
33  return(0);
34 }
int nvars
Definition: hypar.h:29
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArraySetValue_(x, size, value)
int * dim_local
Definition: hypar.h:37
#define _ArrayIncrementIndex_(N, imax, i, done)
void * physics
Definition: hypar.h:266
int ghosts
Definition: hypar.h:52
#define _ArrayCopy1D_(x, y, size)