Merge remote-tracking branch 'origin/development' into YAML-error-message

This commit is contained in:
Sharan Roongta 2021-03-28 21:59:08 +02:00
commit ecf5639360
89 changed files with 69844 additions and 1763 deletions

@ -1 +1 @@
Subproject commit 48dd9972d9023caa8b04226112dcdd57fa0be6af Subproject commit 6abcd3dba91f37c747eae04c6695949e819ec54b

View File

@ -1 +1 @@
v3.0.0-alpha2-572-g7b89cb41f v3.0.0-alpha2-662-gb36ff26cb

View File

@ -1,8 +1,8 @@
TWIP_Steel_FeMnC: TWIP_Steel_FeMnC:
lattice: cF lattice: cF
mechanics: mechanical:
elasticity: {type: hooke, C_11: 175.0e9, C_12: 115.0e9, C_44: 135.0e9} elastic: {type: hooke, C_11: 175.0e9, C_12: 115.0e9, C_44: 135.0e9}
plasticity: plastic:
type: dislotwin type: dislotwin
output: [rho_mob, rho_dip, gamma_sl, Lambda_sl, tau_pass, f_tw, Lambda_tw, tau_hat_tw, f_tr] output: [rho_mob, rho_dip, gamma_sl, Lambda_sl, tau_pass, f_tw, Lambda_tw, tau_hat_tw, f_tr]
D: 2.0e-5 D: 2.0e-5

View File

@ -1,8 +1,8 @@
Tungsten: Tungsten:
lattice: cI lattice: cI
mechanics: mechanical:
elasticity: {type: hooke, C_11: 523.0e9, C_12: 202.0e9, C_44: 161.0e9} # Marinica et al. Journal of Physics: Condensed Matter(2013) elastic: {type: hooke, C_11: 523.0e9, C_12: 202.0e9, C_44: 161.0e9} # Marinica et al. Journal of Physics: Condensed Matter(2013)
plasticity: plastic:
type: dislotwin type: dislotwin
D: 2.0e-5 # Average grain size / m D: 2.0e-5 # Average grain size / m
N_sl: [12] N_sl: [12]

View File

@ -1,10 +1,10 @@
# Kuo, J. C., Mikrostrukturmechanik von Bikristallen mit Kippkorngrenzen. Shaker-Verlag 2004. http://edoc.mpg.de/204079 # Kuo, J. C., Mikrostrukturmechanik von Bikristallen mit Kippkorngrenzen. Shaker-Verlag 2004. http://edoc.mpg.de/204079
Aluminum: Aluminum:
lattice: aP lattice: aP
mechanics: mechanical:
output: [F, P, F_e, F_p, L_p] output: [F, P, F_e, F_p, L_p]
elasticity: {type: hooke, C_11: 110.9e9, C_12: 58.34e9} elastic: {type: hooke, C_11: 110.9e9, C_12: 58.34e9}
plasticity: plastic:
type: isotropic type: isotropic
output: [xi] output: [xi]
xi_0: 31e6 xi_0: 31e6

View File

@ -1,9 +1,9 @@
Air: FreeSurface:
lattice: aP lattice: aP
mechanics: mechanical:
output: [F, P, F_e, F_p, L_p] output: [F, P, F_e, F_p, L_p]
elasticity: {type: hooke, C_11: 1e8, C_12: 1e6} elastic: {type: hooke, C_11: 1e8, C_12: 1e6}
plasticity: plastic:
type: isotropic type: isotropic
output: [xi] output: [xi]
xi_0: 0.3e6 xi_0: 0.3e6

View File

@ -1,9 +1,9 @@
Aluminum: Aluminum:
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
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001

View File

@ -3,9 +3,9 @@
# Diehl et.al. 2015 Meccanica # Diehl et.al. 2015 Meccanica
Ferrite: Ferrite:
lattice: cI lattice: cI
mechanics: mechanical:
elasticity: {C_11: 233.3e9, C_12: 135.5e9, C_44: 118.0e9, type: hooke} elastic: {C_11: 233.3e9, C_12: 135.5e9, C_44: 118.0e9, type: hooke}
plasticity: plastic:
N_sl: [12, 12] N_sl: [12, 12]
a_sl: 2.0 a_sl: 2.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001

View File

@ -3,9 +3,9 @@
# Diehl et.al. 2015 Meccanica # Diehl et.al. 2015 Meccanica
Martensite: Martensite:
lattice: cI lattice: cI
mechanics: mechanical:
elasticity: {C_11: 417.4e9, C_12: 242.4e9, C_44: 211.1e9, type: hooke} elastic: {C_11: 417.4e9, C_12: 242.4e9, C_44: 211.1e9, type: hooke}
plasticity: plastic:
N_sl: [12, 12] N_sl: [12, 12]
a_sl: 2.0 a_sl: 2.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001

View File

@ -5,10 +5,10 @@
Gold: Gold:
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: {type: hooke, C_11: 191e9, C_12: 162e9, C_44: 42.2e9} elastic: {type: hooke, C_11: 191e9, C_12: 162e9, C_44: 42.2e9}
plasticity: plastic:
type: phenopowerlaw type: phenopowerlaw
output: [xi_sl] output: [xi_sl]
N_sl: [12] N_sl: [12]

View File

@ -2,10 +2,10 @@
Magnesium: Magnesium:
lattice: hP lattice: hP
c/a: 1.62350 c/a: 1.62350
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: 59.3e9, C_12: 25.7e9, C_13: 21.4e9, C_33: 61.5e9, C_44: 16.4e9, type: hooke} elastic: {C_11: 59.3e9, C_12: 25.7e9, C_13: 21.4e9, C_33: 61.5e9, C_44: 16.4e9, type: hooke}
plasticity: plastic:
N_sl: [3, 3, 0, 6, 0, 6] N_sl: [3, 3, 0, 6, 0, 6]
N_tw: [6, 0, 0, 6] N_tw: [6, 0, 0, 6]
h_0_tw_tw: 50.0e6 h_0_tw_tw: 50.0e6
@ -20,9 +20,6 @@ Magnesium:
xi_0_sl: [10.0e6, 55.0e6, 0, 60.0e6, 0.0, 60.0e6] xi_0_sl: [10.0e6, 55.0e6, 0, 60.0e6, 0.0, 60.0e6]
xi_inf_sl: [40.0e6, 135.0e6, 0, 150.0e6, 0.0, 150.0e6] xi_inf_sl: [40.0e6, 135.0e6, 0, 150.0e6, 0.0, 150.0e6]
xi_0_tw: [40e6, 0.0, 0.0, 60.0e6] xi_0_tw: [40e6, 0.0, 0.0, 60.0e6]
####################################################
# open for discussion
####################################################
a_sl: 2.25 a_sl: 2.25
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
dot_gamma_0_tw: 0.001 dot_gamma_0_tw: 0.001

View File

@ -1,13 +1,14 @@
# M. Levy, Handbook of Elastic Properties of Solids, Liquids, and Gases (2001) # M. Levy, Handbook of Elastic Properties of Solids, Liquids, and Gases (2001)
# C. Zambaldi, "Orientation informed nanoindentation of a-titanium: Indentation pileup in hexagonal metals deforming by prismatic slip", J. Mater. Res., Vol. 27, No. 1, Jan 14, 2012 # C. Zambaldi, "Orientation informed nanoindentation of a-titanium: Indentation pileup in hexagonal metals deforming by prismatic slip", J. Mater. Res., Vol. 27, No. 1, Jan 14, 2012
Ti-alpha: # Better use values from L. Wang, Z. Zheng, H. Phukan, P. Kenesei, J.-S. Park, J. Lind, R.M. Suter, T.R. Bieler, Direct measurement of critical resolved shear stress of prismatic and basal slip in polycrystalline Ti using high energy X-ray diffraction microscopy, Acta Mater 2017
cpTi:
lattice: hP lattice: hP
c/a: 1.587 c/a: 1.587
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: 160.0e9, C_12: 90.0e9, C_13: 66.0e9, C_33: 181.7e9, C_44: 46.5e9, type: hooke} elastic: {C_11: 160.0e9, C_12: 90.0e9, C_13: 66.0e9, C_33: 181.7e9, C_44: 46.5e9, type: hooke}
plasticity: plastic:
N_sl: [3, 3, 0, 0, 12] N_sl: [3, 3, 0, 6, 12]
a_sl: 2.0 a_sl: 2.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
h_0_sl_sl: 200e6 h_0_sl_sl: 200e6
@ -15,5 +16,5 @@ Ti-alpha:
n_sl: 20 n_sl: 20
output: [gamma_sl] output: [gamma_sl]
type: phenopowerlaw type: phenopowerlaw
xi_0_sl: [349e6, 150e6, 0, 0, 1107e6] xi_0_sl: [0.15e9, 0.09e9, 0, 0.20e9, 0.25e9]
xi_inf_sl: [568e6, 1502e6, 0, 0, 3420e6] xi_inf_sl: [0.24e9, 0.5e9, 0, 0.6e9, 0.8e9]

View File

@ -2,7 +2,7 @@
homogenization: homogenization:
SX: SX:
N_constituents: 1 N_constituents: 1
mechanics: {type: pass} mechanical: {type: pass}
material: material:
- homogenization: SX - homogenization: SX
@ -109,10 +109,10 @@ material:
phase: phase:
Aluminum: Aluminum:
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

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

@ -65,7 +65,7 @@ if filenames == []: parser.error('no input file specified.')
for name in filenames: for name in filenames:
damask.util.report(scriptName,name) damask.util.report(scriptName,name)
geom = damask.Grid.load_DREAM3D(name,options.basegroup,options.pointwise) geom = damask.Grid.load_DREAM3D(name,'FeatureIds')
damask.util.croak(geom) damask.util.croak(geom)
geom.save_ASCII(os.path.splitext(name)[0]+'.geom') geom.save_ASCII(os.path.splitext(name)[0]+'.geom')

View File

