Zebra provisorisch erstellt lol
parent
2f498367e8
commit
ece09a29f5
|
|
@ -5,7 +5,7 @@ include("../src/visualization.jl")
|
|||
using .Visualization
|
||||
|
||||
N = 256
|
||||
tspan = (0.0, 5000.0)
|
||||
tspan = (0.0, 1500.0)
|
||||
|
||||
sol = AnimalFurFHN.run_simulation(tspan, N)
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ function blocks_ic(N)
|
|||
row_end = min(row_center + 7, N)
|
||||
col_start = max(col_center - 8, 1)
|
||||
col_end = min(col_center + 7, N)
|
||||
u[row_start:row_end, col_start:col_end] .= -0.534522
|
||||
u[row_start:row_end, col_start:col_end] .= -0.01
|
||||
end
|
||||
|
||||
safe_block!(u, p, p)
|
||||
|
|
@ -50,8 +50,8 @@ function blocks_ic(N)
|
|||
end
|
||||
|
||||
function column_ic(N)
|
||||
u = fill(0.534522, N, N)
|
||||
v = fill(0.381802, N, N)
|
||||
u = fill(0.01, N, N)
|
||||
v = fill(0.99, N, N)
|
||||
|
||||
col_center = div(N, 2)
|
||||
col_width = 8 # You can adjust this
|
||||
|
|
@ -59,7 +59,43 @@ function column_ic(N)
|
|||
col_start = max(col_center - div(col_width, 2), 1)
|
||||
col_end = min(col_center + div(col_width, 2) - 1, N)
|
||||
|
||||
u[col_start:col_end, :] .= -0.534522
|
||||
u[col_start:col_end, :] .= -0.01
|
||||
|
||||
return vec(u), vec(v)
|
||||
end
|
||||
|
||||
function two_rows_edge_distance_ic(N)
|
||||
row_width = 8
|
||||
distance_from_edge = 50
|
||||
u = fill(0.01, N, N)
|
||||
v = fill(0.99, N, N)
|
||||
|
||||
# --- Input Validation ---
|
||||
if row_width <= 0 || distance_from_edge < 0
|
||||
error("row_width must be positive and distance_from_edge must be non-negative.")
|
||||
end
|
||||
|
||||
# Calculate column 1 (from the left edge)
|
||||
col1_start = distance_from_edge + 1
|
||||
col1_end = col1_start + row_width - 1
|
||||
|
||||
# Calculate column 2 (from the right edge)
|
||||
col2_end = N - distance_from_edge
|
||||
col2_start = col2_end - row_width + 1
|
||||
|
||||
# --- Further Validation for placement ---
|
||||
if col1_end > N || col2_start < 1
|
||||
error("Columns go out of bounds. Adjust N, row_width, or distance_from_edge.")
|
||||
end
|
||||
if col1_end >= col2_start # Check for overlap or touching
|
||||
error("Columns overlap or touch. Adjust N, row_width, or distance_from_edge such that 2 * (distance_from_edge + row_width) <= N.")
|
||||
end
|
||||
|
||||
# Apply the first column
|
||||
u[:, col1_start:col1_end] .= -0.01
|
||||
|
||||
# Apply the second column
|
||||
u[:, col2_start:col2_end] .= -0.01
|
||||
|
||||
return vec(u), vec(v)
|
||||
end
|
||||
|
|
@ -79,14 +115,43 @@ function center_band_ic(N)
|
|||
end
|
||||
|
||||
function circle_ic(N)
|
||||
u = fill(0.534522, N, N)
|
||||
v = fill(0.381802, N, N)
|
||||
u = fill(0.01, N, N)
|
||||
v = fill(0.99, N, N)
|
||||
cx, cy = div(N, 2), div(N, 2) # center of matrix
|
||||
radius = 0.250 * N # circle radius = 3/4 of N divided by 2
|
||||
radius = 0.125 * N # circle radius = 3/4 of N divided by 2
|
||||
|
||||
for i in 1:N, j in 1:N
|
||||
if (i - cx)^2 + (j - cy)^2 ≤ radius^2
|
||||
u[i, j] = -0.534522
|
||||
u[i, j] = -0.01
|
||||
end
|
||||
end
|
||||
|
||||
return vec(u), vec(v)
|
||||
end
|
||||
|
||||
function three_circles_random_ic(N)
|
||||
u = fill(0.01, N, N)
|
||||
v = fill(0.99, N, N)
|
||||
radius = 0.125 * N
|
||||
|
||||
# Define the bounds for random centers to ensure the circle stays within the matrix
|
||||
min_coord = ceil(Int, radius) + 1
|
||||
max_coord = floor(Int, N - radius)
|
||||
|
||||
if min_coord > max_coord
|
||||
error("Matrix size N is too small to place circles of this radius without overlap or going out of bounds.")
|
||||
end
|
||||
|
||||
for _ in 1:5 # Place 3 circles
|
||||
# Generate random center coordinates
|
||||
cx = rand(min_coord:max_coord)
|
||||
cy = rand(min_coord:max_coord)
|
||||
|
||||
# Apply the circle to the matrix
|
||||
for i in 1:N, j in 1:N
|
||||
if (i - cx)^2 + (j - cy)^2 ≤ radius^2
|
||||
u[i, j] = -0.01
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -94,8 +159,8 @@ function circle_ic(N)
|
|||
end
|
||||
|
||||
function squiggle_ic(N, Lx=400.0, Ly=400.0)
|
||||
uplus = 0.534522
|
||||
vplus = 0.381802
|
||||
uplus = 0.01
|
||||
vplus = 0.99
|
||||
uminus = -uplus
|
||||
|
||||
# Create coordinate grids
|
||||
|
|
@ -135,16 +200,16 @@ end
|
|||
"""
|
||||
function run_simulation(tspan::Tuple{Float64,Float64}, N::Int)
|
||||
# Turing-spot parameters
|
||||
p = FHNParams(N=N, dx=1.0, Du=0.00016, Dv=0.001, ϵ=0.1, a=0.5, b=0.9)
|
||||
p = FHNParams(N=N, dx=1.0, Du=0.016, Dv=0.1, ϵ=0.1, a=0.5, b=0.9)
|
||||
|
||||
# Initial conditions (random noise)
|
||||
Random.seed!(1234)
|
||||
#Random.seed!(4321)
|
||||
# Create two vectors with length N*N with numbers between 0.1 and 0.11
|
||||
#u0 = vec(0.4 .+ 0.01 .* rand(N, N))
|
||||
#v0 = vec(0.4 .+ 0.01 .* rand(N, N))
|
||||
|
||||
# Or use this
|
||||
u0, v0 = squiggle_ic(N)
|
||||
u0, v0 = two_rows_edge_distance_ic(N)
|
||||
|
||||
y0 = vcat(vcat(u0, v0))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue