read_theta_grid_salpha_config Subroutine

private subroutine read_theta_grid_salpha_config(self)

Uses

Reads in the theta_grid_salpha_knobs namelist and populates the member variables

Type Bound

theta_grid_salpha_config_type

Arguments

Type IntentOptional Attributes Name
class(theta_grid_salpha_config_type), intent(inout) :: self

Contents


Source Code

  subroutine read_theta_grid_salpha_config(self)
    use file_utils, only: input_unit_exist, get_indexed_namelist_unit
    use mp, only: proc0
    implicit none
    class(theta_grid_salpha_config_type), intent(in out) :: self
    logical :: exist
    integer :: in_file

    ! Note: When this routine is in the module where these variables live
    ! we shadow the module level variables here. This is intentional to provide
    ! isolation and ensure we can move this routine to another module easily.
    character(len = 20) :: model_option
    real :: alpha1, alpmhdfac

    namelist /theta_grid_salpha_knobs/ alpha1, alpmhdfac, model_option

    ! Only proc0 reads from file
    if (.not. proc0) return

    ! First set local variables from current values
    alpha1 = self%alpha1
    alpmhdfac = self%alpmhdfac
    model_option = self%model_option

    ! Now read in the main namelist
    in_file = input_unit_exist(self%get_name(), exist)
    if (exist) read(in_file, nml = theta_grid_salpha_knobs)

    ! Now copy from local variables into type members
    self%alpha1 = alpha1
    self%alpmhdfac = alpmhdfac
    self%model_option = model_option

    self%exist = exist
  end subroutine read_theta_grid_salpha_config