Skip to content

Commit

Permalink
Merge branch 'main' into compathelper/new_version/2024-01-06-00-46-13…
Browse files Browse the repository at this point in the history
…-136-00252389865
  • Loading branch information
cfarm6 authored Jan 17, 2024
2 parents 39f664b + 6b99305 commit 4443f4e
Show file tree
Hide file tree
Showing 19 changed files with 476 additions and 136 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ jobs:
julia --project=docs/ -e '
using Pkg
Pkg.develop([
PackageSpec(path=pwd()),
PackageSpec(url="https://github.com/cfarm6/ContinuumMechanicsBase.jl.git"),
PackageSpec(url="https://github.com/cfarm6/InverseLangevinApproximations.jl.git"),
PackageSpec(path=pwd()),
])
Pkg.instantiate()
Pkg.update()'
Expand Down
10 changes: 4 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Hyperelastics"
uuid = "c20c605d-adbe-46e4-9db6-e2b04c3ba023"
authors = ["Carson Farmer"]
version = "0.1.0"
version = "0.1.1"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand All @@ -16,7 +16,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LossFunctions = "30fc2ffe-d236-52d8-8643-a9d8f7c094a7"
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Expand Down Expand Up @@ -52,15 +51,14 @@ ComponentArrays = "0.15"
ContinuumMechanicsBase = "0.1"
DataInterpolations = "4"
DocStringExtensions = "0.9"
Integrals = "3"
InverseLangevinApproximations = "0.1"
Integrals = "4"
InverseLangevinApproximations = "0.2"
LabelledArrays = "1"
LossFunctions = "0.11"
PackageExtensionCompat = "1"
QuadGK = "2"
RecursiveArrayTools = "2"
Reexport = "1"
SciMLBase = "1, 2"
SciMLBase = "2"
SpecialFunctions = "2"
StructArrays = "0.6"
Unitful = "1"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Hyperelastics
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://cfarm6.github.io/Hyperelastics.jl/stable) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://cfarm6.github.io/Hyperelastics.jl/dev)
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://TRACER-LULab.github.io/Hyperelastics.jl/stable) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://TRACER-LULab.github.io/Hyperelastics.jl/dev)
[![codecov](https://codecov.io/gh/TRACER-LULab/Hyperelastics.jl/graph/badge.svg?token=EML9TQUEP9)](https://codecov.io/gh/TRACER-LULab/Hyperelastics.jl)


Expand Down
6 changes: 1 addition & 5 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
[deps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
ContinuumMechanicsBase = "3a778109-d974-46c8-ac54-09f30d605bdf"
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Hyperelastics = "c20c605d-adbe-46e4-9db6-e2b04c3ba023"
InverseLangevinApproximations = "b82787f2-62be-403e-9078-6d9feafd7ee3"
MakiePublication = "dde8697e-0d61-460d-88dd-856f66710dd1"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"

[compat]
CairoMakie = "0.10"
ComponentArrays = "0.15"
ContinuumMechanicsBase = "0.1"
DataInterpolations = "4"
Documenter = "1"
DocumenterCitations = "1"
ForwardDiff = "0.10"
InverseLangevinApproximations = "0.1"
MakiePublication = "0.3"
Optimization = "3"
OptimizationOptimJL = "0.1, 0.2"
OptimizationOptimJL = "0.2"
23 changes: 12 additions & 11 deletions docs/src/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ using Optimization, OptimizationOptimJL
using ComponentArrays: ComponentVector
using ForwardDiff
using CairoMakie, MakiePublication
set_theme!(theme_web(width = 800))
set_theme!(theme_latexfonts())
```

For commonly used datasets in hyperelastic modelling, such as the `Treloar1944Uniaxial` data, functions are available for getting the datasets:

```@example 1
f = Figure()
ax = Makie.Axis(f[1,1])
f = Figure(size = (800,800))
ax = Makie.Axis(f[1,1], xlabel = "Stretch [-]", ylabel = "Stress [kg/cm²]")
treloar_data = Treloar1944Uniaxial()
scatter!(ax,
getindex.(treloar_data.data.λ, 1),
Expand Down Expand Up @@ -58,16 +58,15 @@ For fiting multiple models to the same dataset,

```@example 1
models = Dict(
Gent => ComponentVector(μ=240e-3, Jₘ=80.0),
Gent => ComponentVector(μ=240e-3, J_m=80.0),
EdwardVilgis => ComponentVector(Ns=0.10, Nc=0.20, α=0.001, η=0.001),
NeoHookean => ComponentVector(μ=200e-3),
NonaffineMicroSphere => ComponentVector(μ=0.292, N=22.5, p=1.471, U=0.744, q=0.1086),
Beda => ComponentVector(C1=0.1237, C2=0.0424, C3=7.84e-5, K1=0.0168, α=0.9, β=0.68, ζ=3.015)
)
sol = Dict{Any, SciMLSolution}()
for (ψ, p₀) in models
HEProblem = HyperelasticProblem(ψ(), treloar_data, p₀, ad_type = AutoForwardDiff())
for (ψ, p_0) in models
HEProblem = HyperelasticProblem(ψ(), treloar_data, p_0, ad_type = AutoForwardDiff())
sol[ψ] = solve(HEProblem, NelderMead())
end
return sol # hide
Expand All @@ -76,8 +75,8 @@ return sol # hide
To predict the reponse of a model to a proivded dataset and parameters, a `predict` function is provided:

```@example 1
f = Figure()
ax = Makie.Axis(f[1,1])
f = Figure(size = (800,800))
ax = Makie.Axis(f[1,1], xlabel = "Stretch [-]", ylabel = "Stress [kg/cm²]")
for (ψ, p) in sol
pred = predict(ψ(), treloar_data, p.u, ad_type = AutoForwardDiff())
lines!(ax, getindex.(pred.data.λ, 1), getindex.(pred.data.s, 1), label=string(ψ))
Expand All @@ -102,8 +101,10 @@ s₁ = getindex.(treloar_data.data.s, 1)
λ̂₁ = getindex.(pred.data.λ, 1)
ŝ₁ = getindex.(pred.data.s, 1)
f, ax, p = lines(
f = Figure(size = (800,800))
ax = Makie.Axis(f[1,1], xlabel = "Stretch [-]", ylabel = "Stress [kg/cm²]")
lines!(
ax,
λ̂₁,
ŝ₁,
label = "Sussman-Bathe Approximation"
Expand Down
1 change: 1 addition & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
LossFunctions = "30fc2ffe-d236-52d8-8643-a9d8f7c094a7"
MCMCChains = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
MakieCore = "20f20a25-4f0e-4fdf-b5d1-57303727442b"
MakiePublication = "dde8697e-0d61-460d-88dd-856f66710dd1"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Expand Down
Binary file added joss/media/sussman_bathe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added joss/media/treloar_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added joss/media/treloar_data_fits.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 21 additions & 14 deletions joss/paper.bib
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
@software{matAdi2023,
author = {Andreas Dutzler},
title = {matADi: Material Definition with Automatic Differentiation},
url = {https://github.com/adtzlr/matadi},
year = {2023}
}

@article{Bezanson2017,
author = {Bezanson, Jeff and Edelman, Alan and Karpinski, Stefan and Shah, Viral B.},
title = {{J}ulia: A Fresh Approach to Numerical Computing},
journal = {SIAM Review},
volume = {59},
number = {1},
pages = {65-98},
year = {2017},
doi = {10.1137/141000671},
url = {
https://doi.org/10.1137/141000671
},
eprint = {
https://doi.org/10.1137/141000671
},
author = {Bezanson, Jeff and Edelman, Alan and Karpinski, Stefan and Shah, Viral B.},
title = {{J}ulia: A Fresh Approach to Numerical Computing},
journal = {SIAM Review},
volume = {59},
number = {1},
pages = {65-98},
year = {2017},
doi = {10.1137/141000671},
url = {
https://doi.org/10.1137/141000671
},
eprint = {
https://doi.org/10.1137/141000671
}
}

@article{mooney1940theory,
Expand Down
Loading

0 comments on commit 4443f4e

Please sign in to comment.