diff --git a/scripts/run_simulation.jl b/scripts/run_simulation.jl index 87de992..2d5ba7e 100644 --- a/scripts/run_simulation.jl +++ b/scripts/run_simulation.jl @@ -4,8 +4,8 @@ using .AnimalFurFHN include("../src/visualization.jl") using .Visualization -N = 100 -tspan = (1.0, 1000.0) +N = 128 +tspan = (0.0, 2000.0) sol = AnimalFurFHN.run_simulation(tspan, N) diff --git a/src/solver.jl b/src/solver.jl index 91bacdd..b99226c 100644 --- a/src/solver.jl +++ b/src/solver.jl @@ -45,10 +45,10 @@ end function run_simulation(tspan::Tuple{Float64,Float64}, N::Int) # Initial conditions # params, y0 = zebra_conditions(N) # tspan of ~3500 enough - params, y0 = cell_conditions(N) + params, y0 = coral_conditions(N) prob = ODEProblem(fhn!, y0, tspan, params) - sol = solve(prob, BS3(), saveat=10.0) # You can try `Rosenbrock23()` too + sol = solve(prob, BS3(), saveat=50.0) # You can try `Rosenbrock23()` too return sol end diff --git a/src/utils.jl b/src/utils.jl index f79072f..7298bf4 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -21,14 +21,13 @@ function cheetah_conditions(N) return params, vcat(vec(u0), vec(v0)) end -function cell_conditions(N) +function coral_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) + params = FHNParams(N=N, dx=1.0, Du=0.001, Dv=0.06, ϵ=0.05, a=0.0, b=1.2) - u0 = 0.534522 .* (2 .* rand(N, N) .- 1) # noise in [-0.05, 0.05] - v0 = 0.381802 .* (2 .* rand(N, N) .- 1) + u0, v0 = coral_ic(N) - return params, vcat(vec(u0), vec(v0)) + return params, vcat(u0, v0) end # helper functions for filling cells in specific places of the matrix @@ -185,3 +184,15 @@ function squiggle_ic(N, Lx=400.0, Ly=400.0) return vec(u), vec(v) end + +function coral_ic(N) + u = fill(0.534522, N, N) + v = fill(0.381802, N, N) + + for _ in 1:40 # place 15 noisy seeds + i, j = rand(10:N-10), rand(10:N-10) + u[i-2:i+2, j-2:j+2] .= -0.534522 .+ 0.2 * rand(5, 5) + end + + return vec(u), vec(v) +end