Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
CInterface.cpp
Go to the documentation of this file.
1 
8 #define BUILDING_LIBRARY
9 #include "CInterface.h"
10 
11 const int LOCKED_SURFACE_SPIN_EVOL_MODE = Core::LOCKED_SURFACE_SPIN;
12 const int BINARY_EVOL_MODE = Core::BINARY;
13 const int SINGLE_EVOL_MODE = Core::SINGLE;
14 const int TABULATION_EVOL_MODE = Core::TABULATION;
15 const double NaN = Core::NaN;
16 
17 void read_eccentricity_expansion_coefficients(const char *filename)
18 {
20 }
21 
23  unsigned num_tidal_frequency_breaks,
24  unsigned num_spin_frequency_breaks,
25  double *tidal_frequency_breaks,
26  double *spin_frequency_breaks,
27  double *tidal_frequency_powers,
28  double *spin_frequency_powers,
29  double reference_phase_lag,
30  double inertial_mode_enhancement,
31  double inertial_mode_sharpness)
32 {
34  reinterpret_cast<Evolve::BrokenPowerlawPhaseLagZone*>(zone);
35  std::cerr << "Defining zone dissipation" << std::endl;
36  real_zone->setup(
37  (
38  num_tidal_frequency_breaks
39  ? std::vector<double>(
40  tidal_frequency_breaks,
41  tidal_frequency_breaks + num_tidal_frequency_breaks
42  )
43  : std::vector<double>()
44  ),
45  (
46  num_spin_frequency_breaks
47  ? std::vector<double>(
48  spin_frequency_breaks,
49  spin_frequency_breaks + num_spin_frequency_breaks
50  )
51  : std::vector<double>()
52  ),
53  std::vector<double>(
54  tidal_frequency_powers,
55  tidal_frequency_powers + num_tidal_frequency_breaks + 1
56  ),
57  std::vector<double>(
58  spin_frequency_powers,
59  spin_frequency_powers + num_spin_frequency_breaks + 1
60  ),
61  reference_phase_lag,
62  inertial_mode_enhancement,
63  inertial_mode_sharpness
64  );
65 
66 }
67 
69  CPlanet *planet,
70  double initial_semimajor,
71  double initial_eccentricity,
72  double initial_inclination,
73  double disk_lock_frequency,
74  double disk_dissipation_age,
75  double secondary_formation_age)
76 {
77  return reinterpret_cast<DiskBinarySystem*>(
79  *reinterpret_cast<Star::InterpolatedEvolutionStar*>(star),
80  *reinterpret_cast<Planet::Planet*>(planet),
81  initial_semimajor,
82  initial_eccentricity,
83  initial_inclination,
84  disk_lock_frequency,
85  disk_dissipation_age,
86  std::max(secondary_formation_age,
87  disk_dissipation_age)
88  )
89  );
90 }
91 
93  EvolvingStar *secondary,
94  double initial_semimajor,
95  double initial_eccentricity,
96  double initial_inclination,
97  double disk_lock_frequency,
98  double disk_dissipation_age,
99  double secondary_formation_age)
100 {
101  return reinterpret_cast<DiskBinarySystem*>(
103  *reinterpret_cast<Star::InterpolatedEvolutionStar*>(primary),
104  *reinterpret_cast<Star::InterpolatedEvolutionStar*>(secondary),
105  initial_semimajor,
106  initial_eccentricity,
107  initial_inclination,
108  disk_lock_frequency,
109  disk_dissipation_age,
110  std::max(secondary_formation_age,
111  disk_dissipation_age)
112  )
113  );
114 }
115 
117 {
118  delete reinterpret_cast<Evolve::DiskBinarySystem*>(system);
119 }
120 
122  double age,
123  double companion_mass,
124  double semimajor,
125  double eccentricity,
126  const double *spin_angmom,
127  const double *inclination,
128  const double *periapsis,
129  bool locked_surface,
130  bool zero_outer_inclination,
131  bool zero_outer_periapsis)
132 {
133  reinterpret_cast<Star::InterpolatedEvolutionStar*>(star)->configure(
134  true,
135  age,
136  companion_mass,
137  semimajor,
138  eccentricity,
139  spin_angmom,
140  inclination,
141  periapsis,
142  locked_surface,
143  zero_outer_inclination,
144  zero_outer_periapsis
145  );
146 }
147 
148 void configure_planet(CPlanet *planet,
149  double age,
150  double companion_mass,
151  double semimajor,
152  double eccentricity,
153  const double *spin_angmom,
154  const double *inclination,
155  const double *periapsis,
156  bool locked_surface,
157  bool zero_outer_inclination,
158  bool zero_outer_periapsis)
159 {
160  reinterpret_cast<Planet::Planet*>(planet)->configure(
161  true,
162  age,
163  companion_mass,
164  semimajor,
165  eccentricity,
166  spin_angmom,
167  inclination,
168  periapsis,
169  locked_surface,
170  zero_outer_inclination,
171  zero_outer_periapsis
172  );
173 }
174 
176  double age,
177  double semimajor,
178  double eccentricity,
179  const double *spin_angmom,
180  const double *inclination,
181  const double *periapsis,
182  int evolution_mode)
183 {
184  assert(evolution_mode < TABULATION_EVOL_MODE);
185  reinterpret_cast<Evolve::DiskBinarySystem*>(system)->configure(
186  true,
187  age,
188  semimajor,
189  eccentricity,
190  spin_angmom,
191  inclination,
192  periapsis,
193  static_cast<Core::EvolModeType>(evolution_mode)
194  );
195 }
196 
198  double final_age,
199  double max_time_step,
200  double precision,
201  double *required_ages,
202  unsigned num_required_ages,
203  bool print_progress,
204  double max_runtime)
205 {
206  std::cerr.setf(std::ios_base::scientific);
207  std::cerr.precision(16);
208  Evolve::OrbitSolver *solver = new Evolve::OrbitSolver(final_age,
209  precision,
210  print_progress);
211 #ifdef NDEBUG
212  try {
213 #endif
214  (*solver)(
215  *reinterpret_cast<Evolve::DiskBinarySystem*>(system),
216  max_time_step,
217  std::list<double>(required_ages,
218  required_ages + num_required_ages),
219  max_runtime
220  );
221 #ifdef NDEBUG
222  } catch(std::exception)
223  {
224  }
225 #endif
226  return reinterpret_cast<OrbitSolver*>(solver);
227 }
228 
230 {
231  delete reinterpret_cast<Evolve::OrbitSolver*>(solver);
232 }
233 
235 {
236  return reinterpret_cast<Evolve::OrbitSolver*>(
237  solver
238  )->evolution_ages().size();
239 }
240 
241 template<typename T>
242 inline void list_to_array(const std::list<T> &source, T *destination)
243 {
244  if(destination)
245  std::copy(source.begin(), source.end(), destination);
246 }
247 
249 void get_star_evolution(const EvolvingStar *star_arg,
250  double *envelope_inclination,
251  double *core_inclination,
252  double *envelope_periapsis,
253  double *core_periapsis,
254  double *envelope_angmom,
255  double *core_angmom,
256  bool *wind_saturation,
257  double *envelope_inclination_rate,
258  double *core_inclination_rate,
259  double *envelope_periapsis_rate,
260  double *core_periapsis_rate,
261  double *envelope_angmom_rate,
262  double *core_angmom_rate)
263 {
264  const Star::InterpolatedEvolutionStar *star =
265  reinterpret_cast<const Star::InterpolatedEvolutionStar*>(star_arg);
266 
267  list_to_array(star->envelope().get_evolution_real(Evolve::INCLINATION),
268  envelope_inclination);
269 
270  list_to_array(star->core().get_evolution_real(Evolve::INCLINATION),
271  core_inclination);
272 
273  list_to_array(star->envelope().get_evolution_real(Evolve::PERIAPSIS),
274  envelope_periapsis);
275 
276  list_to_array(star->core().get_evolution_real(Evolve::PERIAPSIS),
277  core_periapsis);
278 
279  list_to_array(
281  envelope_angmom
282  );
283 
284  list_to_array(star->core().get_evolution_real(Evolve::ANGULAR_MOMENTUM),
285  core_angmom);
286 
287  list_to_array(star->wind_saturation_evolution(), wind_saturation);
288 
289  list_to_array(
291  envelope_inclination_rate
292  );
293 
294  list_to_array(
296  core_inclination_rate
297  );
298 
299  list_to_array(star->envelope().get_evolution_real(Evolve::PERIAPSIS_DERIV),
300  envelope_periapsis_rate);
301 
302  list_to_array(star->core().get_evolution_real(Evolve::PERIAPSIS_DERIV),
303  core_periapsis_rate);
304 
305  list_to_array(
307  envelope_angmom_rate
308  );
309 
310  list_to_array(
312  core_angmom_rate
313  );
314 }
315 
317 void get_planet_evolution(const CPlanet *planet_arg,
318  double *inclination,
319  double *periapsis,
320  double *angmom,
321  double *inclination_rate,
322  double *periapsis_rate,
323  double *angmom_rate)
324 {
325  const Planet::Planet *planet = reinterpret_cast<const Planet::Planet*>(
326  planet_arg
327  );
328 
329  list_to_array(
331  inclination
332  );
333  list_to_array(
335  periapsis
336  );
337  list_to_array(
339  angmom
340  );
341 
342  list_to_array(
344  inclination_rate
345  );
346  list_to_array(
348  periapsis_rate
349  );
350  list_to_array(
352  angmom_rate
353  );
354 }
355 
358 void get_binary_evolution(const DiskBinarySystem *system_arg,
359  double *semimajor,
360  double *eccentricity,
361  double *semimajor_rate,
362  double *eccentricity_rate)
363 {
364  const Evolve::DiskBinarySystem *system =
365  reinterpret_cast<const Evolve::DiskBinarySystem*>(system_arg);
366 
367  list_to_array(system->semimajor_evolution(), semimajor);
368  list_to_array(system->eccentricity_evolution(), eccentricity);
369 
370  list_to_array(system->semimajor_evolution_rate(), semimajor_rate);
371  list_to_array(system->eccentricity_evolution_rate(), eccentricity_rate);
372 }
373 
376 void get_solver_evolution(const OrbitSolver *solver_arg,
377  double *age,
378  int *evolution_mode)
379 {
380  const Evolve::OrbitSolver *solver =
381  reinterpret_cast<const Evolve::OrbitSolver*>(solver_arg);
382 
383  list_to_array(solver->evolution_ages(), age);
384 
385  if(evolution_mode)
386  std::copy(solver->mode_evolution().begin(),
387  solver->mode_evolution().end(),
388  evolution_mode);
389 }
390 
392  const DiskBinarySystem *system,
393  const EvolvingStar *star,
394  const CPlanet *planet,
395  double *age,
396  double *semimajor,
397  double *eccentricity,
398  double *envelope_inclination,
399  double *core_inclination,
400  double *envelope_periapsis,
401  double *core_periapsis,
402  double *envelope_angmom,
403  double *core_angmom,
404  double *planet_inclination,
405  double *planet_periapsis,
406  double *planet_angmom,
407  int *evolution_mode,
408  bool *wind_saturation,
409  double *semimajor_rate,
410  double *eccentricity_rate,
411  double *envelope_inclination_rate,
412  double *core_inclination_rate,
413  double *envelope_periapsis_rate,
414  double *core_periapsis_rate,
415  double *envelope_angmom_rate,
416  double *core_angmom_rate,
417  double *planet_inclination_rate,
418  double *planet_periapsis_rate,
419  double *planet_angmom_rate)
420 {
421 
422  get_solver_evolution(solver, age, evolution_mode);
423 
424  get_binary_evolution(system,
425  semimajor,
426  eccentricity,
427  semimajor_rate,
428  eccentricity_rate);
429 
430  get_star_evolution(star,
431  envelope_inclination,
432  core_inclination,
433  envelope_periapsis,
434  core_periapsis,
435  envelope_angmom,
436  core_angmom,
437  wind_saturation,
438  envelope_inclination_rate,
439  core_inclination_rate,
440  envelope_periapsis_rate,
441  core_periapsis_rate,
442  envelope_angmom_rate,
443  core_angmom_rate);
444 
445  get_planet_evolution(planet,
446  planet_inclination,
447  planet_periapsis,
448  planet_angmom,
449  planet_inclination_rate,
450  planet_periapsis_rate,
451  planet_angmom_rate);
452 }
453 
455  const DiskBinarySystem *system,
456  const EvolvingStar *primary,
457  const EvolvingStar *secondary,
458  double *age,
459  double *semimajor,
460  double *eccentricity,
461  double *primary_envelope_inclination,
462  double *primary_core_inclination,
463  double *primary_envelope_periapsis,
464  double *primary_core_periapsis,
465  double *primary_envelope_angmom,
466  double *primary_core_angmom,
467  double *secondary_envelope_inclination,
468  double *secondary_core_inclination,
469  double *secondary_envelope_periapsis,
470  double *secondary_core_periapsis,
471  double *secondary_envelope_angmom,
472  double *secondary_core_angmom,
473  int *evolution_mode,
474  bool *primary_wind_saturation,
475  bool *secondary_wind_saturation,
476  double *semimajor_rate,
477  double *eccentricity_rate,
478  double *primary_envelope_inclination_rate,
479  double *primary_core_inclination_rate,
480  double *primary_envelope_periapsis_rate,
481  double *primary_core_periapsis_rate,
482  double *primary_envelope_angmom_rate,
483  double *primary_core_angmom_rate,
484  double *secondary_envelope_inclination_rate,
485  double *secondary_core_inclination_rate,
486  double *secondary_envelope_periapsis_rate,
487  double *secondary_core_periapsis_rate,
488  double *secondary_envelope_angmom_rate,
489  double *secondary_core_angmom_rate)
490 {
491  get_solver_evolution(solver, age, evolution_mode);
492 
493  get_binary_evolution(system,
494  semimajor,
495  eccentricity,
496  semimajor_rate,
497  eccentricity_rate);
498 
499  get_star_evolution(primary,
500  primary_envelope_inclination,
501  primary_core_inclination,
502  primary_envelope_periapsis,
503  primary_core_periapsis,
504  primary_envelope_angmom,
505  primary_core_angmom,
506  primary_wind_saturation,
507  primary_envelope_inclination_rate,
508  primary_core_inclination_rate,
509  primary_envelope_periapsis_rate,
510  primary_core_periapsis_rate,
511  primary_envelope_angmom_rate,
512  primary_core_angmom_rate);
513 
514  get_star_evolution(secondary,
515  secondary_envelope_inclination,
516  secondary_core_inclination,
517  secondary_envelope_periapsis,
518  secondary_core_periapsis,
519  secondary_envelope_angmom,
520  secondary_core_angmom,
521  secondary_wind_saturation,
522  secondary_envelope_inclination_rate,
523  secondary_core_inclination_rate,
524  secondary_envelope_periapsis_rate,
525  secondary_core_periapsis_rate,
526  secondary_envelope_angmom_rate,
527  secondary_core_angmom_rate);
528 }
529 
532 void get_star_final_state(const EvolvingStar *star_arg,
533  double *envelope_inclination,
534  double *core_inclination,
535  double *envelope_periapsis,
536  double *core_periapsis,
537  double *envelope_angmom,
538  double *core_angmom,
539  bool *wind_saturation)
540 {
541  const Star::InterpolatedEvolutionStar *star =
542  reinterpret_cast<const Star::InterpolatedEvolutionStar*>(star_arg);
543 
544  if(envelope_inclination)
545  *envelope_inclination = (
547  );
548 
549  if(core_inclination)
550  *core_inclination = star->core().get_evolution_real(
552  ).back();
553 
554  if(envelope_periapsis)
555  *envelope_periapsis = star->envelope().get_evolution_real(
557  ).back();
558 
559  if(core_periapsis)
560  *core_periapsis = star->core().get_evolution_real(
562  ).back();
563 
564  if(envelope_angmom)
565  *envelope_angmom = star->envelope().get_evolution_real(
567  ).back();
568 
569  if(core_angmom)
570  *core_angmom = star->core().get_evolution_real(
572  ).back();
573 
574  if(wind_saturation)
575  *wind_saturation = star->wind_saturation_evolution().back();
576 }
577 
580 void get_planet_final_state(const CPlanet *planet_arg,
581  double *inclination,
582  double *periapsis,
583  double *angmom)
584 {
585  const Planet::Planet *planet = reinterpret_cast<const Planet::Planet*>(
586  planet_arg
587  );
588 
589  if(inclination)
590  *inclination = planet->zone().get_evolution_real(
592  ).back();
593 
594  if(periapsis)
595  *periapsis = planet->zone().get_evolution_real(
597  ).back();
598 
599  if(angmom)
600  *angmom = planet->zone().get_evolution_real(
602  ).back();
603 }
604 
608  double *semimajor,
609  double *eccentricity)
610 {
611  const Evolve::DiskBinarySystem *system =
612  reinterpret_cast<const Evolve::DiskBinarySystem*>(system_arg);
613 
614  if(semimajor)
615  *semimajor = system->semimajor_evolution().back();
616 
617  if(eccentricity)
618  *eccentricity = system->eccentricity_evolution().back();
619 }
620 
623 void get_solver_final_state(const OrbitSolver *solver_arg,
624  double *age,
625  int *evolution_mode)
626 {
627  const Evolve::OrbitSolver *solver =
628  reinterpret_cast<const Evolve::OrbitSolver*>(solver_arg);
629 
630  if(age)
631  *age = solver->evolution_ages().back();
632 
633  if(evolution_mode)
634  *evolution_mode = solver->mode_evolution().back();
635 }
636 
638  const DiskBinarySystem *system,
639  const EvolvingStar *star,
640  const CPlanet *planet,
641  double *age,
642  double *semimajor,
643  double *eccentricity,
644  double *envelope_inclination,
645  double *core_inclination,
646  double *envelope_periapsis,
647  double *core_periapsis,
648  double *envelope_angmom,
649  double *core_angmom,
650  double *planet_inclination,
651  double *planet_periapsis,
652  double *planet_angmom,
653  int *evolution_mode,
654  bool *wind_saturation)
655 {
656  get_solver_final_state(solver, age, evolution_mode);
657 
658  get_binary_final_state(system, semimajor, eccentricity);
659 
661  envelope_inclination,
662  core_inclination,
663  envelope_periapsis,
664  core_periapsis,
665  envelope_angmom,
666  core_angmom,
667  wind_saturation);
668 
669  get_planet_final_state(planet,
670  planet_inclination,
671  planet_periapsis,
672  planet_angmom);
673 }
674 
676  const DiskBinarySystem *system,
677  const EvolvingStar *primary,
678  const EvolvingStar *secondary,
679  double *age,
680  double *semimajor,
681  double *eccentricity,
682 
683  double *primary_envelope_inclination,
684  double *primary_core_inclination,
685  double *primary_envelope_periapsis,
686  double *primary_core_periapsis,
687  double *primary_envelope_angmom,
688  double *primary_core_angmom,
689 
690  double *secondary_envelope_inclination,
691  double *secondary_core_inclination,
692  double *secondary_envelope_periapsis,
693  double *secondary_core_periapsis,
694  double *secondary_envelope_angmom,
695  double *secondary_core_angmom,
696  int *evolution_mode,
697  bool *primary_wind_saturation,
698  bool *secondary_wind_saturation)
699 {
700  get_solver_final_state(solver, age, evolution_mode);
701 
702  get_binary_final_state(system, semimajor, eccentricity);
703 
704  get_star_final_state(primary,
705  primary_envelope_inclination,
706  primary_core_inclination,
707  primary_envelope_periapsis,
708  primary_core_periapsis,
709  primary_envelope_angmom,
710  primary_core_angmom,
711  primary_wind_saturation);
712 
713  get_star_final_state(secondary,
714  secondary_envelope_inclination,
715  secondary_core_inclination,
716  secondary_envelope_periapsis,
717  secondary_core_periapsis,
718  secondary_envelope_angmom,
719  secondary_core_angmom,
720  secondary_wind_saturation);
721 }
void get_planet_final_state(const CPlanet *planet_arg, double *inclination, double *periapsis, double *angmom)
Fill the given pointers with the state of the given planet at the end of the evolution.
Definition: CInterface.cpp:580
const std::list< double > & eccentricity_evolution() const
The tabulated evolution of the eccentricity so far.
Inclination of the zone.
The rate at which periapsis changes.
DiskBinarySystem * create_star_planet_system(EvolvingStar *star, CPlanet *planet, double initial_semimajor, double initial_eccentricity, double initial_inclination, double disk_lock_frequency, double disk_dissipation_age, double secondary_formation_age)
Create a binary system out of a star and a planet.
Definition: CInterface.cpp:68
void get_star_planet_evolution(const OrbitSolver *solver, const DiskBinarySystem *system, const EvolvingStar *star, const CPlanet *planet, double *age, double *semimajor, double *eccentricity, double *envelope_inclination, double *core_inclination, double *envelope_periapsis, double *core_periapsis, double *envelope_angmom, double *core_angmom, double *planet_inclination, double *planet_periapsis, double *planet_angmom, int *evolution_mode, bool *wind_saturation, double *semimajor_rate, double *eccentricity_rate, double *envelope_inclination_rate, double *core_inclination_rate, double *envelope_periapsis_rate, double *core_periapsis_rate, double *envelope_angmom_rate, double *core_angmom_rate, double *planet_inclination_rate, double *planet_periapsis_rate, double *planet_angmom_rate)
Fill C-style arrays with the calculated evolution of a star-planet system.
Definition: CInterface.cpp:391
const std::list< Core::EvolModeType > & mode_evolution() const
The tabulated evolution modes so far.
Definition: OrbitSolver.h:498
Declare C-style functions for accessing the functionality of the Evolve library.
void get_star_final_state(const EvolvingStar *star_arg, double *envelope_inclination, double *core_inclination, double *envelope_periapsis, double *core_periapsis, double *envelope_angmom, double *core_angmom, bool *wind_saturation)
Fill the given pointers with the state of the given star at the end of the evolution.
Definition: CInterface.cpp:532
void get_binary_final_state(const DiskBinarySystem *system_arg, double *semimajor, double *eccentricity)
Fill the given pointers with the final orbital state of a previously evolved system.
Definition: CInterface.cpp:607
void configure_system(DiskBinarySystem *system, double age, double semimajor, double eccentricity, const double *spin_angmom, const double *inclination, const double *periapsis, int evolution_mode)
Sets the current state of a system.
Definition: CInterface.cpp:175
struct LIB_PUBLIC BrokenPowerlawPhaseLagZone
Opaque struct to cant to/from Evolve::BrokenPowerlawPhasLagZone.
Definition: CInterface.h:41
void get_planet_evolution(const CPlanet *planet_arg, double *inclination, double *periapsis, double *angmom, double *inclination_rate, double *periapsis_rate, double *angmom_rate)
Fill the given array with the part of the evolution tracked by the planet.
Definition: CInterface.cpp:317
const int BINARY_EVOL_MODE
Evolution mode ID for when the two bodies orbit each other.
Definition: CInterface.cpp:12
void destroy_binary(DiskBinarySystem *system)
Destroy a previously created binary system.
Definition: CInterface.cpp:116
The rate at which the the inclination changes.
void configure_planet(CPlanet *planet, double age, double companion_mass, double semimajor, double eccentricity, const double *spin_angmom, const double *inclination, const double *periapsis, bool locked_surface, bool zero_outer_inclination, bool zero_outer_periapsis)
Defines the orbit a planet is in.
Definition: CInterface.cpp:148
Single zone non-evolving planets with huge dissipation, so they always remain locked to the disk...
Definition: Planet.h:21
const std::list< double > & eccentricity_evolution_rate() const
The tabulated evolution of the eccentricity so far.
const Evolve::DissipatingZone & zone(unsigned zone_index) const
Returns the only zone.
Definition: Planet.h:37
struct LIB_PUBLIC OrbitSolver
Opaque struct to cast to/from Evolve::OrbitSolver.
Definition: CInterface.h:38
const std::list< double > & semimajor_evolution() const
The tabulated evolution of the semimajor axis so far.
const std::list< bool > & wind_saturation_evolution() const
The tabulated wind saturation states so far.
const EvolvingStellarCore & core() const
The core of the star.
Definition: EvolvingStar.h:100
struct LIB_PUBLIC DiskBinarySystem
Opaque struct to cast to/from Evolve::DiskBinarySystem.
Definition: CInterface.h:35
unsigned num_evolution_steps(OrbitSolver *solver)
At how many points was the evolution saved.
Definition: CInterface.cpp:234
Periapsis of the zone.
OrbitSolver * evolve_system(DiskBinarySystem *system, double final_age, double max_time_step, double precision, double *required_ages, unsigned num_required_ages, bool print_progress, double max_runtime)
Calculate the evolution of a previously configured binary system.
Definition: CInterface.cpp:197
void get_star_planet_final_state(const OrbitSolver *solver, const DiskBinarySystem *system, const EvolvingStar *star, const CPlanet *planet, double *age, double *semimajor, double *eccentricity, double *envelope_inclination, double *core_inclination, double *envelope_periapsis, double *core_periapsis, double *envelope_angmom, double *core_angmom, double *planet_inclination, double *planet_periapsis, double *planet_angmom, int *evolution_mode, bool *wind_saturation)
Fill destiantions with the calculated final state of a star-planet system.
Definition: CInterface.cpp:637
const int SINGLE_EVOL_MODE
Evolution mode ID for when there is only one body in the system (only its rotation evolves)...
Definition: CInterface.cpp:13
const double NaN
Not a number.
Definition: CInterface.cpp:15
void get_binary_evolution(const DiskBinarySystem *system_arg, double *semimajor, double *eccentricity, double *semimajor_rate, double *eccentricity_rate)
Fill the given arrays with the part of the evolution (the orbital state) tracked by the binary system...
Definition: CInterface.cpp:358
void get_star_evolution(const EvolvingStar *star_arg, double *envelope_inclination, double *core_inclination, double *envelope_periapsis, double *core_periapsis, double *envelope_angmom, double *core_angmom, bool *wind_saturation, double *envelope_inclination_rate, double *core_inclination_rate, double *envelope_periapsis_rate, double *core_periapsis_rate, double *envelope_angmom_rate, double *core_angmom_rate)
Fill the given arrays with the part of the evolution tracked by the star.
Definition: CInterface.cpp:249
static void read_eccentricity_expansion(const std::string &fname)
Reads the eccentricity expansion coefficients of .
DiskBinarySystem * create_star_star_system(EvolvingStar *primary, EvolvingStar *secondary, double initial_semimajor, double initial_eccentricity, double initial_inclination, double disk_lock_frequency, double disk_dissipation_age, double secondary_formation_age)
Create a binary system out of two stars.
Definition: CInterface.cpp:92
const int LOCKED_SURFACE_SPIN_EVOL_MODE
Evolution mode ID for when the surface rotation of one of the bodies is locked to a prescribed value...
Definition: CInterface.cpp:11
const EvolvingStellarEnvelope & envelope() const
The envelope of the star - inmodifiable.
Definition: EvolvingStar.h:94
void get_star_star_evolution(const OrbitSolver *solver, const DiskBinarySystem *system, const EvolvingStar *primary, const EvolvingStar *secondary, double *age, double *semimajor, double *eccentricity, double *primary_envelope_inclination, double *primary_core_inclination, double *primary_envelope_periapsis, double *primary_core_periapsis, double *primary_envelope_angmom, double *primary_core_angmom, double *secondary_envelope_inclination, double *secondary_core_inclination, double *secondary_envelope_periapsis, double *secondary_core_periapsis, double *secondary_envelope_angmom, double *secondary_core_angmom, int *evolution_mode, bool *primary_wind_saturation, bool *secondary_wind_saturation, double *semimajor_rate, double *eccentricity_rate, double *primary_envelope_inclination_rate, double *primary_core_inclination_rate, double *primary_envelope_periapsis_rate, double *primary_core_periapsis_rate, double *primary_envelope_angmom_rate, double *primary_core_angmom_rate, double *secondary_envelope_inclination_rate, double *secondary_core_inclination_rate, double *secondary_envelope_periapsis_rate, double *secondary_core_periapsis_rate, double *secondary_envelope_angmom_rate, double *secondary_core_angmom_rate)
Fill C-style arrays with the calculated evolution of a binary star system.
Definition: CInterface.cpp:454
A DissipatingZone where the phase lag is described by a broken powerlaw.
const std::list< double > & get_evolution_real(ZoneEvolutionQuantities quantity) const
The tabulated evolution of a real valued quantity so far.
void get_solver_evolution(const OrbitSolver *solver_arg, double *age, int *evolution_mode)
Fill the given arrays with the part of the evolution tracked by the orbit solver. ...
Definition: CInterface.cpp:376
Angular momentum of the zone.
void destroy_solver(OrbitSolver *solver)
Destroy a solver created by evolve_system.
Definition: CInterface.cpp:229
void get_star_star_final_state(const OrbitSolver *solver, const DiskBinarySystem *system, const EvolvingStar *primary, const EvolvingStar *secondary, double *age, double *semimajor, double *eccentricity, double *primary_envelope_inclination, double *primary_core_inclination, double *primary_envelope_periapsis, double *primary_core_periapsis, double *primary_envelope_angmom, double *primary_core_angmom, double *secondary_envelope_inclination, double *secondary_core_inclination, double *secondary_envelope_periapsis, double *secondary_core_periapsis, double *secondary_envelope_angmom, double *secondary_core_angmom, int *evolution_mode, bool *primary_wind_saturation, bool *secondary_wind_saturation)
Fill destiantions with the calculated final state of a binary star system.
Definition: CInterface.cpp:675
void configure_star(EvolvingStar *star, double age, double companion_mass, double semimajor, double eccentricity, const double *spin_angmom, const double *inclination, const double *periapsis, bool locked_surface, bool zero_outer_inclination, bool zero_outer_periapsis)
Defines the orbit a star is in.
Definition: CInterface.cpp:121
Solves the system of ODEs describing the evolution of a single planet around a single star...
Definition: OrbitSolver.h:115
const std::list< double > & semimajor_evolution_rate() const
The tabulated evolution of the semimajor axis so far.
The rate at which angular momentum changes.
void get_solver_final_state(const OrbitSolver *solver_arg, double *age, int *evolution_mode)
Fill the given pointers with the final state of an orbit solver used to calculate an evolution...
Definition: CInterface.cpp:623
void read_eccentricity_expansion_coefficients(const char *filename)
Read eccentricity expansion coefficients from a file.
Definition: CInterface.cpp:17
void set_zone_dissipation(BrokenPowerlawPhaseLagZone *zone, unsigned num_tidal_frequency_breaks, unsigned num_spin_frequency_breaks, double *tidal_frequency_breaks, double *spin_frequency_breaks, double *tidal_frequency_powers, double *spin_frequency_powers, double reference_phase_lag, double inertial_mode_enhancement, double inertial_mode_sharpness)
Definition: CInterface.cpp:22
const int TABULATION_EVOL_MODE
Evolution mode ID used as the mode to transform to from all other modes when storing the computed evo...
Definition: CInterface.cpp:14
For some prescribed amount of time the surface of the pramary spins at a prescribed rate...
const std::list< double > & evolution_ages() const
The ages at which evolution has been tabulated so far.
Definition: OrbitSolver.h:494
struct LIB_PUBLIC EvolvingStar
Opaque struct to cast to/from Star::InterpolatedEvolutionStar.
Definition: CInterface.h:30
void setup(const std::vector< double > &tidal_frequency_breaks, const std::vector< double > &spin_frequency_breaks, const std::vector< double > &tidal_frequency_powers, const std::vector< double > &spin_frequency_powers, double reference_phase_lag, double inertial_mode_enhancement=1.0, double inertial_mode_sharpness=10.0)
Seup the zone with the given breaks/powers and inertial mode enhancement. Continuous accress all brea...