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): class ConfigMaterial(Config):
"""Material configuration.""" """Material configuration."""
def __init__(self): _defaults = {'material': [],
"""Initialize object with all required dictionary keys.""" 'homogenization': {},
super().__init__() 'phase': {}}
self['material'] = []
self['homogenization'] = {} def __init__(self,d={}):
self['phase'] = {} """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): def save(self,fname='material.yaml',**kwargs):
""" """

View File

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