Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

How can I make the real.exe read the GPH in met_em?

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

ben108472

New member
I have modified the geopotential height (GHT) in metgrid file (met_em*), but when I run the real.exe, the geopotential height (PH and PHB) in wrfinput does not change.
How does the geopotential height in wrfinput come from?
How can I make the real.exe read the GPH in met_em* and generate the wrfinput with modified geopotential height?
 
GPH is recomputed in REAL program. if you want to use the value from met_em file, you need to skip the computation for GHP. Please see the file "module_initialize_real.F", in which you can find the codes below:
1713 CALL vert_interp ( grid%ght_gc , grid%pd_gc , grid%ph0 , grid%pb , &
1714 grid%hgtmaxw , grid%hgttrop , grid%pmaxw , grid%ptrop , &
1715 grid%pmaxwnn , grid%ptropnn , &
1716 flag_hgtmaxw , flag_hgttrop , &
1717 config_flags%maxw_horiz_pres_diff , config_flags%trop_horiz_pres_diff , &
1718 config_flags%maxw_above_this_level , &
1719 num_metgrid_levels , 'Z' , &
1720 interp_type , lagrange_order , extrap_type , &
1721 lowest_lev_from_sfc , use_levels_below_ground , use_surface , &
1722 zap_close_levels , force_sfc_in_vinterp , grid%id , &
1723 ids , ide , jds , jde , kds , kde , &
1724 ims , ime , jms , jme , kms , kme , &
1725 its , ite , jts , jte , kts , kte )
1726
1727 ! Put things back to normal.

Please comment out the above call for vert_interp. This will let REAL to keep the GPH from met_em. However, be cautious because I am not sure whether this will affect other variables.
 
I have commented out above code you mentioned, then I deleted "real.exe", and compiled the WRF again, but the PH and PHB in wrfinput remained unchanged after I ran the new real.exe. It seems like the wrfinput did not read the modified "GHT" in met_em still.
 
I guess know what is going on here. Please look the codes below:
#if 1
! This is the hydrostatic equation used in the model after the small timesteps. In
! the model, grid%al (inverse density) is computed from the geopotential.

IF (grid%hypsometric_opt == 1) THEN
DO kk = 2,kte
k = kk - 1
grid%ph_2(i,kk,j) = grid%ph_2(i,kk-1,j) - &
grid%dnw(kk-1) * ( ((grid%c1h(k)*grid%mub(i,j)+grid%c2h(k))+(grid%c1h(k)*grid%mu_2(i,j)))*grid%al(i,kk-1,j) &
+ (grid%c1h(k)*grid%mu_2(i,j))*grid%alb(i,kk-1,j) )
grid%ph0(i,kk,j) = grid%ph_2(i,kk,j) + grid%phb(i,kk,j)
END DO
ELSE IF (grid%hypsometric_opt == 2) THEN
! Alternative hydrostatic eq.: dZ = -al*p*dLOG(p), where p is dry pressure.
! Note that al*p approximates Rd*T and dLOG(p) does z.
! Here T varies mostly linear with z, the first-order integration produces better result.

grid%ph_2(i,1,j) = grid%phb(i,1,j)
DO k = 2,kte
pfu = grid%c3f(k )*grid%MU0(i,j)+grid%c4f(k ) + grid%p_top
pfd = grid%c3f(k-1)*grid%MU0(i,j)+grid%c4f(k-1) + grid%p_top
phm = grid%c3h(k-1)*grid%MU0(i,j)+grid%c4h(k-1) + grid%p_top
grid%ph_2(i,k,j) = grid%ph_2(i,k-1,j) + grid%alt(i,k-1,j)*phm*LOG(pfd/pfu)
END DO

DO k = 1,kte
grid%ph_2(i,k,j) = grid%ph_2(i,k,j) - grid%phb(i,k,j)
END DO
END IF
#else
! Get the perturbation geopotential from the 3d height array from WPS.

DO k = 2,kte
grid%ph_2(i,k,j) = grid%ph0(i,k,j)*g - grid%phb(i,k,j)
END DO
#endif

and change the "#if 1" to "#if 0", then recompile WRF. Please let em know whether this works.
 
Top