implemented basic wave pattern instead of animal pattern

pull/6/head
2211567 2025-06-17 16:04:03 +02:00
parent 9ead776049
commit 380d9aa228
2 changed files with 19 additions and 20 deletions

View File

@ -18,7 +18,7 @@ function blocks_ic(N)
safe_block!(u, p, p) safe_block!(u, p, p)
return vec(u), vec(v) return u, v
end end
function column_ic(N) function column_ic(N)
@ -80,7 +80,7 @@ function two_rows_edge_distance_ic(N)
# Apply the second column # Apply the second column
u[:, col2_start:col2_end] .= -0.01 u[:, col2_start:col2_end] .= -0.01
return vec(u), vec(v) return u, v
end end
function center_band_ic(N) function center_band_ic(N)
@ -94,7 +94,7 @@ function center_band_ic(N)
u[row_start:row_end, :] .= 0.1 .+ 0.01 .* randn(band_width + 1, N) u[row_start:row_end, :] .= 0.1 .+ 0.01 .* randn(band_width + 1, N)
v[row_start:row_end, :] .= 0.1 .+ 0.01 .* randn(band_width + 1, N) v[row_start:row_end, :] .= 0.1 .+ 0.01 .* randn(band_width + 1, N)
return vec(u), vec(v) return u, v
end end
function circle_ic(N) function circle_ic(N)
@ -109,7 +109,7 @@ function circle_ic(N)
end end
end end
return vec(u), vec(v) return u, v
end end
function three_circles_random_ic(N) function three_circles_random_ic(N)
@ -165,21 +165,21 @@ function squiggle_ic(N, Lx=400.0, Ly=400.0)
# Apply squiggle # Apply squiggle
u[Z.>0.8] .= uminus u[Z.>0.8] .= uminus
return vec(u), vec(v) return u, v
end end
function coral_ic(N) function coral_ic(N)
u = fill(0.534522, N, N) u = ones(N, N)
v = fill(0.381802, N, N) v = zeros(N, N)
for _ in 1:20 # place 15 noisy seeds for _ in 1:150 # place 15 noisy seeds
i, j = rand(10:N-10), rand(10:N-10) i, j = rand(5:N-5), rand(5:N-5)
u[i-2:i+2, j-2:j+2] .= -0.534522 .+ 0.2 * rand(5, 5) u[i-2:i+2, j-2:j+2] .= -0.534522 .+ 0.2 * rand(5, 5)
end end
return u, v return u, v
end end
export blocks_ic, column_ic, squiggle_ic, three_circles_random_ic, circle_ic, center_band_ic, two_rows_edge_distance_ic, coral_ic export blocks_ic, column_ic, squiggle_ic, three_circles_random_ic, circle_ic, center_band_ic, two_rows_edge_distance_ic, coral_ic, stripe_ic
end end

View File

@ -101,10 +101,9 @@ function build_ui(U, V, param_obs_map::NamedTuple, params_obs, heat_obs)
gh[1, 2] = templategrid = GridLayout(ax.scene, tellwidth=false) gh[1, 2] = templategrid = GridLayout(ax.scene, tellwidth=false)
templategrid[1, 1] = Label(fig, "Templates:") templategrid[1, 1] = Label(fig, "Templates:")
btn_zebra = Button(templategrid[1, 2], width=100, label="Zebra Stripes") btn_waves = Button(templategrid[1, 2], width=100, label="Wave Pattern")
btn_cow = Button(templategrid[1, 3], width=100, label="Cow Spots") btn_cow = Button(templategrid[1, 3], width=100, label="Cow Spots")
btn_cheetah = Button(templategrid[1, 4], width=100, label="Cheetah Spots") btn_cheetah = Button(templategrid[1, 4], width=100, label="Cheetah Spots")
#btn_coral = Button(templategrid[1, 4], width=100, label="Coral Pattern")
# place all the parameter boxes # place all the parameter boxes
gh[2, 2] = textboxgrid = GridLayout(ax.scene, tellwidth=false) gh[2, 2] = textboxgrid = GridLayout(ax.scene, tellwidth=false)
@ -171,18 +170,18 @@ function build_ui(U, V, param_obs_map::NamedTuple, params_obs, heat_obs)
end end
# Template Control # Template Control
on(btn_zebra.clicks) do _ on(btn_waves.clicks) do _
# add column to center of matrix # add column to center of matrix
U, V = Templates.column_ic(params_obs[].N) U, V = Templates.blocks_ic(params_obs[].N)
hm.colormap[] = :grayC hm.colormap[] = :viridis
# change params # change params
param_obs_map.Du[] = 1.0 param_obs_map.Du[] = 0.0008
param_obs_map.Dv[] = 2.0 param_obs_map.Dv[] = 0.1
param_obs_map.ϵ[] = 0.3 param_obs_map.ϵ[] = 0.01
param_obs_map.a[] = 0.0 param_obs_map.a[] = 0.5
param_obs_map.b[] = 1.4 param_obs_map.b[] = 0.15
heat_obs[] = copy(U) heat_obs[] = copy(U)
end end