FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(fields_config_type), | intent(in), | optional | :: | fields_config_in |
subroutine read_parameters(fields_config_in)
use file_utils, only: input_unit, error_unit, input_unit_exist
use text_options, only: text_option, get_option_value
use fields_implicit, only: field_subgath
use fields_local, only: minNRow
use fields_local, only: do_smart_update, field_local_allreduce, field_local_allreduce_sub
use fields_local, only: field_local_tuneminnrow, field_local_nonblocking_collectives
use fields_arrays, only: real_response_file => response_file
use file_utils, only: run_name
implicit none
type(fields_config_type), intent(in), optional :: fields_config_in
character(20) :: field_option
character(len=256) :: response_dir
character(len=256) :: response_file
integer :: ierr, ind_slash
if (present(fields_config_in)) fields_config = fields_config_in
call fields_config%init(name = 'fields_knobs', requires_index = .false.)
! Copy out internal values into module level parameters
do_smart_update = fields_config%do_smart_update
dump_response = fields_config%dump_response
field_local_allreduce = fields_config%field_local_allreduce
field_local_allreduce_sub = fields_config%field_local_allreduce_sub
field_local_nonblocking_collectives = fields_config%field_local_nonblocking_collectives
field_local_tuneminnrow = fields_config%field_local_tuneminnrow
field_option = fields_config%field_option
field_subgath = fields_config%field_subgath
force_maxwell_reinit = fields_config%force_maxwell_reinit
minnrow = fields_config%minnrow
read_response = fields_config%read_response
remove_zonal_flows_switch = fields_config%remove_zonal_flows_switch
response_dir = fields_config%response_dir
response_file = fields_config%response_file
exist = fields_config%exist
ierr = error_unit()
call get_option_value &
(field_option, fieldopts, fieldopt_switch, &
ierr, "field_option in fields_knobs",.true.)
if (trim(response_file) == '') then
response_file = trim(run_name)
end if
if(trim(response_dir).eq.'')then
write(real_response_file,'(A)') trim(response_file)
else
! Need to check if resopnse_file has a directory path in it
! to ensure we merge with response_dir correctly. For example,
! consider response_file = '../../run/input' and response_dir = 'resp'.
! We want to form response_file = '../../run/resp/input' and not
! 'resp/../../run/input' as would happen if just concatenate.
! Check for index of last '/'
ind_slash = index(response_file, "/", back = .true.)
if (ind_slash == 0) then
write(real_response_file,'(A,"/",A)') trim(response_dir),trim(response_file)
else
write(real_response_file,'(A,A,"/",A)') &
response_file(1:ind_slash), &
trim(response_dir), &
trim(response_file(ind_slash+1:))
end if
endif
!Set the solve type specific flags
call set_dump_and_read_response(dump_response, read_response)
end subroutine read_parameters