eggrobin

[WIP][1.5.1, 1.6.1, 1.7.x] Principia—version del Ferro, released 2019-08-30—n-Body and Extended Body Gravitation, axial tilt

Recommended Posts

You didn't miss any mod, KSP uses Keplarian physics which is 2-body (your ship and whatever you're orbiting).

Uh....doh stupid me of course it is. Excuse me while I get my foot out of my mouth.

Share this post


Link to post
Share on other sites
Ah... I wish I could say now I get it, and I am determined to get it, at one time I think I did get it. Let me see if my memory serves me well or not. L1,L3 and L5 are unstable equilibrium points and L2 and L4 are stable equilibrium points. L5 is special in that it the single point where a satellite could remain stationary relative to the barycent. (I am betting I got this all wrong so please no one smack me up side the head for being stupid)

Actually L1, L2 and L3 are unstable and L4 and L5 are stable: "The triangular points (L4 and L5) are stable equilibria, provided that the ratio of M1/M2 is greater than 24.96". All Lagrange points have the property that you remain still relative to a rotating reference frame and thus also relative to the barycenter, however their stability refers to a convergent, or at least not a divergent solution when an object gets perturbed at one of these points, such as the (weak) pull of another celestial body.

The corotating reference frame is confusing, but it's the only frame in which you can see orbits around Lagrange points.

Horseshoe orbits will also be interesting to observe in such an reference frame, but this is basically also an orbit but around multiple Lagrange points (L3, L4 and L5).

Edited by fibonatic
Added link to horseshoe orbit

Share this post


Link to post
Share on other sites

See I told you I would not get it quit right. Well I best get to studying so that I will stop asking stupid questions. Since clearly I have forgotten more than half of what I learned in college.

Share this post


Link to post
Share on other sites

I completely broke it when I put Ike 1000km away from the Mun past Jool's orbit. It seems to orbit a barycenter somewhere outside the Mun itself but without being able to focus on it, it's hard to tell. Needless to say, it certainly didn't enjoy me mocking around with that because it started rotating in all possible directions going from clockwise to counterclockwise whenever it felt like it. I know displaying the barycenter isn't very useful for the Kerbol or even Solar System but it would make this game like Universe Sandbox in a way. Can't wait for this to be released, it's a lot more fun that it sounds.

Share this post


Link to post
Share on other sites
Note while you could make an integrator that preserves first integrals exactly (by projecting onto a state with the right H, p and L), this actually turns out to be useless, the result is aberrant (e.g. stable orbits degenerate)

I hate to ask, but how is that possible? How can a lower orbit have the same vis-viva energy and angular momentum as a higher orbit? Do you have a numerical example, or instructions how to generate one?

Share this post


Link to post
Share on other sites

Are you talking about Lagrangian points? L1 and L2 are points closer and further from the sun respectively, you seem to know physics so they basically work because Earth pulls on it and speeds up or slows it down, making it have the same orbit.

Share this post


Link to post
Share on other sites
I hate to ask, but how is that possible? How can a lower orbit have the same vis-viva energy and angular momentum as a higher orbit? Do you have a numerical example, or instructions how to generate one?

Two orbits with the same semi-major axis have the same characteristic energy (C3 = -mu/2a = 0.5 v^2 - mu/r). In real life, orbital resonances tend to stretch circular orbits into elliptical orbits. C3 stays the same, but because the orbit becomes longer, it crosses the paths of more objects, and becomes more likely to have a collision, get flung away by a gravity boost, or captured in an atmosphere. Jupiter does this to the asteroid belt, resulting in the "Kirkwood gaps" -- there are no (or very few) asteroids in orbits whose periods are resonant with Jupiter's, because they all got cleared out by this process.

Edited by Kerbas_ad_astra
Added the actual formula for C3

Share this post


Link to post
Share on other sites
Two orbits with the same semi-major axis have the same characteristic energy (C3 = -mu/2a = 0.5 v^2 - mu/r). In real life, orbital resonances tend to stretch circular orbits into elliptical orbits. C3 stays the same, but because the orbit becomes longer, it crosses the paths of more objects, and becomes more likely to have a collision, get flung away by a gravity boost, or captured in an atmosphere. Jupiter does this to the asteroid belt, resulting in the "Kirkwood gaps" -- there are no (or very few) asteroids in orbits whose periods are resonant with Jupiter's, because they all got cleared out by this process.

Many thanks for the reply, but what explicitly happens to angular momentum?

Share this post


Link to post
Share on other sites
Many thanks for the reply, but what explicitly happens to angular momentum?

In the case I mentioned, the angular momentum would decrease going from the circular orbit to an elliptical orbit (both orbits have the same magnitude of v at the r where they cross, because they have the same energy, but the elliptical orbit's v is not perpendicular to r, so its angular momentum r x v is less). Maybe an orbit which spiraled into or away from the parent body could conserve both.

Share this post


Link to post
Share on other sites
See I told you I would not get it quit right. Well I best get to studying so that I will stop asking stupid questions. Since clearly I have forgotten more than half of what I learned in college.

Feel free to ask any questions/point out any mistakes in my explanatory documents.

Many thanks for the reply, but what explicitly happens to angular momentum?

This is a good question, and as a result the answer is "I was probably wrong".

My source is page 4 of this paper. By forcing conservation of H, we get something that probably isn't the solution of a some H', let alone a symmetrical H', so there is no reason (that I can immediately think of) why L or p should be conserved.

Note however that this is on three bodies (Sun, Jupiter, Saturn), so it is not immediate that they are not conserved if their orbits are not fixed (that would indeed be immediate in the 2-body case, since H and L determine all orbital elements except for ̉ۡ and M0).

Share this post


Link to post
Share on other sites
Feel free to ask any questions/point out any mistakes in my explanatory documents.

This is a good question, and as a result the answer is "I was probably wrong".

My source is page 4 of this paper. By forcing conservation of H, we get something that probably isn't the solution of a some H', let alone a symmetrical H', so there is no reason (that I can immediately think of) why L or p should be conserved.

Note however that this is on three bodies (Sun, Jupiter, Saturn), so it is not immediate that they are not conserved if their orbits are not fixed (that would indeed be immediate in the 2-body case, since H and L determine all orbital elements except for ̉ۡ and M0).

I hesitate to say you were wrong, but in that paper it appears as though they weren't "clamping" angular momentum, just the vis viva energy.

On a different question, I don't really follow the requirements of degrees of freedom vis-a-vis constants of motion for an integrable mechanical system. Unfortunately I don't even know how to begin formulating a question in this area. It would come out sounding like total nonsense, even to me. For example "To improve the integrability of a system, would you prefer to reduce the number of degrees of freedom, increase the number of constants of motion, or the opposite of either one of those?" As far as I know, that question is complete gibberish.

Share this post


Link to post
Share on other sites
Even in German, i would not understand the text in the OP. :D

Der OP sollte zum größten Teil verständlich sein, die Literaturempfehlungen sind aber etwas komplizierter. Wenn die Sprache ein Problem ist, kann ich das Skript einer Numerische Mathematik Vorlesung, die ich belegt habe, empfehlen.

Thanks!

it appears as though they weren't "clamping" angular momentum, just the vis viva energy.

This is clear. The question would then be whether this somehow implies conservation of other first integrals, but I doubt it.

My earlier statement then becomes, once corrected,

Note while you could make an integrator that preserves energy exactly (by projecting onto a state with the right H), this actually turns out to be useless, the result is aberrant (e.g. stable orbits degenerate), since it is not the solution of a perturbed Hamiltonian.

Regarding this,

On a different question, I don't really follow the requirements of degrees of freedom vis-a-vis constants of motion for an integrable mechanical system. Unfortunately I don't even know how to begin formulating a question in this area. It would come out sounding like total nonsense, even to me. For example "To improve the integrability of a system, would you prefer to reduce the number of degrees of freedom, increase the number of constants of motion, or the opposite of either one of those?" As far as I know, that question is complete gibberish.

The question does sound like gibberish, but more importantly, so does the entire paragraph surrounding it. This makes things rather confusing.

Are you referring to Noether's theorem?

Edited by eggrobin
der die das

Share this post


Link to post
Share on other sites

Just started to read both .pdf

This might have been asked already, but is there a way to try this mod?

Edited by Alpheratz

Share this post


Link to post
Share on other sites
Just started to read both .pdf

This might have been asked already, but is there a way to try this mod?

Here's how to build. I wrote a powershell script I guess it is (mostly copy paste the stuff on that page) that does everything except download the requirements. It's written for my folder paths so you'd have to change those.

Share this post


Link to post
Share on other sites
Here's how to build. I wrote a powershell script I guess it is (mostly copy paste the stuff on that page) that does everything except download the requirements. It's written for my folder paths so you'd have to change those.

Thanks, i'll try it right now :)

Share this post


Link to post
Share on other sites
Hmm, all that I need is ksp_plugin_adapter.dll, 20 KB? Or i have compiled this wrong?

That's wrong, you also need Principia.dll. If you follow all the instructions it will work.


Copy-Item D:\Other\KSP\Principia\GoogleNoMod\gmock-1.7.0 D:\Other\KSP\Principia\Google -recurse
git clone https://github.com/mockingbirdnest/Principia.git
cd Google
git clone "https://chromium.googlesource.com/chromium/src.git" chromium -n --depth 1 -b "40.0.2193.1"
$GitPromptSettings.RepositoriesInWhichToDisableFileStatus += join-path (gi -path .).FullName chromium
cd chromium
git config core.sparsecheckout true
copy "..\..\Principia\documentation\setup files\chromium_sparse_checkout.txt" ".git/info/sparse-checkout"
git checkout
copy "..\..\Principia\documentation\setup files\chromium.patch"
git am "chromium.patch"
rm "chromium.patch"
echo 'chromium done'
cd ..
cd glog-0.3.3
git init
copy "..\..\Principia\.gitattributes"
copy "..\..\Principia\.gitignore"
git add ".gitattributes"
git add ".gitignore"
git commit -m "git files"
git add -A
git commit -m "add glog"
copy "..\..\Principia\documentation\setup files\glog.patch"
git am "glog.patch"
rm "glog.patch"
echo 'glog done'
cd ..
cd gmock-1.7.0
git init
copy "..\..\Principia\.gitattributes"
copy "..\..\Principia\.gitignore"
git add ".gitattributes"
git add ".gitignore"
git commit -m "git files"
git add -A
git commit -m "add gmock"
copy "..\..\Principia\documentation\setup files\gmock.patch"
git am "gmock.patch"
rm "gmock.patch"
echo 'gmock done'
cd ..
git clone https://github.com/pleroy/benchmark.git
cd "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE"
echo 'Build glog debug'
.\devenv.exe D:\Other\KSP\Principia\Google\glog-0.3.3\google-glog.sln /build Debug | Out-Null
echo 'Build glog release'
.\devenv.exe D:\Other\KSP\Principia\Google\glog-0.3.3\google-glog.sln /build Release | Out-Null
echo 'Build gmock debug'
.\devenv.exe D:\Other\KSP\Principia\Google\gmock-1.7.0\msvc\2010\gmock.sln /build Debug | Out-Null
echo 'Build gmock release'
.\devenv.exe D:\Other\KSP\Principia\Google\gmock-1.7.0\msvc\2010\gmock.sln /build Release | Out-Null
echo 'Build benchmark debug'
.\devenv.exe D:\Other\KSP\Principia\Google\benchmark\msvc\google-benchmark.sln /build Debug | Out-Null
echo 'Build benchmark release'
.\devenv.exe D:\Other\KSP\Principia\Google\benchmark\msvc\google-benchmark.sln /build Release | Out-Null
echo 'Build Principia release'
.\devenv.exe D:\Other\KSP\Principia\Principia\Principia.sln /build Release | Out-Null
echo 'All built!'
cd D:\Other\KSP\Principia
Copy-Item D:\Other\KSP\Principia\GoogleNoMod\glog-0.3.3 D:\Other\KSP\Principia\Google -recurse

a PowerShell script that will do everything for you. You need KSP Assemblies, a folder GoogleNoMod with glog and gmock un-modified and an empty folder named Google. You'd need to change all paths as well (or just put it in the same folder). This needs to be launched from GIT Shell if you didn't add git to your paths.

I get ksp_plugin_adapter.dll(22kB) and principia.dll(222kB). The build as of right now seems to crash on surface but works in orbit.

Edited by AndreyATGB

Share this post


Link to post
Share on other sites

I hope the best for this mod's development :D

really really looking forward to when it is playable for the public :)

