Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
update some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
samwaseda committed Aug 5, 2024
1 parent 3d33d73 commit 8557448
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 4 additions & 5 deletions elaston/linear_elasticity/green.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = (
Expand Down Expand Up @@ -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):
Expand Down
11 changes: 11 additions & 0 deletions elaston/linear_elasticity/linear_elasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 8557448

Please sign in to comment.