Aether  0.0
Ionosphere-Thermosphere model
planets.h
1 // Copyright 2020, the Aether Development Team (see doc/dev_team.md for members)
2 // Full license can be found in License.md
3 
4 #ifndef AETHER_INCLUDE_PLANETS_H_
5 #define AETHER_INCLUDE_PLANETS_H_
6 
7 /**************************************************************
8  * A class for keeping track of all of the planetary characteristics
9  *
10  *
11  **************************************************************/
12 
13 #include <string>
14 #include <vector>
15 
16 class Planets {
17 
18 // -----------------------------------------------------------------------
19 // Public functions and variables
20 // -----------------------------------------------------------------------
21 
22 public:
23 
24  // --------------------------------------------------------------------
25  // Functions:
26 
27  /**********************************************************************
28  \brief Initialize the Planet class
29  \param args info about how user has configured things
30  \param report allow reporting to occur
31  **/
32  Planets(Inputs args, Report report);
33 
34  /**********************************************************************
35  \brief Returns the distance from the star to the planet being modeled
36  \param time needed for getting the current time in different formats
37  **/
38  precision_t get_star_to_planet_dist(Times time);
39 
40  /**********************************************************************
41  \brief Returns the orbit angle of the planet around the star
42  \param time needed for getting the current time in different formats
43  **/
44  precision_t get_orbit_angle(Times time);
45 
46  /**********************************************************************
47  \brief Returns the declination angle of the planet (zero = equinox)
48  \param time needed for getting the current time in different formats
49  \param
50  **/
51  precision_t get_declination(Times time);
52 
53  /**********************************************************************
54  \brief Gets mu, which is planet mass times gravitational constant
55  **/
56  precision_t get_mu();
57 
58  /**********************************************************************
59  \brief Returns radius of the planet, which can be a function of latitude
60 
61  currently, this ignores the latitude, but should be implemented.
62 
63  \param latitude the latitude to get the radius at.
64  **/
65  precision_t get_radius(precision_t latitude);
66 
67  /**********************************************************************
68  \brief Returns the longitude offset to convert from longitude to local time
69 
70  this function returns a value that when added to the longitude (in
71  radians) will provide the local time (in radians)
72 
73  \param time needed for getting the current time in different formats
74  **/
75  precision_t get_longitude_offset(Times time);
76 
77  /**********************************************************************
78  \brief Returns the sin of the planet's declination angle
79  \param time needed for getting the current time in different formats
80  **/
81  precision_t get_sin_dec(Times time);
82 
83  /**********************************************************************
84  \brief Returns the cos of the planet's declination angle
85  \param time needed for getting the current time in different formats
86  **/
87  precision_t get_cos_dec(Times time);
88 
89  /**********************************************************************
90  \brief Returns the location of the center of the dipole (in meters)
91  **/
92  std::vector<float> get_dipole_center();
93 
94  /**********************************************************************
95  \brief Returns the rotation angle of the dipole in longitude (radians)
96  **/
97  precision_t get_dipole_rotation();
98 
99  /**********************************************************************
100  \brief Returns the tilt angle of the dipole (co-latitude) (radians)
101  **/
102  precision_t get_dipole_tilt();
103 
104  /**********************************************************************
105  \brief Returns the strength of the dipole at the surface (in nT)
106  **/
107  precision_t get_dipole_strength();
108 
109 // -----------------------------------------------------------------------
110 // Private functions and variables
111 // -----------------------------------------------------------------------
112 
113  private:
114 
118  struct planet_chars {
119 
120  // ---------------------------------------
121  // These are set by an input file:
122 
124  std::string name;
125 
127  precision_t semimajoraxis;
129  precision_t eccentricity;
131  precision_t inclination;
133  precision_t meanlongitude;
135  precision_t perihelionlongitude;
137  precision_t nodelongitude;
138 
140  precision_t rates_semimajoraxis;
142  precision_t rates_eccentricity;
144  precision_t rates_inclination;
146  precision_t rates_meanlongitude;
148  precision_t rates_perihelionlongitude;
150  precision_t rates_nodelongitude;
151 
153  precision_t planet_tilt;
154 
157  precision_t rotation_period;
159  precision_t omega;
161  precision_t length_of_day;
162 
164  double length_of_year;
166  precision_t longitude_jb2000;
167 
169  precision_t mass;
171  precision_t mu;
173  precision_t equator_radius;
175  precision_t polar_radius;
177  precision_t radius;
178 
180  precision_t dipole_strength;
182  precision_t dipole_rotation;
184  precision_t dipole_tilt;
186  std::vector<float> dipole_center{ 0.0, 0.0, 0.0 };
187 
188  // ---------------------------------------
189  // These are updated during the run:
190 
192  precision_t declination, sin_dec, cos_dec;
194  precision_t longitude_offset;
195 
197  precision_t star_planet_distance;
199  precision_t orbit_angle;
201  precision_t ls;
202 
204  double update_time;
205 
206  };
207 
209  std::vector<planet_chars> planets;
210 
212  planet_chars planet;
213 
214  // --------------------------------------------------------------------
215  // Functions:
216 
217  /**********************************************************************
218  \brief Sets the planetary characterists for the chosen planet
219 
220  This function just copies over the chosen planet's characteristics
221  from the vector into the stand-alone structure.
222 
223  \param input info about how user has configured things
224  \param report allow reporting to occur
225  **/
226  int set_planet(Inputs args, Report report);
227 
228  /**********************************************************************
229  \brief Updates the planetary characteristics that depend on time
230 
231  time is needed in a variety of formats, since many of the
232  calculations require different time formats.
233 
234  \param time needed for getting the current time in different formats
235  **/
236  int update(Times time);
237 
238  /**********************************************************************
239  \brief Reads in the planetary characteristics and stores them
240  \param args info about how user has configured things
241  \param report allow reporting to occur
242  **/
243  int read_file(Inputs args, Report report);
244 };
245 
246 #endif // INCLUDE_PLANETS_H_
Planets
Definition: planets.h:16
Inputs
Definition: inputs.h:10
Report
Definition: report.h:28
Times
Definition: times.h:21