Skip to content

Commit

Permalink
+Rescale depth in benchmark_initialize_topography
Browse files Browse the repository at this point in the history
  Added an optional unit_scale_type argument to benchmark_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 e543439 commit c40b482
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/user/benchmark_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@ module benchmark_initialization
contains

!> This subroutine sets up the benchmark test case topography.
subroutine benchmark_initialize_topography(D, G, param_file, max_depth)
type(dyn_horgrid_type), intent(in) :: G !< The dynamic horizontal grid type
subroutine benchmark_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
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 :: min_depth ! The minimum and maximum depths in m.
real :: min_depth ! The minimum and maximum depths in Z.
real :: PI ! 3.1415926... calculated as 4*atan(1)
real :: D0 ! A constant to make the maximum !
! basin depth MAXIMUM_DEPTH. !
real :: m_to_Z ! A dimensional rescaling factor.
real :: x, y
! This include declares and sets the variable "version".
# include "version_variable.h"
Expand All @@ -47,17 +50,19 @@ subroutine benchmark_initialize_topography(D, G, param_file, max_depth)

call MOM_mesg(" benchmark_initialization.F90, benchmark_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)

PI = 4.0*atan(1.0)
D0 = max_depth / 0.5

! Calculate the depth of the bottom.
do i=is,ie ; do j=js,je
x=(G%geoLonT(i,j)-G%west_lon)/G%len_lon
y=(G%geoLatT(i,j)-G%south_lat)/G%len_lat
do j=js,je ; do i=is,ie
x = (G%geoLonT(i,j)-G%west_lon) / G%len_lon
y = (G%geoLatT(i,j)-G%south_lat) / G%len_lat
! This sets topography that has a reentrant channel to the south.
D(i,j) = -D0 * ( y*(1.0 + 0.6*cos(4.0*PI*x)) &
+ 0.75*exp(-6.0*y) &
Expand Down

0 comments on commit c40b482

Please sign in to comment.