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.
Predictor Step: An intermediate velocity is calculated by advancing the momentum equation explicitly, excluding the new pressure gradient.
Poisson Solve: A pressure correction potential is found by solving the Poisson equation derived from the active continuity constraint.
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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(case_params_t), | intent(in) | :: | params | |||
| type(transport_properties_t), | intent(in) | :: | transport | |||
| integer, | intent(in) | :: | cell_id |
Linearly interpolates a scalar field to a face.
| Type | Intent | Optional | 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 |
Linearly interpolates a vector field to a face.
| Type | Intent | Optional | 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) |
Allocates and resets temporary solver vectors. Calculates the normal distance between cell centers or cell-to-face.
| Type | Intent | Optional | 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). |
Orchestrates one full fractional-step iteration.
| Type | Intent | Optional | 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. |
Calculates domain-wide CFL and optionally scales the timestep size.
| Type | Intent | Optional | 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 |
Aggregates global raw-divergence, kinetic-energy, and boundary-flux data.
| Type | Intent | Optional | 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 |
Performs a post-chemistry corrective pressure projection step.
| Type | Intent | Optional | 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. |
Update the guarded variable-density low-Mach divergence source.
| Type | Intent | Optional | 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(:) |
Advances velocity using the 2nd-order Adams-Bashforth scheme.
| Type | Intent | Optional | 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(:,:) |
Adjusts flux at Neumann outlets to ensure strict global mass balance.
| Type | Intent | Optional | 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(:) |
Internal helper for MPI error checking.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | ierr | |||
| character(len=*), | intent(in) | :: | where |
Helper to integrated boundary flux on MPI-owned partitions.
| Type | Intent | Optional | 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 |
Computes density-weighted face mass flux from volumetric flux.
| Type | Intent | Optional | 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(:) |
Computes the discrete divergence of face fluxes for each cell.
| Type | Intent | Optional | 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(:) |
Evaluates the advective, diffusive, and pressure terms of the momentum equation.
| Type | Intent | Optional | 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(:,:) |
Linearly interpolates cell-centered intermediate velocity to mesh faces.
| Type | Intent | Optional | 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(:) |
Updates cell-centered velocity using the pressure potential gradient.
| Type | Intent | Optional | 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(:,:) |
Corrects face fluxes using the pressure potential gradient.
| Type | Intent | Optional | 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(:) |
Calculates the pressure gradient at a cell center using Gauss's Theorem.
| Type | Intent | Optional | 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) |