Skip to content

Feature/1004 stochastic dynamics #1005

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

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

juan-g-bonilla
Copy link
Contributor

@juan-g-bonilla juan-g-bonilla commented May 28, 2025

Description

This PR introduces support for stochastic differential equations (SDEs) in the Basilisk simulation framework. The main changes include:

  • State Diffusion Support: The state machinery (StateData, DynParamManager, ExtendedStateVector, etc.) is extended to support setting and propagating the diffusion term (g_i) for multiple noise sources, in addition to the deterministic drift (f).
  • Stochastic Integrators: Implements weak second-order stochastic Runge-Kutta (SRK) integrators, specifically the methods described by Tang & Xiao (2017), including both W2-Ito1 and W2-Ito2 schemes. These are available as svStochIntegratorW2Ito1 and svStochIntegratorW2Ito2. Also implements the Euler-Mayurama integrator (available in svStochIntegratorMayurama.
  • Noise Source Management: Adds machinery to register and share noise sources between states, allowing for correlated stochastic processes across different states.
  • DynamicObject Interface: Adds equationsOfMotionDiffusion to DynamicObject and relevant subclasses, enabling models to compute the diffusion term.
  • MuJoCo Integration: Updates the MuJoCo scene and state classes to support stochastic integration, including proper propagation of diffusions.
  • spacecraft Integration: equationsOfMotionDiffusion calls the regular equationsOfMotion so that stateEffectors can set the diffusion of states.
  • Python Bindings: Updates SWIG interfaces and Python helper functions to expose the new stochastic integrators and noise management features.
  • Unit Test: Adds a new test (test_stochasticIntegrators.py) that demonstrates and validates the new stochastic integration capabilities.
  • Scenario: Adds a new scenario scenarioStochasticDrag.

Commits are organized by subsystem: core state machinery, integrator implementation, MuJoCo support, Python bindings, and tests.

Verification

  • Automated Tests: Added a new unit test (test_stochasticIntegrators.py) that exercises the stochastic integrator on a simple exponential system and an example from the reference paper. The test compares Basilisk's results to a pure Python implementation.
  • Backwards Compatibility: Existing deterministic integrators and state propagation remain unaffected.

Documentation

  • Code Documentation: All new classes and methods are documented inline with Doxygen-style comments. Python methods have docstrings.
  • Scenario: scenarioStochasticDrag illustrates how to use a stochastic state.

Future work

  • Additional Integrators: Implement strong-order stochastic integrators, support for adaptive time-stepping, Stratonovich noise integrators...

@juan-g-bonilla juan-g-bonilla self-assigned this May 28, 2025
@juan-g-bonilla juan-g-bonilla requested a review from a team as a code owner May 28, 2025 13:50
@juan-g-bonilla juan-g-bonilla added enhancement New feature or request dont merge Waiting on other changes before merging labels May 28, 2025
@juan-g-bonilla juan-g-bonilla moved this to 🏗 In progress in Basilisk May 28, 2025
@juan-g-bonilla juan-g-bonilla force-pushed the feature/1004-stochastic-dynamics branch from 49fb9e9 to c1474a0 Compare June 1, 2025 06:16
@juan-g-bonilla juan-g-bonilla moved this from 🏗 In progress to 👀 In review in Basilisk Jun 1, 2025
@juan-g-bonilla juan-g-bonilla changed the title Feature/1004 stochastic dynamics [DRAFT] Feature/1004 stochastic dynamics Jun 1, 2025
@juan-g-bonilla juan-g-bonilla force-pushed the feature/1004-stochastic-dynamics branch from c1474a0 to 1a49412 Compare June 1, 2025 07:03
@juan-g-bonilla juan-g-bonilla removed the dont merge Waiting on other changes before merging label Jun 1, 2025
@juan-g-bonilla juan-g-bonilla requested a review from schaubh July 7, 2025 15:12
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: 👀 In review
Development

Successfully merging this pull request may close these issues.

Support Stochastic Integration
1 participant