diff --git a/config_src/infra/FMS1/MOM_io_infra.F90 b/config_src/infra/FMS1/MOM_io_infra.F90 index e62216d0b0..e37e5db3cb 100644 --- a/config_src/infra/FMS1/MOM_io_infra.F90 +++ b/config_src/infra/FMS1/MOM_io_infra.F90 @@ -739,7 +739,7 @@ end subroutine read_field_3d_region !! 4-D data field named "fieldname" from file "filename". Valid values for !! "position" include CORNER, CENTER, EAST_FACE and NORTH_FACE. subroutine read_field_4d(filename, fieldname, data, MOM_Domain, & - timelevel, position, scale, global_file, file_may_be_4d) + timelevel, position, scale, global_file) character(len=*), intent(in) :: filename !< The name of the file to read character(len=*), intent(in) :: fieldname !< The variable name of the data in the file real, dimension(:,:,:,:), intent(inout) :: data !< The 4-dimensional array into which the data @@ -750,14 +750,11 @@ subroutine read_field_4d(filename, fieldname, data, MOM_Domain, & real, optional, intent(in) :: scale !< A scaling factor that the field is multiplied !! by before it is returned. logical, optional, intent(in) :: global_file !< If true, read from a single global file - logical, optional, intent(in) :: file_may_be_4d !< If true, this file may have 4-d arrays, - !! in which case a more elaborate set of calls - !! is needed to read it due to FMS limitations. ! Local variables character(len=80) :: varname ! The name of a variable in the file type(fieldtype), allocatable :: fields(:) ! An array of types describing all the variables in the file - logical :: use_fms_read_data, file_is_global + logical :: file_is_global integer :: n, unit, ndim, nvar, natt, ntime ! This single call does not work for a 4-d array due to FMS limitations, so multiple calls are @@ -765,40 +762,32 @@ subroutine read_field_4d(filename, fieldname, data, MOM_Domain, & ! call read_data(filename, fieldname, data, MOM_Domain%mpp_domain, & ! timelevel=timelevel, position=position) - use_fms_read_data = .true. ; if (present(file_may_be_4d)) use_fms_read_data = .not.file_may_be_4d file_is_global = .true. ; if (present(global_file)) file_is_global = global_file - use_fms_read_data = .false. ! 4d arrays not working with FMS1 - - if (use_fms_read_data) then - call read_data(filename, fieldname, data, MOM_Domain%mpp_domain, & - timelevel=timelevel, position=position) + if (file_is_global) then + call mpp_open(unit, trim(filename), form=NETCDF_FILE, action=READONLY_FILE, & + threading=MULTIPLE, fileset=SINGLE_FILE) !, domain=MOM_Domain%mpp_domain ) else - if (file_is_global) then - call mpp_open(unit, trim(filename), form=NETCDF_FILE, action=READONLY_FILE, & - threading=MULTIPLE, fileset=SINGLE_FILE) !, domain=MOM_Domain%mpp_domain ) - else - call mpp_open(unit, trim(filename), form=NETCDF_FILE, action=READONLY_FILE, & - threading=MULTIPLE, fileset=MULTIPLE, domain=MOM_Domain%mpp_domain ) + call mpp_open(unit, trim(filename), form=NETCDF_FILE, action=READONLY_FILE, & + threading=MULTIPLE, fileset=MULTIPLE, domain=MOM_Domain%mpp_domain ) + endif + call mpp_get_info(unit, ndim, nvar, natt, ntime) + allocate(fields(nvar)) + call mpp_get_fields(unit, fields(1:nvar)) + do n=1, nvar + call mpp_get_atts(fields(n), name=varname) + if (lowercase(trim(varname)) == lowercase(trim(fieldname))) then + call MOM_error(NOTE, "Reading 4-d variable "//trim(fieldname)//" from file "//trim(filename)) + ! Maybe something should be done depending on the value of ntime. + call mpp_read(unit, fields(n), MOM_Domain%mpp_domain, data, timelevel) + exit endif - call mpp_get_info(unit, ndim, nvar, natt, ntime) - allocate(fields(nvar)) - call mpp_get_fields(unit, fields(1:nvar)) - do n=1, nvar - call mpp_get_atts(fields(n), name=varname) - if (lowercase(trim(varname)) == lowercase(trim(fieldname))) then - call MOM_error(NOTE, "Reading 4-d variable "//trim(fieldname)//" from file "//trim(filename)) - ! Maybe something should be done depending on the value of ntime. - call mpp_read(unit, fields(n), MOM_Domain%mpp_domain, data, timelevel) - exit - endif - enddo - if ((n == nvar+1) .or. (nvar < 1)) call MOM_error(WARNING, & - "read_field apparently did not find 4-d variable "//trim(fieldname)//" in file "//trim(filename)) + enddo + if ((n == nvar+1) .or. (nvar < 1)) call MOM_error(WARNING, & + "read_field apparently did not find 4-d variable "//trim(fieldname)//" in file "//trim(filename)) - deallocate(fields) - call mpp_close(unit) - endif + deallocate(fields) + call mpp_close(unit) if (present(scale)) then ; if (scale /= 1.0) then call rescale_comp_data(MOM_Domain, data, scale) diff --git a/src/parameterizations/vertical/MOM_diabatic_driver.F90 b/src/parameterizations/vertical/MOM_diabatic_driver.F90 index 8053c16265..1ccd6a7fb2 100644 --- a/src/parameterizations/vertical/MOM_diabatic_driver.F90 +++ b/src/parameterizations/vertical/MOM_diabatic_driver.F90 @@ -3575,6 +3575,8 @@ subroutine register_diabatic_restarts(G, US, param_file, int_tide_CSp, restart_C logical :: use_int_tides + use_int_tides=.false. + call read_param(param_file, "INTERNAL_TIDES", use_int_tides) if (use_int_tides) then