Skip to content

Commit

Permalink
- Add more docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
AkchurinDA committed Dec 26, 2024
1 parent ab37a9e commit 2c57320
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 53 deletions.
51 changes: 51 additions & 0 deletions docs/src/API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# API

## Types Used to Define a Model

```@docs
Model
Node
Material
Section
Element
```

## Types Used to Perform Analyses of Different Types and Store the Results

```@docs
LinearElasticAnalysis
LinearElasticAnalysisCache
ElasticBucklingAnalysis
ElasticBucklingAnalysisCache
FreeVibrationAnalysis
FreeVibrationAnalysisCache
```

## Functions Used to Define a Model

```@docs
node!
section!
material!
element!
concload!
distload!
```

## Functions Used to Perform Analyses of Different Types and Extract the Results

```@docs
solve
getnodedisp
getelementdisp_l
getelementdisp_g
getelementforces_l
getelementforces_g
```

## Functions Used to Plot a Model and the Results of Analyses of Different Types

```@docs
plotmodel
plotmodel!
```
30 changes: 30 additions & 0 deletions src/Analysis/Postprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ function getpartitionindices(model::Model)
return partitionindices
end

"""
getnodedisp(model::Model, solution::AbstractSolutionCache, ID::Int)
Extracts the displacement vector of a node of interest from the solution cache.
"""
getnodedisp(model::Model, solution::AbstractSolutionCache, ID::Int) = getnodedisp(model, solution.U, ID)
function getnodedisp(model::Model, U::AbstractVector{<:Real}, ID::Int)
# Find the index of the node in the model:
Expand All @@ -32,6 +37,11 @@ function getnodedisp(model::Model, U::AbstractVector{<:Real}, ID::Int)
return nodedisp
end

"""
getelementdisp_l(model::Model, solution::AbstractSolutionCache, ID::Int)
Extracts the displacement vector of an element of interest in the local coordinate system from the solution cache.
"""
getelementdisp_l(model::Model, solution::AbstractSolutionCache, ID::Int) = getelementdisp_l(model, solution.U, ID)
function getelementdisp_l(model::Model, U::AbstractVector{<:Real}, ID::Int)
# Find the element in the model:
Expand All @@ -51,6 +61,11 @@ function getelementdisp_l(model::Model, U::AbstractVector{<:Real}, ID::Int)
return elementdisp_l
end

"""
getelementdisp_g(model::Model, solution::AbstractSolutionCache, ID::Int)
Extracts the displacement vector of an element of interest in the global coordinate system from the solution cache.
"""
getelementdisp_g(model::Model, solution::AbstractSolutionCache, ID::Int) = getelementdisp_g(model, solution.U, ID)
function getelementdisp_g(model::Model, U::AbstractVector{<:Real}, ID::Int)
# Find the element in the model:
Expand All @@ -67,6 +82,11 @@ function getelementdisp_g(model::Model, U::AbstractVector{<:Real}, ID::Int)
return elementdisp_g
end

"""
getelementforces_l(model::Model, solution::AbstractSolutionCache, ID::Int)
Extracts the internal forces of an element of interest in the local coordinate system from the solution cache.
"""
getelementforces_l(model::Model, solution::AbstractSolutionCache, ID::Int) = getelementforces_l(model, solution.U, ID)
function getelementforces_l(model::Model, U::AbstractVector{<:Real}, ID::Int)
# Find the element in the model:
Expand All @@ -89,6 +109,11 @@ function getelementforces_l(model::Model, U::AbstractVector{<:Real}, ID::Int)
return elementforces_l
end

"""
getelementforces_g(model::Model, solution::AbstractSolutionCache, ID::Int)
Extracts the internal forces of an element of interest in the global coordinate system from the solution cache.
"""
getelementforces_g(model::Model, solution::AbstractSolutionCache, ID::Int) = getelementforces_g(model, solution.U, ID)
function getelementforces_g(model::Model, U::AbstractVector{<:Real}, ID::Int)
# Find the element in the model:
Expand Down Expand Up @@ -117,6 +142,11 @@ function getelementforces_g(model::Model, U::AbstractVector{<:Real}, ID::Int)
return elementforces_g
end

"""
getelementaxialload(model::Model, solution::AbstractSolutionCache, ID::Int)
Extracts the interal axial load of an element of interest from the solution cache.
"""
function getelementaxialload(model::Model, solution::AbstractSolutionCache, ID::Int)
# Extract the internal forces of the element:
elementforces_l = getelementforces_l(model, solution, ID)
Expand Down
13 changes: 12 additions & 1 deletion src/Utilities/Plotting.jl
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
function plotmodel end
"""
plotmodel(model::Model, [options])
Plots a model of a structure of interest ([`Model`](@ref)) into a new `Makie.jl` scene.
"""
function plotmodel end

"""
plotmodel!(scene::Scene, model::Model, [options])
Plots a model of a structure of interest ([`Model`](@ref)) into an existing `Makie.jl` scene.
"""
function plotmodel! end
52 changes: 0 additions & 52 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,55 +62,3 @@ using DifferentiationInterface, ForwardDiff, ReverseDiff
# Check the result:
@test Δ -0.609 atol = 1E-3
end

using Hephaestus

# Define an empty model:
model = Model()

# Define the nodes and DOF supports:
node!(model, 1, 0, 0, 0, u_x = true, u_y = true, u_z = true, θ_x = true, θ_y = true, θ_z = true)
node!(model, 2, 12, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 3, 24, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 4, 36, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 5, 48, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 6, 60, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 7, 72, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 8, 84, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 9, 96, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 10, 108, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 11, 120, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 12, 132, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 13, 144, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 14, 156, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 15, 168, 0, 0, u_z = true, θ_x = true, θ_y = true)
node!(model, 16, 180, 0, 0, u_z = true, θ_x = true, θ_y = true)

# Define the sections:
section!(model, 1, 10, 100, 100, 5)

# Define the materials:
material!(model, 1, 29000, 0.3, 0.290)

# Define the elements:
element!(model, 1, 1, 2, 1, 1)
element!(model, 2, 2, 3, 1, 1)
element!(model, 3, 3, 4, 1, 1)
element!(model, 4, 4, 5, 1, 1)
element!(model, 5, 5, 6, 1, 1)
element!(model, 6, 6, 7, 1, 1)
element!(model, 7, 7, 8, 1, 1)
element!(model, 8, 8, 9, 1, 1)
element!(model, 9, 9, 10, 1, 1)
element!(model, 10, 10, 11, 1, 1)
element!(model, 11, 11, 12, 1, 1)
element!(model, 12, 12, 13, 1, 1)
element!(model, 13, 13, 14, 1, 1)
element!(model, 14, 14, 15, 1, 1)
element!(model, 15, 15, 16, 1, 1)

# Define the loads:
concload!(model, 16, -100, 0, 0, 0, 0, 0)

# Solve the model using a linear elastic analysis:
solution = solve(model, FreeVibrationAnalysis())

0 comments on commit 2c57320

Please sign in to comment.