Skip to content
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

Error, gravity field model not set when making central gravitational acceleration of Jupiter on Sun #150

Closed
BeatrizMOliveira opened this issue Feb 26, 2017 · 10 comments

Comments

@BeatrizMOliveira
Copy link

I get this error when trying to propagate all of the bodies in question 2.5.
The error seems to happen in this line of code:
basic_astrodynamics::AccelerationMap accelerationModelMap = createAccelerationModelsMap(
bodyMap, accelerationMap, bodiesToPropagate, centralBodies );
If I remove Jupiter, I get the same error for Mars.
Can this be related to these warnings?
Warning, position of Jupiter taken as barycenter of that body's planetary system.
Warning, position of Mars taken as barycenter of that body's planetary system.

@DominicDirkx
Copy link
Member

The warnings:

Warning, position of Jupiter taken as barycenter of that body's planetary system.
Warning, position of Mars taken as barycenter of that body's planetary system.

are not a problem. They simply indicate that the ephemeris of Mars/Jupiter is retrieved from Spice as the center of mass (barycenter) of those planetary systems. For Mars for instance: the joint barycenter of Mars, Phobos and Deimos). Except for applications where highly precise solar system positions are relevant, you can safely ignore it.

Your error seems to be a result of Jupiter not having a gravity field. Before calling the createAccelerationModelsMap function check if

  • Jupiter exists in the body map
  • If Jupiter has a gravity field model

You can check whether a pointer is allocated by comparing with 'NULL':

bodyMap.at( "Jupiter" )->getGravityFieldModel( ) == NULL

will return true if not gravity field model is assigned, and false if it is.

You can check whether an entry exists in a map by using:

bodyMap.count( "Jupiter" )

which will return 1 if the entry exists and 0 if it doesnt.

@BeatrizMOliveira
Copy link
Author

I get 1's for both tests.

@DominicDirkx
Copy link
Member

Ok, so youve established that Jupiter exists, but it has no gravity field.

Is this also the case just after the body map was created? If so, what are the settings for the Jupiter gravity field in the BodySettings map?

@BeatrizMOliveira
Copy link
Author

I think that is where I first checked (after the body map was created). How can I see those settings?

@DominicDirkx
Copy link
Member

These settings are stored in a variable of type:

std::map< std::string, boost::shared_ptr< BodySettings > >

See the lecture slides of last Thursday and the wiki for some additional examples/details. The count command is a function of any map, and the NULL comparison can be used for any kind of (smart) pointer.

@BeatrizMOliveira
Copy link
Author

I don't know if this is what you ment with the settings, but when using this:
std::cout<<bodySettings[ "Jupiter" ] -> gravityFieldSettings -> getGravityFieldType();
I got a 1.
Is there any documentation on the structure of the classes used?

@DominicDirkx
Copy link
Member

@BeatrizMOliveira
Copy link
Author

I did not make any changes for the gravity field settings in the code. It should be set to the default.

@DominicDirkx
Copy link
Member

Ok, let's talk at the office hours this afternoon.

@DominicDirkx
Copy link
Member

Problem solved:

bodyMap[ "Jupiter" ] = boost::make_shared< Body >( );

was called after creation of the body map, overriding the Jupiter object with that has no contents, leading to the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants