Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update call to read_input_nml and remove unnecessary code. #161

Merged
merged 6 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions model/fv_control.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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.
Expand Down
13 changes: 0 additions & 13 deletions tools/fv_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 1 addition & 2 deletions tools/test_cases.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down