Skip to content

Commit 4084c09

Browse files
committed
Updates from UWM
1 parent c7572a3 commit 4084c09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+16408
-10205
lines changed

LY93_pdf.F90

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ module LY93_pdf
2121
contains
2222

2323
!=============================================================================
24-
subroutine LY93_driver( wm, rtm, thlm, wp2, rtp2, & ! In
25-
thlp2, Skw, Skrt, Skthl, & ! In
26-
mu_w_1, mu_w_2, mu_rt_1, mu_rt_2, & ! Out
27-
mu_thl_1, mu_thl_2, sigma_w_1_sqd, & ! Out
28-
sigma_w_2_sqd, sigma_rt_1_sqd, & ! Out
29-
sigma_rt_2_sqd, sigma_thl_1_sqd, & ! Out
30-
sigma_thl_2_sqd, mixt_frac ) ! Out
24+
subroutine LY93_driver( wm, rtm, thlm, wp2, rtp2, & ! In
25+
thlp2, Skw, Skrt, Skthl, & ! In
26+
mu_w_1, mu_w_2, & ! Out
27+
mu_rt_1, mu_rt_2, & ! Out
28+
mu_thl_1, mu_thl_2, & ! Out
29+
sigma_w_1_sqd, sigma_w_2_sqd, & ! Out
30+
sigma_rt_1_sqd, sigma_rt_2_sqd, & ! Out
31+
sigma_thl_1_sqd, sigma_thl_2_sqd, & ! Out
32+
mixt_frac ) ! Out
3133

3234
! Description:
3335
! Calculates the mixture fraction and the PDF component means and PDF

Nc_Ncn_eqns.F90

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module Nc_Ncn_eqns
9292
! | | |
9393
! | | |
9494
! | | |
95-
! | |--(intent in)-------calc_microphys_scheme_tendcies-------------(intent in)
95+
! | |--(intent in)---calc_microphys_scheme_tendcies----(intent in)
9696
! | | |
9797
! | | |
9898
! | | call a microphysics scheme
@@ -147,14 +147,16 @@ module Nc_Ncn_eqns
147147
private :: bivar_NL_chi_Ncn_mean, &
148148
bivar_Ncnm_eqn_comp
149149

150-
contains
150+
contains
151151

152152
!=============================================================================
153-
function Ncnm_to_Nc_in_cloud( mu_chi_1, mu_chi_2, mu_Ncn_1, mu_Ncn_2, &
154-
sigma_chi_1, sigma_chi_2, sigma_Ncn_1, &
155-
sigma_Ncn_2, sigma_Ncn_1_n, sigma_Ncn_2_n, &
156-
corr_chi_Ncn_1_n, corr_chi_Ncn_2_n, mixt_frac, &
157-
cloud_frac_1, cloud_frac_2 ) &
153+
elemental function Ncnm_to_Nc_in_cloud( mu_chi_1, mu_chi_2, mu_Ncn_1, &
154+
mu_Ncn_2, sigma_chi_1, sigma_chi_2, &
155+
sigma_Ncn_1, sigma_Ncn_2, &
156+
sigma_Ncn_1_n, sigma_Ncn_2_n, &
157+
corr_chi_Ncn_1_n, corr_chi_Ncn_2_n, &
158+
mixt_frac, cloud_frac_1, &
159+
cloud_frac_2 ) &
158160
result( Nc_in_cloud )
159161

