Skip to content

A Julia package for solving nonlinear differential equations using the harmonic balance method.

License

Notifications You must be signed in to change notification settings

jdelpino/HarmonicBalance.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tests docs

HarmonicBalance.jl is a Julia package for solving nonlinear differential equations using the method of harmonic balance.

Installation

To install HarmonicBalance.jl, you can use the github repo or the Julia package manager,

using Pkg
Pkg.add("HarmonicBalance")

Documentation

For a detailed description of the package and examples, see the documentation.

This repo contains a collection of example notebooks.

Let's find the steady states of a driven Duffing oscillator with nonlinear damping, its equation of motion is:

using HarmonicBalance
@variables α, ω, ω0, F, t, η, x(t) # declare constant variables and a function x(t)
diff_eq = DifferentialEquation(d(x,t,2) + ω0^2*x + α*x^3 + η*d(x,t)*x^2 ~ F*cos*t), x)
add_harmonic!(diff_eq, x, ω) # specify the ansatz x = u(T) cos(ωt) + v(T) sin(ωt)

# implement ansatz to get harmonic equations
harmonic_eq = get_harmonic_equations(diff_eq)

fixed ==> 1., ω0 => 1.0, F => 0.01, η=>0.1)   # fixed parameters
swept = ω => LinRange(0.9, 1.2, 100)           # range of parameter values
solutions = get_steady_states(harmonic_eq, swept, fixed)
A steady state result for 100 parameter points

Solution branches:   3
   of which real:    3
   of which stable:  2

Classes: stable, physical, Hopf, binary_labels
plot_1D_solutions(solutions, x="ω", y="sqrt(u1^2 + v1^2)");

Citation

If you use HarmonicBalance.jl in your project, we kindly ask you to cite this paper.

About

A Julia package for solving nonlinear differential equations using the harmonic balance method.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Julia 100.0%