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 is the wind in the x-direction calculated?

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.

luwen2020

New member
Hello,

Usually we use the NCL-script to calculate the wind speed in the x-direction
ua=wrf_user_getvar(f1,ua,-1)

In the Registry.EM_COMMON file, there is a variable called U_PHY representing the wind speed of the grid point in the x-direction.
state real u_phy ikj misc 1 - rh "U_PHY" "x-wind component at mass point" "m s-1"
The calculation process of U_PHY is in the model file./dyn_em/module_big_step_utilities_em.F
u_phy(i,k,j) = 0.5*(u(i,k,j)+u(i+1,k,j))

Consistent with the calculation process in NCL-script

However, when I output this variable and compare it with the calculation result of the NCL-script, I found that the value is not the same.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
f1=addfile("wrfout_d01_2019-01-10_00:00:00","r")
ua=wrf_user_getvar(f1,"ua",-1)
uu=f1->U_PHY
print(ua:),0,250,50)+" "+uu:),0,250,50))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;result
[Wen@master 23:52 em_real]$ ncl ll.ncl
(0) 0.832777 0
(1) 0.948471 0.945791
(2) 0.520029 0.520971
(3) 0.549281 0.548501
(4) 0.830116 0.830002
(5) 0.946738 0.94498
(6) 1.21796 1.21623
Can you tell me why the values are not the same?

Thank you very much
 
This is because UA is the wind at current time step, while u_phy is calculated from UA of the previous time step. To confirm this, please save wrfout at each time step, then compare UA with U_PHY. Let me know whether you can get identical results. Thanks.
 
Yeah,you are right.

When I output according to each time step, the result is as follows. u_phy is the previous time integration step's wind speed.

[Wen@node6 14:33 em_real]$ ncl ll.ncl
(0) 0.832777 0
(1) 0.806283 0.832777
(2) 0.828454 0.806283
(3) 0.821687 0.828454
(4) 0.849746 0.821687
(5) 0.864448 0.849746
(6) 0.848954 0.864448
(7) 0.840166 0.848954
(8) 0.829724 0.840166
(9) 0.825324 0.829724
(10) 0.782533 0.825324

Can you tell me where the wind speed changes last in each time integration step? I want to add a subroutine to directly calculate and output the wind speed and direction!

Best wishes to you!

Luwen
 
Luwen
One option is to add your own codes to solve_em.F, right after the call of all RK steps. Please find the piece of code below:
Code:
CALL after_all_rk_steps ( grid, config_flags,                  &
4594                             moist, chem, tracer, scalar,         &
4595                             th_phy, pi_phy, p_phy, rho_phy,      &
4596                             p8w, t8w, dz8w,                      &
4597                             REAL(curr_secs,8), curr_secs2,       &
4598                             diag_flag,                           &
4599                             ids,  ide,  jds,  jde,  kds,  kde,   &
4600                             ims,  ime,  jms,  jme,  kms,  kme,   &
4601                             ips,  ipe,  jps,  jpe,  kps,  kpe,   &
4602                             imsx, imex, jmsx, jmex, kmsx, kmex,  &
4603                             ipsx, ipex, jpsx, jpex, kpsx, kpex,  &
4604                             imsy, imey, jmsy, jmey, kmsy, kmey,  &
4605                             ipsy, ipey, jpsy, jpey, kpsy, kpey   )

After this call, all variables are updated to current step and you can output what you want. There might have some other technical issues you need to handle.
 
Top