From ddd58dfd2962040711adc291e8ba44491d1a507c Mon Sep 17 00:00:00 2001 From: Orjan Ameye Date: Tue, 1 Aug 2023 11:26:40 +0200 Subject: [PATCH] Add extra tests for `hysteris_sweep` --- src/modules/TimeEvolution.jl | 1 + src/modules/TimeEvolution/hysteresis_sweep.jl | 4 ++-- test/hysteresis_sweep.jl | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/TimeEvolution.jl b/src/modules/TimeEvolution.jl index 7ca372e7..609dfa2b 100644 --- a/src/modules/TimeEvolution.jl +++ b/src/modules/TimeEvolution.jl @@ -2,6 +2,7 @@ module TimeEvolution using ..HarmonicBalance using Symbolics + using Plots using OrdinaryDiffEq using DSP using FFTW diff --git a/src/modules/TimeEvolution/hysteresis_sweep.jl b/src/modules/TimeEvolution/hysteresis_sweep.jl index d30e00d8..7af2a715 100644 --- a/src/modules/TimeEvolution/hysteresis_sweep.jl +++ b/src/modules/TimeEvolution/hysteresis_sweep.jl @@ -71,8 +71,8 @@ function plot_1D_solutions_branch(starting_branch::Int64, res::Result; followed_branch, Ys = follow_branch(starting_branch, res, y=y, sweep=sweep, tf=tf, ϵ=ϵ) Y_followed = [Ys[param_idx][branch] for (param_idx,branch) in enumerate(followed_branch)] - X = res.swept_parameters[_parse_expression(x)] + X = real.(res.swept_parameters[HarmonicBalance._parse_expression(x)]) - plot!(p, X, real.(Y_followed); linestyle=:dash, c=:gray, label = sweep*" sweep", _set_Plots_default..., kwargs...) + Plots.plot!(p, X, real.(Y_followed); linestyle=:dash, c=:gray, label = sweep*" sweep", HarmonicBalance._set_Plots_default..., kwargs...) return p end diff --git a/test/hysteresis_sweep.jl b/test/hysteresis_sweep.jl index a8906ade..6188778d 100644 --- a/test/hysteresis_sweep.jl +++ b/test/hysteresis_sweep.jl @@ -14,3 +14,5 @@ result = get_steady_states(harmonic_eq, varied, fixed, show_progress=false) followed_branch, _ = follow_branch(1, result) @test first(followed_branch) ≠ last(followed_branch) + +plot_1D_solutions_branch(1, result, x="ω", y="√(u1^2+v1^2)", show=false);