@@ -125,7 +125,7 @@ module MOM_file_parser
125125
126126contains
127127
128- ! > Make the contents of a parameter input file availalble in a param_file_type
128+ ! > Make the contents of a parameter input file available in a param_file_type
129129subroutine open_param_file (filename , CS , checkable , component , doc_file_dir , ensemble_num )
130130 character (len=* ), intent (in ) :: filename ! < An input file name, optionally with the full path
131131 type (param_file_type), intent (inout ) :: CS ! < The control structure for the file_parser module,
@@ -562,10 +562,10 @@ function removeComments(string)
562562 removeComments(:last)= adjustl (string (:last)) ! Copy only the non-comment part of string
563563end function removeComments
564564
565- ! > Constructs a string with all repeated whitespace replaced with single blanks
565+ ! > Constructs a string with all repeated white space replaced with single blanks
566566! ! and insert white space where it helps delineate tokens (e.g. around =)
567567function simplifyWhiteSpace (string )
568- character (len=* ), intent (in ) :: string ! < A string to modify to simpify white space
568+ character (len=* ), intent (in ) :: string ! < A string to modify to simplify white space
569569 character (len= len (string)+ 16 ) :: simplifyWhiteSpace
570570
571571 ! Local variables
@@ -583,7 +583,7 @@ function simplifyWhiteSpace(string)
583583 if (string (j:j)==quoteChar) insideString= .false. ! End of string
584584 else ! The following is outside of string delimiters
585585 if (string (j:j)==" " .or. string (j:j)==achar (9 )) then ! Space or tab
586- if (nonBlank) then ! Only copy a blank if the preceeding character was non-blank
586+ if (nonBlank) then ! Only copy a blank if the preceding character was non-blank
587587 i= i+1
588588 simplifyWhiteSpace(i:i)= " " ! Not string(j:j) so that tabs are replace by blanks
589589 nonBlank= .false.
@@ -989,7 +989,7 @@ function max_input_line_length(CS, pf_num) result(max_len)
989989end function max_input_line_length
990990
991991! > This subroutine extracts the contents of lines in the param_file_type that refer to
992- ! ! a named parameter. The value_string that is returned must be interepreted in a way
992+ ! ! a named parameter. The value_string that is returned must be interpreted in a way
993993! ! that depends on the type of this variable.
994994subroutine get_variable_line (CS , varname , found , defined , value_string , paramIsLogical )
995995 type (param_file_type), intent (in ) :: CS ! < The control structure for the file_parser module,
@@ -1391,7 +1391,7 @@ end subroutine log_param_int
13911391
13921392! > Log the name and values of an array of integer model parameter in documentation files.
13931393subroutine log_param_int_array (CS , modulename , varname , value , desc , &
1394- units , default , layoutParam , debuggingParam , like_default )
1394+ units , default , defaults , layoutParam , debuggingParam , like_default )
13951395 type (param_file_type), intent (in ) :: CS ! < The control structure for the file_parser module,
13961396 ! ! it is also a structure to parse for run-time parameters
13971397 character (len=* ), intent (in ) :: modulename ! < The name of the module using this parameter
@@ -1400,7 +1400,8 @@ subroutine log_param_int_array(CS, modulename, varname, value, desc, &
14001400 character (len=* ), optional , intent (in ) :: desc ! < A description of this variable; if not
14011401 ! ! present, this parameter is not written to a doc file
14021402 character (len=* ), optional , intent (in ) :: units ! < The units of this parameter
1403- integer , optional , intent (in ) :: default ! < The default value of the parameter
1403+ integer , optional , intent (in ) :: default ! < The uniform default value of this parameter
1404+ integer , optional , intent (in ) :: defaults(:) ! < The element-wise default values of this parameter
14041405 logical , optional , intent (in ) :: layoutParam ! < If present and true, this parameter is
14051406 ! ! logged in the layout parameter file
14061407 logical , optional , intent (in ) :: debuggingParam ! < If present and true, this parameter is
@@ -1419,7 +1420,7 @@ subroutine log_param_int_array(CS, modulename, varname, value, desc, &
14191420
14201421 myunits= " " ; if (present (units)) write (myunits(1 :240 ),' (A)' ) trim (units)
14211422 if (present (desc)) &
1422- call doc_param(CS% doc, varname, desc, myunits, value, default, &
1423+ call doc_param(CS% doc, varname, desc, myunits, value, default, defaults, &
14231424 layoutParam= layoutParam, debuggingParam= debuggingParam, like_default= like_default)
14241425
14251426end subroutine log_param_int_array
@@ -1745,7 +1746,7 @@ end subroutine get_param_int
17451746! > This subroutine reads the values of an array of integer model parameters from a parameter file
17461747! ! and logs them in documentation files.
17471748subroutine get_param_int_array (CS , modulename , varname , value , desc , units , &
1748- default , fail_if_missing , do_not_read , do_not_log , &
1749+ default , defaults , fail_if_missing , do_not_read , do_not_log , &
17491750 layoutParam , debuggingParam )
17501751 type (param_file_type), intent (in ) :: CS ! < The control structure for the file_parser module,
17511752 ! ! it is also a structure to parse for run-time parameters
@@ -1756,7 +1757,8 @@ subroutine get_param_int_array(CS, modulename, varname, value, desc, units, &
17561757 character (len=* ), optional , intent (in ) :: desc ! < A description of this variable; if not
17571758 ! ! present, this parameter is not written to a doc file
17581759 character (len=* ), optional , intent (in ) :: units ! < The units of this parameter
1759- integer , optional , intent (in ) :: default ! < The default value of the parameter
1760+ integer , optional , intent (in ) :: default ! < The uniform default value of this parameter
1761+ integer , optional , intent (in ) :: defaults(:) ! < The element-wise default values of this parameter
17601762 logical , optional , intent (in ) :: fail_if_missing ! < If present and true, a fatal error occurs
17611763 ! ! if this variable is not found in the parameter file
17621764 logical , optional , intent (in ) :: do_not_read ! < If present and true, do not read a
@@ -1773,14 +1775,22 @@ subroutine get_param_int_array(CS, modulename, varname, value, desc, units, &
17731775 do_read = .true. ; if (present (do_not_read)) do_read = .not. do_not_read
17741776 do_log = .true. ; if (present (do_not_log)) do_log = .not. do_not_log
17751777
1778+ if (present (defaults)) then
1779+ if (present (default)) call MOM_error(FATAL, &
1780+ " get_param_int_array: Only one of default and defaults can be specified at a time." )
1781+ if (size (defaults) /= size (value)) call MOM_error(FATAL, &
1782+ " get_param_int_array: The size of defaults and value are not the same." )
1783+ endif
1784+
17761785 if (do_read) then
17771786 if (present (default)) value(:) = default
1787+ if (present (defaults)) value(:) = defaults(:)
17781788 call read_param_int_array(CS, varname, value, fail_if_missing)
17791789 endif
17801790
17811791 if (do_log) then
1782- call log_param_int_array(CS, modulename, varname, value, desc, &
1783- units, default , layoutParam, debuggingParam)
1792+ call log_param_int_array(CS, modulename, varname, value, desc, units, &
1793+ default, defaults , layoutParam, debuggingParam)
17841794 endif
17851795
17861796end subroutine get_param_int_array
@@ -1871,7 +1881,7 @@ subroutine get_param_real_array(CS, modulename, varname, value, desc, units, &
18711881 if (present (default)) call MOM_error(FATAL, &
18721882 " get_param_real_array: Only one of default and defaults can be specified at a time." )
18731883 if (size (defaults) /= size (value)) call MOM_error(FATAL, &
1874- " get_param_real_array: The size of defaults nad value are not the same." )
1884+ " get_param_real_array: The size of defaults and value are not the same." )
18751885 endif
18761886
18771887 if (do_read) then
0 commit comments