Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Krylov-Bogoliubov for commensurate frequencies #251

Open
oameye opened this issue Sep 18, 2024 · 2 comments
Open

Krylov-Bogoliubov for commensurate frequencies #251

oameye opened this issue Sep 18, 2024 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers new feature New feature or request

Comments

@oameye
Copy link
Member

oameye commented Sep 18, 2024

Krylov-Bogoliubov method for commensurate frequencies, e.g., $\omega$ and $3\omega$. Technically the one can compute the slow-flow equations for such a system, but at the moment KB in HB.jl compute the wrong equations.

eq1 = d(d(x, t), t) + ω₁^2 * x + α₁ * x^3 + 3 * J₁ * x^2 * y + J₂ * y^2 * x #+ γ₁ * d(x, t) + η₁ * x^2 * d(x, t)
eq2 = d(d(y, t), t) + ω₂^2 * y + α₂ * y^3 + J₁ * x^3 + J₂ * x^2 * y #+ γ₂ * d(y, t) + η₂ * y^2 * d(y, t)


forces = [F * cos* t), 0]

dEOM_temp = DifferentialEquation([eq1, eq2] - forces, [x, y]);

add_harmonic!(dEOM_temp, x, ω) # x will rotate at ω
add_harmonic!(dEOM_temp, y, 3 * ω); # y will rotate at 3*ω

# harmonic_tmp = get_krylov_equations(dEOM_temp, order=1);
harmonic_tmp = get_harmonic_equations(dEOM_temp);

rearranged = HB.rearrange_standard(harmonic_tmp)
prob_temp = HB.Problem(rearranged)
rearranged.equations

image

@oameye oameye added the bug Something isn't working label Sep 18, 2024
@oameye
Copy link
Member Author

oameye commented Sep 18, 2024

image
Yes KB in HB.jl does something wrong

@oameye
Copy link
Member Author

oameye commented Oct 26, 2024

        @variables t x(t) y(t) ω0 ω F α J # symbolic variables
        eq1 = d(d(x, t), t) + ω0^2 * x + α * x^3 ~ F * cos* t) + J * y
        eq2 = d(d(y, t), t) + ω0^2 * y + α * y^3 ~ F * cos* t) + J * x
        EOM = DifferentialEquation([eq1, eq2], [x, y])
        add_harmonic!(EOM, x, ω)
        add_harmonic!(EOM, y, 3*ω)
        krylov_eq = get_krylov_equations(EOM; order=1)
        harmonic_eq = get_harmonic_equations(EOM)
        rearranged = HarmonicBalance.rearrange_standard(harmonic_eq)


            eqk = expand_fraction(krylov_eq.equations[1].lhs)
            eqh = expand_fraction(rearranged.equations[1].lhs)
            @variables T u1(T) v1(T) ω0 ω F α # symbolic variables
            subs = Dict([u1, v1, α, F, ω0, ω, J] .=> rand(7))
            solk = substitute(eqk, subs)
            solh = substitute(eqh, subs)
            @test Float64(solk + solh) == 0.0

@oameye oameye added the good first issue Good for newcomers label Oct 27, 2024
@oameye oameye added performance Regarding performance of the package new feature New feature or request and removed performance Regarding performance of the package labels Nov 10, 2024
@oameye oameye changed the title Krylov and HB different equations? Krylov-Bogoliubov for commensurate frequencies Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers new feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant