Skip to content

Commit b38bde0

Browse files
committed
FEAT: Improve how cet & init_ion temp check for required neutral species
1 parent 97409ac commit b38bde0

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

include/ions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@ class Ions {
175175
/// Heat Conduction (bulk):
176176
arma_cube lambda;
177177

178-
/// Electron temperature calculations need to know if some neutral species are present
179-
bool has_nO;
180-
bool has_nO2;
181-
bool has_nN2;
182-
183178
// Electrodynamics:
184179
/// Electric potential:
185180
arma_cube potential_scgc;

src/calc_electron_temperature.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ arma_cube calc_epsilon(Neutrals &neutrals, Ions &ions) {
160160
int64_t inO2 = neutrals.get_species_id("O2");
161161
int64_t inN2 = neutrals.get_species_id("N2");
162162
int64_t inO = neutrals.get_species_id("O");
163+
164+
if ((inO == -1) || (inN2 == -1) || (inO2 == -1)) {
165+
report.error("Could not find O, N2, or O2 in neutrals species list");
166+
}
163167

164168
arma_cube epsilon, x, logx;
165169

@@ -327,6 +331,10 @@ std::vector<arma_cube> calc_electron_neutral_collisions(Ions &ions, Neutrals &ne
327331
int64_t inN2 = neutrals.get_species_id("N2");
328332
int64_t inO = neutrals.get_species_id("O");
329333

334+
if ((inO == -1) || (inN2 == -1) || (inO2 == -1)) {
335+
report.error("Could not find O, N2, or O2 in neutrals species list");
336+
}
337+
330338
Qenc = ions.density_scgc * cME * 3.0 * cKB % (neutrals.temperature_scgc - ions.electron_temperature_scgc)
331339
% ((2.33e-11 * neutrals.species[inN2].density_scgc * 1.e-6
332340
% (1 - 1.21e-4 * ions.electron_temperature_scgc)

src/calc_ion_temperature.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,15 @@ void Ions::init_ion_temperature(Neutrals neutrals, Grid grid) {
2828
temperature_scgc = neutrals.temperature_scgc;
2929

3030
// For electron temperature, we need to check if some species are present or not.
31-
// Do this check now & set a bool or vector:
32-
bool has_nO = false;
33-
bool has_nO2 = false;
34-
bool has_nN2 = false;
35-
36-
if (neutrals.get_species_id("O") > -1)
37-
has_nO = true;
38-
if (neutrals.get_species_id("O2") > -1)
39-
has_nO2 = true;
40-
if (neutrals.get_species_id("N2") > -1)
41-
has_nN2 = true;
42-
if ((!has_nO && !has_nO2 && !has_nN2)
43-
&& (input.get_do_photoelectron_heating() || input.get_do_ionization_heating())) {
44-
report.error("Ion photoelectron & ionization heating require neutral O, O2, and N2 to be present.");
31+
// Do this check now & warn if needed:
32+
if ((neutrals.get_species_id("O") == -1)
33+
|| (neutrals.get_species_id("O2") == -1)
34+
||(neutrals.get_species_id("N2") == -1)){
35+
if (input.get_do_photoelectron_heating()
36+
|| input.get_do_ionization_heating()
37+
|| input.get_do_electron_neutral_collisional_heating()) {
38+
report.error("Your electron temperature sources require neutral O, O2, and N2 to be present.");
39+
}
4540
}
4641

4742
return;

0 commit comments

Comments
 (0)