need to pass init argument to dict superclass

This commit is contained in:
Philip Eisenlohr 2020-12-17 18:08:55 -05:00
parent e11be7e600
commit 403ac693da
2 changed files with 14 additions and 11 deletions

View File

@ -9,12 +9,15 @@ from . import Orientation
class ConfigMaterial(Config):
"""Material configuration."""
def __init__(self):
"""Initialize object with all required dictionary keys."""
super().__init__()
self['material'] = []
self['homogenization'] = {}
self['phase'] = {}
_defaults = {'material': [],
'homogenization': {},
'phase': {}}
def __init__(self,d={}):
"""Initialize object with default dictionary keys."""
super().__init__(d)
for k,v in self._defaults.items():
if k not in self: self[k] = v
def save(self,fname='material.yaml',**kwargs):
"""

View File

@ -1,10 +1,10 @@
homogenization:
SX:
N_constituents: 2
mech: {type: none}
N_constituents: 1
mechanics: {type: none}
Taylor:
N_constituents: 2
mech: {type: isostrain}
mechanics: {type: isostrain}
material:
- constituents:
@ -34,11 +34,11 @@ material:
phase:
Aluminum:
lattice: cF
mech:
mechanics:
output: [F, P, F_e, F_p, L_p]
elasticity: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke}
Steel:
lattice: cI
mech:
mechanics:
output: [F, P, F_e, F_p, L_p]
elasticity: {C_11: 233.3e9, C_12: 135.5e9, C_44: 118.0e9, type: hooke}