ExaDG
Loading...
Searching...
No Matches
precice_parameters.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2022 by the ExaDG authors
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 * ______________________________________________________________________
20 */
21
22#ifndef EXADG_FLUID_STRUCTURE_INTERACTION_PRECICE_PRECICE_PARAMETERS_H_
23#define EXADG_FLUID_STRUCTURE_INTERACTION_PRECICE_PRECICE_PARAMETERS_H_
24
25// deal.II
26#include <deal.II/base/parameter_handler.h>
27
28// ExaDG
29#include <exadg/fluid_structure_interaction/precice/coupling_base.h>
30#include <exadg/utilities/enum_utilities.h>
31
32namespace ExaDG
33{
34namespace preCICE
35{
41struct ConfigurationParameters
42{
43 ConfigurationParameters() = default;
44
45 ConfigurationParameters(std::string const & input_file);
46
47 std::string config_file = "precice config-file";
48 std::string physics = "undefined";
49 std::string participant_name = "exadg";
50 std::string read_mesh_name = "default";
51 std::string write_mesh_name = "default";
52 std::string ale_mesh_name = "default";
53 std::string write_data_specification = "values_on_q_points";
54 std::string velocity_data_name = "default";
55 std::string displacement_data_name = "default";
56 std::string stress_data_name = "default";
57
58 WriteDataType write_data_type = WriteDataType::undefined;
59
60 void
61 add_parameters(dealii::ParameterHandler & prm);
62};
63
64
65
66ConfigurationParameters::ConfigurationParameters(std::string const & input_file)
67{
68 dealii::ParameterHandler prm;
69 add_parameters(prm);
70 prm.parse_input(input_file, "", true, true);
71
72 Utilities::string_to_enum(write_data_type, write_data_specification);
73}
74
75
76
77void
78ConfigurationParameters::add_parameters(dealii::ParameterHandler & prm)
79{
80 prm.enter_subsection("preciceConfiguration");
81 {
82 prm.add_parameter("preciceConfigFile",
83 config_file,
84 "Name of the precice configuration file",
85 dealii::Patterns::Anything());
86 prm.add_parameter("Physics",
87 physics,
88 "Specify the side you want to compute (Fluid vs Structure)",
89 dealii::Patterns::Selection("Structure|Fluid|undefined"));
90 prm.add_parameter("ParticipantName",
91 participant_name,
92 "Name of the participant in the precice-config.xml file",
93 dealii::Patterns::Anything());
94 prm.add_parameter("ReadMeshName",
95 read_mesh_name,
96 "Name of the read coupling mesh in the precice-config.xml file",
97 dealii::Patterns::Anything());
98 prm.add_parameter("WriteMeshName",
99 write_mesh_name,
100 "Name of the write coupling mesh in the precice-config.xml file",
101 dealii::Patterns::Anything());
102 prm.add_parameter("ALEMeshName",
103 ale_mesh_name,
104 "Name of the ale-mesh in the precice-config.xml file",
105 dealii::Patterns::Anything());
106 prm.add_parameter("WriteDataSpecification",
107 write_data_specification,
108 "Specification of the write data location and the data type",
109 dealii::Patterns::Selection(
110 "values_on_dofs|values_on_q_points|normal_gradients_on_q_points|"
111 "values_on_other_mesh|gradients_on_other_mesh"));
112 prm.add_parameter("VelocityDataName",
113 velocity_data_name,
114 "Name of the Velocity data in the precice-config.xml file",
115 dealii::Patterns::Anything());
116 prm.add_parameter("DisplacementDataName",
117 displacement_data_name,
118 "Name of the Displacement data in the precice-config.xml file",
119 dealii::Patterns::Anything());
120 prm.add_parameter("StressDataName",
121 stress_data_name,
122 "Name of the Stress data in the precice-config.xml file",
123 dealii::Patterns::Anything());
124 }
125 prm.leave_subsection();
126}
127
128} // namespace preCICE
129} // namespace ExaDG
130
131#endif /* EXADG_FLUID_STRUCTURE_INTERACTION_PRECICE_PRECICE_PARAMETERS_H_ */
void string_to_enum(EnumType &enum_type, std::string const &enum_name)
Converts a string to an enum, which is provided as first function argument.
Definition enum_utilities.h:79
Definition driver.cpp:33