Skip to content

Commit 1222e4f

Browse files
committed
FEAT: Add thermoelectric heating
(it's not working yet though)
1 parent 24b1375 commit 1222e4f

File tree

4 files changed

+66
-9
lines changed

4 files changed

+66
-9
lines changed

include/inputs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,12 @@ class Inputs {
466466
bool get_do_electron_neutral_inelastic_collisional_heating();
467467

468468

469+
/**********************************************************************
470+
\brief returns settings["Sources"]["Ions"]["IncludeThermoelectricHeating"]
471+
\param none
472+
**/
473+
bool get_do_thermoelectric_heating();
474+
469475
/**********************************************************************
470476
\brief returns settings["
471477
\param

include/ions.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,15 @@ class Ions {
409409
**/
410410
std::vector<arma_cube> calc_electron_neutral_inelastic_collisions(Neutrals &neutrals);
411411

412+
/**********************************************************************
413+
\brief Calculate the thermoelectric current (same at all altitudes)
414+
\details Use eq. 6 of https://doi.org/10.1016/j.jastp.2016.01.005
415+
- Since we do not know e- parallel velocity, the dipole needs to do it this way too.
416+
\param grid
417+
\return arma_mat JParaAlt
418+
**/
419+
arma_mat calc_thermoelectric_current(Grid &grid);
420+
412421
/**********************************************************************
413422
\brief Check all of the variables for nonfinites, such as nans
414423
\param none

src/calc_electron_temperature.cpp

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ void Ions::calc_electron_temperature(Neutrals neutrals, Grid grid, Times time) {
110110
Qvib_N2 = Qenc_inelastic[5];
111111
}
112112

113-
// Thermoelectric current
114-
115-
116-
electron_temperature_scgc = neutrals.temperature_scgc;
113+
if (input.get_do_thermoelectric_heating()) {
114+
report.print(4, "Calculating thermoelectric heating");
115+
report.error("Thermoelectric heating is not working yet.");
116+
// Get JPar (Thermoelectric current)
117+
JParallel = calc_thermoelectric_current(grid);
118+
}
117119

118120
report.exit(function);
119121
}
@@ -533,11 +535,43 @@ arma_mat Ions::calc_thermoelectric_current(Grid &grid){
533535
static int iFunction = -1;
534536
report.enter(function, iFunction);
535537

536-
arma_cube JuTotal = ions.density_scgc * cE;
538+
std::vector <arma_cube> JTotal;
537539

538-
report.exit(function);
540+
arma_mat JParallel;
541+
JParallel.set_size(density_scgc.n_rows, density_scgc.n_cols);
542+
JParallel.zeros();
543+
544+
// with the dipole, the field-aligned current is in the k^ direction
545+
// But we do not solve for e- velocity (and exb is 0 parallel to B), so we cannot do this:
546+
// if (grid.iGridShape_ == grid.iDipole_){
547+
// for (int64_t iAlt = 0; iAlt < ions.density_scgc.n_slices; iAlt++){
548+
// JParallel += (ions.density_scgc.slice(iAlt) * cE % (ions.velocity_vcgc[2].slice(iAlt) - ions.exb_vcgc[2].slice(iAlt)))
549+
// * grid.dalt_center_scgc[iAlt];
550+
// }
551+
// }
552+
553+
// else{
554+
// We need to solve for J_Parallel with Equation (6) of (Zhu et al., 2016)
555+
// http://dx.doi.org/10.1016/j.jastp.2016.01.005 - using \nabla \dot J
556+
JTotal.push_back(cE * density_scgc % (velocity_vcgc[0] - exb_vcgc[0]));
557+
JTotal.push_back(cE * density_scgc % (velocity_vcgc[1] - exb_vcgc[1]));
558+
JTotal.push_back(cE * density_scgc % (velocity_vcgc[2] - exb_vcgc[2]));
559+
560+
arma_cube JuTotalDotB = dot_product(JTotal, grid.bfield_vcgc);
561+
arma_cube divJperp;
562+
563+
divJperp.set_size(density_scgc.n_rows, density_scgc.n_cols, density_scgc.n_slices);
564+
divJperp.zeros();
565+
566+
for (int64_t iDir =0; iDir < 3; iDir ++){
567+
divJperp += calc_gradient_vector(JTotal[iDir], grid)[iDir];
568+
divJperp -= calc_gradient_vector(JuTotalDotB, grid)[iDir] % grid.bfield_unit_vcgc[iDir];
569+
divJperp -= calc_gradient_vector(JuTotalDotB, grid)[iDir] % JuTotalDotB;
570+
}
539571

540-
return JuTotal;
541-
572+
for (int64_t iAlt = 0; iAlt < density_scgc.n_slices; iAlt++){
573+
JParallel -= divJperp.slice(iAlt) % grid.dalt_center_scgc.slice(iAlt);}
542574

543-
}
575+
report.exit(function);
576+
return JParallel;
577+
}

src/inputs.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,14 @@ bool Inputs::get_do_electron_neutral_inelastic_collisional_heating() {
795795
return get_setting_bool("Sources", "Ions", "IncludeElectronNeutralInelasticCollisionalHeating");
796796
}
797797

798+
// -----------------------------------------------------------------------
799+
// Return whether to include heating from thermoelectric currents
800+
// -----------------------------------------------------------------------
801+
802+
bool Inputs::get_do_thermoelectric_heating() {
803+
return get_setting_bool("Sources", "Ions", "IncludeThermoelectricHeating");
804+
}
805+
798806
// -----------------------------------------------------------------------
799807
// Return centripetal acceleration
800808
// -----------------------------------------------------------------------

0 commit comments

Comments
 (0)