Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
testEvolve.cpp
2 #include "testOrbitSolver.h"
3 #include "testTidalTorquePower.h"
5 #include "testLockMonitoring.h"
6 
7 #ifdef STANDALONE
8 
9 #include <iostream>
10 #include <iomanip>
11 
12 class SinFunction : public Core::OneArgumentDiffFunction {
13 private:
14  double __frequency, __phase;
15 public:
16  SinFunction(double frequency = 1.0, double phase = 0.0) :
17  __frequency(frequency), __phase(phase) {}
18 
19  double operator()(double x) const
20  {return std::sin(__frequency * x + __phase);}
21 
22  double range_high() const {return Core::Inf;}
23  double range_low() const {return -Core::Inf;}
24 
27  Core::InterpSolutionIterator crossings(double = 0) const
28  {
30  "Finding all solutinos of Sin is not implemented."
31  );
32  };
33 
38  const Core::FunctionDerivatives *deriv(double x) const
39  {
41  operator()(x),
42  __frequency * std::cos(__frequency * x + __phase),
43  -std::pow(__frequency, 2) * operator()(x)
44  );
45  }
46 };
47 
48 
49 int main()
50 {
51  std::cout.setf(std::ios_base::scientific);
52  std::cout.precision(16);
53 
54  /*
55  SinFunction sin_function;
56  InverseFunction arcsin_function(sin_function, -1.0);
57 
58  std::cout << std::setw(25) << "x"
59  << std::setw(25) << "f(x)"
60  << std::setw(25) << "inverted"
61  << std::setw(25) << "arcsin(x)"
62  << std::endl;
63  for(double x = -1.0; x <= 1.0; x+=1e-2) {
64  double solution = arcsin_function(x),
65  expected = std::asin(x);
66  solution -= 2.0 * M_PI * std::floor(solution / (2.0 * M_PI));
67  expected -= 2.0 * M_PI * std::floor(expected / (2.0 * M_PI));
68  if(solution > 0.5 * M_PI && solution < 1.5 * M_PI)
69  solution = 3.0 * M_PI - solution;
70  std::cout << std::setw(25) << x
71  << std::setw(25) << sin_function(solution)
72  << std::setw(25) << solution
73  << std::setw(25) << expected
74  << std::endl;
75  }
76  return 0;
77 
78  Oblique10LinearQuantity q10(1.05 * M_PI, M_PI, 0.1 * M_PI);
79  Oblique20LinearQuantity q20(1.05 * M_PI, M_PI, 0.1 * M_PI);
80  std::cerr << std::setw(25) << "S"
81  << std::setw(25) << "L10(S)"
82  << std::setw(25) << "L20(S)"
83  << std::endl;
84  for(double s = 0.05 * M_PI; s <= 0.1 * M_PI; s+= 0.01 * M_PI)
85  std::cerr << std::setw(25) << s
86  << std::setw(25) << q10(s)
87  << std::setw(25) << q20(s)
88  << std::endl;
89  return 0;
90  */
91 
93  "eccentricity_expansion_coef_O200.txt"
94  );
95 
96  std::cout.setf(std::ios_base::scientific);
97  std::cout.precision(16);
98  std::cerr.setf(std::ios_base::scientific);
99  std::cerr.precision(16);
100  Test::TextOutput output(Test::TextOutput::Verbose);
101 
102  Test::Suite all_tests;
103 /* all_tests.add(
104  std::auto_ptr<Test::Suite>(new Evolve::test_GravitationalPotential)
105  );
106  all_tests.add(
107  std::auto_ptr<Test::Suite>(new Evolve::test_TidalTorquePower)
108  );
109  all_tests.add(
110  std::auto_ptr<Test::Suite>(new Evolve::test_DifferentialEquations)
111  );
112  all_tests.add(
113  std::auto_ptr<Test::Suite>(new Evolve::test_OrbitSolver)
114  );*/
115  all_tests.add(
116  std::auto_ptr<Test::Suite>(new Evolve::test_LockMonitoring)
117  );
118  return (all_tests.run(output)
119  ? EXIT_SUCCESS
120  : EXIT_FAILURE);
121 }
122 #endif
const double Inf
Infinity.
Definition: Common.h:36
Declares the test suite that exercises the OrbitSolver class and some other clasess necessary to acco...
Declare a unit tests class that check the calculations of tidal torque and power. ...
Unit tests that check the expansion of the gravitational potential vs. analytic expressions.
virtual InterpSolutionIterator crossings(double y=0) const=0
An iterator over the abscissas where the function takes the given y value.
A class representing a once differentiable function of a single argument.
Definition: Functions.h:104
Any runtime error.
Definition: Error.h:61
An iterator over a set of solutions to an interpolating function.
The test suite that ensures the correct locks are selected for monitoring and the fixes applied to th...
static void read_eccentricity_expansion(const std::string &fname)
Reads the eccentricity expansion coefficients of .
A class representing arbitrary order derivatives of a function.
Definition: Functions.h:66
A class for the derivatives of a cubic spline (=0 for order>2).
Definition: Functions.h:77
Unit tests that check the differential equations for eccentricity and semimajor against analytic expr...
Unit tests that check the machinery for monitoring potential tidal locks.
virtual const FunctionDerivatives * deriv(double x) const =0
Returns a pointer to the derivative of the function.
virtual double range_high() const=0
The lower end of the range over which the function is defined.
virtual double operator()(double in_value) const=0
The value of the function at the given abscissa.
virtual double range_low() const=0
The upper end of the range over which the function is defined.