Skip to content

Commit

Permalink
Add more flush statements to assess ongoing progress in case of an ea…
Browse files Browse the repository at this point in the history
…rly abort, add success message on landuse.timeseries (Fixing ESCOMP#2131), read in namelist before MPI and ESMF initialize so can set default name for PET files, and split out namelist broadcast to a seperate call
  • Loading branch information
ekluzek committed Oct 8, 2023
1 parent 5cc6b23 commit 92cc9b6
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 12 deletions.
30 changes: 26 additions & 4 deletions tools/mksurfdata_esmf/src/mkinputMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ module mkinputMod
! routines
! ---------------------

public :: read_namelist_input
public :: check_namelist_input
public :: write_namelist_input
public :: read_namelist_input ! Read the input control namelist
public :: bcast_namelist_input ! Broadcast the namelist to all processors
public :: check_namelist_input ! Check the input control namelist for errors
public :: write_namelist_input ! Write information on the control namelist

! ---------------------
! variables
Expand All @@ -34,6 +35,8 @@ module mkinputMod
character(CL) , public :: furbname ! generic transient urban land cover filename
character(CL) , public :: flakname ! generic lake filename

character(CS) , public :: mksrf_grid_name = ' ' ! Name of this grid

character(CX) , public :: mksrf_fgrid_mesh = ' ' ! land grid file name to use
integer , public :: mksrf_fgrid_mesh_nx = -999
integer , public :: mksrf_fgrid_mesh_ny = -999
Expand Down Expand Up @@ -126,11 +129,13 @@ subroutine read_namelist_input()
integer :: ier
integer :: k
integer :: fileunit
integer :: grid_size ! Number of columne in the grid
logical :: lexist
character(len=*), parameter :: subname = 'read_namelist_input'
! ------------------------------------------------------------

namelist /mksurfdata_input/ &
mksrf_grid_name, &
mksrf_fvegtyp, &
mksrf_fvegtyp_mesh, &
mksrf_fhrvtyp, &
Expand Down Expand Up @@ -213,6 +218,21 @@ subroutine read_namelist_input()
call shr_sys_abort(subname//' error reading in mksurfdata_input namelist from standard input')
end if
end if
if ( mksrf_grid_name == ' ' )then
grid_size = mksrf_fgrid_mesh_nx * mksrf_fgrid_mesh_ny
write(mksrf_grid_name,'("Grid",I07)') grid_size
end if

end subroutine read_namelist_input

!===============================================================

subroutine bcast_namelist_input()

! Braodcast the namelist to all processors

! local variables
integer :: ier

call mpi_bcast (mksrf_fgrid_mesh, len(mksrf_fgrid_mesh), MPI_CHARACTER, 0, mpicom, ier)
call mpi_bcast (mksrf_fgrid_mesh_nx, 1, MPI_INTEGER, 0, mpicom, ier)
Expand Down Expand Up @@ -301,7 +321,7 @@ subroutine read_namelist_input()
call mpi_bcast (logname, len(logname), MPI_CHARACTER, 0, mpicom, ier)
call mpi_bcast (hostname, len(hostname), MPI_CHARACTER, 0, mpicom, ier)

end subroutine read_namelist_input
end subroutine bcast_namelist_input

!===============================================================
subroutine check_namelist_input()
Expand Down Expand Up @@ -338,6 +358,7 @@ subroutine write_namelist_input()
! ------------------------------------------------------------

if (root_task) then
write(ndiag,'(a)')'Grid_name: '//trim(mksrf_grid_name)
write(ndiag,'(a)')'Input rawdata files and corresponding meshes'
write(ndiag,'(a)')' PFTs from: '//trim(mksrf_fvegtyp)
write(ndiag,'(a)')' mesh for pft '//trim(mksrf_fvegtyp_mesh)
Expand Down Expand Up @@ -434,6 +455,7 @@ subroutine write_namelist_input()
write(ndiag, '(a)') " WARNING: aborting on invalid data check in urban has been disabled!"
write(ndiag, '(a)') " WARNING: urban data may be invalid!"
end if
flush(ndiag)
end if

end subroutine write_namelist_input
Expand Down
Loading

0 comments on commit 92cc9b6

Please sign in to comment.