8 #define BUILDING_LIBRARY 20 bool disable_precision_fail)
26 disable_precision_fail
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)
43 std::cerr <<
"Defining zone dissipation" << std::endl;
46 num_tidal_frequency_breaks
47 ? std::vector<double>(
48 tidal_frequency_breaks,
49 tidal_frequency_breaks + num_tidal_frequency_breaks
51 : std::vector<double>()
54 num_spin_frequency_breaks
55 ? std::vector<double>(
56 spin_frequency_breaks,
57 spin_frequency_breaks + num_spin_frequency_breaks
59 : std::vector<double>()
62 tidal_frequency_powers,
63 tidal_frequency_powers + num_tidal_frequency_breaks + 1
66 spin_frequency_powers,
67 spin_frequency_powers + num_spin_frequency_breaks + 1
70 inertial_mode_enhancement,
71 inertial_mode_sharpness
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)
87 *reinterpret_cast<Star::InterpolatedEvolutionStar*>(star),
88 *reinterpret_cast<Planet::Planet*>(planet),
94 std::max(secondary_formation_age,
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)
111 *reinterpret_cast<Star::InterpolatedEvolutionStar*>(primary),
112 *reinterpret_cast<Star::InterpolatedEvolutionStar*>(secondary),
114 initial_eccentricity,
117 disk_dissipation_age,
118 std::max(secondary_formation_age,
119 disk_dissipation_age)
126 double initial_semimajor,
127 double initial_eccentricity,
128 double initial_inclination,
129 double disk_lock_frequency,
130 double disk_dissipation_age)
134 *reinterpret_cast<Planet::Planet*>(primary),
135 *reinterpret_cast<Planet::Planet*>(secondary),
137 initial_eccentricity,
140 disk_dissipation_age,
153 double companion_mass,
156 const double *spin_angmom,
157 const double *inclination,
158 const double *periapsis,
160 bool zero_outer_inclination,
161 bool zero_outer_periapsis)
173 zero_outer_inclination,
180 double companion_mass,
183 const double *spin_angmom,
184 const double *inclination,
185 const double *periapsis,
187 bool zero_outer_inclination,
188 bool zero_outer_periapsis)
200 zero_outer_inclination,
209 const double *spin_angmom,
210 const double *inclination,
211 const double *periapsis,
223 static_cast<Core::EvolModeType>(evolution_mode)
229 double max_time_step,
231 double *required_ages,
232 unsigned num_required_ages,
235 unsigned max_time_steps)
237 std::cerr.setf(std::ios_base::scientific);
238 std::cerr.precision(16);
248 std::list<double>(required_ages,
249 required_ages + num_required_ages),
254 }
catch(std::exception)
270 )->evolution_ages().size();
274 inline void list_to_array(
const std::list<T> &source, T *destination)
277 std::copy(source.begin(), source.end(), destination);
282 double *envelope_inclination,
283 double *core_inclination,
284 double *envelope_periapsis,
285 double *core_periapsis,
286 double *envelope_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)
300 envelope_inclination);
323 envelope_inclination_rate
328 core_inclination_rate
332 envelope_periapsis_rate);
335 core_periapsis_rate);
353 double *inclination_rate,
354 double *periapsis_rate,
392 double *eccentricity,
393 double *semimajor_rate,
394 double *eccentricity_rate)
426 const CPlanet *planet,
429 double *eccentricity,
430 double *envelope_inclination,
431 double *core_inclination,
432 double *envelope_periapsis,
433 double *core_periapsis,
434 double *envelope_angmom,
436 double *planet_inclination,
437 double *planet_periapsis,
438 double *planet_angmom,
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)
463 envelope_inclination,
470 envelope_inclination_rate,
471 core_inclination_rate,
472 envelope_periapsis_rate,
474 envelope_angmom_rate,
481 planet_inclination_rate,
482 planet_periapsis_rate,
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,
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)
532 primary_envelope_inclination,
533 primary_core_inclination,
534 primary_envelope_periapsis,
535 primary_core_periapsis,
536 primary_envelope_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);
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);
564 const CPlanet *primary,
565 const CPlanet *secondary,
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,
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)
598 primary_inclination_rate,
599 primary_periapsis_rate,
600 primary_angmom_rate);
603 secondary_inclination,
606 secondary_inclination_rate,
607 secondary_periapsis_rate,
608 secondary_angmom_rate);
614 double *envelope_inclination,
615 double *core_inclination,
616 double *envelope_periapsis,
617 double *core_periapsis,
618 double *envelope_angmom,
620 bool *wind_saturation)
625 if(envelope_inclination)
626 *envelope_inclination = (
635 if(envelope_periapsis)
690 double *eccentricity)
721 const CPlanet *planet,
724 double *eccentricity,
725 double *envelope_inclination,
726 double *core_inclination,
727 double *envelope_periapsis,
728 double *core_periapsis,
729 double *envelope_angmom,
731 double *planet_inclination,
732 double *planet_periapsis,
733 double *planet_angmom,
735 bool *wind_saturation)
742 envelope_inclination,
762 double *eccentricity,
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,
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,
778 bool *primary_wind_saturation,
779 bool *secondary_wind_saturation)
786 primary_envelope_inclination,
787 primary_core_inclination,
788 primary_envelope_periapsis,
789 primary_core_periapsis,
790 primary_envelope_angmom,
792 primary_wind_saturation);
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);
826 void destroy_expansion_coef(
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.
const std::list< double > & eccentricity_evolution() const
The tabulated evolution of the eccentricity so far.
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.
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.
double evaluate_expansion_coeff(int m, int s, double e, bool deriv)
doc
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.
const std::list< Core::EvolModeType > & mode_evolution() const
The tabulated evolution modes so far.
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.
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.
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.
struct LIB_PUBLIC BrokenPowerlawPhaseLagZone
Opaque struct to cast to/from Evolve::BrokenPowerlawPhasLagZone.
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.
const int BINARY_EVOL_MODE
Evolution mode ID for when the two bodies orbit each other.
void destroy_binary(DiskBinarySystem *system)
Destroy a previously created binary system.
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.
Single zone non-evolving planets with huge dissipation, so they always remain locked to the disk...
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.
struct LIB_PUBLIC OrbitSolver
Opaque struct to cast to/from Evolve::OrbitSolver.
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.
struct LIB_PUBLIC DiskBinarySystem
Opaque struct to cast to/from Evolve::DiskBinarySystem.
unsigned num_evolution_steps(OrbitSolver *solver)
At how many points was the evolution saved.
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.
const int SINGLE_EVOL_MODE
Evolution mode ID for when there is only one body in the system (only its rotation evolves)...
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.
struct LIB_PUBLIC EccentricityExpansionCoefficients
Opaque struct to cast to/from Evolve::EccentricityExpansionCoefficients.
const double NaN
Not a number.
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...
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.
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.
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...
const EvolvingStellarEnvelope & envelope() const
The envelope of the star - inmodifiable.
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.
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. ...
double get_expansion_coeff_precision(int m, int s)
doc
Angular momentum of the zone.
void destroy_solver(OrbitSolver *solver)
Destroy a solver created by evolve_system.
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.
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.
Solves the system of ODEs describing the evolution of a single planet around a single star...
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.
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...
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)
const int TABULATION_EVOL_MODE
Evolution mode ID used as the mode to transform to from all other modes when storing the computed evo...
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.
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.
struct LIB_PUBLIC EvolvingStar
Opaque struct to cast to/from Star::InterpolatedEvolutionStar.
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...