Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Erik Strand
nmm_2020_site
Commits
6a7bb75e
Commit
6a7bb75e
authored
May 04, 2020
by
Erik Strand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document initial diff sim stable orbit study
parent
2740192e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
2 deletions
+18
-2
_code/notes/diffsim/glut_grapher.cpp
_code/notes/diffsim/glut_grapher.cpp
+2
-2
_notes/differentiable_simulation.md
_notes/differentiable_simulation.md
+16
-0
assets/mp4/diffsim_bad_orbit.mp4
assets/mp4/diffsim_bad_orbit.mp4
+0
-0
assets/mp4/diffsim_good_orbit.mp4
assets/mp4/diffsim_good_orbit.mp4
+0
-0
No files found.
_code/notes/diffsim/glut_grapher.cpp
View file @
6a7bb75e
...
...
@@ -64,9 +64,9 @@ void GlutGrapher::display() const {
void
GlutGrapher
::
idle
()
{
bool
const
wait_to_start
=
false
;
if
(
wait_to_start
&&
frame_
==
0
)
{
std
::
cout
<<
"Press enter to start a
2
0 second countdown"
<<
std
::
endl
;
std
::
cout
<<
"Press enter to start a
1
0 second countdown"
<<
std
::
endl
;
do
{}
while
(
std
::
cin
.
get
()
!=
'\n'
);
for
(
uint32_t
i
=
2
0
;
i
>
0
;
--
i
)
{
for
(
uint32_t
i
=
1
0
;
i
>
0
;
--
i
)
{
std
::
cout
<<
i
<<
"... "
<<
std
::
flush
;
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
1
));
}
...
...
_notes/differentiable_simulation.md
View file @
6a7bb75e
...
...
@@ -80,3 +80,19 @@ particular particle.
$$
a_i =
\s
um_{j
\n
eq i} G m_j
\f
rac{x_j - x_i}{|x_j - x_i|^3}
$$
To start, let's consider two particles. I'll make one 100 times heavier than the other, and our goal
will be to find a stable circular orbit by varying the initial velocity of the satellite. As a
baseline, here's a really bad trajectory, in which the satellite gains escape velocity and doesn't
end up orbiting at all.
<video
width=
"480"
height=
"320"
controls=
"controls"
muted
plays-inline
>
<source
type=
"video/mp4"
src=
"../assets/mp4/diffsim_bad_orbit.mp4"
>
</video>
Differentiating through the simulation makes it very easy to find the desired solution. This orbit
was found by gradient descent, but Nelder Mead finds the same optimum.
<video
width=
"480"
height=
"320"
controls=
"controls"
muted
plays-inline
>
<source
type=
"video/mp4"
src=
"../assets/mp4/diffsim_good_orbit.mp4"
>
</video>
assets/mp4/diffsim_bad_orbit.mp4
0 → 100644
View file @
6a7bb75e
File added
assets/mp4/diffsim_good_orbit.mp4
0 → 100644
View file @
6a7bb75e
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment