-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt changes in TI # 156 (refact taylorize) (#8)
* Refactor taylorize * Explicit taylorize code * Type-stability for propagate * Simplify propagate * Add tests * ArgParse for integrate_ephemeris.jl * Add constants * Update TS and TI, custom serializatoin, simplify propagate and precompilation * Fix an error in DE430! * Minor fixes * More minor fixes * Custom print for TaylorInterpolant * Minor fixes * Relative state vector callability methods * Bump minor version * Specify what we mean by backward integration * Minor fix * Update TaylorSeries and Abstract TaylorInterpolant fields * Fix join method for TaylorInterpolant * Compat version for JLD2 * Add ArgParse as a dependency * Remove number of threads from main
- Loading branch information
Showing
18 changed files
with
14,276 additions
and
5,589 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
*.jld | ||
*.jld | ||
*.jld2 |
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
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 |
---|---|---|
@@ -1,35 +1,113 @@ | ||
#Multi-threaded: | ||
#JULIA_NUM_THREADS=<number-of-threads> julia --project=@. integrate_ephemeris.jl | ||
#Single-threaded: | ||
#julia --project=@. integrate_ephemeris.jl | ||
|
||
@show Threads.nthreads() | ||
|
||
using PlanetaryEphemeris | ||
using Dates | ||
|
||
#script parameters (TODO: use ArgParse.jl instead) | ||
const maxsteps = 1000000 | ||
# jd0 = datetime2julian(DateTime(1969,6,28,0,0,0)) #starting time of integration | ||
const jd0 = datetime2julian(DateTime(2000,1,1,12)) #starting time of integration | ||
const nyears = 2031.0 - year(julian2datetime(jd0)) | ||
@show jd0, J2000, jd0-J2000 | ||
const dense = true #false | ||
const dynamics = DE430! | ||
@show dynamics | ||
const nast = 343 #16 # number of asteroid perturbers | ||
const quadmath = false #true # use quadruple precision | ||
###bodyind = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 27, 28, 30, 40, 41, 46, 55, 62, 73, 113, 115, 277, 322] # SS + 25 ast perturbers | ||
const bodyind = 1:(11+16) #1:(11+nast) # body indices in output | ||
|
||
# integration parameters | ||
const order = 25 | ||
const abstol = 1.0E-20 | ||
|
||
#integrator warmup | ||
PlanetaryEphemeris.propagate(1, jd0, nyears, output=false, dense=dense, dynamics=dynamics, nast=nast, quadmath=quadmath, bodyind=bodyind, order=order, abstol=abstol) | ||
println("*** Finished warmup") | ||
|
||
# perform full integration | ||
PlanetaryEphemeris.propagate(maxsteps, jd0, nyears, dense=dense, dynamics=dynamics, nast=nast, quadmath=quadmath, bodyind=bodyind, order=order, abstol=abstol) | ||
println("*** Finished full integration") | ||
using ArgParse, PlanetaryEphemeris, Dates | ||
|
||
function parse_commandline() | ||
|
||
s = ArgParseSettings() | ||
|
||
# Program name (for usage & help screen) | ||
s.prog = "integrate_ephemeris.jl" | ||
# Desciption (for help screen) | ||
s.description = "Integrates JPL DE430 Ephemeris" | ||
|
||
@add_arg_table! s begin | ||
"--maxsteps" | ||
help = "Maximum number of steps during integration" | ||
arg_type = Int | ||
default = 1_000_000 | ||
"--jd0" | ||
help = "Starting time of integration; options are: \"2000-01-01T12:00:00\" or \"1969-06-28T00:00:00\"" | ||
arg_type = DateTime | ||
default = DateTime(2000, 1, 1, 12) # DateTime(1969, 6, 28, 0, 0, 0) | ||
"--nyears" | ||
help = "Number of years" | ||
arg_type = Float64 | ||
default = 31.0 | ||
"--dynamics" | ||
help = "Dynamical model function" | ||
arg_type = Function | ||
default = DE430! | ||
"--nast" | ||
help = "Number of asteroid perturbers" | ||
arg_type = Int | ||
default = 343 # 16 | ||
"--order" | ||
help = "Order of Taylor polynomials expansions during integration" | ||
arg_type = Int | ||
default = 25 | ||
"--abstol" | ||
help = "Absolute tolerance" | ||
arg_type = Float64 | ||
default = 1.0E-20 | ||
"--parse_eqs" | ||
help = "Whether to use the taylorized method of jetcoeffs (a-priori faster) or not" | ||
arg_type = Bool | ||
default = true | ||
"--bodyind" | ||
help = "Body indices in output" | ||
arg_type = UnitRange{Int} | ||
default = 1:(11+16) # 1:(11+nast) | ||
# bodyind = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 27, 28, 30, 40, 41, 46, 55, 62, 73, 113, 115, 277, 322] # SS + 25 ast perturbers | ||
end | ||
|
||
s.epilog = """ | ||
examples:\n | ||
\n | ||
# Multi-threaded\n | ||
julia -t 4 --project integrate_ephemeris.jl --maxsteps 100 --jd0 "2000-01-01T12:00:00"\n | ||
\n | ||
# Single-threaded\n | ||
julia --project integrate_ephemeris.jl --maxsteps 100 --jd0 "2000-01-01T12:00:00"\n | ||
\n | ||
""" | ||
|
||
return parse_args(s) | ||
end | ||
|
||
function main(maxsteps::Int, jd0_datetime::DateTime, nyears::Float64, dynamics::Function, nast::Int, | ||
bodyind::UnitRange{Int}, order::Int, abstol::Float64, parse_eqs::Bool) | ||
|
||
println("*** Integrate Ephemeris ***") | ||
println("Number of threads: ", Threads.nthreads()) | ||
println("Dynamical function: ", dynamics) | ||
|
||
jd0 = datetime2julian(jd0_datetime) | ||
println( "Initial time of integration: ", string(jd0_datetime) ) | ||
println( "Final time of integration: ", string(julian2datetime(jd0 + nyears*yr)) ) | ||
|
||
println("*** Integrator warmup ***") | ||
_ = propagate(1, jd0, nyears, Val(true), dynamics = dynamics, nast = nast, order = order, abstol = abstol, | ||
parse_eqs = parse_eqs) | ||
println("*** Finished warmup ***") | ||
|
||
println("*** Full integration ***") | ||
sol = propagate(maxsteps, jd0, nyears, Val(true), dynamics = dynamics, nast = nast, order = order, abstol = abstol, | ||
parse_eqs = parse_eqs) | ||
println("*** Finished full integration ***") | ||
|
||
# Total number of bodies (Sun + 8 Planets + Moon + Pluto + Asteroids) | ||
N = 11 + nast | ||
|
||
selecteph2jld2(sol, bodyind, nyears, N) | ||
|
||
nothing | ||
end | ||
|
||
function main() | ||
|
||
parsed_args = parse_commandline() | ||
|
||
maxsteps = parsed_args["maxsteps"] :: Int | ||
jd0_datetime = parsed_args["jd0"] :: DateTime | ||
nyears = parsed_args["nyears"] :: Float64 | ||
dynamics = parsed_args["dynamics"] :: Function | ||
nast = parsed_args["nast"] :: Int | ||
bodyind = parsed_args["bodyind"] :: UnitRange{Int} | ||
order = parsed_args["order"] :: Int | ||
abstol = parsed_args["abstol"] :: Float64 | ||
parse_eqs = parsed_args["parse_eqs"] :: Bool | ||
|
||
main(maxsteps, jd0_datetime, nyears, dynamics, nast, bodyind, order, abstol, parse_eqs) | ||
|
||
end | ||
|
||
main() |
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
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
Oops, something went wrong.
0af6c0d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
0af6c0d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/80847
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: