Aether  0.0
Ionosphere-Thermosphere model
chemistry.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_CHEMISTRY_H_
5 #define INCLUDE_CHEMISTRY_H_
6 
7 #include <vector>
8 #include <string>
9 
10 class Chemistry {
11 
12  public:
13 
14  struct reaction_type {
15  // Reactions:
16  // loss1 + loss2 + loss3 -> source1 + source2 + source3
17  std::vector<std::string> sources_names;
18  std::vector<std::string> losses_names;
19 
20  std::vector<int> sources_ids;
21  std::vector<bool> sources_IsNeutral;
22 
23  std::vector<int> losses_ids;
24  std::vector<bool> losses_IsNeutral;
25 
26  int nSources;
27  int nLosses;
28 
29  precision_t energy;
30  precision_t rate;
31  precision_t branching_ratio;
32  };
33 
34  std::vector<reaction_type> reactions;
35  int64_t nReactions;
36 
37  Chemistry(Neutrals neutrals,
38  Ions ions,
39  Inputs args,
40  Report &report);
41 
42  void calc_chemistry(Neutrals &neutrals,
43  Ions &ions,
44  Times time,
45  Grid grid,
46  Report &report);
47 
48  void calc_chemical_sources(Neutrals &neutrals,
49  Ions &ions,
50  Report &report);
51 
52  private:
53 
54  struct sources_and_losses_type {
55 
56  precision_t neutral_sources[nSpecies];
57  precision_t neutral_losses[nSpecies];
58  precision_t ion_sources[nIons];
59  precision_t ion_losses[nIons];
60 
61  precision_t heat_neutrals;
62  precision_t heat_ions;
63  precision_t heat_electrons;
64  };
65 
66  sources_and_losses_type sources_and_losses;
67 
68  int read_chemistry_file(Neutrals neutrals,
69  Ions ions,
70  Inputs args,
71  Report &report);
72 
73  reaction_type interpret_reaction_line(Neutrals neutrals,
74  Ions ions,
75  std::vector<std::string> line,
76  Report &report);
77 
78  void find_species_id(std::string name,
79  Neutrals neutrals,
80  Ions ions,
81  int &id_,
82  bool &IsNeutral,
83  Report &report);
84 
85  void display_reaction(reaction_type reaction);
86 };
87 
88 #endif // INCLUDE_CHEMISTRY_H_
Chemistry
Definition: chemistry.h:10
Chemistry::reaction_type
Definition: chemistry.h:14
Inputs
Definition: inputs.h:10
Report
Definition: report.h:28
Ions
Definition: ions.h:10
Times
Definition: times.h:21
Grid
Definition: arm_vars.h:11
Neutrals
Definition: neutrals.h:26