160162
! Description:
@@ -246,10 +248,11 @@ function Ncnm_to_Nc_in_cloud( mu_chi_1, mu_chi_2, mu_Ncn_1, mu_Ncn_2, &
246248
end function Ncnm_to_Nc_in_cloud
247249

248250
!=============================================================================
249-
function Nc_in_cloud_to_Ncnm( mu_chi_1, mu_chi_2, sigma_chi_1, &
250-
sigma_chi_2, mixt_frac, Nc_in_cloud, &
251-
cloud_frac_1, cloud_frac_2, &
252-
const_Ncnp2_on_Ncnm2, const_corr_chi_Ncn ) &
251+
elemental function Nc_in_cloud_to_Ncnm( mu_chi_1, mu_chi_2, sigma_chi_1, &
252+
sigma_chi_2, mixt_frac, Nc_in_cloud, &
253+
cloud_frac_1, cloud_frac_2, &
254+
const_Ncnp2_on_Ncnm2, &
255+
const_corr_chi_Ncn ) &
253256
result( Ncnm )
254257

255258
! Description:
@@ -342,10 +345,11 @@ function Nc_in_cloud_to_Ncnm( mu_chi_1, mu_chi_2, sigma_chi_1, &
342345
end function Nc_in_cloud_to_Ncnm
343346

344347
!=============================================================================
345-
function Ncnm_to_Ncm( mu_chi_1, mu_chi_2, mu_Ncn_1, mu_Ncn_2, &
346-
sigma_chi_1, sigma_chi_2, sigma_Ncn_1, &
347-
sigma_Ncn_2, sigma_Ncn_1_n, sigma_Ncn_2_n, &
348-
corr_chi_Ncn_1_n, corr_chi_Ncn_2_n, mixt_frac ) &
348+
elemental function Ncnm_to_Ncm( mu_chi_1, mu_chi_2, mu_Ncn_1, mu_Ncn_2, &
349+
sigma_chi_1, sigma_chi_2, sigma_Ncn_1, &
350+
sigma_Ncn_2, sigma_Ncn_1_n, sigma_Ncn_2_n, &
351+
corr_chi_Ncn_1_n, corr_chi_Ncn_2_n, &
352+
mixt_frac ) &
349353
result( Ncm )
350354

351355
! Description:
@@ -469,9 +473,10 @@ function Ncnm_to_Ncm( mu_chi_1, mu_chi_2, mu_Ncn_1, mu_Ncn_2, &
469473
end function Ncnm_to_Ncm
470474

471475
!=============================================================================
472-
function Ncm_to_Ncnm( mu_chi_1, mu_chi_2, sigma_chi_1, sigma_chi_2, &
473-
mixt_frac, Ncm, const_Ncnp2_on_Ncnm2, &
474-
const_corr_chi_Ncn, Ncnm_val_denom_0 ) &
476+
elemental function Ncm_to_Ncnm( mu_chi_1, mu_chi_2, sigma_chi_1, &
477+
sigma_chi_2, mixt_frac, Ncm, &
478+
const_Ncnp2_on_Ncnm2, const_corr_chi_Ncn, &
479+
Ncnm_val_denom_0 ) &
475480
result( Ncnm )
476481

477482
! Description:
@@ -699,8 +704,9 @@ function Ncm_to_Ncnm( mu_chi_1, mu_chi_2, sigma_chi_1, sigma_chi_2, &
699704
end function Ncm_to_Ncnm
700705

701706
!=============================================================================
702-
function bivar_NL_chi_Ncn_mean( mu_chi_i, mu_Ncn_i, sigma_chi_i, &
703-
sigma_Ncn_i, sigma_Ncn_i_n, corr_chi_Ncn_i_n )
707+
elemental function bivar_NL_chi_Ncn_mean( mu_chi_i, mu_Ncn_i, sigma_chi_i, &
708+
sigma_Ncn_i, sigma_Ncn_i_n, &
709+
corr_chi_Ncn_i_n )
704710

705711
! Description:
706712
! The double integral over Ncn * H(chi) multiplied by the
@@ -790,7 +796,7 @@ function bivar_NL_chi_Ncn_mean( mu_chi_i, mu_Ncn_i, sigma_chi_i, &
790796
bivar_NL_chi_Ncn_mean
791797

792798

793-
if ( sigma_chi_i <=chi_tol .and. sigma_Ncn_i <= Ncn_tol ) then
799+
if ( sigma_chi_i <= chi_tol .and. sigma_Ncn_i <= Ncn_tol ) then
794800

795801
! The ith PDF component variances of both chi and Ncn are 0.
796802

@@ -847,8 +853,9 @@ function bivar_NL_chi_Ncn_mean( mu_chi_i, mu_Ncn_i, sigma_chi_i, &
847853
end function bivar_NL_chi_Ncn_mean
848854

849855
!=============================================================================
850-
function bivar_Ncnm_eqn_comp( mu_chi_i, sigma_chi_i, &
851-
const_Ncnp2_on_Ncnm2, const_corr_chi_Ncn )
856+
elemental function bivar_Ncnm_eqn_comp( mu_chi_i, sigma_chi_i, &
857+
const_Ncnp2_on_Ncnm2, &
858+
const_corr_chi_Ncn )
852859

853860
! Description:
854861
! When <Ncn> is found based on the value of <Nc>, the following equation is

Skx_module.F90

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Skx_module
1414
contains
1515

1616
!-----------------------------------------------------------------------------
17-
elemental function Skx_func( xp2, xp3, x_tol ) &
17+
function Skx_func( xp2, xp3, x_tol ) &
1818
result( Skx )
1919

2020
! Description:
@@ -34,32 +34,43 @@ elemental function Skx_func( xp2, xp3, x_tol ) &
3434
use clubb_precision, only: &
3535
core_rknd ! Variable(s)
3636

37+
use grid_class, only: &
38+
gr ! Variable Type
39+
3740
implicit none
3841

3942
! External
4043
intrinsic :: min, max
4144

4245
! Parameter Constants
4346
! Whether to apply clipping to the final result
44-
logical, parameter :: &
47+
logical, parameter :: &
4548
l_clipping_kluge = .false.
4649

4750
! Input Variables
48-
real( kind = core_rknd ), intent(in) :: &
49-
xp2, & ! <x'^2> [(x units)^2]
50-
xp3, & ! <x'^3> [(x units)^3]
51+
real( kind = core_rknd ), intent(in) :: &
5152
x_tol ! x tolerance value [(x units)]
5253

54+
real( kind = core_rknd ), dimension(gr%nz), intent(in) :: &
55+
xp2, & ! <x'^2> [(x units)^2]
56+
xp3 ! <x'^3> [(x units)^3]
57+
5358
! Output Variable
54-
real( kind = core_rknd ) :: &
59+
real( kind = core_rknd ), dimension(gr%nz) :: &
5560
Skx ! Skewness of x [-]
5661

62+
! Local Variable
63+
real( kind = core_rknd ) :: &
64+
Skx_denom_tol
65+
5766
! ---- Begin Code ----
5867

68+
Skx_denom_tol = Skw_denom_coef * x_tol**2
69+
5970
!Skx = xp3 / ( max( xp2, x_tol**two ) )**three_halves
6071
! Calculation of skewness to help reduce the sensitivity of this value to
6172
! small values of xp2.
62-
Skx = xp3 / ( xp2 + Skw_denom_coef * x_tol**2 )**three_halves
73+
Skx = xp3 / ( ( xp2 + Skx_denom_tol ) * sqrt( xp2 + Skx_denom_tol ) )
6374

6475
! This is no longer needed since clipping is already
6576
! imposed on wp2 and wp3 elsewhere in the code
@@ -125,12 +136,10 @@ elemental function LG_2005_ansatz( Skw, wpxp, wp2, &
125136

126137
! Larson and Golaz (2005) eq. 16
127138
nrmlzd_corr_wx &
128-
= ( wpxp / ( sqrt( max( wp2, w_tol_sqd ) ) &
129-
* sqrt( max( xp2, x_tol**2 ) ) ) ) &
130-
/ sqrt( one - sigma_sqd_w )
139+
= wpxp / sqrt( max( wp2, w_tol_sqd ) * max( xp2, x_tol**2 ) * ( one - sigma_sqd_w ) )
131140

132141
! Larson and Golaz (2005) eq. 11
133-
nrmlzd_Skw = Skw * ( one - sigma_sqd_w)**(-three_halves)
142+
nrmlzd_Skw = Skw / ( ( one - sigma_sqd_w) * sqrt( one - sigma_sqd_w ) )
134143

135144
! Larson and Golaz (2005) eq. 33
136145
Skx = nrmlzd_Skw * nrmlzd_corr_wx &
@@ -188,8 +197,12 @@ function xp3_LG_2005_ansatz( Skw_zt, wpxp_zt, wp2_zt, &
188197

189198
! Local Variable
190199
real( kind = core_rknd ), dimension(gr%nz) :: &
191-
Skx_zt ! Skewness of x on thermodynamic levels [-]
200+
Skx_zt, & ! Skewness of x on thermodynamic levels [-]
201+
Skx_denom_tol
202+
203+
! ---- Begin Code ----
192204

205+
Skx_denom_tol = Skw_denom_coef * x_tol**2
193206

194207
! Calculate skewness of x using the ansatz of LG05.
195208
Skx_zt(1:gr%nz) &
@@ -198,7 +211,7 @@ function xp3_LG_2005_ansatz( Skw_zt, wpxp_zt, wp2_zt, &
198211

199212
! Calculate <x'^3> using the reverse of the special sensitivity reduction
200213
! formula in function Skx_func above.
201-
xp3 = Skx_zt * ( xp2_zt + Skw_denom_coef * x_tol**2 )**three_halves
214+
xp3 = Skx_zt * ( xp2_zt + Skx_denom_tol ) * sqrt( xp2_zt + Skx_denom_tol )
202215

203216

204217
return

0 commit comments

Comments
 (0)