refresh_energy_from_temperature Subroutine

public subroutine refresh_energy_from_temperature(mesh, params, energy, species_Y)

Refresh h/cp/lambda/rho_thermo from the current temperature field.

This is used by initialization utilities such as the ignition kernel that overwrite energy%T before the first timestep. It keeps the transported sensible enthalpy and derived thermodynamic fields consistent with the modified temperature and composition.

Arguments

Type IntentOptional 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(:,:)

Source Code

   subroutine refresh_energy_from_temperature(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(:,:)

      if (.not. energy%initialized) then
         call fatal_error('energy', 'refresh requested before energy initialization')
      end if

      if (params%enable_cantera_thermo) then
         call update_thermo_from_temperature_cantera(mesh, params, energy, species_Y)
      else
         call update_enthalpy_from_temperature_constant_cp(params, energy)
      end if

      if (allocated(energy%T_old)) energy%T_old = energy%T
      if (allocated(energy%h_old)) energy%h_old = energy%h
      if (allocated(energy%rhs_old)) energy%rhs_old = zero
      energy%rhs_old_valid = .false.
   end subroutine refresh_energy_from_temperature