Skip to content

Testing updated RRTMGPInterface following RRTMGP changes to deep-atmosphere metrics #3779

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

Merged
merged 2 commits into from
May 2, 2025

Conversation

akshaysridhar
Copy link
Member

@akshaysridhar akshaysridhar commented Apr 21, 2025

Updated RRTMGPInterface to account for metric scaling correction for deep atmospheres

@akshaysridhar akshaysridhar force-pushed the as/test-rad-update branch 2 times, most recently from 0e11ab6 to 670131b Compare April 21, 2025 17:54
@akshaysridhar akshaysridhar force-pushed the as/test-rad-update branch 3 times, most recently from f199d7f to 636b176 Compare April 25, 2025 21:39
@akshaysridhar akshaysridhar force-pushed the as/test-rad-update branch 3 times, most recently from 9f7657d to bc74fda Compare April 30, 2025 21:40
@akshaysridhar akshaysridhar marked this pull request as ready for review April 30, 2025 22:09
@akshaysridhar
Copy link
Member Author

cc @sriharshakandala This is rebased and ready for review. The entire interface will be revamped shortly to match the new API changes in RRTMGP in future PRs.

Copy link

coderabbitai bot commented Apr 30, 2025

Walkthrough

This update enables deep atmosphere modeling by adding a deep_atmosphere boolean field to all radiation mode structs and extending the RRTMGPModel with a metric_scaling field. When deep atmosphere is active and spherical geometry is detected, a scaling factor based on planet radius and vertical coordinates is computed and passed through radiation solver calls. The configuration file is updated to set deep_atmosphere to true and add a mesh_warp_type. The rrtmgp_model_kwargs function now conditionally includes planet_radius for spherical geometries. The get_radiation_mode function passes the deep_atmosphere flag to radiation mode constructors. Additionally, the maximum allowed inference failures in a performance test is increased by one.

Suggested labels

enhancement


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91cacfb and 8cb0603.

