9 #ifndef __DISSIPATING_BODY_H 10 #define __DISSIPATING_BODY_H 12 #include "../Core/SharedLibraryExportMacros.h" 15 #include "../Core/OrbitalExpressions.h" 16 #include "../Core/AstronomicalConstants.h" 17 #include "../Core/Common.h" 49 __dorbital_frequency_da,
54 std::valarray< std::valarray<Eigen::Vector3d> >
63 __angular_momentum_transfer,
69 __tidal_torques_above,
101 std::vector<Eigen::Vector3d> __orbit_torque,
119 double normalize_torques(
121 double companion_mass,
127 double orbital_frequency
132 void collect_orbit_rates(
134 double orbital_frequency,
143 void calculate_orbit_rate_corrections();
150 void angular_momentum_transfer(
159 Eigen::Vector3d &outer_angmom_gain,
163 Eigen::Vector3d &inner_angmom_gain,
173 bool with_respect_to_outer=
false 183 Eigen::Vector3d angular_momentum_transfer_from_top(
194 bool with_respect_to_outer=
false 203 Eigen::Vector3d angular_momentum_transfer_from_bottom(
214 bool with_respect_to_inner=
false 223 Eigen::Vector3d angular_momentum_transfer_to_zone(
235 void calculate_nontidal_torques();
238 void correct_orbit_power(
240 Eigen::VectorXd &above_lock_fractions_age_deriv,
244 Eigen::VectorXd &above_lock_fractions_semimajor_deriv,
248 Eigen::VectorXd &above_lock_fractions_eccentricity_deriv,
252 Eigen::VectorXd &above_lock_fractions_radius_deriv
256 void correct_orbit_torque(
258 std::valarray<Eigen::VectorXd> &above_lock_fractions
268 virtual void configure(
276 double companion_mass,
286 const double *spin_angmom,
290 const double *inclination = NULL,
295 const double *periapsis = NULL,
299 bool locked_surface =
false,
304 bool zero_outer_inclination =
false,
309 bool zero_outer_periapsis =
false 315 int orbital_frequency_multiplier,
316 int spin_frequency_multiplier)
318 zone(zone_index).set_lock(orbital_frequency_multiplier,
319 spin_frequency_multiplier);
320 ++__num_locked_zones;
333 if(direction == 0) zone(zone_index).release_lock();
334 else zone(zone_index).release_lock(direction);
335 --__num_locked_zones;
351 Eigen::Vector3d nontidal_torque(
389 assert(zone_index<number_zones());
392 ? __tidal_torques_above
393 : __tidal_torques_below)[zone_index][entry];
412 void set_above_lock_fractions(
416 std::valarray<Eigen::VectorXd> &above_lock_fractions
425 double tidal_orbit_power(
431 unsigned deriv_zone_index=0,
435 const Eigen::VectorXd &
436 above_lock_fraction_deriv=Eigen::VectorXd()
444 Eigen::Vector3d tidal_orbit_torque(
450 unsigned deriv_zone_index=0,
454 const Eigen::VectorXd &
455 above_lock_fraction_deriv=Eigen::VectorXd()
461 Eigen::Vector3d tidal_orbit_torque(
470 unsigned deriv_zone_index=0,
474 const Eigen::VectorXd &above_lock_fraction_deriv=
479 virtual unsigned number_zones()
const =0;
502 virtual Eigen::Vector3d angular_momentum_coupling(
505 unsigned top_zone_index,
513 bool with_respect_to_top=
false 521 virtual double angular_momentum_loss(
531 {
return zone(0).outer_radius(deriv_order);}
546 {
return __surface_lock_frequency;}
550 {__surface_lock_frequency=frequency;}
553 virtual void add_to_evolution();
556 virtual void rewind_evolution(
562 virtual void reset_evolution();
589 virtual void change_e_order(
591 unsigned new_e_order,
unsigned number_locked_zones() const
The number of zones currently in a spin-orbit lock.
virtual ~DissipatingBody()
Virtual destructor.
Declares a class representing one zone of a body dissipative to tidal distortions.
A base class for any body contributing to tidal dissipation.
void unlock_zone_spin(unsigned zone_index, short direction)
Releases the given zone from a spin-orbit lock.
virtual void reached_critical_age(double)
Change the body as necessary at the given age.
double surface_lock_frequency() const
Angular velocity of the surface zone when locked (assumed constant).
Orientations of zones of bodies in a binary system.
double mass() const
The mass of the body (constant with age).
double radius(int deriv_order=0) const
The current radius or its derivative with age of the body.
virtual void spin_jumped()
Notifies the body that its spin just discontinously jumped.
A layer of a system body for which the tidal bulge is not exactly in phase with the tidal potential...
virtual double next_stop_age() const
The next age when the evolution needs to be stopped for a change in one of the bodies.
std::valarray< std::valarray< Eigen::Vector3d > > __tidal_torques_below
Tidal torques and their derivatives on each zone for spin frequency approaching potential lock from b...
std::vector< Eigen::Vector3d > __orbit_torque_correction
Corrections to __orbit_torque_below (undifferentiated) if single zones switch to above.
NO_DERIV
The quantity itself, undifferentiated.
std::vector< Dissipation::QuantityEntry > __orbit_entries
The quantities w.r.t. which derivatives of the orbit energy gain and torque are pre-calculated or err...
void lock_zone_spin(unsigned zone_index, int orbital_frequency_multiplier, int spin_frequency_multiplier)
const Eigen::Vector3d & tidal_torque(unsigned zone_index, bool above, Dissipation::QuantityEntry entry=Dissipation::NO_DERIV) const
Tidal torque acting on the given zone (last calculate_torques_power()).
void set_surface_lock_frequency(double frequency)
Sets the frequency at which the surface is locked (if any).
double __surface_lock_frequency
The frequency at which the surface is locked (if any).
A class combining the the outputs of multiple stopping conditions.
std::valarray< Eigen::VectorXd > __above_lock_fractions
The fractional contribution of the above the lock rates for locked zones and their derivatives...
unsigned __num_locked_zones
The number of zones currently in a spin-orbit lock.
Describes a system of two bodies orbiting each other.
std::valarray< double > __orbit_power_correction
Corrections to __orbit_power_below (undifferentiated) if single zones switch to above.
double spin_frequency() const
The surface spin freuqency of the body.