HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
VlasovAdvectionCoeff.c
Go to the documentation of this file.
1 
6 #include <float.h>
7 #include <math.h>
8 #include <basic.h>
9 #include <arrayfunctions.h>
10 #include <physicalmodels/vlasov.h>
11 #include <mpivars.h>
12 #include <hypar.h>
13 
28 double VlasovAdvectionCoeff(int* idx,
29  int dir,
30  void* s
31  )
32 {
33 
34  HyPar *solver = (HyPar*) s;
35  Vlasov *param = (Vlasov*) solver->physics;
36 
37  int* dim = solver->dim_local;
38  int ghosts = solver->ghosts;
39 
40  double retval = DBL_MAX;
41 
42  if (dir < param->ndims_x) {
43 
44  int veldim = dir + param->ndims_x;
45  _GetCoordinate_(veldim,idx[veldim],dim,ghosts,solver->x,retval);
46 
47  } else {
48 
49  int ndims_x = param->ndims_x;
50  int dim_x[ndims_x]; _ArrayCopy1D_(dim, dim_x, ndims_x);
51 
52  int idx_x[ndims_x];
53  _ArrayCopy1D_(idx, idx_x, ndims_x);
54  int p; _ArrayIndex1D_(ndims_x, dim_x, idx_x, ghosts, p);
55  retval = param->e_field[ndims_x*p+(dir-ndims_x)];
56 
57  }
58 
59  return retval;
60 
61 }
Definition: vlasov.h:57
double VlasovAdvectionCoeff(int *idx, int dir, void *s)
MPI related function definitions.
Some basic definitions and macros.
double * x
Definition: hypar.h:107
double * e_field
Definition: vlasov.h:81
Vlasov Equation.
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
Contains structure definition for hypar.
#define _ArrayIndex1D_(N, imax, i, ghost, index)
int * dim_local
Definition: hypar.h:37
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Definition: basic.h:31
void * physics
Definition: hypar.h:266
int ghosts
Definition: hypar.h:52
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.
int ndims_x
Definition: vlasov.h:63