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

Go to the source code of this file.

Functions

int FPDoubleWellPostStep (double *u, void *s, void *m, double t, int iter)
 

Function Documentation

◆ FPDoubleWellPostStep()

int FPDoubleWellPostStep ( double *  u,
void *  s,
void *  m,
double  t,
int  iter 
)

Definition at line 8 of file FPDoubleWellPostStep.c.

9 {
10  HyPar *solver = (HyPar*) s;
11  MPIVariables *mpi = (MPIVariables*) m;
12  FPDoubleWell *params = (FPDoubleWell*) solver->physics;
14 
15  int *dim = solver->dim_local;
16  int ghosts = solver->ghosts;
17  int ndims = solver->ndims;
18  int index[ndims];
19 
20  double local_sum = 0;
21  int done = 0; _ArraySetValue_(index,ndims,0);
22  while (!done) {
23  int p; _ArrayIndex1D_(ndims,dim,index,ghosts,p);
24  double dx = 1.0 / solver->dxinv[index[0]+ghosts];
25  local_sum += (u[p] * dx);
26  _ArrayIncrementIndex_(ndims,dim,index,done);
27  }
28  double local_integral = local_sum;
29  double global_integral = 0;
30  IERR MPISum_double(&global_integral,&local_integral,1,&mpi->world); CHECKERR(ierr);
31  params->pdf_integral = global_integral;
32 
33  return(0);
34 }
#define IERR
Definition: basic.h:16
#define CHECKERR(ierr)
Definition: basic.h:18
double pdf_integral
Definition: fpdoublewell.h:28
int MPISum_double(double *, double *, int, void *)
Definition: MPISum.c:39
int ndims
Definition: hypar.h:26
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
MPI_Comm world
#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)
void * physics
Definition: hypar.h:266
int ghosts
Definition: hypar.h:52
Structure of MPI-related variables.
#define _DECLARE_IERR_
Definition: basic.h:17
double * dxinv
Definition: hypar.h:110