Skip to content

Commit 722b214

Browse files
authored
Merge pull request #665 from sebproell/mesh-input-all-fields
Enable direct exodus mesh input for all physical fields
2 parents 2180aae + 42f1d08 commit 722b214

File tree

7 files changed

+176
-26
lines changed

7 files changed

+176
-26
lines changed

src/core/fem/src/general/element/4C_fem_general_element.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void Core::Elements::Element::set_node_ids(const int nnode, const int* nodes)
198198

199199
/*----------------------------------------------------------------------*/
200200
/*----------------------------------------------------------------------*/
201-
void Core::Elements::Element::set_node_ids(
201+
void Core::Elements::Element::set_node_ids_one_based_index(
202202
const std::string& distype, const Core::IO::InputParameterContainer& container)
203203
{
204204
nodeid_ = container.get<std::vector<int>>(distype);

src/core/fem/src/general/element/4C_fem_general_element.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -721,12 +721,11 @@ might become invalid after a redistribution of the discretization.
721721
*/
722722
void set_node_ids(const int nnode, const int* nodes);
723723

724-
/*!
725-
\brief Set a list of node ids this element is connected to
726-
727-
Here the node ids are directly taken from an input line.
728-
*/
729-
void set_node_ids(
724+
/**
725+
* Set the list of node ids this element is connected to. Here, the index
726+
* starts at 1, not 0. This is used for the legacy element input.
727+
*/
728+
void set_node_ids_one_based_index(
730729
const std::string& distype, const Core::IO::InputParameterContainer& container);
731730

732731
/*!

src/core/io/src/4C_io_elementreader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void Core::IO::ElementReader::get_and_distribute_elements(const int nblock, cons
176176
Core::IO::InputParameterContainer data;
177177
linedef.fully_parse(element_parser, data);
178178

179-
ele->set_node_ids(distype, data);
179+
ele->set_node_ids_one_based_index(distype, data);
180180
ele->read_element(eletype, distype, data);
181181

182182
// add element to discretization

src/inpar/4C_inpar_validparameters.cpp

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,24 +142,37 @@ std::map<std::string, Core::IO::InputSpec> Input::valid_parameters()
142142
.default_value = -1})},
143143
{.defaultable = true});
144144

145-
specs["STRUCTURE GEOMETRY"] = group("STRUCTURE GEOMETRY",
146-
{
147-
parameter<std::filesystem::path>(
148-
"FILE", {.description = "Path to the exodus geometry file. Either absolute or "
149-
"relative to the input file."}),
150-
// Once we support more format, we should add a "TYPE" parameter for the file format.
151-
list("ELEMENT_BLOCKS",
152-
all_of({
153-
parameter<int>(
154-
"ID", {.description = "ID of the element block in the exodus file."}),
155-
parameter<std::string>("ELEMENT_NAME",
156-
{.description =
157-
"The name of the element that should be assigned to the block."}),
158-
parameter<std::string>("ELEMENT_DATA",
159-
{.description = "A dat-style string of parameters for the element."}),
160-
})),
161-
},
162-
{.required = false});
145+
const auto add_geometry_section = [](auto& specs, const std::string& field_identifier)
146+
{
147+
specs[field_identifier + " GEOMETRY"] = group(field_identifier + " GEOMETRY",
148+
{
149+
parameter<std::filesystem::path>(
150+
"FILE", {.description = "Path to the exodus geometry file. Either absolute or "
151+
"relative to the input file."}),
152+
// Once we support more format, we should add a "TYPE" parameter for the file format.
153+
list("ELEMENT_BLOCKS",
154+
all_of({
155+
parameter<int>(
156+
"ID", {.description = "ID of the element block in the exodus file."}),
157+
parameter<std::string>("ELEMENT_NAME",
158+
{.description =
159+
"The name of the element that should be assigned to the block."}),
160+
parameter<std::string>("ELEMENT_DATA",
161+
{.description = "A dat-style string of parameters for the element."}),
162+
})),
163+
},
164+
{.description = "Settings related to the geometry of discretization " + field_identifier,
165+
.required = false});
166+
};
167+
168+
const std::vector known_fields = {"STRUCTURE", "FLUID", "LUBRICATION", "TRANSPORT", "TRANSPORT2",
169+
"ALE", "ARTERY", "REDUCED D AIRWAYS", "THERMO", "PERIODIC BOUNDINGBOX"};
170+
for (const auto& field : known_fields)
171+
{
172+
add_geometry_section(specs, field);
173+
}
174+
175+
163176

164177
Inpar::Solid::set_valid_parameters(specs);
165178
Inpar::IO::set_valid_parameters(specs);
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
TITLE:
2+
- "This is a modified version of a fluid tutorial that directly reads exodus files."
3+
PROBLEM SIZE:
4+
DIM: 2
5+
PROBLEM TYPE:
6+
PROBLEMTYPE: "Fluid"
7+
FLUID DYNAMIC:
8+
LINEAR_SOLVER: 1
9+
PREDICTOR: "explicit_second_order_midpoint"
10+
NUMSTEP: 10
11+
RESTARTEVERY: 1
12+
FLUID DYNAMIC/RESIDUAL-BASED STABILIZATION:
13+
CHARELELENGTH_PC: "root_of_volume"
14+
SOLVER 1:
15+
SOLVER: "UMFPACK"
16+
MATERIALS:
17+
- MAT: 1
18+
MAT_fluid:
19+
DYNVISCOSITY: 0.004
20+
DENSITY: 1
21+
FUNCT1:
22+
- SYMBOLIC_FUNCTION_OF_SPACE_TIME: "0.5*(sin((t*pi/0.1)-(pi/2)))+0.5"
23+
24+
FLUID GEOMETRY:
25+
FILE: "fluid_exodus_in.exo"
26+
ELEMENT_BLOCKS:
27+
- ID: 1
28+
ELEMENT_NAME: FLUID
29+
ELEMENT_DATA: "MAT 1 NA Euler"
30+
31+
DESIGN LINE DIRICH CONDITIONS:
32+
- E: 1
33+
ENTITY_TYPE: node_set_id
34+
NUMDOF: 3
35+
ONOFF: [1, 1, 0]
36+
VAL: [1.0, 0.0, 0.0]
37+
FUNCT: [1, null, null]
38+
- E: 2
39+
ENTITY_TYPE: node_set_id
40+
NUMDOF: 3
41+
ONOFF: [0, 1, 0]
42+
VAL: [0.0, 0.0, 0.0]
43+
FUNCT: [null, null, null]
44+
- E: 3
45+
ENTITY_TYPE: node_set_id
46+
NUMDOF: 3
47+
ONOFF: [0, 1, 0]
48+
VAL: [0.0, 0.0, 0.0]
49+
FUNCT: [null, null, null]
50+
- E: 4
51+
ENTITY_TYPE: node_set_id
52+
NUMDOF: 3
53+
ONOFF: [1, 1, 0]
54+
VAL: [0.0, 0.0, 0.0]
55+
FUNCT: [null, null, null]
56+
57+
DESIGN POINT DIRICH CONDITIONS:
58+
- E: 5
59+
ENTITY_TYPE: node_set_id
60+
NUMDOF: 3
61+
ONOFF: [1, 1, 0]
62+
VAL: [1.0, 0.0, 0.0]
63+
FUNCT: [null, null, null]
64+
65+
RESULT DESCRIPTION:
66+
- FLUID:
67+
DIS: "fluid"
68+
NODE: 2912
69+
QUANTITY: "velx"
70+
VALUE: 0
71+
TOLERANCE: 1e-08
72+
- FLUID:
73+
DIS: "fluid"
74+
NODE: 2912
75+
QUANTITY: "vely"
76+
VALUE: 0
77+
TOLERANCE: 1e-08
78+
- FLUID:
79+
DIS: "fluid"
80+
NODE: 2912
81+
QUANTITY: "pressure"
82+
VALUE: 2.316272235592883
83+
TOLERANCE: 1e-10
84+
- FLUID:
85+
DIS: "fluid"
86+
NODE: 4034
87+
QUANTITY: "velx"
88+
VALUE: 0
89+
TOLERANCE: 1e-08
90+
- FLUID:
91+
DIS: "fluid"
92+
NODE: 4034
93+
QUANTITY: "vely"
94+
VALUE: 0
95+
TOLERANCE: 1e-08
96+
- FLUID:
97+
DIS: "fluid"
98+
NODE: 4034
99+
QUANTITY: "pressure"
100+
VALUE: 1.5110014506671248
101+
TOLERANCE: 1e-08
102+
- FLUID:
103+
DIS: "fluid"
104+
NODE: 6667
105+
QUANTITY: "velx"
106+
VALUE: 0.8140348125434049
107+
TOLERANCE: 1e-08
108+
- FLUID:
109+
DIS: "fluid"
110+
NODE: 6667
111+
QUANTITY: "vely"
112+
VALUE: -0.022743581282554975
113+
TOLERANCE: 1e-10
114+
- FLUID:
115+
DIS: "fluid"
116+
NODE: 6667
117+
QUANTITY: "pressure"
118+
VALUE: 2.0581385928541125
119+
TOLERANCE: 1e-10
120+
- FLUID:
121+
DIS: "fluid"
122+
NODE: 6998
123+
QUANTITY: "velx"
124+
VALUE: 0.9708173796517694
125+
TOLERANCE: 1e-08
126+
- FLUID:
127+
DIS: "fluid"
128+
NODE: 6998
129+
QUANTITY: "vely"
130+
VALUE: -7.977045433472414e-16
131+
TOLERANCE: 1e-08
132+
- FLUID:
133+
DIS: "fluid"
134+
NODE: 6998
135+
QUANTITY: "pressure"
136+
VALUE: 1.8450141345624358
137+
TOLERANCE: 1e-10
311 KB
Binary file not shown.

tests/list_of_tests.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ four_c_test(TEST_FILE fbi_mortar_solidcoupling.dat NP 2 RESTART_STEP 1)
654654
four_c_test(TEST_FILE fbi_mortar_twoway_obstacle.dat NP 2 RESTART_STEP 1)
655655
four_c_test(TEST_FILE fbi_reissnerbeam_solidcoupling.dat)
656656
four_c_test(TEST_FILE fbi_twoway_obstacle.dat NP 2 RESTART_STEP 1)
657+
four_c_test(TEST_FILE fluid_exodus_in.4C.yaml NP 2 RESTART_STEP 1)
657658
four_c_test(TEST_FILE fps3i_reaction.dat NP 2 RESTART_STEP 2 TIMEOUT 260)
658659
four_c_test(TEST_FILE fpsi_2D_quad4.dat NP 2)
659660
four_c_test(TEST_FILE fpsi_bending_struct.dat NP 2 RESTART_STEP 3 TIMEOUT 260)

0 commit comments

Comments
 (0)