Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
TidalPotential.h
Go to the documentation of this file.
1 
9 #ifndef __UNIT_TESTS_TIDAL_POTENTIAL_H
10 #define __UNIT_TESTS_TIDAL_POTENTIAL_H
11 
12 #include "EccentricOrbit.h"
13 #include <cmath>
14 
15 namespace Evolve {
18  private:
21 
22  double
26 
31 
32  public:
37  double primary_mass=Core::NaN,
38 
40  double secondary_mass=Core::NaN,
41 
43  double semimajor=Core::NaN,
44 
46  double eccentricity=Core::NaN,
47 
49  double inclination=Core::NaN,
50 
52  double arg_of_periapsis=Core::NaN
53  ) :
54  __orbit(primary_mass, secondary_mass, semimajor, eccentricity),
56  __arg_of_periapsis(arg_of_periapsis)
57  {}
58 
60  double inclination() const {return __inclination;}
61 
63  double &inclination() {return __inclination;}
64 
66  double arg_of_periapsis() const {return __arg_of_periapsis;}
67 
70 
72  const EccentricOrbit &orbit() const {return __orbit;}
73 
76 
78  template<class POSITION_TYPE>
79  double operator()(
87  const POSITION_TYPE &position,
88 
91  double time
92  ) const;
93  };
94 
95  template<class POSITION_TYPE>
96  double TidalPotential::operator()(const POSITION_TYPE &position,
97  double time) const
98  {
99  Eigen::Matrix<long double, 3, 1> secondary_position =
101  2.0 * M_PI * time / __orbit.orbital_period()
102  );
103 
104 
105  //Rotate around L_hat to a coordinate system with z along L and y
106  //along SxL
107  long double z_rotated_secondary_x = (
108  secondary_position[0] * std::cos(__arg_of_periapsis)
109  -
110  secondary_position[1] * std::sin(__arg_of_periapsis)
111  );
112  long double z_rotated_secondary_y = (
113  secondary_position[0] * std::sin(__arg_of_periapsis)
114  +
115  secondary_position[1] * std::cos(__arg_of_periapsis)
116  );
117 
118  //Rotated around SxL to the final coordinate system.
119  Eigen::Matrix<long double, 3, 1>
120  transformed_secondary_position(
121  (
122  z_rotated_secondary_x * std::cos(__inclination)
123  +
124  secondary_position[2] * std::sin(__inclination)
125  ),
126  z_rotated_secondary_y,
127  (
128  -z_rotated_secondary_x * std::sin(__inclination)
129  +
130  secondary_position[2] * std::cos(__inclination)
131  )
132  );
133 
134  long double center_to_secondary =
135  transformed_secondary_position.norm();
136  long double position_to_secondary = (
137  position
138  -
139  transformed_secondary_position
140  ).norm();
141  long double result = (
143  *
145  *
146  (
147  position.dot(transformed_secondary_position)
148  /
149  std::pow(center_to_secondary, 3)
150  -
151  1.0 / position_to_secondary
152  +
153  1.0 / center_to_secondary
155  );
156  return result;
157  }
158 } //End Evolve namespace
159 
160 #endif
Basic description of two bodies in an eccentric orbit.
double & inclination()
A mutable reference to the inclination of the system.
double inclination() const
See __inclination attribute.
double arg_of_periapsis() const
The argument of periapsis of the system.
double operator()(const POSITION_TYPE &position, double time) const
Return the tidal potential at a specific position and time in SI.
Orientations of zones of bodies in a binary system.
double & arg_of_periapsis()
A mutable reference to the argument of periapsis of the system.
const double solar_radius
Radius of the sun [m].
TidalPotential(double primary_mass=Core::NaN, double secondary_mass=Core::NaN, double semimajor=Core::NaN, double eccentricity=Core::NaN, double inclination=Core::NaN, double arg_of_periapsis=Core::NaN)
Define the boundary for which to calculate the tidal potential.
const double solar_mass
Mass of the sun [kg].
Calculate the tidal potential over one component of an eccentric binary.
const EccentricOrbit & orbit() const
An unmutable reference to the binary orbit.
Eigen::Matrix< long double, 3, 1 > secondary_position(double orbital_phase) const
Secondary position vector in a coordinate system centered on the primary, with and ...
double orbital_period() const
The orbital period of the system in days.
EccentricOrbit __orbit
The binary orbit.
Declare an interface for working with eccentric orbits.
EccentricOrbit & orbit()
Mutable reference to the binary orbit.
double secondary_mass() const
The semimajor axis of the system.
const double G
Gravitational constant in SI.