Skip to content

Commit c0747f2

Browse files
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
1 parent 85d4ed6 commit c0747f2

File tree

3 files changed

+4
-32
lines changed

3 files changed

+4
-32
lines changed

model/fv_control.F90

+3-17
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ module fv_control_mod
5454
use fv_mp_mod, only: mp_start, domain_decomp, mp_assign_gid, global_nest_domain
5555
use fv_mp_mod, only: broadcast_domains, mp_barrier, is_master, setup_master, grids_master_procs, tile_fine
5656
use fv_mp_mod, only: MAX_NNEST, MAX_NTILE
57-
!use test_cases_mod, only: test_case, bubble_do, alpha, nsolitons, soliton_Umax, soliton_size
5857
use test_cases_mod, only: read_namelist_test_case_nml
5958
use fv_timing_mod, only: timing_on, timing_off, timing_init, timing_prt
6059
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)
389388
Atm(n)%nml_filename = 'input.nml'
390389
endif
391390
if (.not. file_exists(Atm(n)%nml_filename)) then
392-
call mpp_error(FATAL, "Could not find nested grid namelist "//Atm(n)%nml_filename)
391+
call mpp_error(FATAL, "Could not find namelist "//Atm(n)%nml_filename)
393392
endif
394393
enddo
395394

@@ -445,22 +444,10 @@ subroutine fv_control_init(Atm, dt_atmos, this_grid, grids_on_this_pe, p_split)
445444

446445
call set_namelist_pointers(Atm(this_grid))
447446
call fv_diag_init_gn(Atm(this_grid))
448-
#ifdef INTERNAL_FILE_NML
449-
if (this_grid .gt. 1) then
450-
write(Atm(this_grid)%nml_filename,'(A4, I2.2)') 'nest', this_grid
451-
if (.not. file_exists('input_'//trim(Atm(this_grid)%nml_filename)//'.nml')) then
452-
call mpp_error(FATAL, "Could not find nested grid namelist "//'input_'//trim(Atm(this_grid)%nml_filename)//'.nml')
453-
endif
454-
else
455-
Atm(this_grid)%nml_filename = ''
456-
endif
457-
call read_input_nml(Atm(this_grid)%nml_filename) !re-reads into internal namelist
458-
#endif
447+
call read_input_nml(alt_input_nml_path=Atm(this_grid)%nml_filename) !re-reads into internal namelist
459448
call read_namelist_fv_grid_nml
460449
call read_namelist_fv_core_nml(Atm(this_grid)) ! do options processing here too?
461-
call read_namelist_test_case_nml(Atm(this_grid)%nml_filename)
462-
!TODO test_case_nml moved to test_cases
463-
call read_namelist_test_case_nml(Atm(this_grid)%nml_filename)
450+
call read_namelist_test_case_nml
464451
call mpp_get_current_pelist(Atm(this_grid)%pelist, commID=commID) ! for commID
465452
call mp_start(commID,halo_update_type)
466453

@@ -1050,7 +1037,6 @@ subroutine read_namelist_fv_core_nml(Atm)
10501037
198 format(A,i2.2,A,i4.4,'x',i4.4,'x',i1.1,'-',f9.3)
10511038
199 format(A,i3.3)
10521039

1053-
!if (.not. (nested .or. regional)) alpha = alpha*pi !TODO for test_case_nml
10541040

10551041
!allocate(Atm%neststruct%child_grids(size(Atm))) !TODO want to remove
10561042
!Atm(N)%neststruct%child_grids = .false.

tools/fv_diagnostics.F90

-13
Original file line numberDiff line numberDiff line change
@@ -352,20 +352,7 @@ subroutine fv_diag_init(Atm, axes, Time, npx, npy, npz, p_ref)
352352
#endif
353353
levs_ave = 0
354354
levs_ave(1:4) = (/50,400,850,1000/)
355-
#ifdef INTERNAL_FILE_NML
356355
read(input_nml_file, nml=fv_diag_plevs_nml,iostat=ios)
357-
#else
358-
inquire (file=trim(Atm(n)%nml_filename), exist=exists)
359-
if (.not. exists) then
360-
write(errmsg,*) 'fv_diag_plevs_nml: namelist file ',trim(Atm(n)%nml_filename),' does not exist'
361-
call mpp_error(FATAL, errmsg)
362-
else
363-
open (unit=nlunit, file=Atm(n)%nml_filename, READONLY, status='OLD', iostat=ios)
364-
endif
365-
rewind(nlunit)
366-
read (nlunit, nml=fv_diag_plevs_nml, iostat=ios)
367-
close (nlunit)
368-
#endif
369356
if (nplev > MAX_PLEVS) then
370357
if (is_master()) then
371358
print*, ' fv_diagnostics: nplev = ', nplev, ' is too large'

tools/test_cases.F90

+1-2
Original file line numberDiff line numberDiff line change
@@ -5566,9 +5566,8 @@ subroutine init_double_periodic(u,v,w,pt,delp,q,phis, ps,pe,peln,pk,pkz, uc,vc,
55665566

55675567
end subroutine init_double_periodic
55685568

5569-
subroutine read_namelist_test_case_nml(nml_filename)
5569+
subroutine read_namelist_test_case_nml()
55705570

5571-
character(*), intent(IN) :: nml_filename
55725571
integer :: ierr, f_unit, unit, ios
55735572
namelist /test_case_nml/test_case, bubble_do, alpha, nsolitons, soliton_Umax, soliton_size, &
55745573
no_wind, gaussian_dt, dt_amp, do_marine_sounding, checker_tr, small_earth_scale, Umean

0 commit comments

Comments
 (0)