1 #define BUILDING_LIBRARY 15 __orbital_freq_mult(orbital_freq_mult),
16 __spin_freq_mult(spin_freq_mult),
18 __zone_index(zone_index),
21 : system.secondary()).zone(zone_index)),
30 ,
const std::valarray<double> &orbit,
31 const std::valarray<double> &derivatives,
32 std::valarray<double> &stop_deriv
36 assert(evol_mode == Core::BINARY);
39 else assert(std::pow(std::max(0.0, orbit[0]), 1.0 / 6.5)
42 assert(orbit.size() == (1
47 assert(orbit.size() == derivatives.size());
52 worb = Core::orbital_angular_velocity(m1, m2, semimajor),
54 dworb_dt = (Core::orbital_angular_velocity(m1,
81 dworb_dt /= 6.5 * orbit[0] / semimajor;
84 std::cerr <<
describe() <<
" angmom index: " << angmom_ind
86 <<
" dworb_dt = " << dworb_dt
87 <<
" wspin = " << wspin
88 <<
" dwspin_dt = " << dwspin_dt
89 <<
" adot = " << derivatives[0] / (6.5 * orbit[0] / semimajor)
96 (wspin * dworb_dt - dwspin_dt * worb)
109 std::cerr <<
"Synchronized value for zone " << __zone_index <<
"/" 111 <<
", wspin=" << wspin
113 <<
"__spin_freq_mult is NaN." 114 <<
", semimajor=" << semimajor << std::endl ;
118 return std::valarray<double>(
127 std::cerr <<
"Synchronization reached: " 129 <<
"sign: " << deriv_sign
146 std::ostringstream description;
147 description << (
__primary ?
"Primary" :
"Secondary")
152 <<
"(orbital frequency) = " 154 <<
"(spin frequency)";
155 return description.str();
int __spin_freq_mult
The multiplier in front of the spin frequency in the lock.
BinarySystem & __system
The binary system this locking condition is attached to.
const DissipatingBody & primary() const
Returns the primary body in the system (const).
unsigned number_locked_zones() const
The number of zones currently in a spin-orbit lock.
Declares a class representing one zone of a body dissipative to tidal distortions.
SynchronizedCondition(int orbital_freq_mult, int spin_freq_mult, short deriv_sign, bool primary, unsigned zone_index, BinarySystem &system)
Create the synchronization condition for the given planet.
virtual std::string describe(int index=-1) const
See StoppingCondition::describe().
A base class for any body contributing to tidal dissipation.
int __orbital_freq_mult
The mutiplier in front of the orbital frequency in the lock.
virtual const DissipatingZone & zone(unsigned zone_index) const =0
A modifiable reference to one of the body's zones.
void check_for_lock(int orbital_freq_mult, int spin_freq_mult, unsigned short body_index, unsigned zone_index, short direction)
Check if a spin-orbit lock can be held and updates the system as necessary to calculate subsequent ev...
const DissipatingZone & __zone
The zone whose spin is monitored.
Orientations of zones of bodies in a binary system.
virtual double moment_of_inertia(int deriv_order=0) const =0
Moment of inertia of the zone or its age derivative at the age of last configure() call...
double mass() const
The mass of the body (constant with age).
bool __primary
Which body's spin is checked for locking.
const double solar_radius
Radius of the sun [m].
unsigned number_locked_zones() const
How many zones on either body are currently locked.
const DissipatingBody & secondary() const
Returns the secondary body in the system (const).
virtual short expected_crossing_deriv_sign(unsigned index=0) const
The expected sign of the derivative at the next zero-crossing.
A base class for all stopping conditions.
Defines the BinarySystem class.
virtual bool locked(int orbital_frequency_multiplier, int spin_frequency_multiplier) const
Should return true iff the given term is presently locked.
void reached(short deriv_sign, unsigned index=0)
Which body's spin is checked for locking.
EvolModeType
The various evolution modes.
unsigned __zone_index
Which zone is checked for locking.
double semimajor() const
The current semimajor axis of the system.
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 difference between the orbital and multiplier scaled stellar spin angular velocities divid...
unsigned number_zones() const
The total number of zones in both system bodies.
Describes a system of two bodies orbiting each other.
double spin_frequency() const
The spin frequency of the given zone.
virtual unsigned number_zones() const =0
The number of zones the body consists of.
Declares a stopping condition monitoring spin-orbit synchronization.
virtual void reached(short deriv_sign, unsigned index=0)
Called when a stopping condition has been reached by the evolution.