HyPar
1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
|
Sponge boundary condition. More...
Go to the source code of this file.
Functions | |
int | BCSpongeSource (void *b, int ndims, int nvars, int ghosts, int *size, double *grid, double *u, double *source) |
int | BCSpongeUDummy (void *b, void *m, int ndims, int nvars, int *size, int ghosts, double *phi, double waqt) |
Sponge boundary condition.
Definition in file BCSponge.c.
int BCSpongeSource | ( | void * | b, |
int | ndims, | ||
int | nvars, | ||
int | ghosts, | ||
int * | size, | ||
double * | grid, | ||
double * | u, | ||
double * | source | ||
) |
Applies the sponge boundary condition: This function computes the source term required to apply a sponge boundary condition that gradually relaxes the solution to a specified state. This boundary condition is different from other boundary conditions in the sense that it is applied at interior grid points (but within the defined sponge zone).
The source term for the sponge is computed as:
\begin{align} {\bf S}_i &= \sigma_i \left( {\bf U}_i - {\bf U}_{\rm ref} \right),\\ \sigma_i &= \frac {x_i - x_{\rm start}} {x_{\rm end} - x_{\rm start}} \end{align}
where \(i\) is the grid index along the spatial dimension of the sponge, \({\bf U}_{\rm ref}\) is the specified state to which the solution is relaxed, and \(x_i\), \(x_{\rm start}\), and \(x_{\rm end}\) are the spatial coordinates of the grid point, sponge start, and sponge end, respectively, along the spatial dimension of the sponge.
b | Boundary object of type DomainBoundary |
ndims | Number of spatial dimensions |
nvars | Number of variables/DoFs per grid point |
ghosts | Number of ghost points |
size | Integer array with the number of grid points in each spatial dimension |
grid | 1D array with the spatial coordinates of the grid points, one dimension after the other |
u | Solution |
source | Source term to which the sponge term is added |
Definition at line 26 of file BCSponge.c.
int BCSpongeUDummy | ( | void * | b, |
void * | m, | ||
int | ndims, | ||
int | nvars, | ||
int * | size, | ||
int | ghosts, | ||
double * | phi, | ||
double | waqt | ||
) |
Dummy function to ensure consistency with the overall boundary condition implementation. The actual sponge boundary condition is implemented by BCSpongeSource()
b | Boundary object of type DomainBoundary |
m | MPI object of type MPIVariables |
ndims | Number of spatial dimensions |
nvars | Number of variables/DoFs per grid point |
size | Integer array with the number of grid points in each spatial dimension |
ghosts | Number of ghost points |
phi | The solution array on which to apply the boundary condition |
waqt | Current solution time |
Definition at line 73 of file BCSponge.c.