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 all 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: 7 additions & 2 deletions Registry/Registry.EM_COMMON
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ 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"
state real bathymetry ij dyn_em 1 - i1 "bathymetry" "Bathymetry and topography" "m"
state integer BATHYMETRY_FLAG - misc 1 - i0rh "BATHYMETRY_FLAG" "Flag for bathymetry in the global attributes for metgrid data"

#-----------------------------------------------------------------------------------------------------------------------------------------------------------------
#
Expand Down Expand Up @@ -879,8 +881,9 @@ state integer IFNDICEDEPTH - misc 1 - ir "F
state real XLAIDYN ij misc 1 - - "XLAIDYN" "Noah Dynamic LEAF AREA INDEX" "m-2/m-2"
# 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"
state real DTW ij misc 1 - r "DTW" "WARM LAYER TEMP DIFF" "C"
state real lake_depth ij misc 1 - i012rd=(interp_mask_water_field:lu_index,islake) "lake_depth" "lake depth" "m"
state real water_depth ij misc 1 - i0rhd "water_depth" "global water depth" "m"
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"
state real VOCE ij misc 1 - i0124rd=(interp_mask_water_field:lu_index,iswater) "VOCE" "SEA SURFACE MERIDIONAL CURRENTS" "m s-1"
Expand Down Expand Up @@ -2566,6 +2569,8 @@ rconfig integer sf_ocean_physics namelist,physics 1 0
rconfig integer traj_opt namelist,physics 1 0 h "traj_opt" "activate trajectory calculation 0=no, 1=on" ""
rconfig logical dm_has_traj namelist,physics max_domains .false. rh "has_traj" "activate trajectory calculation per domain" ""
rconfig integer tracercall namelist,physics 1 0 h "tracercall" "activate tracer calculation 0=no, 1=on" ""
rconfig integer shalwater_z0 namelist,physics max_domains 0 rh "shalwater_z0" "shallow water sea surface roughness flag" ""
rconfig real shalwater_depth namelist,physics 1 -1.0 rh "shalwater_depth" "water depth for shallow water scheme" "m"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@phawbeck The default value set in the registry is -1. What does this signify?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @weiwangncar - This would come into play in the following case:

  1. User sets shalwater_rough = 1
  2. User does not have bathymetry data
  3. User did not set shalwater_depth in the namelist
    This would cause the value for shalwater_depth to default to -1, and a negative value would cause the model to produce an error. This prevents it from being activated accidentally / erroneously as setting the default value to something like 40 m might be problematic in some situations (e.g., simulations over deep water areas).

That said, I am open to changing it if this is an issue!

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. Usually the default value put in the registry file is a valid option/value, representing expected default behavior. In this case, it may be ok to force a user to define the depth so that the user knows what is used.

rconfig real OMDT namelist,physics 1 1 h "OMDT" "Timestep of ocean model" "s"
rconfig real oml_hml0 namelist,physics 1 50 h "oml_hml0" "oml initial mixed layer depth value" "m"
rconfig real oml_gamma namelist,physics 1 0.14 h "oml_gamma" "oml deep water lapse rate" "K m-1"
Expand Down
3 changes: 3 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,9 @@ 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_z0=config_flags%shalwater_z0 &
& ,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_z0 .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_z0,grid%shalwater_depth, & ! bathymetry
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_z0, & ! 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, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: water_depth
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_z0
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_z0, &
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_z0, &
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, DIMENSION( ims:ime, jms:jme ), INTENT(INOUT) :: water_depth
#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_z0
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_z0, &
shalwater_depth, water_depth, &
xland,LakeModel,lake_depth,lakemask )
isfc = 1
CASE (PXSFCSCHEME)
CALL pxsfclayinit( allowed_to_read )
Expand Down
Loading