Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ This is a list tracking which workflows/tasks we have reimplemented/tested in th
| ⇒ method: [add_buffer_zones/damask](https://github.com/LightForm-group/UoM-CSF-matflow/blob/569fa7bdc7006d04bd6ed2d4e4b6a114df23492e/task_schemas.yml#L760) | ✅ | [modify_VE/add_buffer_zones](https://docs.matflow.io/stable/reference/template_components/task_schemas.html#modify-ve-add-buffer-zones) |
| ⇒ method: [new_orientations/damask](https://github.com/LightForm-group/UoM-CSF-matflow/blob/569fa7bdc7006d04bd6ed2d4e4b6a114df23492e/task_schemas.yml#L770) | ❌ | Unimplemented |
| ⇒ method: [geometry](https://github.com/LightForm-group/UoM-CSF-matflow/blob/569fa7bdc7006d04bd6ed2d4e4b6a114df23492e/task_schemas.yml#L775) | ❌ | Unimplemented |
| ⇒ method: [spread_orientations/damask](https://github.com/LightForm-group/UoM-CSF-matflow/blob/569fa7bdc7006d04bd6ed2d4e4b6a114df23492e/task_schemas.yml#L780) | | Unimplemented |
| ⇒ method: [spread_orientations/damask](https://github.com/LightForm-group/UoM-CSF-matflow/blob/569fa7bdc7006d04bd6ed2d4e4b6a114df23492e/task_schemas.yml#L780) | | [modify_VE/spread_orientations](https://docs.matflow.io/stable/reference/template_components/task_schemas.html#modify-ve-spread-orientations) |
| ⇒ method: [grid_size/damask](https://github.com/LightForm-group/UoM-CSF-matflow/blob/569fa7bdc7006d04bd6ed2d4e4b6a114df23492e/task_schemas.yml#L786) | ✅ | [modify_VE/grid_size](https://docs.matflow.io/stable/reference/template_components/task_schemas.html#modify-ve-grid-size) |
| **generate_load_case** | | |
| ⇒ method: [mixed/formable](https://github.com/LightForm-group/UoM-CSF-matflow/blob/569fa7bdc7006d04bd6ed2d4e4b6a114df23492e/task_schemas.yml#L912) | ✅ | [define_load_case](https://docs.matflow.io/stable/reference/template_components/task_schemas.html#define-load-case) / [LoadCase](https://docs.matflow.io/stable/reference/template_components/parameters.html#load-case) |
Expand Down
25 changes: 25 additions & 0 deletions matflow/data/scripts/damask/modify_VE_spread_orientations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from damask_parse.utils import spread_orientations


def modify_VE_spread_orientations(volume_element, phases, stddev_degrees):
# need to convert Zarr arrays to numpy arrays first:
VE = volume_element
ori_copy = VE["orientations"]
ori_copy["quaternions"] = ori_copy["quaternions"][:]
VE_copy = {
"size": VE["size"],
"grid_size": VE["grid_size"][:],
"orientations": ori_copy,
"element_material_idx": VE["element_material_idx"][:],
"constituent_material_idx": VE["constituent_material_idx"][:],
"constituent_material_fraction": VE["constituent_material_fraction"][:],
"constituent_phase_label": VE["constituent_phase_label"][:],
"constituent_orientation_idx": VE["constituent_orientation_idx"][:],
"material_homog": VE["material_homog"][:],
}
VE = spread_orientations(
volume_element=VE_copy, phase_names=phases, sigmas=stddev_degrees
)
VE["grid_size"] = tuple(int(i) for i in VE["grid_size"])
VE["size"] = tuple(float(i) for i in VE["size"])
return {"volume_element": VE}
18 changes: 18 additions & 0 deletions matflow/data/template_components/task_schemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1067,3 +1067,21 @@
script_data_in: direct
script_data_out: direct
script_exe: python_script

- objective: modify_VE
method: spread_orientations
inputs:
- parameter: volume_element
- parameter: phases
- parameter: stddev_degrees
outputs:
- parameter: volume_element
actions:
- environments:
- scope:
type: any
environment: damask_parse_env
script: <<script:damask/modify_VE_spread_orientations.py>>
script_data_in: direct
script_data_out: direct
script_exe: python_script
31 changes: 31 additions & 0 deletions matflow/data/workflows/spread_orientations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
doc:
- >
Demonstration of modifying a volume element by applying a perturbation to its orientations.

tasks:
- schema: generate_volume_element_from_voronoi
inputs:
homog_label: SX
VE_grid_size: [8, 8, 8]
microstructure_seeds::from_random:
num_seeds: 4
box_size: [1, 1, 1]
phase_label: Al
orientations:
data:
- [1, 0, 0, 0]
- [1, 0, 0, 0]
- [1, 0, 0, 0]
- [1, 0, 0, 0]
unit_cell_alignment:
x: a
y: b
z: c
representation:
type: quaternion
quat_order: scalar_vector

- schema: modify_VE_spread_orientations # underscore to separate the levels of the task schema objective/method
inputs:
phases: [Al]
stddev_degrees: [0.01]