From 7286ad8dd7a5f902b34ae0d8e7f26658fd0c5285 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 23 Feb 2021 09:46:35 -0700 Subject: [PATCH] now pass filename to read_setup_namelist() --- sorc/chgres_cube.fd/program_setup.f90 | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sorc/chgres_cube.fd/program_setup.f90 b/sorc/chgres_cube.fd/program_setup.f90 index ef260e516..4ec07d3e9 100644 --- a/sorc/chgres_cube.fd/program_setup.f90 +++ b/sorc/chgres_cube.fd/program_setup.f90 @@ -144,11 +144,13 @@ module program_setup !> Reads program configuration namelist. !! +!! @param filename the name of the configuration file (defaults to ./fort.41). !! @author George Gayno NCEP/EMC - subroutine read_setup_namelist - + subroutine read_setup_namelist(filename) implicit none - + + character(len=*), intent(in), optional :: filename + character(:), allocatable :: filename_to_use integer :: is, ie, ierr @@ -191,7 +193,13 @@ subroutine read_setup_namelist print*,"- READ SETUP NAMELIST" - open(41, file="./fort.41", iostat=ierr) + if (present(filename)) then + filename_to_use = filename + else + filename_to_use = "./fort.41" + endif + + open(41, file=filename_to_use, iostat=ierr) if (ierr /= 0) call error_handler("OPENING SETUP NAMELIST.", ierr) read(41, nml=config, iostat=ierr) if (ierr /= 0) call error_handler("READING SETUP NAMELIST.", ierr)