@ -27,12 +27,14 @@ class Colormap(mpl.colors.ListedColormap):
References References
---------- ----------
[1] DAMASK colormap theory K. Moreland, Proceedings of the 5th International Symposium on Advances in Visual Computing, 2009
https://www.kennethmoreland.com/color-maps/ColorMapsExpanded.pdf https://doi.org/10.1007/978-3-642-10520-3_9
[2] DAMASK colormaps first use
https://doi.org/10.1016/j.ijplas.2012.09.012 P. Eisenlohr et al., International Journal of Plasticity 46:3753, 2013
[3] Matplotlib colormaps overview https://doi.org/10.1016/j.ijplas.2012.09.012
https://matplotlib.org/tutorials/colors/colormaps.html
Matplotlib colormaps overview
https://matplotlib.org/tutorials/colors/colormaps.html
""" """
@ -524,7 +526,7 @@ class Colormap(mpl.colors.ListedColormap):
References References
---------- ----------
http://www.ryanjuckett.com/programming/rgb-color-space-conversion https://www.easyrgb.com/en/math.php
""" """
rgb_lin = np.dot(np.array([ rgb_lin = np.dot(np.array([
@ -544,7 +546,7 @@ class Colormap(mpl.colors.ListedColormap):
References References
---------- ----------
http://www.ryanjuckett.com/programming/rgb-color-space-conversion https://www.easyrgb.com/en/math.php
""" """
rgb_lin = np.where(rgb>0.04045,((rgb+0.0555)/1.0555)**2.4,rgb/12.92) rgb_lin = np.where(rgb>0.04045,((rgb+0.0555)/1.0555)**2.4,rgb/12.92)

View File

@ -1,10 +1,14 @@
import copy import copy
from io import StringIO from io import StringIO
from collections.abc import Iterable
import abc import abc
import numpy as np import numpy as np
import yaml import yaml
from . import Rotation
from . import Orientation
class NiceDumper(yaml.SafeDumper): class NiceDumper(yaml.SafeDumper):
"""Make YAML readable for humans.""" """Make YAML readable for humans."""
@ -19,8 +23,12 @@ class NiceDumper(yaml.SafeDumper):
def represent_data(self, data): def represent_data(self, data):
"""Cast Config objects and its subclasses to dict.""" """Cast Config objects and its subclasses to dict."""
return self.represent_data(dict(data)) if isinstance(data, dict) and type(data) != dict else \ if isinstance(data, dict) and type(data) != dict:
super().represent_data(data) return self.represent_data(dict(data))
if isinstance(data, (Rotation, Orientation)):
return self.represent_data(data.as_quaternion())
else:
return super().represent_data(data)
def ignore_aliases(self, data): def ignore_aliases(self, data):
"""No references.""" """No references."""
@ -44,6 +52,42 @@ class Config(dict):
copy = __copy__ copy = __copy__
def __or__(self,other):
"""
Update configuration with contents of other.
Parameters
----------
other : damask.Config or dict
Key-value pairs that update self.
"""
duplicate = self.copy()
duplicate.update(other)
return duplicate
def __ior__(self,other):
"""Update configuration with contents of other."""
return self.__or__(other)
def delete(self,keys):
"""
Remove configuration keys.
Parameters
----------
keys : iterable or scalar
Label of the key(s) to remove.
"""
duplicate = self.copy()
for k in keys if isinstance(keys, Iterable) and not isinstance(keys, str) else [keys]:
del duplicate[k]
return duplicate
@classmethod @classmethod
def load(cls,fname): def load(cls,fname):
""" """
@ -99,30 +143,6 @@ class Config(dict):
fhandle.write(yaml.dump(self,Dumper=NiceDumper,**kwargs)) fhandle.write(yaml.dump(self,Dumper=NiceDumper,**kwargs))
def add(self,d):
"""
Add dictionary.
d : dict
Dictionary to append.
"""
duplicate = self.copy()
duplicate.update(d)
return duplicate
def delete(self,key):
"""
Delete item.
key : str or scalar
Label of the key to remove.
"""
duplicate = self.copy()
del duplicate[key]
return duplicate
@property @property
@abc.abstractmethod @abc.abstractmethod
def is_complete(self): def is_complete(self):

View File

@ -1,4 +1,7 @@
import os.path
import numpy as np import numpy as np
import h5py
from . import Config from . import Config
from . import Rotation from . import Rotation
@ -49,7 +52,7 @@ class ConfigMaterial(Config):
@staticmethod @staticmethod
def from_table(table,**kwargs): def from_table(table,**kwargs):
""" """
Load from an ASCII table. Generate from an ASCII table.
Parameters Parameters
---------- ----------
@ -85,7 +88,7 @@ class ConfigMaterial(Config):
phase: {} phase: {}
""" """
kwargs_ = {k:table.get(v) for k,v in kwargs.items()} kwargs_ = {k:table.get(v) for k,v in kwargs.items()}
_,idx = np.unique(np.hstack(list(kwargs_.values())),return_index=True,axis=0) _,idx = np.unique(np.hstack(list(kwargs_.values())),return_index=True,axis=0)
idx = np.sort(idx) idx = np.sort(idx)
@ -94,6 +97,79 @@ class ConfigMaterial(Config):
return ConfigMaterial().material_add(**kwargs_) return ConfigMaterial().material_add(**kwargs_)
@staticmethod
def load_DREAM3D(fname,
grain_data=None,cell_data=None,cell_ensemble_data='CellEnsembleData',
phases='Phases',Euler_angles='EulerAngles',phase_names='PhaseName',
base_group=None):
"""
Load DREAM.3D (HDF5) file.
Data in DREAM.3D files can be stored per cell ('CellData')
and/or per grain ('Grain Data'). Per default, cell-wise data
is assumed.
damask.Grid.load_DREAM3D allows to get the corresponding geometry
for the grid solver.
Parameters
----------
fname : str
Filename of the DREAM.3D (HDF5) file.
grain_data : str
Name of the group (folder) containing grain-wise data. Defaults
to None, in which case cell-wise data is used.
cell_data : str
Name of the group (folder) containing cell-wise data. Defaults to
None in wich case it is automatically detected.
cell_ensemble_data : str
Name of the group (folder) containing data of cell ensembles. This
group is used to inquire the name of the phases. Phases will get
numeric IDs if this group is not found. Defaults to 'CellEnsembleData'.
phases : str
Name of the dataset containing the phase ID (cell-wise or grain-wise).
Defaults to 'Phases'.
Euler_angles : str
Name of the dataset containing the crystallographic orientation as
Euler angles in radians (cell-wise or grain-wise). Defaults to 'EulerAngles'.
phase_names : str
Name of the dataset containing the phase names. Phases will get
numeric IDs if this dataset is not found. Defaults to 'PhaseName'.
base_group : str
Path to the group (folder) that contains geometry (_SIMPL_GEOMETRY),
and grain- or cell-wise data. Defaults to None, in which case
it is set as the path that contains _SIMPL_GEOMETRY/SPACING.
"""
b = util.DREAM3D_base_group(fname) if base_group is None else base_group
c = util.DREAM3D_cell_data_group(fname) if cell_data is None else cell_data
f = h5py.File(fname,'r')
if grain_data is None:
phase = f[os.path.join(b,c,phases)][()].flatten()
O = Rotation.from_Euler_angles(f[os.path.join(b,c,Euler_angles)]).as_quaternion().reshape(-1,4) # noqa
_,idx = np.unique(np.hstack([O,phase.reshape(-1,1)]),return_index=True,axis=0)
idx = np.sort(idx)
else:
phase = f[os.path.join(b,grain_data,phases)][()]
O = Rotation.from_Euler_angles(f[os.path.join(b,grain_data,Euler_angles)]).as_quaternion() # noqa
idx = np.arange(phase.size)
if cell_ensemble_data is not None and phase_names is not None:
try:
names = np.array([s.decode() for s in f[os.path.join(b,cell_ensemble_data,phase_names)]])
phase = names[phase]
except KeyError:
pass
base_config = ConfigMaterial({'phase':{k if isinstance(k,int) else str(k):'t.b.d.' for k in np.unique(phase)},
'homogenization':{'direct':{'N_constituents':1}}})
constituent = {k:np.atleast_1d(v[idx].squeeze()) for k,v in zip(['O','phase'],[O,phase])}
return base_config.material_add(**constituent,homogenization='direct')
@property @property
def is_complete(self): def is_complete(self):
"""Check for completeness.""" """Check for completeness."""

View File

@ -256,35 +256,62 @@ class Grid:
@staticmethod @staticmethod
def load_DREAM3D(fname,base_group,point_data=None,material='FeatureIds'): def load_DREAM3D(fname,
feature_IDs=None,cell_data=None,
phases='Phases',Euler_angles='EulerAngles',
base_group=None):
""" """
Load from DREAM.3D file. Load DREAM.3D (HDF5) file.
Data in DREAM.3D files can be stored per cell ('CellData')
and/or per grain ('Grain Data'). Per default, cell-wise data
is assumed.
damask.ConfigMaterial.load_DREAM3D allows to get the
corresponding material definition.
Parameters Parameters
---------- ----------
fname : str fname : str
Filename of the DREAM.3D file Filename of the DREAM.3D (HDF5) file.
feature_IDs : str
Name of the dataset containing the mapping between cells and
grain-wise data. Defaults to 'None', in which case cell-wise
data is used.
cell_data : str
Name of the group (folder) containing cell-wise data. Defaults to
None in wich case it is automatically detected.
phases : str
Name of the dataset containing the phase ID. It is not used for
grain-wise data, i.e. when feature_IDs is not None.
Defaults to 'Phases'.
Euler_angles : str
Name of the dataset containing the crystallographic orientation as
Euler angles in radians It is not used for grain-wise data, i.e.
when feature_IDs is not None. Defaults to 'EulerAngles'.
base_group : str base_group : str
Name of the group (folder) below 'DataContainers', Path to the group (folder) that contains geometry (_SIMPL_GEOMETRY),
for example 'SyntheticVolumeDataContainer'. and grain- or cell-wise data. Defaults to None, in which case
point_data : str, optional it is set as the path that contains _SIMPL_GEOMETRY/SPACING.
Name of the group (folder) containing the pointwise material data,
for example 'CellData'. Defaults to None, in which case points are consecutively numbered.
material : str, optional
Name of the dataset containing the material ID.
Defaults to 'FeatureIds'.
""" """
root_dir ='DataContainers' b = util.DREAM3D_base_group(fname) if base_group is None else base_group
c = util.DREAM3D_cell_data_group(fname) if cell_data is None else cell_data
f = h5py.File(fname, 'r') f = h5py.File(fname, 'r')
g = os.path.join(root_dir,base_group,'_SIMPL_GEOMETRY')
cells = f[os.path.join(g,'DIMENSIONS')][()]
size = f[os.path.join(g,'SPACING')][()] * cells
origin = f[os.path.join(g,'ORIGIN')][()]
ma = np.arange(cells.prod(),dtype=int) \ cells = f[os.path.join(b,'_SIMPL_GEOMETRY','DIMENSIONS')][()]
if point_data is None else \ size = f[os.path.join(b,'_SIMPL_GEOMETRY','SPACING')] * cells
np.reshape(f[os.path.join(root_dir,base_group,point_data,material)],cells.prod()) origin = f[os.path.join(b,'_SIMPL_GEOMETRY','ORIGIN')][()]
if feature_IDs is None:
phase = f[os.path.join(b,c,phases)][()].reshape(-1,1)
O = Rotation.from_Euler_angles(f[os.path.join(b,c,Euler_angles)]).as_quaternion().reshape(-1,4) # noqa
unique,unique_inverse = np.unique(np.hstack([O,phase]),return_inverse=True,axis=0)
ma = np.arange(cells.prod()) if len(unique) == cells.prod() else \
np.arange(unique.size)[np.argsort(pd.unique(unique_inverse))][unique_inverse]
else:
ma = f[os.path.join(b,c,feature_IDs)][()].flatten()
return Grid(ma.reshape(cells,order='F'),size,origin,util.execution_stamp('Grid','load_DREAM3D')) return Grid(ma.reshape(cells,order='F'),size,origin,util.execution_stamp('Grid','load_DREAM3D'))
@ -482,18 +509,13 @@ class Grid:
References References
---------- ----------
Sébastien B G Blanquer, Maike Werner, Markus Hannula, Shahriar Sharifi, S.B.G. Blanquer et al., Biofabrication 9(2):025001, 2017
Guillaume P R Lajoinie, David Eglin, Jari Hyttinen, André A Poot, and Dirk W Grijpma
Surface curvature in triply-periodic minimal surface architectures as
a distinct design parameter in preparing advanced tissue engineering scaffolds
https://doi.org/10.1088/1758-5090/aa6553 https://doi.org/10.1088/1758-5090/aa6553
Meinhard Wohlgemuth, Nataliya Yufa, James Hoffman, and Edwin L. Thomas M. Wohlgemuth et al., Macromolecules 34(17):6083-6089, 2001
Triply Periodic Bicontinuous Cubic Microdomain Morphologies by Symmetries
https://doi.org/10.1021/ma0019499 https://doi.org/10.1021/ma0019499
Meng-Ting Hsieh, Lorenzo Valdevit M.-T. Hsieh and L. Valdevit, Software Impacts 6:100026, 2020
Minisurf A minimal surface generator for finite element modeling and additive manufacturing
https://doi.org/10.1016/j.simpa.2020.100026 https://doi.org/10.1016/j.simpa.2020.100026
""" """

View File

@ -742,8 +742,7 @@ class Orientation(Rotation):
References References
---------- ----------
C.T. Young and J.L. Lytton, J. Appl. Phys. 43:14081417, 1972 C.T. Young and J.L. Lytton, Journal of Applied Physics 43:14081417, 1972
"Computer Generation and Identification of Kikuchi Projections"
https://doi.org/10.1063/1.1661333 https://doi.org/10.1063/1.1661333
""" """
@ -1070,8 +1069,7 @@ class Orientation(Rotation):
References References
---------- ----------
J.C. Glez and J. Driver, J. Appl. Cryst. 34:280-288, 2001 J.C. Glez and J. Driver, Journal of Applied Crystallography 34:280-288, 2001
"Orientation distribution analysis in deformed grains"
https://doi.org/10.1107/S0021889801003077 https://doi.org/10.1107/S0021889801003077
""" """

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,35 +376,39 @@ 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):
path = os.path.join(group,dataset) path = '/'.join([group,dataset])
inc,prop,name,cat,item = (path.split('/') + ['']*5)[:5] inc,prop,name,cat,item = (path.split('/') + ['']*5)[:5]
key = '/'.join([prop,name+tag]) key = '/'.join([prop,name+tag])
if key not in inGeom: if key not in inGeom:
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,
dtype=np.dtype(f[path])) dtype=np.dtype(f[path]))
data[inGeom[key]] = (f[path] if len(shape)>1 else np.expand_dims(f[path],1))[inData[key]] data[inGeom[key]] = (f[path] if len(shape)>1 else np.expand_dims(f[path],1))[inData[key]]
path = (os.path.join(*([prop,name]+([cat] if cat else [])+([item] if item else []))) if split else path)+tag path = ('/'.join([prop,name]+([cat] if cat else [])+([item] if item else [])) if split else path)+tag
if split: if split:
try: try:
tbl[inc].add(path,data) tbl[inc] = tbl[inc].add(path,data)
except KeyError: except KeyError:
tbl[inc] = Table(data.reshape(self.N_materialpoints,-1),{path:data.shape[1:]}) tbl[inc] = Table(data.reshape(self.N_materialpoints,-1),{path:data.shape[1:]})
else: else:
try: try:
tbl.add(path,data) tbl = tbl.add(path,data)
except AttributeError: except AttributeError:
tbl = Table(data.reshape(self.N_materialpoints,-1),{path:data.shape[1:]}) tbl = Table(data.reshape(self.N_materialpoints,-1),{path:data.shape[1:]})
@ -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)
ph_name = re.compile(r'(?<=(phase\/))(.*?)(?=(mechanics))') # identify phase name if self.version_minor < 12:
dset_name = prefix+re.sub(ph_name,r'',paths[0].split('/',1)[1]) # remove phase name ph_name = re.compile(r'(?<=(phase\/))(.*?)(?=(mechanics))') # identify phase name
v.add(array,dset_name+f' / {self._get_attribute(paths[0],"Unit")}') 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
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

@ -357,10 +357,8 @@ class Rotation:
References References
---------- ----------
Quaternion averaging F. Landis Markley et al., Journal of Guidance, Control, and Dynamics 30(4):1193-1197, 2007
F. Landis Markley, Yang Cheng, John L. Crassidis, Yaakov Oshman https://doi.org/10.2514/1.28949
Journal of Guidance, Control, and Dynamics 30(4):1193-1197, 2007
10.2514/1.28949
""" """
def _M(quat): def _M(quat):
@ -859,7 +857,7 @@ class Rotation:
References References
---------- ----------
P. Eisenlohr, F. Roters, Computational Materials Science 42(4), 670-678, 2008 P. Eisenlohr and F. Roters, Computational Materials Science 42(4):670-678, 2008
https://doi.org/10.1016/j.commatsci.2007.09.015 https://doi.org/10.1016/j.commatsci.2007.09.015
""" """

View File

@ -189,6 +189,11 @@ class Table:
label : str label : str
Column label. Column label.
Returns
-------
data : numpy.ndarray
Array of column data.
""" """
if re.match(r'[0-9]*?_',label): if re.match(r'[0-9]*?_',label):
idx,key = label.split('_',1) idx,key = label.split('_',1)
@ -212,6 +217,11 @@ class Table:
info : str, optional info : str, optional
Human-readable information about the new data. Human-readable information about the new data.
Returns
-------
table : Table
Updated table.
""" """
dup = self.copy() dup = self.copy()
dup._add_comment(label,data.shape[1:],info) dup._add_comment(label,data.shape[1:],info)
@ -238,6 +248,11 @@ class Table:
info : str, optional info : str, optional
Human-readable information about the modified data. Human-readable information about the modified data.
Returns
-------
table : Table
Updated table.
""" """
dup = self.copy() dup = self.copy()
dup._add_comment(label,data.shape[1:],info) dup._add_comment(label,data.shape[1:],info)
@ -261,6 +276,11 @@ class Table:
label : str label : str
Column label. Column label.
Returns
-------
table : Table
Updated table.
""" """
dup = self.copy() dup = self.copy()
dup.data.drop(columns=label,inplace=True) dup.data.drop(columns=label,inplace=True)
@ -279,6 +299,11 @@ class Table:
label_new : str or iterable of str label_new : str or iterable of str
New column label(s). New column label(s).
Returns
-------
table : Table
Updated table.
""" """
dup = self.copy() dup = self.copy()
columns = dict(zip([old] if isinstance(old,str) else old, columns = dict(zip([old] if isinstance(old,str) else old,
@ -300,6 +325,11 @@ class Table:
ascending : bool or list, optional ascending : bool or list, optional
Set sort order. Set sort order.
Returns
-------
table : Table
Updated table.
""" """
dup = self.copy() dup = self.copy()
dup._label_discrete() dup._label_discrete()
@ -320,6 +350,11 @@ class Table:
other : Table other : Table
Table to append. Table to append.
Returns
-------
table : Table
Concatenated table.
""" """
if self.shapes != other.shapes or not self.data.columns.equals(other.data.columns): if self.shapes != other.shapes or not self.data.columns.equals(other.data.columns):
raise KeyError('Labels or shapes or order do not match') raise KeyError('Labels or shapes or order do not match')
@ -340,6 +375,11 @@ class Table:
other : Table other : Table
Table to join. Table to join.
Returns
-------
table : Table
Joined table.
""" """
if set(self.shapes) & set(other.shapes) or self.data.shape[0] != other.data.shape[0]: if set(self.shapes) & set(other.shapes) or self.data.shape[0] != other.data.shape[0]:
raise KeyError('Dublicated keys or row count mismatch') raise KeyError('Dublicated keys or row count mismatch')

View File

@ -9,6 +9,7 @@ from functools import reduce
from optparse import Option from optparse import Option
import numpy as np import numpy as np
import h5py
from . import version from . import version
@ -27,7 +28,8 @@ __all__=[
'extendableOption', 'extendableOption',
'execution_stamp', 'execution_stamp',
'shapeshifter', 'shapeblender', 'shapeshifter', 'shapeblender',
'extend_docstring', 'extended_docstring' 'extend_docstring', 'extended_docstring',
'DREAM3D_base_group', 'DREAM3D_cell_data_group'
] ]
#################################################################################################### ####################################################################################################
@ -376,6 +378,53 @@ def extended_docstring(f,extra_docstring):
return _decorator return _decorator
def DREAM3D_base_group(fname):
"""
Determine the base group of a DREAM.3D file.
The base group is defined as the group (folder) that contains
a 'SPACING' dataset in a '_SIMPL_GEOMETRY' group.
Parameters
----------
fname : str
Filename of the DREAM.3D (HDF5) file.
"""
with h5py.File(fname,'r') as f:
base_group = f.visit(lambda path: path.rsplit('/',2)[0] if '_SIMPL_GEOMETRY/SPACING' in path else None)
if base_group is None:
raise ValueError(f'Could not determine base group in file {fname}.')
return base_group
def DREAM3D_cell_data_group(fname):
"""
Determine the cell data group of a DREAM.3D file.
The cell data group is defined as the group (folder) that contains
a dataset in the base group whose length matches the total number
of points as specified in '_SIMPL_GEOMETRY/DIMENSIONS'.
Parameters
----------
fname : str
Filename of the DREAM.3D (HDF5) file.
"""
base_group = DREAM3D_base_group(fname)
with h5py.File(fname,'r') as f:
cells = tuple(f[os.path.join(base_group,'_SIMPL_GEOMETRY','DIMENSIONS')][()][::-1])
cell_data_group = f[base_group].visititems(lambda path,obj: path.split('/')[0] \
if isinstance(obj,h5py._hl.dataset.Dataset) and np.shape(obj)[:-1] == cells \
else None)
if cell_data_group is None:
raise ValueError(f'Could not determine cell data group in file {fname}/{base_group}.')
return cell_data_group
#################################################################################################### ####################################################################################################
# Classes # Classes
#################################################################################################### ####################################################################################################

View File

@ -0,0 +1 @@
../Grid/2phase_irregularGrid.dream3d

View File

@ -0,0 +1 @@
../Grid/2phase_irregularGrid.json

View File

@ -0,0 +1 @@
../Grid/2phase_irregularGrid.xdmf

View File

@ -0,0 +1 @@
../Grid/measured.dream3d

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
../Grid/measured.xdmf

View File

@ -0,0 +1,764 @@
{
"0": {
"CellEnsembleAttributeMatrixName": "CellEnsembleData",
"CrystalStructuresArrayName": "CrystalStructures",
"Filter_Enabled": true,
"Filter_Human_Label": "StatsGenerator",
"Filter_Name": "StatsGeneratorFilter",
"Filter_Uuid": "{f642e217-4722-5dd8-9df9-cee71e7b26ba}",
"PhaseNamesArrayName": "PhaseName",
"PhaseTypesArrayName": "PhaseTypes",
"StatsDataArray": {
"1": {
"AxisODF-Weights": {
},
"Bin Count": 34,
"BinNumber": [
0.03019738383591175,
1.031197428703308,
2.0321974754333496,
3.0331974029541016,
4.0341973304748535,
5.0351972579956055,
6.036197185516357,
7.037197113037109,
8.03819751739502,
9.03919792175293,
10.04019832611084,
11.04119873046875,
12.04219913482666,
13.04319953918457,
14.04419994354248,
15.04520034790039,
16.046199798583984,
17.047199249267578,
18.048198699951172,
19.049198150634766,
20.05019760131836,
21.051197052001953,
22.052196502685547,
23.05319595336914,
24.054195404052734,
25.055194854736328,
26.056194305419922,
27.057193756103516,
28.05819320678711,
29.059192657470703,
30.060192108154297,
31.06119155883789,
32.062191009521484,
33.06319046020508
],
"BoundaryArea": 0,
"Crystal Symmetry": 1,
"FeatureSize Distribution": {
"Average": 0.5,
"Standard Deviation": 1
},
"FeatureSize Vs B Over A Distributions": {
"Alpha": [
15.845513343811035,
15.281289100646973,
15.406131744384766,
15.695631980895996
],
"Beta": [
1.5363599061965942,
1.3575199842453003,
1.2908644676208496,
1.6510697603225708
],
"Distribution Type": "Beta Distribution"
},
"FeatureSize Vs C Over A Distributions": {
"Alpha": [
15.83090591430664,
15.119057655334473,
15.210259437561035,
15.403964042663574
],
"Beta": [
1.4798208475112915,
1.439164638519287,
1.6361048221588135,
1.3149876594543457
],
"Distribution Type": "Beta Distribution"
},
"FeatureSize Vs Neighbors Distributions": {
"Average": [
2.3025851249694824,
2.4849066734313965,
2.6390573978424072,
2.7725887298583984
],
"Distribution Type": "Log Normal Distribution",
"Standard Deviation": [
0.4000000059604645,
0.3499999940395355,
0.30000001192092896,
0.25
]
},
"FeatureSize Vs Omega3 Distributions": {
"Alpha": [
10.906224250793457,
10.030556678771973,
10.367804527282715,
10.777519226074219
],
"Beta": [
1.7305665016174316,
1.638364553451538,
1.6687047481536865,
1.6839183568954468
],
"Distribution Type": "Beta Distribution"
},
"Feature_Diameter_Info": [
1.0010000467300415,
33.11545181274414,
0.03019738383591175
],
"MDF-Weights": {
},
"Name": "Primary",
"ODF-Weights": {
},
"PhaseFraction": 0.8999999761581421,
"PhaseType": "Primary"
},
"2": {
"AxisODF-Weights": {
},
"Bin Count": 34,
"BinNumber": [
0.03019738383591175,
1.031197428703308,
2.0321974754333496,
3.0331974029541016,
4.0341973304748535,
5.0351972579956055,
6.036197185516357,
7.037197113037109,
8.03819751739502,
9.03919792175293,
10.04019832611084,
11.04119873046875,
12.04219913482666,
13.04319953918457,
14.04419994354248,
15.04520034790039,
16.046199798583984,
17.047199249267578,
18.048198699951172,
19.049198150634766,
20.05019760131836,
21.051197052001953,
22.052196502685547,
23.05319595336914,
24.054195404052734,
25.055194854736328,
26.056194305419922,
27.057193756103516,
28.05819320678711,
29.059192657470703,
30.060192108154297,
31.06119155883789,
32.062191009521484,
33.06319046020508
],
"BoundaryArea": 0,
"Crystal Symmetry": 0,
"FeatureSize Distribution": {
"Average": 0.5,
"Standard Deviation": 1
},
"FeatureSize Vs B Over A Distributions": {
"Alpha": [
15.447705268859863,
15.033297538757324,
15.445094108581543,
15.426791191101074,
15.61402702331543,
15.366107940673828,
15.525880813598633,
15.943540573120117,
15.176913261413574,
15.9615478515625,
15.254341125488281,
15.919609069824219,
15.170331954956055,
15.80831527709961,
15.88097095489502,
15.6745023727417,
15.72781753540039,
15.8475980758667,
15.314001083374023,
15.855002403259277,
15.942434310913086,
15.40106201171875,
15.478381156921387,
15.788527488708496,
15.045133590698242,
15.81428050994873,
15.582372665405273,
15.878610610961914,
15.554070472717285,
15.576101303100586,
15.961583137512207,
15.629712104797363,
15.71079158782959,
15.126718521118164
],
"Beta": [
1.6585813760757446,
1.5793683528900146,
1.3637349605560303,
1.3487848043441772,
1.2599012851715088,
1.6920716762542725,
1.4974967241287231,
1.2616045475006104,
1.4897079467773438,
1.7281248569488525,
1.427177906036377,
1.6394929885864258,
1.533599853515625,
1.4850311279296875,
1.4161322116851807,
1.4839515686035156,
1.619403600692749,
1.3563393354415894,
1.7409964799880981,
1.7253544330596924,
1.3933753967285156,
1.7071460485458374,
1.4746366739273071,
1.3466795682907104,
1.5836750268936157,
1.2904614210128784,
1.4404902458190918,
1.7157742977142334,
1.3197978734970093,
1.2591632604599,
1.387762188911438,
1.5591365098953247,
1.3606828451156616,
1.4381128549575806
],
"Distribution Type": "Beta Distribution"
},
"FeatureSize Vs C Over A Distributions": {
"Alpha": [
15.365218162536621,
15.545299530029297,
15.212627410888672,
15.400262832641602,
15.938212394714355,
15.722898483276367,
15.016470909118652,
15.900740623474121,
15.425718307495117,
15.16152572631836,
15.375897407531738,
15.372262954711914,
15.971389770507812,
15.753372192382812,
15.400237083435059,
15.377294540405273,
15.65787124633789,
15.287458419799805,
15.704233169555664,
15.063706398010254,
15.128981590270996,
15.337125778198242,
15.145627975463867,
15.563216209411621,
15.704171180725098,
15.633543014526367,
15.44886589050293,
15.549928665161133,
15.656011581420898,
15.29349136352539,
15.840867042541504,
15.322612762451172,
15.672919273376465,
15.617719650268555
],
"Beta": [
1.4064055681228638,
1.2828519344329834,
1.468850016593933,
1.7444164752960205,
1.6199990510940552,
1.3697280883789062,
1.2706352472305298,
1.5357846021652222,
1.4822189807891846,
1.6722832918167114,
1.369265079498291,
1.4566115140914917,
1.3299659490585327,
1.3810123205184937,
1.3476874828338623,
1.5510755777359009,
1.7177120447158813,
1.3624974489212036,
1.3216533660888672,
1.3339394330978394,
1.2930961847305298,
1.6279221773147583,
1.6160264015197754,
1.528560757637024,
1.510753870010376,
1.3254910707473755,
1.4221922159194946,
1.2564609050750732,
1.6635781526565552,
1.3418669700622559,
1.7360178232192993,
1.5526862144470215,
1.4054912328720093,
1.277783989906311
],
"Distribution Type": "Beta Distribution"
},
"FeatureSize Vs Omega3 Distributions": {
"Alpha": [
10.336419105529785,
10.1687650680542,
10.27115249633789,
10.215887069702148,
10.185782432556152,
10.72452449798584,
10.59039306640625,
10.541507720947266,
10.88405990600586,
10.985298156738281,
10.061153411865234,
10.403335571289062,
10.103477478027344,
10.359172821044922,
10.454915046691895,
10.805563926696777,
10.597787857055664,
10.86919116973877,
10.310497283935547,
10.723823547363281,
10.431794166564941,
10.962357521057129,
10.227286338806152,
10.641992568969727,
10.421194076538086,
10.347271919250488,
10.305063247680664,
10.359184265136719,
10.88247013092041,
10.224652290344238,
10.449006080627441,
10.638978958129883,
10.109529495239258,
10.306557655334473
],
"Beta": [
1.952553629875183,
1.8465642929077148,
1.9641268253326416,
1.8473154306411743,
1.8531252145767212,
1.6586203575134277,
1.7890105247497559,
1.5307549238204956,
1.5579677820205688,
1.5402934551239014,
1.8692169189453125,
1.7846438884735107,
1.547948956489563,
1.6955899000167847,
1.7097049951553345,
1.5930047035217285,
1.7674869298934937,
1.519134759902954,
1.655213475227356,
1.846417784690857,
1.6024950742721558,
1.7787903547286987,
1.529666781425476,
1.9883882999420166,
1.9980814456939697,
1.6461148262023926,
1.518980622291565,
1.954341173171997,
1.994722604751587,
1.6828864812850952,
1.5880030393600464,
1.7846791744232178,
1.6626262664794922,
1.714822769165039
],
"Distribution Type": "Beta Distribution"
},
"Feature_Diameter_Info": [
1.0010000467300415,
33.11545181274414,
0.03019738383591175
],
"MDF-Weights": {
},
"Name": "Precipitate",
"ODF-Weights": {
},
"PhaseFraction": 0.10000000149011612,
"PhaseType": "Precipitate",
"Precipitate Boundary Fraction": 0.699999988079071,
"Radial Distribution Function": {
"Bin Count": 50,
"BoxDims": [
100,
100,
100
],
"BoxRes": [
0.10000000149011612,
0.10000000149011612,
0.10000000149011612
],
"Max": 80,
"Min": 10
}
},
"Name": "Statistics",
"Phase Count": 3
},
"StatsDataArrayName": "Statistics",
"StatsGeneratorDataContainerName": "StatsGeneratorDataContainer"
},
"1": {
"BoxDimensions": "X Range: 0 to 10.4 (Delta: 10.4)\nY Range: 0 to 6.4 (Delta: 6.4)\nZ Range: 0 to 8 (Delta: 8)",
"CellAttributeMatrixName": "CellData",
"DataContainerName": "SyntheticVolumeDataContainer",
"Dimensions": {
"x": 13,
"y": 8,
"z": 10
},
"EnsembleAttributeMatrixName": "CellEnsembleData",
"EstimateNumberOfFeatures": 1,
"EstimatedPrimaryFeatures": "17",
"FilterVersion": "6.5.138",
"Filter_Enabled": true,
"Filter_Human_Label": "Initialize Synthetic Volume",
"Filter_Name": "InitializeSyntheticVolume",
"Filter_Uuid": "{c2ae366b-251f-5dbd-9d70-d790376c0c0d}",
"InputPhaseTypesArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "PhaseTypes",
"Data Container Name": "StatsGeneratorDataContainer"
},
"InputStatsArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "Statistics",
"Data Container Name": "StatsGeneratorDataContainer"
},
"Origin": {
"x": 0,
"y": 0,
"z": 0
},
"Resolution": {
"x": 0.800000011920929,
"y": 0.800000011920929,
"z": 0.800000011920929
}
},
"2": {
"FilterVersion": "6.5.138",
"Filter_Enabled": true,
"Filter_Human_Label": "Establish Shape Types",
"Filter_Name": "EstablishShapeTypes",
"Filter_Uuid": "{4edbbd35-a96b-5ff1-984a-153d733e2abb}",
"InputPhaseTypesArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "PhaseTypes",
"Data Container Name": "StatsGeneratorDataContainer"
},
"ShapeTypeData": [
999,
0,
0
],
"ShapeTypesArrayName": "ShapeTypes"
},
"3": {
"CellPhasesArrayName": "Phases",
"FeatureGeneration": 0,
"FeatureIdsArrayName": "FeatureIds",
"FeatureInputFile": "C:/Users/work",
"FeaturePhasesArrayName": "Phases",
"FilterVersion": "6.5.138",
"Filter_Enabled": true,
"Filter_Human_Label": "Pack Primary Phases",
"Filter_Name": "PackPrimaryPhases",
"Filter_Uuid": "{84305312-0d10-50ca-b89a-fda17a353cc9}",
"InputPhaseNamesArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "PhaseName",
"Data Container Name": "StatsGeneratorDataContainer"
},
"InputPhaseTypesArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "PhaseTypes",
"Data Container Name": "StatsGeneratorDataContainer"
},
"InputShapeTypesArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "ShapeTypes",
"Data Container Name": "StatsGeneratorDataContainer"
},
"InputStatsArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "Statistics",
"Data Container Name": "StatsGeneratorDataContainer"
},
"MaskArrayPath": {
"Attribute Matrix Name": "",
"Data Array Name": "",
"Data Container Name": ""
},
"NewAttributeMatrixPath": {
"Attribute Matrix Name": "Synthetic Shape Parameters (Primary Phase)",
"Data Array Name": "",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"NumFeaturesArrayName": "NumFeatures",
"OutputCellAttributeMatrixPath": {
"Attribute Matrix Name": "CellData",
"Data Array Name": "",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"OutputCellEnsembleAttributeMatrixName": "CellEnsembleData",
"OutputCellFeatureAttributeMatrixName": "Grain Data",
"PeriodicBoundaries": 0,
"SaveGeometricDescriptions": 0,
"SelectedAttributeMatrixPath": {
"Attribute Matrix Name": "",
"Data Array Name": "",
"Data Container Name": ""
},
"UseMask": 0
},
"4": {
"BoundaryCellsArrayName": "BoundaryCells",
"FeatureIdsArrayPath": {
"Attribute Matrix Name": "CellData",
"Data Array Name": "FeatureIds",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"FilterVersion": "6.5.138",
"Filter_Enabled": true,
"Filter_Human_Label": "Find Boundary Cells (Image)",
"Filter_Name": "FindBoundaryCells",
"Filter_Uuid": "{8a1106d4-c67f-5e09-a02a-b2e9b99d031e}",
"IgnoreFeatureZero": 1,
"IncludeVolumeBoundary": 0
},
"5": {
"BoundaryCellsArrayPath": {
"Attribute Matrix Name": "CellData",
"Data Array Name": "BoundaryCells",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"CellPhasesArrayPath": {
"Attribute Matrix Name": "CellData",
"Data Array Name": "Phases",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"FeatureGeneration": 0,
"FeatureIdsArrayPath": {
"Attribute Matrix Name": "CellData",
"Data Array Name": "FeatureIds",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"FeaturePhasesArrayPath": {
"Attribute Matrix Name": "Grain Data",
"Data Array Name": "Phases",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"FilterVersion": "6.5.138",
"Filter_Enabled": true,
"Filter_Human_Label": "Insert Precipitate Phases",
"Filter_Name": "InsertPrecipitatePhases",
"Filter_Uuid": "{1e552e0c-53bb-5ae1-bd1c-c7a6590f9328}",
"InputPhaseTypesArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "PhaseTypes",
"Data Container Name": "StatsGeneratorDataContainer"
},
"InputShapeTypesArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "ShapeTypes",
"Data Container Name": "StatsGeneratorDataContainer"
},
"InputStatsArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "Statistics",
"Data Container Name": "StatsGeneratorDataContainer"
},
"MaskArrayPath": {
"Attribute Matrix Name": "",
"Data Array Name": "",
"Data Container Name": ""
},
"MatchRDF": 0,
"NewAttributeMatrixPath": {
"Attribute Matrix Name": "Synthetic Shape Parameters (Precipitate)",
"Data Array Name": "",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"NumFeaturesArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "NumFeatures",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"PeriodicBoundaries": 0,
"PrecipInputFile": "C:/Users/work",
"SaveGeometricDescriptions": 0,
"SelectedAttributeMatrixPath": {
"Attribute Matrix Name": "",
"Data Array Name": "",
"Data Container Name": ""
},
"UseMask": 0
},
"6": {
"BoundaryCellsArrayName": "BoundaryCells",
"CellFeatureAttributeMatrixPath": {
"Attribute Matrix Name": "Grain Data",
"Data Array Name": "",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"FeatureIdsArrayPath": {
"Attribute Matrix Name": "CellData",
"Data Array Name": "FeatureIds",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"FilterVersion": "6.5.138",
"Filter_Enabled": true,
"Filter_Human_Label": "Find Feature Neighbors",
"Filter_Name": "FindNeighbors",
"Filter_Uuid": "{97cf66f8-7a9b-5ec2-83eb-f8c4c8a17bac}",
"NeighborListArrayName": "NeighborList",
"NumNeighborsArrayName": "NumNeighbors",
"SharedSurfaceAreaListArrayName": "SharedSurfaceAreaList",
"StoreBoundaryCells": 0,
"StoreSurfaceFeatures": 1,
"SurfaceFeaturesArrayName": "SurfaceFeatures"
},
"7": {
"AvgQuatsArrayName": "AvgQuats",
"CellEulerAnglesArrayName": "EulerAngles",
"CrystalStructuresArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "CrystalStructures",
"Data Container Name": "StatsGeneratorDataContainer"
},
"FeatureEulerAnglesArrayName": "EulerAngles",
"FeatureIdsArrayPath": {
"Attribute Matrix Name": "CellData",
"Data Array Name": "FeatureIds",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"FeaturePhasesArrayPath": {
"Attribute Matrix Name": "Grain Data",
"Data Array Name": "Phases",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"FilterVersion": "6.5.138",
"Filter_Enabled": true,
"Filter_Human_Label": "Match Crystallography",
"Filter_Name": "MatchCrystallography",
"Filter_Uuid": "{7bfb6e4a-6075-56da-8006-b262d99dff30}",
"InputStatsArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "Statistics",
"Data Container Name": "StatsGeneratorDataContainer"
},
"MaxIterations": 100,
"NeighborListArrayPath": {
"Attribute Matrix Name": "Grain Data",
"Data Array Name": "NeighborList",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"NumFeaturesArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "NumFeatures",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"PhaseTypesArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "PhaseTypes",
"Data Container Name": "StatsGeneratorDataContainer"
},
"SharedSurfaceAreaListArrayPath": {
"Attribute Matrix Name": "Grain Data",
"Data Array Name": "SharedSurfaceAreaList",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"SurfaceFeaturesArrayPath": {
"Attribute Matrix Name": "Grain Data",
"Data Array Name": "SurfaceFeatures",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"VolumesArrayName": "Volumes"
},
"8": {
"CellEulerAnglesArrayPath": {
"Attribute Matrix Name": "CellData",
"Data Array Name": "EulerAngles",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"CellIPFColorsArrayName": "IPFColor",
"CellPhasesArrayPath": {
"Attribute Matrix Name": "CellData",
"Data Array Name": "Phases",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"CrystalStructuresArrayPath": {
"Attribute Matrix Name": "CellEnsembleData",
"Data Array Name": "CrystalStructures",
"Data Container Name": "StatsGeneratorDataContainer"
},
"FilterVersion": "6.5.138",
"Filter_Enabled": true,
"Filter_Human_Label": "Generate IPF Colors",
"Filter_Name": "GenerateIPFColors",
"Filter_Uuid": "{a50e6532-8075-5de5-ab63-945feb0de7f7}",
"GoodVoxelsArrayPath": {
"Attribute Matrix Name": "CellData",
"Data Array Name": "",
"Data Container Name": "SyntheticVolumeDataContainer"
},
"ReferenceDir": {
"x": 0,
"y": 0,
"z": 1
},
"UseGoodVoxels": 0
},
"9": {
"FilterVersion": "1.2.812",
"Filter_Enabled": true,
"Filter_Human_Label": "Write DREAM.3D Data File",
"Filter_Name": "DataContainerWriter",
"Filter_Uuid": "{3fcd4c43-9d75-5b86-aad4-4441bc914f37}",
"OutputFile": "C:\\Users\\work\\Desktop\\2phase_irregularGrid.dream3d",
"WriteTimeSeries": 0,
"WriteXdmfFile": 1
},
"PipelineBuilder": {
"Name": "2phase_irregularGrid",
"Number_Filters": 10,
"Version": 6
}
}

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd"[]>
<Xdmf xmlns:xi="http://www.w3.org/2003/XInclude" Version="2.2">
<Domain>
<!-- *************** START OF SyntheticVolumeDataContainer *************** -->
<Grid Name="SyntheticVolumeDataContainer" GridType="Uniform">
<Topology TopologyType="3DCoRectMesh" Dimensions="11 9 14 "></Topology>
<Geometry Type="ORIGIN_DXDYDZ">
<!-- Origin Z, Y, X -->
<DataItem Format="XML" Dimensions="3">0 0 0</DataItem>
<!-- DxDyDz (Spacing/Resolution) Z, Y, X -->
<DataItem Format="XML" Dimensions="3">0.8 0.8 0.8</DataItem>
</Geometry>
<Attribute Name="BoundaryCells" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="10 8 13 1" NumberType="Char" Precision="1" >
2phase_irregularGrid.dream3d:/DataContainers/SyntheticVolumeDataContainer/CellData/BoundaryCells
</DataItem>
</Attribute>
<Attribute Name="EulerAngles" AttributeType="Vector" Center="Cell">
<DataItem Format="HDF" Dimensions="10 8 13 3" NumberType="Float" Precision="4" >
2phase_irregularGrid.dream3d:/DataContainers/SyntheticVolumeDataContainer/CellData/EulerAngles
</DataItem>
</Attribute>
<Attribute Name="FeatureIds" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="10 8 13 1" NumberType="Int" Precision="4" >
2phase_irregularGrid.dream3d:/DataContainers/SyntheticVolumeDataContainer/CellData/FeatureIds
</DataItem>
</Attribute>
<Attribute Name="IPFColor" AttributeType="Vector" Center="Cell">
<DataItem Format="HDF" Dimensions="10 8 13 3" NumberType="UChar" Precision="1" >
2phase_irregularGrid.dream3d:/DataContainers/SyntheticVolumeDataContainer/CellData/IPFColor
</DataItem>
</Attribute>
<Attribute Name="Phases" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="10 8 13 1" NumberType="Int" Precision="4" >
2phase_irregularGrid.dream3d:/DataContainers/SyntheticVolumeDataContainer/CellData/Phases
</DataItem>
</Attribute>
</Grid>
<!-- *************** END OF SyntheticVolumeDataContainer *************** -->
</Domain>
</Xdmf>

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,77 @@
<?xml version="1.0"?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd"[]>
<Xdmf xmlns:xi="http://www.w3.org/2003/XInclude" Version="2.2">
<Domain>
<!-- *************** START OF Small IN100 *************** -->
<Grid Name="Small IN100" GridType="Uniform">
<Topology TopologyType="3DCoRectMesh" Dimensions="2 102 202 "></Topology>
<Geometry Type="ORIGIN_DXDYDZ">
<!-- Origin Z, Y, X -->
<DataItem Format="XML" Dimensions="3">0 35 -294.7</DataItem>
<!-- DxDyDz (Spacing/Resolution) Z, Y, X -->
<DataItem Format="XML" Dimensions="3">0.35 0.35 0.35</DataItem>
</Geometry>
<Attribute Name="Confidence Index" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Confidence Index
</DataItem>
</Attribute>
<Attribute Name="EulerAngles" AttributeType="Vector" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 3" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/EulerAngles
</DataItem>
</Attribute>
<Attribute Name="FeatureIds" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Int" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/FeatureIds
</DataItem>
</Attribute>
<Attribute Name="Fit" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Fit
</DataItem>
</Attribute>
<Attribute Name="IPFColor" AttributeType="Vector" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 3" NumberType="UChar" Precision="1" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/IPFColor
</DataItem>
</Attribute>
<Attribute Name="Image Quality" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Image Quality
</DataItem>
</Attribute>
<Attribute Name="Mask" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="uchar" Precision="1" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Mask
</DataItem>
</Attribute>
<Attribute Name="ParentIds" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Int" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/ParentIds
</DataItem>
</Attribute>
<Attribute Name="Phases" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Int" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Phases
</DataItem>
</Attribute>
<Attribute Name="SEM Signal" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/SEM Signal
</DataItem>
</Attribute>
<Attribute Name="X Position" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/X Position
</DataItem>
</Attribute>
<Attribute Name="Y Position" AttributeType="Scalar" Center="Cell">
<DataItem Format="HDF" Dimensions="1 101 201 1" NumberType="Float" Precision="4" >
measured.dream3d:/DataContainers/Small IN100/EBSD Scan Data/Y Position
</DataItem>
</Attribute>
</Grid>
<!-- *************** END OF Small IN100 *************** -->
</Domain>
</Xdmf>

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:
mechanical:
dot_F: [x, 0, 0,
0, 1.0e-3, 0,
0, 0, x]
P: [0, x, x,
x, x, x,
x, x, 0]
discretization:
t: 20 t: 20
N: 40 N: 40
f_out: 4 f_out: 4
mechanics:
dot_F: [x, 0, 0,
0, 1.0e-3, 0,
0, 0, x]
P: [0, x, x,
x, x, x,
x, x, 0]

View File

@ -2,6 +2,8 @@ import pytest
import numpy as np import numpy as np
from damask import Config from damask import Config
from damask import Rotation
from damask import Orientation
class TestConfig: class TestConfig:
@ -23,8 +25,17 @@ class TestConfig:
assert Config.load(f) == config assert Config.load(f) == config
def test_add_remove(self): def test_add_remove(self):
dummy = {'hello':'world','foo':'bar'}
config = Config() config = Config()
assert config.add({'hello':'world'}).delete('hello') == config config |= dummy
assert config == Config() | dummy
config = config.delete(dummy)
assert config == Config()
assert (config | dummy ).delete( 'hello' ) == config | {'foo':'bar'}
assert (config | dummy ).delete([ 'hello', 'foo' ]) == config
assert (config | Config(dummy)).delete({ 'hello':1,'foo':2 }) == config
assert (config | Config(dummy)).delete(Config({'hello':1 })) == config | {'foo':'bar'}
def test_repr(self,tmp_path): def test_repr(self,tmp_path):
config = Config() config = Config()
@ -42,3 +53,7 @@ class TestConfig:
def test_abstract_is_complete(self): def test_abstract_is_complete(self):
assert Config().is_complete is None assert Config().is_complete is None
@pytest.mark.parametrize('data',[Rotation.from_random(),Orientation.from_random()])
def test_rotation_orientation(self,data):
assert str(Config(a=data)) == str(Config(a=data.as_quaternion()))

View File

@ -1,11 +1,11 @@
import os import os
import pytest import pytest
import numpy as np import numpy as np
from damask import ConfigMaterial from damask import ConfigMaterial
from damask import Table from damask import Table
from damask import Rotation from damask import Rotation
from damask import Grid
@pytest.fixture @pytest.fixture
def ref_path(ref_path_base): def ref_path(ref_path_base):
@ -108,3 +108,35 @@ class TestConfigMaterial:
m = ConfigMaterial().material_add(**kw) m = ConfigMaterial().material_add(**kw)
assert len(m['material']) == N assert len(m['material']) == N
assert len(m['material'][0]['constituents']) == n assert len(m['material'][0]['constituents']) == n
@pytest.mark.parametrize('cell_ensemble_data',[None,'CellEnsembleData'])
def test_load_DREAM3D(self,ref_path,cell_ensemble_data):
grain_c = ConfigMaterial.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d','Grain Data',
cell_ensemble_data = cell_ensemble_data)
point_c = ConfigMaterial.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d',
cell_ensemble_data = cell_ensemble_data)
assert point_c.is_valid and grain_c.is_valid and \
len(point_c['material'])+1 == len(grain_c['material'])
grain_m = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d','FeatureIds').material.flatten()
point_m = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d').material.flatten()
for i in np.unique(point_m):
j = int(grain_m[(point_m==i).nonzero()[0][0]])
assert np.allclose(point_c['material'][i]['constituents'][0]['O'],
grain_c['material'][j]['constituents'][0]['O'])
assert point_c['material'][i]['constituents'][0]['phase'] == \
grain_c['material'][j]['constituents'][0]['phase']
def test_load_DREAM3D_reference(self,tmp_path,ref_path,update):
cur = ConfigMaterial.load_DREAM3D(ref_path/'measured.dream3d')
ref = ConfigMaterial.load(ref_path/'measured.material_yaml')
if update:
cur.save(ref_path/'measured.material_yaml')
for i,m in enumerate(ref['material']):
assert Rotation(m['constituents'][0]['O']) == \
Rotation(cur['material'][i]['constituents'][0]['O'])
assert cur.is_valid and cur['phase'] == ref['phase'] and cur['homogenization'] == ref['homogenization']

View File

@ -420,12 +420,31 @@ class TestGrid:
t = Table(np.column_stack((coords.reshape(-1,3,order='F'),grid.material.flatten(order='F'))),{'c':3,'m':1}) t = Table(np.column_stack((coords.reshape(-1,3,order='F'),grid.material.flatten(order='F'))),{'c':3,'m':1})
assert grid_equal(grid.sort().renumber(),Grid.from_table(t,'c',['m'])) assert grid_equal(grid.sort().renumber(),Grid.from_table(t,'c',['m']))
@pytest.mark.parametrize('periodic',[True,False]) @pytest.mark.parametrize('periodic',[True,False])
@pytest.mark.parametrize('direction',['x','y','z',['x','y'],'zy','xz',['x','y','z']]) @pytest.mark.parametrize('direction',['x','y','z',['x','y'],'zy','xz',['x','y','z']])
def test_get_grain_boundaries(self,update,ref_path,periodic,direction): def test_get_grain_boundaries(self,update,ref_path,periodic,direction):
grid=Grid.load(ref_path/'get_grain_boundaries_8g12x15x20.vtr') grid = Grid.load(ref_path/'get_grain_boundaries_8g12x15x20.vtr')
current=grid.get_grain_boundaries(periodic,direction) current = grid.get_grain_boundaries(periodic,direction)
if update: if update:
current.save(ref_path/f'get_grain_boundaries_8g12x15x20_{direction}_{periodic}.vtu',parallel=False) current.save(ref_path/f'get_grain_boundaries_8g12x15x20_{direction}_{periodic}.vtu',parallel=False)
reference=VTK.load(ref_path/f'get_grain_boundaries_8g12x15x20_{"".join(direction)}_{periodic}.vtu') reference = VTK.load(ref_path/f'get_grain_boundaries_8g12x15x20_{"".join(direction)}_{periodic}.vtu')
assert current.__repr__() == reference.__repr__() assert current.__repr__() == reference.__repr__()
def test_load_DREAM3D(self,ref_path):
grain = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d','FeatureIds')
point = Grid.load_DREAM3D(ref_path/'2phase_irregularGrid.dream3d')
assert np.allclose(grain.origin,point.origin) and \
np.allclose(grain.size,point.size) and \
(grain.sort().material == point.material+1).all()
def test_load_DREAM3D_reference(self,ref_path,update):
current = Grid.load_DREAM3D(ref_path/'measured.dream3d')
reference = Grid.load(ref_path/'measured')
if update:
current.save(ref_path/'measured.vtr')
assert grid_equal(current,reference)

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

@ -1,6 +1,10 @@
import random
import os
import pytest import pytest
import numpy as np import numpy as np
from scipy import stats from scipy import stats
import h5py
from damask import util from damask import util
@ -102,3 +106,36 @@ class TestUtil:
@pytest.mark.parametrize('style',[util.emph,util.deemph,util.warn,util.strikeout]) @pytest.mark.parametrize('style',[util.emph,util.deemph,util.warn,util.strikeout])
def test_decorate(self,style): def test_decorate(self,style):
assert 'DAMASK' in style('DAMASK') assert 'DAMASK' in style('DAMASK')
@pytest.mark.parametrize('complete',[True,False])
def test_D3D_base_group(self,tmp_path,complete):
base_group = ''.join(random.choices('DAMASK', k=10))
with h5py.File(tmp_path/'base_group.dream3d','w') as f:
f.create_group(os.path.join(base_group,'_SIMPL_GEOMETRY'))
if complete:
f[os.path.join(base_group,'_SIMPL_GEOMETRY')].create_dataset('SPACING',data=np.ones(3))
if complete:
assert base_group == util.DREAM3D_base_group(tmp_path/'base_group.dream3d')
else:
with pytest.raises(ValueError):
util.DREAM3D_base_group(tmp_path/'base_group.dream3d')
@pytest.mark.parametrize('complete',[True,False])
def test_D3D_cell_data_group(self,tmp_path,complete):
base_group = ''.join(random.choices('DAMASK', k=10))
cell_data_group = ''.join(random.choices('KULeuven', k=10))
cells = np.random.randint(1,50,3)
with h5py.File(tmp_path/'cell_data_group.dream3d','w') as f:
f.create_group(os.path.join(base_group,'_SIMPL_GEOMETRY'))
f[os.path.join(base_group,'_SIMPL_GEOMETRY')].create_dataset('SPACING',data=np.ones(3))
f[os.path.join(base_group,'_SIMPL_GEOMETRY')].create_dataset('DIMENSIONS',data=cells[::-1])
f[base_group].create_group(cell_data_group)
if complete:
f[os.path.join(base_group,cell_data_group)].create_dataset('data',shape=np.append(cells,1))
if complete:
assert cell_data_group == util.DREAM3D_cell_data_group(tmp_path/'cell_data_group.dream3d')
else:
with pytest.raises(ValueError):
util.DREAM3D_cell_data_group(tmp_path/'cell_data_group.dream3d')

View File

@ -178,11 +178,11 @@ subroutine CPFEM_general(mode, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyS
if (iand(mode, CPFEM_AGERESULTS) /= 0_pInt) call CPFEM_forward if (iand(mode, CPFEM_AGERESULTS) /= 0_pInt) call CPFEM_forward
chosenThermal1: select case (thermal_type(material_homogenizationAt(elCP))) !chosenThermal1: select case (thermal_type(material_homogenizationAt(elCP)))
!case (THERMAL_conduction_ID) chosenThermal1 ! case (THERMAL_conduction_ID) chosenThermal1
! temperature(material_homogenizationAt(elCP))%p(material_homogenizationMemberAt(ip,elCP)) = & ! temperature(material_homogenizationAt(elCP))%p(material_homogenizationMemberAt(ip,elCP)) = &
! temperature_inp ! temperature_inp
end select chosenThermal1 !end select chosenThermal1
homogenization_F0(1:3,1:3,ma) = ffn homogenization_F0(1:3,1:3,ma) = ffn
homogenization_F(1:3,1:3,ma) = ffn1 homogenization_F(1:3,1:3,ma) = ffn1

View File

@ -93,7 +93,7 @@ subroutine DAMASK_interface_init
#endif #endif
print*, achar(27)//'[0m' print*, achar(27)//'[0m'
print*, 'Roters et al., Computational Materials Science 158:420478, 2019' print*, 'F. Roters et al., Computational Materials Science 158:420478, 2019'
print*, 'https://doi.org/10.1016/j.commatsci.2018.04.030' print*, 'https://doi.org/10.1016/j.commatsci.2018.04.030'
print'(/,a)', ' Version: '//DAMASKVERSION print'(/,a)', ' Version: '//DAMASKVERSION

View File

@ -991,7 +991,6 @@ function output_asStrings(self) result(output) !ToDo: SR: Rem
output(o) = output_list%get_asString(o) output(o) = output_list%get_asString(o)
enddo enddo
end function output_asStrings end function output_asStrings
@ -1017,7 +1016,6 @@ function tNode_get_byKey_asIndex(self,key) result(keyIndex)
if (item%key /= key) call IO_error(140,ext_msg=key) if (item%key /= key) call IO_error(140,ext_msg=key)
end function tNode_get_byKey_asIndex end function tNode_get_byKey_asIndex

View File

@ -37,9 +37,10 @@ program DAMASK_grid
f_out, & !< frequency of result writes f_out, & !< frequency of result writes
f_restart !< frequency of restart writes f_restart !< frequency of restart writes
logical :: estimate_rate !< follow trajectory of former loadcase logical :: estimate_rate !< follow trajectory of former loadcase
integer(kind(FIELD_UNDEFINED_ID)), allocatable :: ID(:)
end type tLoadCase end type tLoadCase
integer(kind(FIELD_UNDEFINED_ID)), allocatable :: ID(:)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! variables related to information from load case and geom file ! variables related to information from load case and geom file
real(pReal), dimension(9) :: temp_valueVector !< temporarily from loadcase file when reading in tensors (initialize to 0.0) real(pReal), dimension(9) :: temp_valueVector !< temporarily from loadcase file when reading in tensors (initialize to 0.0)
@ -53,6 +54,7 @@ program DAMASK_grid
integer, parameter :: & integer, parameter :: &
subStepFactor = 2 !< for each substep, divide the last time increment by 2.0 subStepFactor = 2 !< for each substep, divide the last time increment by 2.0
real(pReal) :: & real(pReal) :: &
T_0 = 300.0_pReal, &
time = 0.0_pReal, & !< elapsed time time = 0.0_pReal, & !< elapsed time
time0 = 0.0_pReal, & !< begin of interval time0 = 0.0_pReal, & !< begin of interval
timeinc = 1.0_pReal, & !< current time interval timeinc = 1.0_pReal, & !< current time interval
@ -78,8 +80,7 @@ program DAMASK_grid
maxCutBack, & !< max number of cut backs maxCutBack, & !< max number of cut backs
stagItMax !< max number of field level staggered iterations stagItMax !< max number of field level staggered iterations
character(len=pStringLen) :: & character(len=pStringLen) :: &
incInfo, & incInfo
loadcase_string
type(tLoadCase), allocatable, dimension(:) :: loadCases !< array of all load cases type(tLoadCase), allocatable, dimension(:) :: loadCases !< array of all load cases
type(tSolutionState), allocatable, dimension(:) :: solres type(tSolutionState), allocatable, dimension(:) :: solres
@ -98,10 +99,12 @@ program DAMASK_grid
quit quit
class (tNode), pointer :: & class (tNode), pointer :: &
num_grid, & num_grid, &
debug_grid, & ! pointer to grid debug options
config_load, & config_load, &
load_steps, & load_steps, &
load_step, & load_step, &
solver, &
initial_conditions, &
thermal, &
step_bc, & step_bc, &
step_mech, & step_mech, &
step_discretization, & step_discretization, &
@ -112,17 +115,11 @@ program DAMASK_grid
! init DAMASK (all modules) ! init DAMASK (all modules)
call CPFEM_initAll call CPFEM_initAll
print'(/,a)', ' <<<+- DAMASK_spectral init -+>>>'; flush(IO_STDOUT) print'(/,a)', ' <<<+- DAMASK_grid init -+>>>'; flush(IO_STDOUT)
print*, 'Shanthraj et al., Handbook of Mechanics of Materials, 2019' print*, 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019'
print*, 'https://doi.org/10.1007/978-981-10-6855-3_80' print*, 'https://doi.org/10.1007/978-981-10-6855-3_80'
!--------------------------------------------------------------------------------------------------
! initialize field solver information
nActiveFields = 1
if (any(thermal_type == THERMAL_conduction_ID )) nActiveFields = nActiveFields + 1
if (any(damage_type == DAMAGE_nonlocal_ID )) nActiveFields = nActiveFields + 1
allocate(solres(nActiveFields))
!------------------------------------------------------------------------------------------------- !-------------------------------------------------------------------------------------------------
! reading field paramters from numerics file and do sanity checks ! reading field paramters from numerics file and do sanity checks
@ -133,19 +130,22 @@ program DAMASK_grid
if (stagItMax < 0) call IO_error(301,ext_msg='maxStaggeredIter') if (stagItMax < 0) call IO_error(301,ext_msg='maxStaggeredIter')
if (maxCutBack < 0) call IO_error(301,ext_msg='maxCutBack') if (maxCutBack < 0) call IO_error(301,ext_msg='maxCutBack')
config_load => YAML_parse_file(trim(interface_loadFile))
solver => config_load%get('solver')
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! assign mechanics solver depending on selected type ! assign mechanics solver depending on selected type
debug_grid => config_debug%get('grid',defaultVal=emptyList) nActiveFields = 1
select case (trim(num_grid%get_asString('solver', defaultVal = 'Basic'))) select case (solver%get_asString('mechanical'))
case ('Basic') case ('spectral_basic')
mechanical_init => grid_mechanical_spectral_basic_init mechanical_init => grid_mechanical_spectral_basic_init
mechanical_forward => grid_mechanical_spectral_basic_forward mechanical_forward => grid_mechanical_spectral_basic_forward
mechanical_solution => grid_mechanical_spectral_basic_solution mechanical_solution => grid_mechanical_spectral_basic_solution
mechanical_updateCoords => grid_mechanical_spectral_basic_updateCoords mechanical_updateCoords => grid_mechanical_spectral_basic_updateCoords
mechanical_restartWrite => grid_mechanical_spectral_basic_restartWrite mechanical_restartWrite => grid_mechanical_spectral_basic_restartWrite
case ('Polarisation') case ('spectral_polarization')
mechanical_init => grid_mechanical_spectral_polarisation_init mechanical_init => grid_mechanical_spectral_polarisation_init
mechanical_forward => grid_mechanical_spectral_polarisation_forward mechanical_forward => grid_mechanical_spectral_polarisation_forward
mechanical_solution => grid_mechanical_spectral_polarisation_solution mechanical_solution => grid_mechanical_spectral_polarisation_solution
@ -160,32 +160,36 @@ program DAMASK_grid
mechanical_restartWrite => grid_mechanical_FEM_restartWrite mechanical_restartWrite => grid_mechanical_FEM_restartWrite
case default case default
call IO_error(error_ID = 891, ext_msg = trim(num_grid%get_asString('solver'))) call IO_error(error_ID = 891, ext_msg = trim(solver%get_asString('mechanical')))
end select end select
!--------------------------------------------------------------------------------------------------
! initialize field solver information
if (solver%get_asString('thermal',defaultVal = 'n/a') == 'spectral') nActiveFields = nActiveFields + 1
if (solver%get_asString('damage', defaultVal = 'n/a') == 'spectral') nActiveFields = nActiveFields + 1
allocate(solres(nActiveFields))
allocate( ID(nActiveFields))
field = 1
ID(field) = FIELD_MECH_ID ! mechanical active by default
thermalActive: if (solver%get_asString('thermal',defaultVal = 'n/a') == 'spectral') then
field = field + 1
ID(field) = FIELD_THERMAL_ID
endif thermalActive
damageActive: if (solver%get_asString('damage',defaultVal = 'n/a') == 'spectral') then
field = field + 1
ID(field) = FIELD_DAMAGE_ID
endif damageActive
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! reading information from load case file and to sanity checks
config_load => YAML_parse_file(trim(interface_loadFile))
load_steps => config_load%get('loadstep') load_steps => config_load%get('loadstep')
allocate(loadCases(load_steps%length)) ! array of load cases allocate(loadCases(load_steps%length)) ! array of load cases
do l = 1, load_steps%length do l = 1, load_steps%length
allocate(loadCases(l)%ID(nActiveFields))
field = 1
loadCases(l)%ID(field) = FIELD_MECH_ID ! mechanical active by default
thermalActive: if (any(thermal_type == THERMAL_conduction_ID)) then
field = field + 1
loadCases(l)%ID(field) = FIELD_THERMAL_ID
endif thermalActive
damageActive: if (any(damage_type == DAMAGE_nonlocal_ID)) then
field = field + 1
loadCases(l)%ID(field) = FIELD_DAMAGE_ID
endif damageActive
load_step => load_steps%get(l) load_step => load_steps%get(l)
step_bc => load_step%get('boundary_conditions') step_bc => load_step%get('boundary_conditions')
step_mech => step_bc%get('mechanical') step_mech => step_bc%get('mechanical')
@ -220,19 +224,17 @@ program DAMASK_grid
if (.not. allocated(loadCases(l)%deformation%myType)) call IO_error(error_ID=837,ext_msg = 'L/dot_F/F missing') if (.not. allocated(loadCases(l)%deformation%myType)) call IO_error(error_ID=837,ext_msg = 'L/dot_F/F missing')
step_discretization => load_step%get('discretization') step_discretization => load_step%get('discretization')
if(.not. step_discretization%contains('t')) call IO_error(error_ID=837,ext_msg = 't missing') if (.not. step_discretization%contains('t')) call IO_error(error_ID=837,ext_msg = 't missing')
if(.not. step_discretization%contains('N')) call IO_error(error_ID=837,ext_msg = 'N missing') if (.not. step_discretization%contains('N')) call IO_error(error_ID=837,ext_msg = 'N missing')
loadCases(l)%t = step_discretization%get_asFloat('t') loadCases(l)%t = step_discretization%get_asFloat('t')
loadCases(l)%N = step_discretization%get_asInt ('N') loadCases(l)%N = step_discretization%get_asInt ('N')
loadCases(l)%r = step_discretization%get_asFloat('r', defaultVal= 1.0_pReal) loadCases(l)%r = step_discretization%get_asFloat('r', defaultVal= 1.0_pReal)
loadCases(l)%f_restart = load_step%get_asInt('f_restart', defaultVal=huge(0)) loadCases(l)%f_restart = load_step%get_asInt('f_restart', defaultVal=huge(0))
loadCases(l)%f_out = load_step%get_asInt('f_out', defaultVal=1) loadCases(l)%f_out = load_step%get_asInt('f_out', defaultVal=1)
loadCases(l)%estimate_rate = (load_step%get_asBool('estimate_rate',defaultVal=.true.) .and. & loadCases(l)%estimate_rate = (load_step%get_asBool('estimate_rate',defaultVal=.true.) .and. l>1)
merge(.true.,.false.,l > 1))
reportAndCheck: if (worldrank == 0) then reportAndCheck: if (worldrank == 0) then
write (loadcase_string, '(i0)' ) l
print'(/,a,i0)', ' load case: ', l print'(/,a,i0)', ' load case: ', l
print*, ' estimate_rate:', loadCases(l)%estimate_rate print*, ' estimate_rate:', loadCases(l)%estimate_rate
if (loadCases(l)%deformation%myType == 'L') then if (loadCases(l)%deformation%myType == 'L') then
@ -286,13 +288,13 @@ program DAMASK_grid
else else
print'(a,f0.3)', ' r: ', loadCases(l)%r print'(a,f0.3)', ' r: ', loadCases(l)%r
endif endif
print'(a,f0.3)', ' t: ', loadCases(l)%t print'(a,f0.3)', ' t: ', loadCases(l)%t
print'(a,i0)', ' N: ', loadCases(l)%N print'(a,i0)', ' N: ', loadCases(l)%N
print'(a,i0)', ' f_out: ', loadCases(l)%f_out print'(a,i0)', ' f_out: ', loadCases(l)%f_out
if (loadCases(l)%f_restart < huge(0)) & if (loadCases(l)%f_restart < huge(0)) &
print'(a,i0)', ' f_restart: ', loadCases(l)%f_restart print'(a,i0)', ' f_restart: ', loadCases(l)%f_restart
if (errorID > 0) call IO_error(error_ID = errorID, ext_msg = loadcase_string) ! exit with error message if (errorID > 0) call IO_error(error_ID = errorID, el = l)
endif reportAndCheck endif reportAndCheck
enddo enddo
@ -301,12 +303,14 @@ program DAMASK_grid
! doing initialization depending on active solvers ! doing initialization depending on active solvers
call spectral_Utilities_init call spectral_Utilities_init
do field = 1, nActiveFields do field = 1, nActiveFields
select case (loadCases(1)%ID(field)) select case (ID(field))
case(FIELD_MECH_ID) case(FIELD_MECH_ID)
call mechanical_init call mechanical_init
case(FIELD_THERMAL_ID) case(FIELD_THERMAL_ID)
call grid_thermal_spectral_init initial_conditions => config_load%get('initial_conditions',defaultVal=emptyDict)
thermal => initial_conditions%get('thermal',defaultVal=emptyDict)
call grid_thermal_spectral_init(thermal%get_asFloat('T',defaultVal = T_0))
case(FIELD_DAMAGE_ID) case(FIELD_DAMAGE_ID)
call grid_damage_spectral_init call grid_damage_spectral_init
@ -377,7 +381,7 @@ program DAMASK_grid
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! forward fields ! forward fields
do field = 1, nActiveFields do field = 1, nActiveFields
select case(loadCases(l)%ID(field)) select case(ID(field))
case(FIELD_MECH_ID) case(FIELD_MECH_ID)
call mechanical_forward (& call mechanical_forward (&
cutBack,guess,timeinc,timeIncOld,remainingLoadCaseTime, & cutBack,guess,timeinc,timeIncOld,remainingLoadCaseTime, &
@ -397,7 +401,7 @@ program DAMASK_grid
stagIterate = .true. stagIterate = .true.
do while (stagIterate) do while (stagIterate)
do field = 1, nActiveFields do field = 1, nActiveFields
select case(loadCases(l)%ID(field)) select case(ID(field))
case(FIELD_MECH_ID) case(FIELD_MECH_ID)
solres(field) = mechanical_solution(incInfo) solres(field) = mechanical_solution(incInfo)
case(FIELD_THERMAL_ID) case(FIELD_THERMAL_ID)

View File

@ -75,7 +75,7 @@ subroutine grid_damage_spectral_init
print'(/,a)', ' <<<+- grid_spectral_damage init -+>>>' print'(/,a)', ' <<<+- grid_spectral_damage init -+>>>'
print*, 'Shanthraj et al., Handbook of Mechanics of Materials, 2019' print*, 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019'
print*, 'https://doi.org/10.1007/978-981-10-6855-3_80' print*, 'https://doi.org/10.1007/978-981-10-6855-3_80'
!------------------------------------------------------------------------------------------------- !-------------------------------------------------------------------------------------------------

View File

@ -105,10 +105,10 @@ subroutine grid_mechanical_spectral_basic_init
print'(/,a)', ' <<<+- grid_mechanical_spectral_basic init -+>>>'; flush(IO_STDOUT) print'(/,a)', ' <<<+- grid_mechanical_spectral_basic init -+>>>'; flush(IO_STDOUT)
print*, 'Eisenlohr et al., International Journal of Plasticity 46:3753, 2013' print*, 'P. Eisenlohr et al., International Journal of Plasticity 46:3753, 2013'
print*, 'https://doi.org/10.1016/j.ijplas.2012.09.012'//IO_EOL print*, 'https://doi.org/10.1016/j.ijplas.2012.09.012'//IO_EOL
print*, 'Shanthraj et al., International Journal of Plasticity 66:3145, 2015' print*, 'P. Shanthraj et al., International Journal of Plasticity 66:3145, 2015'
print*, 'https://doi.org/10.1016/j.ijplas.2014.02.006' print*, 'https://doi.org/10.1016/j.ijplas.2014.02.006'
!------------------------------------------------------------------------------------------------- !-------------------------------------------------------------------------------------------------

View File

@ -116,9 +116,9 @@ subroutine grid_mechanical_spectral_polarisation_init
num_grid, & num_grid, &
debug_grid debug_grid
print'(/,a)', ' <<<+- grid_mechanical_spectral_polarisation init -+>>>'; flush(IO_STDOUT) print'(/,a)', ' <<<+- grid_mechanical_spectral_polarization init -+>>>'; flush(IO_STDOUT)
print*, 'Shanthraj et al., International Journal of Plasticity 66:3145, 2015' print*, 'P. Shanthraj et al., International Journal of Plasticity 66:3145, 2015'
print*, 'https://doi.org/10.1016/j.ijplas.2014.02.006' print*, 'https://doi.org/10.1016/j.ijplas.2014.02.006'
!------------------------------------------------------------------------------------------------- !-------------------------------------------------------------------------------------------------

View File

@ -61,7 +61,9 @@ contains
!> @brief allocates all neccessary fields and fills them with data !> @brief allocates all neccessary fields and fills them with data
! ToDo: Restart not implemented ! ToDo: Restart not implemented
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine grid_thermal_spectral_init subroutine grid_thermal_spectral_init(T_0)
real(pReal), intent(in) :: T_0
PetscInt, dimension(0:worldsize-1) :: localK PetscInt, dimension(0:worldsize-1) :: localK
integer :: i, j, k, ce integer :: i, j, k, ce
@ -73,7 +75,7 @@ subroutine grid_thermal_spectral_init
print'(/,a)', ' <<<+- grid_thermal_spectral init -+>>>' print'(/,a)', ' <<<+- grid_thermal_spectral init -+>>>'
print*, 'Shanthraj et al., Handbook of Mechanics of Materials, 2019' print*, 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019'
print*, 'https://doi.org/10.1007/978-981-10-6855-3_80' print*, 'https://doi.org/10.1007/978-981-10-6855-3_80'
!------------------------------------------------------------------------------------------------- !-------------------------------------------------------------------------------------------------
@ -131,9 +133,10 @@ subroutine grid_thermal_spectral_init
ce = 0 ce = 0
do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1) do k = 1, grid3; do j = 1, grid(2); do i = 1,grid(1)
ce = ce + 1 ce = ce + 1
T_current(i,j,k) = homogenization_thermal_T(ce) T_current(i,j,k) = T_0
T_lastInc(i,j,k) = T_current(i,j,k) T_lastInc(i,j,k) = T_current(i,j,k)
T_stagInc(i,j,k) = T_current(i,j,k) T_stagInc(i,j,k) = T_current(i,j,k)
call homogenization_thermal_setField(T_0,0.0_pReal,ce)
enddo; enddo; enddo enddo; enddo; enddo
call DMDAVecGetArrayF90(thermal_grid,solution_vec,x_scal,ierr); CHKERRQ(ierr) !< get the data out of PETSc to work with call DMDAVecGetArrayF90(thermal_grid,solution_vec,x_scal,ierr); CHKERRQ(ierr) !< get the data out of PETSc to work with
x_scal(xstart:xend,ystart:yend,zstart:zend) = T_current x_scal(xstart:xend,ystart:yend,zstart:zend) = T_current

View File

@ -176,16 +176,16 @@ subroutine spectral_utilities_init
print'(/,a)', ' <<<+- spectral_utilities init -+>>>' print'(/,a)', ' <<<+- spectral_utilities init -+>>>'
print*, 'Diehl, Diploma Thesis TU München, 2010' print*, 'M. Diehl, Diploma Thesis TU München, 2010'
print*, 'https://doi.org/10.13140/2.1.3234.3840'//IO_EOL print*, 'https://doi.org/10.13140/2.1.3234.3840'//IO_EOL
print*, 'Eisenlohr et al., International Journal of Plasticity 46:3753, 2013' print*, 'P. Eisenlohr et al., International Journal of Plasticity 46:3753, 2013'
print*, 'https://doi.org/10.1016/j.ijplas.2012.09.012'//IO_EOL print*, 'https://doi.org/10.1016/j.ijplas.2012.09.012'//IO_EOL
print*, 'Shanthraj et al., International Journal of Plasticity 66:3145, 2015' print*, 'P. Shanthraj et al., International Journal of Plasticity 66:3145, 2015'
print*, 'https://doi.org/10.1016/j.ijplas.2014.02.006'//IO_EOL print*, 'https://doi.org/10.1016/j.ijplas.2014.02.006'//IO_EOL
print*, 'Shanthraj et al., Handbook of Mechanics of Materials, 2019' print*, 'P. Shanthraj et al., Handbook of Mechanics of Materials, 2019'
print*, 'https://doi.org/10.1007/978-981-10-6855-3_80' print*, 'https://doi.org/10.1007/978-981-10-6855-3_80'
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------

View File

@ -35,15 +35,11 @@ module homogenization
homogState, & homogState, &
damageState_h damageState_h
integer(kind(THERMAL_isothermal_ID)), dimension(:), allocatable :: &
real(pReal), dimension(:), allocatable, public, protected :: &
thermal_initialT
integer(kind(THERMAL_isothermal_ID)), dimension(:), allocatable, public, protected :: &
thermal_type !< thermal transport model thermal_type !< thermal transport model
integer(kind(DAMAGE_none_ID)), dimension(:), allocatable, public, protected :: & integer(kind(DAMAGE_none_ID)), dimension(:), allocatable :: &
damage_type !< nonlocal damage model damage_type !< nonlocal damage model
integer(kind(HOMOGENIZATION_undefined_ID)), dimension(:), allocatable, public, protected :: & integer(kind(HOMOGENIZATION_undefined_ID)), dimension(:), allocatable :: &
homogenization_type !< type of each homogenization homogenization_type !< type of each homogenization
type, private :: tNumerics_damage type, private :: tNumerics_damage
@ -95,7 +91,7 @@ module homogenization
real(pReal), intent(in), dimension(3,3) :: & real(pReal), intent(in), dimension(3,3) :: &
subF subF
integer, intent(in) :: & integer, intent(in) :: &
ce ce
end subroutine mechanical_partition end subroutine mechanical_partition
module subroutine thermal_partition(ce) module subroutine thermal_partition(ce)
@ -133,10 +129,8 @@ module homogenization
module function thermal_conduction_getConductivity(ce) result(K) module function thermal_conduction_getConductivity(ce) result(K)
integer, intent(in) :: ce integer, intent(in) :: ce
real(pReal), dimension(3,3) :: K real(pReal), dimension(3,3) :: K
end function thermal_conduction_getConductivity end function thermal_conduction_getConductivity
module function thermal_conduction_getSpecificHeat(ce) result(c_P) module function thermal_conduction_getSpecificHeat(ce) result(c_P)
@ -171,13 +165,12 @@ module homogenization
real(pReal), intent(out) :: Tdot real(pReal), intent(out) :: Tdot
end subroutine thermal_conduction_getSource end subroutine thermal_conduction_getSource
module function damage_nonlocal_getMobility(ce) result(M) module function damage_nonlocal_getMobility(ce) result(M)
integer, intent(in) :: ce integer, intent(in) :: ce
real(pReal) :: M real(pReal) :: M
end function damage_nonlocal_getMobility end function damage_nonlocal_getMobility
module subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ce) module subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ce)
integer, intent(in) :: ce integer, intent(in) :: ce
real(pReal), intent(in) :: & real(pReal), intent(in) :: &
phi phi
@ -185,21 +178,17 @@ module homogenization
phiDot, dPhiDot_dPhi phiDot, dPhiDot_dPhi
end subroutine damage_nonlocal_getSourceAndItsTangent end subroutine damage_nonlocal_getSourceAndItsTangent
module subroutine damage_nonlocal_putNonLocalDamage(phi,ce) module subroutine damage_nonlocal_putNonLocalDamage(phi,ce)
integer, intent(in) :: ce integer, intent(in) :: ce
real(pReal), intent(in) :: & real(pReal), intent(in) :: &
phi phi
end subroutine damage_nonlocal_putNonLocalDamage end subroutine damage_nonlocal_putNonLocalDamage
module subroutine damage_nonlocal_results(ho,group) module subroutine damage_nonlocal_results(ho,group)
integer, intent(in) :: ho integer, intent(in) :: ho
character(len=*), intent(in) :: group character(len=*), intent(in) :: group
end subroutine damage_nonlocal_results end subroutine damage_nonlocal_results
end interface end interface
public :: & public :: &
@ -242,21 +231,18 @@ subroutine homogenization_init()
allocate(homogState (size(material_name_homogenization))) allocate(homogState (size(material_name_homogenization)))
allocate(damageState_h (size(material_name_homogenization))) allocate(damageState_h (size(material_name_homogenization)))
call material_parseHomogenization call material_parseHomogenization()
num_homog => config_numerics%get('homogenization',defaultVal=emptyDict) num_homog => config_numerics%get('homogenization',defaultVal=emptyDict)
num_homogGeneric => num_homog%get('generic',defaultVal=emptyDict) num_homogGeneric => num_homog%get('generic',defaultVal=emptyDict)
num%nMPstate = num_homogGeneric%get_asInt ('nMPstate', defaultVal=10) num%nMPstate = num_homogGeneric%get_asInt('nMPstate',defaultVal=10)
if (num%nMPstate < 1) call IO_error(301,ext_msg='nMPstate') if (num%nMPstate < 1) call IO_error(301,ext_msg='nMPstate')
call mechanical_init(num_homog) call mechanical_init(num_homog)
call thermal_init() call thermal_init()
call damage_init() call damage_init()
call damage_nonlocal_init()
call damage_nonlocal_init
end subroutine homogenization_init end subroutine homogenization_init
@ -290,8 +276,8 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE
call phase_restore(ce,.false.) ! wrong name (is more a forward function) call phase_restore(ce,.false.) ! wrong name (is more a forward function)
if(homogState(ho)%sizeState > 0) homogState(ho)%State(:,me) = homogState(ho)%State0(:,me) if(homogState(ho)%sizeState > 0) homogState(ho)%state(:,me) = homogState(ho)%state0(:,me)
if(damageState_h(ho)%sizeState > 0) damageState_h(ho)%State(:,me) = damageState_h(ho)%State0(:,me) if(damageState_h(ho)%sizeState > 0) damageState_h(ho)%state(:,me) = damageState_h(ho)%state0(:,me)
call damage_partition(ce) call damage_partition(ce)
doneAndHappy = [.false.,.true.] doneAndHappy = [.false.,.true.]
@ -301,20 +287,17 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE
.and. NiterationMPstate < num%nMPstate) .and. NiterationMPstate < num%nMPstate)
NiterationMPstate = NiterationMPstate + 1 NiterationMPstate = NiterationMPstate + 1
call mechanical_partition(homogenization_F(1:3,1:3,ce),ce)
converged = .true.
do co = 1, myNgrains
converged = converged .and. crystallite_stress(dt,co,ip,el)
enddo
if (.not. doneAndHappy(1)) then if (converged) then
call mechanical_partition(homogenization_F(1:3,1:3,ce),ce) doneAndHappy = mechanical_updateState(dt,homogenization_F(1:3,1:3,ce),ce)
converged = .true. converged = all(doneAndHappy)
do co = 1, myNgrains else
converged = converged .and. crystallite_stress(dt,co,ip,el) doneAndHappy = [.true.,.false.]
enddo
if (.not. converged) then
doneAndHappy = [.true.,.false.]
else
doneAndHappy = mechanical_updateState(dt,homogenization_F(1:3,1:3,ce),ce)
converged = all(doneAndHappy)
endif
endif endif
enddo convergenceLooping enddo convergenceLooping
@ -326,7 +309,7 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE
enddo enddo
!$OMP END DO !$OMP END DO
if (.not. terminallyIll ) then if (.not. terminallyIll) then
!$OMP DO PRIVATE(ho,ph,ce) !$OMP DO PRIVATE(ho,ph,ce)
do el = FEsolving_execElem(1),FEsolving_execElem(2) do el = FEsolving_execElem(1),FEsolving_execElem(2)
if (terminallyIll) continue if (terminallyIll) continue
@ -340,9 +323,9 @@ subroutine materialpoint_stressAndItsTangent(dt,FEsolving_execIP,FEsolving_execE
if (.not. terminallyIll) & ! so first signals terminally ill... if (.not. terminallyIll) & ! so first signals terminally ill...
print*, ' Integration point ', ip,' at element ', el, ' terminally ill' print*, ' Integration point ', ip,' at element ', el, ' terminally ill'
terminallyIll = .true. ! ...and kills all others terminallyIll = .true. ! ...and kills all others
endif endif
call thermal_homogenize(ip,el)
enddo enddo
call thermal_homogenize(ip,el)
enddo enddo
enddo enddo
!$OMP END DO !$OMP END DO
@ -384,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
@ -464,7 +447,7 @@ subroutine homogenization_restartRead(fileHandle)
groupHandle(2) = HDF5_openGroup(groupHandle(1),material_name_homogenization(ho)) groupHandle(2) = HDF5_openGroup(groupHandle(1),material_name_homogenization(ho))
call HDF5_read(groupHandle(2),homogState(ho)%state,'omega') ! ToDo: should be done by mech call HDF5_read(groupHandle(2),homogState(ho)%state0,'omega') ! ToDo: should be done by mech
call HDF5_closeGroup(groupHandle(2)) call HDF5_closeGroup(groupHandle(2))
@ -553,14 +536,13 @@ subroutine material_parseHomogenization
material_homogenization => config_material%get('homogenization') material_homogenization => config_material%get('homogenization')
allocate(homogenization_type(size(material_name_homogenization)), source=HOMOGENIZATION_undefined_ID) allocate(homogenization_type(size(material_name_homogenization)), source=HOMOGENIZATION_undefined_ID)
allocate(thermal_type(size(material_name_homogenization)), source=THERMAL_isothermal_ID) allocate(thermal_type(size(material_name_homogenization)), source=THERMAL_isothermal_ID)
allocate(damage_type (size(material_name_homogenization)), source=DAMAGE_none_ID) allocate(damage_type (size(material_name_homogenization)), source=DAMAGE_none_ID)
allocate(thermal_initialT(size(material_name_homogenization)), source=300.0_pReal)
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
@ -572,27 +554,20 @@ subroutine material_parseHomogenization
call IO_error(500,ext_msg=homogMech%get_asString('type')) call IO_error(500,ext_msg=homogMech%get_asString('type'))
end select end select
if (homog%contains('thermal')) then
if(homog%contains('thermal')) then
homogThermal => homog%get('thermal') homogThermal => homog%get('thermal')
thermal_initialT(h) = homogThermal%get_asFloat('T_0',defaultVal=300.0_pReal)
select case (homogThermal%get_asString('type')) select case (homogThermal%get_asString('type'))
case('isothermal') case('pass')
thermal_type(h) = THERMAL_isothermal_ID
case('conduction')
thermal_type(h) = THERMAL_conduction_ID thermal_type(h) = THERMAL_conduction_ID
case default case default
call IO_error(500,ext_msg=homogThermal%get_asString('type')) call IO_error(500,ext_msg=homogThermal%get_asString('type'))
end select end select
endif endif
if(homog%contains('damage')) then if (homog%contains('damage')) then
homogDamage => homog%get('damage') homogDamage => homog%get('damage')
select case (homogDamage%get_asString('type')) select case (homogDamage%get_asString('type'))
case('none') case('pass')
damage_type(h) = DAMAGE_none_ID
case('nonlocal')
damage_type(h) = DAMAGE_nonlocal_ID damage_type(h) = DAMAGE_nonlocal_ID
case default case default
call IO_error(500,ext_msg=homogDamage%get_asString('type')) call IO_error(500,ext_msg=homogDamage%get_asString('type'))
@ -600,7 +575,6 @@ subroutine material_parseHomogenization
endif endif
enddo enddo
end subroutine material_parseHomogenization end subroutine material_parseHomogenization

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

@ -91,12 +91,11 @@ module subroutine mechanical_RGC_init(num_homogMech)
print'(a,i2)', ' # instances: ',count(homogenization_type == HOMOGENIZATION_RGC_ID); flush(IO_STDOUT) print'(a,i2)', ' # instances: ',count(homogenization_type == HOMOGENIZATION_RGC_ID); flush(IO_STDOUT)
print*, 'Tjahjanto et al., International Journal of Material Forming 2(1):939942, 2009' print*, 'D.D. Tjahjanto et al., International Journal of Material Forming 2(1):939942, 2009'
print*, 'https://doi.org/10.1007/s12289-009-0619-1'//IO_EOL print*, 'https://doi.org/10.1007/s12289-009-0619-1'//IO_EOL
print*, 'Tjahjanto et al., Modelling and Simulation in Materials Science and Engineering 18:015006, 2010' print*, 'D.D. Tjahjanto et al., Modelling and Simulation in Materials Science and Engineering 18:015006, 2010'
print*, 'https://doi.org/10.1088/0965-0393/18/1/015006'//IO_EOL print*, 'https://doi.org/10.1088/0965-0393/18/1/015006'//IO_EOL
material_homogenization => config_material%get('homogenization') material_homogenization => config_material%get('homogenization')
@ -139,7 +138,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

@ -44,7 +44,7 @@ module subroutine thermal_init()
allocate(current(configHomogenizations%length)) allocate(current(configHomogenizations%length))
do ho = 1, configHomogenizations%length do ho = 1, configHomogenizations%length
allocate(current(ho)%T(count(material_homogenizationAt2==ho)), source=thermal_initialT(ho)) allocate(current(ho)%T(count(material_homogenizationAt2==ho)), source=300.0_pReal)
allocate(current(ho)%dot_T(count(material_homogenizationAt2==ho)), source=0.0_pReal) allocate(current(ho)%dot_T(count(material_homogenizationAt2==ho)), source=0.0_pReal)
configHomogenization => configHomogenizations%get(ho) configHomogenization => configHomogenizations%get(ho)
associate(prm => param(ho)) associate(prm => param(ho))

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

@ -17,7 +17,7 @@ module material
private private
integer, dimension(:), allocatable, public, protected :: & integer, dimension(:), allocatable, public, protected :: &
homogenization_Nconstituents !< number of grains in each homogenization homogenization_Nconstituents !< number of grains in each homogenization
character(len=:), public, protected, allocatable, dimension(:) :: & character(len=:), public, protected, allocatable, dimension(:) :: &
material_name_phase, & !< name of each phase material_name_phase, & !< name of each phase
@ -30,7 +30,7 @@ module material
material_homogenizationAt, & !< homogenization ID of each element material_homogenizationAt, & !< homogenization ID of each element
material_homogenizationAt2, & !< per cell material_homogenizationAt2, & !< per cell
material_homogenizationMemberAt2 !< cell material_homogenizationMemberAt2 !< cell
integer, dimension(:,:), allocatable, public, protected :: & ! (ip,elem) integer, dimension(:,:), allocatable :: & ! (ip,elem)
material_homogenizationMemberAt !< position of the element within its homogenization instance material_homogenizationMemberAt !< position of the element within its homogenization instance
integer, dimension(:,:), allocatable, public, protected :: & ! (constituent,elem) integer, dimension(:,:), allocatable, public, protected :: & ! (constituent,elem)
material_phaseAt, & !< phase ID of each element material_phaseAt, & !< phase ID of each element

View File

@ -133,7 +133,7 @@ module subroutine damage_init
integer :: & integer :: &
ph, & !< counter in phase loop ph, & !< counter in phase loop
Nconstituents Nmembers
class(tNode), pointer :: & class(tNode), pointer :: &
phases, & phases, &
phase, & phase, &
@ -151,10 +151,10 @@ module subroutine damage_init
do ph = 1,phases%length do ph = 1,phases%length
Nconstituents = count(material_phaseAt2 == ph) Nmembers = count(material_phaseAt2 == ph)
allocate(current(ph)%phi(Nconstituents),source=1.0_pReal) allocate(current(ph)%phi(Nmembers),source=1.0_pReal)
allocate(current(ph)%d_phi_d_dot_phi(Nconstituents),source=0.0_pReal) allocate(current(ph)%d_phi_d_dot_phi(Nmembers),source=0.0_pReal)
phase => phases%get(ph) phase => phases%get(ph)
sources => phase%get('damage',defaultVal=emptyList) sources => phase%get('damage',defaultVal=emptyList)
@ -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

@ -40,7 +40,7 @@ module function anisobrittle_init() result(mySources)
phase, & phase, &
sources, & sources, &
src src
integer :: Nconstituents,p integer :: Nmembers,p
integer, dimension(:), allocatable :: N_cl integer, dimension(:), allocatable :: N_cl
character(len=pStringLen) :: extmsg = '' character(len=pStringLen) :: extmsg = ''
@ -92,8 +92,8 @@ module function anisobrittle_init() result(mySources)
if (any(prm%g_crit < 0.0_pReal)) extmsg = trim(extmsg)//' g_crit' if (any(prm%g_crit < 0.0_pReal)) extmsg = trim(extmsg)//' g_crit'
if (any(prm%s_crit < 0.0_pReal)) extmsg = trim(extmsg)//' s_crit' if (any(prm%s_crit < 0.0_pReal)) extmsg = trim(extmsg)//' s_crit'
Nconstituents = count(material_phaseAt==p) * discretization_nIPs Nmembers = count(material_phaseAt==p) * discretization_nIPs
call phase_allocateState(damageState(p),Nconstituents,1,1,0) call phase_allocateState(damageState(p),Nmembers,1,1,0)
damageState(p)%atol = src%get_asFloat('anisobrittle_atol',defaultVal=1.0e-3_pReal) damageState(p)%atol = src%get_asFloat('anisobrittle_atol',defaultVal=1.0e-3_pReal)
if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisobrittle_atol' if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisobrittle_atol'

View File

@ -35,7 +35,7 @@ module function anisoductile_init() result(mySources)
pl, & pl, &
sources, & sources, &
src src
integer :: Ninstances,Nconstituents,p integer :: Ninstances,Nmembers,p
integer, dimension(:), allocatable :: N_sl integer, dimension(:), allocatable :: N_sl
character(len=pStringLen) :: extmsg = '' character(len=pStringLen) :: extmsg = ''
@ -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')
@ -78,8 +78,8 @@ module function anisoductile_init() result(mySources)
if (prm%q <= 0.0_pReal) extmsg = trim(extmsg)//' q' if (prm%q <= 0.0_pReal) extmsg = trim(extmsg)//' q'
if (any(prm%gamma_crit < 0.0_pReal)) extmsg = trim(extmsg)//' gamma_crit' if (any(prm%gamma_crit < 0.0_pReal)) extmsg = trim(extmsg)//' gamma_crit'
Nconstituents=count(material_phaseAt2==p) Nmembers=count(material_phaseAt2==p)
call phase_allocateState(damageState(p),Nconstituents,1,1,0) call phase_allocateState(damageState(p),Nmembers,1,1,0)
damageState(p)%atol = src%get_asFloat('anisoDuctile_atol',defaultVal=1.0e-3_pReal) damageState(p)%atol = src%get_asFloat('anisoDuctile_atol',defaultVal=1.0e-3_pReal)
if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisoductile_atol' if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' anisoductile_atol'

View File

@ -31,7 +31,7 @@ module function isobrittle_init() result(mySources)
phase, & phase, &
sources, & sources, &
src src
integer :: Nconstituents,p integer :: Nmembers,p
character(len=pStringLen) :: extmsg = '' character(len=pStringLen) :: extmsg = ''
@ -64,8 +64,8 @@ module function isobrittle_init() result(mySources)
! sanity checks ! sanity checks
if (prm%W_crit <= 0.0_pReal) extmsg = trim(extmsg)//' W_crit' if (prm%W_crit <= 0.0_pReal) extmsg = trim(extmsg)//' W_crit'
Nconstituents = count(material_phaseAt2==p) Nmembers = count(material_phaseAt2==p)
call phase_allocateState(damageState(p),Nconstituents,1,1,1) call phase_allocateState(damageState(p),Nmembers,1,1,1)
damageState(p)%atol = src%get_asFloat('isoBrittle_atol',defaultVal=1.0e-3_pReal) damageState(p)%atol = src%get_asFloat('isoBrittle_atol',defaultVal=1.0e-3_pReal)
if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isobrittle_atol' if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isobrittle_atol'

View File

@ -33,7 +33,7 @@ module function isoductile_init() result(mySources)
phase, & phase, &
sources, & sources, &
src src
integer :: Ninstances,Nconstituents,p integer :: Ninstances,Nmembers,p
character(len=pStringLen) :: extmsg = '' character(len=pStringLen) :: extmsg = ''
@ -68,8 +68,8 @@ module function isoductile_init() result(mySources)
if (prm%q <= 0.0_pReal) extmsg = trim(extmsg)//' q' if (prm%q <= 0.0_pReal) extmsg = trim(extmsg)//' q'
if (prm%gamma_crit <= 0.0_pReal) extmsg = trim(extmsg)//' gamma_crit' if (prm%gamma_crit <= 0.0_pReal) extmsg = trim(extmsg)//' gamma_crit'
Nconstituents=count(material_phaseAt2==p) Nmembers=count(material_phaseAt2==p)
call phase_allocateState(damageState(p),Nconstituents,1,1,0) call phase_allocateState(damageState(p),Nmembers,1,1,0)
damageState(p)%atol = src%get_asFloat('isoDuctile_atol',defaultVal=1.0e-3_pReal) damageState(p)%atol = src%get_asFloat('isoDuctile_atol',defaultVal=1.0e-3_pReal)
if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isoductile_atol' if(any(damageState(p)%atol < 0.0_pReal)) extmsg = trim(extmsg)//' isoductile_atol'

View File

@ -191,7 +191,7 @@ module subroutine mechanical_init(materials,phases)
ph, & ph, &
me, & me, &
stiffDegradationCtr, & stiffDegradationCtr, &
Nconstituents Nmembers
class(tNode), pointer :: & class(tNode), pointer :: &
num_crystallite, & num_crystallite, &
material, & material, &
@ -229,31 +229,31 @@ module subroutine mechanical_init(materials,phases)
allocate(material_orientation0(homogenization_maxNconstituents,phases%length,maxVal(material_phaseMemberAt))) allocate(material_orientation0(homogenization_maxNconstituents,phases%length,maxVal(material_phaseMemberAt)))
do ph = 1, phases%length do ph = 1, phases%length
Nconstituents = count(material_phaseAt == ph) * discretization_nIPs Nmembers = count(material_phaseAt == ph) * discretization_nIPs
allocate(phase_mechanical_Fi(ph)%data(3,3,Nconstituents)) allocate(phase_mechanical_Fi(ph)%data(3,3,Nmembers))
allocate(phase_mechanical_Fe(ph)%data(3,3,Nconstituents)) allocate(phase_mechanical_Fe(ph)%data(3,3,Nmembers))
allocate(phase_mechanical_Fi0(ph)%data(3,3,Nconstituents)) allocate(phase_mechanical_Fi0(ph)%data(3,3,Nmembers))
allocate(phase_mechanical_Fp(ph)%data(3,3,Nconstituents)) allocate(phase_mechanical_Fp(ph)%data(3,3,Nmembers))
allocate(phase_mechanical_Fp0(ph)%data(3,3,Nconstituents)) allocate(phase_mechanical_Fp0(ph)%data(3,3,Nmembers))
allocate(phase_mechanical_Li(ph)%data(3,3,Nconstituents)) allocate(phase_mechanical_Li(ph)%data(3,3,Nmembers))
allocate(phase_mechanical_Li0(ph)%data(3,3,Nconstituents)) allocate(phase_mechanical_Li0(ph)%data(3,3,Nmembers))
allocate(phase_mechanical_Lp0(ph)%data(3,3,Nconstituents)) allocate(phase_mechanical_Lp0(ph)%data(3,3,Nmembers))
allocate(phase_mechanical_Lp(ph)%data(3,3,Nconstituents)) allocate(phase_mechanical_Lp(ph)%data(3,3,Nmembers))
allocate(phase_mechanical_S(ph)%data(3,3,Nconstituents),source=0.0_pReal) allocate(phase_mechanical_S(ph)%data(3,3,Nmembers),source=0.0_pReal)
allocate(phase_mechanical_P(ph)%data(3,3,Nconstituents),source=0.0_pReal) allocate(phase_mechanical_P(ph)%data(3,3,Nmembers),source=0.0_pReal)
allocate(phase_mechanical_S0(ph)%data(3,3,Nconstituents),source=0.0_pReal) allocate(phase_mechanical_S0(ph)%data(3,3,Nmembers),source=0.0_pReal)
allocate(phase_mechanical_F(ph)%data(3,3,Nconstituents)) allocate(phase_mechanical_F(ph)%data(3,3,Nmembers))
allocate(phase_mechanical_F0(ph)%data(3,3,Nconstituents)) 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') &
@ -278,8 +278,7 @@ module subroutine mechanical_init(materials,phases)
enddo enddo
endif endif
!$OMP PARALLEL DO PRIVATE(ph,me,material,constituents,constituent)
do el = 1, size(material_phaseMemberAt,3); do ip = 1, size(material_phaseMemberAt,2) do el = 1, size(material_phaseMemberAt,3); do ip = 1, size(material_phaseMemberAt,2)
do co = 1, homogenization_Nconstituents(material_homogenizationAt(el)) do co = 1, homogenization_Nconstituents(material_homogenizationAt(el))
material => materials%get(discretization_materialAt(el)) material => materials%get(discretization_materialAt(el))
@ -305,7 +304,6 @@ module subroutine mechanical_init(materials,phases)
enddo enddo
enddo; enddo enddo; enddo
!$OMP END PARALLEL DO
! initialize plasticity ! initialize plasticity
@ -400,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
@ -563,7 +560,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken)
cycle LpLoop cycle LpLoop
endif endif
calculateJacobiLi: if (mod(jacoCounterLp, num%iJacoLpresiduum) == 0) then calculateJacobiLp: if (mod(jacoCounterLp, num%iJacoLpresiduum) == 0) then
jacoCounterLp = jacoCounterLp + 1 jacoCounterLp = jacoCounterLp + 1
do o=1,3; do p=1,3 do o=1,3; do p=1,3
@ -575,7 +572,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken)
call dgesv(9,1,dRLp_dLp,9,devNull_9,temp_9,9,ierr) ! solve dRLp/dLp * delta Lp = -res for delta Lp call dgesv(9,1,dRLp_dLp,9,devNull_9,temp_9,9,ierr) ! solve dRLp/dLp * delta Lp = -res for delta Lp
if (ierr /= 0) return ! error if (ierr /= 0) return ! error
deltaLp = - math_9to33(temp_9) deltaLp = - math_9to33(temp_9)
endif calculateJacobiLi endif calculateJacobiLp
Lpguess = Lpguess & Lpguess = Lpguess &
+ deltaLp * steplengthLp + deltaLp * steplengthLp
@ -603,7 +600,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken)
cycle LiLoop cycle LiLoop
endif endif
calculateJacobiLp: if (mod(jacoCounterLi, num%iJacoLpresiduum) == 0) then calculateJacobiLi: if (mod(jacoCounterLi, num%iJacoLpresiduum) == 0) then
jacoCounterLi = jacoCounterLi + 1 jacoCounterLi = jacoCounterLi + 1
temp_33 = matmul(matmul(A,B),invFi_current) temp_33 = matmul(matmul(A,B),invFi_current)
@ -622,7 +619,7 @@ function integrateStress(F,subFp0,subFi0,Delta_t,co,ip,el) result(broken)
call dgesv(9,1,dRLi_dLi,9,devNull_9,temp_9,9,ierr) ! solve dRLi/dLp * delta Li = -res for delta Li call dgesv(9,1,dRLi_dLi,9,devNull_9,temp_9,9,ierr) ! solve dRLi/dLp * delta Li = -res for delta Li
if (ierr /= 0) return ! error if (ierr /= 0) return ! error
deltaLi = - math_9to33(temp_9) deltaLi = - math_9to33(temp_9)
endif calculateJacobiLp endif calculateJacobiLi
Liguess = Liguess & Liguess = Liguess &
+ deltaLi * steplengthLi + deltaLi * steplengthLi
@ -980,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)
@ -1025,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

@ -79,7 +79,7 @@ module function plastic_dislotungsten_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
ph, i, & ph, i, &
Nconstituents, & Nmembers, &
sizeState, sizeDotState, & sizeState, sizeDotState, &
startIndex, endIndex startIndex, endIndex
integer, dimension(:), allocatable :: & integer, dimension(:), allocatable :: &
@ -103,8 +103,8 @@ module function plastic_dislotungsten_init() result(myPlasticity)
print'(/,a)', ' <<<+- phase:mechanical:plastic:dislotungsten init -+>>>' print'(/,a)', ' <<<+- phase:mechanical:plastic:dislotungsten init -+>>>'
print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT)
print*, 'Cereceda et al., International Journal of Plasticity 78:242256, 2016' print*, 'D. Cereceda et al., International Journal of Plasticity 78:242256, 2016'
print*, 'https://dx.doi.org/10.1016/j.ijplas.2015.09.002' print*, 'https://doi.org/10.1016/j.ijplas.2015.09.002'
phases => config_material%get('phase') phases => config_material%get('phase')
@ -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)
@ -220,18 +220,18 @@ module function plastic_dislotungsten_init() result(myPlasticity)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
Nconstituents = count(material_phaseAt2 == ph) Nmembers = count(material_phaseAt2 == ph)
sizeDotState = size(['rho_mob ','rho_dip ','gamma_sl']) * prm%sum_N_sl sizeDotState = size(['rho_mob ','rho_dip ','gamma_sl']) * prm%sum_N_sl
sizeState = sizeDotState sizeState = sizeDotState
call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,0) call phase_allocateState(plasticState(ph),Nmembers,sizeState,sizeDotState,0)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! state aliases and initialization ! state aliases and initialization
startIndex = 1 startIndex = 1
endIndex = prm%sum_N_sl endIndex = prm%sum_N_sl
stt%rho_mob => plasticState(ph)%state(startIndex:endIndex,:) stt%rho_mob => plasticState(ph)%state(startIndex:endIndex,:)
stt%rho_mob = spread(rho_mob_0,2,Nconstituents) stt%rho_mob = spread(rho_mob_0,2,Nmembers)
dot%rho_mob => plasticState(ph)%dotState(startIndex:endIndex,:) dot%rho_mob => plasticState(ph)%dotState(startIndex:endIndex,:)
plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal)
if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_rho' if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_rho'
@ -239,7 +239,7 @@ module function plastic_dislotungsten_init() result(myPlasticity)
startIndex = endIndex + 1 startIndex = endIndex + 1
endIndex = endIndex + prm%sum_N_sl endIndex = endIndex + prm%sum_N_sl
stt%rho_dip => plasticState(ph)%state(startIndex:endIndex,:) stt%rho_dip => plasticState(ph)%state(startIndex:endIndex,:)
stt%rho_dip = spread(rho_dip_0,2,Nconstituents) stt%rho_dip = spread(rho_dip_0,2,Nmembers)
dot%rho_dip => plasticState(ph)%dotState(startIndex:endIndex,:) dot%rho_dip => plasticState(ph)%dotState(startIndex:endIndex,:)
plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal)
@ -251,8 +251,8 @@ module function plastic_dislotungsten_init() result(myPlasticity)
! global alias ! global alias
plasticState(ph)%slipRate => plasticState(ph)%dotState(startIndex:endIndex,:) plasticState(ph)%slipRate => plasticState(ph)%dotState(startIndex:endIndex,:)
allocate(dst%Lambda_sl(prm%sum_N_sl,Nconstituents), source=0.0_pReal) allocate(dst%Lambda_sl(prm%sum_N_sl,Nmembers), source=0.0_pReal)
allocate(dst%threshold_stress(prm%sum_N_sl,Nconstituents), source=0.0_pReal) allocate(dst%threshold_stress(prm%sum_N_sl,Nmembers), source=0.0_pReal)
plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally

View File

@ -127,7 +127,7 @@ module function plastic_dislotwin_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
ph, i, & ph, i, &
Nconstituents, & Nmembers, &
sizeState, sizeDotState, & sizeState, sizeDotState, &
startIndex, endIndex startIndex, endIndex
integer, dimension(:), allocatable :: & integer, dimension(:), allocatable :: &
@ -150,13 +150,13 @@ module function plastic_dislotwin_init() result(myPlasticity)
print'(/,a)', ' <<<+- phase:mechanical:plastic:dislotwin init -+>>>' print'(/,a)', ' <<<+- phase:mechanical:plastic:dislotwin init -+>>>'
print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT)
print*, 'Ma and Roters, Acta Materialia 52(12):36033612, 2004' print*, 'A. Ma and F. Roters, Acta Materialia 52(12):36033612, 2004'
print*, 'https://doi.org/10.1016/j.actamat.2004.04.012'//IO_EOL print*, 'https://doi.org/10.1016/j.actamat.2004.04.012'//IO_EOL
print*, 'Roters et al., Computational Materials Science 39:9195, 2007' print*, 'F. Roters et al., Computational Materials Science 39:9195, 2007'
print*, 'https://doi.org/10.1016/j.commatsci.2006.04.014'//IO_EOL print*, 'https://doi.org/10.1016/j.commatsci.2006.04.014'//IO_EOL
print*, 'Wong et al., Acta Materialia 118:140151, 2016' print*, 'S.L. Wong et al., Acta Materialia 118:140151, 2016'
print*, 'https://doi.org/10.1016/j.actamat.2016.07.032' print*, 'https://doi.org/10.1016/j.actamat.2016.07.032'
@ -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)
@ -406,21 +406,21 @@ module function plastic_dislotwin_init() result(myPlasticity)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
Nconstituents = count(material_phaseAt2 == ph) Nmembers = count(material_phaseAt2 == ph)
sizeDotState = size(['rho_mob ','rho_dip ','gamma_sl']) * prm%sum_N_sl & sizeDotState = size(['rho_mob ','rho_dip ','gamma_sl']) * prm%sum_N_sl &
+ size(['f_tw']) * prm%sum_N_tw & + size(['f_tw']) * prm%sum_N_tw &
+ size(['f_tr']) * prm%sum_N_tr + size(['f_tr']) * prm%sum_N_tr
sizeState = sizeDotState sizeState = sizeDotState
call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,0) call phase_allocateState(plasticState(ph),Nmembers,sizeState,sizeDotState,0)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! locally defined state aliases and initialization of state0 and atol ! locally defined state aliases and initialization of state0 and atol
startIndex = 1 startIndex = 1
endIndex = prm%sum_N_sl endIndex = prm%sum_N_sl
stt%rho_mob=>plasticState(ph)%state(startIndex:endIndex,:) stt%rho_mob=>plasticState(ph)%state(startIndex:endIndex,:)
stt%rho_mob= spread(rho_mob_0,2,Nconstituents) stt%rho_mob= spread(rho_mob_0,2,Nmembers)
dot%rho_mob=>plasticState(ph)%dotState(startIndex:endIndex,:) dot%rho_mob=>plasticState(ph)%dotState(startIndex:endIndex,:)
plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal)
if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_rho' if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_rho'
@ -428,7 +428,7 @@ module function plastic_dislotwin_init() result(myPlasticity)
startIndex = endIndex + 1 startIndex = endIndex + 1
endIndex = endIndex + prm%sum_N_sl endIndex = endIndex + prm%sum_N_sl
stt%rho_dip=>plasticState(ph)%state(startIndex:endIndex,:) stt%rho_dip=>plasticState(ph)%state(startIndex:endIndex,:)
stt%rho_dip= spread(rho_dip_0,2,Nconstituents) stt%rho_dip= spread(rho_dip_0,2,Nmembers)
dot%rho_dip=>plasticState(ph)%dotState(startIndex:endIndex,:) dot%rho_dip=>plasticState(ph)%dotState(startIndex:endIndex,:)
plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_rho',defaultVal=1.0_pReal)
@ -454,18 +454,18 @@ module function plastic_dislotwin_init() result(myPlasticity)
plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_f_tr',defaultVal=1.0e-6_pReal) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_f_tr',defaultVal=1.0e-6_pReal)
if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_f_tr' if (any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_f_tr'
allocate(dst%Lambda_sl (prm%sum_N_sl,Nconstituents),source=0.0_pReal) allocate(dst%Lambda_sl (prm%sum_N_sl,Nmembers),source=0.0_pReal)
allocate(dst%tau_pass (prm%sum_N_sl,Nconstituents),source=0.0_pReal) allocate(dst%tau_pass (prm%sum_N_sl,Nmembers),source=0.0_pReal)
allocate(dst%Lambda_tw (prm%sum_N_tw,Nconstituents),source=0.0_pReal) allocate(dst%Lambda_tw (prm%sum_N_tw,Nmembers),source=0.0_pReal)
allocate(dst%tau_hat_tw (prm%sum_N_tw,Nconstituents),source=0.0_pReal) allocate(dst%tau_hat_tw (prm%sum_N_tw,Nmembers),source=0.0_pReal)
allocate(dst%tau_r_tw (prm%sum_N_tw,Nconstituents),source=0.0_pReal) allocate(dst%tau_r_tw (prm%sum_N_tw,Nmembers),source=0.0_pReal)
allocate(dst%V_tw (prm%sum_N_tw,Nconstituents),source=0.0_pReal) allocate(dst%V_tw (prm%sum_N_tw,Nmembers),source=0.0_pReal)
allocate(dst%Lambda_tr (prm%sum_N_tr,Nconstituents),source=0.0_pReal) allocate(dst%Lambda_tr (prm%sum_N_tr,Nmembers),source=0.0_pReal)
allocate(dst%tau_hat_tr (prm%sum_N_tr,Nconstituents),source=0.0_pReal) allocate(dst%tau_hat_tr (prm%sum_N_tr,Nmembers),source=0.0_pReal)
allocate(dst%tau_r_tr (prm%sum_N_tr,Nconstituents),source=0.0_pReal) allocate(dst%tau_r_tr (prm%sum_N_tr,Nmembers),source=0.0_pReal)
allocate(dst%V_tr (prm%sum_N_tr,Nconstituents),source=0.0_pReal) allocate(dst%V_tr (prm%sum_N_tr,Nmembers),source=0.0_pReal)
plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally plasticState(ph)%state0 = plasticState(ph)%state ! ToDo: this could be done centrally

