From 52cbabb5bbc6b550c2c237cce0b56146756a7a8d Mon Sep 17 00:00:00 2001 From: Thomas Marks Date: Fri, 31 Jan 2025 19:12:42 -0500 Subject: [PATCH] fix massive divergence angles when ion velocity small or negative --- NEWS.md | 6 ++++++ Project.toml | 2 +- src/simulation/plume.jl | 7 +++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index c9b45fc1..ce6fea8a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,12 @@ EditURL = "NEWS.md" # Release notes +## v0.18.3 + +### Bug fixes +- Fix indexing error in rate coefficient calculation +- Fix massive divergence angles when ion velocity is zero or negative + ## v0.18.2 ### New features diff --git a/Project.toml b/Project.toml index 32b490f3..97dba25d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "HallThruster" uuid = "2311f341-5e6d-4941-9e3e-3ce0ae0d9ed6" authors = ["Thomas Marks "] -version = "0.18.2" +version = "0.18.3" [deps] DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" diff --git a/src/simulation/plume.jl b/src/simulation/plume.jl index 1453338c..df88debb 100644 --- a/src/simulation/plume.jl +++ b/src/simulation/plume.jl @@ -21,13 +21,16 @@ function update_plume_geometry!(params) L_ch = thruster.geometry.channel_length exit_plane_index = max(findfirst(>=(L_ch), grid.cell_centers), 1) Tev_exit = Tev[exit_plane_index] + inv_mi = 1 / mi for i in (exit_plane_index + 1):(grid.num_cells) ui = sum(niui[Z, i] for Z in 1:ncharge) / sum(ni[Z, i] for Z in 1:ncharge) - tanδ_i = sqrt(5 * e * Tev_exit / 3 / mi) / ui - tanδ[i] = max(0.0, tanδ_i) + thermal_speed = sqrt((5/3) * e * Tev_exit * inv_mi) + ui = max(ui, thermal_speed) + tanδ[i] = clamp(thermal_speed / ui, 0.0, 1.0) + avg_tan_δ = 0.5 * (tanδ[i] + tanδ[i - 1]) Δz = grid.cell_centers[i] - grid.cell_centers[i - 1] inner_radius[i] = max(0.0, inner_radius[i - 1] - avg_tan_δ * Δz)