Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_radar / da_radzicevar_prepare_mixingratios.inc
blob0a932a117be1ad10daae4a609d4fc9a760403639
1   subroutine da_radzicevar_prepare_mixingratios(tlopt,prain_coef,dsnow_coef,dgr_coef, &
2                                   prain,dsnow,wsnow,dgr,wgr,            &
3                                   qra,qgr,qsn,qthres,                   &
4                                   pdfrrs,pdfrrg,pdfsrs,pdfgrg           &
5                                  )
6    !------------------------------------------------------------------------------
7    ! purpose: calculate the mixing ratios of pure rainwater, dry/wet snow/graupel
8    !------------------------------------------------------------------------------
9      implicit none
10      integer :: tlopt
11      real    :: prain_coef,dsnow_coef,dgr_coef
12      real    :: prain,dsnow,wsnow,dgr,wgr
13      real    :: upper_fs,upper_fg
14      real    :: qra,qgr,qsn
15      real    :: qthres
16      real    :: pdfrrs,pdfrrg,pdfsrs,pdfgrg
19      call da_radzicevar_upper_f(upper_fg,qra,qgr,qthres,2)
20      call da_radzicevar_upper_f(upper_fs,qra,qsn,qthres,1)
22      prain_coef=1-upper_fg-upper_fs
23      if(prain_coef<0.0) then
24        prain_coef=0
25      endif
26      prain=prain_coef*qra
28      dsnow_coef=1-upper_fs
29      if(dsnow_coef<0.0) then
30        dsnow_coef=0
31      endif
32      dsnow=dsnow_coef*qsn
33      wsnow=(1-dsnow_coef)*(qsn+qra)
35      dgr_coef=1-upper_fg
36      if(dgr_coef<0.0) then
37        dgr_coef=0.0
38      endif
39      dgr=dgr_coef*qgr
40      wgr=(1-dgr_coef)*(qgr+qra)
42      if(tlopt>=1) then
43        pdfrrs=0
44        pdfrrg=0
45        pdfsrs=0
46        pdfgrg=0
47      endif
49   end subroutine da_radzicevar_prepare_mixingratios