8 #define BUILDING_LIBRARY 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)
35 std::cerr <<
"Defining zone dissipation" << std::endl;
38 num_tidal_frequency_breaks
39 ? std::vector<double>(
40 tidal_frequency_breaks,
41 tidal_frequency_breaks + num_tidal_frequency_breaks
43 : std::vector<double>()
46 num_spin_frequency_breaks
47 ? std::vector<double>(
48 spin_frequency_breaks,
49 spin_frequency_breaks + num_spin_frequency_breaks
51 : std::vector<double>()
54 tidal_frequency_powers,
55 tidal_frequency_powers + num_tidal_frequency_breaks + 1
58 spin_frequency_powers,
59 spin_frequency_powers + num_spin_frequency_breaks + 1
62 inertial_mode_enhancement,
63 inertial_mode_sharpness
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)
79 *reinterpret_cast<Star::InterpolatedEvolutionStar*>(star),
80 *reinterpret_cast<Planet::Planet*>(planet),
86 std::max(secondary_formation_age,
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)
103 *reinterpret_cast<Star::InterpolatedEvolutionStar*>(primary),
104 *reinterpret_cast<Star::InterpolatedEvolutionStar*>(secondary),
106 initial_eccentricity,
109 disk_dissipation_age,
110 std::max(secondary_formation_age,
111 disk_dissipation_age)
123 double companion_mass,
126 const double *spin_angmom,
127 const double *inclination,
128 const double *periapsis,
130 bool zero_outer_inclination,
131 bool zero_outer_periapsis)
143 zero_outer_inclination,
150 double companion_mass,
153 const double *spin_angmom,
154 const double *inclination,
155 const double *periapsis,
157 bool zero_outer_inclination,
158 bool zero_outer_periapsis)
170 zero_outer_inclination,
179 const double *spin_angmom,
180 const double *inclination,
181 const double *periapsis,
193 static_cast<Core::EvolModeType>(evolution_mode)
199 double max_time_step,
201 double *required_ages,
202 unsigned num_required_ages,
206 std::cerr.setf(std::ios_base::scientific);
207 std::cerr.precision(16);
217 std::list<double>(required_ages,
218 required_ages + num_required_ages),
222 }
catch(std::exception)
238 )->evolution_ages().size();
242 inline void list_to_array(
const std::list<T> &source, T *destination)
245 std::copy(source.begin(), source.end(), destination);
250 double *envelope_inclination,
251 double *core_inclination,
252 double *envelope_periapsis,
253 double *core_periapsis,
254 double *envelope_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)
268 envelope_inclination);
291 envelope_inclination_rate
296 core_inclination_rate
300 envelope_periapsis_rate);
303 core_periapsis_rate);
321 double *inclination_rate,
322 double *periapsis_rate,
360 double *eccentricity,
361 double *semimajor_rate,
362 double *eccentricity_rate)
394 const CPlanet *planet,
397 double *eccentricity,
398 double *envelope_inclination,
399 double *core_inclination,
400 double *envelope_periapsis,
401 double *core_periapsis,
402 double *envelope_angmom,
404 double *planet_inclination,
405 double *planet_periapsis,
406 double *planet_angmom,
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)
431 envelope_inclination,
438 envelope_inclination_rate,
439 core_inclination_rate,
440 envelope_periapsis_rate,
442 envelope_angmom_rate,
449 planet_inclination_rate,
450 planet_periapsis_rate,
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,
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)
500 primary_envelope_inclination,
501 primary_core_inclination,
502 primary_envelope_periapsis,
503 primary_core_periapsis,
504 primary_envelope_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);
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);
533 double *envelope_inclination,
534 double *core_inclination,
535 double *envelope_periapsis,
536 double *core_periapsis,
537 double *envelope_angmom,
539 bool *wind_saturation)
544 if(envelope_inclination)
545 *envelope_inclination = (
554 if(envelope_periapsis)
609 double *eccentricity)
640 const CPlanet *planet,
643 double *eccentricity,
644 double *envelope_inclination,
645 double *core_inclination,
646 double *envelope_periapsis,
647 double *core_periapsis,
648 double *envelope_angmom,
650 double *planet_inclination,
651 double *planet_periapsis,
652 double *planet_angmom,
654 bool *wind_saturation)
661 envelope_inclination,
681 double *eccentricity,
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,
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,
697 bool *primary_wind_saturation,
698 bool *secondary_wind_saturation)
705 primary_envelope_inclination,
706 primary_core_inclination,
707 primary_envelope_periapsis,
708 primary_core_periapsis,
709 primary_envelope_angmom,
711 primary_wind_saturation);
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);
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.
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 cant 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.
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.
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.
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)...
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.
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.
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.
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. ...
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.
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...
void read_eccentricity_expansion_coefficients(const char *filename)
Read eccentricity expansion coefficients from a file.
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...
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...