Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFCLAY=1, add shallow water roughness calculation #1543

Merged
merged 30 commits into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a31407e
Adding necessary variables to the registry
hawbecker Aug 9, 2021
83837a9
Passing variables through to sfclayrev
hawbecker Aug 10, 2021
ce1f541
Get water depth data
hawbecker Aug 10, 2021
40dd9b2
Add function for shallow water roughness.
hawbecker Aug 10, 2021
7813ca5
Bug fix: water_depth not being assigned.
hawbecker Aug 12, 2021
37f6396
Changing default shalwater_depth to -1
hawbecker Aug 16, 2021
4bbe43a
Rearrange shalwater_depth assignment to inside WRF
hawbecker Aug 16, 2021
9885070
Clean up comments and print statements.
hawbecker Aug 16, 2021
0446669
Clean up additional comments
hawbecker Aug 16, 2021
5f9c088
Restructure code + add lake depth + clean
hawbecker Aug 18, 2021
8e93d12
Making fatal error more helpful
hawbecker Aug 18, 2021
b57d8df
Adding description in README.namelist
hawbecker Aug 18, 2021
fe803cb
Deleting additional initial identifiers.
hawbecker Aug 19, 2021
ce6dc90
Adding examples for shallow water roughness
hawbecker Sep 14, 2021
40eaa79
Adding units and fixing Registry fields
hawbecker Sep 24, 2021
08ad7da
bathy 23:25
davegill Dec 9, 2021
8fdfcf7
bathy2 08:32
davegill Dec 9, 2021
df63d7f
bathy3 09:30
davegill Dec 9, 2021
3e71bbb
bathy4 11:34
davegill Dec 9, 2021
8220723
bathy5 12:24
davegill Dec 9, 2021
02b4865
bathy6 13:03
davegill Dec 9, 2021
eb3dc40
bathy7 13:38
davegill Dec 9, 2021
1ea0306
Updating README.namelist for shalwater_depth
hawbecker Dec 20, 2021
0f1ff0c
Merge branch 'feature/shallow_water_roughness' of https://github.com/…
hawbecker Dec 20, 2021
17fbd2d
Add consistency check: requires use of revised MO sfclay
davegill Dec 20, 2021
592ab0e
Removing "optional" declarations.
hawbecker Dec 23, 2021
433f983
Merge branch 'feature/shallow_water_roughness' of https://github.com/…
hawbecker Dec 23, 2021
37c24a4
Removing message about GEBCO dataset
hawbecker Dec 23, 2021
1c4fb70
Adding bathymetry_flag to restarts and history
hawbecker Jan 6, 2022
83c9dc7
Updating shalwater_rough to shalwater_z0
hawbecker Jan 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Registry/Registry.EM_COMMON
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ state real utrop ij dyn_em 1 X i1 "UTROP"
state real vmaxw ij dyn_em 1 Y i1 "VMAXW" "V-component of the max wind speed" "m s-1"
state real vtrop ij dyn_em 1 Y i1 "VTROP" "V-component of the tropopause wind" "m s-1"
state real erod ij. misc 1 - i012rd "EROD" "fraction of erodible surface in each grid cell (0-1)" "none"
# PSH - begin
davegill marked this conversation as resolved.
Show resolved Hide resolved
state real bathymetry ij dyn_em 1 - i1 "bathymetry" "Bathymetry and topography" "m"
state integer BATHYMETRY_FLAG - misc 1 - i0 "BATHYMETRY_FLAG" "Flag for bathymetry in the global attributes for metgrid data"
# PSH - end end

