Merge branch 'polishing' into 'development'

Polishing

See merge request damask/DAMASK!401
This commit is contained in:
Sharan Roongta 2021-06-20 10:46:47 +00:00
commit df5f9822f0
64 changed files with 95 additions and 116 deletions

View File

@ -87,7 +87,6 @@ checkout:
- git checkout $CI_COMMIT_SHA - git checkout $CI_COMMIT_SHA
- git submodule update --init - git submodule update --init
- source env/DAMASK.sh - source env/DAMASK.sh
- ./installation/symlink_Processing.py
except: except:
- master - master
- release - release

@ -1 +1 @@
Subproject commit 6363147d0a8bb45e681c5dc39041828a6b34664e Subproject commit 023f86ff9e603dcc8c7adc16545783653083ea83

View File

@ -16,8 +16,8 @@ phase:
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
h_0_sl_sl: 75e6 h_0_sl-sl: 75e6
h_sl_sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
output: [xi_sl] output: [xi_sl]
xi_0_sl: [31e6] xi_0_sl: [31e6]

View File

@ -19,7 +19,7 @@ TWIP_Steel_FeMnC:
D_0: 4.0e-5 # Vacancy diffusion prefactor / m^2/s D_0: 4.0e-5 # Vacancy diffusion prefactor / m^2/s
D_a: 1.0 # minimum dipole distance / b D_a: 1.0 # minimum dipole distance / b
Q_cl: 4.5e-19 # Activation energy for climb / J Q_cl: 4.5e-19 # Activation energy for climb / J
h_sl_sl: [0.122, 0.122, 0.625, 0.07, 0.137, 0.137, 0.122] # Interaction coefficients (Kubin et al. 2008) h_sl-sl: [0.122, 0.122, 0.625, 0.07, 0.137, 0.137, 0.122] # Interaction coefficients (Kubin et al. 2008)
# shear band parameters # shear band parameters
xi_sb: 180.0e6 xi_sb: 180.0e6
Q_sb: 3.7e-19 Q_sb: 3.7e-19
@ -35,7 +35,7 @@ TWIP_Steel_FeMnC:
V_cs: 1.67e-29 # cross slip volume / m^3 V_cs: 1.67e-29 # cross slip volume / m^3
p_tw: [10.0] # r-exponent in twin formation probability p_tw: [10.0] # r-exponent in twin formation probability
i_tw: 1.0 # Adj. parameter controlling twin mean free path i_tw: 1.0 # Adj. parameter controlling twin mean free path
h_sl_tw: [0.0, 1.0, 1.0] # dislocation-twin interaction coefficients h_sl-tw: [0.0, 1.0, 1.0] # dislocation-twin interaction coefficients
h_tw_tw: [0.0, 1.0] # twin-twin interaction coefficients h_tw-tw: [0.0, 1.0] # twin-twin interaction coefficients
Gamma_sf_0K: -0.0396 # stacking fault energy / J/m^2 at zero K; TWIP steel: -0.0526; Cu: -0.0396 Gamma_sf_0K: -0.0396 # stacking fault energy / J/m^2 at zero K; TWIP steel: -0.0526; Cu: -0.0396
dGamma_sf_dT: 0.0002 # temperature dependence / J/(m^2 K) of stacking fault energy dGamma_sf_dT: 0.0002 # temperature dependence / J/(m^2 K) of stacking fault energy

View File

@ -18,4 +18,4 @@ Tungsten:
D_0: 4.0e-5 # Vacancy diffusion prefactor / m^2/s D_0: 4.0e-5 # Vacancy diffusion prefactor / m^2/s
D_a: 1.0 # minimum dipole distance / b D_a: 1.0 # minimum dipole distance / b
Q_cl: 4.5e-19 # Activation energy for climb / J Q_cl: 4.5e-19 # Activation energy for climb / J
h_sl_sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4]

View File

@ -7,8 +7,8 @@ Aluminum:
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
h_0_sl_sl: 75e6 h_0_sl-sl: 75e6
h_sl_sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
output: [xi_sl, gamma_sl] output: [xi_sl, gamma_sl]
type: phenopowerlaw type: phenopowerlaw

View File

