1 #define BUILDING_LIBRARY 11 return Core::orbital_angular_velocity(
20 int orbital_frequency_multiplier,
21 int spin_frequency_multiplier,
22 Dissipation::QuantityEntry entry
32 abs_forcing_frequency = std::abs(forcing_frequency);
35 abs_forcing_frequency > 2.0 * abs_spin_frequency
39 2.0 * abs_spin_frequency / abs_forcing_frequency,
47 abs_forcing_frequency > 2.0 * abs_spin_frequency
51 2.0 * abs_spin_frequency / abs_forcing_frequency,
102 "Starting evolution from exactly a critical spin " 103 "frequency is not currently supported." 111 std::vector<double>::size_type
113 double abs_forcing_frequency
116 assert(abs_forcing_frequency >= 0);
122 abs_forcing_frequency
143 for(
int m = -2; m <= 2; ++m)
156 out_stream <<
"Tidal breaks: ";
158 std::vector<double>::const_iterator
163 out_stream << *i <<
" ";
164 out_stream << std::endl;
166 out_stream <<
"Tidal powers: ";
168 std::vector<double>::const_iterator
173 out_stream << *i <<
" ";
174 out_stream << std::endl;
176 out_stream <<
"Spin breaks: ";
178 std::vector<double>::const_iterator
183 out_stream << *i <<
" ";
184 out_stream << std::endl;
186 out_stream <<
"Spin powers: ";
188 std::vector<double>::const_iterator
193 out_stream << *i <<
" ";
194 out_stream << std::endl;
196 out_stream <<
"Break lags: ";
198 std::vector<double>::const_iterator
203 out_stream << *i <<
" ";
204 out_stream << std::endl;
208 const std::vector<double> &tidal_frequency_breaks,
209 const std::vector<double> &spin_frequency_breaks,
210 const std::vector<double> &tidal_frequency_powers,
211 const std::vector<double> &spin_frequency_powers,
212 double reference_phase_lag,
213 double inertial_mode_enhancement,
214 double inertial_mode_sharpness
223 assert(tidal_frequency_powers.size()
225 tidal_frequency_breaks.size() + 1);
226 assert(spin_frequency_powers.size()
228 spin_frequency_breaks.size() + 1);
229 assert(tidal_frequency_breaks.size() > 0
231 tidal_frequency_powers.front() == 0);
232 assert(spin_frequency_breaks.size() > 0
234 spin_frequency_powers.front() == 0);
237 __can_lock = tidal_frequency_powers.front() <= 0;
244 std::max(
int(spin_frequency_breaks.size()), 1)
246 std::max(
int(tidal_frequency_breaks.size()), 1)
249 unsigned break_lag_i = 0;
251 int spin_break_i = 0;
252 spin_break_i < std::max(
int(spin_frequency_breaks.size()), 1);
260 break_lag_i - tidal_frequency_breaks.size()
264 spin_frequency_powers[spin_break_i] == 0
268 spin_frequency_breaks[spin_break_i]
270 spin_frequency_breaks[spin_break_i - 1]
272 spin_frequency_powers[spin_break_i]
278 int tidal_break_i = 1;
279 tidal_break_i < std::max(
int(tidal_frequency_breaks.size()),
287 tidal_frequency_powers[tidal_break_i] == 0
291 tidal_frequency_breaks[tidal_break_i]
293 tidal_frequency_breaks[tidal_break_i - 1]
295 tidal_frequency_powers[tidal_break_i]
308 "Inertial mode enhancement must be greater than 1." 312 "Sharpness parameter for inertial mode enhancement must be " 324 double orbital_frequency,
326 double orbital_angmom,
330 bool spin_is_frequency
334 if(initialize && !std::isnan(orbital_frequency)) {
338 std::cerr <<
"Initializing broken powerlaw lag zone at t = " 340 << (initialize ?
" for the first time " :
" ")
341 <<
"with Worb = " << orbital_frequency
342 <<
", " << (spin_is_frequency ?
"W" :
"L") <<
"* = " 344 <<
", e = " << eccentricity
345 <<
", inclination = " << inclination
346 <<
", periapsis = " << periapsis
357 std::cerr <<
"__tidal_indices size = " 362 std::vector< std::vector<double>::size_type >::iterator
370 for(
int m = -2; m <= 2; ++m) {
371 double abs_forcing_frequency = std::abs(
381 abs_forcing_frequency
385 "Starting evolution from exactly a critical tidal " 386 "forcing frequency is not currently supported." 409 int orbital_frequency_multiplier,
410 int spin_frequency_multiplier,
412 Dissipation::QuantityEntry entry,
413 double &above_lock_value
423 double abs_forcing_frequency = std::abs(forcing_frequency),
431 std::vector<double>::size_type
437 std::vector<double>::size_type tidal_break_index = tidal_index,
447 tidal_break_index > 0
453 std::vector<double>::size_type
457 double tidal_factor = (
460 : std::pow(abs_forcing_frequency
466 double spin_factor = (
485 orbital_frequency_multiplier,
486 spin_frequency_multiplier));
494 ? (spin_frequency_multiplier * tidal_power
501 orbital_frequency_multiplier,
502 spin_frequency_multiplier,
510 ? (orbital_frequency_multiplier * tidal_power
517 orbital_frequency_multiplier,
518 spin_frequency_multiplier,
526 if(forcing_frequency == 0) {
537 if(tidal_power == 1) {
541 ? spin_frequency_multiplier
542 : -orbital_frequency_multiplier
552 assert(tidal_power > 1);
556 if(spin_frequency_multiplier >= 0) {
557 above_lock_value = -result;
560 above_lock_value = result;
564 return (forcing_frequency > 0 ? result : -result);
585 *result |=
new LagSpinBreakCondition(
604 unsigned new_expansion_order,
614 std::vector< std::vector<double>::size_type >::iterator
620 mp <= static_cast<int>(new_expansion_order) + 2;
623 for(
int m = -2; m <= 2; ++m) {
void set_spin_index()
Properly set the value of __spin_index per the current spin of the zone.
double tidal_power(bool above, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
The dimensionless tidal power or one of its derivatives.
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...
Function arguments do not satisfy some requirement.
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)
Defines the current orbit, triggering re-calculation of all quantities.
void print_configuration(std::ostream &out_stream=std::clog)
Print the configuration of the zone to stdlog.
const DissipatingBody & primary() const
Returns the primary body in the system (const).
SPIN_FREQUENCY
The derivative w.r.t. the spin frequency of a dissipating zone.
std::vector< double >::size_type __spin_index
The index within __spin_frequency_powers of the powerlaw now in effect.
A base class for any body contributing to tidal dissipation.
std::vector< double >::size_type get_tidal_index(double abs_forcing_frequency) const
The index within __tidal_frequency_powers to use for the given forcing frequency. ...
std::vector< double > __spin_frequency_powers
The powerlaw indices for the spin frequency dependence.
double get_orbital_frequency(const BinarySystem &system) const
Return the current orbital frequency of the given system.
double periapsis(bool evolution_rate=false) const
The argument of periapsis of this zone minus the reference zone's.
virtual double modified_phase_lag(int orbital_frequency_multiplier, int spin_frequency_multiplier, double forcing_frequency, Dissipation::QuantityEntry entry, double &above_lock_value) const
Should return the tidal phase lag times the love number for the given tidal term (or one of its deriv...
bool __dissipative
Is the zone dissipative.
Orientations of zones of bodies in a binary system.
void initializing(bool flag)
Notify the zone that it is in the process of initializing or not.
double mass() const
The mass of the body (constant with age).
virtual unsigned expansion_order() const
const DissipatingBody & secondary() const
Returns the secondary body in the system (const).
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().
virtual void change_expansion_order(unsigned new_expansion_order, BinarySystem &system, bool primary, unsigned zone_index)
Changes the order of the eccentricity expansion performed.
virtual void change_expansion_order(unsigned new_expansion_order, BinarySystem &system, bool primary, unsigned zone_index)
Changes the order of the eccentricity expansion performed.
AGE
The derivative w.r.t. age, excluding the dependence through the body's radius and the moments of iner...
double __inertial_mode_sharpness
See setup()
void add_tidal_frequency_conditions(BinarySystem &system, bool primary, unsigned zone_index, CombinedStoppingCondition &result)
Make sure that the entries in __tidal_frequency_conditions are appropriate for the current eccentrici...
Core::EvolModeType evolution_mode()
The evolution mode of last call to configure().
std::vector< double > __break_phase_lags
The phase lags at the tidal/spin frequency breaks.
virtual CombinedStoppingCondition * stopping_conditions(BinarySystem &system, bool primary, unsigned zone_index)
Conditions detecting the next possible discontinuities in the evolution due to this zone...
double inclination(bool evolution_rate=false) const
The angle between the angular momenta of the zone and the orbit.
NO_DERIV
The quantity itself, undifferentiated.
std::vector< double > __spin_frequency_breaks
The locations of the breaks in spin frequency in rad/day.
double get_inertial_mode_factor(double abs_forcing_frequency, int orbital_frequency_multiplier, int spin_frequency_multiplier, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
Calculate the factor by which dissipation is enhanced due to inertial modes or one of its logarithmic...
ORBITAL_FREQUENCY
The derivative w.r.t. the orbital frequency.
double semimajor() const
The current semimajor axis of the system.
Declares the class that provides the phase lag function to DissipatingZone objects.
void configure_spin(double spin, bool spin_is_frequency)
Configures only the spin of the zone.
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.
double __inertial_mode_enhancement
See setup()
std::vector< double > __tidal_frequency_powers
The powerlaw indices for the tidal frequency dependence.
A class combining the the outputs of multiple stopping conditions.
std::vector< double > __tidal_frequency_breaks
The locations of the breaks in tidal frequency in rad/day.
virtual CombinedStoppingCondition * stopping_conditions(BinarySystem &system, bool primary, unsigned zone_index)
Conditions detecting the next possible discontinuities in the evolution due to this zone...
satisfied when a forcing frequency reaches a critical value.
Describes a system of two bodies orbiting each other.
double spin_frequency() const
The spin frequency of the given zone.
void setup(const std::vector< double > &tidal_frequency_breaks, const std::vector< double > &spin_frequency_breaks, const std::vector< double > &tidal_frequency_powers, const std::vector< double > &spin_frequency_powers, double reference_phase_lag, double inertial_mode_enhancement=1.0, double inertial_mode_sharpness=10.0)
Seup the zone with the given breaks/powers and inertial mode enhancement. Continuous accress all brea...