Skip to content

Commit

Permalink
Feature/jedi control (#136)
Browse files Browse the repository at this point in the history
* Updates to allow for JEDI to specify input.nml
  • Loading branch information
mark-a-potts committed Oct 27, 2021
1 parent 8a3a759 commit d6bfc15
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions model/fv_control.F90
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,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 ! 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
Expand All @@ -216,6 +219,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 !!!!!!!!!!

!------------------------------------------
Expand Down Expand Up @@ -412,6 +418,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
Expand Down Expand Up @@ -486,9 +495,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_exists(Atm(n)%nml_filename)) 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
Expand Down Expand Up @@ -554,7 +564,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?
Expand Down

0 comments on commit d6bfc15

Please sign in to comment.