Reads in the parameter_scan_knobs namelist and populates the member variables
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(parameter_scan_config_type), | intent(inout) | :: | self |
subroutine read_parameter_scan_config(self)
use file_utils, only: input_unit_exist, get_indexed_namelist_unit
use mp, only: proc0
implicit none
class(parameter_scan_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) :: inc_con, scan_par, scan_type, target_par
integer :: nstep_inc, nstep_init, scan_spec
logical :: scan_restarted
real :: delta_t_inc, delta_t_init, par_end, par_inc, par_start, target_val
namelist /parameter_scan_knobs/ delta_t_inc, delta_t_init, inc_con, nstep_inc, nstep_init, par_end, par_inc, par_start, scan_par, scan_restarted, scan_spec, scan_type, target_par, target_val
! Only proc0 reads from file
if (.not. proc0) return
! First set local variables from current values
delta_t_inc = self%delta_t_inc
delta_t_init = self%delta_t_init
inc_con = self%inc_con
nstep_inc = self%nstep_inc
nstep_init = self%nstep_init
par_end = self%par_end
par_inc = self%par_inc
par_start = self%par_start
scan_par = self%scan_par
scan_restarted = self%scan_restarted
scan_spec = self%scan_spec
scan_type = self%scan_type
target_par = self%target_par
target_val = self%target_val
! Now read in the main namelist
in_file = input_unit_exist(self%get_name(), exist)
if (exist) read(in_file, nml = parameter_scan_knobs)
! Now copy from local variables into type members
self%delta_t_inc = delta_t_inc
self%delta_t_init = delta_t_init
self%inc_con = inc_con
self%nstep_inc = nstep_inc
self%nstep_init = nstep_init
self%par_end = par_end
self%par_inc = par_inc
self%par_start = par_start
self%scan_par = scan_par
self%scan_restarted = scan_restarted
self%scan_spec = scan_spec
self%scan_type = scan_type
self%target_par = target_par
self%target_val = target_val
self%exist = exist
end subroutine read_parameter_scan_config