📒 Files selected for processing (1)
  • reproducibility_tests/ref_counter.jl (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • reproducibility_tests/ref_counter.jl
⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: ci 1.11 - windows-latest
  • GitHub Check: ci 1.11 - macOS-latest
  • GitHub Check: ci 1.11 - ubuntu-latest
  • GitHub Check: ci 1.10 - windows-latest
  • GitHub Check: test (1.11)
  • GitHub Check: downstream ClimaCoupler.jl (1.11)
  • GitHub Check: ci 1.10 - macOS-latest
  • GitHub Check: docbuild
  • GitHub Check: downstream ClimaCoupler.jl (1.10)
  • GitHub Check: evaluate
  • GitHub Check: ci 1.10 - ubuntu-latest
  • GitHub Check: test (1.10)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
src/parameterized_tendencies/radiation/RRTMGPInterface.jl (1)

19-45: ⚠️ Potential issue

New deep_atmosphere field breaks zero-arg constructors

All four radiation-mode structs now require an extra deep_atmosphere::Bool, but the file still passes around instances created with zero arguments (GrayRadiation(), ClearSkyRadiation(), …).
Unless companion outer constructors were updated elsewhere, any call site that still does ClearSkyRadiation() will now throw a MethodError.

Add default constructors or make the new flag a keyword with a sensible default (false) to keep downstream code working.

♻️ Duplicate comments (1)
src/parameterized_tendencies/radiation/RRTMGPInterface.jl (1)

913-920: Same symbol/string mismatch here – see previous comment.
Fixing the guard to haskey(dict, :planet_radius) (and adding the early error) will make this block execute.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 05225a0 and bc74fda.

📒 Files selected for processing (5)
  • .buildkite/Manifest-v1.11.toml (5 hunks)
  • config/longrun_configs/amip_target_edonly.yml (1 hunks)
  • src/parameterized_tendencies/radiation/RRTMGPInterface.jl (16 hunks)
  • src/parameterized_tendencies/radiation/radiation.jl (4 hunks)
  • src/solver/model_getters.jl (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: ci 1.11 - windows-latest
  • GitHub Check: downstream ClimaCoupler.jl (1.11)
  • GitHub Check: test (1.11)
  • GitHub Check: downstream ClimaCoupler.jl (1.10)
🔇 Additional comments (12)
.buildkite/Manifest-v1.11.toml (5)

580-582: Package upgrade for CubedSphere

The CubedSphere package was updated from version 0.3.1 to 0.3.2, likely to support the deep atmosphere modeling functionality.


731-734: ExactPredicates dependency update

ExactPredicates package was updated to version 2.2.8 and now depends on StaticArrays instead of StaticArraysCore.


1158-1171: IntervalArithmetic dependency restructuring

IntervalArithmetic has undergone significant restructuring:

  • Removed several dependencies (FastRounding, LinearAlgebra, etc.)
  • Added new dependencies (MacroTools, OpenBLASConsistentFPCSR_jll)
  • Added weak dependencies and extension mappings

This update supports the numerical precision needed for deep atmosphere calculations.


1764-1768: New dependency added

Added OpenBLASConsistentFPCSR_jll package, which provides consistent floating-point control status registers for OpenBLAS operations. This supports more stable numerical computations required for deep atmosphere modeling.


2467-2469: TaylorSeries version update

TaylorSeries package updated from 0.18.5 to 0.19.1, providing improved polynomial approximation capabilities needed for deep atmosphere calculations.

config/longrun_configs/amip_target_edonly.yml (1)

5-6: Enable deep atmosphere mode

Added two important configuration parameters:

  1. deep_atmosphere: true - Enables deep atmosphere modeling which corrects for metric scaling
  2. mesh_warp_type: "SLEVE" - Specifies smooth level vertical (SLEVE) coordinate system

These changes are central to the purpose of this PR which tests updated RRTMGP interface for deep atmospheres.

src/parameterized_tendencies/radiation/radiation.jl (3)

109-111: Extract planet radius from spherical geometry

Added conditional logic to extract planet radius from the grid's global geometry when it's a spherical geometry. This parameter is crucial for deep atmosphere modeling.


123-134: Conditionally include planet radius in model parameters

Added conditional logic for the zkwargs named tuple to include the planet radius only when using spherical geometry. This ensures correct metric scaling for deep atmospheres while maintaining compatibility with other geometry types.


275-289: Consistent conditional planet radius handling

Implemented the same conditional planet radius logic in another overload of the function, maintaining consistency throughout the radiation model.

src/solver/model_getters.jl (2)

241-241: Extract deep_atmosphere parameter from config

Added code to extract the deep_atmosphere parameter from the parsed arguments. This is needed to pass the configuration setting to the radiation model constructors.


261-261: Propagate deep_atmosphere parameter to radiation modes

Updated all radiation mode constructors to include the deep_atmosphere parameter, ensuring the setting is properly propagated to:

  • GrayRadiation
  • ClearSkyRadiation
  • AllSkyRadiation
  • AllSkyRadiationWithClearSkyDiagnostics

This completes the connection between the configuration file and the radiation model implementation.

Also applies to: 263-268, 270-278, 280-288

src/parameterized_tendencies/radiation/RRTMGPInterface.jl (1)

1164-1182: Verify solver signatures after the new metric_scaling argument

solve_lw!/solve_sw! are now invoked with one extra positional parameter.
Please ensure every corresponding method in RRTMGP.RTESolver was updated accordingly; otherwise compilation will fail or, worse, the wrong method will be dispatched.

Also applies to: 1203-1252

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc74fda and 720d69e.

📒 Files selected for processing (6)
  • .buildkite/Manifest-v1.11.toml (5 hunks)
  • config/longrun_configs/amip_target_edonly.yml (1 hunks)
  • perf/jet_test_nfailures.jl (1 hunks)
  • src/parameterized_tendencies/radiation/RRTMGPInterface.jl (16 hunks)
  • src/parameterized_tendencies/radiation/radiation.jl (4 hunks)
  • src/solver/model_getters.jl (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • config/longrun_configs/amip_target_edonly.yml
  • src/solver/model_getters.jl
  • src/parameterized_tendencies/radiation/radiation.jl
  • .buildkite/Manifest-v1.11.toml
  • src/parameterized_tendencies/radiation/RRTMGPInterface.jl
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: ci 1.11 - windows-latest
  • GitHub Check: ci 1.11 - ubuntu-latest
  • GitHub Check: ci 1.10 - windows-latest
  • GitHub Check: ci 1.10 - ubuntu-latest
  • GitHub Check: downstream ClimaCoupler.jl (1.11)
  • GitHub Check: downstream ClimaCoupler.jl (1.10)
  • GitHub Check: test (1.11)
  • GitHub Check: test (1.10)
  • GitHub Check: evaluate

@akshaysridhar akshaysridhar force-pushed the as/test-rad-update branch 2 times, most recently from 1670d69 to 38fe2ca Compare May 1, 2025 17:18
	modified:   src/parameterized_tendencies/radiation/RRTMGPInterface.jl
	modified:   src/parameterized_tendencies/radiation/radiation.jl
	modified:   src/solver/model_getters.jl
	modified:   .buildkite/Manifest-v1.11.toml
	modified:   perf/jet_test_nfailures.jl
@sriharshakandala
Copy link
Member

This looks good to me overall.
We can revisit names during the RRTMGPInterface update.
On the tests, would this long run running stably be the only practical test?
Can we please run this in ClimaCoupler, check if this helps with the stability of amip runs in deep atmosphere setting.

@sriharshakandala
Copy link
Member

We might need to reset MSE tables.

@sriharshakandala sriharshakandala requested a review from Sbozzolo May 1, 2025 17:49
@akshaysridhar
Copy link
Member Author

akshaysridhar commented May 1, 2025

We might need to reset MSE tables

Indeed, this is behaviour changing for some spherical cases. I'm running a coupler 30 elem amip_edonly run on clima a100 as well which should serve as the downstream check.

@akshaysridhar
Copy link
Member Author

@sriharshakandala https://buildkite.com/clima/climacoupler-coarse-nightly-amip/builds/317/steps Here is the nightly build that exercises this. (The 30 elem case is still running)

Comment on lines +275 to +289
if ᶜspace.grid.global_geometry isa
Geometry.AbstractSphericalGlobalGeometry
kwargs = (;
kwargs...,
center_z = Fields.field2array(ᶜz),
face_z = Fields.field2array(ᶠz),
planet_radius = planet_radius,
)
else
kwargs = (;
kwargs...,
center_z = Fields.field2array(ᶜz),
face_z = Fields.field2array(ᶠz),
)
end
Copy link
Member

@dennisYatunin dennisYatunin May 1, 2025

Choose a reason for hiding this comment

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

Suggested change
if ᶜspace.grid.global_geometry isa
Geometry.AbstractSphericalGlobalGeometry
kwargs = (;
kwargs...,
center_z = Fields.field2array(ᶜz),
face_z = Fields.field2array(ᶠz),
planet_radius = planet_radius,
)
else
kwargs = (;
kwargs...,
center_z = Fields.field2array(ᶜz),
face_z = Fields.field2array(ᶠz),
)
end
kwargs = (;
kwargs...,
center_z = Fields.field2array(ᶜz),
face_z = Fields.field2array(ᶠz),
)
if ᶜspace.grid.global_geometry isa
Geometry.AbstractSphericalGlobalGeometry
planet_radius = ᶜspace.grid.global_geometry.radius
kwargs = (; kwargs..., planet_radius)
end

This could be a little less repetitive, and it would be clearer if you extracted planet_radius here instead of the beginning of the function. Same for the GrayRadiation method above.

@akshaysridhar akshaysridhar added this pull request to the merge queue May 2, 2025
Merged via the queue into main with commit 52734d3 May 2, 2025
19 checks passed
@akshaysridhar akshaysridhar deleted the as/test-rad-update branch May 2, 2025 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants