species_sensible_enthalpies_from_temperature_cantera_point Subroutine

private subroutine species_sensible_enthalpies_from_temperature_cantera_point(params, temperature, hk_value, Y_point)

Compute species sensible enthalpies for one boundary/face state.

Arguments

Type IntentOptional Attributes Name
type(case_params_t), intent(in) :: params
real(kind=rk), intent(in) :: temperature
real(kind=rk), intent(out) :: hk_value(:)
real(kind=rk), intent(in) :: Y_point(:)

Source Code

   subroutine species_sensible_enthalpies_from_temperature_cantera_point(params, temperature, hk_value, Y_point)
      type(case_params_t), intent(in) :: params
      real(rk), intent(in) :: temperature
      real(rk), intent(out) :: hk_value(:)
      real(rk), intent(in) :: Y_point(:)

      integer :: n_len, nsp
      real(rk) :: T_arr(1), P_arr(1)
      real(rk), allocatable :: Y_local(:,:)
      character(kind=c_char), allocatable :: c_names_flat(:)

      if (params%nspecies <= 0) then
         call fatal_error('energy', 'Cantera boundary species enthalpies require at least one species')
      end if
      if (size(hk_value) < params%nspecies) then
         call fatal_error('energy', 'species enthalpy point hk array has incompatible size')
      end if
      if (size(Y_point) < params%nspecies) then
         call fatal_error('energy', 'species enthalpy point Y array has incompatible size')
      end if

      nsp = max(1, params%nspecies)
      allocate(Y_local(nsp, 1))
      Y_local = zero
      Y_local(1:params%nspecies, 1) = max(zero, Y_point(1:params%nspecies))
      if (sum(Y_local(1:params%nspecies, 1)) > tiny_safe) then
         Y_local(1:params%nspecies, 1) = Y_local(1:params%nspecies, 1) / sum(Y_local(1:params%nspecies, 1))
      else
         Y_local(1, 1) = 1.0_rk
      end if

      T_arr(1) = temperature
      P_arr(1) = params%background_press
      call build_c_species_names(params, c_names_flat, n_len)

      call cantera_species_sensible_enthalpies_c(1, T_arr, P_arr, params%nspecies, Y_local, &
                                                 hk_value, params%energy_reference_T, &
                                                 c_names_flat, n_len)

      deallocate(Y_local)
      deallocate(c_names_flat)
   end subroutine species_sensible_enthalpies_from_temperature_cantera_point