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 TUV-x to CAM #784

Draft
wants to merge 94 commits into
base: cam_development
Choose a base branch
from

Conversation

mattldawson
Copy link
Collaborator

This PR contributes to #757 by including TUV-x in the CAM build and introducing a TUV-x wrapper to allow CAM-Chem photolysis rates to be calculated in-line by TUV-x. @stacywalters @tilmes @lkemmons @dkinnison

Using TUV-x for photolysis rate calculations in CAM runs is disabled pending science evaluation/implementation of:

  • cross section and quantum yield data sets
  • aerosol optical inputs to TUV-x
  • cloud optical inputs to TUV-x
  • heating rate calculations

This is my first CAM PR and I have some remaining questions about the correct way to do some things (which I will add as comments on this PR), so I'm leaving it in draft mode for now.

mattldawson and others added 30 commits October 6, 2022 10:02
Comment on lines 218 to 219
shutil.copytree(os.path.join(srcroot, "libraries", "musica", "lib", \
"tuv-x", "data"), dest_data)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are a large number of small data files for cross sections and quantum yields that are currently part of the TUV-x repo (but may eventually move to a database of some kind). These are not CAM-specific files and will be used by other models that link to TUV-x. Is this the correct way to stage them for use in a CAM run? @nusbaume @cacraigucar

Comment on lines +220 to +223
shutil.copy2(os.path.join(srcroot, "cime_config", "tuvx_MOZART.json"), \
os.path.join(rundir, "tuvx_MOZART.json"))
shutil.copy2(os.path.join(srcroot, "cime_config", "tuvx_MOZART_TS1.json"), \
os.path.join(rundir, "tuvx_MOZART_TS1.json"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There are two CAM-specific configuration files (each for specific MOZART chemical mechanisms) needed to use TUV-x in CAM. Should these be moved to the CAM dataset repository? @nusbaume @cacraigucar

Copy link
Collaborator

Choose a reason for hiding this comment

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

This handling for config files looks similar to what we originally did for GEOS-Chem. Ultimately we decided to keep the config files in the source code, copy them at case setup time to the case root via cam/cime_config/case.case_setup.py, and then copy from case root to run directory upon submit (via this code in buildnml). This is good if you think your config file template will be tied to source code version and you want users to be able to custom edit it prior to run-time(from case root).

Externals.cfg Outdated
@@ -21,9 +21,9 @@ externals = Externals.cfg
required = True

[cmeps]
tag = cmeps0.14.12
branch = develop-add-linked-libs
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is pending CMEPS PR 356

mattldawson and others added 6 commits February 1, 2024 10:13
* update to latest TUV-x

* add heating rate terms to config

* add heating rate calcs

* remove default output of photo rates

* remove default TUV-x output

* initialize heating rates to zero

* fix max sza type

* update TUV-x commit
…dexing (#10)

* link to cpp std lib

* fix CMake flag, update TUV-x, and fix aerosol wavelength grid use
@mnlevy1981
Copy link

Are there plans to bring biological effects in to this PR? @coupewx has coupled a version of WACCM4 with TUV (from @cbardeen) to POP in CESM2 to compute UV inhibition in ocean plankton groups; we would like to bring this work into CESM3 (with MOM6 instead of POP), and are trying to scope out what would be involved. If this update to CAM provides fields like UV index and phytoplankton damage per Cullen et al (see this block of code from the version of CAM he is currently using), that would reduce the workload on our end. We skimmed through the changes in this PR and didn't see anything - if we missed something, could you please point us to it?

@fvitt
Copy link

fvitt commented Jul 3, 2024

Are there plans to bring biological effects in to this PR? @coupewx has coupled a version of WACCM4 with TUV (from @cbardeen) to POP in CESM2 to compute UV inhibition in ocean plankton groups; we would like to bring this work into CESM3 (with MOM6 instead of POP), and are trying to scope out what would be involved. If this update to CAM provides fields like UV index and phytoplankton damage per Cullen et al (see this block of code from the version of CAM he is currently using), that would reduce the workload on our end. We skimmed through the changes in this PR and didn't see anything - if we missed something, could you please point us to it?

@dkinnison should weigh in on this

@fvitt
Copy link

fvitt commented Sep 9, 2024

@mattldawson
Is the version of TUVx used in your branch near the head of NCAR/tuv-x?
Do you have a test case for WACCM including the json file needed for Js and chemical heating?

args += "-DCMAKE_C_COMPILER_WORKS=1 "
args += "-DCMAKE_Fortran_COMPILER_WORKS=1 "
args += "-DCMAKE_CXX_COMPILER_WORKS=1 "
cmd = "cmake {} .".format(args)
Copy link

Choose a reason for hiding this comment

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

@mattldawson
I believe to get the correct compiler flags you need this line:

       args += "-DDEBUG={} ".format(build.get_value("DEBUG"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

5 participants