All of the notes from the intro of day 2. This includes some movie ideas, and some beginnings
of thinking in 3D (in the 2nd half of the day).
This streamlines the code and makes it more modular. This library provides both solver and plotting unit conversions and data readers.
We are going to break up our code into two parts - one part to calculate trajectories and save the info to a text file,
and the second part to read in saved data and make png plot images.
This is exactly the code from "Choose your
Own Adventure #1" from Day 4, but with some code to save information about the trajectories in a text file
instead of plotting. Feel free to just grab the end bits of this code that does the saving of positions and velocities
as your code probably differs in initial conditions.
If you worked with galaxy mergers last week, use this code to generate movies from saved data. See the "Resources" section
for the data download. Note - its a 77Mb zip file.
Step 1: Download FFmpeg from here. There are
binaries for most distributions under "Get the packages" so select one that matches your OS.
Step 2: Once you have a series of images generated from the "Code" section above, you can create a
movie with the following (assuming /FFMPEG_DIRECTORY/ is the directory where FFmpeg unpacks):
/FFMPEG_DIRECTORY/ffmpeg -framerate 15 -pattern_type glob -i 'traj*.png' -c:v libx264 -pix_fmt yuv420p out.mp4
The above is for a Mac, but the calling sequence might be slightly different on your OS, so let someone
know if it doesn't work and we can take a look at it.
Note: If you get a "width not divisible by 2" error, this means your saved images have a height or width
that is not divisible by 2. You can solve this with a comment such as (if the width is not divisible by 2):
/FFMPEG_DIRECTORY/ffmpeg -framerate 15 -pattern_type glob -i 'traj*.png' -vf "crop=in_w-1:in_h" -c:v libx264 -pix_fmt yuv420p out.mp4
But certainly let someone know if this doesn't fix the problem.
Also, check out "Resources" section for some FFmpeg links.
Lots of information about what the different parameters are for using FFmpeg to make a movie from a series of png files.
A list of other movie making resources if you HATE FFmpeg.
77Mb of galaxy merger awesomeness.
This code reads in planet data and makes the files needed to view a series of 3D spheres based on a single time
snapshot (static model).
This code reads in 2-particle type galaxy data and makes a PLY file containing each particle as a colored vertex.
These are the files to go in your "generic_dir" to plot planets in 3D.
This is a simple low-ish resolution sphere wrapped with a Mars texture map.
Detailed wiki article about the Wavefront file format.
This is just a google search for planet texture maps. Make sure they have widths about 1000-1200 pixels - bigger ones take up too much
For Reference ONLY (not covered here)
Code for Galaxy Simulators: NOTE - Not well documented, we will not go over
This is mainly to serve as a reference for folks that do galaxy simulations in their research and want to plot some stuff in 3D in the future.
Feel free to email me whenever about this!
Reads in Gadget-2/Gizmo/Arepo-like data and converts it to text file format. Also can be used to
reduce the number of particles. So far, only 2 particle types, but more can be added by the user.
Reads in SPH text file data and reduces the number of particles.