@@ -11,6 +11,7 @@ Let us load the following packages into our environment:
1111```` @example state_dependent_perturbation
1212using HarmonicBalance, Plots;
1313HB = HarmonicBalance;
14+ HSS = HarmonicSteadyState;
1415crange = (0, 9);
1516nothing #hide
1617````
@@ -19,15 +20,15 @@ Later, we will need to classify the solutions of our perturbation. To make this
1920
2021```` @example state_dependent_perturbation
2122function my_classify_default!(result)
22- my_classify_solutions!(result, HB .is_physical, "physical")
23- my_classify_solutions!(result, HB .is_stable, "stable")
24- return HB .order_branches!(result, ["physical", "stable"]) # shuffle the branches to have relevant
23+ my_classify_solutions!(result, HSS .is_physical, "physical")
24+ my_classify_solutions!(result, HSS .is_stable, "stable")
25+ return HSS .order_branches!(result, ["physical", "stable"]) # shuffle the branches to have relevant
2526end
26- function my_classify_solutions!(res::HB .Result, f::Function, name::String)
27+ function my_classify_solutions!(res::HSS .Result, f::Function, name::String)
2728 values = my_classify_solutions(res, f)
2829 return res.classes[name] = values
2930end
30- function my_classify_solutions(res::HB .Result, f::Function)
31+ function my_classify_solutions(res::HSS .Result, f::Function)
3132 values = similar(res.solutions, BitVector)
3233 for (idx, soln) in enumerate(res.solutions)
3334 values[idx] = [
@@ -72,8 +73,8 @@ We sweep over the system where we both increase the drive frequency $\omega$ and
7273
7374```` @example state_dependent_perturbation
7475res = 80
75- fixed = HB .OrderedDict(ω0 => 1.0, α => 1.0, J => 0.005, γ => 0.005)
76- varied = HB .OrderedDict((ω => range(0.99, 1.01, res), λ => range(1e-6, 0.03, res)))
76+ fixed = HSS .OrderedDict(ω0 => 1.0, α => 1.0, J => 0.005, γ => 0.005)
77+ varied = HSS .OrderedDict((ω => range(0.99, 1.01, res), λ => range(1e-6, 0.03, res)))
7778method = TotalDegree()
7879result_ωλ = get_steady_states(harmonic_normal, method, varied, fixed; show_progress=false);
7980plot_phase_diagram(result_ωλ; class="stable")
@@ -206,7 +207,7 @@ plot_phase_diagram(result_ωλ_antisym; class=["stable", "not_zero"])
206207We filter the non-zero amplitude solution and store it in a matrix $A$:
207208
208209```` @example state_dependent_perturbation
209- branch_mat = findfirst.(HB ._get_mask(result_ωλ_antisym, ["stable", "not_zero"], []))
210+ branch_mat = findfirst.(HSS ._get_mask(result_ωλ_antisym, ["stable", "not_zero"], []))
210211A = map(CartesianIndices(result_ωλ_antisym.solutions)) do idx
211212 branch = branch_mat[idx]
212213 if isnothing(branch)
@@ -242,7 +243,7 @@ permutation = first.(
242243param_ranges = collect(values(varied))
243244input_array = collect(Iterators.product(param_ranges..., values(fixed)...))
244245input_array = getindex.(input_array, [permutation])
245- input_array = HB .tuple_to_vector.(input_array)
246+ input_array = HSS .tuple_to_vector.(input_array)
246247input_array = map(idx -> push!(input_array[idx], A[idx]...), CartesianIndices(input_array));
247248nothing #hide
248249````
@@ -251,8 +252,8 @@ Solving for the steady states of the dressed symmetric mode:
251252
252253```` @example state_dependent_perturbation
253254function solve_perturbed_system(prob, input)
254- result_full = HB .ProgressMeter.@showprogress map(input_array) do input
255- HB .HomotopyContinuation.solve(
255+ result_full = HSS .ProgressMeter.@showprogress map(input_array) do input
256+ HSS .HomotopyContinuation.solve(
256257 prob.system;
257258 start_system=:total_degree,
258259 target_parameters=input,
@@ -261,22 +262,22 @@ function solve_perturbed_system(prob, input)
261262 )
262263 end
263264
264- rounded_solutions = HB .HomotopyContinuation.solutions.(result_full)
265- solutions = HB .pad_solutions(rounded_solutions)
265+ rounded_solutions = HSS .HomotopyContinuation.solutions.(result_full)
266+ solutions = HSS .pad_solutions(rounded_solutions)
266267
267268 jacobian = HarmonicBalance.get_Jacobian(harmonic_tmp)
268269 J_variables = cat(prob.variables, collect(keys(varied)), [ua, va]; dims=1)
269- compiled_J = HB .compile_matrix(jacobian, J_variables; rules=fixed)
270- compiled_J = HB .JacobianFunction(HB .solution_type(solutions))(compiled_J)
271- result = HB .Result(
270+ compiled_J = HSS .compile_matrix(jacobian, J_variables; rules=fixed)
271+ compiled_J = HSS .JacobianFunction(HSS .solution_type(solutions))(compiled_J)
272+ result = HSS .Result(
272273 solutions,
273274 varied,
274275 fixed,
275276 prob,
276277 Dict(),
277278 zeros(Int64, size(solutions)...),
278279 compiled_J,
279- HB .seed(method),
280+ HSS .seed(method),
280281 )
281282
282283 my_classify_default!(result)
0 commit comments