@@ -110,10 +110,12 @@ void Ions::calc_electron_temperature(Neutrals neutrals, Grid grid, Times time) {
110
110
Qvib_N2 = Qenc_inelastic[5 ];
111
111
}
112
112
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
+ }
117
119
118
120
report.exit (function);
119
121
}
@@ -533,11 +535,43 @@ arma_mat Ions::calc_thermoelectric_current(Grid &grid){
533
535
static int iFunction = -1 ;
534
536
report.enter (function, iFunction);
535
537
536
- arma_cube JuTotal = ions. density_scgc * cE ;
538
+ std::vector < arma_cube> JTotal ;
537
539
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
+ }
539
571
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);}
542
574
543
- }
575
+ report.exit (function);
576
+ return JParallel;
577
+ }
0 commit comments