Recover T from h and refresh cp/lambda/rho_thermo in one Cantera sync.
This is the preferred energy-step thermo sync routine:
(T, cp, lambda, rho_thermo) = sync(h, Y, p0). It preserves the
transported sensible enthalpy field and updates only derived thermo
state: T, cp, lambda, and rho_thermo. The thermo-sync cache key in the
C++ bridge is h, p0, and Y; rho_thermo becomes active density only
after sync_active_density_from_thermo in variable-density mode.
| 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(:,:) |
subroutine recover_temperature_and_update_thermo_cantera(mesh, params, energy, species_Y) type(mesh_t), intent(in) :: mesh type(case_params_t), intent(in) :: params type(energy_fields_t), intent(inout) :: energy real(rk), intent(in), optional :: species_Y(:,:) integer :: n_len real(rk), allocatable :: P_arr(:), Y_local(:,:) character(kind=c_char), allocatable :: c_names_flat(:) if (.not. params%enable_cantera_thermo) return if (params%nspecies <= 0) then call fatal_error('energy', 'enable_cantera_thermo requires at least one inert thermo species') end if allocate(P_arr(mesh%ncells)) P_arr = params%background_press call build_thermo_Y(params, mesh%ncells, Y_local, species_Y) call build_c_species_names(params, c_names_flat, n_len) call cantera_recover_temperature_and_update_thermo_c(mesh%ncells, & energy%h, & P_arr, & params%nspecies, & Y_local, & energy%T, & energy%cp, & energy%lambda, & energy%rho_thermo, & params%energy_reference_T, & c_names_flat, & n_len) deallocate(P_arr) deallocate(Y_local) deallocate(c_names_flat) end subroutine recover_temperature_and_update_thermo_cantera