Demo workflows#
These workflow templates are included in MatFlow as demonstrations. You can copy a demo workflow template to somewhere accessible using the CLI like this:
matflow demo-workflow copy WORKFLOW_NAME DESTINATION
where WORKFLOW_NAME is the name of one of the demo workflows, and DESTINATION is the
target copy location, which can be a directory (e.g. "." for the current
working directory, or a full file path).
In the Python API, we can copy a demo workflow template file like this:
import matflow as mf
mf.copy_demo_workflow(name, dst)
sample_texture_ODF_mat#
Demonstration of a task to sample texture from an MTEX ODF object stored in a binary .mat file, and produce pole figures of the sampled orientations.
sample_texture_ODF_mat.yaml
tasks:
- schema: sample_texture_from_ODF_mat_file_mtex
inputs:
ODF_mat_file_path: <<demo_data_file:ODF.mat>>
num_orientations: 1000
compile: false
- schema: visualise_orientations_pole_figure_mtex
inputs:
crystal_symmetry: cubic
pole_figure_directions:
- [0, 0, 1]
- [1, 0, 1]
- [1, 1, 1]
use_contours: false
compile: false
damask_input_files#
Demonstration of passing DAMASK input files (load case file, geometry file, and material file) directly to the simulate_VE_loading_damask task. Input parameters that are used to generate these input files need not be passed.
damask_input_files.yaml
tasks:
- schema: simulate_VE_loading_damask
input_files:
damask_load_file: <<demo_data_file:load.yaml>>
damask_geom_file: <<demo_data_file:geom.vti>>
damask_material_file: <<demo_data_file:material.yaml>>
inputs:
damask_post_processing:
- name: add_stress_Cauchy
args: {P: P, F: F}
opts: {add_Mises: true}
- name: add_strain
args: {F: F, t: V, m: 0}
opts: {add_Mises: true}
- name: add_strain
args: {F: F_p, t: V, m: 0}
opts: {add_Mises: true}
- name: add_IPF_color
args: {l: [0, 0, 1]}
VE_response_data:
phase_data:
- field_name: sigma_vM
phase_name: Al
out_name: vol_avg_equivalent_stress
transforms: [mean_along_axes: 1]
- field_name: epsilon_V^0(F)_vM
phase_name: Al
out_name: vol_avg_equivalent_strain
transforms: [mean_along_axes: 1]
- field_name: epsilon_V^0(F_p)_vM
phase_name: Al
out_name: vol_avg_equivalent_plastic_strain
transforms: [mean_along_axes: 1]
field_data:
- field_name: phase
- field_name: O
grain_data:
- field_name: O
increments: [values: [0, -1]]
damask_viz:
fields: [F, F_p, P, sigma_vM, epsilon_V^0(F_p)_vM, IPFcolor_(0 0 1), phase]
increments:
- step: 20
read_tensile_test_CSV#
Read tensile test data from a CSV file.
read_tensile_test_CSV.yaml
tasks:
- schema: read_tensile_test_from_CSV
inputs:
CSV_file_path: <<demo_data_file:surfalex_tensile_test.csv>>
CSV_arguments:
delimiter: ','
skip_rows: 0
header_row: 1
eng_strain_col_index: 0
eng_stress_col_index: 1
stress_units: MPa
fit_single_crystal_parameters#
Fit single crystal parameters using an experimental uniaxial tension stress-strain curve and an iterative Levenberg-Marquardt fitting process.
fit_single_crystal_parameters.yaml
loops:
- num_iterations: 2
tasks: [3, 4]
tasks:
- schema: generate_microstructure_seeds_from_random
inputs:
VE_size: [1, 1, 1]
num_grains: 2000
phase_label: Al
- schema: generate_volume_element_from_voronoi
inputs:
homog_label: SX
VE_grid_size: [32, 32, 32]
- schema: read_tensile_test_from_CSV
inputs:
CSV_file_path: <<demo_data_file:surfalex_tensile_test.csv>>
CSV_arguments:
delimiter: ','
skip_rows: 0
header_row: 1
eng_strain_col_index: 0
eng_stress_col_index: 1
stress_units: MPa
- schema: simulate_VE_loading_damask
inputs:
load_case::uniaxial:
total_time: 3500
num_increments: 170
direction: x
target_def_grad_rate: 1.0e-4
dump_frequency: 1
homogenization:
SX:
mechanical: {type: pass}
N_constituents: 1
single_crystal_parameters:
phases:
Al:
h_0_sl-sl: 400e6
xi_0_sl: [30e6]
xi_inf_sl: [95e6]
damask_phases:
Al:
lattice: cF
mechanical:
output: [F, P, F_p]
elastic:
type: Hooke
C_11: 106750000000
C_12: 60410000000
C_44: 28340000000
plastic:
type: phenopowerlaw
single_crystal_parameters: Al
N_sl: [12]
a_sl: 2.25
atol_xi: 1
dot_gamma_0_sl: 0.001
h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20
output: [xi_sl]
damask_post_processing:
- name: add_stress_Cauchy
args: {P: P, F: F}
opts: {add_Mises: true}
- name: add_strain
args: {F: F, t: U, m: 0}
opts: {add_Mises: true}
VE_response_data:
volume_data:
- out_name: vol_avg_stress
field_name: sigma
transforms: [mean_along_axes: 1]
- out_name: vol_avg_strain
field_name: epsilon_U^0(F)
transforms: [mean_along_axes: 1]
sequences:
- path: inputs.single_crystal_parameters.perturbations
values:
-
- multiplicative: 1.05
path: [Al, h_0_sl-sl]
- multiplicative: 1.05
path: [Al, xi_0_sl, 0]
- multiplicative: 1.05
path: [Al, xi_inf_sl, 0]
groups:
- name: fit_single_crystal_parameters
- schema: fit_single_crystal_parameters
inputs:
initial_damping: [2.0, 1.0, 0.5]
sample_texture_CTF_file#
Demonstration of a task to sample texture from a CTF file using MTEX, and produce pole figures of the sampled orientations.
sample_texture_CTF_file.yaml
tasks:
- schema: sample_texture_from_CTF_file_mtex
inputs:
CTF_file_path: <<demo_data_file:texture_Al.ctf>>
EBSD_reference_frame_transformation: convertEuler2SpatialReferenceFrame
specimen_symmetry: cubic
EBSD_phase: Al
EBSD_rotation:
num_orientations: 1000
compile: false
- schema: visualise_orientations_pole_figure_mtex
inputs:
crystal_symmetry: cubic
pole_figure_directions:
- [0, 0, 1]
- [1, 0, 1]
- [1, 1, 1]
use_contours: false
compile: false
sample_texture_model_ODF#
Demonstration of a task to sample texture from a model orientation distribution function (ODF) using MTEX, and produce pole figures of the sampled orientations.
sample_texture_model_ODF.yaml
tasks:
- schema: sample_texture_from_model_ODF_mtex
inputs:
crystal_symmetry: hexagonal
specimen_symmetry: orthorhombic
num_orientations: 1000
ODF_components:
- type: unimodal
component_fraction: 0.4 # component fractions must sum to 1!
modal_orientation_HKL: [0, 0, 1]
modal_orientation_UVW: [1, 0, 0]
halfwidth: 15
- type: unimodal
component_fraction: 0.3 # component fractions must sum to 1!
modal_orientation_euler: [0, 0, 10] # in Bunge/degrees/MTEX hex alignment (y//b)
halfwidth: 5
- type: uniform
component_fraction: 0.3 # component fractions must sum to 1!
compile: false
- schema: visualise_orientations_pole_figure_mtex
inputs:
crystal_symmetry: hexagonal
pole_figure_directions:
- [0, 0, 0, 1]
- [1, 0, -1, 0]
- [1, 1, -2, 0]
use_contours: true
compile: false
tension_DAMASK_Al#
A simple crystal plasticity simulation using DAMASK. A volume element generated from a random voronoi tessellation is loaded uniaxially, using aluminium (Al) material parameters.
tension_DAMASK_Al.yaml
tasks:
- schema: generate_microstructure_seeds_from_random
inputs:
VE_size: [1, 1, 1]
num_grains: 4
phase_label: Al
- schema: generate_volume_element_from_voronoi
inputs:
homog_label: SX
VE_grid_size: [8, 8, 8]
- schema: simulate_VE_loading_damask
inputs:
load_case::uniaxial:
total_time: 100
num_increments: 200
direction: x
target_def_grad_rate: 1.0e-3
dump_frequency: 1
homogenization:
SX:
mechanical: {type: pass}
N_constituents: 1
damask_phases:
Al:
lattice: cF
mechanical:
output: [F, P, F_e, F_p, L_p, O]
elastic:
type: Hooke
C_11: 106750000000
C_12: 60410000000
C_44: 28340000000
plastic:
type: phenopowerlaw
N_sl: [12]
a_sl: 2.25
atol_xi: 1
dot_gamma_0_sl: 0.001
h_0_sl-sl: 75.0e+6
h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20
output: [xi_sl]
xi_0_sl: [31.0e+6]
xi_inf_sl: [63.0e+6]
damask_post_processing:
- name: add_stress_Cauchy
args: {P: P, F: F}
opts: {add_Mises: true}
- name: add_strain
args: {F: F, t: V, m: 0}
opts: {add_Mises: true}
- name: add_strain
args: {F: F_p, t: V, m: 0}
opts: {add_Mises: true}
- name: add_IPF_color
args: {l: [0, 0, 1]}
VE_response_data:
phase_data:
- field_name: sigma_vM
phase_name: Al
out_name: vol_avg_equivalent_stress
transforms: [mean_along_axes: 1]
- field_name: epsilon_V^0(F)_vM
phase_name: Al
out_name: vol_avg_equivalent_strain
transforms: [mean_along_axes: 1]
- field_name: epsilon_V^0(F_p)_vM
phase_name: Al
out_name: vol_avg_equivalent_plastic_strain
transforms: [mean_along_axes: 1]
field_data:
- field_name: phase
- field_name: O
grain_data:
- field_name: O
increments: [values: [0, -1]]
damask_viz:
fields: [F, F_p, P, sigma_vM, epsilon_V^0(F_p)_vM, IPFcolor_(0 0 1), phase]
increments:
- step: 20
tension_DAMASK_Mg#
A simple crystal plasticity simulation using DAMASK. A volume element generated from a random voronoi tessellation is loaded uniaxially, using magnesium (Mg) material parameters.
tension_DAMASK_Mg.yaml
tasks:
- schema: generate_microstructure_seeds_from_random
inputs:
VE_size: [1, 1, 1]
num_grains: 4
phase_label: Mg
- schema: generate_volume_element_from_voronoi
inputs:
homog_label: SX
VE_grid_size: [8, 8, 8]
- schema: simulate_VE_loading_damask
inputs:
load_case::uniaxial:
total_time: 100
num_increments: 1000
direction: x
target_def_grad_rate: 1.0e-3
dump_frequency: 5
homogenization:
SX:
mechanical: {type: pass}
N_constituents: 1
damask_phases:
Mg:
lattice: hP
c/a: 1.62350 # from Tromans 2011, Elastic Anisotropy of HCP Metal Crystals and Polycrystals
rho: 1740.0
mechanical:
output: [F, P, F_e, F_p, L_p, O]
elastic:
type: Hooke
C_11: 59.3e9
C_12: 25.7e9
C_13: 21.4e9
C_33: 61.5e9
C_44: 16.4e9
plastic:
type: phenopowerlaw
references:
- F. Wang et al., Acta Materialia 80:77-93, 2014, https://doi.org/10.1016/j.actamat.2014.07.048
output: [xi_sl, xi_tw]
N_sl: [3, 3, 6, 0, 6] # basal, prism, 1. pyr<a>, -, 2. pyr<c+a>
N_tw: [6, 0, 6] # tension, -, compression
xi_0_sl: [10.e+6, 55.e+6, 60.e+6, 0., 60.e+6]
xi_inf_sl: [40.e+6, 135.e+6, 150.e+6, 0., 150.e+6]
xi_0_tw: [40.e+6, 0., 60.e+6]
a_sl: 2.25
dot_gamma_0_sl: 0.001
dot_gamma_0_tw: 0.001
n_sl: 20
n_tw: 20
f_sat_sl-tw: 10.0
h_0_sl-sl: 500.0e+6
h_0_tw-tw: 50.0e+6
h_0_tw-sl: 150.0e+6
h_sl-sl: [+1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, +1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0,
-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0,
-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0,
1.0, +1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, -1.0,
-1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0] # unused entries are indicated by -1.0
h_tw-tw: [+1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0,
1.0] # unused entries are indicated by -1.0
h_tw-sl: [1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0,
-1.0, -1.0, -1.0, -1.0, -1.0, +1.0, -1.0, 1.0, -1.0] # unused entries are indicated by -1.0
h_sl-tw: [1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0,
-1.0, -1.0, -1.0, -1.0, -1.0, +1.0, -1.0, 1.0] # unused entries are indicated by -1.0
damask_post_processing:
- name: add_stress_Cauchy
args: {P: P, F: F}
opts: {add_Mises: true}
- name: add_strain
args: {F: F, t: V, m: 0}
opts: {add_Mises: true}
- name: add_strain
args: {F: F_p, t: V, m: 0}
opts: {add_Mises: true}
- name: add_IPF_color
args: {l: [0, 0, 1]}
VE_response_data:
phase_data:
- field_name: sigma_vM
phase_name: Mg
out_name: vol_avg_equivalent_stress
transforms: [mean_along_axes: 1]
- field_name: epsilon_V^0(F)_vM
phase_name: Mg
out_name: vol_avg_equivalent_strain
transforms: [mean_along_axes: 1]
- field_name: epsilon_V^0(F_p)_vM
phase_name: Mg
out_name: vol_avg_equivalent_plastic_strain
transforms: [mean_along_axes: 1]
field_data:
- field_name: phase
- field_name: O
grain_data:
- field_name: O
increments: [values: [0, -1]]
damask_viz:
fields: [F, F_p, P, sigma_vM, epsilon_V^0(F_p)_vM, IPFcolor_(0 0 1), phase]
increments:
- step: 100
fit_yield_funcs#
A workflow to fit yield functions to crystal plasticity simulations.
fit_yield_funcs.yaml
tasks:
- schema: generate_volume_element_from_voronoi
inputs:
homog_label: SX
VE_grid_size: [8, 8, 8]
orientations::from_random:
number: 4
microstructure_seeds::from_random:
box_size: [1, 1, 1]
num_seeds: 4
phase_label: Al
- schema: define_load_case
element_sets:
- inputs:
load_case::uniaxial:
total_time: 100
num_increments: 200
direction: x
target_def_grad_rate: 1.0e-3
- inputs:
load_case::random_3D:
total_time: 100
num_increments: 200
target_def_grad: 1.0e-1
groups:
- name: multiaxial_load_cases
repeats: 6
- schema: simulate_VE_loading_damask
inputs:
homogenization:
SX:
mechanical: {type: pass}
N_constituents: 1
damask_phases:
Al:
lattice: cF
mechanical:
output: [F, P, F_e, F_p, L_p, O]
elastic:
type: Hooke
C_11: 106750000000
C_12: 60410000000
C_44: 28340000000
plastic:
type: phenopowerlaw
N_sl: [12]
a_sl: 2.25
atol_xi: 1
dot_gamma_0_sl: 0.001
h_0_sl-sl: 75.0e+6
h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20
output: [xi_sl]
xi_0_sl: [31.0e+6]
xi_inf_sl: [63.0e+6]
damask_post_processing:
- name: add_stress_Cauchy
args: {P: P, F: F}
opts: {}
- name: add_strain
args: {F: F_p, t: U, m: 0}
opts: {}
VE_response_data:
volume_data:
- out_name: vol_avg_stress
field_name: sigma
transforms: [mean_along_axes: 1]
- out_name: vol_avg_plastic_strain
field_name: epsilon_U^0(F_p)
transforms: [mean_along_axes: 1]
- schema: fit_yield_function
inputs:
yield_function_name: Hill1948
yield_point_criteria:
threshold: equivalent_plastic_strain
values: [2.0e-3, 1.0e-2]
input_sources:
VE_response[uniaxial]:
- source_type: task
task_ref: simulate_VE_loading_damask
where:
path: inputs.load_case.type
condition:
value.equal_to: uniaxial
VE_response[multiaxial]:
- source_type: task
task_ref: simulate_VE_loading_damask
where:
path: inputs.load_case.type
condition:
value.equal_to: random_3D
simulate_yield_surface_2D_brass#
WIP: This workflow uses DAMASK full-field crystal plasticity simulations to generate a yield surface for an aluminium material with the Brass texture.
simulate_yield_surface_2D_brass.yaml
tasks:
- schema: sample_texture_from_model_ODF_mtex
inputs:
crystal_symmetry: hexagonal
specimen_symmetry: orthorhombic
num_orientations: 1024
ODF_components:
- type: unimodal
component_fraction: 1.0
modal_orientation_HKL: [1, 1, 0]
modal_orientation_UVW: [1, -1, 2]
halfwidth: 5
compile: false
- schema: generate_microstructure_seeds_from_random
inputs:
VE_size: [1, 1, 1]
num_grains: 1024
phase_label: Al
- schema: generate_volume_element_from_voronoi
inputs:
homog_label: SX
VE_grid_size: [64, 64, 64]
- schema: visualise_volume_element_VTK
- schema: define_load_case
inputs:
load_case:
steps:
- total_time: 100
num_increments: 500
target_def_grad_rate:
- [0.0, 0.0, x]
- [0.0, 0.0, x]
- [0.0, 0.0, x]
stress:
- [x, x, 0.0]
- [x, x, 0.0]
- [x, x, 0.0]
dump_frequency: 1
sequences:
- path: inputs.load_case.steps.0.target_def_grad_rate.0.0
values::from_rectangle:
start: [-0.0002, -0.0002]
stop: [+0.0002, +0.0002]
num: [17, 17]
include: [top, right]
coord: 0
- path: inputs.load_case.steps.0.target_def_grad_rate.1.1
values::from_rectangle:
start: [-0.0002, -0.0002]
stop: [+0.0002, +0.0002]
num: [17, 17]
include: [top, right]
coord: 1
- schema: simulate_VE_loading_damask
inputs:
homogenization:
SX:
mechanical: {type: pass}
N_constituents: 1
damask_phases:
Al:
lattice: cF
mechanical:
output: [F, P, F_e, F_p, L_p, O]
elastic:
type: Hooke
C_11: 107.3e+9
C_12: 60.9e+9
C_44: 28.3e+9
plastic:
type: phenopowerlaw
N_sl: [12]
a_sl: 1.499
atol_xi: 1
dot_gamma_0_sl: 0.001
h_0_sl-sl: 912.2e+6 # come from 60C results
h_sl-sl: [1, 1, 1.4, 1.4, 1.4, 1.4, 1.4]
n_sl: 20
output: [xi_sl]
xi_0_sl: [138.2e+6]
xi_inf_sl: [300.9e+6]
damask_post_processing:
- name: add_stress_Cauchy
args: {P: P, F: F}
- name: add_strain
args: {F: F_p, t: U, m: 1}
VE_response_data:
phase_data:
- field_name: sigma
phase_name: Al
out_name: vol_avg_stress
transforms: [mean_along_axes: 1]
- field_name: epsilon_U^1(F_p)
phase_name: Al
out_name: vol_avg_plastic_strain
transforms: [mean_along_axes: 1]