In the dev branch, when we create the *Rates.F90 file, the YIN argument definition statements in routine Update_Rconst are placed before the INLINED_RCONST statement. If a USE statement is included in the INLINED_RCONST section, then this will generate code such as this:
SUBROUTINE Update_RCONST ( YIN )
! YIN - Optional input concentrations of variable species
REAL(kind=dp), OPTIONAL :: YIN(NVAR)
! Y - Concentrations of species (local)
REAL(kind=dp) :: Y(NSPEC)
! Ensure local Y array is filled with variable and constant concentrations
Y(1:NSPEC) = C(1:NSPEC)
! Update local Y array if variable concentrations are provided
if (present(YIN)) Y(1:NVAR) = YIN(1:NVAR)
! Begin INLINED RCONST
! Inline an include file containing rate law definitions, which
! will be inserted directly into subroutine Update_Rconst().
! This is necessary as a workaround for KPP not being able to
! include very large files ( > 200000 chars) directly.
! -- Bob Yantosca (11 Jun 2021)
USE fullchem_RateLawFuncs
! End INLINED RCONST
This will generate an error such as:
gfortran -cpp -O -c gckpp_Precision.F90
gfortran -cpp -O -c gckpp_Parameters.F90
gfortran -cpp -O -c gckpp_Global.F90
gfortran -cpp -O -c gckpp_JacobianSP.F90
gfortran -cpp -O -c gckpp_Jacobian.F90
gfortran -cpp -O -c gckpp_Function.F90
gfortran -cpp -O -c rateLawUtilFuncs.F90
gfortran -cpp -O -c fullchem_RateLawFuncs.F90
gfortran -cpp -O -c gckpp_Rates.F90
gckpp_Rates.F90:439:27:
439 | USE fullchem_RateLawFuncs
| 1
Error: Unexpected USE statement at (1)
make: *** [Makefile:163: gckpp_Rates.o] Error 1
Failed to build the 'kpp_executable.exe' file! Aborting...
This is because the USE statement must come before any variable declarations or executable statements.
The fix is simple, to place the INLINED_RCONST section first before adding the YIN variable declarations. I can push a fix.
Currently this only affects code in the dev branch but not in main.
Tagging @jimmielin @RolfSander
In the
devbranch, when we create the*Rates.F90file, theYINargument definition statements in routineUpdate_Rconstare placed before theINLINED_RCONSTstatement. If aUSEstatement is included in theINLINED_RCONSTsection, then this will generate code such as this:This will generate an error such as:
This is because the USE statement must come before any variable declarations or executable statements.
The fix is simple, to place the
INLINED_RCONSTsection first before adding theYINvariable declarations. I can push a fix.Currently this only affects code in the
devbranch but not inmain.Tagging @jimmielin @RolfSander