Tudat / tudat

NOTE: This Tudat version is no longer supported. See https://docs.tudat.space/en/stable/ and https://github.com/tudat-team/tudat-bundle for the new version
BSD 3-Clause "New" or "Revised" License
87 stars 142 forks source link

EGM2008 #594

Closed sGrady201 closed 1 year ago

sGrady201 commented 4 years ago

Hi at everyone!

I've got a quick question regarding the gravity models in tudat. I read that the EGM 96 is build in, but is it possible to use the EGM2008, e.g. with the help from "Spherical Harmonic Gravity Field from custom file"? If yes, what would the code be like?

Thanks for your time.

DominicDirkx commented 4 years ago

Hi,

You're going to have to be more specific. You seem to be referring to a specific page in the documentation. Please add a link to it, and explain where/how you want to use this functionality.

In principle, there is no issue with changing the gravity field, and in fact we should change this default anyway in the near future,

Dominic

sGrady201 commented 4 years ago

Hi Dominic,

thank you for your reply. I am working with the json interface to set up some simulations. The point I'm referrring to is on this page:

http://tudat.tudelft.nl/tutorials/jsonInterface/keys/rst/index.html#jsoninterface-keys

and to be more specific: Body -> Gravity Field -> Spherical Harmonic Gravity Field from custom file.

I've seen on the page https://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008/egm08_wgs84.html that there are two files you can download: 1) EGM2008_to2190_TideFree.gz and 2) Zeta-to-N_to2160_egm2008.gz

One of these should contain the coefficients of the spherical harmonics for the model and in my (naive) opinion it would be perfect if I could put the (correct) file into a seperate folder and load the coefficients directly into tudat. I'm a hobby astronomer and just started to dig in this field, that's why I'm asking.

DominicDirkx commented 4 years ago

Hi,

Thanks for the clarification, and good to hear that you're using Tudat for your hobby. Just for my curiosity: how did you happen to come across it?

It would be fairly straightforward to add more gravity fields, provided they have the same file format as those here:

https://github.com/Tudat/tudat/tree/master/Tudat/External/GravityModels/Earth

We could approach this in two ways:

The first should be very straightforward. The second will be a bit more work, but would still require only very limited modifications to the code.

We can make this modification (one or both), but it will probably be a few weeks for us to find the time to do so. If you're (a little) proficient in C++, I can also pint you in the right direction on doing this yourself. Please let us know what you'd prefer,

Best,

Dominic

sGrady201 commented 4 years ago

Hi,

as simple as it sounds I was searching for an open-source software to simulate planetary orbits, because I find it very interesting how the planets interact with the sun and with each other and wanted to know more. Then I stumbled over tudat and what you guys are doing is absolute fantastic! Not only is your software able to simulate planets but satellites, too. And that for free! I really appreciate what you are doing.

I think the best/most usefull way would be to go approach one. The last time I was programming was a while ago, but nevertheless I would like to try my best. How about this: If you could put way one on your "to-do-if-there-is-time"-list that would be perfect. Meanwhile I would try to add the new identifier and as soon as I am sucessful I would contact you to add it to the master branch. If you could give me some hints to point me in the right direction, that would be very good.

As far as I understand the files in the gravity folder the first line describes the reference mass and the semi-major axis of the reference ellipsoid. Then following they are sorted by | n | m | cos | sin | always first increasing n by one and then holding n constant and iterate m from 0 to new n. Is that correct?

What I do not understand yet is why there are two additional columns in the file "EGM2008_to2190_TideFree.gz". Do you have a tip how i have to convert this file to get a structure like the existing ones with in the gravity folder?

Thank you for your time and work. I really appreciate it!

Best, Sebastian

DominicDirkx commented 4 years ago

Hi Sebastian,

Indeed, the gravity field file's first line contains some reference data like gravitational parameter and reference radius.

We'll put this on our todo-list, and we'll keep this issue open as a reminder to us. The from-file gravity field settings are read from the JSON file in these lines:

https://github.com/Tudat/tudat/blob/master/Tudat/JsonInterface/Environment/gravityField.cpp#L144-L149

This ends up calling the gravity field from file read function:

https://github.com/Tudat/tudat/blob/master/Tudat/SimulationSetup/EnvironmentSetup/createGravityField.cpp#L107-L110

The gravity then is created in this switch statement:

https://github.com/Tudat/tudat/blob/master/Tudat/SimulationSetup/EnvironmentSetup/createGravityField.cpp#L271

It may not be the most straightforward pieces of code, so good luck!

Best,

Dominic

sGrady201 commented 4 years ago

Sorry for bothering again,

but is there a minimal tutorial / beginners guide to compile a modified version of the tudat examples? To be more specific my situation is the following: I'm starting to understand the structure of tudat more and more by each day and modified one of the examples in ...\SatellitePropagatorExamples. Now I want to compile and run it to see the differences. Therefore I need a guide for dummies (sorry for that). Could someone of the experienced users be so kind and help me or give me a direction where to work on?

