HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ApplyBoundaryConditions.c File Reference

Apply physical boundary conditions to domain. More...

#include <stdio.h>
#include <basic.h>
#include <arrayfunctions.h>
#include <mpivars.h>
#include <boundaryconditions.h>
#include <hypar.h>

Go to the source code of this file.

Functions

int ApplyBoundaryConditions (void *s, void *m, double *x, double *xref, double waqt)
 Applies the boundary conditions specified for each boundary zone. More...
 

Detailed Description

Apply physical boundary conditions to domain.

Author
Debojyoti Ghosh Contains the function that applies the physical boundary conditions to each boundary zone.

Definition in file ApplyBoundaryConditions.c.

Function Documentation

int ApplyBoundaryConditions ( void *  s,
void *  m,
double *  x,
double *  xref,
double  waqt 
)

Applies the boundary conditions specified for each boundary zone.

The solver object (of type HyPar) contains an oject of type DomainBoundary that contains all the boundary information (dimension, extent, face, type, etc). This function iterates through each of the boundary zones (HyPar::boundary[HyPar::nBoundaryZones]) and calls the corresponding boundary condition function.

The variable flag indicates if the array x is the solution, or a delta-solution (from implicit time-integration methods).

Parameters
sObject of type HyPar containing solver-related variables
mObject of type MPIVariables containing MPI-related variables
xThe solution vector on which the boundary conditions are to be applied
xrefReference solution vector, if needed
waqtCurrent simulation time

Definition at line 28 of file ApplyBoundaryConditions.c.

34 {
35  HyPar *solver = (HyPar*) s;
36  DomainBoundary *boundary = (DomainBoundary*) solver->boundary;
37  MPIVariables *mpi = (MPIVariables*) m;
38  int nb = solver->nBoundaryZones;
39 
40  int* dim_local;
41 #if defined(HAVE_CUDA)
42  if (solver->use_gpu) {
43  dim_local = solver->gpu_dim_local;
44  } else {
45 #endif
46  dim_local = solver->dim_local;
47 #if defined(HAVE_CUDA)
48  }
49 #endif
50 
51  /* Apply domain boundary conditions to x */
52  int n;
53  for (n = 0; n < nb; n++) {
54  boundary[n].BCFunctionU(&boundary[n],mpi,solver->ndims,solver->nvars,
55  dim_local,solver->ghosts,x,waqt);
56  }
57 
58  return(0);
59 }
int(* BCFunctionU)(void *, void *, int, int, int *, int, double *, double)
int * dim_local
Definition: hypar.h:37
int ghosts
Definition: hypar.h:52
void * boundary
Definition: hypar.h:159
int * gpu_dim_local
Definition: hypar.h:455
Structure containing the variables and function pointers defining a boundary.
int nBoundaryZones
Definition: hypar.h:157
int nvars
Definition: hypar.h:29
int use_gpu
Definition: hypar.h:449
int ndims
Definition: hypar.h:26
Structure of MPI-related variables.
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23