allocate_radiation_state Subroutine

public subroutine allocate_radiation_state(state, ncells, n_species, n_scalars)

Arguments

Type IntentOptional Attributes Name
type(radiation_state_t), intent(inout) :: state
integer, intent(in) :: ncells
integer, intent(in) :: n_species
integer, intent(in) :: n_scalars

Source Code

   subroutine allocate_radiation_state(state, ncells, n_species, n_scalars)
      type(radiation_state_t), intent(inout) :: state
      integer, intent(in) :: ncells, n_species, n_scalars
      call free_radiation_state(state)
      state%ncells = ncells
      state%n_species = max(0, n_species)
      state%n_scalars = max(0, n_scalars)
      allocate(state%temperature(ncells), state%pressure(ncells))
      state%temperature = zero
      state%pressure = zero
      if (state%n_species > 0) then
         allocate(state%Y(state%n_species, ncells))
         state%Y = zero
      end if
      if (state%n_scalars > 0) then
         allocate(state%scalars(state%n_scalars, ncells))
         state%scalars = zero
      end if
   end subroutine allocate_radiation_state