#-----------------------------------------------------------------------------------------------------------------------------------------------------------------
#
Expand Down Expand Up @@ -880,6 +884,11 @@ state real XLAIDYN ij misc 1 - - "X
# SKIN SST
state real SSTSK ij misc 1 - rhd=(interp_mask_field:lu_index,iswater)u=(copy_fcnm) "SSTSK" "SKIN SEA SURFACE TEMPERATURE" "K"
state real lake_depth ij misc 1 - i012rd=(interp_mask_water_field:lu_index,islake) "lake_depth" "lake depth" "m"
# PSH - begin
state real water_depth ij misc 1 - i0rhd "water_depth" "global water depth" "m"
rconfig integer shalwater_rough namelist,physics max_domains 0 rh "shallow water roughness flag" "" ""
rconfig real shalwater_depth namelist,physics 1 -1.0 rh "water depth for shallow water scheme" "" ""
# PSH - end
state real DTW ij misc 1 - r "DTW" "WARM LAYER TEMP DIFF" "C"
# Ocean surface currents
state real UOCE ij misc 1 - i0124rd=(interp_mask_water_field:lu_index,iswater) "UOCE" "SEA SURFACE ZONAL CURRENTS" "m s-1"
Expand Down
2 changes: 2 additions & 0 deletions dyn_em/module_first_rk_step_part1.F
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,8 @@ SUBROUTINE first_rk_step_part1 ( grid , config_flags &
& ,HUML=grid%huml, HVML=grid%hvml, F=grid%f &
& ,TMOML=grid%TMOML,ISWATER=iswater &
& ,OML_RELAXATION_TIME=grid%OML_RELAXATION_TIME &
& ,shalwater_rough=config_flags%shalwater_rough,water_depth=grid%water_depth &
& ,shalwater_depth=config_flags%shalwater_depth &
& ,lakedepth2d=grid%lakedepth2d, savedtke12d=grid%savedtke12d &
& ,snowdp2d=grid%snowdp2d, h2osno2d=grid%h2osno2d & !lake
& ,snl2d=grid%snl2d, t_grnd2d=grid%t_grnd2d &
Expand Down
38 changes: 38 additions & 0 deletions dyn_em/module_initialize_real.F
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,44 @@ SUBROUTINE init_domain_rk ( grid &
END IF
END IF

grid%bathymetry_flag = flag_bathymetry
IF ( flag_bathymetry .EQ. 0 ) THEN
IF ( grid%shalwater_rough .EQ. 1 ) THEN
CALL wrf_message ( " Warning: No bathymetry data found for shallow water roughness model." )
IF ( grid%shalwater_depth .LE. 0.0 ) THEN
CALL wrf_message ( " Warning: shalwater_depth must be greater than 0.0 for WRF to run." )
END IF
END IF
DO j = jts, MIN(jde-1,jte)
DO i = its, MIN(ide-1,ite)
grid%water_depth(i,j) = -4.0
END DO
END DO
ELSE
CALL wrf_message ( " Bathymetry dataset from GEBCO Compilation Group. Please acknowledge the following in presentations and publications: GEBCO Compilation Group (2021) GEBCO 2021 Grid (doi:10.5285/c6612cbe-50b3-0cff-e053-6c86abc09f8f)." )
DO j = jts, MIN(jde-1,jte)
DO i = its, MIN(ide-1,ite)
grid%water_depth(i,j) = grid%bathymetry(i,j)
! Get depth of lake based on height of water surface:
IF ( grid%lu_index(i,j) .EQ. grid%islake ) THEN
grid%water_depth(i,j) = grid%bathymetry(i,j) - grid%ht_gc(i,j)
END IF
! Depth is positive:
grid%water_depth(i,j) = -grid%water_depth(i,j)
! Set land cells to -10
IF ( ( grid%lu_index(i,j) .NE. grid%islake ) .AND. ( grid%lu_index(i,j) .NE. grid%iswater ) ) THEN
grid%water_depth(i,j) = -2.0
ELSE ! Water cells:
! Find any water cells with negative (originally positive) values...
! ... indicative of mis-match of bathymetry and land mask.
IF (grid%water_depth(i,j) .LT. 0.1) THEN
grid%water_depth(i,j) = 0.1
END IF
END IF
END DO
END DO
END IF

! Send out a quick message about the time steps based on the map scale factors.

IF ( ( internal_time_loop .EQ. 1 ) .AND. ( grid%id .EQ. 1 ) .AND. &
Expand Down
1 change: 1 addition & 0 deletions dyn_em/nest_init_utils.F
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ SUBROUTINE init_domain_constants_em ( parent , nest )
nest%traj_lat = parent%traj_lat
nest%this_is_an_ideal_run = parent%this_is_an_ideal_run
nest%lake_depth_flag = parent%lake_depth_flag
nest%bathymetry_flag = parent%bathymetry_flag

CALL nl_get_mminlu ( 1, char_junk )
CALL nl_get_iswater( 1, iswater )
Expand Down
1 change: 1 addition & 0 deletions dyn_em/start_em.F
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,7 @@ SUBROUTINE start_domain_em ( grid, allowed_to_read &
grid%tkdry3d, grid%tksatu3d, grid%lake2d, & !lake
config_flags%lakedepth_default, config_flags%lake_min_elev, grid%lake_depth, & !lake
grid%lakemask, grid%lakeflag, grid%LAKE_DEPTH_FLAG, grid%use_lakedepth, & !lake
grid%water_depth, grid%BATHYMETRY_FLAG, grid%shalwater_rough,grid%shalwater_depth, & !PSH bath
config_flags%sf_surface_mosaic, config_flags%mosaic_cat, config_flags%num_land_cat, & ! Noah tiling
config_flags%maxpatch, & ! start of CLM variables
grid%numc,grid%nump,grid%snl,grid%snowdp,& !
Expand Down
24 changes: 21 additions & 3 deletions phys/module_physics_init.F
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ SUBROUTINE phy_init ( id, config_flags, DT, restart, zfull, zhalf, &
lakemask, lakeflag, & !lake
#endif
lake_depth_flag, use_lakedepth, & !lake
water_depth, bathymetry_flag, shalwater_rough, & !bathymetry
shalwater_depth, & ! bathymetry
sf_surface_mosaic, mosaic_cat, NLCAT, & ! Noah tiling
!CLM variables
maxpatch, &
Expand Down Expand Up @@ -755,14 +757,18 @@ SUBROUTINE phy_init ( id, config_flags, DT, restart, zfull, zhalf, &
real, dimension( ims:ime,-nlevsnow+0:nlevsoil, jms:jme ),INTENT(inout) :: zi3d
LOGICAL, DIMENSION( ims:ime, jms:jme ),intent(out) :: lake2d
! REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN) :: HT
REAL, OPTIONAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN) :: lake_depth
REAL, OPTIONAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: lake_depth
REAL, OPTIONAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: water_depth
weiwangncar marked this conversation as resolved.
Show resolved Hide resolved
real, intent(in) :: lakedepth_default, lake_min_elev
#if ( EM_CORE == 1 )
REAL, dimension(ims:ime,jms:jme ) :: lakemask
INTEGER, INTENT(IN) :: lakeflag
#endif
INTEGER, INTENT(INOUT) :: lake_depth_flag
INTEGER, INTENT(IN) :: use_lakedepth
INTEGER, INTENT(INOUT) :: bathymetry_flag
INTEGER, INTENT(IN) :: shalwater_rough
REAL, INTENT(IN) :: shalwater_depth


!CLM
Expand Down Expand Up @@ -1446,6 +1452,8 @@ SUBROUTINE phy_init ( id, config_flags, DT, restart, zfull, zhalf, &
lakemask, lakeflag, & !lake
#endif
lake_depth_flag, use_lakedepth, & !lake
water_depth, bathymetry_flag, shalwater_rough, &
shalwater_depth, &
te_temf,cf3d_temf,wm_temf, & ! WA
DZR, DZB, DZG, & !Optional urban
TR_URB2D,TB_URB2D,TG_URB2D,TC_URB2D,QC_URB2D, & !Optional urban
Expand Down Expand Up @@ -2470,6 +2478,8 @@ SUBROUTINE bl_init(STEPBL,BLDT,DT,RUBLTEN,RVBLTEN,RTHBLTEN, &
lakemask, lakeflag, & !lake
#endif
lake_depth_flag, use_lakedepth, & !lake
water_depth,bathymetry_flag, shalwater_rough, &
shalwater_depth, &
te_temf,cf3d_temf,wm_temf, & ! WA
! num_roof_layers,num_wall_layers,num_road_layers,& !Optional urban
DZR, DZB, DZG, & !Optional urban
Expand Down Expand Up @@ -2938,13 +2948,17 @@ SUBROUTINE bl_init(STEPBL,BLDT,DT,RUBLTEN,RVBLTEN,RTHBLTEN, &
real, dimension( ims:ime,-nlevsnow+0:nlevsoil, jms:jme ),INTENT(inout) :: zi3d

logical, dimension(ims:ime,jms:jme ),intent(out) :: lake2d
REAL, OPTIONAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN) :: lake_depth
REAL, OPTIONAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: lake_depth
REAL, OPTIONAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: water_depth
weiwangncar marked this conversation as resolved.
Show resolved Hide resolved
#if ( EM_CORE == 1 )
REAL, dimension(ims:ime,jms:jme ),intent(inout) :: lakemask
INTEGER, INTENT(IN) :: lakeflag
#endif
INTEGER, INTENT(IN) :: use_lakedepth
INTEGER, INTENT(INOUT) :: lake_depth_flag
INTEGER, INTENT(IN) :: shalwater_rough
REAL, INTENT(IN) :: shalwater_depth
INTEGER, INTENT(INOUT) :: bathymetry_flag
! REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN) :: HT

REAL, DIMENSION( ims:ime , jms:jme ) , OPTIONAL, INTENT(INOUT) :: &
Expand Down Expand Up @@ -3088,7 +3102,11 @@ SUBROUTINE bl_init(STEPBL,BLDT,DT,RUBLTEN,RVBLTEN,RTHBLTEN, &
CALL sfclayinit( allowed_to_read )
isfc = 1
CASE (SFCLAYREVSCHEME)
CALL sfclayrevinit
CALL sfclayrevinit(ims,ime,jms,jme, &
its,ite,jts,jte, &
bathymetry_flag, shalwater_rough, &
shalwater_depth, water_depth, &
xland,LakeModel,lake_depth,lakemask )
isfc = 1
CASE (PXSFCSCHEME)
CALL pxsfclayinit( allowed_to_read )
Expand Down
124 changes: 118 additions & 6 deletions phys/module_sf_sfclayrev.F
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ SUBROUTINE SFCLAYREV(U3D,V3D,T3D,QV3D,P3D,dz8w, &
ids,ide, jds,jde, kds,kde, &
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte, &
ustm,ck,cka,cd,cda,isftcflx,iz0tlnd,scm_force_flux )
ustm,ck,cka,cd,cda,isftcflx,iz0tlnd, &
shalwater_rough,water_depth,shalwater_depth, &
scm_force_flux )
!-------------------------------------------------------------------
IMPLICIT NONE
!-------------------------------------------------------------------
Expand Down Expand Up @@ -190,6 +192,10 @@ SUBROUTINE SFCLAYREV(U3D,V3D,T3D,QV3D,P3D,dz8w, &

INTEGER, OPTIONAL, INTENT(IN ) :: ISFTCFLX, IZ0TLND
INTEGER, OPTIONAL, INTENT(IN ) :: SCM_FORCE_FLUX

INTEGER, OPTIONAL, INTENT(IN ) :: shalwater_rough
REAL, OPTIONAL, INTENT(IN ) :: shalwater_depth
REAL, OPTIONAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN) :: water_depth
weiwangncar marked this conversation as resolved.
Show resolved Hide resolved
! LOCAL VARS

REAL, DIMENSION( its:ite ) :: U1D, &
Expand Down Expand Up @@ -231,6 +237,7 @@ SUBROUTINE SFCLAYREV(U3D,V3D,T3D,QV3D,P3D,dz8w, &
GZ1OZ0(ims,j),WSPD(ims,j),BR(ims,j),ISFFLX,DX, &
SVP1,SVP2,SVP3,SVPT0,EP1,EP2,KARMAN,EOMEG,STBOLT, &
P1000mb, &
shalwater_rough,water_depth(ims,j),shalwater_depth,&
ids,ide, jds,jde, kds,kde, &
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte &
Expand All @@ -256,6 +263,7 @@ SUBROUTINE SFCLAYREV1D(J,UX,VX,T1D,QV1D,P1D,dz8w1d, &
SVP1,SVP2,SVP3,SVPT0,EP1,EP2, &
KARMAN,EOMEG,STBOLT, &
P1000mb, &
shalwater_rough,water_depth,shalwater_depth, &
ids,ide, jds,jde, kds,kde, &
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte, &
Expand Down Expand Up @@ -321,6 +329,9 @@ SUBROUTINE SFCLAYREV1D(J,UX,VX,T1D,QV1D,P1D,dz8w1d, &

REAL, INTENT(IN ) :: CP,G,ROVCP,R,XLV,DX

INTEGER, OPTIONAL, INTENT(IN ) :: shalwater_rough
REAL, OPTIONAL, INTENT(IN ) :: shalwater_depth
REAL, OPTIONAL, DIMENSION( ims:ime ), INTENT(IN) :: water_depth
weiwangncar marked this conversation as resolved.
Show resolved Hide resolved
! MODULE-LOCAL VARIABLES, DEFINED IN SUBROUTINE SFCLAY
REAL, DIMENSION( its:ite ), INTENT(IN ) :: dz8w1d

Expand Down Expand Up @@ -971,10 +982,16 @@ SUBROUTINE SFCLAYREV1D(J,UX,VX,T1D,QV1D,P1D,dz8w1d, &
DO 360 I=its,ite
IF((XLAND(I)-1.5).GE.0)THEN
! ZNT(I)=CZO*UST(I)*UST(I)/G+OZO
! Since V3.7 (ref: EC Physics document for Cy36r1)
ZNT(I)=CZO*UST(I)*UST(I)/G+0.11*1.5E-5/UST(I)
! V3.9: Add limit as in isftcflx = 1,2
ZNT(I)=MIN(ZNT(I),2.85e-3)
! PSH - formulation for depth-dependent roughness from
! ... Jimenez and Dudhia, 2018
IF ( shalwater_rough .eq. 1 ) THEN
ZNT(I) = depth_dependent_z0(water_depth(I),ZNT(I),UST(I))
ELSE
! Since V3.7 (ref: EC Physics document for Cy36r1)
ZNT(I)=CZO*UST(I)*UST(I)/G+0.11*1.5E-5/UST(I)
! V3.9: Add limit as in isftcflx = 1,2
ZNT(I)=MIN(ZNT(I),2.85e-3)
ENDIF
! COARE 3.5 (Edson et al. 2013)
! CZC = 0.0017*WSPD(I)-0.005
! CZC = min(CZC,0.028)
Expand Down Expand Up @@ -1086,11 +1103,25 @@ SUBROUTINE SFCLAYREV1D(J,UX,VX,T1D,QV1D,P1D,dz8w1d, &
END SUBROUTINE SFCLAYREV1D

!====================================================================
SUBROUTINE sfclayrevinit
SUBROUTINE sfclayrevinit(ims,ime,jms,jme, &
its,ite,jts,jte, &
bathymetry_flag, shalwater_rough, &
shalwater_depth, water_depth, &
xland,LakeModel,lake_depth,lakemask )

INTEGER :: N
REAL :: zolf

INTEGER, INTENT(IN) :: ims,ime,jms,jme,its,ite,jts,jte
INTEGER, INTENT(IN) :: shalwater_rough
REAL, INTENT(IN) :: shalwater_depth
INTEGER, INTENT(IN) :: bathymetry_flag
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: water_depth
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN ) :: xland
INTEGER :: LakeModel
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN ) :: lake_depth
REAL, DIMENSION( ims:ime, jms:jme ) :: lakemask

DO N=0,1000
! stable function tables
zolf = float(n)*0.01
Expand All @@ -1103,9 +1134,74 @@ SUBROUTINE sfclayrevinit
psih_unstab(n)=psih_unstable_full(zolf)

ENDDO
IF ( shalwater_rough .EQ. 1 ) THEN
CALL shalwater_init(ims,ime,jms,jme, &
its,ite,jts,jte, &
bathymetry_flag, shalwater_rough, &
shalwater_depth, water_depth, &
xland,LakeModel,lake_depth,lakemask )
END IF

END SUBROUTINE sfclayrevinit

SUBROUTINE shalwater_init(ims,ime,jms,jme, &
its,ite,jts,jte, &
bathymetry_flag, shalwater_rough, &
shalwater_depth, water_depth, &
xland,LakeModel,lake_depth,lakemask )

INTEGER, INTENT(IN) :: ims,ime,jms,jme,its,ite,jts,jte
INTEGER, INTENT(IN) :: shalwater_rough
REAL, INTENT(IN) :: shalwater_depth
INTEGER, INTENT(IN) :: bathymetry_flag
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: water_depth
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN ) :: xland
INTEGER :: LakeModel
REAL, DIMENSION( ims:ime, jms:jme ), INTENT(IN ) :: lake_depth
REAL, DIMENSION( ims:ime, jms:jme ) :: lakemask

! Local
LOGICAL :: overwrite_water_depth

overwrite_water_depth = .False.

IF ( bathymetry_flag .eq. 1 ) THEN
IF ( shalwater_depth .LE. 0.0 ) THEN
CALL wrf_message ( " Bathymetry dataset from GEBCO Compilation Group. Please acknowledge the following in presentations and publications: GEBCO Compilation Group (2021) GEBCO 2021 Grid (doi:10 .5285/c6612cbe-50b3-0cff-e053-6c86abc09f8f)." )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phawbeck Should this be in the code or added to the release note? We don't have any other prints from the code to do this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phawbeck I see that this message is in the README file. I think adding it to the RELEASE NOTE should be sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly one way or the other, so whatever you recommend! Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phawbeck Can you then remove this print?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phawbeck Can you remove this message, as we discussed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

IF ( LakeModel .ge. 1 ) THEN
DO j = jts,jte
DO i = its,ite
IF ( lakemask(i,j) .EQ. 1 ) THEN
water_depth(i,j) = lake_depth(i,j)
END IF
END DO
END DO
END IF
ELSE
overwrite_water_depth = .True.
END IF
ELSE
IF ( shalwater_depth .GT. 0.0 ) THEN
overwrite_water_depth = .True.
ELSE
CALL wrf_error_fatal('No bathymetry data detected and shalwater_depth not greater than 0.0. Re-run WPS to get bathymetry data or set shalwater_depth > 0.0')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phawbeck This is probably ok, but in the future namelist cross-checks probably should be placed in share/module_check_a_mundo.F.
@davegill What do you think?

END IF
END IF

IF (overwrite_water_depth) THEN
DO j = jts,jte
DO i = its,ite
IF((XLAND(i,j)-1.5).GE.0)THEN
water_depth(i,j) = shalwater_depth
ELSE
water_depth(i,j) = -2.0
END IF
END DO
END DO
END IF

END SUBROUTINE shalwater_init

function zolri(ri,z,z0)
!
if (ri.lt.0.)then
Expand Down Expand Up @@ -1249,6 +1345,22 @@ function psih_unstable(zolf)
return
end function

function depth_dependent_z0(water_depth,z0,UST)
real :: depth_b
real :: effective_depth
IF ( water_depth .lt. 10.0 ) THEN
effective_depth = 10.0
ELSEIF ( water_depth .gt. 100.0 ) THEN
effective_depth = 100.0
ELSE
effective_depth = water_depth
ENDIF

depth_b = 1 / 30.0 * log (1260.0 / effective_depth)
depth_dependent_z0 = exp((2.7 * ust - 1.8 / depth_b) / (ust + 0.17 / depth_b) )
depth_dependent_z0 = MIN(depth_dependent_z0,0.1)
return
end function
!-------------------------------------------------------------------

END MODULE module_sf_sfclayrev
Expand Down
Loading