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

Fix to allow use_theta_m=1 with vertical nesting and simplify rebalance options #1408

Merged
merged 5 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Registry/Registry.EM_COMMON
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,7 @@ rconfig integer num_metgrid_soil_levels namelist,domains 1 4
rconfig real p_top_requested namelist,domains 1 5000 irh "p_top_requested" "Pa" ""
rconfig logical interp_theta namelist,domains 1 .false. irh "interp_theta" "inside real, vertically interpolate theta (T) or temperature (F)" ""
rconfig integer interp_type namelist,domains 1 2 irh "interp_type" "1=interp in pressure, 2=interp in LOG pressure" ""
rconfig integer rebalance namelist,domains 1 0 irh "rebalance" "0=no; 1=yes, always; 2=yes, but only when doing vertical nesting"
rconfig integer rebalance namelist,domains 1 0 irh "rebalance" "0=no; 1=yes (must be 1 if vertical nesting is used)"
rconfig integer vert_refine_method namelist,domains max_domains 0 irh "vert_refine_method" "0=no vertical nesting, 1=integer refinement, 2=use specified eta levels or compute_eta routine" ""
rconfig integer vert_refine_fact namelist,domains 1 1 irh "vertical refinment factor for ndown, not used for concurrent vertical grid nesting" "" ""
rconfig integer extrap_type namelist,domains 1 2 irh "extrap_type" "1= use 2 lowest levels, 2=constant" ""
Expand Down
5 changes: 2 additions & 3 deletions dyn_em/module_initialize_real.F
Original file line number Diff line number Diff line change
Expand Up @@ -3957,9 +3957,8 @@ SUBROUTINE init_domain_rk ( grid &
! Compute pressure similarly to how computed within model, with final Qv.

! Do a re-balance or not? 0 = NOPE

IF ( ( config_flags%rebalance .EQ. 0 ) .OR. &
( ( config_flags%rebalance .EQ. 2 ) .AND. ( config_flags%vert_refine_method .NE. 2 ) ) ) THEN
! Note that rebalance must be 1 for vertical nesting
IF ( config_flags%rebalance .EQ. 0 ) THEN

DO j = jts, min(jde-1,jte)
DO k=kts,kte-1
Expand Down
32 changes: 24 additions & 8 deletions dyn_em/start_em.F
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,8 @@ SUBROUTINE start_domain_em ( grid, allowed_to_read &
ENDDO
ENDDO
ENDDO
IF ( ( config_flags%rebalance .EQ. 1 ) .OR. &
( ( config_flags%rebalance .EQ. 2 ) .AND. ( config_flags%vert_refine_method .EQ. 2 ) ) ) THEN
!Note that rebalance must be set to 1 for vertical nesting
IF ( config_flags%rebalance .EQ. 1 ) THEN
! Integrate base geopotential, starting at terrain elevation. This assures that
! the base state is in exact hydrostatic balance with respect to the model equations.
! This field is on full levels.
Expand Down Expand Up @@ -773,9 +773,9 @@ SUBROUTINE start_domain_em ( grid, allowed_to_read &
! it is an easy decision.
ELSE
! We request rebalancing for vertical grid nesting, or when the user asks for rebalancing.
! (Note that rebalance now must be set to 1 for vertical nesting)
! Rebalance recomputes 1/rho, p, ph_2, ph0, p_hyd
IF ( ( config_flags%rebalance .EQ. 1 ) .OR. &
( ( config_flags%rebalance .EQ. 2 ) .AND. ( config_flags%vert_refine_method .EQ. 2 ) ) ) THEN
IF ( config_flags%rebalance .EQ. 1 ) THEN
call rebalance_driver_cycl (grid )
DO j = jts,min(jte,jde-1)
DO k = kts,kte
Expand Down Expand Up @@ -2301,7 +2301,11 @@ SUBROUTINE rebalance_cycl ( grid &
qvf1 = qtot*qvf2

grid%p(i,kk,j) = - 0.5*((grid%c1f(k)*grid%Mu_2(i,j))+qvf1*(grid%c1f(k)*grid%Mub(i,j)+grid%c2f(k)))/grid%rdnw(kk)/qvf2
qvf = 1.+rvovrd*moist(i,kk,j,P_QV)
IF ( grid%use_theta_m == 0) THEN
qvf = 1.+rvovrd*moist(i,kk,j,P_QV)
ELSE
qvf = 1.
ENDIF
grid%alt(i,kk,j) = (r_d/p1000mb)*(grid%t_2(i,kk,j)+t0)*qvf* &
(((grid%p(i,kk,j)+grid%pb(i,kk,j))/p1000mb)**cvpm)
grid%al(i,kk,j) = grid%alt(i,kk,j) - grid%alb(i,kk,j)
Expand All @@ -2322,7 +2326,11 @@ SUBROUTINE rebalance_cycl ( grid &
qvf1 = qtot*qvf2
grid%p(i,kk,j) = grid%p(i,kk+1,j) - ((grid%c1f(k)*grid%Mu_2(i,j)) + &
qvf1*(grid%c1f(k)*grid%Mub(i,j)+grid%c2f(k)))/qvf2/grid%rdn(kk+1)
qvf = 1. + rvovrd*moist(i,kk,j,P_QV)
IF ( grid%use_theta_m == 0) THEN
qvf = 1. + rvovrd*moist(i,kk,j,P_QV)
ELSE
qvf = 1.
ENDIF
grid%alt(i,kk,j) = (r_d/p1000mb)*(grid%t_2(i,kk,j)+t0)*qvf* &
(((grid%p(i,kk,j)+grid%pb(i,kk,j))/p1000mb)**cvpm)
grid%al(i,kk,j) = grid%alt(i,kk,j) - grid%alb(i,kk,j)
Expand Down Expand Up @@ -2370,7 +2378,11 @@ SUBROUTINE rebalance_cycl ( grid &
qvf2 = 1./(1.+qvf1)
qvf1 = qvf1*qvf2
grid%p(i,kk,j) = - 0.5*((grid%c1f(k)*grid%Mu_2(i,j))+qvf1*(grid%c1f(k)*grid%Mub(i,j)+grid%c2f(k)))/grid%rdnw(kk)/qvf2
qvf = 1. + rvovrd*moist(i,kk,j,P_QV)
IF ( grid%use_theta_m == 0) THEN
qvf = 1. + rvovrd*moist(i,kk,j,P_QV)
ELSE
qvf = 1.
ENDIF
grid%alt(i,kk,j) = (r_d/p1000mb)*(grid%t_2(i,kk,j)+t0)*qvf &
*(((grid%p(i,kk,j)+grid%pb(i,kk,j))/p1000mb)**cvpm)
grid%al(i,kk,j) = grid%alt(i,kk,j) - grid%alb(i,kk,j)
Expand All @@ -2383,7 +2395,11 @@ SUBROUTINE rebalance_cycl ( grid &
qvf2 = 1./(1.+qvf1)
qvf1 = qvf1*qvf2
grid%p(i,kk,j) = grid%p(i,kk+1,j) - ((grid%c1f(k)*grid%Mu_2(i,j)) + qvf1*(grid%c1f(k)*grid%Mub(i,j)+grid%c2f(k)))/qvf2/grid%rdn(kk+1)
qvf = 1. + rvovrd*moist(i,kk,j,P_QV)
IF ( grid%use_theta_m == 0) THEN
qvf = 1. + rvovrd*moist(i,kk,j,P_QV)
ELSE
qvf = 1.
ENDIF
grid%alt(i,kk,j) = (r_d/p1000mb)*(grid%t_2(i,kk,j)+t0)*qvf* &
(((grid%p(i,kk,j)+grid%pb(i,kk,j))/p1000mb)**cvpm)
grid%al(i,kk,j) = grid%alt(i,kk,j) - grid%alb(i,kk,j)
Expand Down
12 changes: 10 additions & 2 deletions external/RSL_LITE/module_dm.F
Original file line number Diff line number Diff line change
Expand Up @@ -4310,7 +4310,11 @@ SUBROUTINE force_domain_em_part2 ( grid, ngrid, pgrid, config_flags &
qvf1 = qvf1*qvf2

p(i,kk,j) = - 0.5*((ngrid%c1f(k)*grid%Mu_2(i,j))+qvf1*(ngrid%c1f(k)*grid%Mub(i,j)+ngrid%c2f(k)))/ngrid%rdnw(kk)/qvf2
qvf = 1. + rvovrd*moist(i,kk,j,P_QV)
IF ( config_flags%use_theta_m == 0) THEN
qvf = 1. + rvovrd*moist(i,kk,j,P_QV)
ELSE
qvf = 1.
ENDIF
al(i,kk,j) = (r_d/p1000mb)*(grid%t_2(i,kk,j)+t0)*qvf* &
(((p(i,kk,j)+grid%pb(i,kk,j))/p1000mb)**cvpm) - grid%alb(i,kk,j)

Expand All @@ -4323,7 +4327,11 @@ SUBROUTINE force_domain_em_part2 ( grid, ngrid, pgrid, config_flags &
qvf2 = 1./(1.+qvf1)
qvf1 = qvf1*qvf2
p(i,kk,j) = p(i,kk+1,j) - ((ngrid%c1f(k)*grid%Mu_2(i,j)) + qvf1*(ngrid%c1f(k)*grid%Mub(i,j)+ngrid%c2f(k)))/qvf2/ngrid%rdn(kk+1)
qvf = 1. + rvovrd*moist(i,kk,j,P_QV)
IF ( config_flags%use_theta_m == 0) THEN
qvf = 1. + rvovrd*moist(i,kk,j,P_QV)
ELSE
qvf = 1.
ENDIF
al(i,kk,j) = (r_d/p1000mb)*(grid%t_2(i,kk,j)+t0)*qvf* &
(((p(i,kk,j)+grid%pb(i,kk,j))/p1000mb)**cvpm) - grid%alb(i,kk,j)
END DO
Expand Down
20 changes: 20 additions & 0 deletions share/module_check_a_mundo.F
Original file line number Diff line number Diff line change
Expand Up @@ -2298,6 +2298,26 @@ END FUNCTION bep_bem_nbui_max
count_fatal_error = count_fatal_error + 1
END IF

!-----------------------------------------------------------------------
! Consistency checks for vertical refinement:
! rebalance must be set to 1
!-----------------------------------------------------------------------
oops = 0
DO i = 2, model_config_rec % max_dom
IF ( .NOT. model_config_rec % grid_allowed(i) ) CYCLE
IF (model_config_rec%vert_refine_method(i) .NE. 0) THEN
IF ( model_config_rec%rebalance .NE. 1 ) THEN
oops = oops + 1
END IF
END IF
END DO

IF ( oops .GT. 0 ) THEN
wrf_err_message = '--- ERROR: vert_refine_method=2 only works with rebalance=1 '
CALL wrf_debug ( 0, TRIM( wrf_err_message ) )
count_fatal_error = count_fatal_error + 1
END IF
davegill marked this conversation as resolved.
Show resolved Hide resolved

!-----------------------------------------------------------------------
! This WRF version does not support trajectories on a global domain
!-----------------------------------------------------------------------
Expand Down