Skip to content

Commit

Permalink
+Rescale depth in DOME_initialize_topography
Browse files Browse the repository at this point in the history
  Added an optional unit_scale_type argument to DOME_initialize_topography, and
if it is present the unit conversion of the topography from m to Z occurs within
this initialization routine.   All answers are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Nov 16, 2018
1 parent f909e93 commit a1653f6
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/user/DOME_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,44 @@ module DOME_initialization

! -----------------------------------------------------------------------------
!> This subroutine sets up the DOME topography
subroutine DOME_initialize_topography(D, G, param_file, max_depth)
type(dyn_horgrid_type), intent(in) :: G !< The dynamic horizontal grid type
subroutine DOME_initialize_topography(D, G, param_file, max_depth, US)
type(dyn_horgrid_type), intent(in) :: G !< The dynamic horizontal grid type
real, dimension(G%isd:G%ied,G%jsd:G%jed), &
intent(out) :: D !< Ocean bottom depth in m
type(param_file_type), intent(in) :: param_file !< Parameter file structure
real, intent(in) :: max_depth !< Maximum depth of model in m

real :: min_depth ! The minimum and maximum depths in m.
! This include declares and sets the variable "version".
#include "version_variable.h"
intent(out) :: D !< Ocean bottom depth in m or Z if US is present
type(param_file_type), intent(in) :: param_file !< Parameter file structure
real, intent(in) :: max_depth !< Maximum model depth in the units of D
type(unit_scale_type), optional, intent(in) :: US !< A dimensional unit scaling type

! Local variables
real :: m_to_Z ! A dimensional rescaling factor.
real :: min_depth ! The minimum and maximum depths in Z.
! This include declares and sets the variable "version".
# include "version_variable.h"
character(len=40) :: mdl = "DOME_initialize_topography" ! This subroutine's name.
integer :: i, j, is, ie, js, je, isd, ied, jsd, jed
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed

call MOM_mesg(" DOME_initialization.F90, DOME_initialize_topography: setting topography", 5)

m_to_Z = 1.0 ; if (present(US)) m_to_Z = US%m_to_Z

call log_version(param_file, mdl, version, "")
call get_param(param_file, mdl, "MINIMUM_DEPTH", min_depth, &
"The minimum depth of the ocean.", units="m", default=0.0)
"The minimum depth of the ocean.", units="m", default=0.0, scale=m_to_Z)

do j=js,je ; do i=is,ie
if (G%geoLatT(i,j) < 600.0) then
if (G%geoLatT(i,j) < 300.0) then
D(i,j)=max_depth
D(i,j) = max_depth
else
D(i,j)=max_depth-10.0*(G%geoLatT(i,j)-300.0)
D(i,j) = max_depth - 10.0*m_to_Z * (G%geoLatT(i,j)-300.0)
endif
else
if ((G%geoLonT(i,j) > 1000.0).AND.(G%geoLonT(i,j) < 1100.0)) then
D(i,j)=600.0
if ((G%geoLonT(i,j) > 1000.0) .AND. (G%geoLonT(i,j) < 1100.0)) then
D(i,j) = 600.0*m_to_Z
else
D(i,j)=0.5*min_depth
D(i,j) = 0.5*min_depth
endif
endif

Expand Down

0 comments on commit a1653f6

Please sign in to comment.