@@ -1464,7 +1464,7 @@ end subroutine log_param_real
1464
1464
1465
1465
! > Log the name and values of an array of real model parameter in documentation files.
1466
1466
subroutine log_param_real_array (CS , modulename , varname , value , desc , &
1467
- units , default , debuggingParam , like_default , unscale )
1467
+ units , default , defaults , debuggingParam , like_default , unscale )
1468
1468
type (param_file_type), intent (in ) :: CS ! < The control structure for the file_parser module,
1469
1469
! ! it is also a structure to parse for run-time parameters
1470
1470
character (len=* ), intent (in ) :: modulename ! < The name of the calling module
@@ -1473,7 +1473,8 @@ subroutine log_param_real_array(CS, modulename, varname, value, desc, &
1473
1473
character (len=* ), optional , intent (in ) :: desc ! < A description of this variable; if not
1474
1474
! ! present, this parameter is not written to a doc file
1475
1475
character (len=* ), intent (in ) :: units ! < The units of this parameter
1476
- real , optional , intent (in ) :: default ! < The default value of the parameter
1476
+ real , optional , intent (in ) :: default ! < A uniform default value of the parameter
1477
+ real , optional , intent (in ) :: defaults(:) ! < The element-wise defaults of the parameter
1477
1478
logical , optional , intent (in ) :: debuggingParam ! < If present and true, this parameter is
1478
1479
! ! logged in the debugging parameter file
1479
1480
logical , optional , intent (in ) :: like_default ! < If present and true, log this parameter as
@@ -1498,7 +1499,7 @@ subroutine log_param_real_array(CS, modulename, varname, value, desc, &
1498
1499
1499
1500
write (myunits(1 :240 ),' (A)' ) trim (units)
1500
1501
if (present (desc)) &
1501
- call doc_param(CS% doc, varname, desc, myunits, log_val, default, &
1502
+ call doc_param(CS% doc, varname, desc, myunits, log_val, default, defaults, &
1502
1503
debuggingParam= debuggingParam, like_default= like_default)
1503
1504
1504
1505
end subroutine log_param_real_array
@@ -1835,7 +1836,7 @@ end subroutine get_param_real
1835
1836
! > This subroutine reads the values of an array of real model parameters from a parameter file
1836
1837
! ! and logs them in documentation files.
1837
1838
subroutine get_param_real_array (CS , modulename , varname , value , desc , units , &
1838
- default , fail_if_missing , do_not_read , do_not_log , debuggingParam , &
1839
+ default , defaults , fail_if_missing , do_not_read , do_not_log , debuggingParam , &
1839
1840
scale , unscaled )
1840
1841
type (param_file_type), intent (in ) :: CS ! < The control structure for the file_parser module,
1841
1842
! ! it is also a structure to parse for run-time parameters
@@ -1846,7 +1847,8 @@ subroutine get_param_real_array(CS, modulename, varname, value, desc, units, &
1846
1847
character (len=* ), optional , intent (in ) :: desc ! < A description of this variable; if not
1847
1848
! ! present, this parameter is not written to a doc file
1848
1849
character (len=* ), intent (in ) :: units ! < The units of this parameter
1849
- real , optional , intent (in ) :: default ! < The default value of the parameter
1850
+ real , optional , intent (in ) :: default ! < A uniform default value of the parameter
1851
+ real , optional , intent (in ) :: defaults(:) ! < The element-wise defaults of the parameter
1850
1852
logical , optional , intent (in ) :: fail_if_missing ! < If present and true, a fatal error occurs
1851
1853
! ! if this variable is not found in the parameter file
1852
1854
logical , optional , intent (in ) :: do_not_read ! < If present and true, do not read a
@@ -1865,14 +1867,22 @@ subroutine get_param_real_array(CS, modulename, varname, value, desc, units, &
1865
1867
do_read = .true. ; if (present (do_not_read)) do_read = .not. do_not_read
1866
1868
do_log = .true. ; if (present (do_not_log)) do_log = .not. do_not_log
1867
1869
1870
+ if (present (defaults)) then
1871
+ if (present (default)) call MOM_error(FATAL, &
1872
+ " get_param_real_array: Only one of default and defaults can be specified at a time." )
1873
+ if (size (defaults) /= size (value)) call MOM_error(FATAL, &
1874
+ " get_param_real_array: The size of defaults nad value are not the same." )
1875
+ endif
1876
+
1868
1877
if (do_read) then
1869
1878
if (present (default)) value(:) = default
1879
+ if (present (defaults)) value(:) = defaults(:)
1870
1880
call read_param_real_array(CS, varname, value, fail_if_missing)
1871
1881
endif
1872
1882
1873
1883
if (do_log) then
1874
1884
call log_param_real_array(CS, modulename, varname, value, desc, &
1875
- units, default, debuggingParam)
1885
+ units, default, defaults, debuggingParam)
1876
1886
endif
1877
1887
1878
1888
if (present (unscaled)) unscaled(:) = value(:)
0 commit comments