Reads in the kt_grids_range_parameters namelist and populates the member variables
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(kt_grids_range_config_type), | intent(inout) | :: | self |
subroutine read_kt_grids_range_config(self)
use file_utils, only: input_unit_exist, get_indexed_namelist_unit
use mp, only: proc0
implicit none
class(kt_grids_range_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) :: kyspacing_option
integer :: n0_max, n0_min, naky, nn0, ntheta0
real :: akx_max, akx_min, aky_max, aky_min, rhostar_range, theta0_max, theta0_min
namelist /kt_grids_range_parameters/ akx_max, akx_min, aky_max, aky_min, kyspacing_option, n0_max, n0_min, naky, nn0, ntheta0, rhostar_range, theta0_max, theta0_min
! Only proc0 reads from file
if (.not. proc0) return
! First set local variables from current values
akx_max = self%akx_max
akx_min = self%akx_min
aky_max = self%aky_max
aky_min = self%aky_min
kyspacing_option = self%kyspacing_option
n0_max = self%n0_max
n0_min = self%n0_min
naky = self%naky
nn0 = self%nn0
ntheta0 = self%ntheta0
rhostar_range = self%rhostar_range
theta0_max = self%theta0_max
theta0_min = self%theta0_min
! Now read in the main namelist
in_file = input_unit_exist(self%get_name(), exist)
if (exist) read(in_file, nml = kt_grids_range_parameters)
! Now copy from local variables into type members
self%akx_max = akx_max
self%akx_min = akx_min
self%aky_max = aky_max
self%aky_min = aky_min
self%kyspacing_option = kyspacing_option
self%n0_max = n0_max
self%n0_min = n0_min
self%naky = naky
self%nn0 = nn0
self%ntheta0 = ntheta0
self%rhostar_range = rhostar_range
self%theta0_max = theta0_max
self%theta0_min = theta0_min
self%exist = exist
end subroutine read_kt_grids_range_config