Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to correctly add tags to custom.equ in KPP and run GEOS-Chem with custom mechanism? #2550

Open
LittleFeify opened this issue Nov 4, 2024 · 5 comments
Assignees
Labels
category: Debug Help Request for assistance debugging GEOS-Chem topic: Chemical Mechanisms Related to KPP and/or GEOS-Chem chemistry mechanisms

Comments

@LittleFeify
Copy link

Your name

feify

Your affiliation

SUST

Please provide a clear and concise description of your question or discussion topic.

Hello, I am using GEOS-Chem-14.4.3 to track the budget for species such as NO, NO2, etc. I made changes to the custom.equ file and add the PNO, LNO2.. in custom.kpp as shown in the image below. But there are some errors when reading new files. So I'm wondering what the custom.equ file format looks like? Can I add a family including all species I want to track in custom.kpp, then I need to add the PNO to custom.equ again? Is there some more detailed manual or case on how to add tags, please. Thanks a lot.
custom_equ
custom_kpp

@LittleFeify LittleFeify added the category: Question Further information is requested label Nov 4, 2024
@yantosca yantosca added topic: Chemical Mechanisms Related to KPP and/or GEOS-Chem chemistry mechanisms category: Debug Help Request for assistance debugging GEOS-Chem and removed category: Question Further information is requested labels Nov 4, 2024
@yantosca yantosca self-assigned this Nov 4, 2024
@yantosca
Copy link
Contributor

yantosca commented Nov 4, 2024

Thanks for writing @LittleFeify. Would you be able to post the log file that shows the specific error that you are getting?

We do have a guide on adding prod/loss families to a mechanism on ReadTheDocs:

@yantosca
Copy link
Contributor

yantosca commented Nov 4, 2024

Also the custom.eqn file is the same as the fullchem.eqn file out-of-the-box. We provide the custom.eqn file so that users can modify it without touching the fullchem.eqn file. That way if there is a problem, one can always start over by copying the fullchem.eqn to the custom.eqn.

@LittleFeify
Copy link
Author

LittleFeify commented Nov 8, 2024

Hi,
Thanks for your reply.
I've resolved the last question by updating the Unix text format and need to add several species tags in custom.equ for NOx tracking. This might create issues in custom.kpp due to the large number of families. The kpp compile succeeded after I deleted some families, so how many families can we add? Should I add the tagged species individually to custom.kpp to account for every reaction contribution?

The tags like the below in custom.eqn

HNO3 + hv = PNO2_1538 + LHNO3_1538 + OH + NO2 :                                     PHOTOL(16);
HNO2 + hv = PNO_1539 + LHNO2_1539 + OH + NO :                                      PHOTOL(15);
HNO4 + hv = OH + NO3 :                       PHOTOL(17);
HNO4 + hv = PNO2_1541 + HO2 + NO2 :          PHOTOL(18);
NO3 + hv = PNO2_1542 + NO2 + O :             PHOTOL(12);     {2014/02/03; Eastham2014; SDE}
NO3 + hv = PNO_1543 + NO + O2 :

......
The added families are like below in custom.kpp:

PNO2_521 : NO2;
LNO_522 : NO;
LNO_523 : NO;
PNO2_523 : NO2;

.....

The error occurred while running ./build_mechanism.sh.
KPP is parsing the equation file.Warning :gckpp.kpp:227:    Unnecessary ';'
Error : Too many families.

Looking forward to your reply. Thanks!

@yantosca
Copy link
Contributor

yantosca commented Nov 8, 2024

Thanks for writing @LittleFeify. KPP 3.1.1 allows for 300 family species. To increase the limit, go to KPP/src/gdata.h and change the MAX_FAMILIES constant in this section of code:

https://github.com/KineticPreProcessor/KPP/blob/cd03fe0adcde0cce76498981812cd302959185c2/src/gdata.h#L42-L81

Then recompile KPP:

$ cd KPP/src
$ make distclean
$ make -j

Then rebuild the GEOS-Chem fullchem mechanism as usual. That should fix it.

@LittleFeify
Copy link
Author

LittleFeify commented Nov 9, 2024

Thanks, Bob. I fixed the last issue by modifying the gdata.h file but encountered a new error while running GEOS-Chem. The restart file needs all variables that I added in custom.equ and the families in custom.kpp. So I need to add hundreds of variables in my case, is that right? I created those dummy variables in the restart file, and an error occurred.I uploaded my GC.log.
[GC.log](https://github.com/user-attachments/files/17688452/GC.log

GEOS-Chem ERROR: KPP failed to converge after 2 iterations!
-> at Do_FullChem (in module GeosCore/FullChem_mod.F90)

GEOS-Chem ERROR: Error encountered in "Do_FullChem"!
-> at Do_Chemistry (in module GeosCore/chemistry_mod.F90)

GEOS-CHEM ERROR: Error encountered in "Do_Chemistry"!
STOP at -> at GEOS-Chem (in GeosCore/main.F90)

I am not sure whether other people have met a similar problem. Looking forward to your reply. Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Debug Help Request for assistance debugging GEOS-Chem topic: Chemical Mechanisms Related to KPP and/or GEOS-Chem chemistry mechanisms
Projects
None yet
Development

No branches or pull requests

2 participants