Skip to content

Commit

Permalink
updated input_nml_file to use get_ascii_file_num_lines_and_length
Browse files Browse the repository at this point in the history
  • Loading branch information
GFDL-Eric committed Mar 22, 2021
1 parent 50c2dd9 commit 72f06af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions mpp/include/mpp_util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,8 @@ end function rarray_to_char
character(len=*), intent(in), optional :: pelist_name_in
! private variables
integer :: log_unit
integer :: num_lines, i
integer :: i
integer, dimension(2) :: lines_and_length
logical :: file_exist
character(len=len(peset(current_peset_num)%name)) :: pelist_name
character(len=128) :: filename
Expand All @@ -1328,17 +1329,17 @@ end function rarray_to_char
if (.not. file_exist ) then
filename='input.nml'
endif
num_lines = get_ascii_file_num_lines(filename, INPUT_STR_LENGTH)
allocate(input_nml_file(num_lines))
call read_ascii_file(filename, INPUT_STR_LENGTH, input_nml_file)
lines_and_length = get_ascii_file_num_lines_and_length(filename)
allocate(character(len=lines_and_length(2))::input_nml_file(lines_and_length(1)))
call read_ascii_file(filename, lines_and_length(2), input_nml_file)

! write info logfile
if (pe == root_pe) then
log_unit = stdlog()
write(log_unit,'(a)') '========================================================================'
write(log_unit,'(a)') 'READ_INPUT_NML: '//trim(version)
write(log_unit,'(a)') 'READ_INPUT_NML: '//trim(filename)//' '
do i = 1, num_lines
do i = 1, lines_and_length(1)
write(log_unit,*) trim(input_nml_file(i))
enddo
end if
Expand Down
2 changes: 1 addition & 1 deletion mpp/mpp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ module mpp_mod
! parameter defining length of character variables
integer, parameter :: INPUT_STR_LENGTH = 256
! public variable needed for reading input.nml from an internal file
character(len=INPUT_STR_LENGTH), dimension(:), allocatable, target, public :: input_nml_file
character(len=:), dimension(:), allocatable, target, public :: input_nml_file
logical :: read_ascii_file_on = .FALSE.
!***********************************************************************

Expand Down

0 comments on commit 72f06af

Please sign in to comment.