Symbolic Material Notebook

[1]:
import sympy as sp

from mechpy.core.symbolic.material import (
    SymbolicIsotropicMaterial,
    SymbolicTransverseIsotropicMaterial,
    SymbolicOrthotropicMaterial,

)

Symbolic Material

Isotropic Material

[2]:
E, nu = sp.symbols("E nu")
symbolic_isotropic_material = SymbolicIsotropicMaterial(E=E, nu=nu)
display(symbolic_isotropic_material)
SymbolicIsotropicMaterial(E=E, nu=nu)
[3]:
compliance_tensor = symbolic_isotropic_material.compliance_tensor()
display(compliance_tensor.data)
$\displaystyle \left[\begin{matrix}\frac{1}{E} & - \frac{\nu}{E} & - \frac{\nu}{E} & 0 & 0 & 0\\- \frac{\nu}{E} & \frac{1}{E} & - \frac{\nu}{E} & 0 & 0 & 0\\- \frac{\nu}{E} & - \frac{\nu}{E} & \frac{1}{E} & 0 & 0 & 0\\0 & 0 & 0 & \frac{2 \left(\nu + 1\right)}{E} & 0 & 0\\0 & 0 & 0 & 0 & \frac{2 \left(\nu + 1\right)}{E} & 0\\0 & 0 & 0 & 0 & 0 & \frac{2 \left(\nu + 1\right)}{E}\end{matrix}\right]$

Using Lamé parameters

[4]:
lamda, mu = sp.symbols("lamda mu")
symbolic_isotropic_material = SymbolicIsotropicMaterial(lamda=lamda, mu=mu)
display(symbolic_isotropic_material)
SymbolicIsotropicMaterial(lamda=lamda, mu=mu)
[5]:
stiffness_tensor = symbolic_isotropic_material.stiffness_tensor()
display(stiffness_tensor.data)
compliance_tensor = symbolic_isotropic_material.compliance_tensor()
display(compliance_tensor.data)
$\displaystyle \left[\begin{matrix}\lambda + 2 \mu & \lambda & \lambda & 0 & 0 & 0\\\lambda & \lambda + 2 \mu & \lambda & 0 & 0 & 0\\\lambda & \lambda & \lambda + 2 \mu & 0 & 0 & 0\\0 & 0 & 0 & \mu & 0 & 0\\0 & 0 & 0 & 0 & \mu & 0\\0 & 0 & 0 & 0 & 0 & \mu\end{matrix}\right]$
$\displaystyle \left[\begin{matrix}\frac{\lambda + \mu}{\mu \left(3 \lambda + 2 \mu\right)} & - \frac{\lambda}{2 \mu \left(3 \lambda + 2 \mu\right)} & - \frac{\lambda}{2 \mu \left(3 \lambda + 2 \mu\right)} & 0 & 0 & 0\\- \frac{\lambda}{2 \mu \left(3 \lambda + 2 \mu\right)} & \frac{\lambda + \mu}{\mu \left(3 \lambda + 2 \mu\right)} & - \frac{\lambda}{2 \mu \left(3 \lambda + 2 \mu\right)} & 0 & 0 & 0\\- \frac{\lambda}{2 \mu \left(3 \lambda + 2 \mu\right)} & - \frac{\lambda}{2 \mu \left(3 \lambda + 2 \mu\right)} & \frac{\lambda + \mu}{\mu \left(3 \lambda + 2 \mu\right)} & 0 & 0 & 0\\0 & 0 & 0 & \frac{1}{\mu} & 0 & 0\\0 & 0 & 0 & 0 & \frac{1}{\mu} & 0\\0 & 0 & 0 & 0 & 0 & \frac{1}{\mu}\end{matrix}\right]$

Transverse Isotropic Material

