From fac1464e831ebe2b6165e27dc2fc014023fee1bd Mon Sep 17 00:00:00 2001 From: Robert Hallberg Date: Thu, 15 Nov 2018 10:23:13 -0500 Subject: [PATCH] +Eliminated Zd_to_m from grid types Eliminated Zd_to_m from dyn_horgrid_type and ocean_grid_type. Instead, any dimensional rescaling uses elements of unit_scale_types. All answers are bitwise identical. --- src/core/MOM_grid.F90 | 8 +++----- src/core/MOM_transcribe_grid.F90 | 2 -- src/framework/MOM_dyn_horgrid.F90 | 16 +++++++--------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/core/MOM_grid.F90 b/src/core/MOM_grid.F90 index c0ca264d68..e226598b7f 100644 --- a/src/core/MOM_grid.F90 +++ b/src/core/MOM_grid.F90 @@ -132,7 +132,6 @@ module MOM_grid real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: & bathyT !< Ocean bottom depth at tracer points, in depth units. - real :: Zd_to_m = 1.0 !< The conversion factor between the units of bathyT and m. logical :: bathymetry_at_vel !< If true, there are separate values for the !! basin depths at velocity points. Otherwise the effects of @@ -165,7 +164,7 @@ module MOM_grid real :: len_lat = 0. !< The latitudinal (or y-coord) extent of physical domain real :: len_lon = 0. !< The longitudinal (or x-coord) extent of physical domain real :: Rad_Earth = 6.378e6 !< The radius of the planet in meters. - real :: max_depth !< The maximum depth of the ocean in depth units (scaled by Zd_to_m). + real :: max_depth !< The maximum depth of the ocean in depth units (Z). end type ocean_grid_type contains @@ -359,13 +358,13 @@ subroutine rescale_grid_bathymetry(G, m_in_new_units) isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed IsdB = G%IsdB ; IedB = G%IedB ; JsdB = G%JsdB ; JedB = G%JedB - if (m_in_new_units == G%Zd_to_m) return + if (m_in_new_units == 1.0) return if (m_in_new_units < 0.0) & call MOM_error(FATAL, "rescale_grid_bathymetry: Negative depth units are not permitted.") if (m_in_new_units == 0.0) & call MOM_error(FATAL, "rescale_grid_bathymetry: Zero depth units are not permitted.") - rescale = G%Zd_to_m / m_in_new_units + rescale = 1.0 / m_in_new_units do j=jsd,jed ; do i=isd,ied G%bathyT(i,j) = rescale*G%bathyT(i,j) enddo ; enddo @@ -376,7 +375,6 @@ subroutine rescale_grid_bathymetry(G, m_in_new_units) G%Dblock_v(i,J) = rescale*G%Dblock_v(i,J) ; G%Dopen_v(i,J) = rescale*G%Dopen_v(i,J) enddo ; enddo ; endif G%max_depth = rescale*G%max_depth - G%Zd_to_m = m_in_new_units end subroutine rescale_grid_bathymetry diff --git a/src/core/MOM_transcribe_grid.F90 b/src/core/MOM_transcribe_grid.F90 index 8c3786d51a..62ac6e1ea4 100644 --- a/src/core/MOM_transcribe_grid.F90 +++ b/src/core/MOM_transcribe_grid.F90 @@ -44,7 +44,6 @@ subroutine copy_dyngrid_to_MOM_grid(dG, oG) if ((isd > oG%isc) .or. (ied < oG%ied) .or. (jsd > oG%jsc) .or. (jed > oG%jed)) & call MOM_error(FATAL, "copy_dyngrid_to_MOM_grid called with incompatible grids.") - oG%Zd_to_m = dG%Zd_to_m do i=isd,ied ; do j=jsd,jed oG%geoLonT(i,j) = dG%geoLonT(i+ido,j+jdo) oG%geoLatT(i,j) = dG%geoLatT(i+ido,j+jdo) @@ -188,7 +187,6 @@ subroutine copy_MOM_grid_to_dyngrid(oG, dG) if ((isd > dG%isc) .or. (ied < dG%ied) .or. (jsd > dG%jsc) .or. (jed > dG%jed)) & call MOM_error(FATAL, "copy_dyngrid_to_MOM_grid called with incompatible grids.") - dG%Zd_to_m = oG%Zd_to_m do i=isd,ied ; do j=jsd,jed dG%geoLonT(i,j) = oG%geoLonT(i+ido,j+jdo) dG%geoLatT(i,j) = oG%geoLatT(i+ido,j+jdo) diff --git a/src/framework/MOM_dyn_horgrid.F90 b/src/framework/MOM_dyn_horgrid.F90 index 37500d31c2..51c45bc1b9 100644 --- a/src/framework/MOM_dyn_horgrid.F90 +++ b/src/framework/MOM_dyn_horgrid.F90 @@ -132,17 +132,16 @@ module MOM_dyn_horgrid real, allocatable, dimension(:,:) :: & bathyT !< Ocean bottom depth at tracer points, in depth units. - real :: Zd_to_m = 1.0 !< The conversion factor between the units of bathyT and m. logical :: bathymetry_at_vel !< If true, there are separate values for the !! basin depths at velocity points. Otherwise the effects of !! of topography are entirely determined from thickness points. real, allocatable, dimension(:,:) :: & - Dblock_u, & !< Topographic depths at u-points at which the flow is blocked, in depth units. - Dopen_u !< Topographic depths at u-points at which the flow is open at width dy_Cu, in depth units. + Dblock_u, & !< Topographic depths at u-points at which the flow is blocked, in Z. + Dopen_u !< Topographic depths at u-points at which the flow is open at width dy_Cu, in Z. real, allocatable, dimension(:,:) :: & - Dblock_v, & !< Topographic depths at v-points at which the flow is blocked, in depth units. - Dopen_v !< Topographic depths at v-points at which the flow is open at width dx_Cv, in depth units. + Dblock_v, & !< Topographic depths at v-points at which the flow is blocked, in Z. + Dopen_v !< Topographic depths at v-points at which the flow is open at width dx_Cv, in Z. real, allocatable, dimension(:,:) :: & CoriolisBu !< The Coriolis parameter at corner points, in s-1. real, allocatable, dimension(:,:) :: & @@ -160,7 +159,7 @@ module MOM_dyn_horgrid real :: len_lat = 0. !< The latitudinal (or y-coord) extent of physical domain real :: len_lon = 0. !< The longitudinal (or x-coord) extent of physical domain real :: Rad_Earth = 6.378e6 !< The radius of the planet in meters. - real :: max_depth !< The maximum depth of the ocean in depth units (scaled by Zd_to_m). + real :: max_depth !< The maximum depth of the ocean in Z. end type dyn_horgrid_type contains @@ -287,13 +286,13 @@ subroutine rescale_dyn_horgrid_bathymetry(G, m_in_new_units) isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed IsdB = G%IsdB ; IedB = G%IedB ; JsdB = G%JsdB ; JedB = G%JedB - if (m_in_new_units == G%Zd_to_m) return + if (m_in_new_units == 1.0) return if (m_in_new_units < 0.0) & call MOM_error(FATAL, "rescale_grid_bathymetry: Negative depth units are not permitted.") if (m_in_new_units == 0.0) & call MOM_error(FATAL, "rescale_grid_bathymetry: Zero depth units are not permitted.") - rescale = G%Zd_to_m / m_in_new_units + rescale = 1.0 / m_in_new_units do j=jsd,jed ; do i=isd,ied G%bathyT(i,j) = rescale*G%bathyT(i,j) enddo ; enddo @@ -304,7 +303,6 @@ subroutine rescale_dyn_horgrid_bathymetry(G, m_in_new_units) G%Dblock_v(i,J) = rescale*G%Dblock_v(i,J) ; G%Dopen_v(i,J) = rescale*G%Dopen_v(i,J) enddo ; enddo ; endif G%max_depth = rescale*G%max_depth - G%Zd_to_m = m_in_new_units end subroutine rescale_dyn_horgrid_bathymetry