consistent naming in HDF5 output

This commit is contained in:
Martin Diehl 2021-03-25 19:22:59 +01:00
parent fe0cd8e5e2
commit 3b392281e4
32 changed files with 1458 additions and 1403 deletions

@ -1 +1 @@
Subproject commit ba046ace284515cb82020b3930206eab84ff3121 Subproject commit 6abcd3dba91f37c747eae04c6695949e819ec54b

View File

@ -35,10 +35,10 @@ for filename in options.filenames:
if not results.structured: continue if not results.structured: continue
coords = damask.grid_filters.coordinates0_point(results.cells,results.size,results.origin).reshape(-1,3,order='F') coords = damask.grid_filters.coordinates0_point(results.cells,results.size,results.origin).reshape(-1,3,order='F')
N_digits = int(np.floor(np.log10(int(results.increments[-1][3:]))))+1 N_digits = int(np.floor(np.log10(int(results.increments[-1][10:]))))+1
N_digits = 5 # hack to keep test intact N_digits = 5 # hack to keep test intact
for inc in damask.util.show_progress(results.iterate('increments'),len(results.increments)): for inc in damask.util.show_progress(results.iterate('increments'),len(results.increments)):
table = damask.Table(np.ones(np.product(results.cells),dtype=int)*int(inc[3:]),{'inc':(1,)})\ table = damask.Table(np.ones(np.product(results.cells),dtype=int)*int(inc[10:]),{'inc':(1,)})\
.add('pos',coords.reshape(-1,3)) .add('pos',coords.reshape(-1,3))
results.view('homogenizations',False) results.view('homogenizations',False)
@ -59,5 +59,5 @@ for filename in options.filenames:
if not os.path.isdir(dirname): if not os.path.isdir(dirname):
os.mkdir(dirname,0o755) os.mkdir(dirname,0o755)
file_out = '{}_inc{}.txt'.format(os.path.splitext(os.path.split(filename)[-1])[0], file_out = '{}_inc{}.txt'.format(os.path.splitext(os.path.split(filename)[-1])[0],
inc[3:].zfill(N_digits)) inc[10:].zfill(N_digits))
table.save(os.path.join(dirname,file_out),legacy=True) table.save(os.path.join(dirname,file_out),legacy=True)

View File

