Skip to content

Commit 76e1b09

Browse files
committed
Adapt export of input file with exo meshes to new changes in 4C
1 parent 2e41a1a commit 76e1b09

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

src/cubitpy/cubit_to_fourc_input.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,16 @@ def add_exodus_geometry_section(cubit, input_file, rel_exo_file_path):
138138
"SHOW_INFO": "detailed_summary",
139139
"ELEMENT_BLOCKS": [],
140140
}
141-
# retrieve the fourc name for the element
141+
# retrieve the fourc name (e.g., SOLID/FLUID/...) and the cubit name
142+
# (e.g., HEX8/TET4/...) for the element
142143
four_c_element_name = cur_block_data[0].get_four_c_name()
143-
# convert the material data from dict to string because 4C currently does not support a dict here
144-
element_data_string = " ".join(
145-
f"{key} {value}" for key, value in cur_block_data[1].items()
146-
)
144+
_, cubit_element_name = cur_block_data[0].get_cubit_names()
147145
# add block id, fourc element name and element data string to the element block dictionary
148146
element_block_dict = {
149147
"ID": cur_block_id,
150-
"ELEMENT_NAME": four_c_element_name,
151-
"ELEMENT_DATA": element_data_string,
148+
"ELEMENT_DATA": {
149+
four_c_element_name: {cubit_element_name: cur_block_data[1]},
150+
},
152151
}
153152
# append the dictionary with the element block information to the element block list
154153
input_file[cur_geometry_section_key]["ELEMENT_BLOCKS"].append(

tests/input-files-ref/test_yaml_with_exo_export.4C.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ STRUCTURE GEOMETRY:
4747
SHOW_INFO: "detailed_summary"
4848
ELEMENT_BLOCKS:
4949
- ID: 1
50-
ELEMENT_NAME: "SOLID"
51-
ELEMENT_DATA: "MAT 1 KINEM nonlinear"
50+
ELEMENT_DATA:
51+
SOLID:
52+
HEX8:
53+
MAT: 1
54+
KINEM: nonlinear
5255
- ID: 2
53-
ELEMENT_NAME: "SOLID"
54-
ELEMENT_DATA: "MAT 2 KINEM nonlinear"
56+
ELEMENT_DATA:
57+
SOLID:
58+
HEX8:
59+
MAT: 2
60+
KINEM: nonlinear

tests/input-files-ref/test_yaml_with_exo_export_fsi.4C.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,19 @@ STRUCTURE GEOMETRY:
1010
SHOW_INFO: "detailed_summary"
1111
ELEMENT_BLOCKS:
1212
- ID: 1
13-
ELEMENT_NAME: "SOLID"
14-
ELEMENT_DATA: "MAT 1 KINEM nonlinear TECH eas_full"
13+
ELEMENT_DATA:
14+
SOLID:
15+
HEX8:
16+
MAT: 1
17+
KINEM: "nonlinear"
18+
TECH: "eas_full"
1519
FLUID GEOMETRY:
1620
FILE: "test_yaml_with_exo_export_fsi.exo"
1721
SHOW_INFO: "detailed_summary"
1822
ELEMENT_BLOCKS:
1923
- ID: 2
20-
ELEMENT_NAME: "FLUID"
21-
ELEMENT_DATA: "MAT 2 NA ALE"
24+
ELEMENT_DATA:
25+
FLUID:
26+
HEX8:
27+
MAT: 2
28+
NA: "ALE"

0 commit comments

Comments
 (0)