8#ifndef __mx_astro_planets_hpp__
9#define __mx_astro_planets_hpp__
11#include "../math/constants.hpp"
60template <
typename units>
63 typedef typename units::realT realT;
65 using namespace mx::astro::constants;
67 if( mass < 4.1 * massEarth<units>() )
71 else if( mass <
static_cast<realT
>( 15.84 ) * massEarth<units>() )
73 return 0.62 * pow( mass / massEarth<units>(),
static_cast<realT
>( 0.67 ) ) * radEarth<units>();
75 else if( mass < 3591.1 * massEarth<units>() )
77 realT logM = log10( mass / massEarth<units>() );
79 return (
static_cast<realT
>( 14.0211 ) -
static_cast<realT
>( 44.8414 ) * logM +
80 static_cast<realT
>( 53.6554 ) * pow( logM, 2 ) -
static_cast<realT
>( 25.3289 ) * pow( logM, 3 ) +
81 static_cast<realT
>( 5.4920 ) * pow( logM, 4 ) - 0.4586 * pow( logM, 5 ) ) *
86 return static_cast<realT
>( 32.03 ) * pow( mass / massEarth<units>(),
static_cast<realT
>( -0.125 ) ) *
117template <
typename units>
118typename units::realT planetMass2RadiusWThorngren(
typename units::realT mass )
120 typedef typename units::realT realT;
122 using namespace mx::astro::constants;
124 if( mass < 4.1 * massEarth<units>() )
128 else if( mass <
static_cast<realT
>( 15.00 ) * massEarth<units>() )
130 return 0.6413 * pow( mass / massEarth<units>(),
static_cast<realT
>( 0.6477 ) ) * radEarth<units>();
132 else if( mass < 12 * massJupiter<units>() )
134 realT lM = log10( mass / massJupiter<units>() );
136 return (
static_cast<realT
>( 0.96 ) +
static_cast<realT
>( 0.21 ) * lM -
137 static_cast<realT
>( 0.20 ) * pow( lM, 2 ) ) *
142 return static_cast<realT
>( 29.97 ) * pow( mass / massEarth<units>(),
static_cast<realT
>( -0.125 ) ) *
155template <
typename units>
156typename units::realT planetMass2RadiusThorngren(
typename units::realT mass )
158 typedef typename units::realT realT;
160 using namespace mx::astro::constants;
162 realT lM = log10( mass / massJupiter<units>() );
164 return ( 0.96 + 0.21 * lM - 0.2 * pow( lM, 2 ) ) * radJupiter<units>();
186template <
typename units>
187typename units::realT planetMass2RadiusFab2014(
typename units::realT mass )
189 typedef typename units::realT realT;
191 using namespace mx::astro::constants;
193 if( mass < massEarth<units>() )
199 return pow( mass / massEarth<units>(),
static_cast<realT
>( 1 ) /
static_cast<realT
>( 2.06 ) ) *
constexpr floatT six_fifths()
Return 6/5 in the specified precision.
units::realT planetMass2Radius(typename units::realT mass)
An ad-hoc planetary mass-to-radius relationship (old version)
Unit specifications and conversions.