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

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 8 of file FPPowerSystemPostStep.c.

9 {
10  HyPar *solver = (HyPar*) s;
11  MPIVariables *mpi = (MPIVariables*) m;
12  FPPowerSystem *params = (FPPowerSystem*) 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 dxinv; _GetCoordinate_(0,index[0],dim,ghosts,solver->dxinv,dxinv);
25  double dyinv; _GetCoordinate_(1,index[1],dim,ghosts,solver->dxinv,dyinv);
26  local_sum += (u[p] / (dxinv * dyinv));
27  _ArrayIncrementIndex_(ndims,dim,index,done);
28  }
29  double local_integral = local_sum;
30  double global_integral = 0;
31  IERR MPISum_double(&global_integral,&local_integral,1,&mpi->world); CHECKERR(ierr);
32  params->pdf_integral = global_integral;
33 
34  return(0);
35 }
double pdf_integral
Definition: fppowersystem.h:69
#define _ArraySetValue_(x, size, value)
#define _ArrayIncrementIndex_(N, imax, i, done)
void * physics
Definition: hypar.h:266
int * dim_local
Definition: hypar.h:37
int MPISum_double(double *, double *, int, void *)
Definition: MPISum.c:39
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Definition: basic.h:31
int ghosts
Definition: hypar.h:52
#define _ArrayIndex1D_(N, imax, i, ghost, index)
MPI_Comm world
#define CHECKERR(ierr)
Definition: basic.h:18
double * dxinv
Definition: hypar.h:110
int ndims
Definition: hypar.h:26
#define IERR
Definition: basic.h:16
Structure of MPI-related variables.
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
#define _DECLARE_IERR_
Definition: basic.h:17