@ -46,7 +46,7 @@ class Result:
self.version_major = f.attrs['DADF5_version_major'] self.version_major = f.attrs['DADF5_version_major']
self.version_minor = f.attrs['DADF5_version_minor'] self.version_minor = f.attrs['DADF5_version_minor']
if self.version_major != 0 or not 7 <= self.version_minor <= 11: if self.version_major != 0 or not 7 <= self.version_minor <= 12:
raise TypeError(f'Unsupported DADF5 version {self.version_major}.{self.version_minor}') raise TypeError(f'Unsupported DADF5 version {self.version_major}.{self.version_minor}')
self.structured = 'grid' in f['geometry'].attrs.keys() or \ self.structured = 'grid' in f['geometry'].attrs.keys() or \
@ -60,15 +60,20 @@ class Result:
self.size = f['geometry'].attrs['size'] self.size = f['geometry'].attrs['size']
self.origin = f['geometry'].attrs['origin'] self.origin = f['geometry'].attrs['origin']
r=re.compile('inc[0-9]+') r=re.compile('inc[0-9]+' if self.version_minor < 12 else 'increment_[0-9]+')
increments_unsorted = {int(i[3:]):i for i in f.keys() if r.match(i)} increments_unsorted = {int(i[10:]):i for i in f.keys() if r.match(i)}
self.increments = [increments_unsorted[i] for i in sorted(increments_unsorted)] self.increments = [increments_unsorted[i] for i in sorted(increments_unsorted)]
self.times = [round(f[i].attrs['time/s'],12) for i in self.increments] self.times = [round(f[i].attrs['time/s'],12) for i in self.increments] if self.version_minor < 12 else \
[round(f[i].attrs['t/s'],12) for i in self.increments]
self.N_materialpoints, self.N_constituents = np.shape(f['mapping/phase']) grp = 'mapping' if self.version_minor < 12 else 'cell_to'
self.homogenizations = [m.decode() for m in np.unique(f['mapping/homogenization']['Name'])] self.N_materialpoints, self.N_constituents = np.shape(f[f'{grp}/phase'])
self.phases = [c.decode() for c in np.unique(f['mapping/phase']['Name'])]
self.homogenizations = [m.decode() for m in np.unique(f[f'{grp}/homogenization']
['Name' if self.version_minor < 12 else 'label'])]
self.phases = [c.decode() for c in np.unique(f[f'{grp}/phase']
['Name' if self.version_minor < 12 else 'label'])]
self.out_type_ph = [] self.out_type_ph = []
for c in self.phases: for c in self.phases:
@ -137,9 +142,10 @@ class Result:
choice = datasets if hasattr(datasets,'__iter__') and not isinstance(datasets,str) else \ choice = datasets if hasattr(datasets,'__iter__') and not isinstance(datasets,str) else \
[datasets] [datasets]
inc = 'inc' if self.version_minor < 12 else 'increment_' # compatibility hack
if what == 'increments': if what == 'increments':
choice = [c if isinstance(c,str) and c.startswith('inc') else choice = [c if isinstance(c,str) and c.startswith(inc) else
f'inc{c}' for c in choice] f'{inc}{c}' for c in choice]
elif what == 'times': elif what == 'times':
what = 'increments' what = 'increments'
if choice == ['*']: if choice == ['*']:
@ -204,7 +210,7 @@ class Result:
self._allow_modification = False self._allow_modification = False
def incs_in_range(self,start,end): def increments_in_range(self,start,end):
""" """
Select all increments within a given range. Select all increments within a given range.
@ -216,9 +222,11 @@ class Result:
End increment. End increment.
""" """
# compatibility hack
ln = 3 if self.version_minor < 12 else 10
selected = [] selected = []
for i,inc in enumerate([int(i[3:]) for i in self.increments]): for i,inc in enumerate([int(i[ln:]) for i in self.increments]):
s,e = map(lambda x: int(x[3:] if isinstance(x,str) and x.startswith('inc') else x), (start,end)) s,e = map(lambda x: int(x[ln:] if isinstance(x,str) and x.startswith('inc') else x), (start,end))
if s <= inc <= e: if s <= inc <= e:
selected.append(self.increments[i]) selected.append(self.increments[i])
return selected return selected
@ -368,6 +376,10 @@ class Result:
tbl = {} if split else None tbl = {} if split else None
inGeom = {} inGeom = {}
inData = {} inData = {}
# compatibility hack
name = 'Name' if self.version_minor < 12 else 'label'
member = 'Position' if self.version_minor < 12 else 'entry'
grp = 'mapping' if self.version_minor < 12 else 'cell_to'
with h5py.File(self.fname,'r') as f: with h5py.File(self.fname,'r') as f:
for dataset in sets: for dataset in sets:
for group in self.groups_with_datasets(dataset): for group in self.groups_with_datasets(dataset):
@ -378,11 +390,11 @@ class Result:
if prop == 'geometry': if prop == 'geometry':
inGeom[key] = inData[key] = np.arange(self.N_materialpoints) inGeom[key] = inData[key] = np.arange(self.N_materialpoints)
elif prop == 'phase': elif prop == 'phase':
inGeom[key] = np.where(f['mapping/phase'][:,constituent]['Name'] == str.encode(name))[0] inGeom[key] = np.where(f[f'{grp}/phase'][:,constituent][name] == str.encode(name))[0]
inData[key] = f['mapping/phase'][inGeom[key],constituent]['Position'] inData[key] = f[f'{grp}/phase'][inGeom[key],constituent][member]
elif prop == 'homogenization': elif prop == 'homogenization':
inGeom[key] = np.where(f['mapping/homogenization']['Name'] == str.encode(name))[0] inGeom[key] = np.where(f[f'{grp}/homogenization'][name] == str.encode(name))[0]
inData[key] = f['mapping/homogenization'][inGeom[key].tolist()]['Position'] inData[key] = f[f'{grp}/homogenization'][inGeom[key].tolist()][member]
shape = np.shape(f[path]) shape = np.shape(f[path])
data = np.full((self.N_materialpoints,) + (shape[1:] if len(shape)>1 else (1,)), data = np.full((self.N_materialpoints,) + (shape[1:] if len(shape)>1 else (1,)),
np.nan, np.nan,
@ -456,6 +468,9 @@ class Result:
def list_data(self): def list_data(self):
"""Return information on all active datasets in the file.""" """Return information on all active datasets in the file."""
# compatibility hack
de = 'Description' if self.version_minor < 12 else 'description'
un = 'Unit' if self.version_minor < 12 else 'unit'
message = '' message = ''
with h5py.File(self.fname,'r') as f: with h5py.File(self.fname,'r') as f:
for i in self.iterate('increments'): for i in self.iterate('increments'):
@ -470,13 +485,13 @@ class Result:
for d in f[group].keys(): for d in f[group].keys():
try: try:
dataset = f['/'.join([group,d])] dataset = f['/'.join([group,d])]
if 'Unit' in dataset.attrs: if un in dataset.attrs:
unit = f" / {dataset.attrs['Unit']}" if h5py3 else \ unit = f" / {dataset.attrs[un]}" if h5py3 else \
f" / {dataset.attrs['Unit'].decode()}" f" / {dataset.attrs[un].decode()}"
else: else:
unit = '' unit = ''
description = dataset.attrs['Description'] if h5py3 else \ description = dataset.attrs[de] if h5py3 else \
dataset.attrs['Description'].decode() dataset.attrs[de].decode()
message += f' {d}{unit}: {description}\n' message += f' {d}{unit}: {description}\n'
except KeyError: except KeyError:
pass pass
@ -529,6 +544,10 @@ class Result:
Defaults to False. Defaults to False.
""" """
# compatibility hack
name = 'Name' if self.version_minor < 12 else 'label'
member = 'Position' if self.version_minor < 12 else 'entry'
grp = 'mapping' if self.version_minor < 12 else 'cell_to'
with h5py.File(self.fname,'r') as f: with h5py.File(self.fname,'r') as f:
shape = (self.N_materialpoints,) + np.shape(f[path[0]])[1:] shape = (self.N_materialpoints,) + np.shape(f[path[0]])[1:]
if len(shape) == 1: shape = shape +(1,) if len(shape) == 1: shape = shape +(1,)
@ -540,17 +559,17 @@ class Result:
dataset = np.array(f[pa]) dataset = np.array(f[pa])
continue continue
p = np.where(f['mapping/phase'][:,c]['Name'] == str.encode(label))[0] p = np.where(f[f'{grp}/phase'][:,c][name] == str.encode(label))[0]
if len(p)>0: if len(p)>0:
u = (f['mapping/phase']['Position'][p,c]) u = (f[f'{grp}/phase'][member][p,c])
a = np.array(f[pa]) a = np.array(f[pa])
if len(a.shape) == 1: if len(a.shape) == 1:
a=a.reshape([a.shape[0],1]) a=a.reshape([a.shape[0],1])
dataset[p,:] = a[u,:] dataset[p,:] = a[u,:]
p = np.where(f['mapping/homogenization']['Name'] == str.encode(label))[0] p = np.where(f[f'{grp}/homogenization'][name] == str.encode(label))[0]
if len(p)>0: if len(p)>0:
u = (f['mapping/homogenization']['Position'][p.tolist()]) u = (f[f'{grp}/homogenization'][member][p.tolist()])
a = np.array(f[pa]) a = np.array(f[pa])
if len(a.shape) == 1: if len(a.shape) == 1:
a=a.reshape([a.shape[0],1]) a=a.reshape([a.shape[0],1])
@ -586,9 +605,9 @@ class Result:
'data': np.abs(x['data']), 'data': np.abs(x['data']),
'label': f'|{x["label"]}|', 'label': f'|{x["label"]}|',
'meta': { 'meta': {
'Unit': x['meta']['Unit'], 'unit': x['meta']['unit'],
'Description': f"Absolute value of {x['label']} ({x['meta']['Description']})", 'description': f"absolute value of {x['label']} ({x['meta']['description']})",
'Creator': 'add_absolute' 'creator': 'add_absolute'
} }
} }
def add_absolute(self,x): def add_absolute(self,x):
@ -614,9 +633,9 @@ class Result:
'data': eval(formula), 'data': eval(formula),
'label': kwargs['label'], 'label': kwargs['label'],
'meta': { 'meta': {
'Unit': kwargs['unit'], 'unit': kwargs['unit'],
'Description': f"{kwargs['description']} (formula: {kwargs['formula']})", 'description': f"{kwargs['description']} (formula: {kwargs['formula']})",
'Creator': 'add_calculation' 'creator': 'add_calculation'
} }
} }
def add_calculation(self,label,formula,unit='n/a',description=None): def add_calculation(self,label,formula,unit='n/a',description=None):
@ -646,11 +665,11 @@ class Result:
'data': mechanics.stress_Cauchy(P['data'],F['data']), 'data': mechanics.stress_Cauchy(P['data'],F['data']),
'label': 'sigma', 'label': 'sigma',
'meta': { 'meta': {
'Unit': P['meta']['Unit'], 'unit': P['meta']['unit'],
'Description': "Cauchy stress calculated " 'description': "Cauchy stress calculated "
f"from {P['label']} ({P['meta']['Description']})" f"from {P['label']} ({P['meta']['description']})"
f" and {F['label']} ({F['meta']['Description']})", f" and {F['label']} ({F['meta']['description']})",
'Creator': 'add_stress_Cauchy' 'creator': 'add_stress_Cauchy'
} }
} }
def add_stress_Cauchy(self,P='P',F='F'): def add_stress_Cauchy(self,P='P',F='F'):
@ -674,9 +693,9 @@ class Result:
'data': np.linalg.det(T['data']), 'data': np.linalg.det(T['data']),
'label': f"det({T['label']})", 'label': f"det({T['label']})",
'meta': { 'meta': {
'Unit': T['meta']['Unit'], 'unit': T['meta']['unit'],
'Description': f"Determinant of tensor {T['label']} ({T['meta']['Description']})", 'description': f"determinant of tensor {T['label']} ({T['meta']['description']})",
'Creator': 'add_determinant' 'creator': 'add_determinant'
} }
} }
def add_determinant(self,T): def add_determinant(self,T):
@ -698,9 +717,9 @@ class Result:
'data': tensor.deviatoric(T['data']), 'data': tensor.deviatoric(T['data']),
'label': f"s_{T['label']}", 'label': f"s_{T['label']}",
'meta': { 'meta': {
'Unit': T['meta']['Unit'], 'unit': T['meta']['unit'],
'Description': f"Deviator of tensor {T['label']} ({T['meta']['Description']})", 'description': f"deviator of tensor {T['label']} ({T['meta']['description']})",
'Creator': 'add_deviator' 'creator': 'add_deviator'
} }
} }
def add_deviator(self,T): def add_deviator(self,T):
@ -719,19 +738,19 @@ class Result:
@staticmethod @staticmethod
def _add_eigenvalue(T_sym,eigenvalue): def _add_eigenvalue(T_sym,eigenvalue):
if eigenvalue == 'max': if eigenvalue == 'max':
label,p = 'Maximum',2 label,p = 'maximum',2
elif eigenvalue == 'mid': elif eigenvalue == 'mid':
label,p = 'Intermediate',1 label,p = 'intermediate',1
elif eigenvalue == 'min': elif eigenvalue == 'min':
label,p = 'Minimum',0 label,p = 'minimum',0
return { return {
'data': tensor.eigenvalues(T_sym['data'])[:,p], 'data': tensor.eigenvalues(T_sym['data'])[:,p],
'label': f"lambda_{eigenvalue}({T_sym['label']})", 'label': f"lambda_{eigenvalue}({T_sym['label']})",
'meta' : { 'meta' : {
'Unit': T_sym['meta']['Unit'], 'unit': T_sym['meta']['unit'],
'Description': f"{label} eigenvalue of {T_sym['label']} ({T_sym['meta']['Description']})", 'description': f"{label} eigenvalue of {T_sym['label']} ({T_sym['meta']['description']})",
'Creator': 'add_eigenvalue' 'creator': 'add_eigenvalue'
} }
} }
def add_eigenvalue(self,T_sym,eigenvalue='max'): def add_eigenvalue(self,T_sym,eigenvalue='max'):
@ -761,10 +780,10 @@ class Result:
'data': tensor.eigenvectors(T_sym['data'])[:,p], 'data': tensor.eigenvectors(T_sym['data'])[:,p],
'label': f"v_{eigenvalue}({T_sym['label']})", 'label': f"v_{eigenvalue}({T_sym['label']})",
'meta' : { 'meta' : {
'Unit': '1', 'unit': '1',
'Description': f"Eigenvector corresponding to {label} eigenvalue" 'description': f"eigenvector corresponding to {label} eigenvalue"
f" of {T_sym['label']} ({T_sym['meta']['Description']})", f" of {T_sym['label']} ({T_sym['meta']['description']})",
'Creator': 'add_eigenvector' 'creator': 'add_eigenvector'
} }
} }
def add_eigenvector(self,T_sym,eigenvalue='max'): def add_eigenvector(self,T_sym,eigenvalue='max'):
@ -787,9 +806,9 @@ class Result:
def _add_IPF_color(l,q): def _add_IPF_color(l,q):
m = util.scale_to_coprime(np.array(l)) m = util.scale_to_coprime(np.array(l))
try: try:
lattice = {'fcc':'cF','bcc':'cI','hex':'hP'}[q['meta']['Lattice']] lattice = {'fcc':'cF','bcc':'cI','hex':'hP'}[q['meta']['lattice']]
except KeyError: except KeyError:
lattice = q['meta']['Lattice'] lattice = q['meta']['lattice']
try: try:
o = Orientation(rotation = (rfn.structured_to_unstructured(q['data'])),lattice=lattice) o = Orientation(rotation = (rfn.structured_to_unstructured(q['data'])),lattice=lattice)
except ValueError: except ValueError:
@ -799,10 +818,10 @@ class Result:
'data': np.uint8(o.IPF_color(l)*255), 'data': np.uint8(o.IPF_color(l)*255),
'label': 'IPFcolor_[{} {} {}]'.format(*m), 'label': 'IPFcolor_[{} {} {}]'.format(*m),
'meta' : { 'meta' : {
'Unit': '8-bit RGB', 'unit': '8-bit RGB',
'Lattice': q['meta']['Lattice'], 'lattice': q['meta']['lattice'],
'Description': 'Inverse Pole Figure (IPF) colors along sample direction [{} {} {}]'.format(*m), 'description': 'Inverse Pole Figure (IPF) colors along sample direction [{} {} {}]'.format(*m),
'Creator': 'add_IPF_color' 'creator': 'add_IPF_color'
} }
} }
def add_IPF_color(self,l,q='O'): def add_IPF_color(self,l,q='O'):
@ -827,9 +846,9 @@ class Result:
'data': mechanics.maximum_shear(T_sym['data']), 'data': mechanics.maximum_shear(T_sym['data']),
'label': f"max_shear({T_sym['label']})", 'label': f"max_shear({T_sym['label']})",
'meta': { 'meta': {
'Unit': T_sym['meta']['Unit'], 'unit': T_sym['meta']['unit'],
'Description': f"Maximum shear component of {T_sym['label']} ({T_sym['meta']['Description']})", 'description': f"maximum shear component of {T_sym['label']} ({T_sym['meta']['description']})",
'Creator': 'add_maximum_shear' 'creator': 'add_maximum_shear'
} }
} }
def add_maximum_shear(self,T_sym): def add_maximum_shear(self,T_sym):
@ -849,9 +868,9 @@ class Result:
def _add_equivalent_Mises(T_sym,kind): def _add_equivalent_Mises(T_sym,kind):
k = kind k = kind
if k is None: if k is None:
if T_sym['meta']['Unit'] == '1': if T_sym['meta']['unit'] == '1':
k = 'strain' k = 'strain'
elif T_sym['meta']['Unit'] == 'Pa': elif T_sym['meta']['unit'] == 'Pa':
k = 'stress' k = 'stress'
if k not in ['stress', 'strain']: if k not in ['stress', 'strain']:
raise ValueError('invalid von Mises kind {kind}') raise ValueError('invalid von Mises kind {kind}')
@ -861,9 +880,9 @@ class Result:
mechanics.equivalent_stress_Mises)(T_sym['data']), mechanics.equivalent_stress_Mises)(T_sym['data']),
'label': f"{T_sym['label']}_vM", 'label': f"{T_sym['label']}_vM",
'meta': { 'meta': {
'Unit': T_sym['meta']['Unit'], 'unit': T_sym['meta']['unit'],
'Description': f"Mises equivalent {k} of {T_sym['label']} ({T_sym['meta']['Description']})", 'description': f"Mises equivalent {k} of {T_sym['label']} ({T_sym['meta']['description']})",
'Creator': 'add_Mises' 'creator': 'add_Mises'
} }
} }
def add_equivalent_Mises(self,T_sym,kind=None): def add_equivalent_Mises(self,T_sym,kind=None):
@ -900,9 +919,9 @@ class Result:
'data': np.linalg.norm(x['data'],ord=o,axis=axis,keepdims=True), 'data': np.linalg.norm(x['data'],ord=o,axis=axis,keepdims=True),
'label': f"|{x['label']}|_{o}", 'label': f"|{x['label']}|_{o}",
'meta': { 'meta': {
'Unit': x['meta']['Unit'], 'unit': x['meta']['unit'],
'Description': f"{o}-norm of {t} {x['label']} ({x['meta']['Description']})", 'description': f"{o}-norm of {t} {x['label']} ({x['meta']['description']})",
'Creator': 'add_norm' 'creator': 'add_norm'
} }
} }
def add_norm(self,x,ord=None): def add_norm(self,x,ord=None):
@ -926,11 +945,11 @@ class Result:
'data': mechanics.stress_second_Piola_Kirchhoff(P['data'],F['data']), 'data': mechanics.stress_second_Piola_Kirchhoff(P['data'],F['data']),
'label': 'S', 'label': 'S',
'meta': { 'meta': {
'Unit': P['meta']['Unit'], 'unit': P['meta']['unit'],
'Description': "2. Piola-Kirchhoff stress calculated " 'description': "second Piola-Kirchhoff stress calculated "
f"from {P['label']} ({P['meta']['Description']})" f"from {P['label']} ({P['meta']['description']})"
f" and {F['label']} ({F['meta']['Description']})", f" and {F['label']} ({F['meta']['description']})",
'Creator': 'add_stress_second_Piola_Kirchhoff' 'creator': 'add_stress_second_Piola_Kirchhoff'
} }
} }
def add_stress_second_Piola_Kirchhoff(self,P='P',F='F'): def add_stress_second_Piola_Kirchhoff(self,P='P',F='F'):
@ -968,10 +987,10 @@ class Result:
# 'data': coords, # 'data': coords,
# 'label': 'p^{}_[{} {} {})'.format(u'rφ' if polar else 'xy',*m), # 'label': 'p^{}_[{} {} {})'.format(u'rφ' if polar else 'xy',*m),
# 'meta' : { # 'meta' : {
# 'Unit': '1', # 'unit': '1',
# 'Description': '{} coordinates of stereographic projection of pole (direction/plane) in crystal frame'\ # 'description': '{} coordinates of stereographic projection of pole (direction/plane) in crystal frame'\
# .format('Polar' if polar else 'Cartesian'), # .format('Polar' if polar else 'Cartesian'),
# 'Creator': 'add_pole' # 'creator': 'add_pole'
# } # }
# } # }
# def add_pole(self,q,p,polar=False): # def add_pole(self,q,p,polar=False):
@ -997,9 +1016,9 @@ class Result:
'data': mechanics.rotation(F['data']).as_matrix(), 'data': mechanics.rotation(F['data']).as_matrix(),
'label': f"R({F['label']})", 'label': f"R({F['label']})",
'meta': { 'meta': {
'Unit': F['meta']['Unit'], 'unit': F['meta']['unit'],
'Description': f"Rotational part of {F['label']} ({F['meta']['Description']})", 'description': f"rotational part of {F['label']} ({F['meta']['description']})",
'Creator': 'add_rotation' 'creator': 'add_rotation'
} }
} }
def add_rotation(self,F): def add_rotation(self,F):
@ -1021,9 +1040,9 @@ class Result:
'data': tensor.spherical(T['data'],False), 'data': tensor.spherical(T['data'],False),
'label': f"p_{T['label']}", 'label': f"p_{T['label']}",
'meta': { 'meta': {
'Unit': T['meta']['Unit'], 'unit': T['meta']['unit'],
'Description': f"Spherical component of tensor {T['label']} ({T['meta']['Description']})", 'description': f"spherical component of tensor {T['label']} ({T['meta']['description']})",
'Creator': 'add_spherical' 'creator': 'add_spherical'
} }
} }
def add_spherical(self,T): def add_spherical(self,T):
@ -1045,9 +1064,9 @@ class Result:
'data': mechanics.strain(F['data'],t,m), 'data': mechanics.strain(F['data'],t,m),
'label': f"epsilon_{t}^{m}({F['label']})", 'label': f"epsilon_{t}^{m}({F['label']})",
'meta': { 'meta': {
'Unit': F['meta']['Unit'], 'unit': F['meta']['unit'],
'Description': f"Strain tensor of {F['label']} ({F['meta']['Description']})", 'description': f"strain tensor of {F['label']} ({F['meta']['description']})",
'Creator': 'add_strain' 'creator': 'add_strain'
} }
} }
def add_strain(self,F='F',t='V',m=0.0): def add_strain(self,F='F',t='V',m=0.0):
@ -1076,10 +1095,10 @@ class Result:
'data': (mechanics.stretch_left if t.upper() == 'V' else mechanics.stretch_right)(F['data']), 'data': (mechanics.stretch_left if t.upper() == 'V' else mechanics.stretch_right)(F['data']),
'label': f"{t}({F['label']})", 'label': f"{t}({F['label']})",
'meta': { 'meta': {
'Unit': F['meta']['Unit'], 'unit': F['meta']['unit'],
'Description': '{} stretch tensor of {} ({})'.format('Left' if t.upper() == 'V' else 'Right', 'description': '{} stretch tensor of {} ({})'.format('left' if t.upper() == 'V' else 'right',
F['label'],F['meta']['Description']), F['label'],F['meta']['description']),
'Creator': 'add_stretch_tensor' 'creator': 'add_stretch_tensor'
} }
} }
def add_stretch_tensor(self,F='F',t='V'): def add_stretch_tensor(self,F='F',t='V'):
@ -1153,8 +1172,7 @@ class Result:
if self._allow_modification and result[0]+'/'+result[1]['label'] in f: if self._allow_modification and result[0]+'/'+result[1]['label'] in f:
dataset = f[result[0]+'/'+result[1]['label']] dataset = f[result[0]+'/'+result[1]['label']]
dataset[...] = result[1]['data'] dataset[...] = result[1]['data']
dataset.attrs['Overwritten'] = 'Yes' if h5py3 else \ dataset.attrs['overwritten'] = True
'Yes'.encode()
else: else:
if result[1]['data'].size >= chunk_size*2: if result[1]['data'].size >= chunk_size*2:
shape = result[1]['data'].shape shape = result[1]['data'].shape
@ -1167,14 +1185,14 @@ class Result:
dataset = f[result[0]].create_dataset(result[1]['label'],data=result[1]['data']) dataset = f[result[0]].create_dataset(result[1]['label'],data=result[1]['data'])
now = datetime.datetime.now().astimezone() now = datetime.datetime.now().astimezone()
dataset.attrs['Created'] = now.strftime('%Y-%m-%d %H:%M:%S%z') if h5py3 else \ dataset.attrs['created'] = now.strftime('%Y-%m-%d %H:%M:%S%z') if h5py3 else \
now.strftime('%Y-%m-%d %H:%M:%S%z').encode() now.strftime('%Y-%m-%d %H:%M:%S%z').encode()
for l,v in result[1]['meta'].items(): for l,v in result[1]['meta'].items():
dataset.attrs[l]=v if h5py3 else v.encode() dataset.attrs[l.lower()]=v if h5py3 else v.encode()
creator = dataset.attrs['Creator'] if h5py3 else \ creator = dataset.attrs['creator'] if h5py3 else \
dataset.attrs['Creator'].decode() dataset.attrs['creator'].decode()
dataset.attrs['Creator'] = f"damask.Result.{creator} v{damask.version}" if h5py3 else \ dataset.attrs['creator'] = f"damask.Result.{creator} v{damask.version}" if h5py3 else \
f"damask.Result.{creator} v{damask.version}".encode() f"damask.Result.{creator} v{damask.version}".encode()
except (OSError,RuntimeError) as err: except (OSError,RuntimeError) as err:
@ -1192,6 +1210,8 @@ class Result:
The view is not taken into account, i.e. the content of the The view is not taken into account, i.e. the content of the
whole file will be included. whole file will be included.
""" """
# compatibility hack
u = 'Unit' if self.version_minor < 12 else 'unit'
if self.N_constituents != 1 or len(self.phases) != 1 or not self.structured: if self.N_constituents != 1 or len(self.phases) != 1 or not self.structured:
raise TypeError('XDMF output requires homogeneous grid') raise TypeError('XDMF output requires homogeneous grid')
@ -1273,7 +1293,7 @@ class Result:
dtype = f[name].dtype dtype = f[name].dtype
if dtype not in np.sctypes['int']+np.sctypes['uint']+np.sctypes['float']: continue if dtype not in np.sctypes['int']+np.sctypes['uint']+np.sctypes['float']: continue
unit = f[name].attrs['Unit'] if h5py3 else f[name].attrs['Unit'].decode() unit = f[name].attrs[u] if h5py3 else f[name].attrs[u].decode()
attributes.append(ET.SubElement(grid, 'Attribute')) attributes.append(ET.SubElement(grid, 'Attribute'))
attributes[-1].attrib={'Name': name.split('/',2)[2]+f' / {unit}', attributes[-1].attrib={'Name': name.split('/',2)[2]+f' / {unit}',
@ -1317,7 +1337,10 @@ class Result:
elif mode.lower()=='point': elif mode.lower()=='point':
v = VTK.from_poly_data(self.coordinates0_point) v = VTK.from_poly_data(self.coordinates0_point)
N_digits = int(np.floor(np.log10(max(1,int(self.increments[-1][3:])))))+1 # compatibility hack
ln = 3 if self.version_minor < 12 else 10
N_digits = int(np.floor(np.log10(max(1,int(self.increments[-1][ln:])))))+1
for inc in util.show_progress(self.iterate('increments'),len(self.visible['increments'])): for inc in util.show_progress(self.iterate('increments'),len(self.visible['increments'])):
@ -1327,21 +1350,24 @@ class Result:
for o in self.iterate('out_type_ph'): for o in self.iterate('out_type_ph'):
for c in range(self.N_constituents): for c in range(self.N_constituents):
prefix = '' if self.N_constituents == 1 else f'constituent{c}/' prefix = '' if self.N_constituents == 1 else f'constituent{c}/'
if o != 'mechanics': if o not in ['mechanics', 'mechanical']: # compatibility hack
for _ in self.iterate('phases'): for _ in self.iterate('phases'):
path = self.get_dataset_location(label) path = self.get_dataset_location(label)
if len(path) == 0: if len(path) == 0:
continue continue
array = self.read_dataset(path,c) array = self.read_dataset(path,c)
v.add(array,prefix+path[0].split('/',1)[1]+f' / {self._get_attribute(path[0],"Unit")}') v.add(array,prefix+path[0].split('/',1)[1]+f' / {self._get_attribute(path[0],"unit")}')
else: else:
paths = self.get_dataset_location(label) paths = self.get_dataset_location(label)
if len(paths) == 0: if len(paths) == 0:
continue continue
array = self.read_dataset(paths,c) array = self.read_dataset(paths,c)
if self.version_minor < 12:
ph_name = re.compile(r'(?<=(phase\/))(.*?)(?=(mechanics))') # identify phase name ph_name = re.compile(r'(?<=(phase\/))(.*?)(?=(mechanics))') # identify phase name
else:
ph_name = re.compile(r'(?<=(phase\/))(.*?)(?=(mechanical))') # identify phase name
dset_name = prefix+re.sub(ph_name,r'',paths[0].split('/',1)[1]) # remove phase name dset_name = prefix+re.sub(ph_name,r'',paths[0].split('/',1)[1]) # remove phase name
v.add(array,dset_name+f' / {self._get_attribute(paths[0],"Unit")}') v.add(array,dset_name+f' / {self._get_attribute(paths[0],"unit")}')
self.view('homogenizations',viewed_backup_ho) self.view('homogenizations',viewed_backup_ho)
viewed_backup_ph = self.visible['phases'].copy() viewed_backup_ph = self.visible['phases'].copy()
@ -1352,10 +1378,10 @@ class Result:
if len(paths) == 0: if len(paths) == 0:
continue continue
array = self.read_dataset(paths) array = self.read_dataset(paths)
v.add(array,paths[0].split('/',1)[1]+f' / {self._get_attribute(paths[0],"Unit")}') v.add(array,paths[0].split('/',1)[1]+f' / {self._get_attribute(paths[0],"unit")}')
self.view('phases',viewed_backup_ph) self.view('phases',viewed_backup_ph)
u = self.read_dataset(self.get_dataset_location('u_n' if mode.lower() == 'cell' else 'u_p')) u = self.read_dataset(self.get_dataset_location('u_n' if mode.lower() == 'cell' else 'u_p'))
v.add(u,'u') v.add(u,'u')
v.save(f'{self.fname.stem}_inc{inc[3:].zfill(N_digits)}') v.save(f'{self.fname.stem}_inc{inc[ln:].zfill(N_digits)}')

View File

@ -1320,7 +1320,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.31066783350657406, -0.21779766497005681, 0.09214584007574673, 0.9206295772538797] - O: [0.3106678335065741, -0.21779766497005681, 0.09214584007574673, 0.9206295772538797]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -6145,7 +6145,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7229346828273859, 0.6685599713651128, 0.08624285203524544, -0.15150966809538396] - O: [0.7229346828273859, 0.6685599713651128, 0.08624285203524544, -0.151509668095384]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -7905,7 +7905,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.931126859733525, -0.188840906559267, -0.02833613959862872, -0.3107071712807828] - O: [0.931126859733525, -0.188840906559267, -0.028336139598628726, -0.3107071712807828]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -9565,7 +9565,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.11865322052371209, -0.3065569449170895, 0.4154484877145501, -0.8481431523263895] - O: [0.11865322052371209, -0.30655694491708946, 0.4154484877145501, -0.8481431523263895]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -10020,7 +10020,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7710983914563474, -0.25797372805099167, 0.06002968724073646, -0.5790105896947706] - O: [0.7710983914563474, -0.25797372805099167, 0.06002968724073645, -0.5790105896947706]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -10030,7 +10030,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.35438790449292706, -0.7304914461669942, 0.45467382555607483, -0.3661463813561039] - O: [0.35438790449292706, -0.7304914461669942, 0.4546738255560747, -0.3661463813561039]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -11370,7 +11370,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7243608788790047, 0.6637631628425261, 0.10268145117209243, -0.15548729976469167] - O: [0.7243608788790047, 0.6637631628425261, 0.10268145117209244, -0.15548729976469167]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -11905,7 +11905,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.44419032008820003, -0.5529905706737287, 0.6935425610206521, 0.12607578807527303] - O: [0.4441903200882, -0.5529905706737287, 0.6935425610206521, 0.12607578807527303]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -13445,7 +13445,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.6697470295795691, 0.6829830719241006, 0.18311468066389644, -0.22680840716301023] - O: [0.6697470295795691, 0.6829830719241006, 0.1831146806638964, -0.22680840716301023]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -14395,7 +14395,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.9420844797399966, 0.25883464708013926, -0.15857648026162938, 0.14260069569168562] - O: [0.9420844797399965, 0.25883464708013926, -0.15857648026162938, 0.14260069569168562]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -14690,7 +14690,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.033965862583657844, 0.38987430052446437, -0.021104332173659594, -0.9199994332242882] - O: [0.033965862583657844, 0.3898743005244644, -0.021104332173659597, -0.9199994332242882]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -15495,7 +15495,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.4474330690811882, -0.8476542309437225, -0.07321245604536979, 0.27554652916630923] - O: [0.44743306908118824, -0.8476542309437225, -0.07321245604536979, 0.27554652916630923]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -18035,7 +18035,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.5678359403213665, 0.07874570435451851, 0.2615872285658415, 0.7764879785137065] - O: [0.5678359403213665, 0.0787457043545185, 0.2615872285658415, 0.7764879785137065]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -18380,7 +18380,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.45754782565553354, -0.8464334117650875, -0.078012752396648, 0.2609875038179162] - O: [0.45754782565553354, -0.8464334117650875, -0.078012752396648, 0.26098750381791624]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -21065,7 +21065,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.15856773796560278, -0.8551430307243139, -0.16291561140092078, 0.4658810717790231] - O: [0.15856773796560275, -0.8551430307243139, -0.16291561140092078, 0.4658810717790231]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -21105,7 +21105,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.0729259571624348, 0.6341236234582911, 0.6589981632125096, 0.39785733099518056] - O: [0.07292595716243482, 0.6341236234582911, 0.6589981632125096, 0.39785733099518056]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -21190,7 +21190,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.8101586668979511, 0.20957597947719434, 0.12829598334751469, -0.5322226826556751] - O: [0.8101586668979511, 0.20957597947719434, 0.12829598334751466, -0.5322226826556751]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -21415,7 +21415,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.054943066882071276, 0.5737114639476909, -0.7876822531704588, -0.21769952589957298] - O: [0.05494306688207128, 0.5737114639476909, -0.7876822531704588, -0.21769952589957298]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -21710,7 +21710,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.14915138908745934, -0.8562445741042877, -0.16015480811048352, 0.4679204311518599] - O: [0.14915138908745934, -0.8562445741042877, -0.1601548081104835, 0.4679204311518599]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -23870,7 +23870,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.523752232028536, 0.7737953530354786, -0.20639371250697794, -0.29038937050693264] - O: [0.523752232028536, 0.7737953530354785, -0.2063937125069779, -0.29038937050693264]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -25830,7 +25830,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7957667481488323, 0.4476552551183933, -0.1758152425875816, 0.36803404133230533] - O: [0.7957667481488323, 0.4476552551183933, -0.1758152425875816, 0.3680340413323053]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -26700,7 +26700,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.4408305262512665, -0.8243331876591884, 0.30124916847267375, 0.1881280982288277] - O: [0.4408305262512665, -0.8243331876591884, 0.30124916847267375, 0.18812809822882767]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -27520,7 +27520,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.4416212269855147, 0.51737078732195, 0.7244227935501028, 0.11184711210728344] - O: [0.4416212269855147, 0.5173707873219501, 0.7244227935501028, 0.11184711210728344]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -27530,7 +27530,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.6859450548749442, 0.0627647667917942, 0.43495714692133275, 0.5799588313701549] - O: [0.6859450548749442, 0.06276476679179419, 0.4349571469213327, 0.5799588313701549]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -27540,7 +27540,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7176823153423195, 0.09542057499927087, -0.4443698021852411, -0.5276006889850936] - O: [0.7176823153423195, 0.09542057499927085, -0.4443698021852411, -0.5276006889850936]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -29955,7 +29955,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.5959382011529282, -0.46777492923475683, -0.09801282849081705, -0.6453198907807353] - O: [0.5959382011529282, -0.46777492923475683, -0.09801282849081705, -0.6453198907807352]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -31070,7 +31070,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.4406006220873551, -0.31937401853421743, 0.1303472021126782, -0.8287828032741376] - O: [0.4406006220873552, -0.31937401853421743, 0.1303472021126782, -0.8287828032741376]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -31930,7 +31930,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7993341974700379, 0.3949133472602586, -0.3825888485301062, 0.24235111283226313] - O: [0.7993341974700379, 0.3949133472602586, -0.3825888485301062, 0.24235111283226318]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -37735,7 +37735,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7052795411761517, -0.30262049917738404, 0.10159446606657871, -0.6329930226634689] - O: [0.7052795411761517, -0.302620499177384, 0.1015944660665787, -0.6329930226634689]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -40475,7 +40475,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.8497500999920073, -0.3541522098950685, -0.3863229159313577, -0.05705772880430643] - O: [0.8497500999920073, -0.3541522098950686, -0.38632291593135776, -0.05705772880430643]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -42475,7 +42475,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.5383777729036413, -0.0006130402781197792, -0.5241013413815168, -0.6598990693939697] - O: [0.5383777729036413, -0.0006130402781197792, -0.5241013413815168, -0.6598990693939698]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -43140,7 +43140,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.09246710333146782, -0.8345101822571583, -0.37880620210322863, 0.3892922446681156] - O: [0.09246710333146782, -0.8345101822571585, -0.37880620210322863, 0.3892922446681156]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -44270,7 +44270,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.762924200138241, 0.03641508152920803, -0.5009075218239414, -0.4070777091181044] - O: [0.762924200138241, 0.03641508152920803, -0.5009075218239414, -0.40707770911810437]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -44435,7 +44435,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.47087677242309084, -0.3468298666306204, -0.21279566355408053, 0.7827529076138762] - O: [0.47087677242309084, -0.34682986663062043, -0.21279566355408056, 0.7827529076138762]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -44540,7 +44540,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7125379091798806, 0.2340374000100663, 0.28955145542568306, 0.5947068000611403] - O: [0.7125379091798806, 0.23403740001006632, 0.2895514554256831, 0.5947068000611403]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -44960,7 +44960,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.6958878424426996, -0.116583243012937, 0.5489570390723334, 0.4481011352830605] - O: [0.6958878424426996, -0.11658324301293699, 0.5489570390723334, 0.4481011352830605]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -45260,7 +45260,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.805457583058606, 0.1804396057325204, 0.5643909987322313, -0.011934451244853332] - O: [0.8054575830586059, 0.1804396057325204, 0.5643909987322313, -0.01193445124485333]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -45605,7 +45605,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.897939106580608, -0.15852644047994666, -0.0906003445066782, -0.40045762087547854] - O: [0.897939106580608, -0.15852644047994663, -0.0906003445066782, -0.40045762087547854]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -45855,7 +45855,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7102784157142707, 0.21927545769758944, 0.3045499288077718, 0.5955436060315983] - O: [0.7102784157142707, 0.21927545769758944, 0.30454992880777176, 0.5955436060315983]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -46785,7 +46785,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.8482899898135381, 0.013443034780803168, -0.5239164704064472, 0.07572918879058307] - O: [0.8482899898135381, 0.01344303478080317, -0.5239164704064473, 0.07572918879058307]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -47370,7 +47370,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.2131719944192954, -0.45816274673352775, 0.3755521192528604, -0.7769203331266176] - O: [0.2131719944192954, -0.45816274673352775, 0.3755521192528605, -0.7769203331266176]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -49465,7 +49465,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.5037539978875478, 0.798549991924166, 0.18656398735621565, 0.2715579102732541] - O: [0.5037539978875478, 0.798549991924166, 0.18656398735621565, 0.27155791027325404]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -50335,7 +50335,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.39921645983730997, -0.6013267272096834, 0.636522210649765, -0.27179378338695087] - O: [0.39921645983730997, -0.6013267272096833, 0.6365222106497649, -0.27179378338695087]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -50645,7 +50645,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.07083309409802357, -0.6366354041315766, -0.6538301805355591, -0.40272090833176605] - O: [0.07083309409802356, -0.6366354041315766, -0.6538301805355591, -0.40272090833176605]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -51020,7 +51020,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.3399140508362671, 0.5524833187439406, 0.645323253963486, 0.40345819913311837] - O: [0.3399140508362671, 0.5524833187439406, 0.645323253963486, 0.4034581991331183]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -53090,7 +53090,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.6178033410366038, 0.3428318561655839, -0.7064244293225029, 0.041831517525023065] - O: [0.6178033410366037, 0.3428318561655839, -0.7064244293225029, 0.04183151752502306]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -55470,7 +55470,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.4147250145072622, -0.674841467282132, -0.3134600753091279, -0.5237699280845035] - O: [0.4147250145072622, -0.6748414672821321, -0.31346007530912795, -0.5237699280845035]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -60645,7 +60645,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.772317193587748, -0.15756277648057698, -0.11054904749292865, -0.6053751168117856] - O: [0.772317193587748, -0.15756277648057695, -0.11054904749292863, -0.6053751168117856]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -60910,7 +60910,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7256517547455084, 0.39540025559174474, 0.46095445780716454, 0.3234333881040275] - O: [0.7256517547455085, 0.39540025559174474, 0.46095445780716454, 0.3234333881040275]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -61365,7 +61365,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.3756400691131763, 0.6005332316905265, 0.6536828427774418, 0.26637026329975905] - O: [0.3756400691131763, 0.6005332316905264, 0.6536828427774417, 0.26637026329975905]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -63490,7 +63490,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.251478214662433, -0.7746585879697298, 0.2936799549832292, 0.5004146917067767] - O: [0.251478214662433, -0.7746585879697298, 0.2936799549832292, 0.5004146917067765]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -63955,7 +63955,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.7761095621277665, 0.5658565514148699, 0.21082820014959885, 0.1816914439823677] - O: [0.7761095621277665, 0.5658565514148699, 0.21082820014959885, 0.18169144398236772]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
@ -64355,7 +64355,7 @@ material:
v: 1.0 v: 1.0
homogenization: direct homogenization: direct
- constituents: - constituents:
- O: [0.08994219560426488, -0.9524153356792486, -0.021344167817519546, 0.29044768257475523] - O: [0.08994219560426489, -0.9524153356792486, -0.021344167817519546, 0.29044768257475523]
phase: 1 phase: 1
v: 1.0 v: 1.0
homogenization: direct homogenization: direct

