made docs foldable
parent
3fcfa16570
commit
aec9b33b38
|
|
@ -5,7 +5,7 @@ include("../src/visualization.jl")
|
||||||
using .Visualization
|
using .Visualization
|
||||||
|
|
||||||
N = 100
|
N = 100
|
||||||
tspan = (0.0, 100.0)
|
tspan = (0.0, 1000.0)
|
||||||
|
|
||||||
sol = AnimalFurFHN.run_simulation(tspan, N)
|
sol = AnimalFurFHN.run_simulation(tspan, N)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
"""
|
"""
|
||||||
laplacian(U::Matrix{Float64}, N::Int, h::Float64)
|
laplacian(U::Matrix{Float64}, N::Int, h::Float64)
|
||||||
|
|
||||||
Computes the discrete 2D Laplacian of a matrix `U` using a 5-point stencil
|
Computes the discrete 2D Laplacian of a matrix `U` using a 5-point stencil
|
||||||
and circular boundary conditions.
|
and circular boundary conditions.
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
- `U::Matrix{Float64}`: The input 2D matrix representing the field or image.
|
- `U::Matrix{Float64}`: The input 2D matrix representing the field or image.
|
||||||
- `N::Int`: Integer
|
- `N::Int`: Integer
|
||||||
- `h::Float64`: The spatial step size or grid spacing between points in the discretization.
|
- `h::Float64`: The spatial step size or grid spacing between points in the discretization.
|
||||||
|
|
||||||
# Returns
|
# Returns
|
||||||
- `Vector{Float64}`: A flattened (vectorized) representation of the approximated Laplacian values for each element in `U`. The boundary conditions are handled circularly.
|
- `Vector{Float64}`: A flattened (vectorized) representation of the approximated Laplacian values for each element in `U`. The boundary conditions are handled circularly.
|
||||||
"""
|
"""
|
||||||
function laplacian(U::Matrix{Float64}, N::Int, h::Float64)
|
function laplacian(U::Matrix{Float64}, N::Int, h::Float64)
|
||||||
# shifts matrices and sums them up
|
# shifts matrices and sums them up
|
||||||
|
|
|
||||||
|
|
@ -5,17 +5,17 @@ using .Constants
|
||||||
"""
|
"""
|
||||||
fhn(du, u, p:FHNParams, t:)
|
fhn(du, u, p:FHNParams, t:)
|
||||||
|
|
||||||
Implements the spatial dynamics of FitzHugh-Nagumo (fhn). Designed to be
|
Implements the spatial dynamics of FitzHugh-Nagumo (fhn). Designed to be
|
||||||
within a larger numerical solver of partial differential equations.
|
within a larger numerical solver of partial differential equations.
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
- `du`: output argument which stores the calculated derivatives
|
- `du`: output argument which stores the calculated derivatives
|
||||||
- `u`: input vector containing the current state of the system at time t
|
- `u`: input vector containing the current state of the system at time t
|
||||||
- `p`: holds all the fixed parameters of the FHN model
|
- `p`: holds all the fixed parameters of the FHN model
|
||||||
- `t`: current time
|
- `t`: current time
|
||||||
|
|
||||||
# Returns
|
# Returns
|
||||||
- `du`: calculated derivatives put back into the du array
|
- `du`: calculated derivatives put back into the du array
|
||||||
"""
|
"""
|
||||||
function fhn!(du, u, p::FHNParams, t = 0)
|
function fhn!(du, u, p::FHNParams, t = 0)
|
||||||
u_mat = reshape(u[1:p.N^2], p.N, p.N) # activation variable
|
u_mat = reshape(u[1:p.N^2], p.N, p.N) # activation variable
|
||||||
|
|
@ -33,14 +33,14 @@ end
|
||||||
"""
|
"""
|
||||||
run_simulation(tspan::Tuple{Float64,Float64}, N::Int)
|
run_simulation(tspan::Tuple{Float64,Float64}, N::Int)
|
||||||
|
|
||||||
solving the ODE and modelling it after FHN
|
solving the ODE and modelling it after FHN
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
- `tspan`: tuple of two Float64's representing start and end times for simulation
|
- `tspan`: tuple of two Float64's representing start and end times for simulation
|
||||||
- `N`: size of the N×N grid
|
- `N`: size of the N×N grid
|
||||||
|
|
||||||
# Returns
|
# Returns
|
||||||
- `sol`: solved differential equation (ODE)
|
- `sol`: solved differential equation (ODE)
|
||||||
"""
|
"""
|
||||||
function run_simulation(tspan::Tuple{Float64,Float64}, N::Int)
|
function run_simulation(tspan::Tuple{Float64,Float64}, N::Int)
|
||||||
# Turing-spot parameters
|
# Turing-spot parameters
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@ using GLMakie
|
||||||
"""
|
"""
|
||||||
step_through_solution(sol::SolutionType, N::Int)
|
step_through_solution(sol::SolutionType, N::Int)
|
||||||
|
|
||||||
Function for visualization for the output of run_simulation
|
Function for visualization for the output of run_simulation
|
||||||
|
|
||||||
# Arguments
|
# Arguments
|
||||||
- `sol`: computed differential equation by run_simulation
|
- `sol`: computed differential equation by run_simulation
|
||||||
- `N`: size of the N×N grid
|
- `N`: size of the N×N grid
|
||||||
|
|
||||||
# Returns
|
# Returns
|
||||||
- ``: Displays created figure
|
- ``: Displays created figure
|
||||||
"""
|
"""
|
||||||
function step_through_solution(sol, N::Int)
|
function step_through_solution(sol, N::Int)
|
||||||
fig = Figure(resolution=(600, 600))
|
fig = Figure(resolution=(600, 600))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue