Skip to content

Earth Radiation Pressure and Planet Radiation Base. Albedo uses PlanetRadiationBase#1351

Merged
schaubh merged 5 commits into
AVSLab:developfrom
carlo98:feature/earth_RP_IR
Jun 11, 2026
Merged

Earth Radiation Pressure and Planet Radiation Base. Albedo uses PlanetRadiationBase#1351
schaubh merged 5 commits into
AVSLab:developfrom
carlo98:feature/earth_RP_IR

Conversation

@carlo98

@carlo98 carlo98 commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Description

This PR introduces Earth Radiation Pressure (ERP) support in Basilisk through three changes:

  1. planetRadiationBase - a new base class (_GeneralModuleFiles/planetRadiationBase.{h,cpp,.rst}) that abstracts shared logic for planet radiation models (patch discretisation, solar flux computation, visibility checks). Both the refactored albedo module and the new earthRadiationModel inherit from it.

  2. earthRadiationModel - a new environment module (src/simulation/environment/earthRadiationModel/) implementing the Knocke et al. (1988) patch model. It discretises the visible Earth disk into latitude/longitude zones and accumulates shortwave (albedo) and longwave (IR/OLR) fluxes, plus flux-weighted net force direction vectors, into the new EarthRadiationMsgPayload output message. These outputs are intended to feed a DynamicEffector.

  3. albedo refactor - the existing albedo module is rewritten to derive from planetRadiationBase, removing duplicated patch geometry code. The public API is updated (eclipseCase is now set via setEclipseCase()). Added a deprecation message and unittest for eclipseCase as a public member.

EarthRadiationMsgPayload.h is also added to src/architecture/msgPayloadDefC/ to define the new output message structure.

Verification

  • New pytests test_earthRadiationModel.py cover:
    • Physics sanity checks for albedo and IR fluxes against analytical estimates.
    • Direction vector normalisation when flux is non-zero.
    • Correct behaviour with unlinked optional messages.
    • Error handling for invalid albedo data files (expects BasiliskError).
    • A NumPy reference implementation cross-check run with and without albedo data files.
  • The existing test_albedo.py was updated by one line to use the new setEclipseCase() setter; all other albedo tests are unchanged and still pass.

Documentation

  • earthRadiationModel.rst - new module doc.
  • planetRadiationBase.rst - new base class doc.
  • albedo.rst - Added a deprecation message and unittest for eclipseCase as a public member.

Future work

  • Implement DynamicEffector to consume EarthRadiationMsgPayload and apply the ERP force/torque to spacecraft.
  • Consider adding an integration/scenario test pairing earthRadiationModel with a spacecraft dynamics simulation to validate force magnitudes.

@carlo98

carlo98 commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6862c1fc00

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/simulation/environment/albedo/albedo.cpp Outdated
Comment thread src/simulation/environment/_GeneralModuleFiles/planetRadiationBase.cpp Outdated
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from 6862c1f to d800bf1 Compare April 7, 2026 22:35
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 8, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from d800bf1 to 7ce5123 Compare April 8, 2026 14:26
@carlo98

carlo98 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ce51235cf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/simulation/environment/albedo/albedo.cpp Outdated
Comment thread src/simulation/environment/_GeneralModuleFiles/planetRadiationBase.cpp Outdated
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 9, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from 7ce5123 to 029a21b Compare April 9, 2026 16:28
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 9, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from 029a21b to 32fed88 Compare April 9, 2026 16:58
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 9, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from 32fed88 to ad1d54c Compare April 9, 2026 21:11
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 23, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from ad1d54c to b9a59e1 Compare April 23, 2026 17:40
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 23, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from b9a59e1 to d285fbf Compare April 23, 2026 18:14
@carlo98

