version 0.6.0
mod_explicit_add_cell_bc Module Reference

Fill ghost nodes with given boundary conditions for cell scalars.

Functions/Subroutines

subroutine explicit_add_cell_bc (scalar, boundary_condition)
 Compute the equivalent Dirichlet boundary value of a field and store the result in the first ghost cell in each direction. More...
 

Function/Subroutine Documentation

◆ explicit_add_cell_bc()

subroutine mod_explicit_add_cell_bc::explicit_add_cell_bc ( double precision, dimension(:,:,:), intent(inout)  scalar,
type(t_boundary_condition), intent(in)  boundary_condition 
)

The computation is done for Neumann boundaries.

  • The Neumann value is modified as to account for the wanted extrapolated derivative at the destination cells *.

This is done by applying a different Neumann condition which is the extrapolation of the derivative at the extrapolated point (order 2):

\[ \phi(\alpha) \simeq \phi(x_0) + \alpha D^1(x_0) + \alpha^2/2 D^2(x_0) \Rightarrow \frac{d \phi}{d x}(\alpha) \simeq D^1(x_0) + \alpha D^2(x_0) \Rightarrow D^1(x_0) \simeq \frac{d \phi}{d x}(\alpha) - \alpha D^2(x_0) \]

where \( \alpha \) is the distance between the extrapolation cell and the place where the derivative is given.

Example
if the right face is a Neumann boundary, then scalar(i,je+1,k) will be filled with the 2nd order extrapolated value at the cell (not the face!).
Note
For Dirichlet boundaries, the value is simply copied.
Parameters
[in,out]scalarscalar field
[in]boundary_conditionboundary conditions.
Todo:
MCO: do better extrapolation (not sequential)