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

Add KPP Standalone into GEOS-Chem 14.5.1 #2588

Merged
merged 44 commits into from
Dec 2, 2024

Conversation

yantosca
Copy link
Contributor

@yantosca yantosca commented Nov 22, 2024

Name and Institution (Required)

Name: Bob Yantosca
Institution: Harvard + GCST

Describe the update

This PR brings the updates that were formerly in geos-chem PR #2382 and geos-chem PR #2383 into the dev/no-diff-to-benchmark branch. These will ship in 14.5.1.

Expected changes

This is a zero-diff update

Related Github Issue

Obin Sturm and others added 30 commits September 26, 2024 14:44
Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
run/shared/kpp_standalone_interface.yml
- Fixed typo: "output_dir" -> "output_directory"

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
GeosCore/fullchem_mod.f90
- Use keyword arguments, for clarity

GeosCore/kpp_standalone_interface.F90
- Remove Active_Cell and Active_Cell_Name from KPP_Standalone_YAML
- Add new derived type KPP_Standalone_ActiveCell_Type, which is now
  declared with !$OMP THREADPRIVATE.  This contains the Active_Cell
  and Active_Cell_Name fields.
- Added new variable KPP_Standalone_ActiveCell, based on
  new KPP_Standalone_ActiveCell_Type

NOTE: The KPP_Standalone_YAML is initialized outside of a parallel
loop, so it does not need to be declared !$OMP THREADPRIVATE.  But the
choice of whether an (I,J,L) location corresponds to one of the
"active_cells" (listed in the kpp_standalone_interface.yml file) happens
within a parallelized loop.  Thus we need to move the Active_Cell and
Active_Cell_Name fields out of KPP_Standalone_YAML and into
KPP_Standalone_ActiveCell.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
run/shared/kpp_standalone_interface.yml
- Reorganize file so that "settings:" comes first, then "active_cells:",
  and then "locations:"
- Add "settings:activate" YAML tag to toggle the KPP standalone
  interface on or off

GeosCore/kpp_standalone_interface.F90
- Add call to QFYAML_Add_Get to parse the "settings:activate" YAML tag
- Set KPP_Standalone_YAML%SkipIt to .TRUE. if "settings:activate"
  is false.  This will cause the code to ignore saving out the state
  of the model for the KPP standalone even if kpp_standalone_interface.yml
  is present in the run directory.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
run/GCClassic/createRunDir.sh
- Copy run/shared/kpp_standalone_interface.yml to fullchem rundirs

run/shared/cleanRunDir.sh
- Skip removing bpch files (and {diag,tracer}info.dat files), we no
  longer generate bpch output
- Add comments and usage examples
- Remove all fort.* files
- Remove OututDir/*.txt files as well (these are KPP standalone
  interface files)

CHANGELOG.md
- Updated accordingly

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

GeosCore/fullchem_mod.F90
- Remove State_Grid from call to Check_ActiveCell

GeosCore/kpp_standalone_interface.F90
- Updated subroutine header comments
- Added cosmetic changes for clarity (mostly making code fit within
  80 characters, for better readability)
- Removed Active_Cell and Active_Cell_name from the
  KPP_Standalone_Interface_Type (should have been done previously)
- Remove State_Grid argument from Check_ActiveCell, this was only
  used for debugging.   Also removed commented out debug prints.
- Use Format statements with write statments where expedient
- Echo a message when the KPP standalone interface is manually disabled
  (i.e. when settings:activate = false)
- Added display of location names and lon/lats at end of the routine
  Config_KPP_Standalone
- In routine Write_Samples, wrap file I/O in an !$OMP CRITICAL block,
  in order to prevent more than one thread from writing to each file.
- Removed RETURN statement from within !$OMP CRITICAL block, this
  is not allowed.
- Bug fix: Write Kpp_Standalone_ActiveCell%Active_Cell_Name to file,
  and not Kpp_Standalone_YAML%Active_Cell_Name (which has been removed).

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
GeosCore/kpp_standalone_interface.F90
- Moved to kppsa_interface_mod.F90

GeosCore/kppsa_interface_mod.F90
- Moved from kpp_standalone_interface
- Renamed types, variables and routines using "KppSa" prefix:
  - KPP_Standalone_Interface_Type -> KppSa_Interface_Type
  - KPP_Standalone_ActiveCell_Type -> KppSa_ActiveCell_Type
  - KPP_Standalone_YAML -> KppSa_State
  - KPP_Standalone_ActiveCell -> KppSa_ActiveCell
  - Check_Domain -> KppSa_Check_Domain
  - Check_ActiveCell -> KppSa_Check_ActiveCell
  - Config_KPP_Standalone -> KppSa_Config
  - Write_Samples -> KppSa_Write_Samples
  - Cleanup_KPP_Standalone -> KppSa_Cleanup
- Added KppSa_Check_Time function to determine if it is time to
  write KPP standalone output.  This allows you to only write output
  e.g. at the end of a run instead of for each timestep.
- Added KppSa_State%SkipWriteAtThisTime field, which is used to
  determine if we need to exit a routine early.

GeosCore/fullchem_mod.F90
- "USE Kpp_Standalone_Interface" -> "USE KppSa_Interface_Mod"
- Call renamed routines from kppsa_interface_mod.F90
- Now call KppSa_Check_Domain only if it is the first call to
  DO_FULLCHEM.  This is to avoid repeated computations.
- Now call KppSa_Check_Time to determine if we are in the time window
  when the model state should be archived to disk.
- Updated comments and comment headers

run/shared/kpp_standalone_interface.yml
- Added "start_output_at" to denote starting date time for archiving
  model state
- Added "stop_output_at" to denote ending date time for archiving
  model state
- Updated comments

CHANGELOG.md
GeosCore/CMakeLists.txt
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
GeosCore/kppsa_interface_mod.F90
- In routine KppSa_Check_Time:
  - rRmoved leftover debug print statements
- In routine Kpp_Check_ActiveCell
  - Added an IF statement to exit after setting KppSa_State%Active_Cell to .FALSE.
    and  KppSa_Active_Cell_Name to '' if we are outside of the time
    window specified in the kpp_standalone_interface.yml fiel.
  - This will ensure that we only archive model state to disk during
    the specified time window, which helps with computatonal efficiency.
- In routine KppSa_Config:
  - Now write starting & ending date of archival window to log file

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
run/GCHP/createRunDir.sh
- Added an if statement to copy run/shared/kpp_standalone_interface.yml
  to GCHP fullchem run directories (any option)

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
Changed the CEDS TMB emission fields to actually emit TMB like they're supposed to, instead of emitting HCOOH. I'm not sure if this fix needs to go into any other HEMCO_Config.rc template files, either in run/GCClassic or in other run/ directories, but hopefully we can make any other necessary changes down the line
KPP/standalone
- Folder which contains source code from the GitHub repository:
  https://github.com/geoschem/KPP-Standalone.  This is a fork of
  the https://github.com/KineticPreProcessor/KPP-Standalone repo
  by Obin Sturm, Mike Long, and Christoph Keller.  The branch
  geoschem-dev is checked out.  This is where we can place
  GEOS-Chem-specific updates without touching the original code
  in the kpp-standalone branch.
  branch is set to geoschem-dev, which is the branch to be used
  for interfacing into the GEOS-Chem model

.gitmodules
- This was updated by running the command:
  git submodule add -b geoschem-dev \
    https://github.com/geoschem/KPP-Standalone \
    KPP/standalone

CHANGELOG.md
- Updated accordingly

KPP/fullchem/Makefile
KPP/fullchem/kpp_standalone*.F90
KPP/fullchem/samples_kpp_standalone/*
- Removed from the KPP/fullchem folder.

KPP/standalone
- Folder containing code from https://github.com/geoschem/KPP-Standalone

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
KPP/CMakeLists.txt
- Add calls to "add_directory(standalone)" in the fullchem and
  custom "if" blocks.  This will tell CMake to look for the
  CMakeLists.txt file in the KPP/standalone folder, and to build
  the standalone files (libKppStandalone.a) after libKPP.a has
  been built.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
Changed the CEDS TMB emission fields to actually emit TMB like they're supposed to, instead of emitting HCOOH.
Changed the CEDS TMB emission fields to actually emit TMB like they're supposed to, instead of emitting HCOOH.
This merge brings PR #2483 (KPP standalone from Obin Sturm,
by @obin1 and @lizziel) into the GEOS-Chem 14.6.0 development stream.

This PR does the following:

1. Adds submodule https://github.com/geoschem/KPP-Standalone
   in the KPP/standalone folder

2. Updates KPP/CMakeListst.txt to build the KPP standalone
   executable when the GEOS-Chem executable is built
   (currently only for fullchem or custom mechanisms)

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This merge brings PR #2482 (KPP standalone interface from Obin
Sturm, by @lizziel) into the GEOS-Chem 14.5.1 development stream.

This PR brings the interface for the KPP standalone box model
into GEOS-Chem 14.6.0.  A new kpp_standalone_interface.yml file
is placed into the run directory.  In this YAML file, the user
can select the locations and times for archiving model state
to text files that can be fed into the KPP standalone model.

Also the writing of files is now done in a thread-safe manner.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This merge brings PR #2483 (KPP standalone from Obin Sturm,
by @obin1 and @lizziel) into the GEOS-Chem 14.5.1 development
stream.

This PR does the following:

1. Adds submodule https://github.com/geoschem/KPP-Standalone
   in the KPP/standalone folder

2. Updates KPP/CMakeListst.txt to build the KPP standalone
   executable when the GEOS-Chem executable is built
   (currently only for fullchem or custom mechanisms)

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
This commit informs the GEOS-Chem repository about the following
commits that were pushed to the geoschem/KPP-Standalone repo:

cfccbe7 (HEAD -> geoschem-dev, origin/geoschem-dev) Remove build_executable.sh from geoschem-dev branch
337668e Merge kpp-standalone into geoschem-dev (14.5.0 mechanism)

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
@yantosca yantosca added category: Feature Request New feature or request topic: Chemical Mechanisms Related to KPP and/or GEOS-Chem chemistry mechanisms no-diff-to-benchmark This update will not change the results of fullchem benchmark simulations labels Nov 22, 2024
@yantosca yantosca requested a review from lizziel November 22, 2024 17:21
@yantosca yantosca self-assigned this Nov 22, 2024
.gitmodules Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
GeosCore/fullchem_mod.F90 Outdated Show resolved Hide resolved
run/shared/cleanRunDir.sh Outdated Show resolved Hide resolved
run/shared/cleanRunDir.sh Show resolved Hide resolved
.gitmodules
- Now pull the "GC_Interface" tag instead of the geoschem-dev branch

GeosCore/fullchem_mod.F90
- Removed unused code

run/shared/cleanRunDir.sh
- Updated comments in header.  Now use --force (but any non-empty
  argument) will cause files to be removed w/o user confirmation.

CHANGELOG.md
- Updated accordingly

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
CHANGELOG.md
- Now note that we pull the KPP-Standalone repo from the
  "GC_Interface" tag, not a branch.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
@yantosca yantosca requested a review from lizziel November 22, 2024 20:01
.gitmodules Outdated Show resolved Hide resolved
@yantosca yantosca requested a review from lizziel December 2, 2024 15:42
.gitmodules
- Removed the "tag = GC_Interface" line.  We only need to use the URL,
  as we will commit the hash that points to the most recent commit
  in the KPP-Standalone repo.


Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
CHANGELOG.md
- We no longer require to check out the GC_Interface tag for
  the KPP-Standalone submodule.  We have made the corresponding
  edit to the CHANGELOG.md file.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Feature Request New feature or request no-diff-to-benchmark This update will not change the results of fullchem benchmark simulations topic: Chemical Mechanisms Related to KPP and/or GEOS-Chem chemistry mechanisms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants