Merge branch 'feat/create_templates' of https://gitty.informatik.hs-mannheim.de/2212719/SCJ_Projekt into feat/create_templates
commit
e5bc553e4c
|
|
@ -9,77 +9,6 @@ using Observables
|
|||
using ..Constants
|
||||
using .Laplacian
|
||||
|
||||
"""
|
||||
fhn(du, u, p:FHNParams, t:)
|
||||
|
||||
Implements the spatial dynamics of FitzHugh-Nagumo (fhn). Designed to be
|
||||
within a larger numerical solver of partial differential equations.
|
||||
|
||||
# Arguments
|
||||
- `du`: output argument which stores the calculated derivatives
|
||||
- `u`: input vector containing the current state of the system at time t
|
||||
- `p`: holds all the fixed parameters of the FHN model
|
||||
- `t`: current time
|
||||
|
||||
# Returns
|
||||
- `du`: calculated derivatives put back into the du array
|
||||
"""
|
||||
# function fhn!(du, u, p::CombinedPDEParams, t)
|
||||
# N = p.N
|
||||
# u_mat = reshape(u[1:N^2], N, N)
|
||||
# v_mat = reshape(u[N^2+1:end], N, N)
|
||||
|
||||
# Δu = laplacian(u_mat, p.dx)
|
||||
# Δv = laplacian(v_mat, p.dx)
|
||||
|
||||
# u_in = u_mat[2:end-1, 2:end-1]
|
||||
# v_in = v_mat[2:end-1, 2:end-1]
|
||||
|
||||
# fu = p.Du * Δu .+ u_in .- u_in .^ 3 ./ 3 .- v_in
|
||||
# fv = p.Dv * Δv .+ p.ϵ * (u_in .+ p.a .- p.b .* v_in)
|
||||
|
||||
# # Construct output with zero boundary (padding)
|
||||
# fu_full = zeros(N, N)
|
||||
# fv_full = zeros(N, N)
|
||||
# fu_full[2:end-1, 2:end-1] .= fu
|
||||
# fv_full[2:end-1, 2:end-1] .= fv
|
||||
|
||||
# du .= vcat(vec(fu_full), vec(fv_full))
|
||||
# end
|
||||
|
||||
# function step_fhn!(U, V, params_obs::Observable; dx=1)
|
||||
# p = params_obs[]
|
||||
|
||||
# # Flatten initial condition (activation u, recovery v)
|
||||
# u0 = vec(U)
|
||||
# v0 = vec(V)
|
||||
# u_init = vcat(u0, v0)
|
||||
|
||||
# # Define one integration step using your fhn! function
|
||||
# prob = ODEProblem((du, u, p, t) -> fhn!(du, u, p, t), u_init, (0.0, 0.1), p)
|
||||
# sol = solve(prob, BS3(); save_start=false, saveat=10.0)
|
||||
|
||||
# # Extract solution and reshape
|
||||
# u_new = reshape(sol[end][1:p.N^2], p.N, p.N)
|
||||
# v_new = reshape(sol[end][p.N^2+1:end], p.N, p.N)
|
||||
|
||||
# # Update matrices in-place
|
||||
# U .= u_new
|
||||
# V .= v_new
|
||||
|
||||
# # Apply periodic boundary conditions
|
||||
# U[1, :] .= U[end-1, :]
|
||||
# U[end, :] .= U[2, :]
|
||||
# U[:, 1] .= U[:, end-1]
|
||||
# U[:, end] .= U[:, 2]
|
||||
|
||||
# V[1, :] .= V[end-1, :]
|
||||
# V[end, :] .= V[2, :]
|
||||
# V[:, 1] .= V[:, end-1]
|
||||
# V[:, end] .= V[:, 2]
|
||||
|
||||
# return U
|
||||
# end
|
||||
function step_fhn!(U, V, params_obs::Observable; dx=1, dt=0.01)
|
||||
p = params_obs[]
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ function build_ui(U, V, param_obs_map::NamedTuple, params_obs, heat_obs)
|
|||
|
||||
on(btn_reset.clicks) do _
|
||||
running[] = false
|
||||
hm.colormap[] = :viridis
|
||||
hm.colormap[] = :seismic
|
||||
reset!(U, V, heat_obs)
|
||||
|
||||
end
|
||||
|
|
@ -174,7 +174,7 @@ function build_ui(U, V, param_obs_map::NamedTuple, params_obs, heat_obs)
|
|||
# add column to center of matrix
|
||||
U, V = Templates.blocks_ic(params_obs[].N)
|
||||
|
||||
hm.colormap[] = :viridis
|
||||
hm.colormap[] = :seismic
|
||||
|
||||
# change params
|
||||
param_obs_map.Du[] = 0.0008
|
||||
|
|
|
|||
Loading…
Reference in New Issue