-
Notifications
You must be signed in to change notification settings - Fork 17
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
Different result from get_steady_states in case of a 2D sweep depending on sampling rate in the same linear range #163
Comments
Hey Soumya. Should the last term in |
Oh hey, sorry about that. Must've left it out while copying over here. Yes, it should be cubed. |
Hey Soumya, The problem seems to be solved if you use the using HarmonicBalance
@variables ω0, γ, ω, α, F₁, m, δ, t, x(t);
natural_equation = d(x, t, 2) + γ * d(x, t) + ω0^2 * x + α * x^3;
factor = γ^2 / 4;
factor /= γ^2 / 4 + δ^2;
forces_new = F₁ * cos(ω * t) - factor * F₁ * m * cos(ω * t);
diffEOM_new = DifferentialEquation(natural_equation + forces_new, x);
add_harmonic!(diffEOM_new, x, [ω]);
averagediffEOM_new = get_harmonic_equations(diffEOM_new);
fixed = (F₁ => 0.02, α => 1.0, γ => 0.025, ω0 => 1.0, ω => 1.1)
swept = (m => range(0.0, 1.0, 50), δ => range(-0.25, 0.25, 80)); #here, try LinRange(-0.25, 0.25, 81)
res2D = get_steady_states(averagediffEOM_new, swept, fixed, method=:total_degree)
plot_phase_diagram(res2D) |
I am confused why it did work on v1.6.4 on your side. Because, I had the same "bug" on v1.6.4. It would also surprise me, as that part of the code did note change at all. It could be this line: complex_pert = [1E-2 * issubset(p, keys(sweep))*randn(ComplexF64) for p in problem.parameters] I will look into it |
I cannot seem to replicate it working on 1.6.4 |
Hey Soumya, this is now resolved on the master branch. The issue shouldn't be there anymore in next version :) |
I get different number of solution branches from get_steady_states in the case of a 2D sweep if I change the sampling number (eg, going from LinRange(-0.25, 0.25, 80) to LinRange(-0.25, 0.25, 81) ) even when I sweep the parameter between the same values. The bug does not appear in HarmonicBalance v0.6.4, but it appears in HarmonicBalance v0.8.0
Expected behavior
The number of solution branches should have remained the same in both cases. The error does not happen when I am working with a positive [0,0.25] or a negative [-0.25,0] range, but only when I am working with a negative to positive range [-0.25,0.25].
Minimal Reproducible Example
Environment (please complete the following information):
using Pkg; Pkg.status()
HarmonicBalance v0.8.0
versioninfo()
The text was updated successfully, but these errors were encountered: