Skip to content

Commit 64f9bb9

Browse files
committed
use default value for initial chemical species mixing ratios
1 parent e252454 commit 64f9bb9

File tree

6 files changed

+49
-173
lines changed

6 files changed

+49
-173
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
[submodule "ncar-physics"]
2121
path = src/physics/ncar_ccpp
2222
url = https://github.com/ESCOMP/atmospheric_physics
23-
fxtag = 2b66267fe263d9268effeaa1d47e3c03e6121d74
23+
fxtag = e92f76351e7f7703fb6d91cb5e76dcbbc6dcb3f2
2424
fxrequired = AlwaysRequired
2525
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
2626
[submodule "rrtmgp-data"]

cime_config/atm_musica_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
MUSICA_REPO_URL = "https://github.com/NCAR/musica.git"
99
MUSICA_TAG = "25fff7ae42d146bf3f83ad5ac18b3caac8701ddd"
1010
CHEMISTRY_DATA_REPO_URL = "https://github.com/NCAR/cam-sima-chemistry-data.git"
11-
CHEMISTRY_DATA_TAG = "71ed143c54b0d5d6e3e70f3d05d413fddcf8d59e"
11+
CHEMISTRY_DATA_TAG = "1ea9d1b8b04980738894d30a864f9a000daf2e5c"

src/control/cam_comp.F90

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,18 @@ subroutine cam_timestep_init()
290290
!
291291
!-----------------------------------------------------------------------
292292

293-
use phys_comp, only: phys_timestep_init
294-
use physics_grid, only: lat_rad, lon_rad
295-
use orbital_data, only: orbital_data_advance
296-
use stepon, only: stepon_timestep_init
297-
use cam_ccpp_cap, only: cam_constituents_array
298-
use ccpp_kinds, only: kind_phys
299-
use musica_ccpp_dependencies, only: set_initial_musica_concentrations
293+
use phys_comp, only: phys_timestep_init
294+
use physics_grid, only: lat_rad, lon_rad
295+
use orbital_data, only: orbital_data_advance
296+
use stepon, only: stepon_timestep_init
297+
use cam_ccpp_cap, only: cam_constituents_array
298+
use cam_ccpp_cap, only: cam_model_const_properties
299+
use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t
300+
use ccpp_kinds, only: kind_phys
301+
use musica_ccpp_dependencies, only: set_initial_musica_concentrations
300302

301303
real(kind_phys), pointer :: constituents_array(:,:,:)
304+
type(ccpp_constituent_prop_ptr_t), pointer :: constituent_properties(:)
302305

303306
! Update current fractional calendar day. Needs to be updated at every timestep.
304307
calday = get_curr_calday()
@@ -331,7 +334,9 @@ subroutine cam_timestep_init()
331334
!----------------------------------------------------------
332335
if (is_first_timestep) then
333336
constituents_array => cam_constituents_array()
334-
call set_initial_musica_concentrations(constituents_array)
337+
constituent_properties => cam_model_const_properties()
338+
call set_initial_musica_concentrations(constituents_array, &
339+
constituent_properties)
335340
end if
336341

337342
!

src/control/runtime_opts.F90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
4545
use inic_analytic_utils, only: analytic_ic_readnl
4646

4747
use tropopause_climo_read, only: tropopause_climo_readnl
48-
use musica_sima_namelist, only: musica_ccpp_dependencies_readnl
4948

5049
! use tracers, only: tracers_readnl
5150
! use nudging, only: nudging_readnl
@@ -103,7 +102,6 @@ subroutine read_namelist(nlfilename, single_column, scmlat, scmlon)
103102
! call check_energy_readnl(nlfilename)
104103
call analytic_ic_readnl(nlfilename)
105104
call tropopause_climo_readnl(nlfilename)
106-
call musica_ccpp_dependencies_readnl(nlfilename)
107105
! call scam_readnl(nlfilename, single_column, scmlat, scmlon)
108106
! call nudging_readnl(nlfilename)
109107

src/physics/utils/musica_ccpp_dependencies.F90

Lines changed: 34 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ module musica_ccpp_dependencies
4747
!> Indicator of whether MUSICA suite is being used
4848
logical :: is_musica_suite = .false.
4949

