Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
ConstSolutionIterator.cpp
2 
3 namespace Evolve {
4 
6  std::list<double>::const_iterator
7  ConstSolutionIterator::__placeholder_iterator=__placeholder_list.end();
8 
10  const std::list<double> &tabulation_ages
11  )
12  {
13  const DissipatingZone &convective=__star.zone(0),
14  &radiative=__star.zone(__star.number_zones()-1);
15  static std::vector< std::list<double> >
16  quantities(OutCol::LAST_NO_ORBIT+1);
17  for(unsigned i=0; i<=OutCol::LAST_NO_ORBIT; ++i) quantities[i].clear();
18  for(
19  std::list<double>::const_iterator t_i=tabulation_ages.begin();
20  t_i!=tabulation_ages.end();
21  ++t_i
22  ) {
23  double age=*t_i;
24 #ifdef DEBUG
25  std::cerr << "Tabulating quantities at age = " << age << std::endl;
26 #endif
27  quantities[OutCol::ICONV].push_back(
28  convective.moment_of_inertia(age)
29  );
30  quantities[OutCol::IRAD].push_back(
31  radiative.moment_of_inertia(age)
32  );
33  quantities[OutCol::RSTAR].push_back(convective.outer_radius(age));
34  quantities[OutCol::RRAD].push_back(radiative.outer_radius(age));
35  quantities[OutCol::MRAD].push_back(radiative.outer_mass(age));
36  quantities[OutCol::ICONV_DERIV].push_back(
37  convective.moment_of_inertia(age, 1)
38  );
39  quantities[OutCol::IRAD_DERIV].push_back(
40  radiative.moment_of_inertia(age, 1)
41  );
42  quantities[OutCol::RSTAR_DERIV].push_back(
43  convective.outer_radius(age, 1)
44  );
45  quantities[OutCol::RRAD_DERIV].push_back(
46  radiative.outer_radius(age, 1)
47  );
48  quantities[OutCol::MRAD_DERIV].push_back(
49  radiative.outer_mass(age, 1)
50  );
51  quantities[OutCol::ICONV_SECOND_DERIV].push_back(
52  convective.moment_of_inertia(age, 2)
53  );
54  quantities[OutCol::IRAD_SECOND_DERIV].push_back(
55  radiative.moment_of_inertia(age, 2)
56  );
57  quantities[OutCol::RRAD_SECOND_DERIV].push_back(
58  radiative.outer_radius(age, 2)
59  );
60  }
61  for(unsigned i=0; i<=OutCol::LAST_NO_ORBIT; ++i)
62  if(i!=OutCol::AGE) __real_iterators[i]=quantities[i].begin();
63  }
64 
66  double start_age,
67  double end_age,
68  double timestep,
69  const std::list<double> &required_ages
70  )
71  {
72 #ifdef DEBUG
73  std::cerr << "Fixing no evolution output." << std::endl;
74 #endif
75  static std::list<double> age_list;
76  age_list.clear();
77  std::list<double>::const_iterator
78  required_ages_iter=required_ages.begin();
79  for(double age=start_age; age<=end_age; age+=timestep) {
80  for(;required_ages_iter!=required_ages.end() &&
81  *required_ages_iter<age; ++required_ages_iter) {
82 #ifdef DEBUG
83  std::cerr << "Adding required age: "
84  << *required_ages_iter
85  << std::endl;
86 #endif
87  age_list.push_back(*required_ages_iter);
88  }
89 #ifdef DEBUG
90  std::cerr << "Adding max step age: "
91  << *required_ages_iter
92  << std::endl;
93 #endif
94  age_list.push_back(age);
95  }
96 #ifdef DEBUG
97  std::cerr << "Adding final age: " << end_age << std::endl;
98 #endif
99  age_list.push_back(end_age);
100  __real_iterators[OutCol::AGE]=age_list.begin();
101  __last_age=age_list.end();
102  create_missing_lists(age_list);
103  for(
104  unsigned i=OutCol::LAST_NO_ORBIT+1;
106  ++i
108  for(
109  unsigned i=0;
111  ++i
112  ) std::cerr << output_column_names()[i] << " is valid: "
114  << std::endl;
115  }
116 
118  const OrbitSolver &solver,
119  const BinarySystem &system,
120  const InterpolatedEvolutionStar &star,
121  double start_age,
122  double end_age,
123  double timestep,
124  const std::list<double> &required_ages
127  __mode(solver.mode_evolution().begin()),
128  __wind_saturation(star.wind_saturation_evolution().begin()),
129  __last_age(solver.evolution_ages().end()),
130  __mstar(star.mass()),
131  __mplanet(system.secondary().mass()),
132  __star(star)
133  {
134  const DissipatingZone &convective=star.zone(0),
135  &radiative=star.zone(1);
136  __real_iterators[OutCol::AGE]=solver.evolution_ages().begin();
139  ).begin();
140  __real_iterators[OutCol::IRAD]=radiative.get_evolution_real(
142  ).begin();
145  ).begin();
146  __real_iterators[OutCol::RRAD]=radiative.get_evolution_real(
148  ).begin();
149  __real_iterators[OutCol::MRAD]=radiative.get_evolution_real(
150  OUTER_MASS
151  ).begin();
154  ).begin();
155  __real_iterators[OutCol::IRAD_DERIV]=radiative.get_evolution_real(
157  ).begin();
160  ).begin();
161  __real_iterators[OutCol::RRAD_DERIV]=radiative.get_evolution_real(
163  ).begin();
164  __real_iterators[OutCol::MRAD_DERIV]=radiative.get_evolution_real(
166  ).begin();
168  convective.get_evolution_real(
170  ).begin();
172  radiative.get_evolution_real(
174  ).begin();
175  __real_iterators[OutCol::RRAD_SECOND_DERIV]=radiative.get_evolution_real(
177  ).begin();
181  ).begin();
182  __real_iterators[OutCol::RAD_INCLINATION]=radiative.get_evolution_real(
184  ).begin();
186  PERIAPSIS
187  ).begin();
188  __real_iterators[OutCol::RAD_PERIAPSIS]=radiative.get_evolution_real(
189  PERIAPSIS
190  ).begin();
193  ).begin();
194  __real_iterators[OutCol::LRAD]=radiative.get_evolution_real(
196  ).begin();
198  fix_no_evolution(start_age,
199  std::min(end_age, __star.lifetime()),
200  timestep,
201  required_ages);
202  }
203 
205  {
206  for(unsigned i=0; i<__real_iterators.size(); ++i)
208  ++__real_iterators[i];
209  ++__mode;
212  convective_orientation(*__real_iterators[OutCol::CONV_INCLINATION],
214  radiative_orientation(*__real_iterators[OutCol::CONV_INCLINATION],
215  *__real_iterators[OutCol::CONV_PERIAPSIS]);
217  radiative_orientation,
218  convective_orientation,
219  Eigen::Vector3d(0, 0, *__real_iterators[OutCol::LRAD])
220  );
222  return *this;
223  }
224 
226  {
227  switch(quantity) {
228  case OutCol::ITOT :
230  +
232  case OutCol::LSTAR :
233  return __star.luminosity(*__real_iterators[OutCol::AGE]);
234  case OutCol::ITOT_DERIV :
236  +
240  +
242  case OutCol::WORB : return Core::orbital_angular_velocity(
243  __mstar,
244  __mplanet,
246  );
247  case OutCol::PORB : return 2.0*M_PI/real_quantity(OutCol::WORB);
248  case OutCol::LORB : return Core::orbital_angular_momentum(
249  __mstar,
250  __mplanet,
251  *__real_iterators[OutCol::SEMIMAJOR],
253  );
254  case OutCol::LTOT : return __stellar_angmom.norm();
256  /
259  /
260  *__real_iterators[OutCol::IRAD]);
261  case OutCol::PSURF : return 2.0*M_PI/real_quantity(OutCol::WSURF);
262  case OutCol::PRAD : return 2.0*M_PI/real_quantity(OutCol::WRAD);
263  default : return *__real_iterators[quantity];
264  }
265  }
266 
267 }//End Evolve namespace.
static std::list< double >::const_iterator __placeholder_iterator
All undefined entries in __real_iterators are set to this.
Age derivative of MOMENT_OF_INERTIA.
Inclination of the zone.
Second derivative of the moment of inertia of the entire star.
Definition: IOColumns.h:158
The orbital periapsis in the reference frame of the stellar radiative zone in radians.
Definition: IOColumns.h:186
Age of the system in Gyr.
Definition: IOColumns.h:106
static std::list< double > __placeholder_list
Location for undefined iterators to point to.
Spin period of the stellar surface in days.
Definition: IOColumns.h:208
Age derivative of the convective moment of inertia in .
Definition: IOColumns.h:130
Second derivative of the moment of ivertia of the radiative zone.
Definition: IOColumns.h:155
Age derivative of the stellar radius in .
Definition: IOColumns.h:141
void fix_no_evolution(double start_age, double end_age, double timestep, const std::list< double > &required_ages=std::list< double >())
Handles the case when no evolution was actually calculated.
The eccentricity of the orbit.
Definition: IOColumns.h:167
Angular velocity of the stellar surface in rad/day.
Definition: IOColumns.h:202
Age derivative of the moment of inertia of the entire star in .
Definition: IOColumns.h:138
The orbital frequency in rad/day.
Definition: IOColumns.h:168
The number of real valued output quantities.
Definition: IOColumns.h:214
Second derivative of the core-envelope boundary.
Definition: IOColumns.h:161
The orbital period days.
Definition: IOColumns.h:169
Angular momentum of the radiative zone of the star in (low mass stars only)
Definition: IOColumns.h:196
Second derivative of the moment of ivertia of the convective zone.
Definition: IOColumns.h:152
std::list< bool >::const_iterator __wind_saturation
Iterator over the tabulated wind saturation state.
The angle between the stellar core spin and orbital angular momentum in radians.
Definition: IOColumns.h:178
The angle between the stellar surface spin and orbital angular momentum in radians.
Definition: IOColumns.h:174
Outer radius boundary of the zone.
Eigen::Vector3d zone_to_zone_transform(const ZoneOrientation &from_zone, const ZoneOrientation &to_zone, const Eigen::Vector3d &vector, Dissipation::QuantityEntry deriv, bool with_respect_to_from)
Transforms a vector betwen the coordinates systems of two zones.
Orientations of zones of bodies in a binary system.
Spin period of the stellar core in days (low mass stars only).
Definition: IOColumns.h:211
const ConstSolutionIterator & operator++()
Move to the next tabulated point.
Angular velocity of the stellar core in rad/day (low mass stars only).
Definition: IOColumns.h:206
double real_quantity(OutCol::OutputColumns quantity)
Get a real value quantity for the current step.
Isolates the tags for the output columns.
Definition: IOColumns.h:103
First age derivative of OUTER_MASS.
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...
Periapsis of the zone.
Eigen::Vector3d __stellar_angmom
Total angular momentum vector of the star in the reference frame of the surface zone.
A layer of a system body for which the tidal bulge is not exactly in phase with the tidal potential...
Iterates over the tabulated solution after an evolution calculation.
Age derivative of the mass of the radiative core in .
Definition: IOColumns.h:149
Angular momentum of the entire star in .
Definition: IOColumns.h:200
std::list< Core::EvolModeType >::const_iterator __mode
Iterator over the tabulated evolution mode.
Age derivative of the radiative moment of inertia in .
Definition: IOColumns.h:134
Angular momentum of the convective zone of the star in (low mass stars only)
Definition: IOColumns.h:191
Radius of the star in .
Definition: IOColumns.h:119
std::vector< std::list< double >::const_iterator > __real_iterators
Iterators to the tabulated real values quantities.
double semimajor_evolution(double orbit_power, double orbit_power_deriv=Core::NaN) const
Returns the rate of evolution of the semimajor axis or one of its derivatives.
Moment of inertia of the radiative zone of the star (low mass stars only) in .
Definition: IOColumns.h:114
Moment of inertia of the zone.
Moment of inertia of the convective zone of the star (low mass stars only) in .
Definition: IOColumns.h:110
Outer mass boundary of the zone.
Second age deriv of OUTER_RADIUS.
double __mplanet
The mass of the planet.
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.
const InterpolatedEvolutionStar & __star
The star in the system.
Luminosity of the star in .
Definition: IOColumns.h:120
Solves the system of ODEs describing the evolution of a single planet around a single star...
Definition: OrbitSolver.h:115
Age second deriv of MOMENT_OF_INERTIA.
double __mstar
The mass of the star.
Radius of the stellar core in (low mass stars only).
Definition: IOColumns.h:123
ConstSolutionIterator(const OrbitSolver &solver, const BinarySystem &system, const InterpolatedEvolutionStar &star, double start_age, double end_age, double timestep, const std::list< double > &required_ages=std::list< double >())
Start iterating over a solution.
OutputColumns
Tags for the possible columns to output.
Definition: IOColumns.h:105
The orbital periapsis in the reference frame of the stellar convective zone in radians.
Definition: IOColumns.h:182
The index of the last quantity requiring no orbital evolution.
Definition: IOColumns.h:164
Defines the SolutionIterator class.
void create_missing_lists(const std::list< double > &tabulation_ages)
Creates lists for non-orbital quantities and sets the corresponding iterators.
Mass of the stellar core in (low mass stars only).
Definition: IOColumns.h:126
Describes a system of two bodies orbiting each other.
Definition: BinarySystem.h:56
std::list< double >::const_iterator __last_age
One past the last tabulated age.
Semimajor axis of the orbit in AU.
Definition: IOColumns.h:166
virtual double outer_radius(int deriv_order=0) const =0
Outer radius of the zone or its derivative (per last.
const std::list< double > & evolution_ages() const
The ages at which evolution has been tabulated so far.
Definition: OrbitSolver.h:494
const std::vector< std::string > & output_column_names()
Define the names of the output columns.
Definition: IOColumns.cpp:3
Total moment of inertia of the star in .
Definition: IOColumns.h:117