Skip to content

Commit

Permalink
Fixes AstrodynamicalSolvers tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cadojo committed Nov 13, 2024
1 parent 23f98f1 commit 58ad1e1
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 69 deletions.
6 changes: 3 additions & 3 deletions lib/AstrodynamicalSolvers/src/CR3BSolvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function extraplanar_differential(state::AbstractVector, μ)
f = CR3BFunction()
accel = f(state, (μ,), NaN)

F = @views [
F = [
state[10] state[34] accel[4]
state[12] state[36] accel[6]
state[8] state[32] state[5]
Expand Down Expand Up @@ -171,7 +171,7 @@ function lyapunov(x, ẏ, μ, T; reltol = 1e-12, abstol = 1e-12, maxiters = 10)
return (; x = x, ẏ = ẏ, Δt = 2τ)
end

correction = planar_differential(@views(solution.u[end]), μ)
correction = planar_differential(solution.u[end], μ)

_z = z + correction.δz
_ẏ =+ correction.δẏ
Expand Down Expand Up @@ -243,7 +243,7 @@ function lyapunov(x, ẏ, μ, T; reltol = 1e-12, abstol = 1e-12, maxiters = 10)
end

function lyapunov(u::AbstractVector, μ, T; kwargs...)
corrected = lyapunov(@views(u[begin]), @views(u[begin+4]), μ, T)
corrected = lyapunov(u[begin], u[begin+4], μ, T)

return typeof(u)(@SVector [corrected.x, 0, 0, 0, corrected.ẏ, 0]), corrected.T
end
Expand Down
62 changes: 1 addition & 61 deletions lib/AstrodynamicalSolvers/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ end
solution =
solve(problem, Vern9(), reltol = 1e-12, abstol = 1e-12, saveat = (T / 10))

solution.u
solution.u[begin:begin+9]
end

@test ics [
Expand Down Expand Up @@ -552,50 +552,6 @@ end
6.241725963443699,
6.540160859407583,
],
[
0.9894058673149445,
7.496100275905479e-15,
0.005986079972946951,
-5.224004126394785e-14,
0.012509732067479662,
2.0208745832464827e-14,
363.5695646260086,
-98.06514156622599,
-47.32080144069423,
697.403493226936,
-355.9757987239261,
-273.5580556895539,
-150.84678203289957,
41.30059843066769,
19.504183945583154,
-288.5621336671776,
148.34069711110283,
112.7515351286987,
-110.89785303818041,
30.40698418319986,
15.347602546829501,
-212.7440873239205,
109.04417094750771,
83.74272666784147,
147.89291423249102,
-39.776655263719505,
-19.506758521547493,
284.01625409850567,
-144.93904643230533,
-110.89785303784609,
39.776655263625734,
-11.022980358853847,
-5.037110248617916,
76.01918084826457,
-38.25271209672777,
-30.406984183046543,
-19.506758521645583,
5.037110248654976,
2.2693997822749954,
-37.246580943614184,
19.509333097636393,
15.347602546859227,
],
]

unstable = [diverge(ic[1:6], reshape(ic[7:end], 6, 6), Φ; eps = 1e-8) for ic in ics]
Expand Down Expand Up @@ -681,14 +637,6 @@ end
0.010601178931901838,
0.004737087172996553,
],
[
0.9894058633306714,
1.0720548026638724e-9,
0.005986080494545013,
-7.646033252523916e-9,
0.012509735977239008,
2.992840604048945e-9,
],
]

stable = [converge(ic[1:6], reshape(ic[7:end], 6, 6), Φ; eps = 1e-8) for ic in ics]
Expand Down Expand Up @@ -774,14 +722,6 @@ end
0.01060118194201734,
0.004737081701461207,
],
[
0.9894058633306714,
-1.0720398109166672e-9,
0.005986080494545012,
7.645928773607352e-9,
0.012509735977239006,
-2.9928001869866915e-9,
],
]
end

Expand Down
71 changes: 71 additions & 0 deletions paper/notebooks/jovian-moons.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Re-touring Jovian Moons\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[32m\u001b[1m Activating\u001b[22m\u001b[39m project at `~/Projects/Astrodynamics/GeneralAstrodynamics.jl/paper`\n",
"\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n",
"\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/Projects/Astrodynamics/GeneralAstrodynamics.jl/paper/Project.toml`\n",
"\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/Projects/Astrodynamics/GeneralAstrodynamics.jl/paper/Manifest.toml`\n"
]
}
],
"source": [
"import Pkg\n",
"Pkg.activate(joinpath(@__DIR__, \"..\"))\n",
"\n",
"Pkg.develop(\n",
" [\n",
" Pkg.PackageSpec(; path=joinpath(@__DIR__, \"..\", \"..\", \"lib\", \"AstrodynamicalCalculations\")),\n",
" Pkg.PackageSpec(; path=joinpath(@__DIR__, \"..\", \"..\", \"lib\", \"AstrodynamicalModels\")),\n",
" Pkg.PackageSpec(; path=joinpath(@__DIR__, \"..\", \"..\", \"lib\", \"AstrodynamicalSolvers\")),\n",
" Pkg.PackageSpec(; path=joinpath(@__DIR__, \"..\", \"..\")),\n",
" ]\n",
")\n",
"\n",
"Pkg.instantiate()\n",
"\n",
"using SPICE, SPICEKernels\n",
"using GeneralAstrodynamics, Plots\n",
"using OrdinaryDiffEq, StaticArrays\n",
"\n",
"furnsh(\n",
" jup344(), # position and velocity data the Jupiter system\n",
" latest_leapseconds_tls(), # timekeeping, parsing epochs\n",
" gm_de440(), # mass parameters for major solar system bodies\n",
" pck00011(), # physical properties of major solar system bodies\n",
"\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.11.1",
"language": "julia",
"name": "julia-1.11"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.11.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
4 changes: 2 additions & 2 deletions paper/notebooks/manifold-computations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -54,7 +54,7 @@
"\n",
"furnsh(\n",
" de432s(), # position and velocity data for nearby planets\n",
" latest_leapseconds_lsk(), # timekeeping, parsing epochs\n",
" latest_leapseconds_tls(), # timekeeping, parsing epochs\n",
" gm_de440(), # mass parameters for major solar system bodies\n",
" pck00011(), # physical properties of major solar system bodies\n",
")"
Expand Down
6 changes: 3 additions & 3 deletions paper/notebooks/representing-orbits.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,15 @@
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.10.4",
"display_name": "Julia 1.11.1",
"language": "julia",
"name": "julia-1.10"
"name": "julia-1.11"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.10.4"
"version": "1.11.1"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 58ad1e1

Please sign in to comment.