Skip to content
Merged
36 changes: 36 additions & 0 deletions src/gsi/cplr_read_wrf_mass_guess.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,8 @@ subroutine read_wrf_mass_netcdf_guess_wrf(this,mype)
! - add CV transform option on hydrometer variables
! 2022-03-15 Hu change all th2 to t2m and convert 2m temperature
! from potentionl to senseible temperature
! 2025-01-28 zhao - added code to read wave height (howv) & wind gust (gust)
! from intermediate binary file for the analysis in WRF-ARW based 3DRTMA
Comment thread
GangZhao-NOAA marked this conversation as resolved.
Outdated
!
! input argument list:
! mype - pe number
Expand Down Expand Up @@ -1394,6 +1396,7 @@ subroutine read_wrf_mass_netcdf_guess_wrf(this,mype)
aerotot_guess,init_aerotot_guess,wrf_pm2_5,aero_ratios
use rapidrefresh_cldsurf_mod, only: l_hydrometeor_bkio,l_gsd_soiltq_nudge
use rapidrefresh_cldsurf_mod, only: i_use_2mq4b,i_use_2mt4b
use rapidrefresh_cldsurf_mod, only: i_howv_3dda, i_gust_3dda
use wrf_mass_guess_mod, only: soil_temp_cld,isli_cld,ges_xlon,ges_xlat,ges_tten,create_cld_grids
use gsi_bundlemod, only: GSI_BundleGetPointer
use gsi_metguess_mod, only: gsi_metguess_get,GSI_MetGuess_Bundle
Expand Down Expand Up @@ -1446,6 +1449,7 @@ subroutine read_wrf_mass_netcdf_guess_wrf(this,mype)
integer(i_kind) i_qc,i_qi,i_qr,i_qs,i_qg,i_qnr,i_qni,i_qnc,i_w,i_dbz
integer(i_kind) kqc,kqi,kqr,kqs,kqg,kqnr,kqni,kqnc,i_xlon,i_xlat,i_tt,ktt
integer(i_kind) i_th2,i_q2,i_soilt1,ksmois,ktslb
integer(i_kind) i_howv, i_gust
integer(i_kind) ier, istatus
integer(i_kind) n_actual_clouds
integer(i_kind) iv,n_gocart_var
Expand All @@ -1469,6 +1473,8 @@ subroutine read_wrf_mass_netcdf_guess_wrf(this,mype)
real(r_kind), pointer :: ges_tv_it (:,:,:)=>NULL()
real(r_kind), pointer :: ges_q_it (:,:,:)=>NULL()
real(r_kind), pointer :: ges_w_it (:,:,:)=>NULL()
real(r_kind), pointer :: ges_howv_it (:,:)=>NULL()
real(r_kind), pointer :: ges_gust_it (:,:)=>NULL()

real(r_kind), pointer :: ges_qc (:,:,:)=>NULL()
real(r_kind), pointer :: ges_qi (:,:,:)=>NULL()
Expand Down Expand Up @@ -1560,6 +1566,8 @@ subroutine read_wrf_mass_netcdf_guess_wrf(this,mype)
if(l_gsd_soilTQ_nudge) num_mass_fields=num_mass_fields+2*(nsig_soil-1)+1
if(i_use_2mt4b > 0 ) num_mass_fields=num_mass_fields + 2
if(i_use_2mq4b > 0 .and. i_use_2mt4b <=0 ) num_mass_fields=num_mass_fields + 1
if( i_howv_3dda > 0 ) num_mass_fields = num_mass_fields + 1
if( i_gust_3dda > 0 ) num_mass_fields = num_mass_fields + 1

