submodule (params_template_m) io_params_template_parbnd_s !! Handles I/O of parameters related with parallel (Sheath) boundaries of template models use parallelisation_setup_m, only : is_rank_info_writer use screen_io_m, only : get_stdout use error_handling_grillix_m, only: handle_error use status_codes_grillix_m, only : GRILLIX_ERR_NAMELIST implicit none namelist / parbnd_template / parbnd_method, parbnd_type_dens, parbnd_type_parmom namelist / parbnd_immersed / parbnd_immersed_epsinv namelist / parbnd_taylor / parbnd_taylor_order contains module subroutine read_params_template_parbnd(optional_filepath) character(len=*), intent(in), optional :: optional_filepath character(len=:), allocatable :: fpath integer :: io_unit, io_error character(len=256) :: io_errmsg if (present(optional_filepath)) then fpath = optional_filepath else fpath = path_tstep endif open(newunit=io_unit, file=fpath, status='old', action='read', iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, __LINE__, __FILE__) endif read(io_unit, nml=parbnd_template, iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, __LINE__, __FILE__) endif select case(parbnd_method) case('None') case('Immersed') read(io_unit, nml=parbnd_immersed, iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, __LINE__, __FILE__) endif case('Taylor') read(io_unit, nml=parbnd_taylor, iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, __LINE__, __FILE__) endif case default call handle_error("parbnd_method not valid: " // parbnd_method, & GRILLIX_ERR_NAMELIST, __LINE__, __FILE__) end select close(io_unit) end subroutine module subroutine display_params_template_parbnd() if (is_rank_info_writer) then write(get_stdout(), nml=parbnd_template) select case(parbnd_method) case('Immersed') write(get_stdout(), nml=parbnd_immersed) case('Taylor') write(get_stdout(), nml=parbnd_taylor) end select endif end subroutine end submodule