@ -9,8 +9,8 @@ Ferrite:
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
h_0_sl_sl: 1000.0e6 h_0_sl-sl: 1000.0e6
h_sl_sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
type: phenopowerlaw type: phenopowerlaw
xi_0_sl: [95.e6, 96.e6] xi_0_sl: [95.e6, 96.e6]

View File

@ -9,8 +9,8 @@ Martensite:
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
h_0_sl_sl: 563.0e9 h_0_sl-sl: 563.0e9
h_sl_sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
type: phenopowerlaw type: phenopowerlaw
xi_0_sl: [405.8e6, 456.7e6] xi_0_sl: [405.8e6, 456.7e6]

View File

@ -8,13 +8,13 @@ Magnesium:
plastic: 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
h_0_sl_sl: 500.0e6 h_0_sl-sl: 500.0e6
h_0_tw_sl: 150.0e6 h_0_tw-sl: 150.0e6
h_sl_sl: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] h_sl-sl: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
h_tw_tw: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] h_tw-tw: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
h_sl_tw: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] h_sl-tw: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
h_tw_sl: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] h_tw-sl: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
output: [xi_sl, xi_tw] output: [xi_sl, xi_tw]
type: phenopowerlaw type: phenopowerlaw
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]
@ -25,4 +25,4 @@ Magnesium:
dot_gamma_0_tw: 0.001 dot_gamma_0_tw: 0.001
n_sl: 20 n_sl: 20
n_tw: 20 n_tw: 20
f_sat_sl_tw: 10.0 f_sat_sl-tw: 10.0

View File

@ -11,8 +11,8 @@ cpTi:
N_sl: [3, 3, 0, 6, 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
h_sl_sl: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] h_sl-sl: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
n_sl: 20 n_sl: 20
output: [gamma_sl] output: [gamma_sl]
type: phenopowerlaw type: phenopowerlaw

View File

@ -18,7 +18,7 @@ q_sl: [1.55, 1.55]
i_sl: [23.3, 23.3] i_sl: [23.3, 23.3]
D_a: 7.4 # C_anni D_a: 7.4 # C_anni
B: [0.001, 0.001] B: [0.001, 0.001]
h_sl_sl: [0.1, 0.72, 0.1, 0.053, 0.053, 0.073, 0.137, 0.72, 0.72, 0.053, 0.053, 0.053, 0.053, 0.073, 0.073, 0.073, 0.073, 0.073, 0.073, 0.137, 0.073, 0.073, 0.137, 0.073] h_sl-sl: [0.1, 0.72, 0.1, 0.053, 0.053, 0.073, 0.137, 0.72, 0.72, 0.053, 0.053, 0.053, 0.053, 0.073, 0.073, 0.073, 0.073, 0.073, 0.073, 0.137, 0.073, 0.073, 0.137, 0.073]
D_0: 4.000E-05 D_0: 4.000E-05
Q_cl: 5.400E-19 # no recovery! Q_cl: 5.400E-19 # no recovery!
D: 40e-6 # estimated D: 40e-6 # estimated

View File

@ -10,8 +10,8 @@ output: [xi_sl, gamma_sl]
N_sl: [12] N_sl: [12]
n_sl: 83.3 n_sl: 83.3
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
h_0_sl_sl: 75.0e6 h_0_sl-sl: 75.0e6
h_sl_sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
a_sl: 1.0 a_sl: 1.0
xi_0_sl: [26.25e6] xi_0_sl: [26.25e6]
xi_inf_sl: [53.0e6] xi_inf_sl: [53.0e6]

View File

@ -16,8 +16,8 @@ phase:
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
h_0_sl_sl: 75e6 h_0_sl-sl: 75e6
h_sl_sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
output: [xi_sl] output: [xi_sl]
xi_0_sl: [31e6] xi_0_sl: [31e6]

View File

@ -15,8 +15,8 @@ phase:
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
h_0_sl_sl: 75e6 h_0_sl-sl: 75e6
h_sl_sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
output: [xi_sl] output: [xi_sl]
xi_0_sl: [31e6] xi_0_sl: [31e6]

View File

