9 #ifndef __DISSIPATING_ZONE_H 10 #define __DISSIPATING_ZONE_H 13 #include "../Core/SharedLibraryExportMacros.h" 14 #include "../Core/Error.h" 21 #include "../Core/Common.h" 23 #include <boost/math/special_functions/sign.hpp> 112 double m_value = 0.0,
113 double m_plus_one_value = 0.0):
116 m_plus_one(m_plus_one_value)
142 static const double __torque_x_plus_coef[];
146 static const double __torque_x_minus_coef[];
153 __angular_momentum_evolution_rate,
174 std::valarray<double> __power,
223 void fix_forcing_frequency(
229 int orbital_frequency_multiplier,
233 int spin_frequency_multiplier,
237 double &forcing_frequency
248 void limit_above_lock_per_expansion_order(
249 int proposed_orbital_multiplier,
250 int proposed_spin_multiplier
255 void set_faster_spin_lock(
261 int proposed_orbital_multiplier,
268 int proposed_spin_multiplier
275 void initialize_locks();
286 double tidal_frequency,
306 virtual void check_locks_consistency()
const;
318 bool spin_is_frequency
326 virtual void configure(
334 double orbital_frequency,
340 double orbital_angmom,
355 bool spin_is_frequency
362 double angular_momentum,
371 __angular_momentum_evolution_rate = angular_momentum;
372 ZoneOrientation::set_evolution_rates(inclination, periapsis);
380 double forcing_frequency(
383 int orbital_frequency_multiplier,
387 int spin_frequency_multiplier,
390 double orbital_frequency
396 {__orbital_angmom=reference_angmom;}
403 double periapsis_evolution(
406 const Eigen::Vector3d &orbit_torque,
411 const Eigen::Vector3d &zone_torque,
425 const Eigen::Vector3d &orbit_torque_deriv=
431 const Eigen::Vector3d &zone_torque_deriv=Eigen::Vector3d()
439 double inclination_evolution(
442 const Eigen::Vector3d &orbit_torque,
447 const Eigen::Vector3d &zone_torque,
468 const Eigen::Vector3d &orbit_torque_deriv=Eigen::Vector3d(),
473 const Eigen::Vector3d &zone_torque_deriv=Eigen::Vector3d()
478 virtual bool locked(
int orbital_frequency_multiplier,
479 int spin_frequency_multiplier)
const 480 {
return __lock(orbital_frequency_multiplier,
481 spin_frequency_multiplier);}
502 int spin_frequency_multiplier)
505 __lock.
set_lock(orbital_frequency_multiplier,
506 spin_frequency_multiplier);
520 int orbital_frequency_multiplier,
524 int spin_frequency_multiplier,
527 double forcing_frequency,
533 Dissipation::QuantityEntry entry,
538 double &above_lock_value)
const =0;
542 virtual double love_coefficient(
545 int orbital_frequency_multiplier,
549 int spin_frequency_multiplier,
555 Dissipation::QuantityEntry entry
560 virtual double moment_of_inertia(
571 virtual double moment_of_inertia(
605 assert(2 * entry + 1 < static_cast<int>(__power.size()));
607 return __power[2 * entry + (above? 1 : 0)];
615 double above_fraction,
625 assert(!locked() || (above_fraction >= 0 && above_fraction <= 1));
627 assert(2 * entry + 1 < static_cast<int>(__power.size()));
630 above_fraction * __power[2 * entry + 1]
632 (1.0 - above_fraction) * __power[2 * entry]
648 assert(2 * entry + 1 < static_cast<int>(__torque_x.size()));
650 return __torque_x[2 * entry + (above ? 1 : 0)];
658 double above_fraction,
669 !locked() || (above_fraction >= 0 && above_fraction <= 1)
675 static_cast<int>(__torque_x.size())
678 return (above_fraction * __torque_x[2 * entry + 1]
680 (1.0 - above_fraction) * __torque_x[2 * entry]);
698 static_cast<int>(__torque_y.size())
701 return __torque_y[2 * entry + (above? 1 : 0)];
709 double above_fraction,
719 assert(!locked() || (above_fraction >= 0 && above_fraction <= 1));
721 assert(2 * entry + 1 < static_cast<int>(__torque_y.size()));
723 return (above_fraction * __torque_y[2 * entry + 1]
725 (1.0 - above_fraction) * __torque_y[2 * entry]);
740 assert(2 * entry + 1 < static_cast<int>(__torque_z.size()));
742 return __torque_z[2 * entry + (above? 1 : 0)];
750 double above_fraction,
760 assert(!locked() || (above_fraction >= 0 && above_fraction <= 1));
762 assert(2 * entry + 1 < static_cast<int>(__torque_z.size()));
764 return (above_fraction * __torque_z[2 * entry + 1]
766 (1.0 - above_fraction) * __torque_z[2 * entry]);
774 virtual double outer_radius(
784 virtual double outer_radius(
double age,
int deriv_order=0)
const =0;
791 virtual double outer_mass(
801 virtual double outer_mass(
double age,
int deriv_order=0)
const =0;
808 virtual void change_e_order(
810 unsigned new_e_order,
823 virtual void add_to_evolution();
826 virtual void rewind_evolution(
832 virtual void reset_evolution();
841 return __evolution_real[quantity];
861 return __locked_zone_index;
869 return __locked_zone_index;
873 virtual bool dissipative()
const =0;
877 virtual bool can_lock()
const =0;
896 {initialize_locks();}
ZoneEvolutionQuantities
IDs for quantities saved as part of the evolution.
double tidal_torque_x(double above_fraction, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
Same as tidal_torque_x(bool, Dissipation::QuantityEntry) but below and above contributions mixed...
double m
The (m, m') coefficient.
double tidal_power(bool above, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
The dimensionless tidal power or one of its derivatives.
unsigned locked_zone_index() const
The index of this zone in the list of locked zones (valid only if locked).
Age derivative of MOMENT_OF_INERTIA.
virtual void spin_jumped()
Notifies the zone that its spin just jumped discontinously.
unsigned __locked_zone_index
If this zone is locked, this is its index in the list of locked zones in the system.
The rate at which periapsis changes.
const SpinOrbitLockInfo & lock_monitored(bool other=false) const
Useful for debugging.
double angular_momentum() const
The angular momentum of the given zone in .
The total number of quantities whose evolution is tracked.
virtual void reached_critical_age(double)
Change the body as necessary at the given age.
Declares a class for orientations of zones of DissipatingBody objects.
double __spin_frequency
The current spin frequency of the zone.
std::ostream & operator<<(std::ostream &os, const ZoneEvolutionQuantities &evol_var)
More civilized output for EvolVarType variables.
Declares a class for a stopping condition monitoring when a locked zone loses the lock...
The rate at which the the inclination changes.
unsigned __e_order
The expansion order in eccentricity to use.
std::vector< std::list< double > > __evolution_real
The floating point quantities whose evolution is tracked.
Outer radius boundary of the zone.
virtual double next_stop_age() const
The next age when the evolution needs to be stopped for a change in one of the bodies.
double tidal_power(double above_fraction, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
Same as tidal_power(bool, Dissipation::QuantityEntry), but using the predefined mix of below/above co...
Orientations of zones of bodies in a binary system.
Number of real values evolution quantities.
void initializing(bool flag)
Notify the zone that it is in the process of initializing or not.
double tidal_torque_y(bool above, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
The dimensionless torque along y.
Eccentricity expansion order.
First age derivative of OUTER_MASS.
double m_minus_one
The (m-1, m') coefficient.
A layer of a system body for which the tidal bulge is not exactly in phase with the tidal potential...
Declare an interface for evaluating the expansion of the tidal potential.
Defines the SpinOrbitLockInfo class.
double m_plus_one
The (m+1, m') coefficient.
double modified_phase_lag(const EvolvingStar *star, unsigned zone_index, int orbital_frequency_multiplier, int spin_frequency_multiplier, double forcing_frequency, int entry, double *above_lock_value)
See Evolve::BrokenPowerlawPhaseLagZone::modified_phase_lag for details.
TidalPotentialTerms __potential_term
The expansion of the tidal potential in series.
SpinOrbitLockInfo __other_lock
The term closest matched by the current spin-orbit ratio in the other direction from __lock...
Declaration of enumerations of dissipation quantities and derivatives.
double tidal_torque_y(double above_fraction, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
Same as tidal_torque_y(bool, Dissipation::QuantityEntry) but below and above contributions mixed...
virtual unsigned eccentricity_order() const
For locked zones this is the orbital frequency multiple of the lock.
Moment of inertia of the zone.
void set_evolution_rates(double angular_momentum, double inclination, double periapsis)
Set evolution rates for this zone's properties for storing in the eveloution.
void set_reference_zone_angmom(double reference_angmom)
Defines the angular momentum of the reference zone for single body evolution.
double tidal_torque_z(double above_fraction, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
Same as tidal_torque_z(bool, Dissipation::QuantityEntry) but below and above contributions mixed...
virtual bool locked(int orbital_frequency_multiplier, int spin_frequency_multiplier) const
Should return true iff the given term is presently locked.
const SpinOrbitLockInfo & lock_held() const
The currntly held lock.
Outer mass boundary of the zone.
void set_lock(int orbital_frequency_multiplier, int spin_frequency_multiplier)
Locks the zone spin to the orbit in the given ratio.
NO_DERIV
The quantity itself, undifferentiated.
const std::list< int > & get_evolution_integer(ZoneEvolutionQuantities quantity) const
The tabulated evolution of an integer quantity so far.
Second age deriv of OUTER_RADIUS.
std::vector< std::list< int > > __evolution_integer
The integer quantities whose evolution is tracked.
double tidal_torque_z(bool above, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
The dimensionless tidal torque along z.
const std::list< double > & get_evolution_real(ZoneEvolutionQuantities quantity) const
The tabulated evolution of a real valued quantity so far.
Angular momentum of the zone.
First age deriv of OUTER_RADIUS.
Age second deriv of MOMENT_OF_INERTIA.
std::valarray< double > __torque_z
The dimensionless tidal torque in the z direction and its derivatives.
Declares a class for a stopping condition that combines other stopping conditions.
The rate at which angular momentum changes.
A class combining the the outputs of multiple stopping conditions.
bool __initializing
Is the zone in the middle of initializing (disable lock check)?
double tidal_torque_x(bool above, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
The dimensionless tidal torque along x.
For locked zones this is the spin frequency multiple of the lock.
virtual bool locked() const
Should return true iff any tidal term is locked.
Describes a system of two bodies orbiting each other.
void set_lock(int orbital_freq_mult, int spin_freq_mult, short lock_direction=0)
Define which tidal dissipation term is in a lock.
unsigned & locked_zone_index()
Reference to the locked_zone_index() of this zone.
double spin_frequency() const
The spin frequency of the given zone.
Defines a lock between the spin of a dissipating body and the orbit.
Declares a stopping condition monitoring spin-orbit synchronization.