Skip to content

Commit e097951

Browse files
authored
InnerLayer.SLAYER - BUGFIX - Use the shear magnitude in the layer timescales and widths (#431)
2 parents d7e6e6f + 66cc5ed commit e097951

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/InnerLayer/SLAYER/LayerParameters.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ function _solve_dc_tmp(; dc_type::Symbol, dr_val::Real, dgeo_val::Real,
133133
Wd = 0.1
134134
converged = false
135135
for _ in 1:max_iter
136-
chi_par_lmfp = (2.0 * R0 * vte) / (sqrt(π) * n_tor * sval_r * Wd)
136+
chi_par_lmfp = (2.0 * R0 * vte) / (sqrt(π) * n_tor * abs(sval_r) * Wd)
137137
chi_par = (chi_par_smfp * chi_par_lmfp) /
138138
(chi_par_smfp + chi_par_lmfp)
139139
Wd_new = sqrt(8.0) * (chi_perp / chi_par)^0.25 *
140-
(1.0 / sqrt((rs / R0) * sval_r * n_tor))
140+
(1.0 / sqrt((rs / R0) * abs(sval_r) * n_tor))
141141
if abs(Wd_new - Wd) / max(abs(Wd), 1e-30) < tol
142142
Wd = Wd_new
143143
converged = true
@@ -147,13 +147,13 @@ function _solve_dc_tmp(; dc_type::Symbol, dr_val::Real, dgeo_val::Real,
147147
end
148148
converged || error("SLAYERParameters: Wd iteration failed to converge")
149149

150-
chi_par_lmfp = (2.0 * R0 * vte) / (sqrt(π) * n_tor * sval_r * Wd)
150+
chi_par_lmfp = (2.0 * R0 * vte) / (sqrt(π) * n_tor * abs(sval_r) * Wd)
151151
chi_par = (chi_par_smfp * chi_par_lmfp) / (chi_par_smfp + chi_par_lmfp)
152152

153153
if dc_type === :lar
154154
return 0.5 * (-dr_val) * π^1.5 *
155155
(chi_par / chi_perp)^0.25 *
156-
sqrt((n_tor * sval_r) / (R0 * rs))
156+
sqrt((n_tor * abs(sval_r)) / (R0 * rs))
157157
elseif dc_type === :rfitzp
158158
return -(sqrt(2.0) * π^1.5 * dr_val) / Wd
159159
elseif dc_type === :toroidal
@@ -297,8 +297,10 @@ function slayer_parameters(;
297297

298298
# Alfven time uses minor-radius shear directly (sval enters the
299299
# b_l = (n/m) r_s sval bt / R0 expression and cancels through to
300-
# tau_h = R0 sqrt(mu0 rho) / (n sval bt)).
301-
tau_h = R0 * sqrt(MU_0 * rho) / (n * sval_r * bt)
300+
# tau_h = R0 sqrt(mu0 rho) / (n sval bt)). Magnitude only: the layer timescales and
301+
# widths depend on |dq/dr|, not its sign, and a reverse-shear surface would otherwise
302+
# give tau_h < 0, hence lu < 0 and a DomainError in lu^(1/3) below.
303+
tau_h = R0 * sqrt(MU_0 * rho) / (n * abs(sval_r) * bt)
302304
# Resistive diffusion time τ_R = μ₀ r_s² / η (Fitzpatrick 2023), with
303305
# the selected η closure — neoclassical by default — setting the
304306
# Lundquist number.

0 commit comments

Comments
 (0)