From 85574486a848d9fe07a29cd8f41639c98162fe5f Mon Sep 17 00:00:00 2001 From: samwaseda Date: Mon, 5 Aug 2024 14:02:03 +0000 Subject: [PATCH] update some stuff --- elaston/linear_elasticity/green.py | 9 ++++----- elaston/linear_elasticity/linear_elasticity.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/elaston/linear_elasticity/green.py b/elaston/linear_elasticity/green.py index 4e0a11b..1797a61 100644 --- a/elaston/linear_elasticity/green.py +++ b/elaston/linear_elasticity/green.py @@ -5,6 +5,7 @@ import numpy as np from elaston.linear_elasticity import tools from tqdm.auto import tqdm +from functools import cached_property __author__ = "Sam Waseda" __copyright__ = ( @@ -108,15 +109,13 @@ def __init__(self, poissons_ratio, shear_modulus, min_distance=0, optimize=True) self.shear_modulus = shear_modulus self.min_dist = min_distance self.optimize = optimize - self._A = None self._B = None - @property + # Rewrite A using cached_property + @cached_property def A(self): """First coefficient of the Green's function. For more, cf. DocString in the class level.""" - if self._A is None: - self._A = (3 - 4 * self.poissons_ratio) * self.B - return self._A + return (3 - 4 * self.poissons_ratio) * self.B @property def B(self): diff --git a/elaston/linear_elasticity/linear_elasticity.py b/elaston/linear_elasticity/linear_elasticity.py index e97a27f..c993d9f 100644 --- a/elaston/linear_elasticity/linear_elasticity.py +++ b/elaston/linear_elasticity/linear_elasticity.py @@ -273,6 +273,17 @@ def youngs_modulus(self): """ Returns: ((3,)-array): xx-, yy-, zz-components of Young's modulus + + + Here is a list of Young's modulus of a few materials: + + - Al: 70.4 + - Cu: 170.0 + - Fe: 211.0 + - Mo: 442.0 + - Ni: 248.0 + - W: 630.0 + """ return 1 / self.compliance_matrix[:3, :3].diagonal()