Skip to content

Commit

Permalink
FEAT: make ion heating symmetric with neutral heating
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjridley committed Nov 18, 2024
1 parent 60c15c9 commit 503819b
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions src/neutral_ion_collisions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void calc_ion_collisions(Neutrals &neutrals,
arma_cube vDiff(nX, nY, nZ);
// momentum so we can divide by the mass density later
std::vector<arma_cube> momentum;
momentum = make_cube_vector(nX, nY, nZ, 3);
momentum = make_cube_vector(nX, nY, nZ, 3);

beta.zeros();

Expand Down Expand Up @@ -67,14 +67,32 @@ void calc_ion_collisions(Neutrals &neutrals,
% vDiff;
}

// multiply by collision frequencies and convert
// energy change to temperature change:
// multiply by collision frequencies divide by two. The two is because we
// assumed that the ion and neutral masses (not rho) were the same above,
// and the bottom term has Mi + Mn and not just Mn.
neutrals.heating_ion_friction_scgc =
beta % neutrals.heating_ion_friction_scgc / (2 * neutrals.rho_scgc %
neutrals.Cv_scgc);
beta % neutrals.heating_ion_friction_scgc / 2;
neutrals.heating_ion_heat_transfer_scgc =
beta % neutrals.heating_ion_friction_scgc / (2 * neutrals.rho_scgc %
neutrals.Cv_scgc);
beta % neutrals.heating_ion_heat_transfer_scgc / 2;

// The ions get the same amount of energy:
ions.heating_neutral_friction_scgc = 100*neutrals.heating_ion_friction_scgc;
// Temperature difference is reversed (ions giving energy to neutrals):
ions.heating_neutral_heat_transfer_scgc = - neutrals.heating_ion_heat_transfer_scgc;

// convert energy change to temperature change:
neutrals.heating_ion_friction_scgc =
neutrals.heating_ion_friction_scgc / (neutrals.rho_scgc % neutrals.Cv_scgc);
neutrals.heating_ion_heat_transfer_scgc =
neutrals.heating_ion_heat_transfer_scgc / (neutrals.rho_scgc % neutrals.Cv_scgc);
std::cout << "ion heat : " << ions.heating_neutral_friction_scgc(2,2,25) << " "
<< ions.heating_neutral_heat_transfer_scgc(2,2,25) << " "
<< vDiff(2,2,25) << "\n";
//ions.heating_neutral_friction_scgc =
// ions.heating_neutral_friction_scgc / (ions.rho_scgc % ions.Cv_scgc);
//ions.heating_neutral_heat_transfer_scgc =
// ions.heating_neutral_heat_transfer_scgc / (ions.rho_scgc % ions.Cv_scgc);

} else {
energy.zeros();

Expand Down

0 comments on commit 503819b

Please sign in to comment.