50-
!> Set of species for the current MUSICA configuration
51-
type(species_t), allocatable :: musica_species(:)
50+
!> Set of species for TUV-x
51+
type(species_t), allocatable :: tuvx_species(:)
5252

5353
!==============================================================================
5454
contains
@@ -84,20 +84,13 @@ subroutine initialize_musica_species_constituents(constituents_properties, &
8484
use ccpp_const_utils, only: ccpp_const_get_idx
8585
use cam_logfile, only: iulog
8686
use spmd_utils, only: primary_process => masterproc
87-
use musica_sima_namelist, only: musica_config_str
8887

8988
type(ccpp_constituent_prop_ptr_t), pointer :: constituents_properties(:)
9089
character(len=512), intent(out) :: errmsg
9190
integer, intent(out) :: errcode
9291

9392
! local variables
94-
character(len=*), parameter :: chapman_config = 'chapman'
95-
character(len=*), parameter :: terminator_config = 'terminator'
96-
logical :: is_chapman = .false.
97-
logical :: is_terminator = .false.
98-
integer :: num_micm_species = 0
99-
integer :: num_tuvx_constituents = 1
100-
integer :: num_tuvx_only_gas_species = 0
93+
integer, parameter :: num_tuvx_constituents = 4
10194
integer :: position
10295
integer :: constituent_index
10396
integer :: i_species
@@ -108,67 +101,28 @@ subroutine initialize_musica_species_constituents(constituents_properties, &
108101
return
109102
end if
110103

111-
! Currently, we only support two types of MUSICA configurations: Chapman and Terminator,
112-
! until the file I/O object is implemented. If the configuration is neither of these,
113-
! an error will be thrown.
114-
if (trim(musica_config_str) == "chapman") then
115-
is_chapman = .true.
116-
if (primary_process) then
117-
write(iulog,*) "[MUSICA Info] Using the Chapman configuration with stubbed dependencies."
118-
end if
119-
else if (trim(musica_config_str) == "terminator") then
120-
is_terminator = .true.
121-
if (primary_process) then
122-
write(iulog,*) "[MUSICA Info] Using the Terminator configuration with stubbed dependencies."
123-
end if
124-
else
125-
errcode = 1
126-
errmsg = "[MUSICA Error] MUSICA configuration is not found."
127-
return
128-
end if
129-
130-
if (is_chapman) then
131-
num_micm_species = 5
132-
num_tuvx_only_gas_species = 1
133-
else if (is_terminator) then
134-
num_micm_species = 2
135-
num_tuvx_only_gas_species = 3
136-
end if
137-
138-
allocate (musica_species(num_micm_species + num_tuvx_constituents + num_tuvx_only_gas_species), &
139-
stat=errcode, errmsg=errmsg)
104+
allocate (tuvx_species(num_tuvx_constituents), stat=errcode, errmsg=errmsg)
140105
if (errcode /= 0) return
141106

142-
musica_species(1) = species_t(&
107+
tuvx_species(1) = species_t(&
143108
"cloud_liquid_water_mixing_ratio_wrt_moist_air_and_condensed_water", 0.0000060_kind_phys)
144-
145-
if (is_chapman) then
146-
musica_species(2) = species_t("O2", 0.22474_kind_phys)
147-
musica_species(3) = species_t("O", 5.3509e-10_kind_phys)
148-
musica_species(4) = species_t("O1D", 5.3509e-10_kind_phys)
149-
musica_species(5) = species_t("O3", 0.00016_kind_phys)
150-
musica_species(6) = species_t("N2", 0.74015_kind_phys)
151-
musica_species(7) = species_t("air", 1.0_kind_phys)
152-
153-
else if (is_terminator) then
154-
musica_species(2) = species_t("Cl", 1.0e-12_kind_phys)
155-
musica_species(3) = species_t("Cl2", 1.0e-12_kind_phys)
156-
musica_species(4) = species_t("air", 1.0_kind_phys)
157-
musica_species(5) = species_t("O2", 0.21_kind_phys)
158-
musica_species(6) = species_t("O3", 4.0e-6_kind_phys)
159-
end if
160-
161-
do i_species = 1, num_micm_species + num_tuvx_constituents + num_tuvx_only_gas_species
162-
call ccpp_const_get_idx(constituents_properties, trim(musica_species(i_species)%name), &
163-
musica_species(i_species)%constituent_index, errmsg, errcode)
109+
tuvx_species(2) = species_t("air", 1.0_kind_phys)
110+
tuvx_species(3) = species_t("O2", 0.21_kind_phys)
111+
tuvx_species(4) = species_t("O3", 4.0e-6_kind_phys)
112+
113+
do i_species = 1, num_tuvx_constituents
114+
call ccpp_const_get_idx(constituents_properties, trim(tuvx_species(i_species)%name), &
115+
tuvx_species(i_species)%constituent_index, errmsg, errcode)
164116
if (errcode /= 0) return
165117
end do
166118

167119
end subroutine initialize_musica_species_constituents
168120

169-
subroutine set_initial_musica_concentrations(constituents_array)
121+
subroutine set_initial_musica_concentrations(constituents_array, constituent_properties)
170122

171-
use cam_abortutils, only: endrun
123+
use cam_abortutils, only: endrun
124+
use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t
125+
use musica_ccpp_species, only: micm_species_set
172126

173127
!-----------------------------------------------------------------------
174128
!
@@ -177,22 +131,35 @@ subroutine set_initial_musica_concentrations(constituents_array)
177131
!-----------------------------------------------------------------------
178132

179133
real(kind_phys), intent(inout) :: constituents_array(:,:,:)
134+
type(ccpp_constituent_prop_ptr_t), pointer, intent(inout) :: constituent_properties(:)
180135

181136
! local variables
182-
integer :: i_species
137+
integer :: i_species, i_constituent
183138
character(len=512) :: errmsg
139+
integer :: errcode
140+
real(kind_phys) :: default_value
184141

185142
! Don't do anything if MUSICA suite is not being used
186143
if (.not. is_musica_suite) return
187144

188-
if (.not. allocated(musica_species)) then
145+
if (.not. allocated(tuvx_species)) then
189146
errmsg = "[MUSICA Error] MUSICA species are not initialized."
190147
call endrun(errmsg, file=__FILE__, line=__LINE__)
191148
end if
192149

193-
do i_species = 1, size(musica_species)
194-
constituents_array(:,:,musica_species(i_species)%constituent_index) = &
195-
musica_species(i_species)%initial_mixing_ratio
150+
do i_species = 1, size(tuvx_species)
151+
constituents_array(:,:,tuvx_species(i_species)%constituent_index) = &
152+
tuvx_species(i_species)%initial_mixing_ratio
153+
end do
154+
155+
do i_species = 1, size(micm_species_set)
156+
i_constituent = micm_species_set(i_species)%index_constituent_props
157+
call constituent_properties(i_constituent)%default_value( &
158+
default_value, errcode, errmsg)
159+
if (errcode /= 0) then
160+
call endrun(errmsg, file=__FILE__, line=__LINE__)
161+
end if
162+
constituents_array(:,:,i_constituent) = default_value
196163
end do
197164

198165
end subroutine set_initial_musica_concentrations
@@ -205,7 +172,6 @@ subroutine musica_ccpp_dependencies_init( &
205172
use cam_logfile, only: iulog
206173
use spmd_utils, only: primary_process => masterproc
207174
use ccpp_constituent_prop_mod, only: ccpp_constituent_prop_ptr_t
208-
use musica_sima_namelist, only: musica_config_str
209175

210176
!-----------------------------------------------------------------------
211177
!
@@ -228,12 +194,6 @@ subroutine musica_ccpp_dependencies_init( &
228194
if (trim(phys_suite_name) /= "musica") return
229195
is_musica_suite = .true.
230196

231-
if (trim(musica_config_str) == "none") then
232-
errmsg = "[MUSICA Error] MUSICA configuration is not found. Please set musica_config to 'chapman' or 'terminator'."
233-
errcode = 1
234-
call endrun(errmsg, file=__FILE__, line=__LINE__)
235-
end if
236-
237197
if (primary_process) then
238198
write(iulog,*) 'WARNING: Using placeholder data for MUSICA chemistry.'
239199
end if

src/physics/utils/musica_sima_namelist.F90

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)