Share this post


Link to post
Share on other sites

eggrobin, would you mind linking the LaTeX source for the “recommended reading†articles you put together? The typesetting and layout are marvelous.

Share this post


Link to post
Share on other sites

The intellectual carefulness in each aspect of this project is terrific. I have only glanced at bits of the code, but I did love the bit about Sputnik romanization.

I have a vague suggestion about conveying information about fields like gravitational potential. If, in addition to a visual plot on some reference plane, it is helpful to give the player info about a single, selectable point in space, I think it is best selected by the player clicking once on that point (defining a line through space normal to the camera perspective), rotating the camera some amount, and clicking on it again (the second click being clamped to the line defined by the first click). Whenever I have seen a graphical control for selecting a point in three dimensions, it has been done by having the user select a point on a reference plane, and then offsetting it normal to that plane. This is needlessly awkward.

The two clicks could also be used to select a plane along which to plot the potential, the plane given by the two intersecting lines. This might be more relevant than my first thought about only one point. Another good way to control the plane for plotting the potential is simply to select the one normal to the camera perspective and passing through the barycenter (or a craft, or a point chosen manually)  in real time as the camera rotates. This would greatly enable the player in building a mental picture of the potential field, especially if it could somehow be adapted to n bodies.

Share this post


Link to post
Share on other sites
eggrobin, would you mind linking the LaTeX source for the “recommended reading†articles you put together? The typesetting and layout are marvelous.

It's all on the repository, under documentation. It should be compiled with XeLaTeX. It uses a package of mine which (rather unsuccessfully) tries to make the syntax semantically saner, and also autosizes brackets ignoring super- and subscripts.

It turns out that I have twice as much LaTeX as I have C#... (GitHub stats)

Edited by eggrobin

Share this post


Link to post
Share on other sites

I really, really look forward to this mod...

Granted I can barely do the math for KSP as is, but it is fun to make it hyper-realistic and watch your own spectacular failures, lol.

Will this work with RSS if/when complete? Or would that break the implementation of either this or RSS?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.