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::Vector3d secondary_position = __orbit.secondary_position(
100  2.0 * M_PI * time / __orbit.orbital_period()
101  );
102 
103 
104  //Rotate around L_hat to a coordinate system with z along L and y
105  //along SxL
106  double z_rotated_secondary_x = (
107  secondary_position[0] * std::cos(__arg_of_periapsis)
108  -
109  secondary_position[1] * std::sin(__arg_of_periapsis)
110  );
111  double z_rotated_secondary_y = (
112  secondary_position[0] * std::sin(__arg_of_periapsis)
113  +
114  secondary_position[1] * std::cos(__arg_of_periapsis)
115  );
116 
117  //Rotated around SxL to the final coordinate system.
118  Eigen::Vector3d transformed_secondary_position(
119  (
120  z_rotated_secondary_x * std::cos(__inclination)
121  +
122  secondary_position[2] * std::sin(__inclination)
123  ),
124  z_rotated_secondary_y,
125  (
126  -z_rotated_secondary_x * std::sin(__inclination)
127  +
128  secondary_position[2] * std::cos(__inclination)
129  )
130  );
131 
132  double center_to_secondary = transformed_secondary_position.norm();
133  double position_to_secondary = (
134  position
135  -
136  transformed_secondary_position
137  ).norm();
138  return (
140  *
142  *
143  (
144  position.dot(transformed_secondary_position)
145  /
146  std::pow(center_to_secondary, 3)
147  -
148  1.0 / position_to_secondary
149  +
150  1.0 / center_to_secondary
152  );
153  }
154 } //End Evolve namespace
155 
156 #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.
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.
Eigen::Vector3d secondary_position(double orbital_phase) const
Secondary position vector in a coordinate system centered on the primary, with and ...
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.