Hi there,
I tried to implement a new material in the compas_fea library.
I’ve used the following Example for execution:
- beam_simple.3dm
- beam_simple_rhino.py
Steps of implementation:
1. Implementing of SolidwoodC24 in the python file:(It is based on predefined orthotropic Material)
compas\compas_fea\src\compas_fea\fea\structure\material.py
class SolidwoodC24(Material):
""" Elastic, orthotropic and homogeneous material.
Parameters According to SIA 265 & SIA 265/1, page 25 (dimensioning Niveau)
Parameters
----------
name : str
Material name.
Ex = Ey : float
Young's modulus Ex, Ey in x & y direction [Pa].
Perpendicular to fiber direction.
According to local axis of cross section.
Ez : float
Young's modulus Ez in z direction [Pa].
Parallel to fiber direction.
According to local axis of cross section.
v : float
Poissons ratio --> unknown!
G : float
Mean shear modulus [Pa].
p : float
Density [kg/m3].
tension : bool
Can take tension.
compression : bool
Can take compression.
type: C16, C24, C30, D30
According to SIA 256 & SIA 265/1
C24 as default value. --> not implemented yet!!
fu : float
Ultimate stresses --> not yet defined!!
"""
def __init__(self, name, Ex=300, Ey=300, Ez=11000, vxy=0.3, vyz=0.3, vzx=0.3, Gxy=500, Gyz=500, Gzx=500, p=380, tension=True, compression=True):
Material.__init__(self, name=name)
Ex *= 10.**6; Ey *= 10.**6; Ez *= 10.**6; Gxy *= 10.**6; Gyz *= 10.**6; Gzx *= 10.**6
self.__name__ = 'SolidwoodC24'
self.name = name
self.E = {'Ex': Ex, 'Ey': Ey, 'Ez': Ez}
self.v = {'vxy': vxy, 'vyz': vyz, 'vzx': vzx}
self.G = {'Gxy': Gxy, 'Gyz': Gyz, 'Gzx': Gzx}
self.p = p
self.tension = tension
self.compression = compression
self.attr_list.extend(['E', 'v', 'G', 'p', 'tension', 'compression'])
.
1.1 This command line works in the PythonRhinoScript:
from compas_fea.structure import SolidwoodC24
.
1.2 If I try to assemble the new material to the structure through the following command line
(in PythonRhinoScript):
mdl.add(SolidwoodC24(name=‘mat_elastic’))
–>Then I get an error message:
2. In a second step, I additional tried to implement the recently created material in the following python file:
compas\compas_fea\src\compas_fea\fea\materials.py
2.1 By executing the example again, I got several new error messages:
I’m not able to find the error… do I have to addapt another compas_fea library file? Or how can I implement my own material in the material library of compas (local on my computer) ?
Thank you for your support,
Viviane