View File

@ -2,15 +2,15 @@
homogenization: homogenization:
SX: SX:
N_constituents: 1 N_constituents: 1
mechanics: {type: none} mechanical: {type: pass}
phase: phase:
pheno_fcc: pheno_fcc:
lattice: cF lattice: cF
mechanics: mechanical:
output: [F, P, F_e, F_p, L_p, O] output: [F, P, F_e, F_p, L_p, O]
elasticity: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke}
plasticity: plastic:
N_sl: [12] N_sl: [12]
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
@ -24,10 +24,10 @@ phase:
xi_inf_sl: [63e6] xi_inf_sl: [63e6]
pheno_bcc: pheno_bcc:
lattice: cI lattice: cI
mechanics: mechanical:
output: [F, P, F_e, F_p, L_p, O] output: [F, P, F_e, F_p, L_p, O]
elasticity: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke}
plasticity: plastic:
N_sl: [12] N_sl: [12]
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
@ -42,62 +42,62 @@ phase:
material: material:
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.8229200444892315, 0.5284940239127993, -0.11958598847729246, 0.17086795611292308] O: [0.8229200444892315, 0.5284940239127993, -0.11958598847729246, 0.17086795611292308]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.029934934533052786, -0.0463822071939717, 0.9983440440417412, 0.01617900728410769] O: [0.029934934533052786, -0.0463822071939717, 0.9983440440417412, 0.01617900728410769]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.5285808688806949, 0.7326575088838098, 0.4051997815944012, 0.1401013087924221] O: [0.5285808688806949, 0.7326575088838098, 0.4051997815944012, 0.1401013087924221]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.1839974517790312, 0.49550065903084944, -0.1541415483910751, -0.8347840545305227] O: [0.1839974517790312, 0.49550065903084944, -0.1541415483910751, -0.8347840545305227]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.8055693100147384, -0.22778497057116814, -0.028331746016454287, 0.5462320075864553] O: [0.8055693100147384, -0.22778497057116814, -0.028331746016454287, 0.5462320075864553]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.8025842700117737, -0.33640019337884963, -0.3847408071640489, 0.3076815085881779] O: [0.8025842700117737, -0.33640019337884963, -0.3847408071640489, 0.3076815085881779]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.6048933483394416, 0.7565005822419409, -0.08545681892422426, -0.2334695661144201] O: [0.6048933483394416, 0.7565005822419409, -0.08545681892422426, -0.2334695661144201]
phase: pheno_bcc phase: pheno_bcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.2012339360745425, -0.3580127491130033, -0.7798091137625135, 0.47247171400774884] O: [0.2012339360745425, -0.3580127491130033, -0.7798091137625135, 0.47247171400774884]
phase: pheno_bcc phase: pheno_bcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.7949688202267222, 0.3623793306926909, -0.18836147613310203, -0.4485819321629098] O: [0.7949688202267222, 0.3623793306926909, -0.18836147613310203, -0.4485819321629098]
phase: pheno_bcc phase: pheno_bcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.19733162113429173, -0.06559103894055797, -0.40230149937129567, 0.8915781236183501] O: [0.19733162113429173, -0.06559103894055797, -0.40230149937129567, 0.8915781236183501]
phase: pheno_bcc phase: pheno_bcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.8659916384140512, -0.2761459420825848, 0.38479354764225004, -0.1604238964779258] O: [0.8659916384140512, -0.2761459420825848, 0.38479354764225004, -0.1604238964779258]
phase: pheno_bcc phase: pheno_bcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.5951846978175659, 0.4476701545571293, -0.6038886363266418, -0.2840160613735736] O: [0.5951846978175659, 0.4476701545571293, -0.6038886363266418, -0.2840160613735736]
phase: pheno_bcc phase: pheno_bcc
homogenization: SX homogenization: SX

