geoschem / geos-chem

GEOS-Chem "Science Codebase" repository. Contains GEOS-Chem science routines, run directory generation scripts, and interface code. This repository is used as a submodule within the GCClassic and GCHP wrappers, as well as in other modeling contexts (external ESMs).
http://geos-chem.org
Other
167 stars 162 forks source link

GC Classic 14.1.1: failed to compile after applying a custom mechanism #1819

Closed axzhang1216 closed 1 year ago

axzhang1216 commented 1 year ago

Name and Institution (Required)

Name: Aoxing Zhang Institution: Southern University of Science and Technology

Confirm you have reviewed the following documentation

Description of your issue or question

Please provide as much detail as possible. Always include the GEOS-Chem version number and any relevant configuration and log files.

Dear GC support team,

I am using the GC Classic 14.1.1 and tried to update some changes for the chemical mechanisms. I followed the guidance of "Update chemical mechanisms with KPP" (https://geos-chem.readthedocs.io/en/stable/geos-chem-shared-docs/supplemental-guides/using-kpp-with-gc.html?highlight=add%20new%20reaction), changed some reactions (but not adding species) and rebuild KPP, it seemed work:

./build_mechanism.sh custom

This is KPP-2.5.0.

KPP is parsing the equation file.
KPP is computing Jacobian sparsity structure.
KPP is starting the code generation.
KPP is initializing the code generation.
KPP is generating the monitor data:
    - gckpp_Monitor
KPP is generating the utility data:
    - gckpp_Util
KPP is generating the global declarations:
    - gckpp_Main
KPP is generating the ODE function:
    - gckpp_Function
KPP is generating the ODE Jacobian:
    - gckpp_Jacobian
    - gckpp_JacobianSP
KPP is generating the linear algebra routines:
    - gckpp_LinearAlgebra
KPP is generating the utility functions:
    - gckpp_Util
KPP is generating the rate laws:
    - gckpp_Rates
KPP is generating the parameters:
    - gckpp_Parameters
KPP is generating the global data:
    - gckpp_Global
KPP is generating the driver from none.F90:
    - gckpp_Main
KPP is starting the code post-processing.

KPP has succesfully created the model "gckpp".

Reactivity consists of 189 reactions
Written to gckpp_Util.F90

Then I go to my run dic to rebuild this using the following commands:

cmake ../CodeDir -DMECH=custom -DRUNDIR=..
make -j

The cmake part works, ended by:

=================================================================
GEOS-Chem 14.1.1 (science codebase)
Current status: 14.1.0-134-g462e421ac.dirty
=================================================================
Creating /work/ese-zhangax/data/GC14.1.1/rundic/GEOSFP_4x5_GLYXupdate/CodeDir/src/GEOS-Chem/Interfaces/GCClassic/gc_classic_version.H
-- Configuring done (2.5s)
-- Generating done (0.3s)
-- Build files have been written to: /work/ese-zhangax/data/GC14.1.1/rundic/GEOSFP_4x5_GLYXupdate/build

but make -j failed, giving the following errors:

[ 86%] Building Fortran object src/GEOS-Chem/GeosCore/CMakeFiles/GeosCore.dir/emissions_mod.F90.o
[ 86%] Building Fortran object src/GEOS-Chem/GeosCore/CMakeFiles/GeosCore.dir/chemistry_mod.F90.o
[ 87%] Building Fortran object src/GEOS-Chem/GeosCore/CMakeFiles/GeosCore.dir/gc_environment_mod.F90.o
[ 89%] Building Fortran object src/GEOS-Chem/GeosCore/CMakeFiles/GeosCore.dir/cleanup.F90.o
[ 89%] Linking Fortran static library libGeosCore.a
[ 98%] Built target GeosCore
[ 98%] Building Fortran object src/CMakeFiles/gcclassic.dir/GEOS-Chem/Interfaces/GCClassic/main.F90.o
[100%] Linking Fortran executable ../bin/gcclassic
GEOS-Chem/GeosCore/libGeosCore.a(fullchem_mod.F90.o): In function `fullchem_mod_mp_do_fullchem_':
fullchem_mod.F90:(.text+0x65c3): undefined reference to `fullchem_autoreducefuncs_mp_fullchem_ar_keephalogensactive_'
fullchem_mod.F90:(.text+0x802a): undefined reference to `fullchem_autoreducefuncs_mp_fullchem_ar_setkeepactive_'
fullchem_mod.F90:(.text+0x91b2): undefined reference to `fullchem_autoreducefuncs_mp_fullchem_ar_setintegratoroptions_'
fullchem_mod.F90:(.text+0xe484): undefined reference to `fullchem_autoreducefuncs_mp_fullchem_ar_updatekppdiags_'
GEOS-Chem/GeosCore/libGeosCore.a(carbon_gases_mod.F90.o): In function `carbon_gases_mod_mp_chem_carbon_gases_':
carbon_gases_mod.F90:(.text+0x60ec): undefined reference to `carbon_funcs_mp_carbon_convertkgtomoleccm3_'
carbon_gases_mod.F90:(.text+0x62ee): undefined reference to `carbon_funcs_mp_carbon_computerateconstants_'
carbon_gases_mod.F90:(.text+0x6720): undefined reference to `carbon_funcs_mp_carbon_convertmoleccm3tokg_'
carbon_gases_mod.F90:(.text+0x7064): undefined reference to `carbon_funcs_mp_carbon_get_co2fromoh_flux_'
carbon_gases_mod.F90:(.text+0x7124): undefined reference to `carbon_funcs_mp_carbon_get_cofromnmvoc_flux_'
carbon_gases_mod.F90:(.text+0x719e): undefined reference to `carbon_funcs_mp_carbon_get_cofromch4_flux_'
make[2]: *** [bin/gcclassic] Error 1
make[1]: *** [src/CMakeFiles/gcclassic.dir/all] Error 2
make: *** [all] Error 2

There is no error reports before, so I'm not sure what these undefined references refers to...

Do you have any suggestions, or what procedure might I miss when updating the chemical mechanism?

Thanks, Aoxing

axzhang1216 commented 1 year ago

Dear GC support team,

I seemed to solve this issue by updating KPP from 2.5.0 to 3.0.1.

The default fullchem mechanism included rosenbrock_autoreduce method, which is not available in KPP2.5.0. Building custom mechanism with resenbrock (but no autoreduce) method will pass KPP, but it will not pass the 'make -j' in the rundic, showing the above errors (or other errors sometime, related to the autoreduce part, carbon-gases mod or KPP).

Then I updated a KPP 3.0.1, building the custom mechanism using rosenbrock_autoreduce method (in custom.kpp), then it worked so far.

This issue indicates that without changing other codes, current KPP only accepts the rosenbrock_autoreduce method. Maybe there are other modifications that may help this option flexible again? Hope to see your suggestions.

Thanks! Aoxing

yantosca commented 1 year ago

Thanks for writing @axzhang1216. Yes, in 14.1.1 you need KPP 3.0.0+. I believe in 14.2.0 we will update the #MINVERSION tag in the fullchem,file accordingly (by an oversight it may still be #MINVERSION 2.5.0.

yantosca commented 1 year ago

I'll close out this issue for now. Thanks for raising it @axzhang1216. We'll update the minversion.

yantosca commented 1 year ago

@axzhang1216 Also see PR #1946 for additional fixes that will go into 14.2.1

axzhang1216 commented 1 year ago

Thanks!

Aoxing

On Tue, Sep 12, 2023 at 3:46 AM Bob Yantosca @.***> wrote:

@axzhang1216 https://github.com/axzhang1216 Also see PR #1946 https://github.com/geoschem/geos-chem/pull/1946 for additional fixes that will go into 14.2.1

— Reply to this email directly, view it on GitHub https://github.com/geoschem/geos-chem/issues/1819#issuecomment-1714479539, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALGUFDXQDFCMRJEV5K3NLGDXZ5TA5ANCNFSM6AAAAAAYZCVVOQ . You are receiving this because you were mentioned.Message ID: @.***>