HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
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

◆ FPPowerSystemPostStep()

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 }
#define IERR
Definition: basic.h:16
#define CHECKERR(ierr)
Definition: basic.h:18
int MPISum_double(double *, double *, int, void *)
Definition: MPISum.c:39
int ndims
Definition: hypar.h:26
double pdf_integral
Definition: fppowersystem.h:69
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)
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Definition: basic.h:31
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