From aec9b33b38774ec38c29641cf9eaf4c4d0510131 Mon Sep 17 00:00:00 2001 From: 2211567 Date: Sat, 31 May 2025 13:51:23 +0200 Subject: [PATCH] made docs foldable --- scripts/run_simulation.jl | 2 +- src/laplacian.jl | 16 ++++++++-------- src/solver.jl | 30 +++++++++++++++--------------- src/visualization.jl | 12 ++++++------ 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/scripts/run_simulation.jl b/scripts/run_simulation.jl index bc65ee4..3e43bb4 100644 --- a/scripts/run_simulation.jl +++ b/scripts/run_simulation.jl @@ -5,7 +5,7 @@ include("../src/visualization.jl") using .Visualization N = 100 -tspan = (0.0, 100.0) +tspan = (0.0, 1000.0) sol = AnimalFurFHN.run_simulation(tspan, N) diff --git a/src/laplacian.jl b/src/laplacian.jl index 5b1cb3c..f9f4965 100644 --- a/src/laplacian.jl +++ b/src/laplacian.jl @@ -1,16 +1,16 @@ """ laplacian(U::Matrix{Float64}, N::Int, h::Float64) -Computes the discrete 2D Laplacian of a matrix `U` using a 5-point stencil -and circular boundary conditions. + Computes the discrete 2D Laplacian of a matrix `U` using a 5-point stencil + and circular boundary conditions. -# Arguments -- `U::Matrix{Float64}`: The input 2D matrix representing the field or image. -- `N::Int`: Integer -- `h::Float64`: The spatial step size or grid spacing between points in the discretization. + # Arguments + - `U::Matrix{Float64}`: The input 2D matrix representing the field or image. + - `N::Int`: Integer + - `h::Float64`: The spatial step size or grid spacing between points in the discretization. -# Returns -- `Vector{Float64}`: A flattened (vectorized) representation of the approximated Laplacian values for each element in `U`. The boundary conditions are handled circularly. + # Returns + - `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) # shifts matrices and sums them up diff --git a/src/solver.jl b/src/solver.jl index 1b2787b..e40ed47 100644 --- a/src/solver.jl +++ b/src/solver.jl @@ -5,17 +5,17 @@ using .Constants """ 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. + 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 + # 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 + # Returns + - `du`: calculated derivatives put back into the du array """ function fhn!(du, u, p::FHNParams, t = 0) 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) -solving the ODE and modelling it after FHN + solving the ODE and modelling it after FHN -# Arguments -- `tspan`: tuple of two Float64's representing start and end times for simulation -- `N`: size of the N×N grid + # Arguments + - `tspan`: tuple of two Float64's representing start and end times for simulation + - `N`: size of the N×N grid -# Returns -- `sol`: solved differential equation (ODE) + # Returns + - `sol`: solved differential equation (ODE) """ function run_simulation(tspan::Tuple{Float64,Float64}, N::Int) # Turing-spot parameters diff --git a/src/visualization.jl b/src/visualization.jl index a62460d..7f1514a 100644 --- a/src/visualization.jl +++ b/src/visualization.jl @@ -4,14 +4,14 @@ using GLMakie """ 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 -- `sol`: computed differential equation by run_simulation -- `N`: size of the N×N grid + # Arguments + - `sol`: computed differential equation by run_simulation + - `N`: size of the N×N grid -# Returns -- ``: Displays created figure + # Returns + - ``: Displays created figure """ function step_through_solution(sol, N::Int) fig = Figure(resolution=(600, 600))