Closed sabourbaray closed 3 months ago
Thanks @sabourbaray! We will try to fix this in GEOS-Chem 14.2.1.
I am tagging @hannahnesser who is also encountering this bug.
Yes, this is very similar to what I find. My problems occur beginning around state vector element ~133--so I wonder a bit if it's limited to large numbers of state vector elements.
@sabourbaray--could you share your state vector file? I wonder if there are similarities in our files that are triggering this bug. It's odd that other inversions haven't encountered it.
@hannahnesser sure, see attached for the state vector: StateVector.zip
I have added a fix in this pull request: https://github.com/geoschem/geos-chem/pull/1976.
The issue is that STATE_VECTOR is defined as REAL(FP), while Input_Opt%StateVectorElement is an INTEGER. My solution was to round STATE_VECTOR(I,J)
to the nearest integer when comparing the two.
I tested this with @hannahnesser's setup and it now perturbs Jacobian runs that were previously identical to the prior simulation (i.e. where no emissions perturbation was occurring).
This issue has been automatically marked as stale because it has not had recent activity. If there are no updates within 7 days it will be closed. You can add the "never stale" tag to prevent the issue from closing this issue.
Closing due to inactivity
Name and Institution (Required)
Name: Sabour Baray Institution: Environment and Climate Change Canada
Description of your issue or question
Running an experiment with a larger number of state vector elements (~800) produced a checkerboard pattern in the sensitivities beginning at state vector element 373, where some alternating elements had sensitivities of 0 (see figure below).
The issue arises because the Jacobian model runs are not perturbing the requested state vector element correctly, resulting in the same concentration field as the base-case (Jacobian 0000) run. This is due to a numerical error in the comparison in GeosCore/global_ch4_mod.F90:
https://github.com/geoschem/geos-chem/blob/4722f288e90291ba904222f4bbe4fc216d17c34a/GeosCore/global_ch4_mod.F90#L520C1-L535C16
After adding diagnostic print statements and running a test case without parallelization in this block of code, we can see there is a small numerical error.
In this example we can see the state vector element for this run 381 was skipped and not perturbed because the comparison to 380.999969482422 was not true.
A temporary solution to this is to add a tolerance, although this is probably not the preferred approach:
I think the original issue in how HCO_GC_EvalFld interacts with the state vector built by the IMI, where there may be conversions between data types that introduces this small numerical error: