Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
WindSaturationCondition.cpp
Go to the documentation of this file.
1 
8 #define BUILDING_LIBRARY
10 
11 namespace Star {
12  std::valarray<double> WindSaturationCondition::operator()(
13  Core::EvolModeType evol_mode,
14  const std::valarray<double> &,
15  const std::valarray<double> &derivatives,
16  std::valarray<double> &stop_deriv) const
17  {
18 #ifdef DEBUG
19  assert(evol_mode != Core::LOCKED_SURFACE_SPIN);
20  if(evol_mode != Core::BINARY) assert(__primary);
21 #endif
22  unsigned angmom_index = 1 + 2 * __body.number_zones();
23  if(evol_mode == Core::BINARY)
24  angmom_index += 2 * __other_body.number_zones()
25  +
26  (__primary ? 0
29  else angmom_index -= 3;
30  assert(angmom_index <= derivatives.size());
31  double wsurf = __body.spin_frequency(),
32  surf_angmom_deriv,
33  result = (
34  (std::abs(wsurf) - __saturation_freq)
36  ),
37  wsurf_sign = (wsurf < 0 ? -1.0 : 1.0);
38  if(std::isinf(__saturation_freq)) result=-1;
39  if(__body.zone(0).locked()) return std::valarray<double>(result, 1);
40  surf_angmom_deriv = derivatives[angmom_index];
41  stop_deriv.resize(
42  1
43  ,
44  (
45  wsurf_sign * surf_angmom_deriv
46  -
47  __body.zone(0).moment_of_inertia(1) * std::abs(wsurf)
48  )
49  /
51  );
52  return std::valarray<double>(result, 1);
53  }
54 
56  int
57 #ifndef NDEBUG
58  index
59 #endif
60  ) const
61  {
62  assert(index <= 0);
63  std::ostringstream description;
64  description << (__primary ? "Primary" : "Secondary")
65  << " surface spin "
67  ? "exceeding"
68  : "falling below")
69  << " the wind saturation threshold of"
71  << " rad/day";
72  return description.str();
73  }
74 
75 }//End Star namespace.
unsigned number_locked_zones() const
The number of zones currently in a spin-orbit lock.
virtual const DissipatingZone & zone(unsigned zone_index) const =0
A modifiable reference to one of the body&#39;s zones.
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...
Declaration of a stopping condition monitoring for the surface spin of a star crossing the wind satur...
virtual std::string describe(int index=-1) const
See StoppingCondition::describe().
double __saturation_freq
The frequency at which the wind saturates.
virtual short expected_crossing_deriv_sign(unsigned index=0) const
The expected sign of the derivative at the next zero-crossing.
bool __primary
Is __body we are the primary in 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
The difference between the convective and wind saturation angular velocities divided by the latter...
virtual bool locked(int orbital_frequency_multiplier, int spin_frequency_multiplier) const
Should return true iff the given term is presently locked.
EvolModeType
The various evolution modes.
Definition: Common.h:42
SaturatingSkumanichWindBody & __body
The body this condition is monitoring.
const Evolve::DissipatingBody & __other_body
The primary body in the system if not __body.
double spin_frequency() const
The surface spin freuqency of the body.
virtual unsigned number_zones() const =0
The number of zones the body consists of.