View File

@ -2,15 +2,15 @@
homogenization: homogenization:
SX: SX:
N_constituents: 1 N_constituents: 1
mechanics: {type: none} mechanical: {type: pass}
phase: phase:
pheno_fcc: pheno_fcc:
lattice: cF lattice: cF
mechanics: mechanical:
output: [F, P, F_e, F_p, L_p, O] output: [F, P, F_e, F_p, L_p, O]
elasticity: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke} elastic: {C_11: 106.75e9, C_12: 60.41e9, C_44: 28.34e9, type: hooke}
plasticity: plastic:
N_sl: [12] N_sl: [12]
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
@ -25,32 +25,32 @@ phase:
material: material:
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.8229200444892315, 0.5284940239127993, -0.11958598847729246, 0.17086795611292308] O: [0.8229200444892315, 0.5284940239127993, -0.11958598847729246, 0.17086795611292308]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.029934934533052786, -0.0463822071939717, 0.9983440440417412, 0.01617900728410769] O: [0.029934934533052786, -0.0463822071939717, 0.9983440440417412, 0.01617900728410769]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.5285808688806949, 0.7326575088838098, 0.4051997815944012, 0.1401013087924221] O: [0.5285808688806949, 0.7326575088838098, 0.4051997815944012, 0.1401013087924221]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.1839974517790312, 0.49550065903084944, -0.1541415483910751, -0.8347840545305227] O: [0.1839974517790312, 0.49550065903084944, -0.1541415483910751, -0.8347840545305227]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.8055693100147384, -0.22778497057116814, -0.028331746016454287, 0.5462320075864553] O: [0.8055693100147384, -0.22778497057116814, -0.028331746016454287, 0.5462320075864553]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX
- constituents: - constituents:
- fraction: 1.0 - v: 1.0
O: [0.8025842700117737, -0.33640019337884963, -0.3847408071640489, 0.3076815085881779] O: [0.8025842700117737, -0.33640019337884963, -0.3847408071640489, 0.3076815085881779]
phase: pheno_fcc phase: pheno_fcc
homogenization: SX homogenization: SX

