Closed yantosca closed 4 years ago
We can now close this issue (which was added for documentation purposes). This issue is resolved by the following commits: https://github.com/geoschem/geos-chem/commit/c860b567bcee0e282b840ac9e177f155947994c2, https://github.com/geoschem/geos-chem/commit/9dd4f63a901c8d1f5574444519eb8d86dc47b2fd, https://github.com/geoschem/geos-chem/commit/83d18521d993ed1a2d98ba280ee3ce9c9c328af7, and https://github.com/geoschem/geos-chem/commit/45741670c518ef0e16e799b92747a7c24b49ecf0.
Describe the bug:
In the halogens update for GEOS-Chem 12.9.0, the computation of heterogeneous rates was slowed down by several calls to the
Ind_()
function from within routineSET_HET
inKPP/Standard/gckpp_Hetrates.F90
. This function is used to translate a species name to its index in the list of species. TheInd_()
function incurs a certain amount of overhead on each call, andSET_HET
is called on each (I,J,L) iteration. The end result was that the het rates computation was bogged down by inefficient code.Solution:
Instead of calling the
Ind_()
function repeatedly from within routineSET_HET
, we now have used the defined type object fieldState_Chm%HetInfo
to store precomputed model indices, molecular weights, and Henry's law constants. TheState_Chm%HetInfo
field only needs to be defined at model initialization, and can be passed intoSET_HET
on subsequent timesteps.Furthermore, we were able to improve several internal routines (in which hetchem rates in tropopshereic clouds are computed) in
gckpp_Hetrates.F90
by exiting each routine immediately if grid box (I,J,L) corresponded to a location within the stratosphere. Prior to this fix, several needless computations were being performed for stratospheric boxes, where they were not used.These fixes dramatically decrease the time spent in the computation of the heterogenous chemistry rates. Here are the times in total seconds from several internal 1-month benchmarks:
Also, as part of this fix, we have removed multiple inconsistent definitions of parameters (such as molecular weights, Henry's law coefficients, and conversion factors). All molecular weights and Henry's law coefficients now come from the GEOS-Chem species database, and only a single set of unit conversion factors are used. This will cause some minor numerical differences w/r/t the prior code.