[6]:
material_props = {
    "E_L": sp.symbols("E_L"),
    "E_T": sp.symbols("E_T"),
    "nu": sp.symbols("nu"),
    "G_L": sp.symbols("G_L"),
    "G_T": sp.symbols("G_T"),
}
display(material_props)
symbolic_transverse_isotropic_material = SymbolicTransverseIsotropicMaterial(**material_props)
display(symbolic_transverse_isotropic_material)
{'E_L': E_L, 'E_T': E_T, 'nu': nu, 'G_L': G_L, 'G_T': G_T}
SymbolicTransverseIsotropicMaterial(E_L=E_L, E_T=E_T, nu=nu, G_L=G_L, G_T=G_T)
[7]:
stiffness_tensor = symbolic_transverse_isotropic_material.stiffness_tensor()
display(stiffness_tensor.data)
$\displaystyle \left[\begin{matrix}- \frac{E_{L}}{\nu^{2} - 1} & - \frac{E_{L} \nu}{\nu - 1} & - \frac{E_{L} \nu}{\nu - 1} & 0 & 0 & 0\\- \frac{E_{L} \nu}{\nu - 1} & - \frac{E_{L}}{\nu^{2} - 1} & - \frac{E_{L} \nu}{\nu - 1} & 0 & 0 & 0\\- \frac{E_{L} \nu}{\nu - 1} & - \frac{E_{L} \nu}{\nu - 1} & E_{T} & 0 & 0 & 0\\0 & 0 & 0 & G_{L} & 0 & 0\\0 & 0 & 0 & 0 & G_{L} & 0\\0 & 0 & 0 & 0 & 0 & G_{T}\end{matrix}\right]$

Orthotropic Material

[8]:
material_props = {_:sp.symbols(_) for _ in SymbolicOrthotropicMaterial.props_keys}
display(material_props)
symbolic_orthotropic_material = SymbolicOrthotropicMaterial(**material_props)
display(symbolic_orthotropic_material)
{'E2': E2,
 'nu23': nu23,
 'G31': G31,
 'G12': G12,
 'nu12': nu12,
 'E3': E3,
 'G23': G23,
 'nu31': nu31,
 'E1': E1}
SymbolicOrthotropicMaterial(E1=E1, E2=E2, E3=E3, G12=G12, G23=G23, G31=G31, nu12=nu12, nu23=nu23, nu31=nu31)
[9]:
stiffness_tensor = symbolic_orthotropic_material.stiffness_tensor()
display(stiffness_tensor.data)
compliance_tensor = symbolic_orthotropic_material.compliance_tensor()
display(compliance_tensor.data)
$\displaystyle \left[\begin{matrix}E_{1} & E_{2} \nu_{12} & E_{1} \nu_{31} & 0 & 0 & 0\\E_{2} \nu_{12} & E_{2} & E_{3} \nu_{23} & 0 & 0 & 0\\E_{1} \nu_{31} & E_{3} \nu_{23} & E_{3} & 0 & 0 & 0\\0 & 0 & 0 & G_{23} & 0 & 0\\0 & 0 & 0 & 0 & G_{31} & 0\\0 & 0 & 0 & 0 & 0 & G_{12}\end{matrix}\right]$
$\displaystyle \left[\begin{matrix}\frac{E_{3} \left(- E_{2} + E_{3} \nu_{23}^{2}\right)}{E_{1}^{2} E_{2} \nu_{31}^{2} - 2 E_{1} E_{2} E_{3} \nu_{12} \nu_{23} \nu_{31} - E_{1} E_{2} E_{3} + E_{1} E_{3}^{2} \nu_{23}^{2} + E_{2}^{2} E_{3} \nu_{12}^{2}} & \frac{E_{3} \left(- E_{1} \nu_{23} \nu_{31} + E_{2} \nu_{12}\right)}{E_{1}^{2} E_{2} \nu_{31}^{2} - 2 E_{1} E_{2} E_{3} \nu_{12} \nu_{23} \nu_{31} - E_{1} E_{2} E_{3} + E_{1} E_{3}^{2} \nu_{23}^{2} + E_{2}^{2} E_{3} \nu_{12}^{2}} & \frac{E_{2} \left(E_{1} \nu_{31} - E_{3} \nu_{12} \nu_{23}\right)}{E_{1}^{2} E_{2} \nu_{31}^{2} - 2 E_{1} E_{2} E_{3} \nu_{12} \nu_{23} \nu_{31} - E_{1} E_{2} E_{3} + E_{1} E_{3}^{2} \nu_{23}^{2} + E_{2}^{2} E_{3} \nu_{12}^{2}} & 0 & 0 & 0\\\frac{E_{3} \left(- E_{1} \nu_{23} \nu_{31} + E_{2} \nu_{12}\right)}{E_{1}^{2} E_{2} \nu_{31}^{2} - 2 E_{1} E_{2} E_{3} \nu_{12} \nu_{23} \nu_{31} - E_{1} E_{2} E_{3} + E_{1} E_{3}^{2} \nu_{23}^{2} + E_{2}^{2} E_{3} \nu_{12}^{2}} & \frac{E_{1} \left(E_{1} \nu_{31}^{2} - E_{3}\right)}{E_{1}^{2} E_{2} \nu_{31}^{2} - 2 E_{1} E_{2} E_{3} \nu_{12} \nu_{23} \nu_{31} - E_{1} E_{2} E_{3} + E_{1} E_{3}^{2} \nu_{23}^{2} + E_{2}^{2} E_{3} \nu_{12}^{2}} & \frac{E_{1} \left(- E_{2} \nu_{12} \nu_{31} + E_{3} \nu_{23}\right)}{E_{1}^{2} E_{2} \nu_{31}^{2} - 2 E_{1} E_{2} E_{3} \nu_{12} \nu_{23} \nu_{31} - E_{1} E_{2} E_{3} + E_{1} E_{3}^{2} \nu_{23}^{2} + E_{2}^{2} E_{3} \nu_{12}^{2}} & 0 & 0 & 0\\\frac{E_{2} \left(E_{1} \nu_{31} - E_{3} \nu_{12} \nu_{23}\right)}{E_{1}^{2} E_{2} \nu_{31}^{2} - 2 E_{1} E_{2} E_{3} \nu_{12} \nu_{23} \nu_{31} - E_{1} E_{2} E_{3} + E_{1} E_{3}^{2} \nu_{23}^{2} + E_{2}^{2} E_{3} \nu_{12}^{2}} & \frac{E_{1} \left(- E_{2} \nu_{12} \nu_{31} + E_{3} \nu_{23}\right)}{E_{1}^{2} E_{2} \nu_{31}^{2} - 2 E_{1} E_{2} E_{3} \nu_{12} \nu_{23} \nu_{31} - E_{1} E_{2} E_{3} + E_{1} E_{3}^{2} \nu_{23}^{2} + E_{2}^{2} E_{3} \nu_{12}^{2}} & \frac{E_{2} \left(- E_{1} + E_{2} \nu_{12}^{2}\right)}{E_{1}^{2} E_{2} \nu_{31}^{2} - 2 E_{1} E_{2} E_{3} \nu_{12} \nu_{23} \nu_{31} - E_{1} E_{2} E_{3} + E_{1} E_{3}^{2} \nu_{23}^{2} + E_{2}^{2} E_{3} \nu_{12}^{2}} & 0 & 0 & 0\\0 & 0 & 0 & \frac{1}{G_{23}} & 0 & 0\\0 & 0 & 0 & 0 & \frac{1}{G_{31}} & 0\\0 & 0 & 0 & 0 & 0 & \frac{1}{G_{12}}\end{matrix}\right]$

