HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
BCDirichlet.c File Reference

Dirichlet boundary conditions. More...

#include <stdlib.h>
#include <basic.h>
#include <arrayfunctions.h>
#include <boundaryconditions.h>

Go to the source code of this file.

Functions

int BCDirichletU (void *b, void *m, int ndims, int nvars, int *size, int ghosts, double *phi, double waqt)
 

Detailed Description

Dirichlet boundary conditions.

Author
Debojyoti Ghosh

Definition in file BCDirichlet.c.

Function Documentation

◆ BCDirichletU()

int BCDirichletU ( void *  b,
void *  m,
int  ndims,
int  nvars,
int *  size,
int  ghosts,
double *  phi,
double  waqt 
)

Applies (steady) Dirichlet boundary conditions for the solution: the ghost points at the physical boundaries are set to specified values

Parameters
bBoundary object of type DomainBoundary
mMPI object of type MPIVariables
ndimsNumber of spatial dimensions
nvarsNumber of variables/DoFs per grid point
sizeInteger array with the number of grid points in each spatial dimension
ghostsNumber of ghost points
phiThe solution array on which to apply the boundary condition
waqtCurrent solution time

Definition at line 13 of file BCDirichlet.c.

23 {
24  DomainBoundary *boundary = (DomainBoundary*) b;
25 
26  if (boundary->on_this_proc) {
27  int bounds[ndims], indexb[ndims];
28  _ArraySubtract1D_(bounds,boundary->ie,boundary->is,ndims);
29  _ArraySetValue_(indexb,ndims,0);
30  int done = 0;
31  while (!done) {
32  int p; _ArrayIndex1DWO_(ndims,size ,indexb,boundary->is,ghosts,p);
33  _ArrayCopy1D_((boundary->DirichletValue),(phi+nvars*p),nvars);
34  _ArrayIncrementIndex_(ndims,bounds,indexb,done);
35  }
36  }
37  return(0);
38 }
Structure containing the variables and function pointers defining a boundary.
#define _ArraySubtract1D_(x, a, b, size)
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArraySetValue_(x, size, value)
#define _ArrayIncrementIndex_(N, imax, i, done)
#define _ArrayCopy1D_(x, y, size)