Skip to content

Commit 987e63f

Browse files
authored
InnerLayer.SLAYER - TEST - Pin the reverse-shear invariance of the layer magnitudes (#432)
2 parents e097951 + 42ec8db commit 987e63f

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

test/runtests_slayer_params.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,29 @@
165165
@test_throws ArgumentError r_based_shear(0.5, 2.0, 1.0, 0.0)
166166
@test_throws ArgumentError r_based_shear(0.5, 0.0, 1.0, 0.5)
167167
end
168+
169+
@testset "Test 3: reverse-shear invariance" begin
170+
# The layer timescales and widths depend on |dq/dr|, not its sign: a negative-shear
171+
# surface must reduce to its positive-shear mirror, with only the recorded sval_r
172+
# diagnostic keeping the sign. dc_type=:lar with nonzero dr_val exercises the Wd
173+
# iteration and the critical-Δ square roots as well as tau_h.
174+
base = _ref_kwargs(; dr_val=-0.1, dc_type=:lar)
175+
pos = slayer_parameters(; base...)
176+
neg = slayer_parameters(; merge(base, (; sval_r=-1.0))...)
177+
178+
# The sign survives where it is a diagnostic, not a magnitude.
179+
@test pos.sval_r == 1.0
180+
@test neg.sval_r == -1.0
181+
182+
# Every normalized layer quantity is bit-identical: abs(-1.0) === 1.0,
183+
# so the whole downstream chain reproduces exactly.
184+
for f in (:tau, :lu, :c_beta, :D_norm, :P_perp, :P_tor, :Q_e, :Q_i,
185+
:iota_e, :tauk, :tau_r, :delta_n, :eta, :d_beta, :dc_tmp)
186+
@test getfield(neg, f) == getfield(pos, f)
187+
end
188+
189+
# tau_h > 0 keeps the Lundquist number positive, so S^(1/3) is defined on reverse shear.
190+
@test neg.lu > 0
191+
@test neg.tauk > 0
192+
end
168193
end

0 commit comments

Comments
 (0)