View File

@ -52,7 +52,7 @@ module function plastic_isotropic_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
ph, & ph, &
Nconstituents, & Nmembers, &
sizeState, sizeDotState sizeState, sizeDotState
real(pReal) :: & real(pReal) :: &
xi_0 !< initial critical stress xi_0 !< initial critical stress
@ -71,7 +71,7 @@ module function plastic_isotropic_init() result(myPlasticity)
print'(/,a)', ' <<<+- phase:mechanical:plastic:isotropic init -+>>>' print'(/,a)', ' <<<+- phase:mechanical:plastic:isotropic init -+>>>'
print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT) print'(a,i0)', ' # phases: ',count(myPlasticity); flush(IO_STDOUT)
print*, 'Maiti and Eisenlohr, Scripta Materialia 145:3740, 2018' print*, 'T. Maiti and P. Eisenlohr, Scripta Materialia 145:3740, 2018'
print*, 'https://doi.org/10.1016/j.scriptamat.2017.09.047' print*, 'https://doi.org/10.1016/j.scriptamat.2017.09.047'
phases => config_material%get('phase') phases => config_material%get('phase')
@ -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)
@ -119,11 +119,11 @@ module function plastic_isotropic_init() result(myPlasticity)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
Nconstituents = count(material_phaseAt2 == ph) Nmembers = count(material_phaseAt2 == ph)
sizeDotState = size(['xi ','gamma']) sizeDotState = size(['xi ','gamma'])
sizeState = sizeDotState sizeState = sizeDotState
call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,0) call phase_allocateState(plasticState(ph),Nmembers,sizeState,sizeDotState,0)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! state aliases and initialization ! state aliases and initialization