@ -1,28 +0,0 @@
#!/usr/bin/env python3
# Makes postprocessing routines accessible from everywhere.
import sys
from pathlib import Path
import os
bin_dir = Path(os.environ['DAMASK_ROOT'])/'bin'
if not bin_dir.exists():
bin_dir.mkdir()
sys.stdout.write('\nsymbolic linking...\n')
for sub_dir in ['pre','post']:
the_dir = Path(os.environ['DAMASK_ROOT'])/'processing'/sub_dir
for the_file in the_dir.glob('*.py'):
src = the_dir/the_file
dst = bin_dir/Path(the_file.with_suffix('').name)
if dst.is_file(): dst.unlink() # dst.unlink(True) for Python >3.8
dst.symlink_to(src)
sys.stdout.write('\npruning broken links...\n')
for filename in bin_dir.glob('*'):
if not filename.is_file():
filename.unlink()

View File

@ -108,6 +108,10 @@ class ConfigMaterial(Config):
and grain- or cell-wise data. Defaults to None, in which case and grain- or cell-wise data. Defaults to None, in which case
it is set as the path that contains _SIMPL_GEOMETRY/SPACING. it is set as the path that contains _SIMPL_GEOMETRY/SPACING.
Notes
-----
Homogenization and phase entries are emtpy and need to be defined separately.
Returns Returns
------- -------
loaded : damask.ConfigMaterial loaded : damask.ConfigMaterial

View File

@ -31,14 +31,15 @@ class Grid:
Parameters Parameters
---------- ----------
material : numpy.ndarray material : numpy.ndarray of shape (:,:,:)
Material index array (3D). Material indices. The shape of the material array defines
size : list or numpy.ndarray the number of cells.
Physical size of the grid in meter. size : list or numpy.ndarray of shape (3)
origin : list or numpy.ndarray, optional Physical size of grid in meter.
Physical origin of the grid in meter. origin : list or numpy.ndarray of shape (3), optional
Coordinates of grid origin in meter.
comments : list of str, optional comments : list of str, optional
Comment lines. Comments, e.g. history of operations.
""" """
self.material = material self.material = material

View File

@ -78,7 +78,7 @@ class Result:
>>> r = damask.Result('my_file.hdf5') >>> r = damask.Result('my_file.hdf5')
>>> r.add_Cauchy() >>> r.add_Cauchy()
>>> r.add_equivalent_Mises('sigma') >>> r.add_equivalent_Mises('sigma')
>>> r.save_VTK() >>> r.export_VTK()
>>> r_last = r.view('increments',-1) >>> r_last = r.view('increments',-1)
>>> sigma_vM_last = r_last.get('sigma_vM') >>> sigma_vM_last = r_last.get('sigma_vM')
@ -1377,13 +1377,13 @@ class Result:
pool.join() pool.join()
def save_XDMF(self,output='*'): def export_XDMF(self,output='*'):
""" """
Write XDMF file to directly visualize data in DADF5 file. Write XDMF file to directly visualize data in DADF5 file.
The XDMF format is only supported for structured grids The XDMF format is only supported for structured grids
with single phase and single constituent. with single phase and single constituent.
For other cases use `save_VTK`. For other cases use `export_VTK`.
Parameters Parameters
---------- ----------
@ -1511,7 +1511,7 @@ class Result:
return at_cell_ph,in_data_ph,at_cell_ho,in_data_ho return at_cell_ph,in_data_ph,at_cell_ho,in_data_ho
def save_VTK(self,output='*',mode='cell',constituents=None,fill_float=np.nan,fill_int=0,parallel=True): def export_VTK(self,output='*',mode='cell',constituents=None,fill_float=np.nan,fill_int=0,parallel=True):
""" """
Export to VTK cell/point data. Export to VTK cell/point data.
@ -1549,7 +1549,7 @@ class Result:
else: else:
raise ValueError(f'invalid mode {mode}') raise ValueError(f'invalid mode {mode}')
v.set_comments(util.execution_stamp('Result','save_VTK')) v.set_comments(util.execution_stamp('Result','export_VTK'))
N_digits = int(np.floor(np.log10(max(1,int(self.increments[-1][10:])))))+1 N_digits = int(np.floor(np.log10(max(1,int(self.increments[-1][10:])))))+1
@ -1732,3 +1732,6 @@ class Result:
if flatten: r = util.dict_flatten(r) if flatten: r = util.dict_flatten(r)
return None if (type(r) == dict and r == {}) else r return None if (type(r) == dict and r == {}) else r
save_VTK = export_VTK
save_XDMF = export_XDMF

