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. | |
Common module to compute ghost weights table for implicit boundary conditions .
| 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.
| [in] | bndc_coeff | the boundary condition coefficients |
| [in] | bnd_dist | the signed distance from the first inner cell center to the boundary |
| [in] | xb | the coordinate of the reference boundary point |
| [in,out] | scheme | the reconstruction extrapolation scheme (first cell = first ghost) |
| [in] | ghost_face_coords | the coordinates of the ghost control volumes' faces: \( [ a_2, b_2=a_1, b_1=x_b ] \) |
| [in] | inner_steps | the inner cells control volumes: \( [ \Delta x_{i_1}, \ldots, \Delta x_{i_p} ] \) |
| [in,out] | ghost_weights_table | the 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.
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). \)
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.ghost_weights_table = 0.compute_one_ghost_weights with (a,b) and the scratch vector previous_ghost_cell_weights.ghost_weights_table.
|
private |
Compute one ghost cell matrix coefficients (one line) associated to the extrapolation scheme.
| [in] | bndc_coeff | the boundary condition coefficients |
| [in] | bnd_dist | the signed distance from the first inner cell center to the boundary |
| [in,out] | scheme | the reconstruction extrapolation scheme |
| [in] | steps | the 1 ghost + inner cells control volume's, as sent to the scheme |
| [in] | a | the left integration bound (face_coords(i-k)) |
| [in] | b | the right integration bound (face_coords(i-k+1)) |
| [in,out] | ghost_weights_table | the resulting ghost cells weights table |
| [in,out] | previous_ghost_cell_weights | the 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.
\begin{align} \mathbf{w}_{0:order-1} &= -\,\boldsymbol{t}/v, \\ w_g &= 1/v. \end{align}
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. 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.