Best regards


Edit: I'm a stupid moron. I've found the documentation https://tudat.tudelft.nl/installation/creatingNewApps.html#creating-a-new-tudat-application.

Now I get the following error message:

Running C:\Program Files\CMake\bin\cmake.exe D:/tudatBundle/tudatExampleApplications/templateApplication/TemplateApplication "-GCodeBlocks - MinGW Makefiles" "-DCMAKE_BUILD_TYPE:STRING=Debug" "-DCMAKE_CXX_COMPILER:STRING=C:/Qt/Tools/mingw730_64/bin/g++.exe" "-DCMAKE_C_COMPILER:STRING=C:/Qt/Tools/mingw730_64/bin/gcc.exe" "-DCMAKE_PREFIX_PATH:STRING=" "-DQT_QMAKE_EXECUTABLE:STRING=" in C:\Users\Pliskin\AppData\Local\Temp\QtCreator-mAWdlP\qtc-cmake-ubGCgJAM. -- The C compiler identification is GNU 7.3.0 -- The CXX compiler identification is GNU 7.3.0 -- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe -- Check for working C compiler: C:/Qt/Tools/mingw730_64/bin/gcc.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: C:/Qt/Tools/mingw730_64/bin/g++.exe -- Check for working CXX compiler: C:/Qt/Tools/mingw730_64/bin/g++.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- << TemplateApplication (Debug - standalone) >> -- CMake Module path(s): D:/tudatBundle/tudatExampleApplications/templateApplication/TemplateApplication/CMakeModules CMake Error at CMakeLists.txt:44 (include): include could not find load file:

compiler

CMake Error at CMakeLists.txt:86 (find_package): By not providing "FindEigen3.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Eigen3", but CMake did not find one.

Could not find a package configuration file provided by "Eigen3" with any of the following names:

Eigen3Config.cmake
eigen3-config.cmake

Add the installation prefix of "Eigen3" to CMAKE_PREFIX_PATH or set "Eigen3_DIR" to a directory containing one of the above files. If "Eigen3" provides a separate development package or SDK, be sure it has been installed.

sGrady201 commented 4 years ago

Update (if people have the same problem here is what solved it for me):