carlo98 commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d285fbf037

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/simulation/environment/albedo/albedo.cpp Outdated
Comment thread src/simulation/environment/albedo/_UnitTest/test_albedo.py Outdated
@carlo98 carlo98 changed the title [#1345] Earth Radiation Pressure and Planet Radiation Base. Albedo uses PlanetRadiationBase Earth Radiation Pressure and Planet Radiation Base. Albedo uses PlanetRadiationBase Apr 23, 2026
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 23, 2026
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 23, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from d285fbf to 5b2176a Compare April 23, 2026 22:30
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 24, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from 5b2176a to 4a64bee Compare April 24, 2026 19:32
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 24, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from 4a64bee to ee1f901 Compare April 24, 2026 21:25
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 27, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from ee1f901 to ca82e5d Compare April 27, 2026 16:29
carlo98 added a commit to carlo98/basilisk that referenced this pull request Apr 27, 2026
@carlo98 carlo98 marked this pull request as ready for review May 21, 2026 14:21
@carlo98 carlo98 requested a review from a team as a code owner May 21, 2026 14:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a8e4666d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/simulation/environment/_GeneralModuleFiles/planetRadiationBase.cpp Outdated
@schaubh schaubh self-assigned this May 21, 2026
@schaubh schaubh self-requested a review May 21, 2026 14:35
@schaubh schaubh added the enhancement New feature or request label May 21, 2026
@schaubh schaubh added this to Basilisk May 21, 2026
@schaubh schaubh moved this to 👀 In review in Basilisk May 21, 2026

@schaubh schaubh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work. This is an interesting refactor of albedo and adding new functionality for planet radiation pressure forces in the future.

Question. you have a module called earthRadiationModel. Why is this specific to Earth? Couldn't this be written to be a generic planetRadiationModel where the use then can configure this to be for Earth?

Comment thread src/architecture/utilities/astroConstants.h Outdated
Comment thread src/architecture/msgPayloadDefC/EarthRadiationMsgPayload.h Outdated
Comment thread src/simulation/environment/_GeneralModuleFiles/planetRadiationBase.cpp Outdated
Comment thread src/simulation/environment/_GeneralModuleFiles/planetRadiationBase.rst Outdated
Comment thread src/simulation/environment/albedo/albedo.rst
carlo98 added a commit to carlo98/basilisk that referenced this pull request Jun 8, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from 6a8e466 to 851c35c Compare June 8, 2026 07:21
carlo98 added a commit to carlo98/basilisk that referenced this pull request Jun 9, 2026
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from 851c35c to e2bc0d7 Compare June 9, 2026 07:46
carlo98 added a commit to carlo98/basilisk that referenced this pull request Jun 9, 2026
@carlo98 carlo98 requested a review from schaubh June 10, 2026 07:17

@schaubh schaubh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One minor documentation changes.

I pushed two commits to address two issues I came across. Let me know if you approve. I pushed the commits to your branch.

Comment thread src/simulation/environment/earthRadiationModel/earthRadiationModel.rst Outdated
schaubh added a commit to carlo98/basilisk that referenced this pull request Jun 10, 2026
Track whether PlanetGrid::initialize() completed successfully and clear cached
grid data when initialization is retried. Have direct computePatches() calls
raise BasiliskError if the grid is not initialized or cached patch data is
inconsistent.

Add a Python regression test for the direct PlanetGrid API failure path.
schaubh added a commit to carlo98/basilisk that referenced this pull request Jun 10, 2026
Replace hard-coded solar radiation flux values in the Python and C orbitalMotion
solarRad helpers with the shared Basilisk constants. The Python helper now reads
astroFunctions.solarFluxEarth, while the C helper uses SOLAR_FLUX_EARTH from
astroConstants.h.
@schaubh schaubh force-pushed the feature/earth_RP_IR branch from 6aa1e1d to 0434f53 Compare June 10, 2026 17:44
carlo98 added a commit to carlo98/basilisk that referenced this pull request Jun 11, 2026
@carlo98

carlo98 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

One minor documentation changes.

I pushed two commits to address two issues I came across. Let me know if you approve. I pushed the commits to your branch.

Thank you! The commits are ok for me

carlo98 and others added 5 commits June 11, 2026 09:10
Track whether PlanetGrid::initialize() completed successfully and clear cached
grid data when initialization is retried. Have direct computePatches() calls
raise BasiliskError if the grid is not initialized or cached patch data is
inconsistent.

Add a Python regression test for the direct PlanetGrid API failure path.
Replace hard-coded solar radiation flux values in the Python and C orbitalMotion
solarRad helpers with the shared Basilisk constants. The Python helper now reads
astroFunctions.solarFluxEarth, while the C helper uses SOLAR_FLUX_EARTH from
astroConstants.h.
@carlo98 carlo98 force-pushed the feature/earth_RP_IR branch from e457479 to 9c2f4fe Compare June 11, 2026 07:10
@carlo98 carlo98 requested a review from schaubh June 11, 2026 07:41
@schaubh schaubh merged commit 1db9c1f into AVSLab:develop Jun 11, 2026
7 checks passed
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: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants