HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
FPDoubleWellUpwind.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 FPDoubleWellUpwind (double *fI, double *fL, double *fR, double *uL, double *uR, double *u, int dir, void *s, double t)
 

Function Documentation

◆ FPDoubleWellUpwind()

int FPDoubleWellUpwind ( double *  fI,
double *  fL,
double *  fR,
double *  uL,
double *  uR,
double *  u,
int  dir,
void *  s,
double  t 
)

Definition at line 7 of file FPDoubleWellUpwind.c.

9 {
10  HyPar *solver = (HyPar*) s;
11  int done,v;
12 
13  int ndims = solver->ndims;
14  int nvars = solver->nvars;
15  int ghosts = solver->ghosts;
16  int *dim = solver->dim_local;
17 
18  int index_outer[ndims], index_inter[ndims], bounds_outer[ndims], bounds_inter[ndims];
19  _ArrayCopy1D_(dim,bounds_outer,ndims); bounds_outer[dir] = 1;
20  _ArrayCopy1D_(dim,bounds_inter,ndims); bounds_inter[dir] += 1;
21 
22  done = 0; _ArraySetValue_(index_outer,ndims,0);
23  while (!done) {
24  _ArrayCopy1D_(index_outer,index_inter,ndims);
25  for (index_inter[dir] = 0; index_inter[dir] < bounds_inter[dir]; index_inter[dir]++) {
26  int p; _ArrayIndex1D_(ndims,bounds_inter,index_inter,0,p);
27  double x1; _GetCoordinate_(0,index_inter[0]-1,dim,ghosts,solver->x,x1);
28  double x2; _GetCoordinate_(0,index_inter[0] ,dim,ghosts,solver->x,x2);
29  double x = 0.5 * ( x1 + x2 );
30  for (v = 0; v < nvars; v++)
31  fI[nvars*p+v] = (drift(x) > 0 ? fL[nvars*p+v] : fR[nvars*p+v] );
32  }
33  _ArrayIncrementIndex_(ndims,bounds_outer,index_outer,done);
34  }
35 
36  return(0);
37 }
int nvars
Definition: hypar.h:29
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
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _ArraySetValue_(x, size, value)
int * dim_local
Definition: hypar.h:37
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Definition: basic.h:31
int ghosts
Definition: hypar.h:52
#define _ArrayCopy1D_(x, y, size)