Skip to content

Commit fb698f0

Browse files
committed
Adapt export of input file with exo meshes to new changes in 4C
1 parent 3153988 commit fb698f0

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

src/cubitpy/cubit_to_fourc_input.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,16 @@ def add_exodus_geometry_section(cubit, input_file, rel_exo_file_path):
141141
"SHOW_INFO": "detailed_summary",
142142
"ELEMENT_BLOCKS": [],
143143
}
144-
# retrieve the fourc name for the element
144+
# retrieve the fourc name (e.g., SOLID/FLUID/...) and the cubit name
145+
# (e.g., HEX8/TET4/...) for the element
145146
four_c_element_name = cur_block_data[0].get_four_c_name()
146-
# convert the material data from dict to string because 4C currently does not support a dict here
147-
element_data_string = " ".join(
148-
f"{key} {value}" for key, value in cur_block_data[1].items()
149-
)
147+
_, cubit_element_name = cur_block_data[0].get_cubit_names()
150148
# add block id, fourc element name and element data string to the element block dictionary
151149
element_block_dict = {
152150
"ID": cur_block_id,
153-
"ELEMENT_NAME": four_c_element_name,
154-
"ELEMENT_DATA": element_data_string,
151+
"ELEMENT_DATA": {
152+
four_c_element_name: {cubit_element_name: cur_block_data[1]},
153+
},
155154
}
156155
# append the dictionary with the element block information to the element block list
157156
input_file[cur_geometry_section_key]["ELEMENT_BLOCKS"].append(

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,14 @@ STRUCTURE GEOMETRY:
9393
SHOW_INFO: "detailed_summary"
9494
ELEMENT_BLOCKS:
9595
- ID: 1
96-
ELEMENT_NAME: "SOLID"
97-
ELEMENT_DATA: "MAT 1 KINEM nonlinear"
98-
- ID: 27
99-
ELEMENT_NAME: "SOLID"
100-
ELEMENT_DATA: "MAT 2 KINEM nonlinear"
96+
ELEMENT_DATA:
97+
SOLID:
98+
HEX8:
99+
MAT: 1
100+
KINEM: nonlinear
101+
- ID: 2
102+
ELEMENT_DATA:
103+
SOLID:
104+
HEX8:
105+
MAT: 2
106+
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)