mod_flow_projection Module

Fractional-step projection solver for constant- and variable-density modes.

This module implements the core hydrodynamic solver for the LowMachReact-Hex framework. Constant-density mode uses params%rho and enforces . Guarded variable-density low-Mach mode uses active density transport%rho and enforces , where is stored in fields%projection_divergence_source for the projection time level.

  1. Predictor Step: An intermediate velocity is calculated by advancing the momentum equation explicitly, excluding the new pressure gradient.

  2. Poisson Solve: A pressure correction potential is found by solving the Poisson equation derived from the active continuity constraint.

  3. Corrector Step: The final velocity and pressure are updated using the potential gradient.

The linear system for the Poisson equation is solved using a Preconditioned Conjugate Gradient (PCG) method with a diagonal (Jacobi) preconditioner.



Functions

private function boundary_density_for_cell(params, transport, cell_id) result(rho_b)

Arguments

Type IntentOptional Attributes Name
type(case_params_t), intent(in) :: params
type(transport_properties_t), intent(in) :: transport
integer, intent(in) :: cell_id

Return Value real(kind=rk)

private function face_linear_scalar(mesh, bc, face_id, cell_id, nb, owner_value, neighbor_value) result(face_value)

Linearly interpolates a scalar field to a face.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(bc_set_t), intent(in) :: bc
integer, intent(in) :: face_id
integer, intent(in) :: cell_id
integer, intent(in) :: nb
real(kind=rk), intent(in) :: owner_value
real(kind=rk), intent(in) :: neighbor_value

Return Value real(kind=rk)

private function face_linear_vector(mesh, bc, face_id, cell_id, nb, owner_value, neighbor_value) result(face_value)

Linearly interpolates a vector field to a face.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(bc_set_t), intent(in) :: bc
integer, intent(in) :: face_id
integer, intent(in) :: cell_id
integer, intent(in) :: nb
real(kind=rk), intent(in) :: owner_value(3)
real(kind=rk), intent(in) :: neighbor_value(3)

Return Value real(kind=rk), (3)

private function face_neighbor_weight(mesh, bc, face_id, cell_id, nb) result(w_nb)

Allocates and resets temporary solver vectors. Calculates the normal distance between cell centers or cell-to-face.

Read more…

Arguments

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

The mesh.

type(bc_set_t), intent(in) :: bc

Boundary conditions.

integer, intent(in) :: face_id

Face index.

integer, intent(in) :: cell_id

Source cell index.

integer, intent(in) :: nb

Neighbor cell index (or 0 for boundaries).

Return Value real(kind=rk)


Subroutines

public subroutine advance_projection_step(mesh, flow, bc, params, transport, fields, stats)

Orchestrates one full fractional-step iteration.

Read more…

Arguments

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

Computational mesh context.

type(flow_mpi_t), intent(inout) :: flow

MPI parallelization data structure.

type(bc_set_t), intent(in) :: bc

Boundary condition patches.

type(case_params_t), intent(in) :: params

Configuration input parameters.

type(transport_properties_t), intent(inout) :: transport

Physical and thermodynamic properties (e.g. density).

type(flow_fields_t), intent(inout) :: fields

Flow field arrays (u, u_star, p, phi, face_flux, mass_flux) updated in-place.

type(solver_stats_t), intent(inout) :: stats

Solver diagnostics statistics container.

public subroutine compute_and_update_cfl(mesh, flow, params, fields, stats)

Calculates domain-wide CFL and optionally scales the timestep size.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(case_params_t), intent(inout) :: params
type(flow_fields_t), intent(in) :: fields
type(solver_stats_t), intent(inout) :: stats

public subroutine compute_flow_diagnostics(mesh, flow, bc, params, fields, stats)

Aggregates global raw-divergence, kinetic-energy, and boundary-flux data.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(bc_set_t), intent(in) :: bc
type(case_params_t), intent(in) :: params
type(flow_fields_t), intent(in) :: fields
type(solver_stats_t), intent(inout) :: stats

public subroutine correct_projection_to_lowmach_source(mesh, flow, bc, params, transport, fields, stats)

Performs a post-chemistry corrective pressure projection step.

Read more…

Arguments

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

Computational mesh context.

type(flow_mpi_t), intent(inout) :: flow

MPI parallelization data structure.

type(bc_set_t), intent(in) :: bc

Boundary condition patches.

type(case_params_t), intent(in) :: params

Configuration input parameters.

type(transport_properties_t), intent(inout) :: transport

Physical and thermodynamic properties (e.g. density).

type(flow_fields_t), intent(inout) :: fields

Flow field arrays corrected in-place.

type(solver_stats_t), intent(inout) :: stats

Solver diagnostics statistics container.

public subroutine update_lowmach_divergence_source_from_density(mesh, flow, bc, params, transport, fields, species_Y, T_state)

Update the guarded variable-density low-Mach divergence source.

Read more…

Arguments

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

Computational mesh context.

type(flow_mpi_t), intent(inout) :: flow

MPI parallelization communicator data.

type(bc_set_t), intent(in) :: bc

Boundary condition set.

type(case_params_t), intent(in) :: params

Global simulation configuration parameters.

type(transport_properties_t), intent(inout) :: transport

Thermodynamic property array containing density.

type(flow_fields_t), intent(inout) :: fields

Flow fields where the divergence source will be populated.

real(kind=rk), intent(in), optional :: species_Y(:,:)
real(kind=rk), intent(in), optional :: T_state(:)

private subroutine advance_ab2(mesh, flow, params, fields, rhs, local_ustar)

Advances velocity using the 2nd-order Adams-Bashforth scheme.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(case_params_t), intent(in) :: params
type(flow_fields_t), intent(in) :: fields
real(kind=rk), intent(in) :: rhs(:,:)
real(kind=rk), intent(out) :: local_ustar(:,:)

private subroutine balance_neumann_outlet_flux(mesh, flow, bc, params, fields, face_flux)

Adjusts flux at Neumann outlets to ensure strict global mass balance.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(bc_set_t), intent(in) :: bc
type(case_params_t), intent(in) :: params
type(flow_fields_t), intent(in) :: fields
real(kind=rk), intent(inout) :: face_flux(:)

private subroutine check_mpi(ierr, where)

Internal helper for MPI error checking.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: ierr
character(len=*), intent(in) :: where

private subroutine compute_boundary_flux(mesh, flow, bc, face_flux, local_flux)

Helper to integrated boundary flux on MPI-owned partitions.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(bc_set_t), intent(in) :: bc
real(kind=rk), intent(in) :: face_flux(:)
real(kind=rk), intent(out) :: local_flux

private subroutine compute_face_mass_flux(mesh, flow, bc, transport, face_flux, mass_flux)

Computes density-weighted face mass flux from volumetric flux.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(bc_set_t), intent(in) :: bc
type(transport_properties_t), intent(in) :: transport
real(kind=rk), intent(in) :: face_flux(:)
real(kind=rk), intent(out) :: mass_flux(:)

private subroutine compute_flux_divergence(mesh, flow, face_flux, local_div)

Computes the discrete divergence of face fluxes for each cell.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
real(kind=rk), intent(in) :: face_flux(:)
real(kind=rk), intent(out) :: local_div(:)

private subroutine compute_momentum_rhs(mesh, flow, bc, params, transport, u, p, local_rhs)

Evaluates the advective, diffusive, and pressure terms of the momentum equation.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(bc_set_t), intent(in) :: bc
type(case_params_t), intent(in) :: params
type(transport_properties_t), intent(in) :: transport
real(kind=rk), intent(in) :: u(:,:)
real(kind=rk), intent(in) :: p(:)
real(kind=rk), intent(out) :: local_rhs(:,:)

private subroutine compute_predicted_face_flux(mesh, flow, bc, params, transport, ustar, face_flux)

Linearly interpolates cell-centered intermediate velocity to mesh faces.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(bc_set_t), intent(in) :: bc
type(case_params_t), intent(in) :: params
type(transport_properties_t), intent(in) :: transport
real(kind=rk), intent(in) :: ustar(:,:)
real(kind=rk), intent(out) :: face_flux(:)

private subroutine correct_cell_velocity(mesh, flow, bc, params, transport, ustar, phi, local_u)

Updates cell-centered velocity using the pressure potential gradient.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(bc_set_t), intent(in) :: bc
type(case_params_t), intent(in) :: params
type(transport_properties_t), intent(in) :: transport
real(kind=rk), intent(in) :: ustar(:,:)
real(kind=rk), intent(in) :: phi(:)
real(kind=rk), intent(out) :: local_u(:,:)

private subroutine correct_face_flux(mesh, flow, bc, params, transport, predicted_flux, phi, face_flux)

Corrects face fluxes using the pressure potential gradient.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(bc_set_t), intent(in) :: bc
type(case_params_t), intent(in) :: params
type(transport_properties_t), intent(in) :: transport
real(kind=rk), intent(in) :: predicted_flux(:)
real(kind=rk), intent(in) :: phi(:)
real(kind=rk), intent(out) :: face_flux(:)

private subroutine pressure_gradient_cell(mesh, bc, p, cell_id, gradp)

Calculates the pressure gradient at a cell center using Gauss's Theorem.

Read more…

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(bc_set_t), intent(in) :: bc
real(kind=rk), intent(in) :: p(:)
integer, intent(in) :: cell_id
real(kind=rk), intent(out) :: gradp(3)