View File

@ -62,7 +62,7 @@ module function plastic_kinehardening_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
ph, o, & ph, o, &
Nconstituents, & Nmembers, &
sizeState, sizeDeltaState, sizeDotState, & sizeState, sizeDeltaState, sizeDotState, &
startIndex, endIndex startIndex, endIndex
integer, dimension(:), allocatable :: & integer, dimension(:), allocatable :: &
@ -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)
@ -165,19 +165,19 @@ module function plastic_kinehardening_init() result(myPlasticity)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
Nconstituents = count(material_phaseAt2 == ph) Nmembers = count(material_phaseAt2 == ph)
sizeDotState = size(['crss ','crss_back', 'accshear ']) * prm%sum_N_sl !ToDo: adjust names like in material.yaml sizeDotState = size(['crss ','crss_back', 'accshear ']) * prm%sum_N_sl !ToDo: adjust names like in material.yaml
sizeDeltaState = size(['sense ', 'chi0 ', 'gamma0' ]) * prm%sum_N_sl !ToDo: adjust names like in material.yaml sizeDeltaState = size(['sense ', 'chi0 ', 'gamma0' ]) * prm%sum_N_sl !ToDo: adjust names like in material.yaml
sizeState = sizeDotState + sizeDeltaState sizeState = sizeDotState + sizeDeltaState
call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,sizeDeltaState) call phase_allocateState(plasticState(ph),Nmembers,sizeState,sizeDotState,sizeDeltaState)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! state aliases and initialization ! state aliases and initialization
startIndex = 1 startIndex = 1
endIndex = prm%sum_N_sl endIndex = prm%sum_N_sl
stt%crss => plasticState(ph)%state (startIndex:endIndex,:) stt%crss => plasticState(ph)%state (startIndex:endIndex,:)
stt%crss = spread(xi_0, 2, Nconstituents) stt%crss = spread(xi_0, 2, Nmembers)
dot%crss => plasticState(ph)%dotState(startIndex:endIndex,:) dot%crss => plasticState(ph)%dotState(startIndex:endIndex,:)
plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal)
if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi' if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi'

