C++ Module: stochasticDragCoeff

Executive Summary

The StochasticDragCoeff module applies scalar mean-reverting stochastic noise to aerodynamic drag coefficient by specializing MeanRevertingNoise. It perturbs dragCoeff in a DragGeometryMsgPayload and republishes the modified geometry message.

Message Interfaces

stochasticDragCoeff module input and output messages

Module I/O Messages

Msg Variable Name

Msg Type

Description

dragGeomInMsg

DragGeometryMsgPayload

Input drag geometry message containing dragCoeff, projected area, and center-of-pressure data.

dragGeomOutMsg

DragGeometryMsgPayload

Output drag geometry message with stochastic correction applied to dragCoeff.

Module Description

The inherited Ornstein-Uhlenbeck state \(x\) evolves as

\[\text{d}x = -\frac{1}{\tau}x\,\text{d}t + \sqrt{\frac{2}{\tau}}\sigma_{st}\,\text{d}W\]

The output drag coefficient is

\[C_{D,\text{out}} = C_{D,\text{in}}(1 + x)\]

The remaining geometry fields are passed through unchanged.

Verification and Testing

The module is validated in src/simulation/mujocoDynamics/stochasticDragCoeff/_UnitTest/test_stochasticDragCoeff.py by checking that the output drag coefficient time series has the expected OU statistics (mean, variance, and correlation time) for a constant nominal drag geometry input.


class StochasticDragCoeff : public MeanRevertingNoise
#include <stochasticDragCoeff.h>

Applies a mean-reverting Ornstein–Uhlenbeck correction to the drag coefficient.

Derives from MeanRevertingNoise. Scales the incoming drag coefficient by \((1 + x)\), where \(x\) is the OU state maintained by the base class. All other geometry fields are passed through unchanged.

Public Members

ReadFunctor<DragGeometryMsgPayload> dragGeomInMsg

Input drag geometry message.

Read each step to obtain the nominal geometry and coefficient.

Message<DragGeometryMsgPayload> dragGeomOutMsg

Output drag geometry message with corrected drag coefficient.

Protected Functions

void writeOutput(uint64_t CurrentSimNanos, double x) override

Apply the OU correction to \(C_D\) and write the result.

Called by MeanRevertingNoise::UpdateState after drift and diffusion are set.

Parameters:
  • CurrentSimNanos – Simulation time in nanoseconds.

  • x – Current scalar correction factor.