Custom Symbols

[10]:
material_props = {
    "E" : sp.symbols("{..}\\atop{E}"),
    "nu": sp.symbols("nu^°")
}
display(material_props)
symbolic_isotropic_material = SymbolicIsotropicMaterial(**material_props)
display(symbolic_isotropic_material)
{'E': {..}\atop{E}, 'nu': nu^°}
SymbolicIsotropicMaterial(E={..}\atop{E}, nu=nu^°)
[11]:
compliance_tensor = symbolic_isotropic_material.compliance_tensor()
display(compliance_tensor.data)
$\displaystyle \left[\begin{matrix}\frac{1}{{..}\atop{E}} & - \frac{\nu^{°}}{{..}\atop{E}} & - \frac{\nu^{°}}{{..}\atop{E}} & 0 & 0 & 0\\- \frac{\nu^{°}}{{..}\atop{E}} & \frac{1}{{..}\atop{E}} & - \frac{\nu^{°}}{{..}\atop{E}} & 0 & 0 & 0\\- \frac{\nu^{°}}{{..}\atop{E}} & - \frac{\nu^{°}}{{..}\atop{E}} & \frac{1}{{..}\atop{E}} & 0 & 0 & 0\\0 & 0 & 0 & \frac{2 \left(\nu^{°} + 1\right)}{{..}\atop{E}} & 0 & 0\\0 & 0 & 0 & 0 & \frac{2 \left(\nu^{°} + 1\right)}{{..}\atop{E}} & 0\\0 & 0 & 0 & 0 & 0 & \frac{2 \left(\nu^{°} + 1\right)}{{..}\atop{E}}\end{matrix}\right]$