compute_species_sensible_enthalpies_cantera Subroutine

public subroutine compute_species_sensible_enthalpies_cantera(mesh, params, T_state, species_Y, hk_species)

Compute species sensible enthalpies h_k(T)-h_k(T_ref) [J/kg_k] for all cells.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(case_params_t), intent(in) :: params
real(kind=rk), intent(in) :: T_state(:)
real(kind=rk), intent(in) :: species_Y(:,:)
real(kind=rk), intent(out) :: hk_species(:,:)

Source Code

   subroutine compute_species_sensible_enthalpies_cantera(mesh, params, T_state, species_Y, hk_species)
      type(mesh_t), intent(in) :: mesh
      type(case_params_t), intent(in) :: params
      real(rk), intent(in) :: T_state(:)
      real(rk), intent(in) :: species_Y(:,:)
      real(rk), intent(out) :: hk_species(:,:)

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

      if (.not. params%enable_cantera_thermo) then
         call fatal_error('energy', 'species sensible enthalpies require Cantera thermo')
      end if
      if (params%nspecies <= 0) then
         call fatal_error('energy', 'species sensible enthalpies require at least one species')
      end if
      if (size(T_state) < mesh%ncells) then
         call fatal_error('energy', 'T_state has incompatible size for species sensible enthalpies')
      end if
      if (size(hk_species, 1) < params%nspecies .or. size(hk_species, 2) < mesh%ncells) then
         call fatal_error('energy', 'hk_species has incompatible shape')
      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_species_sensible_enthalpies_c(mesh%ncells, T_state, P_arr, params%nspecies, &
                                                 Y_local, hk_species, params%energy_reference_T, &
                                                 c_names_flat, n_len)

      deallocate(P_arr)
      deallocate(Y_local)
      deallocate(c_names_flat)
   end subroutine compute_species_sensible_enthalpies_cantera