This repository was archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
162 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*/param.* |
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,155 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2c4f59ea-1251-49f6-af1e-5695d7e25500", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import swiftest\n", | ||
"import numpy as np\n", | ||
"from numpy.random import default_rng" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "6054c7ab-c748-4b39-9fee-d8b27326f497", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Initialize the simulation object as a variable\n", | ||
"sim = swiftest.Simulation(tstart=0.0, tstop=10.0, dt=0.005, tstep_out=1.0, fragmentation=True, minimum_fragment_mass = 2.5e-11, mtiny=2.5e-8)\n", | ||
"sim.get_parameter()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "1c122676-bacb-447c-bc37-5ef8019be0d0", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Add the modern planets and the Sun using the JPL Horizons Database\n", | ||
"sim.add_solar_system_body([\"Sun\",\"Mercury\",\"Venus\",\"Earth\",\"Mars\",\"Jupiter\",\"Saturn\",\"Uranus\",\"Neptune\",\"Pluto\"])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "97fe9f16-bc2e-443c-856b-7dacb1267f2d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Add 5 user-defined massive bodies\n", | ||
"npl = 5\n", | ||
"density_pl = 3000.0 / (sim.param['MU2KG'] / sim.param['DU2M'] ** 3)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "566a742e-3935-484d-9c7a-87310b6aaa3a", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"name_pl = [\"MassiveBody_01\", \"MassiveBody_02\", \"MassiveBody_03\", \"MassiveBody_04\", \"MassiveBody_05\"]\n", | ||
"a_pl = default_rng().uniform(0.3, 1.5, npl)\n", | ||
"e_pl = default_rng().uniform(0.0, 0.3, npl)\n", | ||
"inc_pl = default_rng().uniform(0.0, 90, npl)\n", | ||
"capom_pl = default_rng().uniform(0.0, 360.0, npl)\n", | ||
"omega_pl = default_rng().uniform(0.0, 360.0, npl)\n", | ||
"capm_pl = default_rng().uniform(0.0, 360.0, npl)\n", | ||
"GM_pl = (np.array([6e23, 8e23, 1e24, 3e24, 5e24]) / sim.param['MU2KG']) * sim.GU\n", | ||
"R_pl = np.full(npl, (3 * (GM_pl / sim.GU) / (4 * np.pi * density_pl)) ** (1.0 / 3.0))\n", | ||
"Rh_pl = a_pl * ((GM_pl) / (3 * sim.GU)) ** (1.0 / 3.0)\n", | ||
"Ip1_pl = [0.4, 0.4, 0.4, 0.4, 0.4]\n", | ||
"Ip2_pl = [0.4, 0.4, 0.4, 0.4, 0.4]\n", | ||
"Ip3_pl = [0.4, 0.4, 0.4, 0.4, 0.4]\n", | ||
"rotx_pl = [0.0, 0.0, 0.0, 0.0, 0.0]\n", | ||
"roty_pl = [0.0, 0.0, 0.0, 0.0, 0.0]\n", | ||
"rotz_pl = [0.0, 0.0, 0.0, 0.0, 0.0]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d2c14121-e5b4-45bd-99a7-acde0ee77955", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sim.add_body(name_pl, a_pl, e_pl, inc_pl, capom_pl, omega_pl, capm_pl, GMpl=GM_pl, Rpl=R_pl, rhill=Rh_pl, Ip1=Ip1_pl, Ip2=Ip2_pl, Ip3=Ip3_pl, rotx=rotx_pl, roty=roty_pl, rotz=rotz_pl)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b3f979b3-5238-492f-8589-0cf5d9a3c2bc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Add 10 user-defined test particles\n", | ||
"ntp = 10" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "5777c1bb-8c91-452a-8869-ce6f951b33a3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"name_tp = [\"TestParticle_01\", \"TestParticle_02\", \"TestParticle_03\", \"TestParticle_04\", \"TestParticle_05\", \"TestParticle_06\", \"TestParticle_07\", \"TestParticle_08\", \"TestParticle_09\", \"TestParticle_10\"]\n", | ||
"a_tp = default_rng().uniform(0.3, 1.5, ntp)\n", | ||
"e_tp = default_rng().uniform(0.0, 0.3, ntp)\n", | ||
"inc_tp = default_rng().uniform(0.0, 90, ntp)\n", | ||
"capom_tp = default_rng().uniform(0.0, 360.0, ntp)\n", | ||
"omega_tp = default_rng().uniform(0.0, 360.0, ntp)\n", | ||
"capm_tp = default_rng().uniform(0.0, 360.0, ntp)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "8df4bcb7-46a6-402a-b10f-f37c55a0fdee", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sim.add_body(name_tp, a_tp, e_tp, inc_tp, capom_tp, omega_tp, capm_tp)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "fd30638b-6868-4162-bc05-1011bb255968", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Run the simulation\n", | ||
"sim.run()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "swiftest", | ||
"language": "python", | ||
"name": "swiftest" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file was deleted.
Oops, something went wrong.
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