View File

@ -177,7 +177,7 @@ module function plastic_nonlocal_init() result(myPlasticity)
integer :: & integer :: &
Ninstances, & Ninstances, &
ph, & ph, &
Nconstituents, & Nmembers, &
sizeState, sizeDotState, sizeDependentState, sizeDeltaState, & sizeState, sizeDotState, sizeDependentState, sizeDeltaState, &
s1, s2, & s1, s2, &
s, t, l s, t, l
@ -203,10 +203,10 @@ module function plastic_nonlocal_init() result(myPlasticity)
print'(/,a)', ' <<<+- phase:mechanical:plastic:nonlocal init -+>>>' print'(/,a)', ' <<<+- phase:mechanical:plastic:nonlocal init -+>>>'
print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT) print'(a,i0)', ' # phases: ',Ninstances; flush(IO_STDOUT)
print*, 'Reuber et al., Acta Materialia 71:333348, 2014' print*, 'C. Reuber et al., Acta Materialia 71:333348, 2014'
print*, 'https://doi.org/10.1016/j.actamat.2014.03.012'//IO_EOL print*, 'https://doi.org/10.1016/j.actamat.2014.03.012'//IO_EOL
print*, 'Kords, Dissertation RWTH Aachen, 2014' print*, 'C. Kords, Dissertation RWTH Aachen, 2014'
print*, 'http://publications.rwth-aachen.de/record/229993' print*, 'http://publications.rwth-aachen.de/record/229993'
@ -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')
@ -398,7 +398,7 @@ module function plastic_nonlocal_init() result(myPlasticity)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
Nconstituents = count(material_phaseAt2 == ph) Nmembers = count(material_phaseAt2 == ph)
sizeDotState = size([ 'rhoSglEdgePosMobile ','rhoSglEdgeNegMobile ', & sizeDotState = size([ 'rhoSglEdgePosMobile ','rhoSglEdgeNegMobile ', &
'rhoSglScrewPosMobile ','rhoSglScrewNegMobile ', & 'rhoSglScrewPosMobile ','rhoSglScrewNegMobile ', &
'rhoSglEdgePosImmobile ','rhoSglEdgeNegImmobile ', & 'rhoSglEdgePosImmobile ','rhoSglEdgeNegImmobile ', &
@ -412,9 +412,9 @@ module function plastic_nonlocal_init() result(myPlasticity)
'maxDipoleHeightEdge ','maxDipoleHeightScrew' ]) * prm%sum_N_sl !< other dependent state variables that are not updated by microstructure 'maxDipoleHeightEdge ','maxDipoleHeightScrew' ]) * prm%sum_N_sl !< other dependent state variables that are not updated by microstructure
sizeDeltaState = sizeDotState sizeDeltaState = sizeDotState
call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,sizeDeltaState) call phase_allocateState(plasticState(ph),Nmembers,sizeState,sizeDotState,sizeDeltaState)
allocate(geom(ph)%V_0(Nconstituents)) allocate(geom(ph)%V_0(Nmembers))
call storeGeometry(ph) call storeGeometry(ph)
plasticState(ph)%nonlocal = pl%get_asBool('nonlocal') plasticState(ph)%nonlocal = pl%get_asBool('nonlocal')
@ -486,26 +486,26 @@ module function plastic_nonlocal_init() result(myPlasticity)
dot%rho_dip_scr => plasticState(ph)%dotState (9*prm%sum_N_sl+1:10*prm%sum_N_sl,:) dot%rho_dip_scr => plasticState(ph)%dotState (9*prm%sum_N_sl+1:10*prm%sum_N_sl,:)
del%rho_dip_scr => plasticState(ph)%deltaState (9*prm%sum_N_sl+1:10*prm%sum_N_sl,:) del%rho_dip_scr => plasticState(ph)%deltaState (9*prm%sum_N_sl+1:10*prm%sum_N_sl,:)
stt%gamma => plasticState(ph)%state (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) stt%gamma => plasticState(ph)%state (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nmembers)
dot%gamma => plasticState(ph)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) dot%gamma => plasticState(ph)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nmembers)
del%gamma => plasticState(ph)%deltaState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) del%gamma => plasticState(ph)%deltaState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nmembers)
plasticState(ph)%atol(10*prm%sum_N_sl+1:11*prm%sum_N_sl ) = pl%get_asFloat('atol_gamma', defaultVal = 1.0e-2_pReal) plasticState(ph)%atol(10*prm%sum_N_sl+1:11*prm%sum_N_sl ) = pl%get_asFloat('atol_gamma', defaultVal = 1.0e-2_pReal)
if(any(plasticState(ph)%atol(10*prm%sum_N_sl+1:11*prm%sum_N_sl) < 0.0_pReal)) & if(any(plasticState(ph)%atol(10*prm%sum_N_sl+1:11*prm%sum_N_sl) < 0.0_pReal)) &
extmsg = trim(extmsg)//' atol_gamma' extmsg = trim(extmsg)//' atol_gamma'
plasticState(ph)%slipRate => plasticState(ph)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nconstituents) plasticState(ph)%slipRate => plasticState(ph)%dotState (10*prm%sum_N_sl + 1:11*prm%sum_N_sl,1:Nmembers)
stt%rho_forest => plasticState(ph)%state (11*prm%sum_N_sl + 1:12*prm%sum_N_sl,1:Nconstituents) stt%rho_forest => plasticState(ph)%state (11*prm%sum_N_sl + 1:12*prm%sum_N_sl,1:Nmembers)
stt%v => plasticState(ph)%state (12*prm%sum_N_sl + 1:16*prm%sum_N_sl,1:Nconstituents) stt%v => plasticState(ph)%state (12*prm%sum_N_sl + 1:16*prm%sum_N_sl,1:Nmembers)
stt%v_edg_pos => plasticState(ph)%state (12*prm%sum_N_sl + 1:13*prm%sum_N_sl,1:Nconstituents) stt%v_edg_pos => plasticState(ph)%state (12*prm%sum_N_sl + 1:13*prm%sum_N_sl,1:Nmembers)
stt%v_edg_neg => plasticState(ph)%state (13*prm%sum_N_sl + 1:14*prm%sum_N_sl,1:Nconstituents) stt%v_edg_neg => plasticState(ph)%state (13*prm%sum_N_sl + 1:14*prm%sum_N_sl,1:Nmembers)
stt%v_scr_pos => plasticState(ph)%state (14*prm%sum_N_sl + 1:15*prm%sum_N_sl,1:Nconstituents) stt%v_scr_pos => plasticState(ph)%state (14*prm%sum_N_sl + 1:15*prm%sum_N_sl,1:Nmembers)
stt%v_scr_neg => plasticState(ph)%state (15*prm%sum_N_sl + 1:16*prm%sum_N_sl,1:Nconstituents) stt%v_scr_neg => plasticState(ph)%state (15*prm%sum_N_sl + 1:16*prm%sum_N_sl,1:Nmembers)
allocate(dst%tau_pass(prm%sum_N_sl,Nconstituents),source=0.0_pReal) allocate(dst%tau_pass(prm%sum_N_sl,Nmembers),source=0.0_pReal)
allocate(dst%tau_back(prm%sum_N_sl,Nconstituents),source=0.0_pReal) allocate(dst%tau_back(prm%sum_N_sl,Nmembers),source=0.0_pReal)
end associate end associate
if (Nconstituents > 0) call stateInit(ini,ph,Nconstituents) if (Nmembers > 0) call stateInit(ini,ph,Nmembers)
plasticState(ph)%state0 = plasticState(ph)%state plasticState(ph)%state0 = plasticState(ph)%state
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -527,7 +527,7 @@ module function plastic_nonlocal_init() result(myPlasticity)
if(.not. myPlasticity(ph)) cycle if(.not. myPlasticity(ph)) cycle
phase => phases%get(ph) phase => phases%get(ph)
Nconstituents = count(material_phaseAt2 == ph) Nmembers = count(material_phaseAt2 == ph)
l = 0 l = 0
do t = 1,4 do t = 1,4
do s = 1,param(ph)%sum_N_sl do s = 1,param(ph)%sum_N_sl
@ -1406,7 +1406,7 @@ module subroutine plastic_nonlocal_updateCompatibility(orientation,ph,i,e)
me, & me, &
neighbor_e, & ! element index of my neighbor neighbor_e, & ! element index of my neighbor
neighbor_i, & ! integration point index of my neighbor neighbor_i, & ! integration point index of my neighbor
neighbor_me, & neighbor_me, &
neighbor_phase, & neighbor_phase, &
ns, & ! number of active slip systems ns, & ! number of active slip systems
s1, & ! slip system index (me) s1, & ! slip system index (me)
@ -1579,13 +1579,13 @@ end subroutine plastic_nonlocal_results
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief populates the initial dislocation density !> @brief populates the initial dislocation density
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine stateInit(ini,phase,Nconstituents) subroutine stateInit(ini,phase,Nmembers)
type(tInitialParameters) :: & type(tInitialParameters) :: &
ini ini
integer,intent(in) :: & integer,intent(in) :: &
phase, & phase, &
Nconstituents Nmembers
integer :: & integer :: &
i, & i, &
e, & e, &
@ -1602,7 +1602,7 @@ subroutine stateInit(ini,phase,Nconstituents)
totalVolume, & totalVolume, &
densityBinning, & densityBinning, &
minimumIpVolume minimumIpVolume
real(pReal), dimension(Nconstituents) :: & real(pReal), dimension(Nmembers) :: &
volume volume
@ -1622,13 +1622,13 @@ subroutine stateInit(ini,phase,Nconstituents)
meanDensity = 0.0_pReal meanDensity = 0.0_pReal
do while(meanDensity < ini%random_rho_u) do while(meanDensity < ini%random_rho_u)
call random_number(rnd) call random_number(rnd)
phasemember = nint(rnd(1)*real(Nconstituents,pReal) + 0.5_pReal) phasemember = nint(rnd(1)*real(Nmembers,pReal) + 0.5_pReal)
s = nint(rnd(2)*real(sum(ini%N_sl),pReal)*4.0_pReal + 0.5_pReal) s = nint(rnd(2)*real(sum(ini%N_sl),pReal)*4.0_pReal + 0.5_pReal)
meanDensity = meanDensity + densityBinning * volume(phasemember) / totalVolume meanDensity = meanDensity + densityBinning * volume(phasemember) / totalVolume
stt%rhoSglMobile(s,phasemember) = densityBinning stt%rhoSglMobile(s,phasemember) = densityBinning
enddo enddo
else ! homogeneous distribution with noise else ! homogeneous distribution with noise
do e = 1, Nconstituents do e = 1, Nmembers
do f = 1,size(ini%N_sl,1) do f = 1,size(ini%N_sl,1)
from = 1 + sum(ini%N_sl(1:f-1)) from = 1 + sum(ini%N_sl(1:f-1))
upto = sum(ini%N_sl(1:f)) upto = sum(ini%N_sl(1:f))
@ -1809,7 +1809,7 @@ pure function getRho0(ph,me)
getRho0(:,mob) = max(getRho0(:,mob),0.0_pReal) getRho0(:,mob) = max(getRho0(:,mob),0.0_pReal)
getRho0(:,dip) = max(getRho0(:,dip),0.0_pReal) getRho0(:,dip) = max(getRho0(:,dip),0.0_pReal)
where(abs(getRho0) < max(prm%rho_min/geom(ph)%V_0(me)**(2.0_pReal/3.0_pReal),prm%rho_significant)) & where (abs(getRho0) < max(prm%rho_min/geom(ph)%V_0(me)**(2.0_pReal/3.0_pReal),prm%rho_significant)) &
getRho0 = 0.0_pReal getRho0 = 0.0_pReal
end associate end associate
@ -1822,16 +1822,13 @@ subroutine storeGeometry(ph)
integer, intent(in) :: ph integer, intent(in) :: ph
integer :: ip, el, ce, co integer :: ip, el, ce, co
real(pReal), dimension(:), allocatable :: V
ce = 0
do el = 1, size(material_homogenizationMemberAt,2) V = reshape(IPvolume,[product(shape(IPvolume))])
do ip = 1, size(material_homogenizationMemberAt,1) do ce = 1, size(material_homogenizationMemberAt2,1)
ce = ce + 1 do co = 1, homogenization_maxNconstituents
do co = 1, homogenization_maxNconstituents if (material_phaseAt2(co,ce) == ph) geom(ph)%V_0(material_phaseMemberAt2(co,ce)) = V(ce)
if(material_phaseAt2(co,ce) == ph) then
geom(ph)%V_0(material_phaseMemberAt2(co,ce)) = IPvolume(ip,el)
endif
enddo
enddo enddo
enddo enddo

