Drag forces for Python Wrapper

Hi there,

I am currently trying to add drag forces to a propagator but I keep running into some errors.

First of all, I tried this:

atm = DSSTAtmosphericDrag.getAtmosphere()
area = DSSTAtmosphericDrag.getArea()
cd = DSSTAtmosphericDrag.getCd()
scr = SphericalSpacecraft(area, cd, 0., 0.)
drag = DragForce(atm, scr)
propagator.addForceModel(DSSTAtmosphericDrag)

However, received this error:

ModuleNotFoundError: No module named 'org.orekit.forces.SphericalSpacecraft'; 'org.orekit.forces' is not a package

I also tried:

avg = drag.MarshallSolarActivityFutureEstimation.StrengthLevel.AVERAGE
sflux = drag.MarshallSolarActivityFutureEstimation("Jun2016F10.txt", avg)
atmosphere = drag.DTM2000(sflux, sun, earthBody)
dragForce = drag.DragForce(atmosphere, satmodel)

but then received this error:

AttributeError: module 'org.orekit.forces.drag' has no attribute 'MarshallSolarActivityFutureEstimation'

If anyone is able to offer an insight on these issues, or on how to add an drag model to a propagator it would be greatly appreciated!

Hi Ben,

It looks like you are using a very old version of Orekit, the SphericalSpacecraft class was replaced as of Orekit 3.1 by the IsotropicDrag class and other classes.

Can you maybe post your full code including the imports? It will help debugging.

Here’s a code snippet that I use for setting up atmospheric drag (with some variable names adapted to your example):

from org.orekit.models.earth.atmosphere.data import CssiSpaceWeatherData
cswl = CssiSpaceWeatherData("SpaceWeather-All-v1.2.txt")

from org.orekit.models.earth.atmosphere import NRLMSISE00
atmosphere = NRLMSISE00(cswl, sun, earthBody)

from org.orekit.forces.drag import IsotropicDrag
isotropic_drag = IsotropicDrag(cross_section, cd)

from org.orekit.forces.drag import DragForce
drag_force = DragForce(atmosphere, isotropic_drag)

propagator.addForceModel(drag_force)

Where cross_section and cd must be defined before and depend on your spacecraft.

In this example I used the newer CssiSpaceWeatherData data loader which provides 3-hourly space weather data, but you can still use the older monthly MarshallSolarActivityFutureEstimation loader.

from org.orekit.models.earth.atmosphere.data import MarshallSolarActivityFutureEstimation
msafe = MarshallSolarActivityFutureEstimation(
    MarshallSolarActivityFutureEstimation.DEFAULT_SUPPORTED_NAMES,
    MarshallSolarActivityFutureEstimation.StrengthLevel.AVERAGE

from org.orekit.models.earth.atmosphere import NRLMSISE00
atmosphere = NRLMSISE00(msafe, sun, earthBody)

In my example I used the NRLMSISE00 density model , but alternatively you can use the DTM2000 model:

from org.orekit.models.earth.atmosphere import DTM2000
atmosphere = DTM2000(cswl, sun, earthBody)

Or alternatively with the Marshall loader:

from org.orekit.models.earth.atmosphere import DTM2000
atmosphere = DTM2000(msafe, sun, earthBody)
1 Like

Hi yzokras,

Thank you for this detailed response, it has been so useful. I think this has answered the questions I was facing, I really appreciated your input!