Skip to content

Commit 5fb62d9

Browse files
committed
DEV functions on collisions.
1 parent ad4d50e commit 5fb62d9

File tree

1 file changed

+51
-6
lines changed

1 file changed

+51
-6
lines changed

src/physics.jl

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,10 @@ end
10011001
Calculate the collisional time in SI-units of a particle in a plasma due to
10021002
Coulomb collisions.
10031003
Source: Somov 2012 "Plasma Astrophysics, Part I, section 8.3.1, page 158.
1004+
1005+
Note that the electron charge cubed in SI-units is lower than
1006+
the smallest normal number representable by Float32 (`floatmin(Float32)`).
1007+
So use double precision otherwise the results would be wrong.
10041008
"""
10051009
function spitzercollisionaltime(q, m, T, n; coulomb_logarithm=20)
10061010
# From Somov 2012 "Plasma Astrophysics, Part I, section 8.3.1, page 158
@@ -1014,12 +1018,16 @@ end
10141018
calculate the collisional time in cgs-units of a particle in a plasma due to
10151019
coulomb collisions.
10161020
source: Somov 2012 "plasma astrophysics, part i, section 8.3.1, page 158.
1021+
1022+
Note that the electron charge^4 in CGS-units is lower than
1023+
the smallest normal number representable by Float32 (`floatmin(Float32)`).
1024+
So use double precision otherwise the results would be wrong.
10171025
"""
10181026
function spitzercollisionaltime_cgs(q, m, T, n; coulomb_logarithm=20)
10191027
# From Somov 2012 "Plasma Astrophysics, Part I, section 8.3.1, page 158
10201028
# in CGS units
10211029
numerator = m^2 * (3 * TraceParticles.k_B_cgs * T / m)^(3 / 2)
1022-
denominator =* n * e^4 * 8 * coulomb_logarithm) * 0.714
1030+
denominator =* n * q^4 * 8 * coulomb_logarithm) * 0.714
10231031
return numerator / denominator
10241032
end
10251033

@@ -1028,6 +1036,10 @@ end
10281036
calculate the collisional time in SI-units of a particle in a plasma due to
10291037
coulomb collisions.
10301038
source: Chen 2016 "Introduction to Plasma Physics and Controlled Fusion,
1039+
1040+
Note that the electron charge cubed in SI-units is lower than
1041+
the smallest normal number representable by Float32 (`floatmin(Float32)`).
1042+
So use double precision otherwise the results would be wrong.
10311043
"""
10321044
function spitzercollisionaltime_chen(q, m, T, n; coulomb_logarithm=20)
10331045
# From Somov 2012 "Plasma Astrophysics, Part I, section 8.3.1, page 158
@@ -1040,12 +1052,26 @@ end
10401052
dreicerfield_cgs(n, T; coulomb_logarithm=20)
10411053
Calculate the Dreicer field in CGS units.
10421054
"""
1043-
function dreicerfield_cgs(n, T; coulomb_logarithm=20)
1044-
nominator = 4π * TraceParticles.e_cgs^3 * coulomb_logarithm * n
1055+
function dreicerfield_cgs(q, T, n; coulomb_logarithm=20)
1056+
nominator = 4π * q^3 * coulomb_logarithm * n
10451057
denominator = TraceParticles.k_B_cgs * T
10461058
return nominator / denominator
10471059
end
10481060

1061+
"""
1062+
dreicerfield(n, T; coulomb_logarithm=20)
1063+
Calculate the Dreicer field in SI units.
1064+
"""
1065+
function dreicerfield(q, T, n; coulomb_logarithm=20)
1066+
q_cgs = q * TraceParticles.si2cgs_charge
1067+
n_cgs = n * TraceParticles.si2cgs_numberdensity
1068+
E_d_cgs = dreicerfield_cgs(
1069+
q_cgs, T, n_cgs;
1070+
coulomb_logarithm=coulomb_logarithm
1071+
)
1072+
return E_d_cgs * TraceParticles.cgs2si_electricfield
1073+
end
1074+
10491075
"""
10501076
criticalvelocity_cgs(n, T, E, m; coulomb_logarithm=20)
10511077
Calculate the critical velocity of particles with mass `m` in CGS units.
@@ -1054,10 +1080,29 @@ is equal to the electric field `E`, or the velocity at which the frictional
10541080
drag from Coulomb collisions (of thermal like-particle targets) is equal to
10551081
the acceleration from the parallel electric field.
10561082
"""
1057-
function criticalvelocity_cgs(n, T, E, m; coulomb_logarithm=20)
1058-
E_D = dreicerfield_cgs(n, T; coulomb_logarithm=coulomb_logarithm)
1083+
function criticalvelocity_cgs(q, T, n, E, m; coulomb_logarithm=20)
1084+
E_D = dreicerfield_cgs(q, T, n; coulomb_logarithm=coulomb_logarithm)
10591085
v_th = sqrt(TraceParticles.k_B_cgs * T / m)
1060-
return v_th * sqrt(E_D / E)
1086+
return convert(eltype(n), v_th * sqrt(E_D / E))
1087+
end
1088+
1089+
"""
1090+
criticalvelocity(n, T, E, m; coulomb_logarithm=20)
1091+
Calculate the critical velocity of particles with mass `m` in SI units.
1092+
The critical velocity is the velocity at which the Dreicer field
1093+
is equal to the electric field `E`, or the velocity at which the frictional
1094+
drag from Coulomb collisions (of thermal like-particle targets) is equal to
1095+
the acceleration from the parallel electric field.
1096+
"""
1097+
function criticalvelocity(q, T, n, E, m; coulomb_logarithm=20)
1098+
q_cgs = q * TraceParticles.si2cgs_charge
1099+
m_cgs = m * TraceParticles.si2cgs_mass
1100+
n_cgs = n * TraceParticles.si2cgs_numberdensity
1101+
E_cgs = E * TraceParticles.si2cgs_electricfield
1102+
v_crit_cgs = criticalvelocity_cgs(
1103+
q_cgs, T, n_cgs, E_cgs, m_cgs, coulomb_logarithm=coulomb_logarithm
1104+
)
1105+
return v_crit_cgs * TraceParticles.cgs2si_velocity
10611106
end
10621107

10631108
function eperp(

0 commit comments

Comments
 (0)