if (laeroana_gocart .and. wrf_pm2_5 ) then
if(mype==0) write(6,*)'laeroana_gocart canoot be both true'
Expand Down Expand Up @@ -1740,6 +1748,18 @@ subroutine read_wrf_mass_netcdf_guess_wrf(this,mype)
write(identity(i),'("record ",i3,"--th2(",i2,")")')i,k
jsig_skip(i)=0 ; igtype(i)=1
endif
! for wave height (howv is after tsk/q2/soilt1/th2, and before cloud hydrometers)
if ( i_howv_3dda >0 ) then
i=i+1 ; i_howv=i ! howv
write(identity(i),'("record ",i3,"--howv")')i
jsig_skip(i)=0 ; igtype(i)=1
end if
! for wind gust (gust is after tsk/q2/soilt1/th2, and before cloud hydrometers)
if ( i_gust_3dda >0 ) then
i=i+1 ; i_gust=i ! gust
write(identity(i),'("record ",i3,"--gust")')i
jsig_skip(i)=0 ; igtype(i)=1
end if
! for cloud array
if(l_hydrometeor_bkio .and. n_actual_clouds>0) then
i_qc=i+1
Expand Down Expand Up @@ -1944,6 +1964,14 @@ subroutine read_wrf_mass_netcdf_guess_wrf(this,mype)
call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 't2m',ges_t2m_it, istatus );ier=ier+istatus
if (ier/=0) call die(trim(myname),'cannot get pointers for t2m,ier =',ier)
endif
if ( i_howv_3dda >0 ) then
call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'howv',ges_howv_it,istatus );ier=ier+istatus
if (ier/=0) call die(trim(myname),'cannot get pointers for met-field: howv, ier =',ier)
end if
if ( i_gust_3dda >0 ) then
call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'gust',ges_gust_it,istatus );ier=ier+istatus
if (ier/=0) call die(trim(myname),'cannot get pointers for met-field: gust, ier =',ier)
end if
if (l_gsd_soilTQ_nudge) then
call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'tskn',ges_tsk_it, istatus );ier=ier+istatus
call GSI_BundleGetPointer ( GSI_MetGuess_Bundle(it), 'tsoil',ges_soilt1_it,istatus);ier=ier+istatus
Expand Down Expand Up @@ -2273,6 +2301,14 @@ subroutine read_wrf_mass_netcdf_guess_wrf(this,mype)
ges_q2_it(j,i)=real(all_loc(j,i,i_0+i_q2),r_kind)
ges_q2_it(j,i)=ges_q2_it(j,i)/(one+ges_q2_it(j,i))
endif
! wave height (howv)
if ( i_howv_3dda >0 ) then
ges_howv_it(j,i) = real(all_loc(j,i,i_0+i_howv),r_kind)
end if
! wind gust (gust)
if ( i_gust_3dda >0 ) then
ges_gust_it(j,i) = real(all_loc(j,i,i_0+i_gust),r_kind)
end if
! for cloud analysis
if(l_hydrometeor_bkio .and. n_actual_clouds>0) then
soil_temp_cld(j,i,it)=soil_temp(j,i,it)
Expand Down
14 changes: 13 additions & 1 deletion src/gsi/cplr_regional_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ subroutine convert_regional_guess_wrf(this,mype,ctph0,stph0,tlm0)
! 2005-05-24 pondeca - add 2dvar only surface analysis option
! 2005-07-06 parrish - add variable update_pint
! 2012-10-11 parrish - add byte_swap, which is set only on pe 0 and must be broadcast to all pes.
! 2025-01-29 zhao - add i_howv_3dda/i_gust_3dda/i_howv_mask, which are set only on pe 0 and
Comment thread
GangZhao-NOAA marked this conversation as resolved.
Outdated
! must be broadcast to all pes.
!
! input argument list:
! mype - mpi task id
Expand All @@ -76,7 +78,7 @@ subroutine convert_regional_guess_wrf(this,mype,ctph0,stph0,tlm0)
!$$$ end documentation block

use kinds, only: i_kind,r_kind
use mpimod, only: mpi_integer4,mpi_rtype
use mpimod, only: mpi_integer4,mpi_rtype,mpi_itype
use gridmod, only: wrf_mass_regional,wrf_nmm_regional,&
nems_nmmb_regional,cmaq_regional,&
twodvar_regional,netcdf
Expand All @@ -88,6 +90,8 @@ subroutine convert_regional_guess_wrf(this,mype,ctph0,stph0,tlm0)
use mpimod, only: mpi_comm_world,ierror
use wrf_params_mod, only: update_pint,cold_start
use gsi_io, only: verbose
use rapidrefresh_cldsurf_mod, only: i_howv_3dda, i_gust_3dda
use rapidrefresh_cldsurf_mod, only: i_howv_mask

implicit none

Expand Down Expand Up @@ -145,7 +149,15 @@ subroutine convert_regional_guess_wrf(this,mype,ctph0,stph0,tlm0)
end if
call mpi_barrier(mpi_comm_world,ierror)
call mpi_bcast(byte_swap,1,mpi_integer4,0,mpi_comm_world,ierror)
call mpi_bcast(i_howv_3dda, 1, mpi_itype, 0, mpi_comm_world, ierror)
call mpi_bcast(i_gust_3dda, 1, mpi_itype, 0, mpi_comm_world, ierror)
call mpi_bcast(i_howv_mask, 1, mpi_itype, 0, mpi_comm_world, ierror)
if(print_verbose)write(6,*)' in convert_regional_guess, for wrf arw binary input, byte_swap=',byte_swap
if (mype <= 1 .and. print_verbose) then
write(6,'(1x,A,3(2x,I4),2x,A6,I6.6,A2)') &
' in convert_regional_guess, i_howv_3dda i_gust_3dda i_howv_mask =', &
i_howv_3dda,i_gust_3dda,i_howv_mask,' (pe=',mype,').'
end if

elseif (cmaq_regional) then
if (mype==0) then
Expand Down
Loading