Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
LagForcingFrequencyBreakCondition.cpp
Go to the documentation of this file.
1 
9 #define BUILDING_LIBRARY
12 
13 namespace Evolve {
14 
16  {
17  if(
18  __powerlaw_index == 0
19  ||
21  )
23  else
25  }
26 
29  const DissipatingBody &body,
30  const DissipatingBody &other_body,
31  int orbital_frequency_multiplier,
32  int spin_frequency_multiplier
33  ) :
34  __orbital_frequency_multiplier(orbital_frequency_multiplier),
35  __spin_frequency_multiplier(spin_frequency_multiplier),
36  __zone(zone),
37  __body(body),
38  __other_body(other_body),
40  __zone.tidal_term_index(orbital_frequency_multiplier,
41  spin_frequency_multiplier)
42  ),
43  __powerlaw_index(__zone.__tidal_indices[__term_index])
44  {
46  }
47 
50 #ifndef NDEBUG
51  evol_mode
52 #endif
53  ,
54  const std::valarray<double> &orbit,
55  const std::valarray<double> &,
56  std::valarray<double> &stop_deriv
57  ) const
58  {
59  assert(evol_mode == Core::BINARY);
60  double semimajor;
61  if(
63  ||
65  )
66  semimajor = orbit[0];
67  else if(orbit[0] < 0)
68  throw Core::Error::Runtime("Negitave a^6.5 encountered!");
69  else semimajor = std::pow(orbit[0], 1.0 / 6.5);
70 
71  double orbital_frequency = Core::orbital_angular_velocity(
72  __body.mass(),
74  semimajor
75  );
76 
77  double abs_forcing_frequency = std::abs(
81  orbital_frequency
82  )
83  );
84  std::valarray<double> result(__num_subconditions);
85  size_t above_index;
86  if(__powerlaw_index == 0)
87  above_index = 0;
88  else {
89  double critical_frequency =
91 
92  result[0] = ((abs_forcing_frequency - critical_frequency)
93  /
94  critical_frequency);
95  above_index = 1;
96  }
98  double critical_frequency =
100 
101  result[above_index] = (
102  (abs_forcing_frequency - critical_frequency)
103  /
104  critical_frequency
105  );
106  }
107  stop_deriv.resize(__num_subconditions, Core::NaN);
108  return result;
109  }
110 
112  short
113 #ifndef NDEBUG
114  deriv_sign
115 #endif
116  ,
117  unsigned index
118  )
119  {
120  assert(index < __num_subconditions);
121 
122  if(__powerlaw_index > 0 && index == 0) {
123  assert(deriv_sign == -1);
126  } else {
127  assert(deriv_sign == 1);
129 
132 
134  <
136  }
137 
139 
140  }
141 
143  unsigned index
144  ) const
145  {
146  if(index == 1 || __powerlaw_index == 0) {
147  assert(__powerlaw_index
148  <
150  return 1;
151  } else {
152  return -1;
153  }
154  }
155 
156  std::string LagForcingFrequencyBreakCondition::describe(int index) const
157  {
158  std::ostringstream description;
159  description << "Forcing frequency leaving the interval ";
160  if(__powerlaw_index > 0 && index <= 0) {
161  description
163  << " < ";
164  }
165  description << "|"
167  << "Worb"
168  << (__spin_frequency_multiplier > 0 ? " - " : " + ")
169  << std::abs(__spin_frequency_multiplier)
170  << "Wspin|";
171  if(
173  &&
174  (
175  index < 0
176  ||
177  index == static_cast<int>(__num_subconditions) - 1
178  )
179  ) {
180  description << " < "
182  }
183  return description.str();
184  }
185 
186 }//End Evolve namespace.
std::valarray< double > operator()(Core::EvolModeType evol_mode, const std::valarray< double > &orbit, const std::valarray< double > &derivatives, std::valarray< double > &stop_deriv) const
Return the differences between the current forcing frequency of the zone monitored and the two closes...
std::vector< std::vector< double >::size_type > __tidal_indices
The indices within __tidal_frequency_powers of the powerlaw now in effect for each active tidal term...
const DissipatingBody & __other_body
The other body in the system.
unsigned number_locked_zones() const
The number of zones currently in a spin-orbit lock.
A base class for any body contributing to tidal dissipation.
Any runtime error.
Definition: Error.h:61
Orientations of zones of bodies in a binary system.
virtual short expected_crossing_deriv_sign(unsigned index=0) const
See StoppingCondition::expected_crossing_deriv_sign().
double mass() const
The mass of the body (constant with age).
LagForcingFrequencyBreakCondition(BrokenPowerlawPhaseLagZone &zone, const DissipatingBody &body, const DissipatingBody &other_body, int orbital_frequency_multiplier, int spin_frequency_multiplier)
Monitor a single forcing term of a single zone for a number of critical forcing frequencies.
virtual std::string describe(int index=-1) const
See StoppingCondition::describe().
virtual void reached(short deriv_sign, unsigned index=0)
Adjust the above and below critical frequencies being monitored.
A DissipatingZone where the phase lag is described by a broken powerlaw.
EvolModeType
The various evolution modes.
Definition: Common.h:42
const DissipatingBody & __body
The body this condition is monitoring.
Declares a stopping condition satisfied when a forcing frequency reaches a critical value...
Declares the class that provides the phase lag function to DissipatingZone objects.
double forcing_frequency(int orbital_frequency_multiplier, int spin_frequency_multiplier, double orbital_frequency) const
The tidal forcing frequency for the given term and orbital frequency.
std::vector< double > __tidal_frequency_powers
The powerlaw indices for the tidal frequency dependence.
std::vector< double > __tidal_frequency_breaks
The locations of the breaks in tidal frequency in rad/day.
BrokenPowerlawPhaseLagZone & __zone
The zone being monitored (for more convenient access).
void set_num_subconditions()
Set the appropriate value of __num_subcondition.
std::vector< std::vector< double >::size_type >::size_type __term_index
The index of the monitored tidal term within __zone.__tidal_indices.
std::vector< double >::size_type __powerlaw_index
The index of the currently active powerlaw within __zone.__tidal_frequency_powers.