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 prepare_eccentricity_expansion(const char *filename,
18  double precision,
19  bool pre_load,
20  bool disable_precision_fail)
21 {
23  filename,
24  precision,
25  pre_load,
26  disable_precision_fail
27  );
28 }
29 
31  unsigned num_tidal_frequency_breaks,
32  unsigned num_spin_frequency_breaks,
33  double *tidal_frequency_breaks,
34  double *spin_frequency_breaks,
35  double *tidal_frequency_powers,
36  double *spin_frequency_powers,
37  double reference_phase_lag,
38  double inertial_mode_enhancement,
39  double inertial_mode_sharpness)
40 {
42  reinterpret_cast<Evolve::BrokenPowerlawPhaseLagZone*>(zone);
43  std::cerr << "Defining zone dissipation" << std::endl;
44  real_zone->setup(
45  (
46  num_tidal_frequency_breaks
47  ? std::vector<double>(
48  tidal_frequency_breaks,
49  tidal_frequency_breaks + num_tidal_frequency_breaks
50  )
51  : std::vector<double>()
52  ),
53  (
54  num_spin_frequency_breaks
55  ? std::vector<double>(
56  spin_frequency_breaks,
57  spin_frequency_breaks + num_spin_frequency_breaks
58  )
59  : std::vector<double>()
60  ),
61  std::vector<double>(
62  tidal_frequency_powers,
63  tidal_frequency_powers + num_tidal_frequency_breaks + 1
64  ),
65  std::vector<double>(
66  spin_frequency_powers,
67  spin_frequency_powers + num_spin_frequency_breaks + 1
68  ),
69  reference_phase_lag,
70  inertial_mode_enhancement,
71  inertial_mode_sharpness
72  );
73 
74 }
75 
77  CPlanet *planet,
78  double initial_semimajor,
79  double initial_eccentricity,
80  double initial_inclination,
81  double disk_lock_frequency,
82  double disk_dissipation_age,
83  double secondary_formation_age)
84 {
85  return reinterpret_cast<DiskBinarySystem*>(
87  *reinterpret_cast<Star::InterpolatedEvolutionStar*>(star),
88  *reinterpret_cast<Planet::Planet*>(planet),
89  initial_semimajor,
90  initial_eccentricity,
91  initial_inclination,
92  disk_lock_frequency,
93  disk_dissipation_age,
94  std::max(secondary_formation_age,
95  disk_dissipation_age)
96  )
97  );
98 }
99 
101  EvolvingStar *secondary,
102  double initial_semimajor,
103  double initial_eccentricity,
104  double initial_inclination,
105  double disk_lock_frequency,
106  double disk_dissipation_age,
107  double secondary_formation_age)
108 {
109  return reinterpret_cast<DiskBinarySystem*>(
111  *reinterpret_cast<Star::InterpolatedEvolutionStar*>(primary),
112  *reinterpret_cast<Star::InterpolatedEvolutionStar*>(secondary),
113  initial_semimajor,
114  initial_eccentricity,
115  initial_inclination,
116  disk_lock_frequency,
117  disk_dissipation_age,
118  std::max(secondary_formation_age,
119  disk_dissipation_age)
120  )
121  );
122 }
123 
125  CPlanet *secondary,
126  double initial_semimajor,
127  double initial_eccentricity,
128  double initial_inclination,
129  double disk_lock_frequency,
130  double disk_dissipation_age)
131 {
132  return reinterpret_cast<DiskBinarySystem*>(
134  *reinterpret_cast<Planet::Planet*>(primary),
135  *reinterpret_cast<Planet::Planet*>(secondary),
136  initial_semimajor,
137  initial_eccentricity,
138  initial_inclination,
139  disk_lock_frequency,
140  disk_dissipation_age,
141  disk_dissipation_age
142  )
143  );
144 }
145 
147 {
148  delete reinterpret_cast<Evolve::DiskBinarySystem*>(system);
149 }
150 
152  double age,
153  double companion_mass,
154  double semimajor,
155  double eccentricity,
156  const double *spin_angmom,
157  const double *inclination,
158  const double *periapsis,
159  bool locked_surface,
160  bool zero_outer_inclination,
161  bool zero_outer_periapsis)
162 {
163  reinterpret_cast<Star::InterpolatedEvolutionStar*>(star)->configure(
164  true,
165  age,
166  companion_mass,
167  semimajor,
168  eccentricity,
169  spin_angmom,
170  inclination,
171  periapsis,
172  locked_surface,
173  zero_outer_inclination,
174  zero_outer_periapsis
175  );
176 }
177 
178 void configure_planet(CPlanet *planet,
179  double age,
180  double companion_mass,
181  double semimajor,
182  double eccentricity,
183  const double *spin_angmom,
184  const double *inclination,
185  const double *periapsis,
186  bool locked_surface,
187  bool zero_outer_inclination,
188  bool zero_outer_periapsis)
189 {
190  reinterpret_cast<Planet::Planet*>(planet)->configure(
191  true,
192  age,
193  companion_mass,
194  semimajor,
195  eccentricity,
196  spin_angmom,
197  inclination,
198  periapsis,
199  locked_surface,
200  zero_outer_inclination,
201  zero_outer_periapsis
202  );
203 }
204 
206  double age,
207  double semimajor,
208  double eccentricity,
209  const double *spin_angmom,
210  const double *inclination,
211  const double *periapsis,
212  int evolution_mode)
213 {
214  assert(evolution_mode < TABULATION_EVOL_MODE);
215  reinterpret_cast<Evolve::DiskBinarySystem*>(system)->configure(
216  true,
217  age,
218  semimajor,
219  eccentricity,
220  spin_angmom,
221  inclination,
222  periapsis,
223  static_cast<Core::EvolModeType>(evolution_mode)
224  );
225 }
226 
228  double final_age,
229  double max_time_step,
230  double precision,
231  double *required_ages,
232  unsigned num_required_ages,
233  bool print_progress,
234  double max_runtime,
235  unsigned max_time_steps)
236 {
237  std::cerr.setf(std::ios_base::scientific);
238  std::cerr.precision(16);
239  Evolve::OrbitSolver *solver = new Evolve::OrbitSolver(final_age,
240  precision,
241  print_progress);
242 #ifdef NDEBUG
243  try {
244 #endif
245  (*solver)(
246  *reinterpret_cast<Evolve::DiskBinarySystem*>(system),
247  max_time_step,
248  std::list<double>(required_ages,
249  required_ages + num_required_ages),
250  max_runtime,
251  max_time_steps
252  );
253 #ifdef NDEBUG
254  } catch(std::exception)
255  {
256  }
257 #endif
258  return reinterpret_cast<OrbitSolver*>(solver);
259 }
260 
262 {
263  delete reinterpret_cast<Evolve::OrbitSolver*>(solver);
264 }
265 
267 {
268  return reinterpret_cast<Evolve::OrbitSolver*>(
269  solver
270  )->evolution_ages().size();
271 }
272 
273 template<typename T>
274 inline void list_to_array(const std::list<T> &source, T *destination)
275 {
276  if(destination)
277  std::copy(source.begin(), source.end(), destination);
278 }
279 
281 void get_star_evolution(const EvolvingStar *star_arg,
282  double *envelope_inclination,
283  double *core_inclination,
284  double *envelope_periapsis,
285  double *core_periapsis,
286  double *envelope_angmom,
287  double *core_angmom,
288  bool *wind_saturation,
289  double *envelope_inclination_rate,
290  double *core_inclination_rate,
291  double *envelope_periapsis_rate,
292  double *core_periapsis_rate,
293  double *envelope_angmom_rate,
294  double *core_angmom_rate)
295 {
296  const Star::InterpolatedEvolutionStar *star =
297  reinterpret_cast<const Star::InterpolatedEvolutionStar*>(star_arg);
298 
299  list_to_array(star->envelope().get_evolution_real(Evolve::INCLINATION),
300  envelope_inclination);
301 
302  list_to_array(star->core().get_evolution_real(Evolve::INCLINATION),
303  core_inclination);
304 
305  list_to_array(star->envelope().get_evolution_real(Evolve::PERIAPSIS),
306  envelope_periapsis);
307 
308  list_to_array(star->core().get_evolution_real(Evolve::PERIAPSIS),
309  core_periapsis);
310 
311  list_to_array(
313  envelope_angmom
314  );
315 
316  list_to_array(star->core().get_evolution_real(Evolve::ANGULAR_MOMENTUM),
317  core_angmom);
318 
319  list_to_array(star->wind_saturation_evolution(), wind_saturation);
320 
321  list_to_array(
323  envelope_inclination_rate
324  );
325 
326  list_to_array(
328  core_inclination_rate
329  );
330 
331  list_to_array(star->envelope().get_evolution_real(Evolve::PERIAPSIS_DERIV),
332  envelope_periapsis_rate);
333 
334  list_to_array(star->core().get_evolution_real(Evolve::PERIAPSIS_DERIV),
335  core_periapsis_rate);
336 
337  list_to_array(
339  envelope_angmom_rate
340  );
341 
342  list_to_array(
344  core_angmom_rate
345  );
346 }
347 
349 void get_planet_evolution(const CPlanet *planet_arg,
350  double *inclination,
351  double *periapsis,
352  double *angmom,
353  double *inclination_rate,
354  double *periapsis_rate,
355  double *angmom_rate)
356 {
357  const Planet::Planet *planet = reinterpret_cast<const Planet::Planet*>(
358  planet_arg
359  );
360 
361  list_to_array(
363  inclination
364  );
365  list_to_array(
367  periapsis
368  );
369  list_to_array(
371  angmom
372  );
373 
374  list_to_array(
376  inclination_rate
377  );
378  list_to_array(
380  periapsis_rate
381  );
382  list_to_array(
384  angmom_rate
385  );
386 }
387 
390 void get_binary_evolution(const DiskBinarySystem *system_arg,
391  double *semimajor,
392  double *eccentricity,
393  double *semimajor_rate,
394  double *eccentricity_rate)
395 {
396  const Evolve::DiskBinarySystem *system =
397  reinterpret_cast<const Evolve::DiskBinarySystem*>(system_arg);
398 
399  list_to_array(system->semimajor_evolution(), semimajor);
400  list_to_array(system->eccentricity_evolution(), eccentricity);
401 
402  list_to_array(system->semimajor_evolution_rate(), semimajor_rate);
403  list_to_array(system->eccentricity_evolution_rate(), eccentricity_rate);
404 }
405 
408 void get_solver_evolution(const OrbitSolver *solver_arg,
409  double *age,
410  int *evolution_mode)
411 {
412  const Evolve::OrbitSolver *solver =
413  reinterpret_cast<const Evolve::OrbitSolver*>(solver_arg);
414 
415  list_to_array(solver->evolution_ages(), age);
416 
417  if(evolution_mode)
418  std::copy(solver->mode_evolution().begin(),
419  solver->mode_evolution().end(),
420  evolution_mode);
421 }
422 
424  const DiskBinarySystem *system,
425  const EvolvingStar *star,
426  const CPlanet *planet,
427  double *age,
428  double *semimajor,
429  double *eccentricity,
430  double *envelope_inclination,
431  double *core_inclination,
432  double *envelope_periapsis,
433  double *core_periapsis,
434  double *envelope_angmom,
435  double *core_angmom,
436  double *planet_inclination,
437  double *planet_periapsis,
438  double *planet_angmom,
439  int *evolution_mode,
440  bool *wind_saturation,
441  double *semimajor_rate,
442  double *eccentricity_rate,
443  double *envelope_inclination_rate,
444  double *core_inclination_rate,
445  double *envelope_periapsis_rate,
446  double *core_periapsis_rate,
447  double *envelope_angmom_rate,
448  double *core_angmom_rate,
449  double *planet_inclination_rate,
450  double *planet_periapsis_rate,
451  double *planet_angmom_rate)
452 {
453 
454  get_solver_evolution(solver, age, evolution_mode);
455 
456  get_binary_evolution(system,
457  semimajor,
458  eccentricity,
459  semimajor_rate,
460  eccentricity_rate);
461 
462  get_star_evolution(star,
463  envelope_inclination,
464  core_inclination,
465  envelope_periapsis,
466  core_periapsis,
467  envelope_angmom,
468  core_angmom,
469  wind_saturation,
470  envelope_inclination_rate,
471  core_inclination_rate,
472  envelope_periapsis_rate,
473  core_periapsis_rate,
474  envelope_angmom_rate,
475  core_angmom_rate);
476 
477  get_planet_evolution(planet,
478  planet_inclination,
479  planet_periapsis,
480  planet_angmom,
481  planet_inclination_rate,
482  planet_periapsis_rate,
483  planet_angmom_rate);
484 }
485 
487  const DiskBinarySystem *system,
488  const EvolvingStar *primary,
489  const EvolvingStar *secondary,
490  double *age,
491  double *semimajor,
492  double *eccentricity,
493  double *primary_envelope_inclination,
494  double *primary_core_inclination,
495  double *primary_envelope_periapsis,
496  double *primary_core_periapsis,
497  double *primary_envelope_angmom,
498  double *primary_core_angmom,
499  double *secondary_envelope_inclination,
500  double *secondary_core_inclination,
501  double *secondary_envelope_periapsis,
502  double *secondary_core_periapsis,
503  double *secondary_envelope_angmom,
504  double *secondary_core_angmom,
505  int *evolution_mode,
506  bool *primary_wind_saturation,
507  bool *secondary_wind_saturation,
508  double *semimajor_rate,
509  double *eccentricity_rate,
510  double *primary_envelope_inclination_rate,
511  double *primary_core_inclination_rate,
512  double *primary_envelope_periapsis_rate,
513  double *primary_core_periapsis_rate,
514  double *primary_envelope_angmom_rate,
515  double *primary_core_angmom_rate,
516  double *secondary_envelope_inclination_rate,
517  double *secondary_core_inclination_rate,
518  double *secondary_envelope_periapsis_rate,
519  double *secondary_core_periapsis_rate,
520  double *secondary_envelope_angmom_rate,
521  double *secondary_core_angmom_rate)
522 {
523  get_solver_evolution(solver, age, evolution_mode);
524 
525  get_binary_evolution(system,
526  semimajor,
527  eccentricity,
528  semimajor_rate,
529  eccentricity_rate);
530 
531  get_star_evolution(primary,
532  primary_envelope_inclination,
533  primary_core_inclination,
534  primary_envelope_periapsis,
535  primary_core_periapsis,
536  primary_envelope_angmom,
537  primary_core_angmom,
538  primary_wind_saturation,
539  primary_envelope_inclination_rate,
540  primary_core_inclination_rate,
541  primary_envelope_periapsis_rate,
542  primary_core_periapsis_rate,
543  primary_envelope_angmom_rate,
544  primary_core_angmom_rate);
545 
546  get_star_evolution(secondary,
547  secondary_envelope_inclination,
548  secondary_core_inclination,
549  secondary_envelope_periapsis,
550  secondary_core_periapsis,
551  secondary_envelope_angmom,
552  secondary_core_angmom,
553  secondary_wind_saturation,
554  secondary_envelope_inclination_rate,
555  secondary_core_inclination_rate,
556  secondary_envelope_periapsis_rate,
557  secondary_core_periapsis_rate,
558  secondary_envelope_angmom_rate,
559  secondary_core_angmom_rate);
560 }
561 
563  const DiskBinarySystem *system,
564  const CPlanet *primary,
565  const CPlanet *secondary,
566  double *age,
567  double *semimajor,
568  double *eccentricity,
569  double *primary_inclination,
570  double *primary_periapsis,
571  double *primary_angmom,
572  double *secondary_inclination,
573  double *secondary_periapsis,
574  double *secondary_angmom,
575  int *evolution_mode,
576  double *semimajor_rate,
577  double *eccentricity_rate,
578  double *primary_inclination_rate,
579  double *primary_periapsis_rate,
580  double *primary_angmom_rate,
581  double *secondary_inclination_rate,
582  double *secondary_periapsis_rate,
583  double *secondary_angmom_rate)
584 {
585 
586  get_solver_evolution(solver, age, evolution_mode);
587 
588  get_binary_evolution(system,
589  semimajor,
590  eccentricity,
591  semimajor_rate,
592  eccentricity_rate);
593 
594  get_planet_evolution(primary,
595  primary_inclination,
596  primary_periapsis,
597  primary_angmom,
598  primary_inclination_rate,
599  primary_periapsis_rate,
600  primary_angmom_rate);
601 
602  get_planet_evolution(secondary,
603  secondary_inclination,
604  secondary_periapsis,
605  secondary_angmom,
606  secondary_inclination_rate,
607  secondary_periapsis_rate,
608  secondary_angmom_rate);
609 }
610 
613 void get_star_final_state(const EvolvingStar *star_arg,
614  double *envelope_inclination,
615  double *core_inclination,
616  double *envelope_periapsis,
617  double *core_periapsis,
618  double *envelope_angmom,
619  double *core_angmom,
620  bool *wind_saturation)
621 {
622  const Star::InterpolatedEvolutionStar *star =
623  reinterpret_cast<const Star::InterpolatedEvolutionStar*>(star_arg);
624 
625  if(envelope_inclination)
626  *envelope_inclination = (
628  );
629 
630  if(core_inclination)
631  *core_inclination = star->core().get_evolution_real(
633  ).back();
634 
635  if(envelope_periapsis)
636  *envelope_periapsis = star->envelope().get_evolution_real(
638  ).back();
639 
640  if(core_periapsis)
641  *core_periapsis = star->core().get_evolution_real(
643  ).back();
644 
645  if(envelope_angmom)
646  *envelope_angmom = star->envelope().get_evolution_real(
648  ).back();
649 
650  if(core_angmom)
651  *core_angmom = star->core().get_evolution_real(
653  ).back();
654 
655  if(wind_saturation)
656  *wind_saturation = star->wind_saturation_evolution().back();
657 }
658 
661 void get_planet_final_state(const CPlanet *planet_arg,
662  double *inclination,
663  double *periapsis,
664  double *angmom)
665 {
666  const Planet::Planet *planet = reinterpret_cast<const Planet::Planet*>(
667  planet_arg
668  );
669 
670  if(inclination)
671  *inclination = planet->zone().get_evolution_real(
673  ).back();
674 
675  if(periapsis)
676  *periapsis = planet->zone().get_evolution_real(
678  ).back();
679 
680  if(angmom)
681  *angmom = planet->zone().get_evolution_real(
683  ).back();
684 }
685 
689  double *semimajor,
690  double *eccentricity)
691 {
692  const Evolve::DiskBinarySystem *system =
693  reinterpret_cast<const Evolve::DiskBinarySystem*>(system_arg);
694 
695  if(semimajor)
696  *semimajor = system->semimajor_evolution().back();
697 
698  if(eccentricity)
699  *eccentricity = system->eccentricity_evolution().back();
700 }
701 
704 void get_solver_final_state(const OrbitSolver *solver_arg,
705  double *age,
706  int *evolution_mode)
707 {
708  const Evolve::OrbitSolver *solver =
709  reinterpret_cast<const Evolve::OrbitSolver*>(solver_arg);
710 
711  if(age)
712  *age = solver->evolution_ages().back();
713 
714  if(evolution_mode)
715  *evolution_mode = solver->mode_evolution().back();
716 }
717 
719  const DiskBinarySystem *system,
720  const EvolvingStar *star,
721  const CPlanet *planet,
722  double *age,
723  double *semimajor,
724  double *eccentricity,
725  double *envelope_inclination,
726  double *core_inclination,
727  double *envelope_periapsis,
728  double *core_periapsis,
729  double *envelope_angmom,
730  double *core_angmom,
731  double *planet_inclination,
732  double *planet_periapsis,
733  double *planet_angmom,
734  int *evolution_mode,
735  bool *wind_saturation)
736 {
737  get_solver_final_state(solver, age, evolution_mode);
738 
739  get_binary_final_state(system, semimajor, eccentricity);
740 
742  envelope_inclination,
743  core_inclination,
744  envelope_periapsis,
745  core_periapsis,
746  envelope_angmom,
747  core_angmom,
748  wind_saturation);
749 
750  get_planet_final_state(planet,
751  planet_inclination,
752  planet_periapsis,
753  planet_angmom);
754 }
755 
757  const DiskBinarySystem *system,
758  const EvolvingStar *primary,
759  const EvolvingStar *secondary,
760  double *age,
761  double *semimajor,
762  double *eccentricity,
763 
764  double *primary_envelope_inclination,
765  double *primary_core_inclination,
766  double *primary_envelope_periapsis,
767  double *primary_core_periapsis,
768  double *primary_envelope_angmom,
769  double *primary_core_angmom,
770 
771  double *secondary_envelope_inclination,
772  double *secondary_core_inclination,
773  double *secondary_envelope_periapsis,
774  double *secondary_core_periapsis,
775  double *secondary_envelope_angmom,
776  double *secondary_core_angmom,
777  int *evolution_mode,
778  bool *primary_wind_saturation,
779  bool *secondary_wind_saturation)
780 {
781  get_solver_final_state(solver, age, evolution_mode);
782 
783  get_binary_final_state(system, semimajor, eccentricity);
784 
785  get_star_final_state(primary,
786  primary_envelope_inclination,
787  primary_core_inclination,
788  primary_envelope_periapsis,
789  primary_core_periapsis,
790  primary_envelope_angmom,
791  primary_core_angmom,
792  primary_wind_saturation);
793 
794  get_star_final_state(secondary,
795  secondary_envelope_inclination,
796  secondary_core_inclination,
797  secondary_envelope_periapsis,
798  secondary_core_periapsis,
799  secondary_envelope_angmom,
800  secondary_core_angmom,
801  secondary_wind_saturation);
802 }
803 
804 double get_expansion_coeff_precision(int m, int s)
805 {
808  m,
809  s
810  );
811 }
812 
814  int s,
815  double e,
816  bool deriv)
817 {
819  m,
820  s,
821  e,
822  deriv
823  );
824 }
825 
826 void destroy_expansion_coef(
827  const EccentricityExpansionCoefficients *expansion_arg
828 )
829 {
830  delete reinterpret_cast<const Evolve::EccentricityExpansionCoefficients*>(
831  expansion_arg
832  );
833 }
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:661
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:76
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, unsigned max_time_steps)
Calculate the evolution of a previously configured binary system.
Definition: CInterface.cpp:227
double evaluate_expansion_coeff(int m, int s, double e, bool deriv)
doc
Definition: CInterface.cpp:813
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:423
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:613
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:688
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:205
struct LIB_PUBLIC BrokenPowerlawPhaseLagZone
Opaque struct to cast 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:349
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:146
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:178
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
static void prepare(const std::string &tabulated_pms_fname, double precision, bool pre_load, bool disable_precision_fail)
See EccentricityExpansionCoefficients::prepare()
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:266
Periapsis of the zone.
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:718
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
static const EccentricityExpansionCoefficients & expansion_coefficient_evaluator()
Provide direct access to the eccentircity expansion coefficients.
void prepare_eccentricity_expansion(const char *filename, double precision, bool pre_load, bool disable_precision_fail)
Read eccentricity expansion coefficients from a file.
Definition: CInterface.cpp:17
struct LIB_PUBLIC EccentricityExpansionCoefficients
Opaque struct to cast to/from Evolve::EccentricityExpansionCoefficients.
Definition: CInterface.h:44
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:390
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:281
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:100
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
double interp_precision(int m, int s) const
The guaranteed interpolation precision for a given .
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:486
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:408
double get_expansion_coeff_precision(int m, int s)
doc
Definition: CInterface.cpp:804
Angular momentum of the zone.
void destroy_solver(OrbitSolver *solver)
Destroy a solver created by evolve_system.
Definition: CInterface.cpp:261
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:756
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:151
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.
DiskBinarySystem * create_planet_planet_system(CPlanet *primary, CPlanet *secondary, double initial_semimajor, double initial_eccentricity, double initial_inclination, double disk_lock_frequency, double disk_dissipation_age)
Create a binary system out of two planets.
Definition: CInterface.cpp:124
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:704
A class which reads-in and provides a convenient interface to the coefficients.
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:30
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
void get_planet_planet_evolution(const OrbitSolver *solver, const DiskBinarySystem *system, const CPlanet *primary, const CPlanet *secondary, double *age, double *semimajor, double *eccentricity, double *primary_inclination, double *primary_periapsis, double *primary_angmom, double *secondary_inclination, double *secondary_periapsis, double *secondary_angmom, int *evolution_mode, double *semimajor_rate, double *eccentricity_rate, double *primary_inclination_rate, double *primary_periapsis_rate, double *primary_angmom_rate, double *secondary_inclination_rate, double *secondary_periapsis_rate, double *secondary_angmom_rate)
Fill C-style arrays with the calculated evolution of a planet-planet system.
Definition: CInterface.cpp:562
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...