View File

@ -588,9 +588,11 @@ class _ProgressBar:
fraction = (iteration+1) / self.total fraction = (iteration+1) / self.total
filled_length = int(self.bar_length * fraction) filled_length = int(self.bar_length * fraction)
if filled_length > int(self.bar_length * self.last_fraction): delta_time = datetime.datetime.now() - self.start_time
if filled_length > int(self.bar_length * self.last_fraction) or \
delta_time > datetime.timedelta(minutes=1):
bar = '' * filled_length + '' * (self.bar_length - filled_length) bar = '' * filled_length + '' * (self.bar_length - filled_length)
delta_time = datetime.datetime.now() - self.start_time
remaining_time = (self.total - (iteration+1)) * delta_time / (iteration+1) remaining_time = (self.total - (iteration+1)) * delta_time / (iteration+1)
remaining_time -= datetime.timedelta(microseconds=remaining_time.microseconds) # remove μs remaining_time -= datetime.timedelta(microseconds=remaining_time.microseconds) # remove μs
sys.stderr.write(f'\r{self.prefix} {bar} {fraction:>4.0%} ETA {remaining_time}') sys.stderr.write(f'\r{self.prefix} {bar} {fraction:>4.0%} ETA {remaining_time}')

View File

@ -15,8 +15,8 @@ phase:
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
h_0_sl_sl: 75e6 h_0_sl-sl: 75e6
h_sl_sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
output: [xi_sl] output: [xi_sl]
type: phenopowerlaw type: phenopowerlaw
@ -32,8 +32,8 @@ phase:
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
h_0_sl_sl: 75e6 h_0_sl-sl: 75e6
h_sl_sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
output: [xi_sl] output: [xi_sl]
type: phenopowerlaw type: phenopowerlaw

View File

@ -647,8 +647,8 @@ phase:
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
h_0_sl_sl: 75e6 h_0_sl-sl: 75e6
h_sl_sl: [1, 1, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
output: [xi_sl] output: [xi_sl]
type: phenopowerlaw type: phenopowerlaw
@ -664,8 +664,8 @@ phase:
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
h_0_sl_sl: 75e6 h_0_sl-sl: 75e6
h_sl_sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1.4, 1, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
output: [xi_sl] output: [xi_sl]
type: phenopowerlaw type: phenopowerlaw

View File

@ -15,8 +15,8 @@ phase:
a_sl: 2.25 a_sl: 2.25
atol_xi: 1.0 atol_xi: 1.0
dot_gamma_0_sl: 0.001 dot_gamma_0_sl: 0.001
h_0_sl_sl: 75e6 h_0_sl-sl: 75e6
h_sl_sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4] h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20 n_sl: 20
output: [xi_sl] output: [xi_sl]
type: phenopowerlaw type: phenopowerlaw

View File

@ -0,0 +1 @@
d5db0be324a959f00245e42704ea2d6f

View File

@ -0,0 +1 @@
fe9ddaf54ac1fb785094251d29fcdc9c

View File

@ -0,0 +1 @@
9c8ac0bb1eb4a7b9ebc3e5fd5840b0a4

View File

@ -0,0 +1 @@
1b9ebd17c5257e2edba48d006f25d4e6

View File

@ -0,0 +1 @@
8967bb1a6c329a072baaa83da534ae56

View File

@ -0,0 +1 @@
752e8b6186ad2b6b1b5c781940669cb1

View File

@ -1 +0,0 @@
6d4da1188f1de0a80142692e9e135aed

View File

@ -1 +0,0 @@
5926c1f393871ee942750069545798a7

View File

@ -1 +0,0 @@
743c9a868d54b78ee0648613249a0bdc

View File

@ -1 +0,0 @@
09f5a7a6dd7a8e7d30e47aec07f7f616

View File

@ -1 +0,0 @@
5715cfc5fc21c6d04590354f0941cf7b

View File

@ -1 +0,0 @@
2f7b43ea8fe65173f47acb8281f0a919

View File

