cheetah design more or less done

pull/4/head
2211567 2025-06-11 15:31:55 +02:00
parent f5d3ebd0c2
commit 9223916f32
3 changed files with 17 additions and 14 deletions

View File

@ -4,8 +4,8 @@ using .AnimalFurFHN
include("../src/visualization.jl")
using .Visualization
N = 256
tspan = (1.0, 3000.0)
N = 100
tspan = (1.0, 1000.0)
sol = AnimalFurFHN.run_simulation(tspan, N)

View File

@ -45,7 +45,7 @@ end
function run_simulation(tspan::Tuple{Float64,Float64}, N::Int)
# Initial conditions
# params, y0 = zebra_conditions(N) # tspan of ~3500 enough
params, y0 = cheetah_conditions(N)
params, y0 = cell_conditions(N)
prob = ODEProblem(fhn!, y0, tspan, params)
sol = solve(prob, BS3(), saveat=10.0) # You can try `Rosenbrock23()` too

View File

@ -12,20 +12,23 @@ end
function cheetah_conditions(N)
# Turing-spot parameters
params = FHNParams(N=N, dx=1.0, Du=0.0025, Dv=0.6, ϵ=0.05, a=0.7, b=0.8)
#params = FHNParams(N=N, dx=1.0, Du=5e-6, Dv=2e-3, ϵ=0.025, a=0.6, b=0.15)
params = FHNParams(N=N, dx=1.0, Du=0.182, Dv=0.5, ϵ=0.05, a=0.2, b=2.0)
# Approximate Homogenous Steady State (HSS) for a=0.7, b=0.8
u_hss = -1.2
v_hss = -0.625
u0 = 0.05 .* (2 .* rand(N, N) .- 1) # noise in [-0.05, 0.05]
v0 = 0.05 .* (2 .* rand(N, N) .- 1)
# Small perturbations around the HSS
# rand(N,N) generates values between 0 and 1.
# (2 .* rand(N,N) .- 1) generates values between -1 and 1 symmetrically around 0.
perturbation_amplitude = 0.01
u0 = vec(u_hss .+ perturbation_amplitude .* (2 .* rand(N, N) .- 1))
v0 = vec(v_hss .+ perturbation_amplitude .* (2 .* rand(N, N) .- 1))
return params, vcat(vec(u0), vec(v0))
end
return params, vcat(u0, v0)
function cell_conditions(N)
# Turing-spot parameters
params = FHNParams(N=N, dx=1.0, Du=5e-5, Dv=6e-3, ϵ=0.05, a=0.6, b=0.1)
u0 = 0.534522 .* (2 .* rand(N, N) .- 1) # noise in [-0.05, 0.05]
v0 = 0.381802 .* (2 .* rand(N, N) .- 1)
return params, vcat(vec(u0), vec(v0))
end
# helper functions for filling cells in specific places of the matrix