Stream: helpdesk (published)

Topic: rho in Orbits.jl


view this post on Zulip brett knoss (Feb 19 2023 at 09:48):

I'm not sure how to enter the units for rho of a planet in Orbits.jl

view this post on Zulip Daniel González (Feb 19 2023 at 11:18):

Which parameter do you mean by rho?

view this post on Zulip brett knoss (Feb 19 2023 at 12:29):

rho_planet, and rho_star are two variables in the source code.

view this post on Zulip brett knoss (Feb 19 2023 at 12:30):

* `R_planet`/`Rp` -- The radius of the planet [R⊙].
* `R_star`/`Rs` -- The radius of the star [R⊙].
* `rho_star`/`ρ_star` -- The spherical star density [M⊙/R⊙³].

how do I enter this with UnitfulAstro.jl?

view this post on Zulip Daniel González (Feb 19 2023 at 13:06):

I would expect standard Unitful units for density to work there

view this post on Zulip brett knoss (Feb 19 2023 at 14:51):

What unit is that? How do I enter it?

view this post on Zulip Daniel González (Feb 19 2023 at 15:03):

Well, any valid units for mass over volume, like

julia> using Unitful

julia> 0.9u"kg"/u"m"^3
0.9 kg m^-3

view this post on Zulip Daniel González (Feb 19 2023 at 15:07):

Or do something like

julia> mass = 10u"kg"
10 kg

julia> radius = 2u"cm"
2 cm

julia> mass*3/(4π*radius^3)
0.2984155182973038 kg cm^-3

view this post on Zulip brett knoss (Feb 19 2023 at 15:33):

    M_planet=.5*1.99e30u"kg",
    M_star=.8*1.99e30u"kg",
    rho_star=0.9u"kg"/u"m"^3,
    a=1u"AU",
    t0=0u"°"

)

gives me an error that the units aren't compatable. I thought this was what I need if I don't know eccentricity, from reading the docs.

view this post on Zulip Ian Weaver (Feb 20 2023 at 00:52):

Ah, I see the mix-up. Try putting the mid-transit time in units of days u"d", not degrees u"°". We adopted this notation, i.e. [d] in the docs, to represent day so that it would be in line with the standard unit from Unitful.jl. I can see how this could be confused with the unit for degrees out of context, so I have opened a PR to try and clarify this https://github.com/JuliaAstro/Orbits.jl/pull/7


Last updated: Nov 22 2024 at 04:41 UTC