module params_diffusion_m !! Holds all parameters of diffusion model use error_handling_grillix_m, only: handle_error use status_codes_grillix_m, only : GRILLIX_ERR_NAMELIST use screen_io_m, only : get_stdout use technical_constants_m, only : PATHLEN_MAX use params_diffusion_mms_m use params_diffusion_model_m use params_diffusion_tstep_m use params_diffusion_boundaries_perp_m use params_diffusion_boundaries_parpen_m use params_diffusion_init_select_m use params_diffusion_parsolver_m implicit none character(len=PATHLEN_MAX), protected :: path_mms = 'params_diffusion.in' !! Relative path to parameterfile for mms parameters character(len=PATHLEN_MAX), protected :: path_model = 'params_diffusion.in' !! Relative path to parameterfile for model parameters character(len=PATHLEN_MAX), protected :: path_tstep = 'params_diffusion.in' !! Relative path to parameterfile for tstep parameters character(len=PATHLEN_MAX), protected :: path_boundaries_perp = 'params_diffusion.in' !! Relative path to parameterfile for boundaries_perp parameters character(len=PATHLEN_MAX), protected :: path_boundaries_parpen = 'params_diffusion.in' !! Relative path to parameterfile for boundaries_parpen parameters character(len=PATHLEN_MAX), protected :: path_parsolver = 'params_diffusion.in' !! Relative path to parameterfile for parsolver parameters character(len=PATHLEN_MAX), protected :: path_init_select = 'params_diffusion.in' !! Relative path to parameterfile for init_select parameters namelist / paths / & path_mms, path_model, path_tstep, path_boundaries_perp, & path_boundaries_parpen, path_parsolver, path_init_select private paths public :: read_paths public :: write_paths public :: read_all_params_diffusion public :: write_all_params_diffusion contains subroutine read_paths(filename) !! Reads paths to parameter files character(len=*), intent(in) :: filename !! Filename, to read filepaths from integer :: io_unit, io_error character(len=256) :: io_errmsg open(newunit=io_unit, file=filename, 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=paths, iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, & __LINE__, __FILE__) endif close(io_unit) end subroutine subroutine write_paths(filename) !! WWrites paths to parameter files character(len=*), intent(in), optional :: filename !! If present, filename where paths are written to, !! if not present, writes to screen integer :: io_unit, io_error character(len=256) :: io_errmsg if (present(filename)) then open(newunit=io_unit, file=filename, status='unknown', & access='append', action='write', & iostat=io_error, iomsg=io_errmsg ) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, & __LINE__, __FILE__) endif else io_unit = get_stdout() endif write(io_unit, nml=paths, iostat=io_error, iomsg=io_errmsg) if (io_error /= 0) then call handle_error(io_errmsg, GRILLIX_ERR_NAMELIST, & __LINE__, __FILE__) endif if (present(filename)) then close(io_unit) endif end subroutine subroutine read_all_params_diffusion() !! Reads all parameters related with diffusion model call read_params_mms(path_mms) call read_params_model(path_model) call read_params_tstep(path_tstep) call read_params_boundaries_perp(path_boundaries_perp) call read_params_boundaries_parpen(path_boundaries_parpen) call read_params_init_select(path_init_select) call read_params_parsolver(path_parsolver) end subroutine subroutine write_all_params_diffusion(filename) !! Writes all parameters related with diffusion model character(len=*), intent(in), optional :: filename !! If present, filename where parameters are written to call write_params_mms(filename) call write_params_model(filename) call write_params_tstep(filename) call write_params_boundaries_perp(filename) call write_params_boundaries_parpen(filename) call write_params_init_select(filename) call write_params_parsolver(filename) end subroutine end module