@ -369,7 +369,7 @@ class TestResult:
def test_vtk(self,request,tmp_path,ref_path,update,patch_execution_stamp,patch_datetime_now,output,fname,inc): def test_vtk(self,request,tmp_path,ref_path,update,patch_execution_stamp,patch_datetime_now,output,fname,inc):
result = Result(ref_path/fname).view('increments',inc) result = Result(ref_path/fname).view('increments',inc)
os.chdir(tmp_path) os.chdir(tmp_path)
result.save_VTK(output) result.export_VTK(output)
fname = fname.split('.')[0]+f'_inc{(inc if type(inc) == int else inc[0]):0>2}.vti' fname = fname.split('.')[0]+f'_inc{(inc if type(inc) == int else inc[0]):0>2}.vti'
last = '' last = ''
for i in range(10): for i in range(10):
@ -382,9 +382,9 @@ class TestResult:
last = cur last = cur
time.sleep(.5) time.sleep(.5)
if update: if update:
with open((ref_path/'save_VTK'/request.node.name).with_suffix('.md5'),'w') as f: with open((ref_path/'export_VTK'/request.node.name).with_suffix('.md5'),'w') as f:
f.write(cur) f.write(cur)
with open((ref_path/'save_VTK'/request.node.name).with_suffix('.md5')) as f: with open((ref_path/'export_VTK'/request.node.name).with_suffix('.md5')) as f:
assert cur == f.read() assert cur == f.read()
@pytest.mark.parametrize('mode',['point','cell']) @pytest.mark.parametrize('mode',['point','cell'])
@ -392,7 +392,7 @@ class TestResult:
def test_vtk_marc(self,tmp_path,ref_path,mode,output): def test_vtk_marc(self,tmp_path,ref_path,mode,output):
os.chdir(tmp_path) os.chdir(tmp_path)
result = Result(ref_path/'check_compile_job1.hdf5') result = Result(ref_path/'check_compile_job1.hdf5')
result.save_VTK(output,mode) result.export_VTK(output,mode)
def test_marc_coordinates(self,ref_path): def test_marc_coordinates(self,ref_path):
result = Result(ref_path/'check_compile_job1.hdf5').view('increments',-1) result = Result(ref_path/'check_compile_job1.hdf5').view('increments',-1)
@ -403,7 +403,7 @@ class TestResult:
@pytest.mark.parametrize('mode',['point','cell']) @pytest.mark.parametrize('mode',['point','cell'])
def test_vtk_mode(self,tmp_path,single_phase,mode): def test_vtk_mode(self,tmp_path,single_phase,mode):
os.chdir(tmp_path) os.chdir(tmp_path)
single_phase.save_VTK(mode=mode) single_phase.export_VTK(mode=mode)
def test_XDMF_datatypes(self,tmp_path,single_phase,update,ref_path): def test_XDMF_datatypes(self,tmp_path,single_phase,update,ref_path):
for shape in [('scalar',()),('vector',(3,)),('tensor',(3,3)),('matrix',(12,))]: for shape in [('scalar',()),('vector',(3,)),('tensor',(3,3)),('matrix',(12,))]:
@ -411,9 +411,7 @@ class TestResult:
single_phase.add_calculation(f"np.ones(np.shape(#F#)[0:1]+{shape[1]},'{dtype}')",f'{shape[0]}_{dtype}') single_phase.add_calculation(f"np.ones(np.shape(#F#)[0:1]+{shape[1]},'{dtype}')",f'{shape[0]}_{dtype}')
fname = os.path.splitext(os.path.basename(single_phase.fname))[0]+'.xdmf' fname = os.path.splitext(os.path.basename(single_phase.fname))[0]+'.xdmf'
os.chdir(tmp_path) os.chdir(tmp_path)
single_phase.export_XDMF()
single_phase.save_XDMF()
if update: if update:
shutil.copy(tmp_path/fname,ref_path/fname) shutil.copy(tmp_path/fname,ref_path/fname)
@ -423,7 +421,7 @@ class TestResult:
def test_XDMF_shape(self,tmp_path,single_phase): def test_XDMF_shape(self,tmp_path,single_phase):
os.chdir(tmp_path) os.chdir(tmp_path)
single_phase.save_XDMF() single_phase.export_XDMF()
fname = os.path.splitext(os.path.basename(single_phase.fname))[0]+'.xdmf' fname = os.path.splitext(os.path.basename(single_phase.fname))[0]+'.xdmf'
reader_xdmf = vtk.vtkXdmfReader() reader_xdmf = vtk.vtkXdmfReader()
reader_xdmf.SetFileName(fname) reader_xdmf.SetFileName(fname)
@ -431,7 +429,7 @@ class TestResult:
dim_xdmf = reader_xdmf.GetOutput().GetDimensions() dim_xdmf = reader_xdmf.GetOutput().GetDimensions()
bounds_xdmf = reader_xdmf.GetOutput().GetBounds() bounds_xdmf = reader_xdmf.GetOutput().GetBounds()
single_phase.view('increments',0).save_VTK() single_phase.view('increments',0).export_VTK()
fname = os.path.splitext(os.path.basename(single_phase.fname))[0]+'_inc00.vti' fname = os.path.splitext(os.path.basename(single_phase.fname))[0]+'_inc00.vti'
for i in range(10): # waiting for parallel IO for i in range(10): # waiting for parallel IO
reader_vti = vtk.vtkXMLImageDataReader() reader_vti = vtk.vtkXMLImageDataReader()
@ -447,7 +445,7 @@ class TestResult:
def test_XDMF_invalid(self,default): def test_XDMF_invalid(self,default):
with pytest.raises(TypeError): with pytest.raises(TypeError):
default.save_XDMF() default.export_XDMF()
@pytest.mark.parametrize('view,output,flatten,prune', @pytest.mark.parametrize('view,output,flatten,prune',
[({},['F','P','F','L_p','F_e','F_p'],True,True), [({},['F','P','F','L_p','F_e','F_p'],True,True),

View File

@ -149,7 +149,7 @@ module function plastic_dislotungsten_init() result(myPlasticity)
prm%nonSchmid_neg = prm%P_sl prm%nonSchmid_neg = prm%P_sl
endif endif
prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_as1dFloat('h_sl_sl'), & prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_as1dFloat('h_sl-sl'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
prm%forestProjection = lattice_forestProjection_edge(N_sl,phase%get_asString('lattice'),& prm%forestProjection = lattice_forestProjection_edge(N_sl,phase%get_asString('lattice'),&
phase%get_asFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))

View File

@ -194,7 +194,7 @@ module function plastic_dislotwin_init() result(myPlasticity)
slipActive: if (prm%sum_N_sl > 0) then slipActive: if (prm%sum_N_sl > 0) then
prm%P_sl = lattice_SchmidMatrix_slip(N_sl,phase%get_asString('lattice'),& prm%P_sl = lattice_SchmidMatrix_slip(N_sl,phase%get_asString('lattice'),&
phase%get_asFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_as1dFloat('h_sl_sl'), & prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl,pl%get_as1dFloat('h_sl-sl'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
prm%forestProjection = lattice_forestProjection_edge(N_sl,phase%get_asString('lattice'),& prm%forestProjection = lattice_forestProjection_edge(N_sl,phase%get_asString('lattice'),&
phase%get_asFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
@ -271,7 +271,7 @@ module function plastic_dislotwin_init() result(myPlasticity)
prm%P_tw = lattice_SchmidMatrix_twin(N_tw,phase%get_asString('lattice'),& prm%P_tw = lattice_SchmidMatrix_twin(N_tw,phase%get_asString('lattice'),&
phase%get_asFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%h_tw_tw = lattice_interaction_TwinByTwin(N_tw,& prm%h_tw_tw = lattice_interaction_TwinByTwin(N_tw,&
pl%get_as1dFloat('h_tw_tw'), & pl%get_as1dFloat('h_tw-tw'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
prm%b_tw = pl%get_as1dFloat('b_tw', requiredSize=size(N_tw)) prm%b_tw = pl%get_as1dFloat('b_tw', requiredSize=size(N_tw))
@ -327,7 +327,7 @@ module function plastic_dislotwin_init() result(myPlasticity)
prm%x_c_tr = pl%get_asFloat('x_c_tr', defaultVal=0.0_pReal) ! ToDo: How to handle that??? prm%x_c_tr = pl%get_asFloat('x_c_tr', defaultVal=0.0_pReal) ! ToDo: How to handle that???
prm%L_tr = pl%get_asFloat('L_tr') prm%L_tr = pl%get_asFloat('L_tr')
prm%h_tr_tr = lattice_interaction_TransByTrans(N_tr,pl%get_as1dFloat('h_tr_tr'), & prm%h_tr_tr = lattice_interaction_TransByTrans(N_tr,pl%get_as1dFloat('h_tr-tr'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
prm%C66_tr = lattice_C66_trans(N_tr,prm%C66,pl%get_asString('lattice_tr'), & prm%C66_tr = lattice_C66_trans(N_tr,prm%C66,pl%get_asString('lattice_tr'), &
@ -392,14 +392,14 @@ module function plastic_dislotwin_init() result(myPlasticity)
slipAndTwinActive: if (prm%sum_N_sl * prm%sum_N_tw > 0) then slipAndTwinActive: if (prm%sum_N_sl * prm%sum_N_tw > 0) then
prm%h_sl_tw = lattice_interaction_SlipByTwin(N_sl,N_tw,& prm%h_sl_tw = lattice_interaction_SlipByTwin(N_sl,N_tw,&
pl%get_as1dFloat('h_sl_tw'), & pl%get_as1dFloat('h_sl-tw'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
if (prm%fccTwinTransNucleation .and. size(N_tw) /= 1) extmsg = trim(extmsg)//' interaction_sliptwin' if (prm%fccTwinTransNucleation .and. size(N_tw) /= 1) extmsg = trim(extmsg)//' interaction_sliptwin'
endif slipAndTwinActive endif slipAndTwinActive
slipAndTransActive: if (prm%sum_N_sl * prm%sum_N_tr > 0) then slipAndTransActive: if (prm%sum_N_sl * prm%sum_N_tr > 0) then
prm%h_sl_tr = lattice_interaction_SlipByTrans(N_sl,N_tr,& prm%h_sl_tr = lattice_interaction_SlipByTrans(N_sl,N_tr,&
pl%get_as1dFloat('h_sl_tr'), & pl%get_as1dFloat('h_sl-tr'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
if (prm%fccTwinTransNucleation .and. size(N_tr) /= 1) extmsg = trim(extmsg)//' interaction_sliptrans' if (prm%fccTwinTransNucleation .and. size(N_tr) /= 1) extmsg = trim(extmsg)//' interaction_sliptrans'
endif slipAndTransActive endif slipAndTransActive

View File

@ -125,7 +125,7 @@ module function plastic_kinehardening_init() result(myPlasticity)
prm%nonSchmid_neg = prm%P prm%nonSchmid_neg = prm%P
endif endif
prm%interaction_SlipSlip = lattice_interaction_SlipBySlip(N_sl, & prm%interaction_SlipSlip = lattice_interaction_SlipBySlip(N_sl, &
pl%get_as1dFloat('h_sl_sl'), & pl%get_as1dFloat('h_sl-sl'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
xi_0 = pl%get_as1dFloat('xi_0', requiredSize=size(N_sl)) xi_0 = pl%get_as1dFloat('xi_0', requiredSize=size(N_sl))

View File

@ -261,7 +261,7 @@ module function plastic_nonlocal_init() result(myPlasticity)
endif endif
prm%h_sl_sl = lattice_interaction_SlipBySlip(ini%N_sl, & prm%h_sl_sl = lattice_interaction_SlipBySlip(ini%N_sl, &
pl%get_as1dFloat('h_sl_sl'), & pl%get_as1dFloat('h_sl-sl'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
prm%forestProjection_edge = lattice_forestProjection_edge (ini%N_sl,phase%get_asString('lattice'),& prm%forestProjection_edge = lattice_forestProjection_edge (ini%N_sl,phase%get_asString('lattice'),&

View File

@ -128,7 +128,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity)
prm%nonSchmid_neg = prm%P_sl prm%nonSchmid_neg = prm%P_sl
endif endif
prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl, & prm%h_sl_sl = lattice_interaction_SlipBySlip(N_sl, &
pl%get_as1dFloat('h_sl_sl'), & pl%get_as1dFloat('h_sl-sl'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
xi_0_sl = pl%get_as1dFloat('xi_0_sl', requiredSize=size(N_sl)) xi_0_sl = pl%get_as1dFloat('xi_0_sl', requiredSize=size(N_sl))
@ -139,7 +139,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity)
prm%dot_gamma_0_sl = pl%get_asFloat('dot_gamma_0_sl') prm%dot_gamma_0_sl = pl%get_asFloat('dot_gamma_0_sl')
prm%n_sl = pl%get_asFloat('n_sl') prm%n_sl = pl%get_asFloat('n_sl')
prm%a_sl = pl%get_asFloat('a_sl') prm%a_sl = pl%get_asFloat('a_sl')
prm%h_0_sl_sl = pl%get_asFloat('h_0_sl_sl') prm%h_0_sl_sl = pl%get_asFloat('h_0_sl-sl')
! expand: family => system ! expand: family => system
xi_0_sl = math_expand(xi_0_sl, N_sl) xi_0_sl = math_expand(xi_0_sl, N_sl)
@ -167,7 +167,7 @@ module function plastic_phenopowerlaw_init() result(myPlasticity)
prm%P_tw = lattice_SchmidMatrix_twin(N_tw,phase%get_asString('lattice'),& prm%P_tw = lattice_SchmidMatrix_twin(N_tw,phase%get_asString('lattice'),&
phase%get_asFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
prm%h_tw_tw = lattice_interaction_TwinByTwin(N_tw,& prm%h_tw_tw = lattice_interaction_TwinByTwin(N_tw,&
pl%get_as1dFloat('h_tw_tw'), & pl%get_as1dFloat('h_tw-tw'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
prm%gamma_char = lattice_characteristicShear_twin(N_tw,phase%get_asString('lattice'),& prm%gamma_char = lattice_characteristicShear_twin(N_tw,phase%get_asString('lattice'),&
phase%get_asFloat('c/a',defaultVal=0.0_pReal)) phase%get_asFloat('c/a',defaultVal=0.0_pReal))
@ -180,8 +180,8 @@ module function plastic_phenopowerlaw_init() result(myPlasticity)
prm%c_4 = pl%get_asFloat('c_4',defaultVal=0.0_pReal) prm%c_4 = pl%get_asFloat('c_4',defaultVal=0.0_pReal)
prm%dot_gamma_0_tw = pl%get_asFloat('dot_gamma_0_tw') prm%dot_gamma_0_tw = pl%get_asFloat('dot_gamma_0_tw')
prm%n_tw = pl%get_asFloat('n_tw') prm%n_tw = pl%get_asFloat('n_tw')
prm%f_sat_sl_tw = pl%get_asFloat('f_sat_sl_tw') prm%f_sat_sl_tw = pl%get_asFloat('f_sat_sl-tw')
prm%h_0_tw_tw = pl%get_asFloat('h_0_tw_tw') prm%h_0_tw_tw = pl%get_asFloat('h_0_tw-tw')
! expand: family => system ! expand: family => system
xi_0_tw = math_expand(xi_0_tw,N_tw) xi_0_tw = math_expand(xi_0_tw,N_tw)
@ -199,12 +199,12 @@ module function plastic_phenopowerlaw_init() result(myPlasticity)
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
! slip-twin related parameters ! slip-twin related parameters
slipAndTwinActive: if (prm%sum_N_sl > 0 .and. prm%sum_N_tw > 0) then slipAndTwinActive: if (prm%sum_N_sl > 0 .and. prm%sum_N_tw > 0) then
prm%h_0_tw_sl = pl%get_asFloat('h_0_tw_sl') prm%h_0_tw_sl = pl%get_asFloat('h_0_tw-sl')
prm%h_sl_tw = lattice_interaction_SlipByTwin(N_sl,N_tw,& prm%h_sl_tw = lattice_interaction_SlipByTwin(N_sl,N_tw,&
pl%get_as1dFloat('h_sl_tw'), & pl%get_as1dFloat('h_sl-tw'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
prm%h_tw_sl = lattice_interaction_TwinBySlip(N_tw,N_sl,& prm%h_tw_sl = lattice_interaction_TwinBySlip(N_tw,N_sl,&
pl%get_as1dFloat('h_tw_sl'), & pl%get_as1dFloat('h_tw-sl'), &
phase%get_asString('lattice')) phase%get_asString('lattice'))
else slipAndTwinActive else slipAndTwinActive
allocate(prm%h_sl_tw(prm%sum_N_sl,prm%sum_N_tw)) ! at least one dimension is 0 allocate(prm%h_sl_tw(prm%sum_N_sl,prm%sum_N_tw)) ! at least one dimension is 0