MaterialsΒΆ

[1]:
import mechkit
import numpy as np
[2]:
np.set_printoptions(
    linewidth=140,
    precision=3,
    # suppress=False,
)
[3]:
# Inspect some keyword combinations for constructor
mat = mechkit.material.Isotropic(E=2e6, nu=0.3)
mat1 = mechkit.material.Isotropic(E=2e6, K=1e6)
mat2 = mechkit.material.Isotropic(C11_voigt=20, C44_voigt=5)
[4]:
# Address attributes directly or as dictionary
print(mat.G)
print(mat["E"])
769230.7692307692
1999999.9999999998
[5]:
# Get stiffness in common notations
print(mat["stiffness_voigt"])
print(mat["stiffness_mandel6"])
[[2692307.692 1153846.154 1153846.154       0.          0.          0.   ]
 [1153846.154 2692307.692 1153846.154       0.          0.          0.   ]
 [1153846.154 1153846.154 2692307.692       0.          0.          0.   ]
 [      0.          0.          0.     769230.769       0.          0.   ]
 [      0.          0.          0.          0.     769230.769       0.   ]
 [      0.          0.          0.          0.          0.     769230.769]]
[[2692307.692 1153846.154 1153846.154       0.          0.          0.   ]
 [1153846.154 2692307.692 1153846.154       0.          0.          0.   ]
 [1153846.154 1153846.154 2692307.692       0.          0.          0.   ]
 [      0.          0.          0.    1538461.538       0.          0.   ]
 [      0.          0.          0.          0.    1538461.538       0.   ]
 [      0.          0.          0.          0.          0.    1538461.538]]
[6]:
# Do arithmetic on material instances
print((0.5 * mat1 + 0.5 * mat2)["stiffness_voigt"])
[[1071438.571  214290.714  214290.714       0.          0.          0.   ]
 [ 214290.714 1071438.571  214290.714       0.          0.          0.   ]
 [ 214290.714  214290.714 1071438.571       0.          0.          0.   ]
 [      0.          0.          0.     428573.929       0.          0.   ]
 [      0.          0.          0.          0.     428573.929       0.   ]
 [      0.          0.          0.          0.          0.     428573.929]]
[7]:
# Get a transversally isotropic material
transv = mechkit.material.TransversalIsotropic(
    E_l=100.0, E_t=20.0, nu_lt=0.3, G_lt=10.0, G_tt=7.0, principal_axis=[0, 1, 0]
)
print(transv.stiffness_mandel6)
[[ 25.677  11.206  11.677   0.      0.      0.   ]
 [ 11.206 106.724  11.206   0.      0.      0.   ]
 [ 11.677  11.206  25.677   0.      0.      0.   ]
 [  0.      0.      0.     20.      0.      0.   ]
 [  0.      0.      0.      0.     14.      0.   ]
 [  0.      0.      0.      0.      0.     20.   ]]