From 829b9aa7560712bc2681527e96f86b7db0d05317 Mon Sep 17 00:00:00 2001 From: Mark Potts Date: Mon, 30 Aug 2021 10:46:23 -0400 Subject: [PATCH 1/4] Updates to allow for JEDI to specify input.nml --- model/fv_control.F90 | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/model/fv_control.F90 b/model/fv_control.F90 index ca63f8ed9..20237dde8 100644 --- a/model/fv_control.F90 +++ b/model/fv_control.F90 @@ -185,12 +185,15 @@ module fv_control_mod !------------------------------------------------------------------------------- - subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split) + subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split, & + nml_filename_in, skip_nml_read_in) type(fv_atmos_type), allocatable, intent(inout), target :: Atm(:) real, intent(in) :: dt_atmos integer, intent(OUT) :: this_grid logical, allocatable, intent(OUT) :: grids_on_this_pe(:) + character(len=32), optional, intent(in) :: nml_filename_in + logical, optional, intent(in) :: skip_nml_read_in integer, intent(INOUT) :: p_split character(100) :: pe_list_name, errstring @@ -215,6 +218,9 @@ subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split) real :: sdt integer :: unit, ens_root_pe, tile_id(1) + character(len=32) :: nml_filename = 'input.nml' + logical :: skip_nml_read = .false. + !!!!!!!!!! POINTERS FOR READING NAMELISTS !!!!!!!!!! !------------------------------------------ @@ -409,6 +415,9 @@ subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split) call mp_assign_gid ens_root_pe = mpp_root_pe() + if (present(nml_filename_in)) nml_filename = nml_filename_in + if (present(skip_nml_read_in)) skip_nml_read = skip_nml_read_in + ! 1. read nesting namelists call read_namelist_nest_nml call read_namelist_fv_nest_nml @@ -483,9 +492,10 @@ subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split) if (n > 1) then Atm(n)%nml_filename = 'input_'//trim(pe_list_name)//'.nml' else - Atm(n)%nml_filename = 'input.nml' +! Atm(n)%nml_filename = 'input.nml' + Atm(n)%nml_filename = trim(nml_filename) endif - if (.not. file_exist(Atm(n)%nml_filename)) then + if (.not. file_exist(Atm(n)%nml_filename) .and. .not. skip_nml_read) then call mpp_error(FATAL, "Could not find nested grid namelist "//Atm(n)%nml_filename) endif enddo @@ -551,7 +561,9 @@ subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split) else Atm(this_grid)%nml_filename = '' endif - call read_input_nml(Atm(this_grid)%nml_filename) !re-reads into internal namelist + if (.not. skip_nml_read) then + call read_input_nml(Atm(this_grid)%nml_filename) !re-reads into internal namelist + endif #endif call read_namelist_fv_grid_nml call read_namelist_fv_core_nml(Atm(this_grid)) ! do options processing here too? From 779dfd86111afd29c07f8aee8608707b5bf2bfeb Mon Sep 17 00:00:00 2001 From: Mark Potts Date: Fri, 3 Sep 2021 11:20:10 -0400 Subject: [PATCH 2/4] Fixed file_exists --- model/fv_control.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/fv_control.F90 b/model/fv_control.F90 index 3813c078a..f5e5e74d8 100644 --- a/model/fv_control.F90 +++ b/model/fv_control.F90 @@ -494,7 +494,7 @@ subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split, ! Atm(n)%nml_filename = 'input.nml' Atm(n)%nml_filename = trim(nml_filename) endif - if (.not. file_exist(Atm(n)%nml_filename) .and. .not. skip_nml_read) then + if (.not. file_exists(Atm(n)%nml_filename) .and. .not. skip_nml_read) then call mpp_error(FATAL, "Could not find nested grid namelist "//Atm(n)%nml_filename) endif enddo From e9d351e942a606a14aec8fb541c2741ff954b30a Mon Sep 17 00:00:00 2001 From: Mark Potts Date: Fri, 3 Sep 2021 11:20:10 -0400 Subject: [PATCH 3/4] Fixed file_exists and added comments --- model/fv_control.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/fv_control.F90 b/model/fv_control.F90 index 3813c078a..f5e5e74d8 100644 --- a/model/fv_control.F90 +++ b/model/fv_control.F90 @@ -494,7 +494,7 @@ subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split, ! Atm(n)%nml_filename = 'input.nml' Atm(n)%nml_filename = trim(nml_filename) endif - if (.not. file_exist(Atm(n)%nml_filename) .and. .not. skip_nml_read) then + if (.not. file_exists(Atm(n)%nml_filename) .and. .not. skip_nml_read) then call mpp_error(FATAL, "Could not find nested grid namelist "//Atm(n)%nml_filename) endif enddo From 1c943d2f0ea6748278171996f84d524b05735162 Mon Sep 17 00:00:00 2001 From: Mark Potts Date: Tue, 26 Oct 2021 10:08:08 -0400 Subject: [PATCH 4/4] Added some comments --- model/fv_control.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model/fv_control.F90 b/model/fv_control.F90 index f5e5e74d8..a0713b903 100644 --- a/model/fv_control.F90 +++ b/model/fv_control.F90 @@ -191,8 +191,8 @@ subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split, real, intent(in) :: dt_atmos integer, intent(OUT) :: this_grid logical, allocatable, intent(OUT) :: grids_on_this_pe(:) - character(len=32), optional, intent(in) :: nml_filename_in - logical, optional, intent(in) :: skip_nml_read_in + character(len=32), optional, intent(in) :: nml_filename_in ! alternate nml + logical, optional, intent(in) :: skip_nml_read_in ! use previously loaded nml integer, intent(INOUT) :: p_split character(100) :: pe_list_name, errstring