Skip to content

Commit b11292d

Browse files
committed
FEAT: Actually calculate new e- temp
1 parent 1222e4f commit b11292d

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

src/calc_electron_temperature.cpp

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,62 @@ void Ions::calc_electron_temperature(Neutrals neutrals, Grid grid, Times time) {
117117
JParallel = calc_thermoelectric_current(grid);
118118
}
119119

120+
report.print(4, "Calculating electron temperature");
121+
122+
arma_cube sources = Qphe + Qencm + Qeicm + Qrotm + Qf + Qexc + Qvib_O2 + Qvib_N2
123+
+ QIonization + Qenc_v + Qeic_v;
124+
arma_cube sources_temp_dependent = Qencp + Qeicp + Qrotp;
125+
126+
127+
// ============= CALCULATE TEMPERATURE =================
128+
arma_vec temp1d(nAlts);
129+
arma_vec lambda1d(nAlts);
130+
arma_vec front1d(nAlts);
131+
arma_vec dalt1d(nAlts);
132+
arma_vec conduction1d(nAlts);
133+
arma_vec sources1d(nAlts);
134+
arma_vec sources_tempdep_1d(nAlts);
135+
arma_vec ratios(nAlts);
136+
arma_vec density_ratio(nAlts);
137+
138+
// Get the time step size
139+
precision_t dt = time.get_dt();
140+
141+
142+
for (int64_t iLon = nGCs; iLon < nLons - nGCs; iLon++) {
143+
for (int64_t iLat = nGCs; iLat < nLats - nGCs; iLat++) {
144+
temp1d = electron_temperature_scgc.tube(iLon, iLat);
145+
temp1d(0) = neutrals.temperature_scgc(iLon, iLat, 0);
146+
temp1d(1) = neutrals.temperature_scgc(iLon, iLat, 1);
147+
lambda1d = lambda.tube(iLon, iLat);
148+
lambda1d(1) = lambda1d(2);
149+
lambda1d(0) = lambda1d(2);
150+
front1d = 3.0 / 2.0 * cKB * species[nSpecies].density_scgc.tube(iLon, iLat);
151+
dalt1d = grid.dalt_lower_scgc.tube(iLon, iLat);
152+
sources1d = sources.tube(iLon, iLat);
153+
sources1d = sources1d / front1d;
154+
155+
sources_tempdep_1d = sources_temp_dependent.tube(iLon, iLat);
156+
sources_tempdep_1d = sources_tempdep_1d / front1d;
157+
158+
conduction1d.zeros(); // reset temp variable to zero
159+
conduction1d = solver_conduction(temp1d,
160+
lambda1d,
161+
front1d,
162+
sources1d,
163+
dalt1d,
164+
dt / 10.,
165+
nGCs,
166+
false,
167+
sources_tempdep_1d);
168+
169+
// The conduction solver gives Tnew-Told, so divide by dt
170+
conduction1d.clamp(200, 6000);
171+
electron_temperature_scgc.tube(iLon, iLat) = conduction1d;
172+
}}
173+
174+
// electron_temperature_scgc = neutrals.temperature_scgc;
175+
120176
report.exit(function);
121177
}
122178

src/solver_conduction.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// - At this point, the bottom BC is fixed, while the top BC is zero gradient
1717
// - The dx variable is assumed to be distance between the CURRENT cell center
1818
// (i) and the cell center of the cell BELOW the current one (i-1).
19+
//
20+
// The last two arguments are optional, with default values set in the func declaration.
1921
// -----------------------------------------------------------------------
2022

2123
arma_vec solver_conduction(arma_vec value,

0 commit comments

Comments
 (0)