Skip to content

Commit

Permalink
VanDerPol -> DuffingVanDerPol
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Jul 7, 2018
1 parent 7b55951 commit 2c065bd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
module VanDerPol
module DuffingVanDerPol

using DiffEqBase: ODEProblem
using Parameters: @with_kw, @unpack
using Setfield: @lens

using ...Bifurcations: BifurcationProblem

@with_kw struct VanDerPolParam{D, A, Ω}
d::D = 1.0 # 5.0
a::A = 0.0 # 5.0
ω::Ω = 2.466
@with_kw struct DuffingVanDerPolParam{A, B, D}
a::A = 1.0
b::B = 0.0
d::D = 1.0
end

function f(du, u, p, t)
@unpack d, a, ω = p
@unpack d, a, b = p
du[1] = u[2]
du[2] = -u[1] - d * (u[1]^2 - 1) * u[2] + a * cos* t)
du[2] = - a * u[1] - b * u[1]^3 - d * (u[1]^2 - 1) * u[2]
nothing
end

make_prob(
p = VanDerPolParam();
p = DuffingVanDerPolParam();
u0 = [0.0, 0.0],
tspan = (0.0, 2π),
ode = ODEProblem(f, u0, tspan, p),
Expand Down
4 changes: 2 additions & 2 deletions src/examples/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include("transcritical.jl")
include("calcium.jl")
include("predator_prey.jl")
include("bazykin_85.jl")
include("van_der_pol.jl")
include("duffing_van_der_pol.jl")

using Compat

Expand All @@ -15,7 +15,7 @@ example_modules() = [
Calcium,
PredatorPrey,
Bazykin85,
VanDerPol,
DuffingVanDerPol,
]

examples() = [nameof(ex) => ex for ex in example_modules()]
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ using Base.Test
"test_bazykin_85.jl",
"test_examples.jl",
"test_vs_svector.jl",
"test_van_der_pol.jl",
"test_duffing_van_der_pol.jl",
"test_hopf_to_lc.jl",
]
@time include(file)
Expand Down
8 changes: 4 additions & 4 deletions test/test_van_der_pol.jl → test/test_duffing_van_der_pol.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ module TestVanDerPol
include("preamble.jl")

using Bifurcations: LimitCycleProblem
using Bifurcations.Examples: VanDerPol
using Bifurcations.Examples: DuffingVanDerPol
using Bifurcations.Continuations: as, ContinuationSolution, sweeps_as_vectors

# Create a limit cycle solution.
using OrdinaryDiffEq: Tsit5
using DiffEqBase: remake
param = VanDerPol.VanDerPolParam(
param = DuffingVanDerPol.DuffingVanDerPolParam(
d = 0.1,
)
ode = remake(
VanDerPol.ode,
DuffingVanDerPol.ode,
u0 = [1.0, 1.8],
p = param,
tspan = (0.0, 100),
Expand All @@ -30,7 +30,7 @@ x0 = sol(t0)
num_mesh = 20
degree = 3
prob = LimitCycleProblem(
ode, VanDerPol.param_axis, VanDerPol.t_domain,
ode, DuffingVanDerPol.param_axis, DuffingVanDerPol.t_domain,
num_mesh, degree;
x0 = x0,
l0 = t1 - t0,
Expand Down
4 changes: 2 additions & 2 deletions test/test_examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ using Bifurcations: examples
using Bifurcations.Examples: Calcium
using Bifurcations.Examples.Calcium: CalciumParam
using Bifurcations.Examples.Bazykin85: Bazykin85Param
using Bifurcations.Examples.VanDerPol: VanDerPolParam
using Bifurcations.Examples.DuffingVanDerPol: DuffingVanDerPolParam

struct Example{P}
prob::P
end

make_codim2(::Real, point, solver1) = nothing
make_codim2(::Tuple, point, solver1) = nothing # PredatorPrey
make_codim2(::VanDerPolParam, point, solver1) = nothing
make_codim2(::DuffingVanDerPolParam, point, solver1) = nothing

make_codim2(::CalciumParam, point, solver1) =
BifurcationProblem(
Expand Down

0 comments on commit 2c065bd

Please sign in to comment.