Skip to content

COSP-RTTOV integration with CAM#1327

Open
jshaw35 wants to merge 53 commits intoESCOMP:cam_developmentfrom
jshaw35:cam6_3_144_cosprttov
Open

COSP-RTTOV integration with CAM#1327
jshaw35 wants to merge 53 commits intoESCOMP:cam_developmentfrom
jshaw35:cam6_3_144_cosprttov

Conversation

@jshaw35
Copy link
Copy Markdown

@jshaw35 jshaw35 commented Jun 17, 2025

Closes #1324
Closes #1328

Requires cime6.1.106 or later

I have coupled the COSP-RTTOV satellite emulator with CAM and would like to pull it into the main code repository. This update to COSP significantly extends emulation capabilities and is described here: https://egusphere.copernicus.org/preprints/2025/egusphere-2025-169/

An important note: Integrating with COSP-RTTOV with CAM requires linking an external build of RTTOV to CESM during the build step and changes to CIME. This is further complicated by the fact that the RTTOV source code is free but only available to registered users and creating a new build is slow relative to a normal CESM build, so linking an existing RTTOV build during CESM build appears to be the best solution.

CIME fork here: https://github.com/jshaw35/cime/tree/cime6.0.217_httpsbranch02_cosprttov

@jshaw35 jshaw35 marked this pull request as draft June 17, 2025 21:33
jshaw35 and others added 19 commits June 30, 2025 13:20
Merged cospsimulator_intro.F90 and bld/configure by hand. Needs testing to see if COSP-RTTOV functionality is maintained, specifically regarding the treatment of cloud water/ice and effectively water and ice droplet sizes.
…ld dependencies, clean up obsolete cloud water fields.
…te descriptions. Remove commented line from bld/configure
… cosp.F90 this array should be:

"Height of bottom interface of atm layer(km). First level contains the bottom of the top layer. Last level contains the bottom of the surface layer."
Current CAM interface includes the top of the top layer and needs to be corrected.
This reverts commit 496a7ec.
This was a mistake too, I meant to revert the commit that merged recent
CAM updates.
…wer_change"

This reverts commit 9b98aac, reversing
changes made to 9ccd342.
@jshaw35
Copy link
Copy Markdown
Author

jshaw35 commented Jul 17, 2025

@cacraigucar I have now ported the COSP-RTTOV interface code to the cam_development branch. These changes make CAM compatible with the COSP-RTTOV branch that @dustinswales and I are currently reviewing before merging into the official COSPv2.0 repository. I've updated the CAM namelist options and logic as well.

I made the following tests for performance:

  • Bit-for-bit agreement for all COSPv2.0 variables compared to the normal cam_development.
  • COSPv2.0 outputs with and without satellite-like swathing are identical (e.g. swathing just puts nans in "unobserved" gridcells, answers are unchanged even though computing time should be significantly less).
  • RTTOV builds correctly and output is nearly identical to the CESM2.1.5 version that I validated for the COSP-RTTOV documentation paper.

This pull request also corrects an answer-changing model error (cospsimulator_intr.F90) in the assignment of the "hgt_matrix_half" field that COSPv2.0 uses. Per cosp.F90 this array should be:

Height of bottom interface of atm layer(km). First level contains the bottom of the top layer. Last level contains the bottom of the surface layer.

The current CAM interface sets the first level as the top of the top layer and allocates the array as length nlay+1 instead of nlay. This changes all fields that use the lidar_simulator subroutine (CALIPSO, PARASOL, etc) and RTTOV outputs.

I think that this PR is ready for a more detailed review! I will be traveling for work until August 28th and will be slow to respond during that time.

@jshaw35 jshaw35 marked this pull request as ready for review July 17, 2025 18:02
Copy link
Copy Markdown
Collaborator

@cacraigucar cacraigucar left a comment

Choose a reason for hiding this comment

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

Review items for us to discuss (if needed) at our meeting this afternoon

  • Also, we need to add a COSP_RTTOV regression test

