-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/teuben/nemo
- Loading branch information
Showing
2 changed files
with
290 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,274 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "0b0acc08-6ce4-4c7a-abec-966e5abdf370", | ||
"metadata": {}, | ||
"source": [ | ||
"# The Aarseth NBODY family of codes\n", | ||
"\n", | ||
"With the \n", | ||
"[passing of Sverre Aarseth on Dec 28, 2024](https://ascl.net/wordpress/2025/01/07/sverre-aarseth-father-of-open-source-stellar-dynamics-has-passed-on-to-a-higher-orbit/),\n", | ||
"we wanted to remember him by showcasing some examples of some of his legacy in NEMO, in the process cleaning up some of NEMO's code.\n", | ||
"\n", | ||
"Sverre has always made his code available for anybody to use. His current body of work can be found at https://people.ast.cam.ac.uk/~sverre/web/pages/nbody.htm\n", | ||
"\n", | ||
"\n", | ||
"The following programs are avaiilable in NEMO:\n", | ||
"\n", | ||
"* [nbody0, nbody00](https://teuben.github.io/nemo/man_html/nbody0.1.html) - version from Binney & Tremaine's \"Galactic Dynamics\" (1987) book, dubbed the Micky Mouse version by Sverre\n", | ||
"* nbody1, runbody1\n", | ||
"* nbody2, runbody2\n", | ||
"* nbody4, runbody4\n", | ||
"* nbody5 - Regularized AC N-body code with triple & binary collisions\n", | ||
"* nbody6, runbody6 - Hermite N-body code with optional stellar evolution\n", | ||
"* firstn - von Hoerners first N-body code\n", | ||
"* hermit\n", | ||
"* u4tos, stou4 - conversion programs of Sverre's \"UNIT4\" files to and from NEMO snapshot's\n", | ||
"* u3tos - conversion program of Sverre's \"UNIT3\" file to a NEMO snapshot\n", | ||
"\n", | ||
"\n", | ||
"# Loading NEMO\n", | ||
"\n", | ||
"We start by loading NEMO in the shell (your location will likely differ)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "0febd3b4-f29f-4b33-a172-7779666b26ba", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"source $HOME/NEMO/nemo/nemo_start.sh\n", | ||
"nemo" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "a0b8d20a-a7f7-40bb-8b12-3e6c95b4cb77", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "4f6c80e3-688b-4b95-be5b-d8cbf8fb0d98", | ||
"metadata": {}, | ||
"source": [ | ||
"# nbody0, nbody00\n", | ||
"\n", | ||
"This code was published in the Appendix of the 1987 (first) edition of Binney & Tremaine's *Galactic Dynamics*. The code\n", | ||
"can be found in \n", | ||
"**$NEMO/src/nbody/evolve/aarseth/nbody0**. The FORTRAN version reads input from \n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "aee511ff-a61e-4497-8111-e5ab2ea18bcd", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"man nbody0" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6fc2c8ee-6e47-4d5e-9988-195a1307fb1c", | ||
"metadata": {}, | ||
"source": [ | ||
"# nbody1, runbody1\n", | ||
"\n", | ||
"This code is an official version from 1997, though minor updates have been tracked up to a 2019 fix to the KZ(15) parameter. Within NEMO the code lives in **$NEMO/src/nbody/evolve/aarseth/nbody1**\n", | ||
"\n", | ||
"This version also introduces the more formal *run* interface in NEMO to allow one to run legacy codes with a NEMO command line interface. It also includes conversion between NEMO's snapshots and NBODYx files (unit3, unit4)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "6aaa76a2-df8d-4993-86be-7f34d252cba3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "19212aef-7a50-4d5e-8ee9-acee4d2c2078", | ||
"metadata": {}, | ||
"source": [ | ||
"# nbody2, runbody2\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "dc2b4aeb-4352-41bb-a353-9f66e3de5808", | ||
"metadata": {}, | ||
"source": [ | ||
"## A Plummer sphere\n", | ||
"\n", | ||
"To create a Plummer (1911) sphere with 128 particles the **mkplummer** program is available. \n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "9caccf67-7ea6-4319-bb0a-71cebd7a7b0e", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"mkplummer p128 128" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "0d05dabb-f4f2-42ec-a08c-b00becc4fb00", | ||
"metadata": {}, | ||
"source": [ | ||
"The contents is binary. So viewing contents needs a program **tsf** (*type structured file*)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3ef8397c-1275-44db-a8b0-b7df102cd755", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"tsf p128" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "60d90da4-95b3-4220-95a0-f3d4d944332a", | ||
"metadata": {}, | ||
"source": [ | ||
"## Integrate it:\n", | ||
"\n", | ||
"The **hackcode1** program is the original Barnes and Hut (1985) tree code N-logN algorithm to integrate an N-body system." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "eeef980c-e486-43f5-a181-8d50136e7e33", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"hackcode1 p128 p128.out tstop=2 " | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ccecb826-155e-4c1b-9455-e09ac1a40fcc", | ||
"metadata": {}, | ||
"source": [ | ||
"Display some diagnostics, such as energy and center of mass motion" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "6c0ebe67-32c8-40c6-8da1-465175882716", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"snapdiagplot p128.out yapp=fig1.png/png\n", | ||
"ls\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "f89cf800-6c29-4cb9-b788-090f8012ce6b", | ||
"metadata": {}, | ||
"source": [ | ||
"This gives around 1% energy conservation, whichis not too bad, at least for galactic type simulations. For star clusters probably not too great at all.\n", | ||
"\n", | ||
"![alt text](fig1.png \"Title\")\n", | ||
"\n", | ||
"Now plot in a two by two panel the X-Y projections of the integration at times 0, 1 and 2." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ef31bc23-25db-48f5-ab4b-5d0e90fffa86", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"snapplot p128.out nxy=2,2 times=0,1,2 yapp=fig2.png/png\n", | ||
"ls" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "4d5ff810-1c91-4323-b344-eba52c12f84f", | ||
"metadata": {}, | ||
"source": [ | ||
"![alt text](fig2.png \"Title\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "b4549872-eb2b-4f37-8c92-c7d591388abe", | ||
"metadata": {}, | ||
"source": [ | ||
"# nbody4, runbody4" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "b48e2ea9-d87f-4aa2-abab-92407aea029c", | ||
"metadata": {}, | ||
"source": [ | ||
"# nbody5\n", | ||
"\n", | ||
"Unlike other versions, this version does not yet have a **runbody5**, essentially because **nbody5** is not maintained, and **nbody6** should be used. Yet, the manual page talks about a benchmark and it was fun to compare the performance with the numbers from 1995 when this was documented." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "3e01e4f1-39d5-49d8-8ebd-1439ba1752ea", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"man nbody5" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8a79cbb1-29d9-40bc-8bfe-16bea5f6c5ab", | ||
"metadata": {}, | ||
"source": [ | ||
"# nbody6, runbody6" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "63d9eff9-c644-4c6d-8df7-8efcaf74ca31", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Bash", | ||
"language": "bash", | ||
"name": "bash" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": "shell", | ||
"file_extension": ".sh", | ||
"mimetype": "text/x-sh", | ||
"name": "bash" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |