Conversation
src/gen.c - In routine GenerateUpdatePhoto, we also now inline USE statements from inline block F90_RCONST_USE into routine Update_Photo. This fixes a bug that was found with the MCM mechanism. examples/mcm/mcm_isoprene.eqn - Moved "USE constants_mcm" from the F90_RCONST to the F90_RCONST_USE inline block. This will place it properly at the top of the routines. CHANGELOG.md - Updated accordingly Signed-off-by: Bob Yantosca <[email protected]>
docs/source/using_kpp/04_input_for_kpp.rst - Now state that code specified in an #INLINE F90_RCONST_USE section will be placed into both Update_RCONST and Update_PHOTO. Signed-off-by: Bob Yantosca <[email protected]>
Contributor
Author
|
With this fix, the C-I test for the MCM mechanism runs to completion: >>>>>>>> Generating mcm mechanism with KPP <<<<<<<<
This is KPP-3.1.1.
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:
- mcm_Monitor
KPP is generating the utility data:
- mcm_Util
KPP is generating the global declarations:
- mcm_Main
KPP is generating the ODE function:
- mcm_Function
KPP is generating the ODE Jacobian:
- mcm_Jacobian
- mcm_JacobianSP
KPP is generating the linear algebra routines:
- mcm_LinearAlgebra
KPP is generating the utility functions:
- mcm_Util
KPP is generating the rate laws:
- mcm_Rates
KPP is generating the parameters:
- mcm_Parameters
KPP is generating the global data:
- mcm_Global
KPP is generating the driver from ./driver_mcm.f90:
- mcm_Main
KPP is starting the code post-processing.
KPP has successfully created the model "mcm".
>>>>>>>> Building the mcm test executable <<<<<<<<<
gfortran -cpp -O -g -frecursive -c mcm_Precision.f90
gfortran -cpp -O -g -frecursive -c mcm_Parameters.f90
gfortran -cpp -O -g -frecursive -c mcm_Monitor.f90
gfortran -cpp -O -g -frecursive -c mcm_Global.f90
gfortran -cpp -O -g -frecursive -c constants_mcm.f90
gfortran -cpp -O -g -frecursive -c mcm_Function.f90
gfortran -cpp -O -g -frecursive -c mcm_JacobianSP.f90
gfortran -cpp -O -g -frecursive -c mcm_Rates.f90
gfortran -cpp -O -g -frecursive -c mcm_Initialize.f90
gfortran -cpp -O -g -frecursive -c mcm_Util.f90
gfortran -cpp -O -g -frecursive -c mcm_Jacobian.f90
gfortran -cpp -O -g -frecursive -c mcm_LinearAlgebra.f90
mcm_LinearAlgebra.f90:4446:46:
4446 | IF (incX .EQ. incY) IF (incX-1) 5,20,60
| 1
Warning: Fortran 2018 deleted feature: Arithmetic IF statement at (1)
gfortran -cpp -O -g -frecursive -c mcm_Integrator.f90
gfortran -cpp -O -g -frecursive -c mcm_Model.f90
gfortran -cpp -O -g -frecursive -c mcm_Main.f90
gfortran -cpp -O -g -frecursive mcm_Precision.o mcm_Parameters.o mcm_Global.o constants_mcm.o mcm_Function.o mcm_JacobianSP.o mcm_Jacobian.o mcm_Rates.o mcm_Util.o mcm_Monitor.o mcm_LinearAlgebra.o mcm_Main.o mcm_Initialize.o mcm_Integrator.o mcm_Model.o -o mcm.exe
>>>>>>>> Running the mcm test <<<<<<<<
>>>>>>>> mcm test was successful! <<<<<<<< |
RolfSander
approved these changes
Feb 5, 2025
Contributor
RolfSander
left a comment
There was a problem hiding this comment.
This looks good. UPDATE_PHOTO should be treated in the same way as
UPDATE_RCONST: Both should include the F90_RCONST_USE block.
Contributor
Author
|
Thanks @RolfSander. I made note of that in the documentation as well. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug that I found when trying to run the C-I tests for the MCM mechanism. The fix does the following:
Added code to the
GenerateUpdatePhotoroutine insrc/gen.cto so that any F90 use statements specified in#INLINE F90_RCONST_USEwill be inlined at the top of theUpdate_PHOTOroutine. This will prevent compilation errors.Moved the
USE constants_mcmstatement (inexamples/mcm/mcm_isoprene.eqn) from#INLINE F90_RCONSTto#INLINE F90_RCONST_USE, so that it will be placed at the proper place at the top of the subroutine before any declaration or executable statements.Edited the ReadTheDocs documentation for
F90_RCONST_USEto state that any use statements specified here will be placed into bothUpdate_RCONSTandUpdate_PHOTO.