From 5eedbd78a51df2509b33ac60286b65a57d53ef68 Mon Sep 17 00:00:00 2001 From: singularitti Date: Fri, 13 Oct 2023 01:44:08 -0400 Subject: [PATCH 1/5] Add module `EffectiveModuli` with `bulk_modulus` & `shear_modulus` --- src/EffectiveModuli.jl | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/EffectiveModuli.jl diff --git a/src/EffectiveModuli.jl b/src/EffectiveModuli.jl new file mode 100644 index 0000000..27361b8 --- /dev/null +++ b/src/EffectiveModuli.jl @@ -0,0 +1,36 @@ +module EffectiveModuli + +abstract type Model end +struct Voigt <: Model end +struct Reuss <: Model end +struct VoigtReussHill <: Model end + +bulk_modulus(c::StiffnessMatrix, ::Voigt) = + (c[1, 1] + c[2, 2] + c[3, 3] + 2(c[1, 2] + c[2, 3] + c[3, 1])) / 9 +bulk_modulus(s::ComplianceMatrix, ::Voigt) = bulk_modulus(inv(s), Voigt()) +bulk_modulus(s::ComplianceMatrix, ::Reuss) = + inv(s[1, 1] + s[2, 2] + s[3, 3] + 2(s[1, 2] + s[2, 3] + s[3, 1])) +bulk_modulus(c::StiffnessMatrix, ::Reuss) = bulk_modulus(inv(c), Voigt()) +bulk_modulus(c::StiffnessMatrix, ::VoigtReussHill) = + (bulk_modulus(c, Voigt()) + bulk_modulus(inv(c), Reuss())) / 2 +bulk_modulus(s::ComplianceMatrix, ::VoigtReussHill) = + (bulk_modulus(inv(s), Voigt()) + bulk_modulus(s, Reuss())) / 2 + +shear_modulus(c::StiffnessMatrix, ::Voigt) = + ( + c[1, 1] + c[2, 2] + c[3, 3] - (c[1, 2] + c[2, 3] + c[3, 1]) + + 3(c[4, 4] + c[5, 5] + c[6, 6]) + ) / 15 +shear_modulus(s::ComplianceMatrix, ::Voigt) = shear_modulus(inv(s), Voigt()) +shear_modulus(s::ComplianceMatrix, ::Reuss) = + inv( + 4(s[1, 1] + s[2, 2] + s[3, 3] - (s[1, 2] + s[2, 3] + s[3, 1])) + + 3(s[4, 4] + s[5, 5] + s[6, 6]), + ) * 15 +shear_modulus(c::StiffnessMatrix, ::Reuss) = shear_modulus(inv(c), Voigt()) +shear_modulus(c::StiffnessMatrix, ::VoigtReussHill) = + (shear_modulus(c, Voigt()) + shear_modulus(inv(c), Reuss())) / 2 +shear_modulus(s::ComplianceMatrix, ::VoigtReussHill) = + (shear_modulus(inv(s), Voigt()) + shear_modulus(s, Reuss())) / 2 + +end From 145c714e7298a53ffe85a89ea0a74158fddcfb55 Mon Sep 17 00:00:00 2001 From: singularitti Date: Fri, 13 Oct 2023 01:46:01 -0400 Subject: [PATCH 2/5] Fix exports --- src/EffectiveModuli.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/EffectiveModuli.jl b/src/EffectiveModuli.jl index 27361b8..4b08c36 100644 --- a/src/EffectiveModuli.jl +++ b/src/EffectiveModuli.jl @@ -1,5 +1,9 @@ module EffectiveModuli +import ..Isotropic: bulk_modulus, shear_modulus + +export Voigt, Reuss, VoigtReussHill, bulk_modulus, shear_modulus + abstract type Model end struct Voigt <: Model end struct Reuss <: Model end From 949434c35736b6679ea23a65acdce4012aff46be Mon Sep 17 00:00:00 2001 From: singularitti Date: Fri, 13 Oct 2023 01:46:11 -0400 Subject: [PATCH 3/5] Include code --- src/LinearElasticity.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/LinearElasticity.jl b/src/LinearElasticity.jl index 44e8871..dea71b4 100644 --- a/src/LinearElasticity.jl +++ b/src/LinearElasticity.jl @@ -7,6 +7,7 @@ using Reexport: @reexport include("Symmetry.jl") # include("Stability.jl") include("Isotropic.jl") +include("EffectiveModuli.jl") include("misc.jl") include("Solve/Solve.jl") include("ULICS.jl") From 6f678a52cbbfd62ed18225a0c8c97d707b49b1b8 Mon Sep 17 00:00:00 2001 From: singularitti Date: Fri, 13 Oct 2023 01:47:16 -0400 Subject: [PATCH 4/5] Fix imports in src/EffectiveModuli.jl --- src/EffectiveModuli.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/EffectiveModuli.jl b/src/EffectiveModuli.jl index 4b08c36..54a1b54 100644 --- a/src/EffectiveModuli.jl +++ b/src/EffectiveModuli.jl @@ -1,5 +1,7 @@ module EffectiveModuli +using ..LinearElasticity: StiffnessMatrix, ComplianceMatrix + import ..Isotropic: bulk_modulus, shear_modulus export Voigt, Reuss, VoigtReussHill, bulk_modulus, shear_modulus From d2ae2a87f681f0a6c315979e553694b276badb5a Mon Sep 17 00:00:00 2001 From: singularitti Date: Fri, 13 Oct 2023 01:55:48 -0400 Subject: [PATCH 5/5] Add docs to `bulk_modulus` & `shear_modulus` --- src/EffectiveModuli.jl | 58 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/EffectiveModuli.jl b/src/EffectiveModuli.jl index 54a1b54..0f001d9 100644 --- a/src/EffectiveModuli.jl +++ b/src/EffectiveModuli.jl @@ -11,29 +11,87 @@ struct Voigt <: Model end struct Reuss <: Model end struct VoigtReussHill <: Model end +""" + bulk_modulus(c::StiffnessMatrix, ::Voigt) + bulk_modulus(s::ComplianceMatrix, ::Voigt) + +Calculate the bulk modulus of a material from its stiffness matrix by: + +```math +K_V = \\frac{c_{11} + c_{22} + c_{33} + 2(c_{12} + c_{23} + c_{31})}{9}. +``` +""" bulk_modulus(c::StiffnessMatrix, ::Voigt) = (c[1, 1] + c[2, 2] + c[3, 3] + 2(c[1, 2] + c[2, 3] + c[3, 1])) / 9 bulk_modulus(s::ComplianceMatrix, ::Voigt) = bulk_modulus(inv(s), Voigt()) +""" + bulk_modulus(s::ComplianceMatrix, ::Reuss) + bulk_modulus(c::StiffnessMatrix, ::Reuss) + +Calculate the bulk modulus of a material from its compliance matrix by: + +```math +K_R = \\frac{1}{s_{11} + s_{22} + s_{33} + 2(s_{12} + s_{23} + s_{31})}. +``` +""" bulk_modulus(s::ComplianceMatrix, ::Reuss) = inv(s[1, 1] + s[2, 2] + s[3, 3] + 2(s[1, 2] + s[2, 3] + s[3, 1])) bulk_modulus(c::StiffnessMatrix, ::Reuss) = bulk_modulus(inv(c), Voigt()) +""" + bulk_modulus(c::StiffnessMatrix, ::VoigtReussHill) + bulk_modulus(s::ComplianceMatrix, ::VoigtReussHill) + +Calculate the bulk modulus of a material from its stiffness or compliance matrix by: + +```math +K_{VRH} = \\frac{K_V + K_R}{2}. +``` +""" bulk_modulus(c::StiffnessMatrix, ::VoigtReussHill) = (bulk_modulus(c, Voigt()) + bulk_modulus(inv(c), Reuss())) / 2 bulk_modulus(s::ComplianceMatrix, ::VoigtReussHill) = (bulk_modulus(inv(s), Voigt()) + bulk_modulus(s, Reuss())) / 2 +""" + shear_modulus(c::StiffnessMatrix, ::Voigt) + +Calculate the shear modulus of a material from its stiffness matrix by: + +```math +G_V = \\frac{(c_{11} + c_{22} + c_{33}) - (c_{12} + c_{23} + c_{31}) + 3(c_{44} + c_{55} + c_{66})}{15}. +``` +""" shear_modulus(c::StiffnessMatrix, ::Voigt) = ( c[1, 1] + c[2, 2] + c[3, 3] - (c[1, 2] + c[2, 3] + c[3, 1]) + 3(c[4, 4] + c[5, 5] + c[6, 6]) ) / 15 shear_modulus(s::ComplianceMatrix, ::Voigt) = shear_modulus(inv(s), Voigt()) +""" + shear_modulus(s::ComplianceMatrix, ::Reuss) + +Calculate the shear modulus of a material from its compliance matrix by: + +```math +G_R = \\frac{15}{4(s_{11} + s_{22} + s_{33}) - 4(s_{12} + s_{23} + s_{31}) + 3(s_{44} + s_{55} + s_{66})}. +``` +""" shear_modulus(s::ComplianceMatrix, ::Reuss) = inv( 4(s[1, 1] + s[2, 2] + s[3, 3] - (s[1, 2] + s[2, 3] + s[3, 1])) + 3(s[4, 4] + s[5, 5] + s[6, 6]), ) * 15 shear_modulus(c::StiffnessMatrix, ::Reuss) = shear_modulus(inv(c), Voigt()) +""" + shear_modulus(c::StiffnessMatrix, ::VoigtReussHill) + shear_modulus(s::ComplianceMatrix, ::VoigtReussHill) + +Calculate the shear modulus of a material from its stiffness or compliance matrix by: + +```math +G_{VRH} = \\frac{G_V + G_R}{2}. +``` +""" shear_modulus(c::StiffnessMatrix, ::VoigtReussHill) = (shear_modulus(c, Voigt()) + shear_modulus(inv(c), Reuss())) / 2 shear_modulus(s::ComplianceMatrix, ::VoigtReussHill) =