Differences are introduced in multiple consecutive runs versus one single run due to low precision of internal state variables set from Chem_Registry.rc.
Background: Non-species internal state variables in GCHP are created using the Chem_Registry.rc file in the GCHP/Registry directory. This file is parsed using GCHP/Shared/Config/bin/mapl_acg.pl, a perl script that generates a header file with the calls to MAPL_AddInternalSpec for each of the variables listed as internal state variables in Chem_Registry.rc. This header file, along with those created for imports and exports, is included in Chem_GridCompMod.F90.
The way GCHP is currently written, variables defined in Chem_Registry.rc are given precision REAL4. This causes discrepancies across consecutive runs if the GEOS-Chem state object is REAL8.
This problem is demonstrated by the addition of DELPDRY in dev/12.7.0, and the other variables need to be looked at to determine if they have the same issue.
One fix is to explicitly add code for the call to MAPL_AddInternalSpec to Chem_GridCompMod.F90 rather than auto-generate it using mapl_acg.pl. To reduce the file length, and to allow different options such as for GEOS, this could be put in a .H file. Alternatively, the call to mapl_acg.pl may be able to be altered, or precision may be able to be added to Chem_Registry.rc. More investigation is needed before deciding on the ultimate fix.
All State_Chm fields stored in the internal state are in REAL8 starting 12.7.0. The update moves the addition of the fields to the internal state to Chem_GridCompMod and out of Chem_Registry.rc.
Differences are introduced in multiple consecutive runs versus one single run due to low precision of internal state variables set from Chem_Registry.rc.
Background: Non-species internal state variables in GCHP are created using the Chem_Registry.rc file in the GCHP/Registry directory. This file is parsed using GCHP/Shared/Config/bin/mapl_acg.pl, a perl script that generates a header file with the calls to MAPL_AddInternalSpec for each of the variables listed as internal state variables in Chem_Registry.rc. This header file, along with those created for imports and exports, is included in Chem_GridCompMod.F90.
The way GCHP is currently written, variables defined in Chem_Registry.rc are given precision REAL4. This causes discrepancies across consecutive runs if the GEOS-Chem state object is REAL8.
This problem is demonstrated by the addition of DELPDRY in dev/12.7.0, and the other variables need to be looked at to determine if they have the same issue.
One fix is to explicitly add code for the call to MAPL_AddInternalSpec to Chem_GridCompMod.F90 rather than auto-generate it using mapl_acg.pl. To reduce the file length, and to allow different options such as for GEOS, this could be put in a .H file. Alternatively, the call to mapl_acg.pl may be able to be altered, or precision may be able to be added to Chem_Registry.rc. More investigation is needed before deciding on the ultimate fix.