I am currently working on implementing methane (ECH4) as an additional variable in the CMAQ v5.0 adjoint model to evaluate sensitivities. The chemical mechanism used is CB05CL_AERO5. I have successfully modified the chemical mechanism files (i.e., GC_cb05cl_ae5_aq.csv, GC_cb05cl_ae5_aq.nml, and GC_SPC.EXT) to include ECH4 and can now output its concentration without any issues.
In particular, I added the following two chemical reactions:
Initially, a background CH4 concentration was used, but I have modified the model to utilize CH4 emissions as input, and this successfully drives the ECH4 concentration field.
However, when incorporating these reactions into the Tangent Linear and Adjoint models by modifying KPP-related subroutines (KPP_Function, KPP_Jacobian, KPP_JacobianSP, KPP_LinearAlgebra), I encountered an issue where NaN values appear in the computed concentrations. I suspect the problem may lie in the hard-coded Jacobian structure in KPP_Jacobian.f90, which might be incompatible with the changes I’ve made.
Would anyone be willing to provide insight or guidance on resolving this issue? Any help would be greatly appreciated.
I would like to know how you added the chemical reactions involved in ECH4. The CB05CL_AERO5 of CMAQ4.7.1 called by the CMAQv5.0adjoint model does not have files such as GC_cb05cl_ae5_aq.csv and GC_cb05cl_ae5_aq.nml. I modified GC_SPC.EXT、GC_EMIS.EXT、GC_DIFF.EXT、GC_CONC.EXT et, al.
Simply modifying the text include files is not sufficient to modify the chemical mechanism. Adding reactions is possible, but requires a more complete understanding and use of the CMAQ CHEMMECH tool.
Similarly for the original poster, you are correct in that the Jacobian needs to be redefined by taking into account the newly added reactions.
Thank you for your guidance. CMAQ v4.7.1 does not include the CHEMMECH tool, so I have only modified the text include files. I would like to ask how the chemical mechanism should be modified correctly under this constraint, and whether it is possible to obtain the CHEMMECH tool from other sources.
Any help would be greatly appreciated.
Wang
Sorry for the delayed response. As Sergey mentioned, simply modifying the text include files is not sufficient to properly update the chemical mechanism. However, as you know, CMAQ v4.7.1 does not provide the CHEMMECH tool. Because of this limitation, I proceeded without using CHEMMECH and instead modified the Fortran source code directly to add the ECH4-related reactions.
I was able to implement the new reactions successfully by editing the following KPP-generated Fortran modules:
KPP_Function.f90
KPP_Hessian.f90
KPP_HessianSP.f90
KPP_Jacobian.f90
KPP_JacobianSP.f90
KPP_LinearAlgebra.f90
KPP_Parameters.f90
KPP_Util.f90
Although this approach is “hard-coded,” the structure follows a consistent set of rules, which made it possible to extend the mechanism as long as the existing conventions were carefully maintained.