Skip to content

Conversation

@yantosca
Copy link
Contributor

We have added several new features into the dev branch of KPP. I was thinking now might be a good time to bundle them into the KPP 3.2.0 release, as it would certainly facilitate some work that I am doing.

In particular:

  • Added new inline key F90_RCONST_USE so that F90 USE statements can be inlined into the Update_RCONST and UPDATE_PHOTO routines
  • Updated code in src/gen.c to generate the UPDATE_RCONST routine with an optional argument Y
  • Updated C-I tests to print the compiler versions that are used
  • Updated int/sdirk.f90 to a newer version
  • Removed int/beuler.f90; Users can select Backward Euler with sdirk integrator and ICNTRL(3)=6
  • Added MacOS architecture-specific compilation flags to the build sequence

We can add the implicit12 (PR #101) and rosenbrock_h211b (PR #124) integrators into KPP 3.3.0 once they are ready. Also if time permits I would like to try to replace some of the calls to functions in blas.f90 with F90 array operations in the next version and examine the potential speedup.

yantosca and others added 30 commits June 13, 2024 14:25
src/code.h
- Add "char* rootFileName" as the argument to Use_C, Use_F, Use_F90,
  and Use_MATLAB function prototypes

src/code_c.c
- Add "char* rootFileName" as the argument to Use_C

src/code_f77.c
- Add "char* rootFileName" as the argument to Use_F

src/code_f90.c
- Add "char *rootFileName" as the argument to Use_F90

src/code_matlab.c
- Add "char *rootFileName" as the argument to Use_MATLAB

src/gdata.h
- Add "char* rootFileName" as the argument to Generate function prototype

src/gen.c
- Add "char* rootFileName" as the argument to Generate

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This merge brings PR #103 (Update function prototypes to avoid compiler
warnings with GCC 13, by @yantosca) into the KPP development stream.

This PR makes the compiler warnings consistent with the actual arguments
passed to Use_C, Use_F, Use_F90, Use_MATLAB, and Generate functions.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
Update_RCONST now uses variable concentrations for rate constants that
depend on species concentrations. To ensure backwards compatibility, YIN
is an optional input. If YIN is not passed to Update_RCONST,
concentrations from the global C array are used instead.
src/gen.c
- Wrap the code to declare UPDATE_RCONST with YIN in an if block that
  only executes when useLang==F90
- Place code to declare UPDATE_RCONST without any variables in the
  else block.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
.ci-pipelinoes/ci-common.defs.sh
- Add a function "print_compiler_versions" to print the gcc and
  gfortran compiler versions that are used to run the tests.

.ci-pipelines/ci-testing-script.sh
- Call "print_compiler_versions" function before running tests.
  This will print the compiler versions at the top of stdout output.

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This merge brings PR #106 ((Use Y instead of C in Update_RCONST, by
@srosanka) into the KPP development stream.

This PR adds the "Y" variable as an optional argument to the
Update_RCONST function (for F90 only).  If not passed, the C
concentration vector will be used.  This should now update the
concentrations at each integration timestep properly (unless
ICNTRL(15) = -1 is selected).

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
docs/requirements.txt
- Use jinja 3.1.4 as there is a dependabot security warning for
  the previous version 3.1.3.

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
src/gen.c
- Modified routine GenerateUpdateRconst so that the INLINED RCONST
  contents will be placed immedately after the start of the
  UPDATE_RCONST subroutine, and to place F90 variable declarations
  etc. immediately after that.  This will prevent compile-time errors
  if a USE statement is included via "INLINED RCONST", as USE
  statements must come before variable declarationas and other
  statements.
- Updated comments

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
src/gen.c
- Removed leftover comment about "int UPDATE_RCONST;" variable
- Fixed typo

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
src/gdata.h
- Declare F90_RCONST_USE as a variable of type "enum inl_code"

src/scanner.c
- Added F90_RCONST_USE to InlineKeys[]

src/gen.c
- In routine GenerateUpdateRconst we now proceed in this order:
  1. Manually write the "SUBROUTINE UPDATE_RCONST ( YIN )" line
  2. Inline code from the "#INLINE F90_RCONST_USE" section
  3. Declare YIN optional argument and Y local variable
  4. Copy values of YIN to Y (if necessary)
  5. Inline code from the "#INLINE F90_RCONST" section
  6. Manually write the "END SUBROUTINE UPDATE_RCONST" line

.gitignore
- Now ignore executable files in MCM example folders

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
.gitignore
- Ignore all *.exe files

src/gen.c
- Updated commments where inlined code is added to be more descriptive
  (referencing F90_RCONST_USE and F90_RCONST)

docs/source/using_kpp/04_input_for_kpp.rst
- Added documentation for F90_RCONST_USE

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This merge brings PR #120 (Add code from #INLINE F90_RCONST_USE at the top
of the UPDATE_RCONST subroutine, by @yantosca) into the KPP 3.2.0 development
stream.

