Skip to content

Commit

Permalink
+Rescaled G%bathyT
Browse files Browse the repository at this point in the history
  Rescaled G%bathyT for dimenisonal consistency testing.  Answers in the Baltic
test case are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Oct 11, 2019
1 parent 887f0fa commit 62724c7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
32 changes: 18 additions & 14 deletions src/SIS_fixed_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ subroutine SIS_initialize_fixed(G, US, PF, write_geom, output_dir)
call set_grid_metrics(G, PF, US)

! Set up the bottom depth, G%bathyT, either analytically or from a file
call SIS_initialize_topography(G%bathyT, G%max_depth, G, PF)
call SIS_initialize_topography(G%bathyT, G%max_depth, G, PF, US)

! To initialize masks, the bathymetry in halo regions must be filled in
call pass_var(G%bathyT, G%Domain)

! Initialize the various masks and any masked metrics.
call initialize_masks(G, PF)
call initialize_masks(G, PF, US)

if (debug) then
call hchksum(G%bathyT, 'SIS_initialize_fixed: depth ', G%HI, &
haloshift=min(1, G%ied-G%iec, G%jed-G%jec))
haloshift=min(1, G%ied-G%iec, G%jed-G%jec), scale=US%Z_to_m)
call hchksum(G%mask2dT, 'SIS_initialize_fixed: mask2dT ', G%HI)
call uvchksum('SIS_initialize_fixed: mask2dC[uv] ', &
G%mask2dCu, G%mask2dCv, G)
Expand Down Expand Up @@ -120,27 +120,29 @@ subroutine SIS_initialize_fixed(G, US, PF, write_geom, output_dir)

! Write out all of the grid data used by this run.
if (write_geom) call write_ocean_geometry_file(G, PF, output_dir, &
geom_file="sea_ice_geometry")
geom_file="sea_ice_geometry", US=US)

call callTree_leave('SIS_initialize_fixed()')

end subroutine SIS_initialize_fixed

!> SIS_initialize_topography makes the appropriate call to set up the bathymetry.
!! It is very similar to MOM_initialize_topography, but with fewer options.
subroutine SIS_initialize_topography(D, max_depth, G, PF)
subroutine SIS_initialize_topography(D, max_depth, G, PF, 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) :: PF !< Parameter file structure
real, intent(out) :: max_depth !< Maximum depth of model in m
real, intent(out) :: max_depth !< Maximum depth of model [m or Z ~> m]
type(unit_scale_type), optional, intent(in) :: US !< A dimensional unit scaling type

! This subroutine makes the appropriate call to set up the bottom depth.
! This is a separate subroutine so that it can be made public and shared with
! the ice-sheet code or other components.
! Set up the bottom depth, G%bathyT either analytically or from file
character(len=40) :: mdl = "SIS_initialize_topography" ! This subroutine's name.
character(len=200) :: config
real :: Z_to_m

call get_param(PF, mdl, "TOPO_CONFIG", config, &
"This specifies how bathymetry is specified: \n"//&
Expand All @@ -166,24 +168,26 @@ subroutine SIS_initialize_topography(D, max_depth, G, PF)
! fail_if_missing=.true.)
max_depth = -1.e9; call read_param(PF, "MAXIMUM_DEPTH", max_depth)
select case ( trim(config) )
case ("file"); call initialize_topography_from_file(D, G, PF)
case ("flat"); call initialize_topography_named(D, G, PF, config, max_depth)
case ("spoon"); call initialize_topography_named(D, G, PF, config, max_depth)
case ("bowl"); call initialize_topography_named(D, G, PF, config, max_depth)
case ("halfpipe"); call initialize_topography_named(D, G, PF, config, max_depth)
case ("file"); call initialize_topography_from_file(D, G, PF, US)
case ("flat"); call initialize_topography_named(D, G, PF, config, max_depth, US)
case ("spoon"); call initialize_topography_named(D, G, PF, config, max_depth, US)
case ("bowl"); call initialize_topography_named(D, G, PF, config, max_depth, US)
case ("halfpipe"); call initialize_topography_named(D, G, PF, config, max_depth, US)
case default ; call MOM_error(FATAL,"SIS_initialize_topography: "// &
"Unrecognized topography setup '"//trim(config)//"'")
end select

Z_to_m = 1.0 ; if (present(US)) Z_to_m = US%Z_to_m
if (max_depth>0.) then
call log_param(PF, mdl, "MAXIMUM_DEPTH", max_depth, &
call log_param(PF, mdl, "MAXIMUM_DEPTH", max_depth*Z_to_m, &
"The maximum depth of the ocean.", units="m")
else
max_depth = diagnoseMaximumDepth(D,G)
call log_param(PF, mdl, "!MAXIMUM_DEPTH", max_depth, &
call log_param(PF, mdl, "!MAXIMUM_DEPTH", max_depth*Z_to_m, &
"The (diagnosed) maximum depth of the ocean.", units="m")
endif
if (trim(config) .ne. "DOME") then
call limit_topography(D, G, PF, max_depth)
call limit_topography(D, G, PF, max_depth, US)
endif

end subroutine SIS_initialize_topography
Expand Down
2 changes: 1 addition & 1 deletion src/SIS_hor_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ module SIS_hor_grid
! Except on a Cartesian grid, these are usually some variant of "degrees".

real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: &
bathyT !< Ocean bottom depth at tracer points [m].
bathyT !< Ocean bottom depth at tracer points [Z ~> m].
real ALLOCABLE_, dimension(NIMEMB_PTR_,NJMEMB_PTR_) :: &
CoriolisBu !< The Coriolis parameter at corner points [T-1 ~> s-1].
real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: &
Expand Down
2 changes: 1 addition & 1 deletion src/SIS_utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ subroutine ice_grid_chksum(G, US, haloshift)
call uvchksum("G%areaC[uv]", G%areaCu, G%areaCv, G, halos=hs, scale=US%L_to_m**2)
call uvchksum("G%IareaC[uv]", G%IareaCu, G%IareaCv, G, halos=hs, scale=US%m_to_L**2)

call hchksum(G%bathyT, "G%bathyT", G%HI, haloshift=hs)
call hchksum(G%bathyT, "G%bathyT", G%HI, haloshift=hs, scale=US%Z_to_m)
call Bchksum(G%CoriolisBu, "G%CoriolisBu", G%HI, haloshift=hs, scale=US%s_to_T)
call hchksum_pair("G%dF_d[xy]", G%dF_dx, G%dF_dy, G, halos=hs, scale=US%s_to_T*US%m_to_L)

Expand Down

0 comments on commit 62724c7

Please sign in to comment.