[#1325] Added relative velocity atmo in cannonballDrag#1327
[#1325] Added relative velocity atmo in cannonballDrag#1327carlo98 wants to merge 1 commit intoAVSLab:developfrom
Conversation
|
Thanks Carlo for the PR. I think it's a great step to undo the assumption of a stationary atmosphere. However, I think we can take this idea and make it more generic to support arbitrary wind models relatively easily. The main functional change in this pr is: is now (paraphrasing a bit): I think we could improve this module further by not baking in the assumption that we want a co-rotating atmosphere model of the local wind, and instead take that local wind If the model takes in an arbitrary then we could add a new, very simple model The clear benefit is that this opens the door for arbitrary wind models to work in our simulation. NOTE: take the code above with a grain of salt, just a quick sketch of the final product. Feel free to improve as you see fit. For example, in keeping with our environmental models pattern, I would add a |
|
Interesting idea @juan-g-bonilla , if we do all this math, and we have several modules that could use this info, I wonder if we should have a separate module that computes the relative wind that can be fed to drag cannon ball model, faceted model, etc? This way we are not duplicating all this functionality in each module? |
Exactly. We should have a set of modules that compute the wind at some location in the atmosphere (like we have several modules that compute the density at some location) that all feed a wind vector to the drag models (cannonBall, facet, etc.). It would actually reduce repetition of math in PR #1326 and #1327 . |
|
Ok, so I can implement that new simple module (CorotatingAtmosphereWindModel) and windBase in a new PR and then update this one and #1326 . I'm going to convert #1326 and #1327 into drafts while working on the wind module. Does it sound good? @juan-g-bonilla @schaubh Also, to update dragDynamicEffector do you want me to open another PR or use one of these? |
Sounds good to me, thanks for the push! |
Description
Adds optional atmosphere-relative velocity support to
cannonballDrag, allowing drag to be computed against the rotating atmosphere rather than the inertial frame.Key implementation details reviewers should be aware of:
Default behavior is unchanged: The new feature is opt-in. Existing users keep the current inertial-velocity behavior by default (
useAtmosphereRelativeVelocity = false).Relative-velocity formulation: When enabled, the module computes
v_rel = v_sc - (planetOmega_N x r_sc)before transforming into the site frame and evaluating the cannonball drag force and torque.Earth default, configurable for other bodies:
planetOmega_Ndefaults to[0, 0, OMEGA_EARTH], so Earth cases work without extra configuration. Non-Earth cases can override this vector from Python viasetPlanetOmega_N.Getter and setter methods:
setUseAtmosphereRelativeVelocity/getUseAtmosphereRelativeVelocityandsetPlanetOmega_N/getPlanetOmega_Nare exposed to Python via SWIG.Verification
Added
test_cannonballDragAtmoRelVelDisabled: confirms drag is unchanged whenuseAtmosphereRelativeVelocity = Falseand matches the analytical inertial-velocity cannonball drag formula.Added
test_cannonballDragAtmoRelVelEnabled: confirms the computed force matches a reference whenuseAtmosphereRelativeVelocity = True, verifying thatomega x ris correctly subtracted from the inertial velocity before evaluating drag.Extended the integration test
test_orbit: parametrized overuseRelVel = [False, True],orbitCase = ["LPO", "LTO"], andplanetCase = ["earth", "mars"], comparing the module output to an independent reference implementation at every simulation step over a full orbital period.Documentation
cannonballDrag.rstwith the atmosphere-relative velocity formulation, including thev_relequation, Earth-default note, non-Earth configuration note, and description of the detailed per-step behavior.Future work
planetOmega_Nautomatically from Spice kernels.