This PR adds a new inline key (F90_RCONST_USE) so that USE statements
can be placed at the top of subroutine UPDATE_RCONST before any other
Fortran statements (as required by the language standard).

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
CHANGELOG.md
- Changed note about F90_RCONST_USE to be more general, as all
  inlined code comments have been updated to be more consistent
  in PR #122.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This merge brings PR #122 (Consistent comments for inlined code,
by @RolfSander) into the KPP 3.2.0 develpment stream.

This PR updates the BeginComment statements in src/gen.c towrite
comments stating where the inlined code is from (e.g. "Begin
inlined code from F90_RCONST"), etc.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
docs/source/getting_started/01_installation.html
- Add a line to add the path to the flex library to LD_LIBRARY_PATH
  in the Flex installation instructions.

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
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 <yantosca@seas.harvard.edu>
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 <yantosca@seas.harvard.edu>
docs/requirements.txt
- Updated RTD dependency jinja2 to version 3.1.5 (security fix)

docs/source/getting_started/00_revision_history.rst
- Added what's new in KPP 3.2.0 section
- Fixed tag position for KPP 3.1.0 anchor

docs/source/reference/known-bugs.rst
- Added links to both open and closed bug reports on GitHub
- Added a blurb that LSODE is not thread-safe under known issues

docs/source/tech_info/07_numerical_methods.rst
- Added warning that LSODE is not thread-safe

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This merge brings PR #125 (Add inlined code in the #INLINE F90_RCONST_USE
block to the Update_Photo routine, by @yantosca) into the KPP 3.2.0
development stream.

This PR introduces a bugfix. F90 USE statements that were added to
the #INLINE F90_RCONST_USE section are now placed at the top of
the Update_Photo routine (as they are in Update_Rconst).

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
src/Makefile
- Now print the value of SYSTEM_M variable in "make list" target
- Trimmed trailing whitespace

src/Makefile.defs
- Now use the $(strip) function when testing the values of SYSTEM
  and SYSTEM_M.  This will make sure that trailing whitespace is
  removed.  This was affecting the string equality tests.
- Add option "-arch x86_64" if compiling on Intel x86_64 chipsets
- Add option "-arch arm64" if compiling on Apple Silicon chipsets
- Trimmed trailing whitespace

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
int/sdirk.f90
- Original version has been deleted
- int/beuler.f90 is now renamed to int/sdirk.f90

int/beuler.f90
int/beuler.def
- Removed

docs/source/tech_info/07_numerical_methods.rst
- Added documentation instructing user to select #INTEGRATOR sdirk
  with ICNTRL(3) = 6 for Backwards Euler integration

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
int/sdirk.f90
- Indented & lined up code for readability
- Added () to subroutines taking no arguments
- Test if the method is Backward Euler (BEL) before multiplying
  the RoundOff variable by 101 when computing Hstart
- Trimmed trailing whitespace

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This merge brings PR # (Update int/sdirk.f90 to the same version
as was in int/beuler.f90, by @yantosca) into the KPP 3.2.0 development
stream.

This is the companion PR to #129. In this PR we do the following:

- Moved int/beuler.f90 to int/sdirk.f90, since the code in int/beuler.f90
  was a newer version of the SDIRK integrator module
- Removed int/beuler.def
- Updated documentation to instruct users wishing to select the
  Backwards Euler method to use #INTEGRATOR sdirk and set ICNTRL(3) = 6
- Only use 101*Roundoff in the computation for Hstart if the selected
  integration method is Backward Euler
- Trimmed trailing whitespace, indented code

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
docs/source/getting_started/00_revision_history.rst
- Added notes about beuler integrator being removed, and that
  users can use sdirk with ICNTRL(3)=6 to request Backward Euler

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This merge brings PR #127 (Fixed MacOS-specific handling for x86_64
or arm64 #127, by @yantosca) into the KPP 3.2.0 development stream.

This PR adds flags to the compiliation for building on MacOS under
x86_64 or arm64 architectures.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
docs/source/getting_started/00_revision_history.rst
- Added a line to KPP 3.2.0 about MacOS architecture specific build
  compiler flags

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This merge brings in documentation updates for the KPP 3.2.0
release into the release/3.2.0 branch.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
Updated version numbers in
- CHANGELOG.md
- docs/source/conf.py (for RTD documentation)
- src/gdata.h

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
@yantosca yantosca added the feature New feature or request label Feb 27, 2025
@yantosca yantosca added this to the 3.2.0 milestone Feb 27, 2025
@yantosca yantosca requested a review from RolfSander February 27, 2025 16:26
@yantosca yantosca self-assigned this Feb 27, 2025
Copy link
Contributor

@RolfSander RolfSander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@yantosca
Copy link
Contributor Author

Thanks @RolfSander!

@yantosca yantosca closed this Feb 27, 2025
@yantosca yantosca deleted the release/3.2.0 branch February 27, 2025 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants