Energy field storage, diagnostics, and sensible-enthalpy transport.
This module owns the enthalpy/temperature/radiation-source fields used by
the current constant-density energy path. The transported thermodynamic
state is h; temperature is recovered from h, composition Y, and the
background thermodynamic pressure params%background_press.
In Cantera mode the stored sensible enthalpy is
h_abs(T,Y,p0) - h_abs(T_ref,Y,p0), where p0 is the background pressure
and T_ref is params%energy_reference_T. After species transport changes
Y, Option A is enforced: preserve transported h and recover
T(h,Y,p0). Do not rebuild h from the old temperature and new
composition.
The energy equation uses constant flow/projection density params%rho.
energy%rho_thermo is diagnostic/future-use only and is not used by the
projection or momentum equations. Heat conduction uses grad(T), not
grad(h). qrad is a volumetric source with qrad > 0 adding energy to
the gas.
Missing physics in this path: reactions, reaction heat release,
variable-density low-Mach coupling, species-diffusion enthalpy correction
-div(sum_k h_k J_k), and external radiation physics.
C-Binding interface for Cantera thermodynamics.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=c_int), | value | :: | ncells | |||
| real(kind=c_double), | intent(in) | :: | h_in(ncells) | |||
| real(kind=c_double), | intent(in) | :: | P(ncells) | |||
| integer(kind=c_int), | value | :: | nspecies | |||
| real(kind=c_double), | intent(in) | :: | Y_in(*) | |||
| real(kind=c_double), | intent(out) | :: | T_out(ncells) | |||
| real(kind=c_double), | intent(out) | :: | cp_out(ncells) | |||
| real(kind=c_double), | intent(out) | :: | lambda_out(ncells) | |||
| real(kind=c_double), | intent(out) | :: | rho_thermo_out(ncells) | |||
| real(kind=c_double), | value | :: | T_ref | |||
| character(kind=c_char, len=1), | intent(in) | :: | species_names_flat(*) | |||
| integer(kind=c_int), | value | :: | name_len |
C-Binding interface for Cantera thermodynamics.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=c_int), | value | :: | ncells | |||
| real(kind=c_double), | intent(in) | :: | h_in(ncells) | |||
| real(kind=c_double), | intent(in) | :: | P(ncells) | |||
| integer(kind=c_int), | value | :: | nspecies | |||
| real(kind=c_double), | intent(in) | :: | Y_in(*) | |||
| real(kind=c_double), | intent(out) | :: | T_out(ncells) | |||
| real(kind=c_double), | value | :: | T_ref | |||
| character(kind=c_char, len=1), | intent(in) | :: | species_names_flat(*) | |||
| integer(kind=c_int), | value | :: | name_len |
C-Binding interface for Cantera thermodynamics.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=c_int), | value | :: | ncells | |||
| real(kind=c_double), | intent(in) | :: | T(ncells) | |||
| real(kind=c_double), | intent(in) | :: | P(ncells) | |||
| integer(kind=c_int), | value | :: | nspecies | |||
| real(kind=c_double), | intent(in) | :: | Y_in(*) | |||
| real(kind=c_double), | intent(out) | :: | h_out(ncells) | |||
| real(kind=c_double), | intent(out) | :: | cp_out(ncells) | |||
| real(kind=c_double), | intent(out) | :: | lambda_out(ncells) | |||
| real(kind=c_double), | intent(out) | :: | rho_thermo_out(ncells) | |||
| real(kind=c_double), | value | :: | T_ref | |||
| character(kind=c_char, len=1), | intent(in) | :: | species_names_flat(*) | |||
| integer(kind=c_int), | value | :: | name_len |
Cell-centered energy variables.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=rk), | public, | allocatable | :: | T(:) | |||
| real(kind=rk), | public, | allocatable | :: | T_old(:) | |||
| real(kind=rk), | public, | allocatable | :: | cp(:) | |||
| real(kind=rk), | public, | allocatable | :: | h(:) | |||
| real(kind=rk), | public, | allocatable | :: | h_old(:) | |||
| logical, | public | :: | initialized | = | .false. | ||
| real(kind=rk), | public, | allocatable | :: | lambda(:) | |||
| real(kind=rk), | public, | allocatable | :: | qrad(:) | |||
| real(kind=rk), | public, | allocatable | :: | rho_thermo(:) |
Convert a boundary temperature to enthalpy using the active thermo model. Boundary enthalpy from a boundary temperature.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| type(case_params_t), | intent(in) | :: | params | |||
| real(kind=rk), | intent(in) | :: | temperature | |||
| real(kind=rk), | intent(in), | optional | :: | Y_point(:) |
Normal distance used for cell-cell and cell-boundary temperature gradients.
| 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 |
Outward unit normal from cell_id for face_id.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| integer, | intent(in) | :: | face_id | |||
| integer, | intent(in) | :: | cell_id |
Constant-cp helper for a single boundary/face temperature value.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(case_params_t), | intent(in) | :: | params | |||
| real(kind=rk), | intent(in) | :: | temperature |
Advance transported sensible enthalpy with constant flow density.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| type(flow_mpi_t), | intent(inout) | :: | flow | |||
| type(bc_set_t), | intent(in) | :: | bc | |||
| type(case_params_t), | intent(in) | :: | params | |||
| type(flow_fields_t), | intent(in) | :: | fields | |||
| type(energy_fields_t), | intent(inout) | :: | energy | |||
| real(kind=rk), | intent(in), | optional | :: | species_Y(:,:) |
Allocate all energy arrays for the mesh.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| type(energy_fields_t), | intent(inout) | :: | energy |
Deallocate all energy arrays.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(energy_fields_t), | intent(inout) | :: | energy |
Initialize energy fields from case parameters.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| type(case_params_t), | intent(in) | :: | params | |||
| type(energy_fields_t), | intent(inout) | :: | energy | |||
| real(kind=rk), | intent(in), | optional | :: | species_Y(:,:) |
Recover T from h using the constant-cp thermodynamic model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(case_params_t), | intent(in) | :: | params | |||
| type(energy_fields_t), | intent(inout) | :: | energy |
Update h from T using the constant-cp thermodynamic model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(case_params_t), | intent(in) | :: | params | |||
| type(energy_fields_t), | intent(inout) | :: | energy |
Writes the CSV header for energy diagnostics.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(case_params_t), | intent(in) | :: | params | |||
| type(flow_mpi_t), | intent(in) | :: | flow |
Appends one row of global energy diagnostics.
| 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(energy_fields_t), | intent(in) | :: | energy | |||
| integer, | intent(in) | :: | step | |||
| real(kind=rk), | intent(in) | :: | time |
Reset the volumetric energy source to zero.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(energy_fields_t), | intent(inout) | :: | energy |
Build a boundary thermodynamic composition vector for fixed-T boundaries.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| type(bc_set_t), | intent(in) | :: | bc | |||
| type(case_params_t), | intent(in) | :: | params | |||
| integer, | intent(in) | :: | face_id | |||
| integer, | intent(in) | :: | cell_id | |||
| real(kind=rk), | intent(in) | :: | species_Y(:,:) | |||
| real(kind=rk), | intent(out) | :: | Y_point(:) |
Build a flattened C-compatible species-name buffer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(case_params_t), | intent(in) | :: | params | |||
| character(kind=c_char, len=1), | intent(out), | allocatable | :: | c_names_flat(:) | ||
| integer, | intent(out) | :: | n_len |
Build a cellwise thermodynamic composition array for Cantera calls.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(case_params_t), | intent(in) | :: | params | |||
| integer, | intent(in) | :: | ncells | |||
| real(kind=rk), | intent(out), | allocatable | :: | Y_local(:,:) | ||
| real(kind=rk), | intent(in), | optional | :: | species_Y(:,:) |
Compute h(T,Y,p0) for one boundary state using Cantera.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(case_params_t), | intent(in) | :: | params | |||
| real(kind=rk), | intent(in) | :: | temperature | |||
| real(kind=rk), | intent(out) | :: | h_value | |||
| real(kind=rk), | intent(in), | optional | :: | Y_point(:) |
Recover T from h and refresh cp/lambda/rho_thermo in one Cantera sync.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| type(case_params_t), | intent(in) | :: | params | |||
| type(energy_fields_t), | intent(inout) | :: | energy | |||
| real(kind=rk), | intent(in), | optional | :: | species_Y(:,:) |
Recover T from h using Cantera HPY inversion.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| type(case_params_t), | intent(in) | :: | params | |||
| type(energy_fields_t), | intent(inout) | :: | energy | |||
| real(kind=rk), | intent(in), | optional | :: | species_Y(:,:) |
Update h, cp, lambda, and diagnostic thermo density from current T.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_t), | intent(in) | :: | mesh | |||
| type(case_params_t), | intent(in) | :: | params | |||
| type(energy_fields_t), | intent(inout) | :: | energy | |||
| real(kind=rk), | intent(in), | optional | :: | species_Y(:,:) |