Skip to content

Commit

Permalink
Fancy unicode operators aren't the same as traditional ones 😔
Browse files Browse the repository at this point in the history
  • Loading branch information
cadojo committed Nov 23, 2020
1 parent cff950c commit 8ddea4f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/ThreeBody/ThreeBodyCalculations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ time_scale_factor(a, μ₁, μ₂) = orbital_period(a, μ₁+μ₂)
"""
Returns nondimensional length unit, `DU`.
"""
nondimensionalize_length(rᵢ, a) = upreferred(rᵢ a)
nondimensionalize_length(rᵢ, a) = @. upreferred(rᵢ / a)

"""
Returns nondimensional velocity unit, `DU/DT`.
"""
nondimensionalize_velocity(vᵢ, a, Tₛ) = vᵢ ./ (a ÷ Tₛ)
nondimensionalize_velocity(vᵢ, a, Tₛ) = @. upreferred(vᵢ / (a / Tₛ))

"""
Returns nondimensional time unit, `DT`.
Expand All @@ -27,7 +27,7 @@ nondimensionalize_time(t, a, μ₁, μ₂) = t ÷ time_scale_factor(a, μ₁, μ
"""
Returns nondimensional mass parameter, `μ`.
"""
nondimensionalize_mass_parameter(μ₁, μ₂) = min(μ₁,μ₂) ÷ (μ₁+μ₂)
nondimensionalize_mass_parameter(μ₁, μ₂) = min(μ₁,μ₂) / (μ₁+μ₂)

"""
Returns nondimensional form of (`Unitful`) scalar posiion.
Expand Down Expand Up @@ -203,4 +203,4 @@ end
"""
Returns the position and velocity vectors in the synodic (rotating) reference frame.
"""
synodic(rᵢ, vᵢ, a, Tₛ) = nondimensionalize(rᵢ, a), nondimensionalize(vᵢ, a, Tₛ)
synodic(rᵢ, vᵢ, a, Tₛ) = nondimensionalize(rᵢ, a), nondimensionalize(vᵢ, a, Tₛ)
7 changes: 6 additions & 1 deletion src/ThreeBody/ThreeBodyStates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ struct ThreeBodySystem{F<:AbstractFloat} <: OrbitalSystem
TT <: Time{<:AbstractFloat}
}

T = typeof(promote(a, μ₁, μ₂, r, v, t)[1]).val
T = promote_type(typeof(a.val),
typeof(μ₁.val),
typeof(μ₂.val),
map(x->typeof(x.val), r)...,
map(x->typeof(x.val), v)...,
typeof(t.val))

if length(r) length(v) 3
throw(ArgumentError(string("Both `r` and `v` provided to `ThreeBodySystem` ",
Expand Down
4 changes: 2 additions & 2 deletions src/TwoBody/twobody_calculations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ mass_parameter(body::CelestialBody) = body.μ
"""
Returns the orbital period.
"""
orbital_period(a, μ) = upreferred(2π * (a^3 / μ))
orbital_period(a, μ) = 2π * (upreferred(a^3 / μ))
orbital_period(orbit::Orbit) = orbital_period(orbit.a, orbit.body.μ)

"""
Expand Down Expand Up @@ -374,4 +374,4 @@ function Base.isequal(c1::Orbit, c2::Orbit)
mod(c1.ν, 360u"°") == mod(c2.ν, 360u"°") &&
c1.body == c2.body

end
end

0 comments on commit 8ddea4f

Please sign in to comment.