Skip to content

Commit

Permalink
fix: fix krylov variable show method (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
oameye authored Oct 26, 2024
1 parent 75371be commit ff48e5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ end
"""Gives the full harmonic ansatz used to construct `eom`."""
function _show_ansatz(eom::HarmonicEquation)
output = ""
for nat_var in get_variables(eom.natural_equation)
vars = unique(getfield.(eom.variables, :natural_variable))
for nat_var in vars
# the Hopf variable (limit cycle frequency) does not contribute a term
harm_vars = filter(
x -> isequal(nat_var, x.natural_variable) && x.type !== "Hopf", eom.variables
Expand Down
5 changes: 5 additions & 0 deletions test/krylov.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ add_harmonic!(diff_eom, x, ω) # x will rotate at ω
harmonic_eq1 = get_krylov_equations(diff_eom; order=1)
harmonic_eq2 = get_krylov_equations(diff_eom; order=2)

@testset "show method" begin
print_variable = HB._show_ansatz(harmonic_eq1)
@test !(occursin("xˍt(t)", print_variable))
end

fixed = (ω0 => 1.0, γ => 0.005, α => 1.0, η => 0, F => 0.0, ψ => 0.0, θ => 0.0)
varied ==> range(0.99, 1.01, 5), λ => range(1e-6, 0.05, 5))

Expand Down

0 comments on commit ff48e5f

Please sign in to comment.