mod_reconstruction Module

Reusable scalar face reconstruction helpers.

The routines here intentionally avoid equation-specific state. Species, enthalpy, and future transported scalars can share the same menu of face interpolation choices: - upwind - central - bounded_central / bounded_linear - muscl / limited_linear / linear_upwind / higher_order_bounded

The high-order branch uses a compact cell-gradient reconstruction from the upwind cell and clamps the reconstructed face value to local cell-neighbor bounds. This is not a full FCT implementation, but it gives a robust, conservative, bounded upgrade path over first-order upwind without widening the MPI stencil.



Functions

public function scalar_face_value(mesh, phi, grad_phi, scheme_name, limiter_name, c, neighbor, fid, flux_out, boundary_value, is_dirichlet) result(phi_face)

Reconstruct a scalar value at a face using the requested scheme. flux_out is oriented outward from cell c. neighbor is the effective neighbor seen from c (0 for non-periodic boundary). For Dirichlet boundaries, boundary_value is used as the exterior state.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
real(kind=rk), intent(in) :: phi(:)
real(kind=rk), intent(in) :: grad_phi(:,:)
character(len=*), intent(in) :: scheme_name
character(len=*), intent(in) :: limiter_name
integer, intent(in) :: c
integer, intent(in) :: neighbor
integer, intent(in) :: fid
real(kind=rk), intent(in) :: flux_out
real(kind=rk), intent(in) :: boundary_value
logical, intent(in) :: is_dirichlet

Return Value real(kind=rk)

private function adjacent_cell(mesh, fid, c) result(nb)

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
integer, intent(in) :: fid
integer, intent(in) :: c

Return Value integer

private function bounded_to_local_neighbors(mesh, phi, candidate, cell, boundary_value, include_boundary) result(out)

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
real(kind=rk), intent(in) :: phi(:)
real(kind=rk), intent(in) :: candidate
integer, intent(in) :: cell
real(kind=rk), intent(in) :: boundary_value
logical, intent(in) :: include_boundary

Return Value real(kind=rk)

private pure function clamp_value(x, lo, hi) result(y)

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(in) :: x
real(kind=rk), intent(in) :: lo
real(kind=rk), intent(in) :: hi

Return Value real(kind=rk)

private function compute_bj_coefficient(mesh, phi, grad_phi, c) result(alpha)

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
real(kind=rk), intent(in) :: phi(:)
real(kind=rk), intent(in) :: grad_phi(:,:)
integer, intent(in) :: c

Return Value real(kind=rk)

private function compute_tvd_limited_correction(limiter, phi_cell, phi_nb, grad_corr) result(corr)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: limiter
real(kind=rk), intent(in) :: phi_cell
real(kind=rk), intent(in) :: phi_nb
real(kind=rk), intent(in) :: grad_corr

Return Value real(kind=rk)


Subroutines

public subroutine compute_scalar_gradients(mesh, phi, grad_phi)

Compute compact cell-centered gradients from immediately adjacent cells. Boundary faces without an effective/periodic neighbor are skipped; boundary values are still enforced by scalar_face_value at the boundary face.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
real(kind=rk), intent(in) :: phi(:)
real(kind=rk), intent(out) :: grad_phi(:,:)

public subroutine validate_advection_scheme(scheme_name, scope, allow_scalar_high_order)

Validate scalar/momentum advection names at input time.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: scheme_name
character(len=*), intent(in) :: scope
logical, intent(in) :: allow_scalar_high_order

public subroutine validate_limiter_name(limiter_name)

Validate limiter names. The current bounded implementation maps these limiters to the same local-bounds clamp; the menu is preserved in input so future limiter-specific formulas can be added without changing cases.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: limiter_name