Skip to content

Commit

Permalink
Implemented collision frequency matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
amrueda committed Dec 16, 2024
1 parent 69c5db0 commit 0614602
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion examples/tree_2d_dgsem/elixir_mhdmultiion_collisions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ equations = IdealGlmMhdMultiIonEquations2D(gammas = (5 / 3, 5 / 3),
76.3049060157692000), # [nondimensional]
gas_constants = (1.0, 1.0), # [nondimensional]
molar_masses = (1.0, 1.0), # [nondimensional]
collision_frequency = 0.4079382480442680, # [nondimensional] (computed with eq (4.142) of Schunk&Nagy (2009))
collision_frequency = [0.0 0.4079382480442680;
0.4079382480442680 0.0], # [nondimensional] (computed with eq (4.142) of Schunk&Nagy (2009))
ion_electron_collision_constants = (8.56368379833E-06,
8.56368379833E-06), # [nondimensional] (computed with eq (9) of Ghosh et al. (2019))
electron_pressure = electron_pressure_constantTe,
Expand Down
3 changes: 2 additions & 1 deletion src/equations/ideal_glm_mhd_multiion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ function source_terms_collision_ion_ion(u, x, t,
T_kl /= (molar_masses[k] + molar_masses[l])

# Compute effective collision frequency
v_kl = (collision_frequency * (rho_l * molar_masses[1] / molar_masses[l]) /
v_kl = (collision_frequency[l, k] *
(rho_l * molar_masses[1] / molar_masses[l]) /
T_kl^(3 / 2))

# Correct the collision frequency with the drifting effect (NEW - Rambo & Denavit, Rambo & Procassini)
Expand Down
11 changes: 6 additions & 5 deletions src/equations/ideal_glm_mhd_multiion_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ mutable struct IdealGlmMhdMultiIonEquations2D{NVARS, NCOMP, RealT <: Real,
charge_to_mass::SVector{NCOMP, RealT} # Charge to mass ratios
gas_constants::SVector{NCOMP, RealT} # Specific gas constants
molar_masses::SVector{NCOMP, RealT} # Molar masses (can be provided in any units as they are only used to compute ratios)
collision_frequency::RealT # Single collision frequency scaled with molecular mass of ion 1 (TODO: Replace by matrix of collision frequencies)
collision_frequency::Array{RealT, 2} # Matrix of collision frequencies scaled with molecular mass of ion 1
ion_electron_collision_constants::SVector{NCOMP, RealT} # Constants for the ion-electron collision frequencies. The collision frequency is obtained as constant * (e * n_e) / T_e^1.5
electron_pressure::ElectronPressure # Function to compute the electron pressure
electron_temperature::ElectronTemperature # Function to compute the electron temperature
Expand All @@ -65,7 +65,7 @@ mutable struct IdealGlmMhdMultiIonEquations2D{NVARS, NCOMP, RealT <: Real,
::SVector{NCOMP,
RealT},
collision_frequency
::RealT,
::Array{RealT, 2},
ion_electron_collision_constants
::SVector{NCOMP,
RealT},
Expand All @@ -90,8 +90,9 @@ function IdealGlmMhdMultiIonEquations2D(; gammas, charge_to_mass,
eltype(gammas)}),
molar_masses = zero(SVector{length(gammas),
eltype(gammas)}),
collision_frequency = convert(eltype(gammas),
0),
collision_frequency = zeros(eltype(gammas),
length(gammas),
length(gammas)),
ion_electron_collision_constants = zero(SVector{length(gammas),
eltype(gammas)}),
electron_pressure = electron_pressure_zero,
Expand All @@ -104,7 +105,7 @@ function IdealGlmMhdMultiIonEquations2D(; gammas, charge_to_mass,
_ion_electron_collision_constants = promote(ion_electron_collision_constants...)
RealT = promote_type(eltype(_gammas), eltype(_charge_to_mass),
eltype(_gas_constants), eltype(_molar_masses),
typeof(collision_frequency),
eltype(collision_frequency),
eltype(_ion_electron_collision_constants))
__gammas = SVector(map(RealT, _gammas))
__charge_to_mass = SVector(map(RealT, _charge_to_mass))
Expand Down

0 comments on commit 0614602

Please sign in to comment.