Comment thread .gitmodules Outdated
Comment thread bld/config_files/definition.xml Outdated
Comment thread bld/namelist_files/namelist_definition.xml
Comment thread src/physics/cam/diffusion_solver_cam.F90
Comment thread src/physics/cam/cospsimulator_intr.F90 Outdated
Comment thread src/physics/cam/cospsimulator_intr.F90 Outdated
Comment thread src/physics/cam/cospsimulator_intr.F90 Outdated
Comment thread src/physics/cam/cospsimulator_intr.F90 Outdated
Comment thread src/physics/cam/cospsimulator_intr.F90 Outdated
Comment thread src/physics/cam/cospsimulator_intr.F90 Outdated
@cacraigucar
Copy link
Copy Markdown
Collaborator

@jshaw35 - You somehow removed the submodule information - I put it back in.

jshaw35 and others added 10 commits January 26, 2026 09:52
Made ERI test check for Gregorian+spinup compset incompatibility
…ogram outputs to 4d for outfld call. This commit addresses a bug that occurred when cosp_lradar_sim was set to true in user_nl_cam. This bug is likely in all versions of CAM because it is unrelated to swathing and RTTOV features.
…DIR)/build/Makefile.local directly into Makefile.rttov
Comment thread cime_config/buildlib Outdated
Comment thread src/physics/cosp2/COSP-RTTOV_examples/README.txt Outdated
@cacraigucar cacraigucar requested a review from nusbaume April 29, 2026 21:04
Copy link
Copy Markdown
Collaborator

@nusbaume nusbaume left a comment

Choose a reason for hiding this comment

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

Thanks for bringing in this major new capability @jshaw35 and @cacraigucar! I have some requests, but they should hopefully all be small or something we can push off as future work. Of course if you have any questions or concerns with any of my requests just let me know. Thanks again!

Comment thread bld/config_files/definition.xml Outdated
Comment thread bld/config_files/definition.xml Outdated
Comment thread bld/namelist_files/namelist_definition.xml Outdated
Comment thread bld/configure Outdated
Comment thread bld/configure Outdated
Comment thread src/physics/cosp2/COSP-RTTOV_examples/README.txt Outdated
Comment thread src/physics/cosp2/COSP-RTTOV_examples/README.txt Outdated
Comment thread cime_config/testdefs/testlist_cam.xml Outdated
Comment thread src/physics/cosp2/COSP-RTTOV_examples/README.txt Outdated
Comment thread src/physics/cam/cospsimulator_intr.F90 Outdated
@jshaw35
Copy link
Copy Markdown
Author

jshaw35 commented May 4, 2026

@cacraigucar @nusbaume I have responded to all of the the code review comments, thank you for taking the time to look through all of these changes! I also noticed the rttov_libdir is not actually used (RTTOVDIR set in Makefile.rttov instead). I pushed another commit that removes rttov_libdir entirely.

My draft of a future work section is below. Let me know if there is more to do.

To-do's:

Unify linking of RTTOV

Linking RTTOV with CAM/CESM is currently split between multiple locations (bld/configure and cime_config/buildlib). Specifically, linking with hdf5 occurs in buildlib (where hdf5_lib_path can be accessed) and linking with the externally-compiled RTTOV libraries occurs in configure (where cosp_libdir can be accessed). Future work should unify these steps.

Generalize and clean up RTTOV compiling script (src/physics/cosp2/COSP-RTTOV_examples/compile_RTTOV.sh)

Notes:
Future work should generalize and cleanup this script. For example using Intel or GNU for both Fortran and C code, instead of one for each, or alternatively see about replacing it entirely with something like CMake.

The "arch" file that is created in compile_RTTOV.sh is a direct copy of those provided in the official RTTOV source code that was adapted to ifx in order to compile/link RTTOV on Derecho. Adjusting this code makes it less consistent with other RTTOV files, but perhaps that is not a problem.

Clean up flags in src/physics/cosp2/Makefile.rttov:

Notes:
FFLAGS= -I$(RTTOVDIR)/mod -I$(RTTOVDIR)/include -fPIC -O3 -fopenmp
LDFLAGS_ARCH=-fopenmp

openmp is likely not needed because RTTOV is built in a standard configuration without parallel capabilities (linking and running with parallel RTTOV did not improve performance during development, but has not been tested recently). O3 is also likely not needed.

Copy link
Copy Markdown
Collaborator

@nusbaume nusbaume left a comment

Choose a reason for hiding this comment

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

Thanks @jshaw35! Everything looks good to me now.

Cheryl and I will work on what are hopefully some finishing touches to our official regression test tomorrow (you probably got an invite). If everything goes well then we should hopefully have this PR officially merged in later this week. Thanks again for all your help on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants