Aether  0.0
Ionosphere-Thermosphere model
neutrals.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 INCLUDE_NEUTRALS_H_
5 #define INCLUDE_NEUTRALS_H_
6 
7 /**************************************************************
8  * \class Neutrals
9  *
10  * \brief Defines the neutral states
11  *
12  * The Neutrals class defines the neutrals states as well as a bunch
13  * of derived states and source/loss terms. The initial temperature
14  * structure as well as the lower boundary densities can be set
15  * through the planet input file.
16  *
17  * \author Aaron Ridley
18  *
19  * \date 2021/03/28
20  *
21  **************************************************************/
22 
23 #include <string>
24 #include <vector>
25 
26 class Neutrals {
27 
28  public:
29 
32 
33  struct species_chars {
34 
36  std::string cName;
37 
39  precision_t mass;
40 
42  precision_t vibe;
43 
45  int DoAdvect;
46 
48  arma_cube density_scgc;
49 
51  std::vector<float> diff0;
52  std::vector<float> diff_exp;
53 
55  std::vector<float> neutral_ion;
56 
58  precision_t thermal_cond;
59  precision_t thermal_exp;
60 
62  int iEuvAbsId_;
66  std::vector<int> iEuvIonId_;
68  std::vector<int> iEuvIonSpecies_;
69 
70  int nAuroraIonSpecies;
71  std::vector<int> iAuroraIonSpecies_;
72  float Aurora_Coef;
73 
74  // --------------------------------------------------
75  // Some derived quantities:
76  arma_cube rho_alt_int_scgc;
77 
79  arma_cube chapman_scgc;
80 
82  arma_cube scale_height_scgc;
83 
84  // --------------------------------------------------
85  // Sources and Losses:
86 
88  arma_cube ionization_scgc;
89 
91  arma_cube sources_scgc;
92 
94  arma_cube losses_scgc;
95 
97  precision_t lower_bc_density;
98  };
99 
100  // bulk quantities (states):
101 
103  arma_cube density_scgc;
104 
106  std::vector<arma_cube> velocity_vcgc;
107 
109  arma_cube temperature_scgc;
110 
112  arma_cube rho_scgc;
113 
115  arma_cube mean_major_mass_scgc;
116 
118  arma_cube pressure_scgc;
119 
121  arma_cube sound_scgc;
122 
124  arma_cube Cv_scgc;
125 
127  arma_cube gamma_scgc;
128 
130  arma_cube kappa_scgc;
131 
133  std::vector<species_chars> species;
134 
136  precision_t max_chapman = 1.0e26;
137 
138  // Source terms:
139 
141  arma_cube conduction_scgc;
142 
144  arma_cube heating_euv_scgc;
145 
147  precision_t heating_efficiency;
148 
150  float *initial_temperatures, *initial_altitudes;
151  int nInitial_temps = 0;
152 
153  // names and units
154  std::string density_name = "Neutral Bulk Density";
155  std::string density_unit = "(/m3)";
156 
157  std::vector<std::string> velocity_name;
158  std::string velocity_unit = "(m/s)";
159 
160  std::string temperature_name = "Temperature";
161  std::string temperature_unit = "(K)";
162 
163  // --------------------------------------------------------------------
164  // Functions:
165 
166  /**********************************************************************
167  \brief Initialize the neutrals
168  \param grid The grid to define the neutrals on
169  \param input info about how user has configured things
170  \param report allow reporting to occur
171  **/
172  Neutrals(Grid grid, Inputs input, Report report);
173 
174  /**********************************************************************
175  \brief Creates the variables within the species_chars structure
176  \param grid The grid to define the neutrals on
177  \param input info about how user has configured things
178  \param report allow reporting to occur
179  **/
180  species_chars create_species(Grid grid);
181 
182  /**********************************************************************
183  \brief Read in the planet-specific file
184 
185  This file specifies the species to model, their masses,
186  diffusion coefficients and all of the other things needed
187  for specifying the neutrals.
188 
189  \param input info about how user has configured things
190  \param report allow reporting to occur
191  **/
192  int read_planet_file(Inputs input, Report report);
193 
194  /**********************************************************************
195  \brief Sets the initial conditions of the neutrals
196  \param grid The grid to define the neutrals on
197  \param input info about how user has configured things
198  \param report allow reporting to occur
199  **/
200  int initial_conditions(Grid grid, Inputs input, Report report);
201 
202  /**********************************************************************
203  \brief temporary function to set neutral densities with in the model
204 
205  This function integrates the species densities from the bottom
206  of the model using a hydrostatic approximation and the bulk
207  temperature. It is temporary until we get a vertical solver.
208 
209  \param grid The grid to define the neutrals on
210  \param report allow reporting to occur
211  **/
212  void fill_with_hydrostatic(Grid grid, Report report);
213 
214  /**********************************************************************
215  \brief Calculate the bulk mass density from individual species densities
216  \param report allow reporting to occur
217  **/
218  void calc_mass_density(Report &report);
219 
220  /**********************************************************************
221  \brief Calculate the bulk specific heat from individual species
222  \param report allow reporting to occur
223  **/
224  void calc_specific_heat(Report &report);
225 
226  /**********************************************************************
227  \brief Calculate the chapman integrals for the individual species
228  \param grid The grid to define the neutrals on
229  \param report allow reporting to occur
230  **/
231  void calc_chapman(Grid grid, Report &report);
232 
233  /**********************************************************************
234  \brief Calculate the neutral bulk vertical thermal conduction
235  \param grid The grid to define the neutrals on
236  \param time The times within the model (dt is needed)
237  \param report allow reporting to occur
238  **/
239  void calc_conduction(Grid grid, Times time, Report &report);
240 
241  /**********************************************************************
242  \brief Add all of the neutral source terms to each of the equations
243  \param time The times within the model (dt is needed)
244  \param report allow reporting to occur
245  **/
246  void add_sources(Times time, Report &report);
247 
248  /**********************************************************************
249  \brief Set boundary conditions for the neutrals
250  \param report allow reporting to occur
251  **/
252  void set_bcs(Report &report);
253  int get_species_id(std::string name, Report &report);
254 };
255 
256 #endif // INCLUDE_NEUTRALS_H_
257 
Neutrals::species_chars::diff0
std::vector< float > diff0
Diffusion through other neutral species:
Definition: neutrals.h:79
Neutrals::initial_temperatures
float * initial_temperatures
Initial temperature profile, read in through the planet.in file:
Definition: neutrals.h:164
Neutrals::species_chars::ionization_scgc
arma_cube ionization_scgc
How much of this species is lost to ionization (/m3/s)
Definition: neutrals.h:116
Neutrals::Cv_scgc
arma_cube Cv_scgc
Specific heat (constant volume):
Definition: neutrals.h:138
Neutrals::species_chars::lower_bc_density
precision_t lower_bc_density
If we want a fixed lower BC:
Definition: neutrals.h:125
Neutrals::species_chars::sources_scgc
arma_cube sources_scgc
Chemistry source rate (/m3/s)
Definition: neutrals.h:119
Neutrals::heating_efficiency
precision_t heating_efficiency
Nuetral gas direct absorption heating efficiency (~5%)
Definition: neutrals.h:161
Neutrals::max_chapman
precision_t max_chapman
Maximum Chapman integral (will give nearly infinite tau in EUV)
Definition: neutrals.h:150
Neutrals::velocity_vcgc
std::vector< arma_cube > velocity_vcgc
bulk velocity (m/s)
Definition: neutrals.h:120
Neutrals::species_chars::vibe
precision_t vibe
Vibrations of species (for calculation specific heat)
Definition: neutrals.h:70
Neutrals::gamma_scgc
arma_cube gamma_scgc
Bulk Gamma:
Definition: neutrals.h:141
Neutrals::species_chars::iEuvAbsId_
int iEuvAbsId_
Which row in the EUV CSV file is for absorption:
Definition: neutrals.h:90
Inputs
Definition: inputs.h:10
Report
Definition: report.h:28
Neutrals::heating_euv_scgc
arma_cube heating_euv_scgc
Bulk neutral EUV heating temperatuare change (K/s)
Definition: neutrals.h:158
Neutrals::rho_scgc
arma_cube rho_scgc
bulk mass density (kg/m3)
Definition: neutrals.h:126
Neutrals::pressure_scgc
arma_cube pressure_scgc
mean pressure (Pa)
Definition: neutrals.h:132
Neutrals::species
std::vector< species_chars > species
Vector of all species-specific items:
Definition: neutrals.h:147
Neutrals::sound_scgc
arma_cube sound_scgc
speed of sound (m/s)
Definition: neutrals.h:135
Neutrals::species_chars::neutral_ion
std::vector< float > neutral_ion
Neutral - Ion collision frequency coefficients.
Definition: neutrals.h:83
Neutrals::temperature_scgc
arma_cube temperature_scgc
bunk temperature (K)
Definition: neutrals.h:123
Neutrals::species_chars::density_scgc
arma_cube density_scgc
Number density of species (/m3)
Definition: neutrals.h:76
Neutrals::kappa_scgc
arma_cube kappa_scgc
Bulk thermal heat conduction:
Definition: neutrals.h:144
Neutrals::species_chars::cName
std::string cName
Name of the species.
Definition: neutrals.h:64
Times
Definition: times.h:21
Neutrals::conduction_scgc
arma_cube conduction_scgc
Bulk neutral thermal conduction temperature change rate (K/s)
Definition: neutrals.h:155
Neutrals::species_chars::iEuvIonSpecies_
std::vector< int > iEuvIonSpecies_
Which ion species results from the ionization?
Definition: neutrals.h:96
Grid
Definition: arm_vars.h:11
Neutrals::species_chars::chapman_scgc
arma_cube chapman_scgc
Chapman Integrals for the species for EUV calculation (/m2)
Definition: neutrals.h:107
Neutrals::species_chars::thermal_cond
precision_t thermal_cond
Thermal conduction coefficients:
Definition: neutrals.h:86
Neutrals::species_chars::mass
precision_t mass
Mass of the species (kg)
Definition: neutrals.h:67
Neutrals::species_chars::scale_height_scgc
arma_cube scale_height_scgc
Scale height for the species (m)
Definition: neutrals.h:110
Neutrals::density_scgc
arma_cube density_scgc
bulk number density (/m3)
Definition: neutrals.h:117
Neutrals::species_chars
Definition: neutrals.h:47
Neutrals::species_chars::losses_scgc
arma_cube losses_scgc
Chemistry loss rate (/m3/s)
Definition: neutrals.h:122
Neutrals::species_chars::DoAdvect
int DoAdvect
Advect this species? (1 = yes, 0 = no)
Definition: neutrals.h:73
Neutrals::mean_major_mass_scgc
arma_cube mean_major_mass_scgc
mean major mass (kg)
Definition: neutrals.h:129
Neutrals
Definition: neutrals.h:26
Neutrals::species_chars::iEuvIonId_
std::vector< int > iEuvIonId_
Which row in the EUV CSV file if for the particular ionization?
Definition: neutrals.h:94
Neutrals::species_chars::nEuvIonSpecies
int nEuvIonSpecies
How many rows in the EUV CSV file are for ionization of this species?
Definition: neutrals.h:92