Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
testTidalTorquePower.cpp
Go to the documentation of this file.
1 
9 #include "testTidalTorquePower.h"
10 
11 namespace Evolve {
13  {
14  const double abs_tolerance=1e-6;
15  std::valarray<double> one_poly(1.0, 1);
16 
17  ConstPhaseLagZone zone(1.0, one_poly, one_poly, one_poly);
18 
19  zone.configure(true,//initialize
20  1.0,//age
21  1.0,//orbital frequency
22  0.0,//eccentricity
23  1.0,//orbital_angmom
24  0.0,//spin
25  0.0,//inclination
26  0.0,//periapsis
27  true);//spin_is_freq
28 
29  Planet::Planet planet(1.0, 1.0);
30  BinarySystem dummy_system(planet, planet, "");
31 
32  zone.change_e_order(20, dummy_system, true, 0);
33 
34  for(double e = 0.0; e <= 0.0075; e += 0.0001) {
35  zone.configure(false,//initialize
36  1.0,//age
37  1.0,//orbital frequency
38  e,//eccentricity
39  1.0,//orbital_angomm
40  0.0,//spin
41  0.0,//inclination
42  0.0,//periapsis
43  true);//spin_is_freq
44  double factor = 1.2 * M_PI,
45  expected_tidal_power = factor * (1.0 + 14.25 * e * e),
46  expected_z_torque = factor * (1.0 + 7.5 * e * e),
47  got_tidal_power = zone.tidal_power(true),
48  got_x_torque = zone.tidal_torque_x(true),
49  got_y_torque = zone.tidal_torque_y(true),
50  got_z_torque = zone.tidal_torque_z(true);
51  std::ostringstream message;
52  message << "For e = " << e
53  << " tidal power = " << got_tidal_power
54  << ", expected: " << expected_tidal_power
55  << "; difference: " << (got_tidal_power
56  -
57  expected_tidal_power)
58  << " > " << abs_tolerance;
59  TEST_ASSERT_MSG(
60  check_diff(got_tidal_power,
61  expected_tidal_power,
62  0.0,
63  abs_tolerance),
64  message.str().c_str()
65  );
66  TEST_ASSERT_MSG(
67  check_diff(got_x_torque,
68  0.0,
69  0.0,
70  1e-15),
71  "Non-zero x-torque for aligned zone!"
72  );
73  TEST_ASSERT_MSG(
74  check_diff(got_y_torque,
75  0.0,
76  0.0,
77  1e-15),
78  "Non-zero y-torque for aligned zone!"
79  );
80  message.str("");
81  message << "For e = " << e
82  << " tidal Z torque = " << got_z_torque
83  << ", expected: " << expected_z_torque
84  << "; difference: " << (got_z_torque
85  -
86  expected_z_torque)
87  << " > " << abs_tolerance;
88  TEST_ASSERT_MSG(
89  check_diff(got_z_torque,
90  expected_z_torque,
91  0.0,
92  abs_tolerance),
93  message.str().c_str()
94  );
95  }
96  }
97 
99  {
100  const unsigned MAX_E_ORDER=100;
101 
102  std::cout << std::setw(25) << "e";
103  for(unsigned e_order = 0; e_order <= MAX_E_ORDER; e_order += 10) {
104  std::ostringstream order_str;
105  order_str << "[O(e^" << e_order << ")]";
106  std::cout << std::setw(25) << "dE_dt" + order_str.str()
107  << std::setw(25) << "dLz_dt" + order_str.str();
108  }
109  std::cout << std::endl;
110 
111  std::valarray<double> one_poly(1.0, 1);
112 
113  ConstPhaseLagZone zone(1.0, one_poly, one_poly, one_poly);
114 
115  zone.configure(true,//initialize
116  1.0,//age
117  1.0,//orbital frequency
118  0.0,//eccentricity
119  1.0,//orbital_angmom
120  0.0,//spin
121  0.0,//inclination
122  0.0,//periapsis
123  true);//spin_is_freq
124 
125  Planet::Planet planet(1.0, 1.0);
126  BinarySystem dummy_system(planet, planet, "");
127 
128  for(double e = 0.0; e <= 0.99; e += 0.01) {
129  std::cout << std::setw(25) << e;
130  for(unsigned e_order = 0; e_order <= MAX_E_ORDER; e_order += 10) {
131  zone.change_e_order(e_order, dummy_system, true, 0);
132  zone.configure(false,//initialize
133  1.0,//age
134  1.0,//orbital frequency
135  e,//eccentricity
136  1.0,//orbital_angomm
137  0.0,//spin
138  0.0,//inclination
139  0.0,//periapsis
140  true);//spin_is_freq
141 
142  std::cout << std::setw(25) << zone.tidal_power(true)
143  << std::setw(25) << zone.tidal_torque_z(true);
144 
145  }
146  std::cout << std::endl;
147  }
148  }
149 
151  {
154  }
155 }//End Evolve namespace.
double tidal_power(bool above, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
The dimensionless tidal power or one of its derivatives.
A zone with constant phase lag for all tidal terms.
void test_aligned_orbit()
Test the dimensionless tidal torque and power for an equatorial orbit, as a function of eccentricity ...
Declare a unit tests class that check the calculations of tidal torque and power. ...
Single zone non-evolving planets with huge dissipation, so they always remain locked to the disk...
Definition: Planet.h:21
Orientations of zones of bodies in a binary system.
double tidal_torque_y(bool above, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
The dimensionless torque along y.
virtual void configure(bool initialize, double age, double orbital_frequency, double eccentricity, double orbital_angmom, double spin, double inclination, double periapsis, bool spin_is_frequency)
See DissipatingZone::configure().
void test_convergence()
Output a table showing the convergence as e-order is increased for aligned orbit and const phase lag...
test_TidalTorquePower()
Create the test suite.
bool check_diff(double x, double y, double frac_tolerance, double abs_tolerance)
Returns true iff .
Definition: Common.cpp:3
double tidal_torque_z(bool above, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
The dimensionless tidal torque along z.
virtual void change_e_order(unsigned new_e_order, BinarySystem &system, bool primary, unsigned zone_index)
Changes the order of the eccentricity expansion performed.
double tidal_torque_x(bool above, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
The dimensionless tidal torque along x.
Describes a system of two bodies orbiting each other.
Definition: BinarySystem.h:56