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
149 int mp_step = (e_order == 0 ? 1 : 4 + 2 * e_order);
151 for(
int mp = 0; mp <= e_order + 2; mp += mp_step)
152 for(
int m = -2; m <= 2; ++m)
167 out_stream <<
"Tidal breaks: ";
169 std::vector<double>::const_iterator
174 out_stream << *i <<
" ";
175 out_stream << std::endl;
177 out_stream <<
"Tidal powers: ";
179 std::vector<double>::const_iterator
184 out_stream << *i <<
" ";
185 out_stream << std::endl;
187 out_stream <<
"Spin breaks: ";
189 std::vector<double>::const_iterator
194 out_stream << *i <<
" ";
195 out_stream << std::endl;
197 out_stream <<
"Spin powers: ";
199 std::vector<double>::const_iterator
204 out_stream << *i <<
" ";
205 out_stream << std::endl;
207 out_stream <<
"Break lags: ";
209 std::vector<double>::const_iterator
214 out_stream << *i <<
" ";
215 out_stream << std::endl;
219 const std::vector<double> &tidal_frequency_breaks,
220 const std::vector<double> &spin_frequency_breaks,
221 const std::vector<double> &tidal_frequency_powers,
222 const std::vector<double> &spin_frequency_powers,
223 double reference_phase_lag,
224 double inertial_mode_enhancement,
225 double inertial_mode_sharpness
234 assert(tidal_frequency_powers.size()
236 tidal_frequency_breaks.size() + 1);
237 assert(spin_frequency_powers.size()
239 spin_frequency_breaks.size() + 1);
240 assert(tidal_frequency_breaks.size() > 0
242 tidal_frequency_powers.front() == 0);
243 assert(spin_frequency_breaks.size() > 0
245 spin_frequency_powers.front() == 0);
248 __can_lock = tidal_frequency_powers.front() <= 0;
255 std::max(
int(spin_frequency_breaks.size()), 1)
257 std::max(
int(tidal_frequency_breaks.size()), 1)
260 unsigned break_lag_i = 0;
262 int spin_break_i = 0;
263 spin_break_i < std::max(
int(spin_frequency_breaks.size()), 1);
271 break_lag_i - tidal_frequency_breaks.size()
275 spin_frequency_powers[spin_break_i] == 0
279 spin_frequency_breaks[spin_break_i]
281 spin_frequency_breaks[spin_break_i - 1]
283 spin_frequency_powers[spin_break_i]
289 int tidal_break_i = 1;
290 tidal_break_i < std::max(
int(tidal_frequency_breaks.size()),
298 tidal_frequency_powers[tidal_break_i] == 0
302 tidal_frequency_breaks[tidal_break_i]
304 tidal_frequency_breaks[tidal_break_i - 1]
306 tidal_frequency_powers[tidal_break_i]
319 "Inertial mode enhancement must be greater than 1." 323 "Sharpness parameter for inertial mode enhancement must be " 335 double orbital_frequency,
337 double orbital_angmom,
341 bool spin_is_frequency
345 if(initialize && !std::isnan(orbital_frequency)) {
349 std::cerr <<
"Initializing broken powerlaw lag zone at t = " 351 << (initialize ?
" for the first time " :
" ")
352 <<
"with Worb = " << orbital_frequency
353 <<
", " << (spin_is_frequency ?
"W" :
"L") <<
"* = " 355 <<
", e = " << eccentricity
356 <<
", inclination = " << inclination
357 <<
", periapsis = " << periapsis
368 std::cerr <<
"__tidal_indices size = " 373 std::vector< std::vector<double>::size_type >::iterator
381 for(
int m = -2; m <= 2; ++m) {
382 double abs_forcing_frequency = std::abs(
392 abs_forcing_frequency
396 "Starting evolution from exactly a critical tidal " 397 "forcing frequency is not currently supported." 420 int orbital_frequency_multiplier,
421 int spin_frequency_multiplier,
423 Dissipation::QuantityEntry entry,
424 double &above_lock_value
436 double abs_forcing_frequency = std::abs(forcing_frequency),
444 std::vector<double>::size_type
450 std::vector<double>::size_type tidal_break_index = tidal_index,
460 tidal_break_index > 0
466 std::vector<double>::size_type
470 double tidal_factor = (
473 : std::pow(abs_forcing_frequency
479 double spin_factor = (
498 orbital_frequency_multiplier,
499 spin_frequency_multiplier));
507 ? (spin_frequency_multiplier * tidal_power
514 orbital_frequency_multiplier,
515 spin_frequency_multiplier,
523 ? (orbital_frequency_multiplier * tidal_power
530 orbital_frequency_multiplier,
531 spin_frequency_multiplier,
539 if(forcing_frequency == 0) {
550 if(tidal_power == 1) {
554 ? spin_frequency_multiplier
555 : -orbital_frequency_multiplier
565 assert(tidal_power > 1);
569 if(spin_frequency_multiplier >= 0) {
570 above_lock_value = -result;
573 above_lock_value = result;
577 return (forcing_frequency > 0 ? result : -result);
598 *result |=
new LagSpinBreakCondition(
617 unsigned new_e_order,
627 std::vector< std::vector<double>::size_type >::iterator
633 mp <= static_cast<int>(new_e_order) + 2;
636 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.
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 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).
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 unsigned eccentricity_order() const
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.
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 __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...