View File

@ -1,14 +1,17 @@
--- ---
solver:
mechanical: spectral_basic
step: loadstep:
- discretization: - boundary_conditions:
t: 20 mechanical:
N: 40
f_out: 4
mechanics:
dot_F: [x, 0, 0, dot_F: [x, 0, 0,
0, 1.0e-3, 0, 0, 1.0e-3, 0,
0, 0, x] 0, 0, x]
P: [0, x, x, P: [0, x, x,
x, x, x, x, x, x,
x, x, 0] x, x, 0]
discretization:
t: 20
N: 40
f_out: 4

View File

@ -48,7 +48,7 @@ class TestResult:
a = default.get_dataset_location('F') a = default.get_dataset_location('F')
default.view('increments','*') default.view('increments','*')
b = default.get_dataset_location('F') b = default.get_dataset_location('F')
default.view('increments',default.incs_in_range(0,np.iinfo(int).max)) default.view('increments',default.increments_in_range(0,np.iinfo(int).max))
c = default.get_dataset_location('F') c = default.get_dataset_location('F')
default.view('times',True) default.view('times',True)
@ -173,7 +173,7 @@ class TestResult:
loc = {'O': default.get_dataset_location('O'), loc = {'O': default.get_dataset_location('O'),
'color': default.get_dataset_location('IPFcolor_[{} {} {}]'.format(*d))} 'color': default.get_dataset_location('IPFcolor_[{} {} {}]'.format(*d))}
qu = default.read_dataset(loc['O']).view(np.double).squeeze() qu = default.read_dataset(loc['O']).view(np.double).squeeze()
crystal_structure = default._get_attribute(default.get_dataset_location('O')[0],'Lattice') crystal_structure = default._get_attribute(default.get_dataset_location('O')[0],'lattice')
c = Orientation(rotation=qu,lattice=crystal_structure) c = Orientation(rotation=qu,lattice=crystal_structure)
in_memory = np.uint8(c.IPF_color(np.array(d))*255) in_memory = np.uint8(c.IPF_color(np.array(d))*255)
in_file = default.read_dataset(loc['color']) in_file = default.read_dataset(loc['color'])
@ -314,9 +314,9 @@ class TestResult:
with h5py.File(default.fname,'r') as f: with h5py.File(default.fname,'r') as f:
# h5py3 compatibility # h5py3 compatibility
try: try:
created_first = f[loc[0]].attrs['Created'].decode() created_first = f[loc[0]].attrs['created'].decode()
except AttributeError: except AttributeError:
created_first = f[loc[0]].attrs['Created'] created_first = f[loc[0]].attrs['created']
created_first = datetime.strptime(created_first,'%Y-%m-%d %H:%M:%S%z') created_first = datetime.strptime(created_first,'%Y-%m-%d %H:%M:%S%z')
if overwrite == 'on': if overwrite == 'on':
@ -332,9 +332,9 @@ class TestResult:
with h5py.File(default.fname,'r') as f: with h5py.File(default.fname,'r') as f:
# h5py3 compatibility # h5py3 compatibility
try: try:
created_second = f[loc[0]].attrs['Created'].decode() created_second = f[loc[0]].attrs['created'].decode()
except AttributeError: except AttributeError:
created_second = f[loc[0]].attrs['Created'] created_second = f[loc[0]].attrs['created']
created_second = datetime.strptime(created_second,'%Y-%m-%d %H:%M:%S%z') created_second = datetime.strptime(created_second,'%Y-%m-%d %H:%M:%S%z')
if overwrite == 'on': if overwrite == 'on':
assert created_first < created_second and np.allclose(default.read_dataset(loc),311.) assert created_first < created_second and np.allclose(default.read_dataset(loc),311.)

View File

@ -104,7 +104,6 @@ program DAMASK_grid
load_step, & load_step, &
solver, & solver, &
initial_conditions, & initial_conditions, &
ic_thermal, &
thermal, & thermal, &
step_bc, & step_bc, &
step_mech, & step_mech, &

View File

@ -367,17 +367,17 @@ subroutine homogenization_results
call mechanical_results(group_base,ho) call mechanical_results(group_base,ho)
group = trim(group_base)//'/damage'
call results_closeGroup(results_addGroup(group))
select case(damage_type(ho)) select case(damage_type(ho))
case(DAMAGE_NONLOCAL_ID) case(DAMAGE_NONLOCAL_ID)
group = trim(group_base)//'/damage'
call results_closeGroup(results_addGroup(group))
call damage_nonlocal_results(ho,group) call damage_nonlocal_results(ho,group)
end select end select
group = trim(group_base)//'/thermal'
call results_closeGroup(results_addGroup(group))
select case(thermal_type(ho)) select case(thermal_type(ho))
case(THERMAL_CONDUCTION_ID) case(THERMAL_CONDUCTION_ID)
group = trim(group_base)//'/thermal'
call results_closeGroup(results_addGroup(group))
call thermal_conduction_results(ho,group) call thermal_conduction_results(ho,group)
end select end select
@ -542,7 +542,7 @@ subroutine material_parseHomogenization
do h=1, size(material_name_homogenization) do h=1, size(material_name_homogenization)
homog => material_homogenization%get(h) homog => material_homogenization%get(h)
homogMech => homog%get('mechanics') homogMech => homog%get('mechanical')
select case (homogMech%get_asString('type')) select case (homogMech%get_asString('type'))
case('pass') case('pass')
homogenization_type(h) = HOMOGENIZATION_NONE_ID homogenization_type(h) = HOMOGENIZATION_NONE_ID

View File

@ -224,7 +224,7 @@ module subroutine mechanical_results(group_base,ho)
character(len=:), allocatable :: group character(len=:), allocatable :: group
group = trim(group_base)//'/mech' group = trim(group_base)//'/mechanical'
call results_closeGroup(results_addGroup(group)) call results_closeGroup(results_addGroup(group))
select case(homogenization_type(ho)) select case(homogenization_type(ho))

View File

