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

Warn users when projection is inappropriate for GWD_OPT=1 (merged) #213

Merged
merged 8 commits into from
Mar 31, 2017
1 change: 1 addition & 0 deletions Registry/Registry.EM_COMMON
Original file line number Diff line number Diff line change
Expand Up @@ -2465,6 +2465,7 @@ rconfig integer km_opt_dfi namelist,dynamics max_domains 1
rconfig integer damp_opt namelist,dynamics 1 0 irh "damp_opt" "" ""
rconfig integer rad_nudge namelist,dynamics 1 0 irh "rad_nudge" "" ""
rconfig integer gwd_opt namelist,dynamics 1 0 irh "gwd_opt" "" ""
rconfig real max_rot_angle_gwd namelist,dynamics 1 22.5 irh "max_rot_angle_gwd" "max projection rotation angle permitted for gwd_opt=1" ""
rconfig real zdamp namelist,dynamics max_domains 5000. h "zdamp" "" ""
rconfig real dampcoef namelist,dynamics max_domains 0. h "dampcoef" "" ""
rconfig real khdif namelist,dynamics max_domains 0 h "khdif" "" ""
Expand Down
32 changes: 31 additions & 1 deletion dyn_em/start_em.F
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ SUBROUTINE start_domain_em ( grid, allowed_to_read &
! CCN for MP=18 initializatio
REAL :: ccn_max_val

REAL :: max_mf
REAL :: max_mf, max_rot_angle
CALL get_ijk_from_grid ( grid , &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
Expand All @@ -161,6 +161,36 @@ SUBROUTINE start_domain_em ( grid, allowed_to_read &
ALLOCATE(z_at_q(IMS:IME,KMS:KME,JMS:JME),STAT=I) ; z_at_q = 0.
CALL model_to_grid_config_rec ( grid%id , model_config_rec , config_flags )

! If the rotation angle is too large, the GWD option does not do well with the assumed U and V
! being close to earth relative.

IF ( ( grid%id .EQ. 1 ) .AND. ( config_flags%gwd_opt .EQ. 1 ) ) THEN
max_rot_angle = ASIN(ABS(grid%sina(its,jts)))/DEGRAD
DO j=jts,MIN(jde-1,jte)
DO i=its,MIN(ide-1,ite)
max_rot_angle = MAX ( max_rot_angle , ASIN(ABS(grid%sina(i,j)))/DEGRAD )
END DO
END DO
#if ( defined(DM_PARALLEL) && ! defined(STUBMPI) )
max_rot_angle = wrf_dm_max_real ( max_rot_angle )
#endif
IF ( max_rot_angle .GT. ABS(config_flags%max_rot_angle_gwd) ) THEN
WRITE ( a_message , FMT='(A,F5.2)' ) 'Max projection rotation angle for domain 1 = ',max_rot_angle
CALL wrf_message ( a_message )
WRITE ( a_message , FMT='(A)' ) 'This projection may not be appropriate for using the gravity wave drag option.'
CALL wrf_message ( a_message )
WRITE ( a_message , FMT='(A)' ) 'In namelist.input make one of the two following changes:'
CALL wrf_message ( a_message )
WRITE ( a_message , FMT='(A)' ) ' 1) gwd_opt = 0 '
CALL wrf_message ( a_message )
WRITE ( a_message , FMT='(A,F5.2)' ) ' 2) max_rot_angle_gwd > ',max_rot_angle
CALL wrf_message ( a_message )
WRITE ( a_message , FMT='(A)' ) '--- ERROR: gwd_opt does not work with this domain'
CALL wrf_error_fatal ( a_message )
END IF
END IF


IF ( ( MOD (ide-ids,config_flags%parent_grid_ratio) .NE. 0 ) .OR. &
( MOD (jde-jds,config_flags%parent_grid_ratio) .NE. 0 ) ) THEN
WRITE(message, FMT='(A,I2,": Both MOD(",I4,"-",I1,",",I2,") and MOD(",I4,"-",I1,",",I2,") must = 0" )') &
Expand Down