From 10f6f9e82134cd99c99834442b0338343ffb12d3 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 10 Jan 2023 15:05:14 -0500 Subject: [PATCH] Added the solar impact test case --- examples/.gitignore | 3 ++- examples/solar_impact/sundiver.py | 35 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 examples/solar_impact/sundiver.py diff --git a/examples/.gitignore b/examples/.gitignore index 2baf6fec8..151c4c774 100644 --- a/examples/.gitignore +++ b/examples/.gitignore @@ -4,4 +4,5 @@ !Fragmentation !helio_gr_test !whm_gr_test -!Chambers2013 \ No newline at end of file +!Chambers2013 +!solar_impact \ No newline at end of file diff --git a/examples/solar_impact/sundiver.py b/examples/solar_impact/sundiver.py new file mode 100644 index 000000000..e3b24e077 --- /dev/null +++ b/examples/solar_impact/sundiver.py @@ -0,0 +1,35 @@ +""" + Copyright 2023 - David Minton, Carlisle Wishard, Jennifer Pouplin, Jake Elliott, & Dana Singh + This file is part of Swiftest. + Swiftest is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + Swiftest is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with Swiftest. + If not, see: https://www.gnu.org/licenses. +""" + +#!/usr/bin/env python3 +import swiftest +import numpy as np + +# Initialize the simulation object as a variable. Arguments may be defined here or through the sim.run() method. +sim = swiftest.Simulation(compute_conservation_values=True, rotation=True, integrator="symba") + +# Add the modern planets and the Sun using the JPL Horizons Database. +sim.add_solar_system_body(["Sun","Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune","Pluto"]) + +density = 3000.0 * sim.KG2MU / sim.M2DU**3 + +# Make a body with a periapsis inside the Sun's radius +q = 0.9 * swiftest.RSun * sim.M2DU +a = 0.1 +e = 1.0 - q / a +M = 1e-4 * swiftest.MEarth * sim.KG2MU +R = (3 * M / (4 * np.pi * density)) ** (1.0 / 3.0) +rot = 2 * sim.init_cond.sel(name="Earth")['rot'] +sim.add_body(name="Sundiver", a=a, e=e, inc=0.0, capom=0.0, omega=0.0, capm=180.0, mass=M, radius=R, Ip=[0.4,0.4,0.4], rot=rot) +sim.get_parameter() + +# Run the simulation. Arguments may be defined here or thorugh the swiftest.Simulation() method. +sim.run(tstart=0.0, tstop=2e-2, dt=0.001, istep_out=1, dump_cadence=0)