Skip to content

Commit 89b6286

Browse files
authored
Merge development into main for ZM (#194)
Tag: atmos_phys0_08_000 Use new constituent tendency updater in cam7 SDF #188 MUSICA TUVX scheme: create aerosol radiator, set_aerosol_optics_values #182 Set gas-species profiles in TUV-x and map indices between constituents and MICM #184 Complete Zhang McFarlane conversion to CCPP #186
2 parents c3de846 + fb23338 commit 89b6286

File tree

56 files changed

+7423
-902
lines changed

Some content is hidden

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

56 files changed

+7423
-902
lines changed

doc/ChangeLog

+56
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
2+
===============================================================
3+
4+
Tag name:
5+
Originator(s): cacraig
6+
Date: Dec 24, 2024
7+
One-line Summary: Complete Zhang McFarlane conversion to CCPP
8+
Github PR URL:
9+
10+
This PR fixes the following NCAR/atmospheric_physics Github issues:
11+
Add ccpp'ized ZM : https://github.com/ESCOMP/atmospheric_physics/issues/66
12+
13+
Code reviewed by:
14+
15+
List all existing files that have been added (A), modified (M), or deleted (D),
16+
and describe the changes:
17+
A schemes/cloud_fraction/cloud_fraction_fice.F90
18+
A schemes/cloud_fraction/cloud_fraction_fice.meta
19+
A schemes/sima_diagnostics/zm_convr_tendency_diagnostics.F90
20+
A schemes/sima_diagnostics/zm_convr_tendency_diagnostics.meta
21+
A schemes/sima_diagnostics/zm_diagnostics.F90
22+
A schemes/sima_diagnostics/zm_diagnostics.meta
23+
A schemes/sima_diagnostics/zm_evap_tendency_diagnostics.F90
24+
A schemes/sima_diagnostics/zm_evap_tendency_diagnostics.meta
25+
A schemes/sima_diagnostics/zm_momtran_tendency_diagnostics.F90
26+
A schemes/sima_diagnostics/zm_momtran_tendency_diagnostics.meta
27+
A schemes/sima_diagnostics/zm_tendency_diagnostics.F90
28+
A schemes/sima_diagnostics/zm_tendency_diagnostics.meta
29+
A schemes/utilities/to_be_ccppized_temporary.F90
30+
A schemes/utilities/to_be_ccppized_temporary.meta
31+
A schemes/zhang_mcfarlane/set_deep_conv_fluxes_to_general.F90
32+
A schemes/zhang_mcfarlane/set_deep_conv_fluxes_to_general.meta
33+
A schemes/zhang_mcfarlane/set_general_conv_fluxes_to_deep.F90
34+
A schemes/zhang_mcfarlane/set_general_conv_fluxes_to_deep.meta
35+
M schemes/zhang_mcfarlane/zm_conv_convtran.F90
36+
M schemes/zhang_mcfarlane/zm_conv_convtran.meta
37+
M schemes/zhang_mcfarlane/zm_conv_evap.F90
38+
M schemes/zhang_mcfarlane/zm_conv_evap.meta
39+
M schemes/zhang_mcfarlane/zm_conv_momtran.F90
40+
M schemes/zhang_mcfarlane/zm_conv_momtran.meta
41+
M schemes/zhang_mcfarlane/zm_convr.F90
42+
M schemes/zhang_mcfarlane/zm_convr.meta
43+
A schemes/zhang_mcfarlane/zm_convr_namelist.xml
44+
A suites/suite_zhang_mcfarlane.xml
45+
M test/test_schemes/initialize_constituents.F90
46+
A to_be_ccppized/error_messages.F90
47+
A to_be_ccppized/namelist_utils.F90
48+
A to_be_ccppized/units.F90
49+
A to_be_ccppized/wv_sat_methods.F90
50+
A to_be_ccppized/wv_saturation.F90
51+
52+
List and Describe any test failures:
53+
54+
Summarize any changes to answers:
55+
56+
===============================================================
157
===============================================================
258

359
Tag name: atmos_phys0_07_000

doc/NamesNotInDictionary.txt

+255-174
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
module cloud_fraction_fice
2+
3+
use ccpp_kinds, only: kind_phys
4+
implicit none
5+
6+
contains
7+
8+
!================================================================================================
9+
10+
!===============================================================================
11+
!> \section arg_table_cloud_fraction_fice_run Argument Table
12+
!! \htmlinclude cloud_fraction_fice_run.html
13+
!!
14+
subroutine cloud_fraction_fice_run(ncol, t, tmelt, top_lev, pver, fice, fsnow)
15+
!
16+
! Compute the fraction of the total cloud water which is in ice phase.
17+
! The fraction depends on temperature only.
18+
! This is the form that was used for radiation, the code came from cldefr originally
19+
!
20+
! Author: B. A. Boville Sept 10, 2002
21+
! modified: PJR 3/13/03 (added fsnow to ascribe snow production for convection )
22+
!-----------------------------------------------------------------------
23+
24+
! Arguments
25+
integer, intent(in) :: ncol ! number of active columns (count)
26+
real(kind_phys), intent(in) :: t(:,:) ! temperature (K)
27+
real(kind_phys), intent(in) :: tmelt ! freezing point of water (K)
28+
integer, intent(in) :: top_lev ! Vertical layer index for highest layer with tropopheric clouds (index)
29+
integer, intent(in) :: pver ! Number of vertical layers (count)
30+
31+
real(kind_phys), intent(out) :: fice(:,:) ! Fractional ice content within cloud
32+
real(kind_phys), intent(out) :: fsnow(:,:) ! Fractional snow content for convection
33+
34+
! Local variables
35+
real(kind_phys) :: tmax_fice ! max temperature for cloud ice formation
36+
real(kind_phys) :: tmin_fice ! min temperature for cloud ice formation
37+
real(kind_phys) :: tmax_fsnow ! max temperature for transition to convective snow
38+
real(kind_phys) :: tmin_fsnow ! min temperature for transition to convective snow
39+
40+
integer :: i,k ! loop indexes
41+
42+
!-----------------------------------------------------------------------
43+
44+
tmax_fice = tmelt - 10._kind_phys ! max temperature for cloud ice formation
45+
tmin_fice = tmax_fice - 30._kind_phys ! min temperature for cloud ice formation
46+
tmax_fsnow = tmelt ! max temperature for transition to convective snow
47+
tmin_fsnow = tmelt - 5._kind_phys ! min temperature for transition to convective snow
48+
49+
fice(:,:top_lev-1) = 0._kind_phys
50+
fsnow(:,:top_lev-1) = 0._kind_phys
51+
52+
! Define fractional amount of cloud that is ice
53+
do k=top_lev,pver
54+
do i=1,ncol
55+
56+
! If warmer than tmax then water phase
57+
if (t(i,k) > tmax_fice) then
58+
fice(i,k) = 0.0_kind_phys
59+
60+
! If colder than tmin then ice phase
61+
else if (t(i,k) < tmin_fice) then
62+
fice(i,k) = 1.0_kind_phys
63+
64+
! Otherwise mixed phase, with ice fraction decreasing linearly from tmin to tmax
65+
else
66+
fice(i,k) =(tmax_fice - t(i,k)) / (tmax_fice - tmin_fice)
67+
end if
68+
69+
! snow fraction partitioning
70+
71+
! If warmer than tmax then water phase
72+
if (t(i,k) > tmax_fsnow) then
73+
fsnow(i,k) = 0.0_kind_phys
74+
75+
! If colder than tmin then ice phase
76+
else if (t(i,k) < tmin_fsnow) then
77+
fsnow(i,k) = 1.0_kind_phys
78+
79+
! Otherwise mixed phase, with ice fraction decreasing linearly from tmin to tmax
80+
else
81+
fsnow(i,k) =(tmax_fsnow - t(i,k)) / (tmax_fsnow - tmin_fsnow)
82+
end if
83+
84+
end do
85+
end do
86+
87+
end subroutine cloud_fraction_fice_run
88+
89+
end module cloud_fraction_fice
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[ccpp-table-properties]
2+
name = cloud_fraction_fice
3+
type = scheme
4+
5+
[ccpp-arg-table]
6+
name = cloud_fraction_fice_run
7+
type = scheme
8+
[ ncol ]
9+
standard_name = horizontal_loop_extent
10+
units = count
11+
type = integer
12+
dimensions = ()
13+
intent = in
14+
[ t ]
15+
standard_name = air_temperature
16+
units = K
17+
type = real | kind = kind_phys
18+
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
19+
intent = in
20+
[ tmelt ]
21+
standard_name = freezing_point_of_water
22+
units = K
23+
type = real | kind = kind_phys
24+
dimensions = ()
25+
intent = in
26+
[ top_lev ]
27+
standard_name = vertical_layer_index_of_troposphere_cloud_top
28+
units = index
29+
type = integer
30+
dimensions = ()
31+
intent = in
32+
[ pver ]
33+
standard_name = vertical_layer_dimension
34+
units = count
35+
type = integer
36+
dimensions = ()
37+
intent = in
38+
[ fice ]
39+
standard_name = mass_fraction_of_ice_content_within_stratiform_cloud
40+
units = fraction
41+
type = real | kind = kind_phys
42+
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
43+
intent = out
44+
[ fsnow ]
45+
standard_name = mass_fraction_of_snow_content_within_stratiform_cloud
46+
units = fraction
47+
type = real | kind = kind_phys
48+
dimensions = (horizontal_loop_extent,vertical_layer_dimension)
49+
intent = out

schemes/musica/micm/musica_ccpp_micm.F90

+20-4
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ module musica_ccpp_micm
1919

2020
!> Registers MICM constituent properties with the CCPP
2121
subroutine micm_register(solver_type, number_of_grid_cells, constituent_props, &
22-
errmsg, errcode)
22+
micm_species, errmsg, errcode)
2323
use ccpp_constituent_prop_mod, only: ccpp_constituent_properties_t
24-
use musica_micm, only: Rosenbrock, RosenbrockStandardOrder
24+
use musica_ccpp_species, only: musica_species_t
2525
use musica_util, only: error_t
2626
use iso_c_binding, only: c_int
2727

2828
integer(c_int), intent(in) :: solver_type
2929
integer(c_int), intent(in) :: number_of_grid_cells
3030
type(ccpp_constituent_properties_t), allocatable, intent(out) :: constituent_props(:)
31+
type(musica_species_t), allocatable, intent(out) :: micm_species(:)
3132
character(len=512), intent(out) :: errmsg
3233
integer, intent(out) :: errcode
3334

@@ -36,6 +37,7 @@ subroutine micm_register(solver_type, number_of_grid_cells, constituent_props, &
3637
real(kind=kind_phys) :: molar_mass
3738
character(len=:), allocatable :: species_name
3839
logical :: is_advected
40+
integer :: number_of_species
3941
integer :: i, species_index
4042

4143
if (associated( micm )) then
@@ -46,13 +48,20 @@ subroutine micm_register(solver_type, number_of_grid_cells, constituent_props, &
4648
number_of_grid_cells, error)
4749
if (has_error_occurred(error, errmsg, errcode)) return
4850

49-
allocate(constituent_props(micm%species_ordering%size()), stat=errcode)
51+
number_of_species = micm%species_ordering%size()
52+
allocate(constituent_props(number_of_species), stat=errcode)
5053
if (errcode /= 0) then
5154
errmsg = "[MUSICA Error] Failed to allocate memory for constituent properties."
5255
return
5356
end if
5457

55-
do i = 1, micm%species_ordering%size()
58+
allocate(micm_species(number_of_species), stat=errcode)
59+
if (errcode /= 0) then
60+
errmsg = "[MUSICA Error] Failed to allocate memory for micm species."
61+
return
62+
end if
63+
64+
do i = 1, number_of_species
5665
associate( map => micm%species_ordering )
5766
species_name = map%name(i)
5867
species_index = map%index(i)
@@ -78,6 +87,13 @@ subroutine micm_register(solver_type, number_of_grid_cells, constituent_props, &
7887
errcode = errcode, &
7988
errmsg = errmsg)
8089
if (errcode /= 0) return
90+
91+
! Species are ordered to match the sequence of the MICM state array
92+
micm_species(species_index) = musica_species_t( &
93+
name = species_name, &
94+
unit = 'kg kg-1', &
95+
molar_mass = molar_mass, &
96+
index_musica_species = species_index )
8197
end associate ! map
8298
end do
8399
number_of_rate_parameters = micm%user_defined_reaction_rates%size()

0 commit comments

Comments
 (0)