0.6.0
Loading...
Searching...
No Matches
Implicit boundary condition treatment, with ghost cells

Ghost method for implicit boundary condition treatment of a scalar equation defined on cells. More...

Functions/Subroutines

subroutine mod_add_cell_bc_ghost::add_cell_bc_ghost_rec (matrix, rhs, boundary_condition, equation_stencil, equation_ls_map)
 Set boundary condition to a cell-discretized linear system (with ghost cells)
 
subroutine mod_add_cell_bc_ghost::apply_boundary_condition_on_matrix_line (matrix, rhs, ia, l, stencil_size, cells_offset, cells_coeff, robin_coeff_1)
 Apply boundary condition on one line of the matrix.
 
subroutine mod_add_cell_bc_ghost_former::add_cell_bc_ghost_former (matrix, rhs, boundary_condition, equation_stencil, equation_ls_map)
 Set boundary condition to a cell-discretized linear system (with ghost cells)
 

Detailed Description

Ghost method for implicit boundary condition treatment of a scalar equation defined on cells.

Function/Subroutine Documentation

◆ add_cell_bc_ghost_former()

subroutine mod_add_cell_bc_ghost_former::add_cell_bc_ghost_former ( double precision, dimension(:), intent(inout) matrix,
double precision, dimension(:), intent(inout) rhs,
type(t_boundary_condition), intent(in) boundary_condition,
type(t_cell_stencil), intent(in) equation_stencil,
type(t_ls_map), intent(in) equation_ls_map )

Set boundary condition to a cell-discretized linear system (with ghost cells)

Deprecated
Use mod_add_cell_bc_ghost::add_cell_bc_ghost instead.

The Robin boundary condition is discretized:

\begin{align} g = \alpha \frac {\partial S_b} {\partial n} + \beta S_b \end{align}

The first row of ghost cells outside the physical domain are used to impose boundary conditions. A second-order discretization scheme is used as follows (right boundary):

--x--x--|··x··  i: first interior cell node,  e: exterior cell node,
  j  i  b  e    j: second interior cell node, b: boundary face node.
  • Dirichlet "part": the ghost node value \( S_e \), located at the exterior cell node, is computed using the unknown value from the interior cell node and the given boundary value at the boundary face node as:

    \begin{align} S_b = \tfrac{1}{2}(S_e + S_i) \end{align}

  • Dirichlet (only): the given boundary flux at the boundary face is expressed from the unknown values at the interior and exterior cell nodes as:

    \begin{align} S_b = 0.375S_e + 0.750S_i - 0.125S_j \\ \alpha = 0 \\ \beta = 1 \end{align}

  • Neumann "part": the given boundary flux at the boundary face is expressed from the unknown values at the interior and exterior cell nodes as:

    \begin{align} \alpha \frac {\partial S_b} {\partial n} = \alpha \frac {(S_e - S_i)} {\Delta x} \end{align}

The second row of ghost cells outside the physical domain may be used by a second order scheme, whose stencil is equal to 9 points (13 points in 3D). For this purpose, a second-order extrapolation is done (to be improved)

◆ add_cell_bc_ghost_rec()

subroutine mod_add_cell_bc_ghost::add_cell_bc_ghost_rec ( double precision, dimension(:), intent(inout) matrix,
double precision, dimension(:), intent(inout) rhs,
type(t_boundary_condition), intent(in) boundary_condition,
type(t_cell_stencil), intent(in) equation_stencil,
type(t_ls_map), intent(in) equation_ls_map )
private

Set boundary condition to a cell-discretized linear system (with ghost cells)

Parameters
[in,out]matrixthe system matrix
[in,out]rhsthe system right-hand side
[in]boundary_conditionthe boundary condition
[in]equation_stencilthe equation stencil
[in]equation_ls_mapthe linear system mapping

This function applies the boundary condition discretization directly including ghost cells in the linear system matrix and rhs. It is based on the use of mod_compute_ghost_weights_table::compute_ghost_weights_table as the no ghost counterpart mod_add_cell_bc_noghost::add_cell_bc_noghost ["add_cell_bc_noghost"]. However, this routine has some restrictions:

  • only two ghost cells are supported;
  • only linear and quadratic schemes are supported;
  • quadratic scheme only supports Dirichlet BC.

This function directly sets the matrix lines and rhs entries according to the result of mod_compute_ghost_weights_table::compute_ghost_weights_table, using mod_add_cell_bc_ghost::apply_boundary_condition_on_matrix_line.

Note
The no ghost method should be preferred for being more accurate and efficient. mod_add_cell_bc_noghost::add_cell_bc_noghost

◆ apply_boundary_condition_on_matrix_line()

subroutine mod_add_cell_bc_ghost::apply_boundary_condition_on_matrix_line ( double precision, dimension(:), intent(inout) matrix,
double precision, dimension(:), intent(inout) rhs,
integer, intent(in) ia,
integer, intent(in) l,
integer, intent(in) stencil_size,
integer, dimension(:), intent(in) cells_offset,
double precision, dimension(:), intent(in) cells_coeff,
double precision, intent(in) robin_coeff_1 )
private

Apply boundary condition on one line of the matrix.

Set the matrix line and rhs corresponding to the given boundary condition discretization.

Parameters
[in,out]matrixthe system matrix
[in,out]rhsthe system right-hand side
[in]iathe starting index of the matrix line to set
[in]lthe linear system index corresponding to the matrix line (for rhs)
[in]stencil_sizethe size of the stencil
[in]cells_offsetthe offsets of the neighboring cells in the stencil, of size ord
[in]cells_coeffthe coefficients of the neighboring cells in the stencil, of size ord+1 (to store the rhs contribution in ord+1)
[in]robin_coeff_1the first coefficient of the Robin boundary