Skip to content
Merged
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
13 changes: 6 additions & 7 deletions src/cubitpy/cubit_to_fourc_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,16 @@ def add_exodus_geometry_section(cubit, input_file, rel_exo_file_path):
"SHOW_INFO": "detailed_summary",
"ELEMENT_BLOCKS": [],
}
# retrieve the fourc name for the element
# retrieve the fourc name (e.g., SOLID/FLUID/...) and the cubit name
# (e.g., HEX8/TET4/...) for the element
four_c_element_name = cur_block_data[0].get_four_c_name()
# convert the material data from dict to string because 4C currently does not support a dict here
element_data_string = " ".join(
f"{key} {value}" for key, value in cur_block_data[1].items()
)
_, cubit_element_name = cur_block_data[0].get_cubit_names()
# add block id, fourc element name and element data string to the element block dictionary
element_block_dict = {
"ID": cur_block_id,
"ELEMENT_NAME": four_c_element_name,
"ELEMENT_DATA": element_data_string,
"ELEMENT_DATA": {
four_c_element_name: {cubit_element_name: cur_block_data[1]},
},
}
# append the dictionary with the element block information to the element block list
input_file[cur_geometry_section_key]["ELEMENT_BLOCKS"].append(
Expand Down
14 changes: 10 additions & 4 deletions tests/input-files-ref/test_yaml_with_exo_export.4C.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,14 @@ STRUCTURE GEOMETRY:
SHOW_INFO: "detailed_summary"
ELEMENT_BLOCKS:
- ID: 1
ELEMENT_NAME: "SOLID"
ELEMENT_DATA: "MAT 1 KINEM nonlinear"
ELEMENT_DATA:
SOLID:
HEX8:
MAT: 1
KINEM: "nonlinear"
- ID: 27
ELEMENT_NAME: "SOLID"
ELEMENT_DATA: "MAT 2 KINEM nonlinear"
ELEMENT_DATA:
SOLID:
HEX8:
MAT: 2
KINEM: "nonlinear"
15 changes: 11 additions & 4 deletions tests/input-files-ref/test_yaml_with_exo_export_fsi.4C.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ STRUCTURE GEOMETRY:
SHOW_INFO: "detailed_summary"
ELEMENT_BLOCKS:
- ID: 1
ELEMENT_NAME: "SOLID"
ELEMENT_DATA: "MAT 1 KINEM nonlinear TECH eas_full"
ELEMENT_DATA:
SOLID:
HEX8:
MAT: 1
KINEM: "nonlinear"
TECH: "eas_full"
FLUID GEOMETRY:
FILE: "test_yaml_with_exo_export_fsi.exo"
SHOW_INFO: "detailed_summary"
ELEMENT_BLOCKS:
- ID: 2
ELEMENT_NAME: "FLUID"
ELEMENT_DATA: "MAT 2 NA ALE"
ELEMENT_DATA:
FLUID:
HEX8:
MAT: 2
NA: "ALE"