View File

@ -71,7 +71,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity)
logical, dimension(:), allocatable :: myPlasticity logical, dimension(:), allocatable :: myPlasticity
integer :: & integer :: &
ph, i, & ph, i, &
Nconstituents, & Nmembers, &
sizeState, sizeDotState, & sizeState, sizeDotState, &
startIndex, endIndex startIndex, endIndex
integer, dimension(:), allocatable :: & integer, dimension(:), allocatable :: &
@ -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
@ -223,20 +223,20 @@ module function plastic_phenopowerlaw_init() result(myPlasticity)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! allocate state arrays ! allocate state arrays
Nconstituents = count(material_phaseAt2 == ph) Nmembers = count(material_phaseAt2 == ph)
sizeDotState = size(['xi_sl ','gamma_sl']) * prm%sum_N_sl & sizeDotState = size(['xi_sl ','gamma_sl']) * prm%sum_N_sl &
+ size(['xi_tw ','gamma_tw']) * prm%sum_N_tw + size(['xi_tw ','gamma_tw']) * prm%sum_N_tw
sizeState = sizeDotState sizeState = sizeDotState
call phase_allocateState(plasticState(ph),Nconstituents,sizeState,sizeDotState,0) call phase_allocateState(plasticState(ph),Nmembers,sizeState,sizeDotState,0)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! state aliases and initialization ! state aliases and initialization
startIndex = 1 startIndex = 1
endIndex = prm%sum_N_sl endIndex = prm%sum_N_sl
stt%xi_slip => plasticState(ph)%state (startIndex:endIndex,:) stt%xi_slip => plasticState(ph)%state (startIndex:endIndex,:)
stt%xi_slip = spread(xi_0_sl, 2, Nconstituents) stt%xi_slip = spread(xi_0_sl, 2, Nmembers)
dot%xi_slip => plasticState(ph)%dotState(startIndex:endIndex,:) dot%xi_slip => plasticState(ph)%dotState(startIndex:endIndex,:)
plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal)
if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi' if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi'
@ -244,7 +244,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity)
startIndex = endIndex + 1 startIndex = endIndex + 1
endIndex = endIndex + prm%sum_N_tw endIndex = endIndex + prm%sum_N_tw
stt%xi_twin => plasticState(ph)%state (startIndex:endIndex,:) stt%xi_twin => plasticState(ph)%state (startIndex:endIndex,:)
stt%xi_twin = spread(xi_0_tw, 2, Nconstituents) stt%xi_twin = spread(xi_0_tw, 2, Nmembers)
dot%xi_twin => plasticState(ph)%dotState(startIndex:endIndex,:) dot%xi_twin => plasticState(ph)%dotState(startIndex:endIndex,:)
plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal) plasticState(ph)%atol(startIndex:endIndex) = pl%get_asFloat('atol_xi',defaultVal=1.0_pReal)
if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi' if(any(plasticState(ph)%atol(startIndex:endIndex) < 0.0_pReal)) extmsg = trim(extmsg)//' atol_xi'

View File

@ -15,13 +15,13 @@ submodule(phase) thermal
THERMAL_EXTERNALHEAT_ID THERMAL_EXTERNALHEAT_ID
end enum end enum
type :: tDataContainer type :: tDataContainer ! ?? not very telling name. Better: "fieldQuantities" ??
real(pReal), dimension(:), allocatable :: T, dot_T real(pReal), dimension(:), allocatable :: T, dot_T
end type tDataContainer end type tDataContainer
integer(kind(THERMAL_UNDEFINED_ID)), dimension(:,:), allocatable :: & integer(kind(THERMAL_UNDEFINED_ID)), dimension(:,:), allocatable :: &
thermal_source thermal_source
type(tDataContainer), dimension(:), allocatable :: current type(tDataContainer), dimension(:), allocatable :: current ! ?? not very telling name. Better: "field" ??
integer :: thermal_source_maxSizeDotState integer :: thermal_source_maxSizeDotState
@ -78,41 +78,36 @@ module subroutine thermal_init(phases)
integer :: & integer :: &
ph, so, & ph, so, &
Nconstituents Nmembers
print'(/,a)', ' <<<+- phase:thermal init -+>>>' print'(/,a)', ' <<<+- phase:thermal init -+>>>'
allocate(current(phases%length)) allocate(current(phases%length))
allocate(thermalState (phases%length)) allocate(thermalState(phases%length))
allocate(thermal_Nsources(phases%length),source = 0) allocate(thermal_Nsources(phases%length),source = 0)
do ph = 1, phases%length do ph = 1, phases%length
Nmembers = count(material_phaseAt2 == ph)
Nconstituents = count(material_phaseAt2 == ph) allocate(current(ph)%T(Nmembers),source=300.0_pReal)
allocate(current(ph)%dot_T(Nmembers),source=0.0_pReal)
allocate(current(ph)%T(Nconstituents),source=300.0_pReal)
allocate(current(ph)%dot_T(Nconstituents),source=0.0_pReal)
phase => phases%get(ph) phase => phases%get(ph)
if(phase%contains('thermal')) then thermal => phase%get('thermal',defaultVal=emptyDict)
thermal => phase%get('thermal') sources => thermal%get('source',defaultVal=emptyList)
sources => thermal%get('source',defaultVal=emptyList) thermal_Nsources(ph) = sources%length
thermal_Nsources(ph) = sources%length
endif
allocate(thermalstate(ph)%p(thermal_Nsources(ph))) allocate(thermalstate(ph)%p(thermal_Nsources(ph)))
enddo enddo
allocate(thermal_source(maxval(thermal_Nsources),phases%length), source = THERMAL_UNDEFINED_ID) allocate(thermal_source(maxval(thermal_Nsources),phases%length), source = THERMAL_UNDEFINED_ID)
if(maxval(thermal_Nsources) /= 0) then if (maxval(thermal_Nsources) /= 0) then
where(dissipation_init (maxval(thermal_Nsources))) thermal_source = THERMAL_DISSIPATION_ID where(dissipation_init (maxval(thermal_Nsources))) thermal_source = THERMAL_DISSIPATION_ID
where(externalheat_init(maxval(thermal_Nsources))) thermal_source = THERMAL_EXTERNALHEAT_ID where(externalheat_init(maxval(thermal_Nsources))) thermal_source = THERMAL_EXTERNALHEAT_ID
endif endif
thermal_source_maxSizeDotState = 0 thermal_source_maxSizeDotState = 0
PhaseLoop2:do ph = 1,phases%length do ph = 1,phases%length
do so = 1,thermal_Nsources(ph) do so = 1,thermal_Nsources(ph)
thermalState(ph)%p(so)%state = thermalState(ph)%p(so)%state0 thermalState(ph)%p(so)%state = thermalState(ph)%p(so)%state0
@ -120,7 +115,7 @@ module subroutine thermal_init(phases)
thermal_source_maxSizeDotState = max(thermal_source_maxSizeDotState, & thermal_source_maxSizeDotState = max(thermal_source_maxSizeDotState, &
maxval(thermalState(ph)%p%sizeDotState)) maxval(thermalState(ph)%p%sizeDotState))
enddo PhaseLoop2 enddo
end subroutine thermal_init end subroutine thermal_init
@ -145,18 +140,17 @@ module subroutine phase_thermal_getRate(TDot, ph,me)
do so = 1, thermal_Nsources(ph) do so = 1, thermal_Nsources(ph)
select case(thermal_source(so,ph)) select case(thermal_source(so,ph))
case (THERMAL_DISSIPATION_ID) case (THERMAL_DISSIPATION_ID)
call dissipation_getRate(my_Tdot, ph,me) call dissipation_getRate(my_Tdot, ph,me)
case (THERMAL_EXTERNALHEAT_ID) case (THERMAL_EXTERNALHEAT_ID)
call externalheat_getRate(my_Tdot, ph,me) call externalheat_getRate(my_Tdot, ph,me)
case default case default
my_Tdot = 0.0_pReal my_Tdot = 0.0_pReal
end select end select
Tdot = Tdot + my_Tdot Tdot = Tdot + my_Tdot
enddo enddo
end subroutine phase_thermal_getRate end subroutine phase_thermal_getRate
@ -185,7 +179,7 @@ function phase_thermal_collectDotState(ph,me) result(broken)
end function phase_thermal_collectDotState end function phase_thermal_collectDotState
module function thermal_stress(Delta_t,ph,me) result(converged_) module function thermal_stress(Delta_t,ph,me) result(converged_) ! ?? why is this called "stress" when it seems closer to "updateState" ??
real(pReal), intent(in) :: Delta_t real(pReal), intent(in) :: Delta_t
integer, intent(in) :: ph, me integer, intent(in) :: ph, me
@ -212,7 +206,7 @@ function integrateThermalState(Delta_t, ph,me) result(broken)
sizeDotState sizeDotState
broken = phase_thermal_collectDotState(ph,me) broken = phase_thermal_collectDotState(ph,me)
if(broken) return if (broken) return
do so = 1, thermal_Nsources(ph) do so = 1, thermal_Nsources(ph)
sizeDotState = thermalState(ph)%p(so)%sizeDotState sizeDotState = thermalState(ph)%p(so)%sizeDotState
@ -301,14 +295,12 @@ function thermal_active(source_label,src_length) result(active_source)
allocate(active_source(src_length,phases%length), source = .false. ) allocate(active_source(src_length,phases%length), source = .false. )
do p = 1, phases%length do p = 1, phases%length
phase => phases%get(p) phase => phases%get(p)
if (phase%contains('thermal')) then thermal => phase%get('thermal',defaultVal=emptyDict)
thermal => phase%get('thermal',defaultVal=emptyList) sources => thermal%get('source',defaultVal=emptyList)
sources => thermal%get('source',defaultVal=emptyList) do s = 1, sources%length
do s = 1, sources%length src => sources%get(s)
src => sources%get(s) active_source(s,p) = src%get_asString('type') == source_label
if(src%get_asString('type') == source_label) active_source(s,p) = .true. enddo
enddo
endif
enddo enddo

View File

@ -31,7 +31,7 @@ module function dissipation_init(source_length) result(mySources)
phase, & phase, &
sources, thermal, & sources, thermal, &
src src
integer :: so,Nconstituents,ph integer :: so,Nmembers,ph
mySources = thermal_active('dissipation',source_length) mySources = thermal_active('dissipation',source_length)
@ -54,8 +54,8 @@ module function dissipation_init(source_length) result(mySources)
src => sources%get(so) src => sources%get(so)
prm%kappa = src%get_asFloat('kappa') prm%kappa = src%get_asFloat('kappa')
Nconstituents = count(material_phaseAt2 == ph) Nmembers = count(material_phaseAt2 == ph)
call phase_allocateState(thermalState(ph)%p(so),Nconstituents,0,0,0) call phase_allocateState(thermalState(ph)%p(so),Nmembers,0,0,0)
end associate end associate
endif endif

View File

@ -38,7 +38,7 @@ module function externalheat_init(source_length) result(mySources)
phase, & phase, &
sources, thermal, & sources, thermal, &
src src
integer :: so,Nconstituents,ph integer :: so,Nmembers,ph
mySources = thermal_active('externalheat',source_length) mySources = thermal_active('externalheat',source_length)
@ -67,8 +67,8 @@ module function externalheat_init(source_length) result(mySources)
prm%f_T = src%get_asFloats('f_T',requiredSize = size(prm%t_n)) prm%f_T = src%get_asFloats('f_T',requiredSize = size(prm%t_n))
Nconstituents = count(material_phaseAt2 == ph) Nmembers = count(material_phaseAt2 == ph)
call phase_allocateState(thermalState(ph)%p(so),Nconstituents,1,1,0) call phase_allocateState(thermalState(ph)%p(so),Nmembers,1,1,0)
end associate end associate
endif endif
enddo enddo
@ -92,7 +92,7 @@ module subroutine externalheat_dotState(ph, me)
so = source_thermal_externalheat_offset(ph) so = source_thermal_externalheat_offset(ph)
thermalState(ph)%p(so)%dotState(1,me) = 1.0_pReal ! state is current time thermalState(ph)%p(so)%dotState(1,me) = 1.0_pReal ! state is current time
end subroutine externalheat_dotState end subroutine externalheat_dotState
@ -116,15 +116,15 @@ module subroutine externalheat_getRate(TDot, ph, me)
so = source_thermal_externalheat_offset(ph) so = source_thermal_externalheat_offset(ph)
associate(prm => param(ph)) associate(prm => param(ph))
do interval = 1, prm%nIntervals ! scan through all rate segments do interval = 1, prm%nIntervals ! scan through all rate segments
frac_time = (thermalState(ph)%p(so)%state(1,me) - prm%t_n(interval)) & frac_time = (thermalState(ph)%p(so)%state(1,me) - prm%t_n(interval)) &
/ (prm%t_n(interval+1) - prm%t_n(interval)) ! fractional time within segment / (prm%t_n(interval+1) - prm%t_n(interval)) ! fractional time within segment
if ( (frac_time < 0.0_pReal .and. interval == 1) & if ( (frac_time < 0.0_pReal .and. interval == 1) &
.or. (frac_time >= 1.0_pReal .and. interval == prm%nIntervals) & .or. (frac_time >= 1.0_pReal .and. interval == prm%nIntervals) &
.or. (frac_time >= 0.0_pReal .and. frac_time < 1.0_pReal) ) & .or. (frac_time >= 0.0_pReal .and. frac_time < 1.0_pReal) ) &
TDot = prm%f_T(interval ) * (1.0_pReal - frac_time) + & TDot = prm%f_T(interval ) * (1.0_pReal - frac_time) + &
prm%f_T(interval+1) * frac_time ! interpolate heat rate between segment boundaries... prm%f_T(interval+1) * frac_time ! interpolate heat rate between segment boundaries...
! ...or extrapolate if outside me bounds ! ...or extrapolate if outside me bounds
enddo enddo
end associate end associate

View File

@ -61,17 +61,18 @@ subroutine results_init(restart)
print'(/,a)', ' <<<+- results init -+>>>'; flush(IO_STDOUT) print'(/,a)', ' <<<+- results init -+>>>'; flush(IO_STDOUT)
print*, 'Diehl et al., Integrating Materials and Manufacturing Innovation 6(1):8391, 2017' print*, 'M. Diehl et al., Integrating Materials and Manufacturing Innovation 6(1):8391, 2017'
print*, 'https://doi.org/10.1007/s40192-017-0084-5'//IO_EOL print*, 'https://doi.org/10.1007/s40192-017-0084-5'//IO_EOL
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_addAttribute('description','mappings to place data in space','cell_to')
call results_closeJobFile call results_closeJobFile
endif endif
@ -105,12 +106,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 +136,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 +149,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 +162,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 +175,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 +188,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 +207,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 +226,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 +245,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 +264,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 +282,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 +290,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 +300,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 +320,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 +352,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
call HDF5_write(groupHandle,dataset_transposed,label)
else else
allocate(dataset_transposed,source=dataset) call HDF5_write(groupHandle,dataset,label)
endif endif
call executionStamp(group//'/'//label,description,SIunit)
groupHandle = results_openGroup(group)
call HDF5_write(groupHandle,dataset_transposed,label)
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_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 +380,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 +400,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 +432,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 +498,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 +534,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 +558,11 @@ 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)
call executionStamp('cell_to/phase','cell ID and constituent ID to phase results')
end subroutine results_mapping_phase end subroutine results_mapping_phase
@ -613,8 +589,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 +656,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 +692,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 +716,52 @@ 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'
call executionStamp('cell_to/homogenization','cell ID to homogenization results')
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

View File

@ -105,7 +105,7 @@ subroutine rotations_init
print'(/,a)', ' <<<+- rotations init -+>>>'; flush(IO_STDOUT) print'(/,a)', ' <<<+- rotations init -+>>>'; flush(IO_STDOUT)
print*, 'Rowenhorst et al., Modelling and Simulation in Materials Science and Engineering 23:083501, 2015' print*, 'D. Rowenhorst et al., Modelling and Simulation in Materials Science and Engineering 23:083501, 2015'
print*, 'https://doi.org/10.1088/0965-0393/23/8/083501' print*, 'https://doi.org/10.1088/0965-0393/23/8/083501'
call selfTest call selfTest