@ -139,7 +139,7 @@ module subroutine mechanical_RGC_init(num_homogMech)
do ho = 1, size(homogenization_type) do ho = 1, size(homogenization_type)
if (homogenization_type(ho) /= HOMOGENIZATION_RGC_ID) cycle if (homogenization_type(ho) /= HOMOGENIZATION_RGC_ID) cycle
homog => material_homogenization%get(ho) homog => material_homogenization%get(ho)
homogMech => homog%get('mechanics') homogMech => homog%get('mechanical')
associate(prm => param(ho), & associate(prm => param(ho), &
stt => state(ho), & stt => state(ho), &
st0 => state0(ho), & st0 => state0(ho), &

View File

@ -46,7 +46,7 @@ module subroutine mechanical_isostrain_init
do h = 1, size(homogenization_type) do h = 1, size(homogenization_type)
if (homogenization_type(h) /= HOMOGENIZATION_ISOSTRAIN_ID) cycle if (homogenization_type(h) /= HOMOGENIZATION_ISOSTRAIN_ID) cycle
homog => material_homogenization%get(h) homog => material_homogenization%get(h)
homogMech => homog%get('mechanics') homogMech => homog%get('mechanical')
associate(prm => param(h)) associate(prm => param(h))
prm%N_constituents = homogenization_Nconstituents(h) prm%N_constituents = homogenization_Nconstituents(h)

View File

@ -480,8 +480,8 @@ subroutine lattice_init
do ph = 1, phases%length do ph = 1, phases%length
phase => phases%get(ph) phase => phases%get(ph)
mech => phase%get('mechanics') mech => phase%get('mechanical')
elasticity => mech%get('elasticity') elasticity => mech%get('elastic')
lattice_C66(1,1,ph) = elasticity%get_asFloat('C_11') lattice_C66(1,1,ph) = elasticity%get_asFloat('C_11')
lattice_C66(1,2,ph) = elasticity%get_asFloat('C_12') lattice_C66(1,2,ph) = elasticity%get_asFloat('C_12')

View File

@ -341,21 +341,21 @@ module subroutine damage_results(group,ph)
sourceLoop: do so = 1, phase_Nsources(ph) sourceLoop: do so = 1, phase_Nsources(ph)
if (phase_source(ph) /= DAMAGE_UNDEFINED_ID) & if (phase_source(ph) /= DAMAGE_UNDEFINED_ID) &
call results_closeGroup(results_addGroup(group//'sources/')) ! should be 'damage' call results_closeGroup(results_addGroup(group//'damage'))
sourceType: select case (phase_source(ph)) sourceType: select case (phase_source(ph))
case (DAMAGE_ISOBRITTLE_ID) sourceType case (DAMAGE_ISOBRITTLE_ID) sourceType
call isobrittle_results(ph,group//'sources/') call isobrittle_results(ph,group//'damage/')
case (DAMAGE_ISODUCTILE_ID) sourceType case (DAMAGE_ISODUCTILE_ID) sourceType
call isoductile_results(ph,group//'sources/') call isoductile_results(ph,group//'damage/')
case (DAMAGE_ANISOBRITTLE_ID) sourceType case (DAMAGE_ANISOBRITTLE_ID) sourceType
call anisobrittle_results(ph,group//'sources/') call anisobrittle_results(ph,group//'damage/')
case (DAMAGE_ANISODUCTILE_ID) sourceType case (DAMAGE_ANISODUCTILE_ID) sourceType
call anisoductile_results(ph,group//'sources/') call anisoductile_results(ph,group//'damage/')
end select sourceType end select sourceType

View File

@ -53,8 +53,8 @@ module function anisoductile_init() result(mySources)
do p = 1, phases%length do p = 1, phases%length
if(mySources(p)) then if(mySources(p)) then
phase => phases%get(p) phase => phases%get(p)
mech => phase%get('mechanics') mech => phase%get('mechanical')
pl => mech%get('plasticity') pl => mech%get('plastic')
sources => phase%get('damage') sources => phase%get('damage')

View File

@ -247,13 +247,13 @@ module subroutine mechanical_init(materials,phases)
allocate(phase_mechanical_F0(ph)%data(3,3,Nmembers)) allocate(phase_mechanical_F0(ph)%data(3,3,Nmembers))
phase => phases%get(ph) phase => phases%get(ph)
mech => phase%get('mechanics') mech => phase%get('mechanical')
#if defined(__GFORTRAN__) #if defined(__GFORTRAN__)
output_constituent(ph)%label = output_asStrings(mech) output_constituent(ph)%label = output_asStrings(mech)
#else #else
output_constituent(ph)%label = mech%get_asStrings('output',defaultVal=emptyStringArray) output_constituent(ph)%label = mech%get_asStrings('output',defaultVal=emptyStringArray)
#endif #endif
elastic => mech%get('elasticity') elastic => mech%get('elastic')
if(elastic%get_asString('type') == 'hooke') then if(elastic%get_asString('type') == 'hooke') then
phase_elasticity(ph) = ELASTICITY_HOOKE_ID phase_elasticity(ph) = ELASTICITY_HOOKE_ID
else else
@ -269,7 +269,7 @@ module subroutine mechanical_init(materials,phases)
if(maxVal(phase_NstiffnessDegradations)/=0) then if(maxVal(phase_NstiffnessDegradations)/=0) then
do ph = 1, phases%length do ph = 1, phases%length
phase => phases%get(ph) phase => phases%get(ph)
mech => phase%get('mechanics') mech => phase%get('mechanical')
stiffDegradation => mech%get('stiffness_degradation',defaultVal=emptyList) stiffDegradation => mech%get('stiffness_degradation',defaultVal=emptyList)
do stiffDegradationCtr = 1, stiffDegradation%length do stiffDegradationCtr = 1, stiffDegradation%length
if(stiffDegradation%get_asString(stiffDegradationCtr) == 'damage') & if(stiffDegradation%get_asString(stiffDegradationCtr) == 'damage') &
@ -398,32 +398,31 @@ module subroutine mechanical_results(group,ph)
character(len=*), intent(in) :: group character(len=*), intent(in) :: group
integer, intent(in) :: ph integer, intent(in) :: ph
if (phase_plasticity(ph) /= PLASTICITY_NONE_ID) &
call results_closeGroup(results_addGroup(group//'plastic/')) call crystallite_results(group,ph)
select case(phase_plasticity(ph)) select case(phase_plasticity(ph))
case(PLASTICITY_ISOTROPIC_ID) case(PLASTICITY_ISOTROPIC_ID)
call plastic_isotropic_results(ph,group//'plastic/') call plastic_isotropic_results(ph,group//'mechanical/')
case(PLASTICITY_PHENOPOWERLAW_ID) case(PLASTICITY_PHENOPOWERLAW_ID)
call plastic_phenopowerlaw_results(ph,group//'plastic/') call plastic_phenopowerlaw_results(ph,group//'mechanical/')
case(PLASTICITY_KINEHARDENING_ID) case(PLASTICITY_KINEHARDENING_ID)
call plastic_kinehardening_results(ph,group//'plastic/') call plastic_kinehardening_results(ph,group//'mechanical/')
case(PLASTICITY_DISLOTWIN_ID) case(PLASTICITY_DISLOTWIN_ID)
call plastic_dislotwin_results(ph,group//'plastic/') call plastic_dislotwin_results(ph,group//'mechanical/')
case(PLASTICITY_DISLOTUNGSTEN_ID) case(PLASTICITY_DISLOTUNGSTEN_ID)
call plastic_dislotungsten_results(ph,group//'plastic/') call plastic_dislotungsten_results(ph,group//'mechanical/')
case(PLASTICITY_NONLOCAL_ID) case(PLASTICITY_NONLOCAL_ID)
call plastic_nonlocal_results(ph,group//'plastic/') call plastic_nonlocal_results(ph,group//'mechanical/')
end select end select
call crystallite_results(group,ph)
end subroutine mechanical_results end subroutine mechanical_results
@ -978,35 +977,35 @@ subroutine crystallite_results(group,ph)
character(len=:), allocatable :: structureLabel character(len=:), allocatable :: structureLabel
call results_closeGroup(results_addGroup(group//'/mechanics/')) call results_closeGroup(results_addGroup(group//'/mechanical'))
do ou = 1, size(output_constituent(ph)%label) do ou = 1, size(output_constituent(ph)%label)
select case (output_constituent(ph)%label(ou)) select case (output_constituent(ph)%label(ou))
case('F') case('F')
call results_writeDataset(group//'/mechanics/',phase_mechanical_F(ph)%data,'F',& call results_writeDataset(group//'/mechanical/',phase_mechanical_F(ph)%data,'F',&
'deformation gradient','1') 'deformation gradient','1')
case('F_e') case('F_e')
call results_writeDataset(group//'/mechanics/',phase_mechanical_Fe(ph)%data,'F_e',& call results_writeDataset(group//'/mechanical/',phase_mechanical_Fe(ph)%data,'F_e',&
'elastic deformation gradient','1') 'elastic deformation gradient','1')
case('F_p') case('F_p')
call results_writeDataset(group//'/mechanics/',phase_mechanical_Fp(ph)%data,'F_p', & call results_writeDataset(group//'/mechanical/',phase_mechanical_Fp(ph)%data,'F_p', &
'plastic deformation gradient','1') 'plastic deformation gradient','1')
case('F_i') case('F_i')
call results_writeDataset(group//'/mechanics/',phase_mechanical_Fi(ph)%data,'F_i', & call results_writeDataset(group//'/mechanical/',phase_mechanical_Fi(ph)%data,'F_i', &
'inelastic deformation gradient','1') 'inelastic deformation gradient','1')
case('L_p') case('L_p')
call results_writeDataset(group//'/mechanics/',phase_mechanical_Lp(ph)%data,'L_p', & call results_writeDataset(group//'/mechanical/',phase_mechanical_Lp(ph)%data,'L_p', &
'plastic velocity gradient','1/s') 'plastic velocity gradient','1/s')
case('L_i') case('L_i')
call results_writeDataset(group//'/mechanics/',phase_mechanical_Li(ph)%data,'L_i', & call results_writeDataset(group//'/mechanical/',phase_mechanical_Li(ph)%data,'L_i', &
'inelastic velocity gradient','1/s') 'inelastic velocity gradient','1/s')
case('P') case('P')
call results_writeDataset(group//'/mechanics/',phase_mechanical_P(ph)%data,'P', & call results_writeDataset(group//'/mechanical/',phase_mechanical_P(ph)%data,'P', &
'First Piola-Kirchhoff stress','Pa') 'first Piola-Kirchhoff stress','Pa')
case('S') case('S')
call results_writeDataset(group//'/mechanics/',phase_mechanical_S(ph)%data,'S', & call results_writeDataset(group//'/mechanical/',phase_mechanical_S(ph)%data,'S', &
'Second Piola-Kirchhoff stress','Pa') 'second Piola-Kirchhoff stress','Pa')
case('O') case('O')
select case(lattice_structure(ph)) select case(lattice_structure(ph))
case(lattice_ISO_ID) case(lattice_ISO_ID)
@ -1023,9 +1022,9 @@ subroutine crystallite_results(group,ph)
structureLabel = 'oP' structureLabel = 'oP'
end select end select
selected_rotations = select_rotations(crystallite_orientation,ph) selected_rotations = select_rotations(crystallite_orientation,ph)
call results_writeDataset(group//'/mechanics/',selected_rotations,output_constituent(ph)%label(ou),& call results_writeDataset(group//'/mechanical',selected_rotations,output_constituent(ph)%label(ou),&
'crystal orientation as quaternion','q_0 (q_1 q_2 q_3)') 'crystal orientation as quaternion','q_0 (q_1 q_2 q_3)')
call results_addAttribute('Lattice',structureLabel,group//'/mechanics/'//output_constituent(ph)%label(ou)) call results_addAttribute('lattice',structureLabel,group//'/mechanical/'//output_constituent(ph)%label(ou))
end select end select
enddo enddo

View File

@ -57,7 +57,7 @@ module subroutine eigendeformation_init(phases)
do ph = 1,phases%length do ph = 1,phases%length
phase => phases%get(ph) phase => phases%get(ph)
mechanics => phase%get('mechanics') mechanics => phase%get('mechanical')
kinematics => mechanics%get('eigen',defaultVal=emptyList) kinematics => mechanics%get('eigen',defaultVal=emptyList)
Nmodels(ph) = kinematics%length Nmodels(ph) = kinematics%length
enddo enddo
@ -98,7 +98,7 @@ function kinematics_active(kinematics_label,kinematics_length) result(active_ki
allocate(active_kinematics(kinematics_length,phases%length), source = .false. ) allocate(active_kinematics(kinematics_length,phases%length), source = .false. )
do p = 1, phases%length do p = 1, phases%length
phase => phases%get(p) phase => phases%get(p)
mechanics => phase%get('mechanics') mechanics => phase%get('mechanical')
kinematics => mechanics%get('eigen',defaultVal=emptyList) kinematics => mechanics%get('eigen',defaultVal=emptyList)
do k = 1, kinematics%length do k = 1, kinematics%length
kinematics_type => kinematics%get(k) kinematics_type => kinematics%get(k)

View File

@ -27,6 +27,4 @@ module function kinematics_cleavage_opening_init() result(myKinematics)
end function kinematics_cleavage_opening_init end function kinematics_cleavage_opening_init
end submodule cleavageopening end submodule cleavageopening

View File

@ -61,8 +61,8 @@ module function kinematics_slipplane_opening_init() result(myKinematics)
do p = 1, phases%length do p = 1, phases%length
if(myKinematics(p)) then if(myKinematics(p)) then
phase => phases%get(p) phase => phases%get(p)
mech => phase%get('mechanics') mech => phase%get('mechanical')
pl => mech%get('plasticity') pl => mech%get('plastic')
kinematics => phase%get('damage') kinematics => phase%get('damage')

View File

@ -449,8 +449,8 @@ function plastic_active(plastic_label) result(active_plastic)
allocate(active_plastic(phases%length), source = .false. ) allocate(active_plastic(phases%length), source = .false. )
do ph = 1, phases%length do ph = 1, phases%length
phase => phases%get(ph) phase => phases%get(ph)
mech => phase%get('mechanics') mech => phase%get('mechanical')
pl => mech%get('plasticity') pl => mech%get('plastic')
if(pl%get_asString('type') == plastic_label) active_plastic(ph) = .true. if(pl%get_asString('type') == plastic_label) active_plastic(ph) = .true.
enddo enddo

View File

@ -120,8 +120,8 @@ module function plastic_dislotungsten_init() result(myPlasticity)
associate(prm => param(ph), dot => dotState(ph), stt => state(ph), dst => dependentState(ph)) associate(prm => param(ph), dot => dotState(ph), stt => state(ph), dst => dependentState(ph))
phase => phases%get(ph) phase => phases%get(ph)
mech => phase%get('mechanics') mech => phase%get('mechanical')
pl => mech%get('plasticity') pl => mech%get('plastic')
#if defined (__GFORTRAN__) #if defined (__GFORTRAN__)
prm%output = output_asStrings(pl) prm%output = output_asStrings(pl)

View File

@ -173,8 +173,8 @@ module function plastic_dislotwin_init() result(myPlasticity)
associate(prm => param(ph), dot => dotState(ph), stt => state(ph), dst => dependentState(ph)) associate(prm => param(ph), dot => dotState(ph), stt => state(ph), dst => dependentState(ph))
phase => phases%get(ph) phase => phases%get(ph)
mech => phase%get('mechanics') mech => phase%get('mechanical')
pl => mech%get('plasticity') pl => mech%get('plastic')
#if defined (__GFORTRAN__) #if defined (__GFORTRAN__)
prm%output = output_asStrings(pl) prm%output = output_asStrings(pl)

View File

@ -85,8 +85,8 @@ module function plastic_isotropic_init() result(myPlasticity)
associate(prm => param(ph), dot => dotState(ph), stt => state(ph)) associate(prm => param(ph), dot => dotState(ph), stt => state(ph))
phase => phases%get(ph) phase => phases%get(ph)
mech => phase%get('mechanics') mech => phase%get('mechanical')
pl => mech%get('plasticity') pl => mech%get('plastic')
#if defined (__GFORTRAN__) #if defined (__GFORTRAN__)
prm%output = output_asStrings(pl) prm%output = output_asStrings(pl)

View File

@ -98,8 +98,8 @@ module function plastic_kinehardening_init() result(myPlasticity)
associate(prm => param(ph), dot => dotState(ph), dlt => deltaState(ph), stt => state(ph)) associate(prm => param(ph), dot => dotState(ph), dlt => deltaState(ph), stt => state(ph))
phase => phases%get(ph) phase => phases%get(ph)
mech => phase%get('mechanics') mech => phase%get('mechanical')
pl => mech%get('plasticity') pl => mech%get('plastic')
#if defined (__GFORTRAN__) #if defined (__GFORTRAN__)
prm%output = output_asStrings(pl) prm%output = output_asStrings(pl)

View File

@ -227,8 +227,8 @@ module function plastic_nonlocal_init() result(myPlasticity)
st0 => state0(ph), del => deltaState(ph), dst => microstructure(ph)) st0 => state0(ph), del => deltaState(ph), dst => microstructure(ph))
phase => phases%get(ph) phase => phases%get(ph)
mech => phase%get('mechanics') mech => phase%get('mechanical')
pl => mech%get('plasticity') pl => mech%get('plastic')
phase_localPlasticity(ph) = .not. pl%contains('nonlocal') phase_localPlasticity(ph) = .not. pl%contains('nonlocal')

View File

@ -107,8 +107,8 @@ module function plastic_phenopowerlaw_init() result(myPlasticity)
associate(prm => param(ph), dot => dotState(ph), stt => state(ph)) associate(prm => param(ph), dot => dotState(ph), stt => state(ph))
phase => phases%get(ph) phase => phases%get(ph)
mech => phase%get('mechanics') mech => phase%get('mechanical')
pl => mech%get('plasticity') pl => mech%get('plastic')
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! slip related parameters ! slip related parameters

View File

@ -67,11 +67,11 @@ subroutine results_init(restart)
if(.not. restart) then if(.not. restart) then
resultsFile = HDF5_openFile(getSolverJobName()//'.hdf5','w') resultsFile = HDF5_openFile(getSolverJobName()//'.hdf5','w')
call results_addAttribute('DADF5_version_major',0) call results_addAttribute('DADF5_version_major',0)
call results_addAttribute('DADF5_version_minor',11) call results_addAttribute('DADF5_version_minor',12)
call results_addAttribute('DAMASK_version',DAMASKVERSION) call results_addAttribute('DAMASK_version',DAMASKVERSION)
call get_command(commandLine) call get_command(commandLine)
call results_addAttribute('Call',trim(commandLine)) call results_addAttribute('call',trim(commandLine))
call results_closeGroup(results_addGroup('mapping')) call results_closeGroup(results_addGroup('cell_to'))
call results_closeJobFile call results_closeJobFile
endif endif
@ -105,12 +105,14 @@ subroutine results_addIncrement(inc,time)
integer, intent(in) :: inc integer, intent(in) :: inc
real(pReal), intent(in) :: time real(pReal), intent(in) :: time
character(len=pStringLen) :: incChar character(len=pStringLen) :: incChar
write(incChar,'(i10)') inc write(incChar,'(i10)') inc
call results_closeGroup(results_addGroup(trim('inc'//trim(adjustl(incChar))))) call results_closeGroup(results_addGroup(trim('increment_'//trim(adjustl(incChar)))))
call results_setLink(trim('inc'//trim(adjustl(incChar))),'current') call results_setLink(trim('increment_'//trim(adjustl(incChar))),'current')
call results_addAttribute('time/s',time,trim('inc'//trim(adjustl(incChar)))) call results_addAttribute('t/s',time,trim('increment_'//trim(adjustl(incChar))))
end subroutine results_addIncrement end subroutine results_addIncrement
@ -133,6 +135,7 @@ integer(HID_T) function results_openGroup(groupName)
character(len=*), intent(in) :: groupName character(len=*), intent(in) :: groupName
results_openGroup = HDF5_openGroup(resultsFile,groupName) results_openGroup = HDF5_openGroup(resultsFile,groupName)
end function results_openGroup end function results_openGroup
@ -145,6 +148,7 @@ integer(HID_T) function results_addGroup(groupName)
character(len=*), intent(in) :: groupName character(len=*), intent(in) :: groupName
results_addGroup = HDF5_addGroup(resultsFile,groupName) results_addGroup = HDF5_addGroup(resultsFile,groupName)
end function results_addGroup end function results_addGroup
@ -157,6 +161,7 @@ subroutine results_closeGroup(group_id)
integer(HID_T), intent(in) :: group_id integer(HID_T), intent(in) :: group_id
call HDF5_closeGroup(group_id) call HDF5_closeGroup(group_id)
end subroutine results_closeGroup end subroutine results_closeGroup
@ -169,6 +174,7 @@ subroutine results_setLink(path,link)
character(len=*), intent(in) :: path, link character(len=*), intent(in) :: path, link
call HDF5_setLink(resultsFile,path,link) call HDF5_setLink(resultsFile,path,link)
end subroutine results_setLink end subroutine results_setLink
@ -181,6 +187,7 @@ subroutine results_addAttribute_str(attrLabel,attrValue,path)
character(len=*), intent(in) :: attrLabel, attrValue character(len=*), intent(in) :: attrLabel, attrValue
character(len=*), intent(in), optional :: path character(len=*), intent(in), optional :: path
if (present(path)) then if (present(path)) then
call HDF5_addAttribute(resultsFile,attrLabel, attrValue, path) call HDF5_addAttribute(resultsFile,attrLabel, attrValue, path)
else else
@ -199,6 +206,7 @@ subroutine results_addAttribute_int(attrLabel,attrValue,path)
integer, intent(in) :: attrValue integer, intent(in) :: attrValue
character(len=*), intent(in), optional :: path character(len=*), intent(in), optional :: path
if (present(path)) then if (present(path)) then
call HDF5_addAttribute(resultsFile,attrLabel, attrValue, path) call HDF5_addAttribute(resultsFile,attrLabel, attrValue, path)
else else
@ -217,6 +225,7 @@ subroutine results_addAttribute_real(attrLabel,attrValue,path)
real(pReal), intent(in) :: attrValue real(pReal), intent(in) :: attrValue
character(len=*), intent(in), optional :: path character(len=*), intent(in), optional :: path
if (present(path)) then if (present(path)) then
call HDF5_addAttribute(resultsFile,attrLabel, attrValue, path) call HDF5_addAttribute(resultsFile,attrLabel, attrValue, path)
else else
@ -235,6 +244,7 @@ subroutine results_addAttribute_int_array(attrLabel,attrValue,path)
integer, intent(in), dimension(:) :: attrValue integer, intent(in), dimension(:) :: attrValue
character(len=*), intent(in), optional :: path character(len=*), intent(in), optional :: path
if (present(path)) then if (present(path)) then
call HDF5_addAttribute(resultsFile,attrLabel, attrValue, path) call HDF5_addAttribute(resultsFile,attrLabel, attrValue, path)
else else
@ -253,6 +263,7 @@ subroutine results_addAttribute_real_array(attrLabel,attrValue,path)
real(pReal), intent(in), dimension(:) :: attrValue real(pReal), intent(in), dimension(:) :: attrValue
character(len=*), intent(in), optional :: path character(len=*), intent(in), optional :: path
if (present(path)) then if (present(path)) then
call HDF5_addAttribute(resultsFile,attrLabel, attrValue, path) call HDF5_addAttribute(resultsFile,attrLabel, attrValue, path)
else else
@ -270,6 +281,7 @@ subroutine results_removeLink(link)
character(len=*), intent(in) :: link character(len=*), intent(in) :: link
integer :: hdferr integer :: hdferr
call h5ldelete_f(resultsFile,link, hdferr) call h5ldelete_f(resultsFile,link, hdferr)
if (hdferr < 0) call IO_error(1,ext_msg = 'results_removeLink: h5ldelete_soft_f ('//trim(link)//')') if (hdferr < 0) call IO_error(1,ext_msg = 'results_removeLink: h5ldelete_soft_f ('//trim(link)//')')
@ -277,7 +289,7 @@ end subroutine results_removeLink
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief stores a scalar dataset in a group !> @brief Store real scalar dataset with associated metadata.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine results_writeScalarDataset_real(group,dataset,label,description,SIunit) subroutine results_writeScalarDataset_real(group,dataset,label,description,SIunit)
@ -287,24 +299,17 @@ subroutine results_writeScalarDataset_real(group,dataset,label,description,SIuni
integer(HID_T) :: groupHandle integer(HID_T) :: groupHandle
groupHandle = results_openGroup(group) groupHandle = results_openGroup(group)
call HDF5_write(groupHandle,dataset,label) call HDF5_write(groupHandle,dataset,label)
call executionStamp(group//'/'//label,description,SIunit)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Description',description,label)
if (HDF5_objectExists(groupHandle,label) .and. present(SIunit)) &
call HDF5_addAttribute(groupHandle,'Unit',SIunit,label)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Creator','DAMASK '//DAMASKVERSION,label)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Created',now(),label)
call HDF5_closeGroup(groupHandle) call HDF5_closeGroup(groupHandle)
end subroutine results_writeScalarDataset_real end subroutine results_writeScalarDataset_real
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief stores a vector dataset in a group !> @brief Store real vector dataset with associated metadata.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine results_writeVectorDataset_real(group,dataset,label,description,SIunit) subroutine results_writeVectorDataset_real(group,dataset,label,description,SIunit)
@ -314,25 +319,18 @@ subroutine results_writeVectorDataset_real(group,dataset,label,description,SIuni
integer(HID_T) :: groupHandle integer(HID_T) :: groupHandle
groupHandle = results_openGroup(group) groupHandle = results_openGroup(group)
call HDF5_write(groupHandle,dataset,label) call HDF5_write(groupHandle,dataset,label)
call executionStamp(group//'/'//label,description,SIunit)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Description',description,label)
if (HDF5_objectExists(groupHandle,label) .and. present(SIunit)) &
call HDF5_addAttribute(groupHandle,'Unit',SIunit,label)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Creator','DAMASK '//DAMASKVERSION,label)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Created',now(),label)
call HDF5_closeGroup(groupHandle) call HDF5_closeGroup(groupHandle)
end subroutine results_writeVectorDataset_real end subroutine results_writeVectorDataset_real
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief stores a tensor dataset in a group !> @brief Store real tensor dataset with associated metadata.
!> @details Data is transposed to compenstate transposed storage order.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine results_writeTensorDataset_real(group,dataset,label,description,SIunit,transposed) subroutine results_writeTensorDataset_real(group,dataset,label,description,SIunit,transposed)
@ -353,35 +351,25 @@ subroutine results_writeTensorDataset_real(group,dataset,label,description,SIuni
transposed_ = .true. transposed_ = .true.
endif endif
groupHandle = results_openGroup(group)
if(transposed_) then if(transposed_) then
if(size(dataset,1) /= size(dataset,2)) error stop 'transpose non-symmetric tensor' if(size(dataset,1) /= size(dataset,2)) error stop 'transpose non-symmetric tensor'
allocate(dataset_transposed,mold=dataset) allocate(dataset_transposed,mold=dataset)
do i=1,size(dataset_transposed,3) do i=1,size(dataset_transposed,3)
dataset_transposed(:,:,i) = transpose(dataset(:,:,i)) dataset_transposed(:,:,i) = transpose(dataset(:,:,i))
enddo enddo
else
allocate(dataset_transposed,source=dataset)
endif
groupHandle = results_openGroup(group)
call HDF5_write(groupHandle,dataset_transposed,label) call HDF5_write(groupHandle,dataset_transposed,label)
else
if (HDF5_objectExists(groupHandle,label)) & call HDF5_write(groupHandle,dataset,label)
call HDF5_addAttribute(groupHandle,'Description',description,label) endif
if (HDF5_objectExists(groupHandle,label) .and. present(SIunit)) & call executionStamp(group//'/'//label,description,SIunit)
call HDF5_addAttribute(groupHandle,'Unit',SIunit,label)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Creator','DAMASK '//DAMASKVERSION,label)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Created',now(),label)
call HDF5_closeGroup(groupHandle) call HDF5_closeGroup(groupHandle)
end subroutine results_writeTensorDataset_real end subroutine results_writeTensorDataset_real
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief stores a vector dataset in a group !> @brief Store integer vector dataset with associated metadata.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine results_writeVectorDataset_int(group,dataset,label,description,SIunit) subroutine results_writeVectorDataset_int(group,dataset,label,description,SIunit)
@ -391,25 +379,17 @@ subroutine results_writeVectorDataset_int(group,dataset,label,description,SIunit
integer(HID_T) :: groupHandle integer(HID_T) :: groupHandle
groupHandle = results_openGroup(group) groupHandle = results_openGroup(group)
call HDF5_write(groupHandle,dataset,label) call HDF5_write(groupHandle,dataset,label)
call executionStamp(group//'/'//label,description,SIunit)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Description',description,label)
if (HDF5_objectExists(groupHandle,label) .and. present(SIunit)) &
call HDF5_addAttribute(groupHandle,'Unit',SIunit,label)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Creator','DAMASK '//DAMASKVERSION,label)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Created',now(),label)
call HDF5_closeGroup(groupHandle) call HDF5_closeGroup(groupHandle)
end subroutine results_writeVectorDataset_int end subroutine results_writeVectorDataset_int
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief stores a tensor dataset in a group !> @brief Store integer tensor dataset with associated metadata.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine results_writeTensorDataset_int(group,dataset,label,description,SIunit) subroutine results_writeTensorDataset_int(group,dataset,label,description,SIunit)
@ -419,20 +399,13 @@ subroutine results_writeTensorDataset_int(group,dataset,label,description,SIunit
integer(HID_T) :: groupHandle integer(HID_T) :: groupHandle
groupHandle = results_openGroup(group) groupHandle = results_openGroup(group)
call HDF5_write(groupHandle,dataset,label) call HDF5_write(groupHandle,dataset,label)
call executionStamp(group//'/'//label,description,SIunit)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Description',description,label)
if (HDF5_objectExists(groupHandle,label) .and. present(SIunit)) &
call HDF5_addAttribute(groupHandle,'Unit',SIunit,label)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Creator','DAMASK '//DAMASKVERSION,label)
if (HDF5_objectExists(groupHandle,label)) &
call HDF5_addAttribute(groupHandle,'Created',now(),label)
call HDF5_closeGroup(groupHandle) call HDF5_closeGroup(groupHandle)
end subroutine results_writeTensorDataset_int end subroutine results_writeTensorDataset_int
@ -458,8 +431,8 @@ subroutine results_mapping_phase(phaseAt,memberAtLocal,label)
integer(HID_T) :: & integer(HID_T) :: &
loc_id, & !< identifier of group in file loc_id, & !< identifier of group in file
dtype_id, & !< identifier of compound data type dtype_id, & !< identifier of compound data type
name_id, & !< identifier of name (string) in compound data type label_id, & !< identifier of label (string) in compound data type
position_id, & !< identifier of position/index (integer) in compound data type entry_id, & !< identifier of entry (integer) in compound data type
dset_id, & dset_id, &
memspace_id, & memspace_id, &
filespace_id, & filespace_id, &
@ -524,21 +497,21 @@ subroutine results_mapping_phase(phaseAt,memberAtLocal,label)
call h5tcreate_f(H5T_COMPOUND_F, type_size_string + type_size_int, dtype_id, hdferr) call h5tcreate_f(H5T_COMPOUND_F, type_size_string + type_size_int, dtype_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tinsert_f(dtype_id, "Name", 0_SIZE_T, dt_id,hdferr) call h5tinsert_f(dtype_id, 'label', 0_SIZE_T, dt_id,hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tinsert_f(dtype_id, "Position", type_size_string, H5T_NATIVE_INTEGER, hdferr) call h5tinsert_f(dtype_id, 'entry', type_size_string, H5T_NATIVE_INTEGER, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! create memory types for each component of the compound type ! create memory types for each component of the compound type
call h5tcreate_f(H5T_COMPOUND_F, type_size_string, name_id, hdferr) call h5tcreate_f(H5T_COMPOUND_F, type_size_string, label_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tinsert_f(name_id, "Name", 0_SIZE_T, dt_id, hdferr) call h5tinsert_f(label_id, 'label', 0_SIZE_T, dt_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tcreate_f(H5T_COMPOUND_F, type_size_int, position_id, hdferr) call h5tcreate_f(H5T_COMPOUND_F, type_size_int, entry_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tinsert_f(position_id, "Position", 0_SIZE_T, H5T_NATIVE_INTEGER, hdferr) call h5tinsert_f(entry_id, 'entry', 0_SIZE_T, H5T_NATIVE_INTEGER, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tclose_f(dt_id, hdferr) call h5tclose_f(dt_id, hdferr)
@ -560,14 +533,14 @@ subroutine results_mapping_phase(phaseAt,memberAtLocal,label)
call h5pset_preserve_f(plist_id, .true., hdferr) call h5pset_preserve_f(plist_id, .true., hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
loc_id = results_openGroup('/mapping') loc_id = results_openGroup('/cell_to')
call h5dcreate_f(loc_id, 'phase', dtype_id, filespace_id, dset_id, hdferr) call h5dcreate_f(loc_id, 'phase', dtype_id, filespace_id, dset_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5dwrite_f(dset_id, name_id, reshape(label(pack(phaseAtMaterialpoint,.true.)),myShape), & call h5dwrite_f(dset_id, label_id, reshape(label(pack(phaseAtMaterialpoint,.true.)),myShape), &
myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5dwrite_f(dset_id, position_id, reshape(pack(memberAtGlobal,.true.),myShape), & call h5dwrite_f(dset_id, entry_id, reshape(pack(memberAtGlobal,.true.),myShape), &
myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
@ -584,9 +557,9 @@ subroutine results_mapping_phase(phaseAt,memberAtLocal,label)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tclose_f(dtype_id, hdferr) call h5tclose_f(dtype_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tclose_f(name_id, hdferr) call h5tclose_f(label_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tclose_f(position_id, hdferr) call h5tclose_f(entry_id, hdferr)
end subroutine results_mapping_phase end subroutine results_mapping_phase
@ -613,8 +586,8 @@ subroutine results_mapping_homogenization(homogenizationAt,memberAtLocal,label)
integer(HID_T) :: & integer(HID_T) :: &
loc_id, & !< identifier of group in file loc_id, & !< identifier of group in file
dtype_id, & !< identifier of compound data type dtype_id, & !< identifier of compound data type
name_id, & !< identifier of name (string) in compound data type label_id, & !< identifier of label (string) in compound data type
position_id, & !< identifier of position/index (integer) in compound data type entry_id, & !< identifier of entry (integer) in compound data type
dset_id, & dset_id, &
memspace_id, & memspace_id, &
filespace_id, & filespace_id, &
@ -680,21 +653,21 @@ subroutine results_mapping_homogenization(homogenizationAt,memberAtLocal,label)
call h5tcreate_f(H5T_COMPOUND_F, type_size_string + type_size_int, dtype_id, hdferr) call h5tcreate_f(H5T_COMPOUND_F, type_size_string + type_size_int, dtype_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tinsert_f(dtype_id, "Name", 0_SIZE_T, dt_id,hdferr) call h5tinsert_f(dtype_id, 'label', 0_SIZE_T, dt_id,hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tinsert_f(dtype_id, "Position", type_size_string, H5T_NATIVE_INTEGER, hdferr) call h5tinsert_f(dtype_id, 'entry', type_size_string, H5T_NATIVE_INTEGER, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! create memory types for each component of the compound type ! create memory types for each component of the compound type
call h5tcreate_f(H5T_COMPOUND_F, type_size_string, name_id, hdferr) call h5tcreate_f(H5T_COMPOUND_F, type_size_string, label_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tinsert_f(name_id, "Name", 0_SIZE_T, dt_id, hdferr) call h5tinsert_f(label_id, 'label', 0_SIZE_T, dt_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tcreate_f(H5T_COMPOUND_F, type_size_int, position_id, hdferr) call h5tcreate_f(H5T_COMPOUND_F, type_size_int, entry_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tinsert_f(position_id, "Position", 0_SIZE_T, H5T_NATIVE_INTEGER, hdferr) call h5tinsert_f(entry_id, 'entry', 0_SIZE_T, H5T_NATIVE_INTEGER, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tclose_f(dt_id, hdferr) call h5tclose_f(dt_id, hdferr)
@ -716,14 +689,14 @@ subroutine results_mapping_homogenization(homogenizationAt,memberAtLocal,label)
call h5pset_preserve_f(plist_id, .true., hdferr) call h5pset_preserve_f(plist_id, .true., hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
loc_id = results_openGroup('/mapping') loc_id = results_openGroup('/cell_to')
call h5dcreate_f(loc_id, 'homogenization', dtype_id, filespace_id, dset_id, hdferr) call h5dcreate_f(loc_id, 'homogenization', dtype_id, filespace_id, dset_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5dwrite_f(dset_id, name_id, reshape(label(pack(homogenizationAtMaterialpoint,.true.)),myShape), & call h5dwrite_f(dset_id, label_id, reshape(label(pack(homogenizationAtMaterialpoint,.true.)),myShape), &
myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5dwrite_f(dset_id, position_id, reshape(pack(memberAtGlobal,.true.),myShape), & call h5dwrite_f(dset_id, entry_id, reshape(pack(memberAtGlobal,.true.),myShape), &
myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id) myShape, hdferr, file_space_id = filespace_id, mem_space_id = memspace_id, xfer_prp = plist_id)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
@ -740,26 +713,50 @@ subroutine results_mapping_homogenization(homogenizationAt,memberAtLocal,label)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tclose_f(dtype_id, hdferr) call h5tclose_f(dtype_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tclose_f(name_id, hdferr) call h5tclose_f(label_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
call h5tclose_f(position_id, hdferr) call h5tclose_f(entry_id, hdferr)
if(hdferr < 0) error stop 'HDF5 error' if(hdferr < 0) error stop 'HDF5 error'
end subroutine results_mapping_homogenization end subroutine results_mapping_homogenization
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief current date and time (including time zone information) !> @brief Add default information to a dataset.
!--------------------------------------------------------------------------------------------------
subroutine executionStamp(path,description,SIunit)
character(len=*), intent(in) :: path,description
character(len=*), intent(in), optional :: SIunit
if (HDF5_objectExists(resultsFile,path)) &
call HDF5_addAttribute(resultsFile,'description',description,path)
if (HDF5_objectExists(resultsFile,path) .and. present(SIunit)) &
call HDF5_addAttribute(resultsFile,'unit',SIunit,path)
if (HDF5_objectExists(resultsFile,path)) &
call HDF5_addAttribute(resultsFile,'creator','DAMASK '//DAMASKVERSION,path)
if (HDF5_objectExists(resultsFile,path)) &
call HDF5_addAttribute(resultsFile,'created',now(),path)
end subroutine executionStamp
!--------------------------------------------------------------------------------------------------
!> @brief Return current date and time (including time zone information).
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
character(len=24) function now() character(len=24) function now()
character(len=5) :: zone character(len=5) :: zone
integer, dimension(8) :: values integer, dimension(8) :: values
call date_and_time(values=values,zone=zone) call date_and_time(values=values,zone=zone)
write(now,'(i4.4,5(a,i2.2),a)') & write(now,'(i4.4,5(a,i2.2),a)') &
values(1),'-',values(2),'-',values(3),' ',values(5),':',values(6),':',values(7),zone values(1),'-',values(2),'-',values(3),' ',values(5),':',values(6),':',values(7),zone
end function now end function now
end module results end module results