Within the folder "tudatApplications" I pasted the CMakeLists as mentioned in the documentation. To get it running I had to hardcode some variables (I know this is a crude solution, but I'm not experienced enough right now for a better solution. If someone has an idea please fell free to tell me).

Additionally it was necessary to use the file Usersettings.txt and uncomment the following:

Nevertheless I now have the problem that I am not able to compile other examples than "hello world" because everytime I try to compile one of the examples from "SatellitePropagatorExamples", e.g. "AterixAnd ObelixPropagator" I get the errors

with this output on the general console:

Running C:\Program Files\CMake\bin\cmake.exe D:/tudatBundle/tudatApplications "-GCodeBlocks - MinGW Makefiles" "-DCMAKE_BUILD_TYPE:STRING=Release" "-DCMAKE_CXX_COMPILER:STRING=C:/Qt/Tools/mingw730_64/bin/g++.exe" "-DCMAKE_C_COMPILER:STRING=C:/Qt/Tools/mingw730_64/bin/gcc.exe" "-DCMAKE_PREFIX_PATH:STRING=" "-DQT_QMAKE_EXECUTABLE:STRING=" in D:\tudatBundle\build-tudatApplications-Desktop_x86_windows_msys_pe_64bit-Release. -- << TemplateApplication (Release - standalone) >> -- CMake Module path(s): D:/tudatBundle/external/CMake;D:/tudatBundle/tudat/Tudat/External/CMake -- Using gnucxx compiler. -- Building with flags: -Wall -std=c++11 -Wextra -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wold-style-cast -Wnon-virtual-dtor -fPIC. -- SPICE_LIBRARIES: D:/tudatBundle/cspice/lib/libcspice.a -- NRLMSISE-00 disabled! -- SPICE disabled! -- Configuring done -- Generating done -- Build files have been written to: D:/tudatBundle/build-tudatApplications-Desktop_x86_windows_msys_pe_64bit-Release

If someone has a hint it would be much appreciated.

Bests Sebastian

Attachments: CMakeLists.txt UserSettings.txt

DominicDirkx commented 4 years ago

Hi Sebastian,

I think I know where the confusion arises from (but do correct me if I'm wrong!). In any case, when adding new applications, examples, unit tests, etc. to Tudat, the CMakeLists.txt that you open in your IDE is always tudatBundle/CMakeLists.txt. The 'lower-level' CMakeLists.txt files, for instance this one:

https://github.com/Tudat/tudatExampleApplications/blob/master/satellitePropagatorExamples/SatellitePropagatorExamples/CMakeLists.txt

Are then loaded, and all their settings parsed. So, if you want to add a modified example application, you only have to modify the file I linked to above.

If this helps you out, let me know. If not (or if I'm completely wrong about your workflow), we'll figure out what's going wrong, and try to help you out best we can,

Best,

Dominic

sGrady201 commented 4 years ago

Hi Dominic,

thank you for your answer. I think this might be the problem, because I always tried to modify the 'lower' level CMakelists and wondered why the necessary libriaries were not linked.

I would like to have my modified examples segregated from the others to not get confused. That's why I would like to put all my files in a folder structre like

D:\tudatBundle\tudatApplications\myApplications

And, if I understand you correctly, if I paste

add_executable(application_myAsterixAndObelixPropagator "${SRCROOT}/myAsterixAndObelixPropagator.cpp") setup_executable_target(application_myAsterixAndObelixPropagator "${SRCROOT}") target_link_libraries(application_myAsterixAndObelixPropagator ${TUDAT_PROPAGATION_LIBRARIES} ${Boost_LIBRARIES} ) in the local CMakelists

and additionally

add_subdirectory( "${PROJECTROOT}/tudatApplications/myApplications")

into the main CMakelists.txt

https://github.com/Tudat/tudatBundle/blob/master/CMakeLists.txt

and open this 'master' CMake in my IDE it should compile tudat plus my modified examples.

I will try that and report my experiences as soon as possible! Any case thank you for your help and kind offer.

Bests, Sebastian

I'll try to solve the problem tomorrow and report


myAsterixAndObelixPropagator.txt

sGrady201 commented 4 years ago

Hi Dominic,

I just got it done. Thank you for your explanation. Now I'm able to create my own examples in the Applications folder. Next step is taking on the new gravity file.

Merry Christmas, Sebastian

AlexBadauer commented 4 years ago

Hello Dominic, hello Sebastian,

I'm new to tudat and not so versatile as you two. Is there any progress regarding the incoporation of the EGM2008 since the last post? Because I am not able to do so on my own.

SamFayolle commented 4 years ago

Hi Alex,

I don't know if there has been any update on this particular issue but the main Tudat developer will be back from holidays in a few weeks and he will know about the exact status of this issue. Sorry for the delay, software support is unfortunately a bit limited during summer.

Best regards,

Marie

AlexBadauer commented 4 years ago

Hi Marie,

no problem. I'm not in a hurry. Take your time and holidays are now more important then ever.

Best regards Alex

DominicDirkx commented 4 years ago

Hi Alex,

There is no 'automatic' support for this yet (although it will be part of a large forthcoming update). If you post a link to the code you have, and a link to the specific gravity field file you want to us, I should be able to point out where/how to make modifications to your code to use EGM2008,

Best,

Dominic

AlexBadauer commented 4 years ago

Hi Dominic,

quite cool to hear that there will be a large forthcoming update. You're really putting up some effort.

And thank you for your offer. Here is my example where i tried to use spherical harmonical gravity (line 92) with EGM96.

example.txt

Could the file @sGrady201 linked to from NGA EGM2008_to2190_TideFree do the trick? As far as I understand the documentation there could be the possibility of moving this file to gravity folder and then and create matching pointers. The columns are {n, m,C , S , sigmaC ,sigmaS } but the sigma columns at the end should not be of any interest, doesn't it? Perhaps some quick-and-dirty trick by renameing the file to EGM96, removing the last to columns and replace it with the original EGM96 is possible?

Or does one have to take tides into account for satellite orbit propagation? I'm not sure if it is important at all.

Are you allowed to drop a hint in how many months the update approximately will be? If it's just a thing of a couple of months I would wait and not bother you any further.

Best,

Alex

DominicDirkx commented 4 years ago

Hi Alex,

Tides can be important for satellite orbit propagation (we have relatively coarse models for Earth tides available). I would refer you to the literature to get an idea of the importance. I find the book 'Satellite Orbits' by Montenbruck and Gill to be an excellent introduction.

The file you link to should be directly compatible, but make sure to check whether the treatment of tides is as you want it (see the IERS conventions for more details).

Our update should be coming in ~months (or at least partly). No guarantees, but that's the timeframe we're aiming for. If you'd like some more detailed input on how to incorporate the new gravity field file into your code, please post a link to your code where you want to add it, and I can give some pointers,

Best,

Dominic

AlexBadauer commented 4 years ago

Hi Dominic,

thank you for your reply. I will definitly look into the book.

In the next days I will prepare an example and post it here. Thanks for your offer.

Best, Alex

DominicDirkx commented 1 year ago

NOTE: This Tudat version is no longer supported. See https://docs.tudat.space/en/stable/ and https://github.com/tudat-team/tudat-bundle for the new version