0.6.0
Loading...
Searching...
No Matches
Implicit boundary condition treatment, common fonctions

Common module to compute ghost weights table for implicit boundary conditions . More...

Functions/Subroutines

subroutine, public mod_compute_ghost_weights_table::compute_ghost_weights_table (bndc_coeff, bnd_dist, scheme, ghost_face_coords, inner_steps, ghost_weights_table, xb)
 Compute the ghost cells' matrix coefficients associated to the extrapolation scheme.
 
subroutine mod_compute_ghost_weights_table::compute_one_ghost_weights (bndc_coeff, bnd_dist, scheme, steps, a, b, ghost_weights_table, previous_ghost_cell_weights)
 Compute one ghost cell matrix coefficients (one line) associated to the extrapolation scheme.
 

Detailed Description

Common module to compute ghost weights table for implicit boundary conditions .

Function/Subroutine Documentation

◆ compute_ghost_weights_table()

subroutine, public mod_compute_ghost_weights_table::compute_ghost_weights_table ( double precision, dimension(3), intent(in) bndc_coeff,
double precision, intent(in) bnd_dist,
class(t_rec_scheme), intent(inout) scheme,
double precision, dimension(:), intent(in) ghost_face_coords,
double precision, dimension(:), intent(in) inner_steps,
double precision, dimension(:,:), intent(inout) ghost_weights_table,
double precision, intent(in) xb )

Compute the ghost cells' matrix coefficients associated to the extrapolation scheme.

Parameters
[in]bndc_coeffthe boundary condition coefficients
[in]bnd_distthe signed distance from the first inner cell center to the boundary
[in]xbthe coordinate of the reference boundary point
[in,out]schemethe reconstruction extrapolation scheme (first cell = first ghost)
[in]ghost_face_coordsthe coordinates of the ghost control volumes' faces: \( [ a_2, b_2=a_1, b_1=x_b ] \)
[in]inner_stepsthe inner cells control volumes: \( [ \Delta x_{i_1}, \ldots, \Delta x_{i_p} ] \)
[in,out]ghost_weights_tablethe resulting ghost cells weights table

This routine repeatedly calls compute_one_ghost_weights to construct the linear weights expressing each ghost cell average \(\overline{S}_{g_k}\) (k=1,…,nghosts) as a linear combination of interior cell averages and the boundary condition given by coefficients.

Principle

  • The solution ghost_weights_table(nghosts, degree+1) : Each row k holds the weight vector \([\,\omega_0^{(k)},\ldots,\omega_{p-1}^{(k)}, \omega_g^{(k)}\,]\) mapping interior averages and boundary rhs g to the ghost cell \(g_k\).
  • The first ghost cell \(g_1\) is obtained by polynomial extrapolation constrained by the Robin boundary condition:

    \( g = \alpha\,P'(x_b) + \beta\,P(x_b). \)

  • For subsequent ghost cells \(g_k, k\ge2\), the routine uses Chale’s property to derive their averages recursively from the already computed ghost cell(s).

Local variables

  • previous_ghost_cell_weights: scratch vector to store weights of the previously computed ghost cell, needed for recursion.
  • steps(:): extended steps array including both ghost distance and interior mesh steps.

Algorithm

  1. Initialize ghost_weights_table = 0.
  2. For k=1,…,nghosts:
    • Set \( a = |x_0 - x_{g_k}| \), \( b = |x_0 - x_{g_{k-1}}| \).
    • Fill steps(1) = a and steps(2:) = inner_steps .
    • Call compute_one_ghost_weights with (a,b) and the scratch vector previous_ghost_cell_weights.
    • Store the result in row \(k\) of ghost_weights_table.

Remarks

  • The routine is generic w.r.t. mesh spacing (uniform or not).
  • Supports arbitrary polynomial degree (order ≥ 1).
  • Provides all ghost cell weights in a single call, ready for injection into the linear system.

◆ compute_one_ghost_weights()

subroutine mod_compute_ghost_weights_table::compute_one_ghost_weights ( double precision, dimension(:), intent(in) bndc_coeff,
double precision, intent(in) bnd_dist,
class(t_rec_scheme), intent(inout) scheme,
double precision, dimension(:), intent(in) steps,
double precision, intent(in) a,
double precision, intent(in) b,
double precision, dimension(:), intent(inout) ghost_weights_table,
double precision, dimension(:), intent(inout) previous_ghost_cell_weights )
private

Compute one ghost cell matrix coefficients (one line) associated to the extrapolation scheme.

Parameters
[in]bndc_coeffthe boundary condition coefficients
[in]bnd_distthe signed distance from the first inner cell center to the boundary
[in,out]schemethe reconstruction extrapolation scheme
[in]stepsthe 1 ghost + inner cells control volume's, as sent to the scheme
[in]athe left integration bound (face_coords(i-k))
[in]bthe right integration bound (face_coords(i-k+1))
[in,out]ghost_weights_tablethe resulting ghost cells weights table
[in,out]previous_ghost_cell_weightsthe resulting previous ghost cell weights (for optimization)

Compute the weights of one ghost cell by polynomial extrapolation under a Robin boundary condition, with optional recursive update (Chale’s property) when several ghost cells are needed.

This routine builds, at the boundary face center x_b, the unique reconstruction polynomial P of degree \(p = \text{order} - 1\) that interpolates interior cell averages and enforces the Robin condition

\begin{align} g = \alpha\,P'(x_b) + \beta\,P(x_b). \end{align}

Once P is known through its discrete stencil, the average in the first ghost cell \(\overline{S}_{g_1}\) is expressed as a linear combination of interior cell averages and the boundary datum \(g\):

\begin{align} \overline{S}_{g_1} = \sum_{k=0}^{p-1} \omega_k \,\overline{S}_{i_k} + \omega_g \, g, \end{align}

where the weights \(\omega_k\) and \(\omega_g\) are computed from the reconstruction stencil and its first derivative evaluated at \(x_b\).

If additional ghost cells are required (extent > 1), the routine supports the recursive construction using Chale’s property. For a ghost cell \(g_i\) (i ≥ 2), one uses

\begin{align} \bar{S}_{g_i} &= \frac{1}{b_i - a_i} \left( \int_{a_i}^{b_1} P(x)\,dx - \int_{a_{i-1}}^{b_1} P(x)\,dx \right) \\ &= \frac{1}{b_i - a_i} \left( (b_1 - a_i) \bar{S}_{g_i \rightarrow g_1} - (b_1 - b_{i}) \bar{S}_{g_{i-1} \rightarrow g_1} \right) \end{align}

In this implementation, we use the reference \(b_1=0\) and positive \(a_i \equiv a\) and \(b_i \equiv b\) such that:

\begin{align} \overline{S}_{g_i} &= \frac{a\,\overline{S}_{g_i \rightarrow g_1} - b\,\overline{S}_{g_{i-1} \rightarrow g_1}} {b - a}. \end{align}

Practically, the routine updates the weight vector of \(g_i\) from that of \(g_1\) via a simple affine combination of weight tables.

Algorithmic details

  1. Build the reconstruction and its first derivative at \(x_b\): \( \mathbf{W} = \text{scheme_weights},\ \mathbf{W}' = \text{scheme_d1_weights}. \)
  2. Form the Robin row restricted to interior unknowns (indices 2:): \( \boldsymbol{t} = \beta\,\mathbf{W}_{2:} + \alpha\,\mathbf{W}'_{2:} \), and the pivot (ghost-side coefficient): \( v = \beta\,W_1 + \alpha\,W'_1 \).
  3. Solve for the first ghost cell weights:

    \begin{align} \mathbf{w}_{0:order-1} &= -\,\boldsymbol{t}/v, \\ w_g &= 1/v. \end{align}

  4. Prepare recursion (Chale): exchange/copy the current vector to previous_ghost_cell_weights, then update \( \mathbf{w} \leftarrow (a\,\mathbf{w} - b\,\mathbf{w}^{\text{prev}})/(b-a) \) to obtain the weights for the next ghost cell, if any.

Symmetry (left/right boundaries)

The routine is independent on boundary side. By passing appropriate ghost_offsets and target_offsets, it applies equally to left/bottom/back or right/top/front boundaries.