Skip to content

Commit

Permalink
mksurfdata now reads pio_iotype from txt file instead of hardwiring
Browse files Browse the repository at this point in the history
  • Loading branch information
slevis-lmwg committed Jun 10, 2022
1 parent 775ac96 commit 7bf0bcc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tools/mksurfdata_esmf/gen_mksurfdata_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mkdir bld
cd bld

# Write pio_iotype to file with name pio_iotype.txt
echo $pio_iotype > pio_iotype.txt
echo $pio_iotype > $cwd/pio_iotype.txt

# Run the cime configure tool to figure out what modules need to be loaded
echo "Run cime configure for machine $MACH..."
Expand Down
18 changes: 16 additions & 2 deletions tools/mksurfdata_esmf/src/mksurfdata.F90
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ program mksurfdata
integer :: ier,rcode ! error status

! dynamic land use
integer :: nfdyn ! unit numbers
integer :: nfdyn, nfpio ! unit numbers
integer :: ntim ! time sample for dynamic land use
integer :: year ! year for dynamic land use
integer :: year2 ! year for dynamic land use for harvest file
Expand Down Expand Up @@ -230,7 +230,21 @@ program mksurfdata
! the following returns pio_iosystem
call pio_init(iam, mpicom, max(1,petcount/stride), 0, stride, PIO_REARR_SUBSET, pio_iosystem)

pio_iotype = PIO_IOTYPE_PNETCDF
! Open txt file
if (root_task) then
write(ndiag,*)' Opening file and reading pio_iotype from txt file with the same name'
open (newunit=nfpio, file='pio_iotype.txt', status='old', &
form='formatted', action='read', iostat=ier)
if (ier /= 0) then
call shr_sys_abort(subname//" failed to open file pio_iotype.txt")
end if
read(nfpio, '(i)', iostat=ier) pio_iotype
if (ier /= 0) then
call shr_sys_abort(subname//" failed to read file pio_iotype.txt")
end if
end if
call mpi_bcast(pio_iotype, 1, MPI_INTEGER, 0, mpicom, ier)

pio_ioformat = PIO_64BIT_DATA

call ESMF_LogWrite("finished initializing PIO", ESMF_LOGMSG_INFO)
Expand Down

0 comments on commit 7bf0bcc

Please sign in to comment.