From c0747f24c5d5c4eafd1c4670bf4623e47e760fb7 Mon Sep 17 00:00:00 2001 From: laurenchilutti <60401591+laurenchilutti@users.noreply.github.com> Date: Fri, 16 Sep 2022 11:22:40 -0400 Subject: [PATCH] Update call to read_input_nml and remove unnecessary code. (#161) * Update call to read_input_nml and remove unnecessary code. * Removing use of INTERNAL_FILE_NML and cleaning up read_namelist_test_cases to remove unused argument * deleting duplicate call to read_namelist_test_case_nml in fv_control * removing commented code in fv_control --- model/fv_control.F90 | 20 +++----------------- tools/fv_diagnostics.F90 | 13 ------------- tools/test_cases.F90 | 3 +-- 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/model/fv_control.F90 b/model/fv_control.F90 index 7a3d6d47a..2f2563226 100644 --- a/model/fv_control.F90 +++ b/model/fv_control.F90 @@ -54,7 +54,6 @@ module fv_control_mod use fv_mp_mod, only: mp_start, domain_decomp, mp_assign_gid, global_nest_domain use fv_mp_mod, only: broadcast_domains, mp_barrier, is_master, setup_master, grids_master_procs, tile_fine use fv_mp_mod, only: MAX_NNEST, MAX_NTILE - !use test_cases_mod, only: test_case, bubble_do, alpha, nsolitons, soliton_Umax, soliton_size use test_cases_mod, only: read_namelist_test_case_nml use fv_timing_mod, only: timing_on, timing_off, timing_init, timing_prt use mpp_domains_mod, only: domain2D @@ -389,7 +388,7 @@ subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split) Atm(n)%nml_filename = 'input.nml' endif if (.not. file_exists(Atm(n)%nml_filename)) then - call mpp_error(FATAL, "Could not find nested grid namelist "//Atm(n)%nml_filename) + call mpp_error(FATAL, "Could not find namelist "//Atm(n)%nml_filename) endif enddo @@ -445,22 +444,10 @@ subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split) call set_namelist_pointers(Atm(this_grid)) call fv_diag_init_gn(Atm(this_grid)) -#ifdef INTERNAL_FILE_NML - if (this_grid .gt. 1) then - write(Atm(this_grid)%nml_filename,'(A4, I2.2)') 'nest', this_grid - if (.not. file_exists('input_'//trim(Atm(this_grid)%nml_filename)//'.nml')) then - call mpp_error(FATAL, "Could not find nested grid namelist "//'input_'//trim(Atm(this_grid)%nml_filename)//'.nml') - endif - else - Atm(this_grid)%nml_filename = '' - endif - call read_input_nml(Atm(this_grid)%nml_filename) !re-reads into internal namelist -#endif + call read_input_nml(alt_input_nml_path=Atm(this_grid)%nml_filename) !re-reads into internal namelist call read_namelist_fv_grid_nml call read_namelist_fv_core_nml(Atm(this_grid)) ! do options processing here too? - call read_namelist_test_case_nml(Atm(this_grid)%nml_filename) - !TODO test_case_nml moved to test_cases - call read_namelist_test_case_nml(Atm(this_grid)%nml_filename) + call read_namelist_test_case_nml call mpp_get_current_pelist(Atm(this_grid)%pelist, commID=commID) ! for commID call mp_start(commID,halo_update_type) @@ -1050,7 +1037,6 @@ subroutine read_namelist_fv_core_nml(Atm) 198 format(A,i2.2,A,i4.4,'x',i4.4,'x',i1.1,'-',f9.3) 199 format(A,i3.3) - !if (.not. (nested .or. regional)) alpha = alpha*pi !TODO for test_case_nml !allocate(Atm%neststruct%child_grids(size(Atm))) !TODO want to remove !Atm(N)%neststruct%child_grids = .false. diff --git a/tools/fv_diagnostics.F90 b/tools/fv_diagnostics.F90 index 5a8280494..1d59c63c9 100644 --- a/tools/fv_diagnostics.F90 +++ b/tools/fv_diagnostics.F90 @@ -352,20 +352,7 @@ subroutine fv_diag_init(Atm, axes, Time, npx, npy, npz, p_ref) #endif levs_ave = 0 levs_ave(1:4) = (/50,400,850,1000/) -#ifdef INTERNAL_FILE_NML read(input_nml_file, nml=fv_diag_plevs_nml,iostat=ios) -#else - inquire (file=trim(Atm(n)%nml_filename), exist=exists) - if (.not. exists) then - write(errmsg,*) 'fv_diag_plevs_nml: namelist file ',trim(Atm(n)%nml_filename),' does not exist' - call mpp_error(FATAL, errmsg) - else - open (unit=nlunit, file=Atm(n)%nml_filename, READONLY, status='OLD', iostat=ios) - endif - rewind(nlunit) - read (nlunit, nml=fv_diag_plevs_nml, iostat=ios) - close (nlunit) -#endif if (nplev > MAX_PLEVS) then if (is_master()) then print*, ' fv_diagnostics: nplev = ', nplev, ' is too large' diff --git a/tools/test_cases.F90 b/tools/test_cases.F90 index 30b6a7611..034a91fde 100644 --- a/tools/test_cases.F90 +++ b/tools/test_cases.F90 @@ -5566,9 +5566,8 @@ subroutine init_double_periodic(u,v,w,pt,delp,q,phis, ps,pe,peln,pk,pkz, uc,vc, end subroutine init_double_periodic - subroutine read_namelist_test_case_nml(nml_filename) + subroutine read_namelist_test_case_nml() - character(*), intent(IN) :: nml_filename integer :: ierr, f_unit, unit, ios namelist /test_case_nml/test_case, bubble_do, alpha, nsolitons, soliton_Umax, soliton_size, & no_wind, gaussian_dt, dt_amp, do_marine_sounding, checker_tr, small_earth_scale, Umean