ExaDG
Loading...
Searching...
No Matches
parameters.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2023 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_AERO_ACOUSTIC_USER_INTERFACE_INPUT_PARAMETERS_H_
23#define EXADG_AERO_ACOUSTIC_USER_INTERFACE_INPUT_PARAMETERS_H_
24
25// deal.II
26#include <deal.II/base/conditional_ostream.h>
27#include <deal.II/base/parameter_handler.h>
28
29namespace ExaDG
30{
31namespace AeroAcoustic
32{
33enum class FluidToAcousticCouplingStrategy
34{
35 Undefined,
36 ConservativeInterpolation
37};
38
39enum class AcousticSourceTermComputation
40{
41 Undefined,
42 FromFluid,
43 // In case the aero-acoustic source term is known analytically do not compute a
44 // CFD, but interpolate the surce term to the CFD grid and use the given coupling
45 // strategy to transfer the source term. If this coupling strategy is set
46 // IncNS::TemporalDiscretization has to be InterpolateAnalyticalSolution.
47 // The analytical source term is interpolated as is, i.e. at the point of
48 // interpolation there is no check if source_term_with_convection is true. It is
49 // the resposibility of the user to make sure the source term includes convection
50 // or not.
51 FromAnalyticSourceTerm
52};
53
54class Parameters
55{
56public:
57 Parameters()
58 : density(-1.0),
59 source_term_with_convection(false),
60 blend_in_source_term(false),
61 fluid_to_acoustic_coupling_strategy(FluidToAcousticCouplingStrategy::Undefined),
62 acoustic_source_term_computation(AcousticSourceTermComputation::Undefined)
63 {
64 }
65
66 void
67 check() const
68 {
69 AssertThrow(density >= 0.0, dealii::ExcMessage("Density has to be set."));
70
71 AssertThrow(fluid_to_acoustic_coupling_strategy != FluidToAcousticCouplingStrategy::Undefined,
72 dealii::ExcMessage("Coupling strategy has to be set."));
73
74 AssertThrow(acoustic_source_term_computation != AcousticSourceTermComputation::Undefined,
75 dealii::ExcMessage("Source term computation has to be set."));
76 }
77
78 void
79 print(dealii::ConditionalOStream const & pcout, std::string const & name) const
80 {
81 pcout << std::endl << name << std::endl << std::endl;
82 print_parameter(pcout, "Density", density);
83 print_parameter(pcout, "Source term has convective part", source_term_with_convection);
84 print_parameter(pcout, "Blend in source term", blend_in_source_term);
85 print_parameter(pcout, "Fluid to acoustic coupling", fluid_to_acoustic_coupling_strategy);
86 print_parameter(pcout, "Acoustic source term compuation", acoustic_source_term_computation);
87 }
88
89 void
90 add_parameters(dealii::ParameterHandler & prm, std::string const & subsection_name)
91 {
92 prm.enter_subsection(subsection_name);
93 {
94 prm.add_parameter(
95 "Density", density, "Mean density of underlying fluid.", dealii::Patterns::Double(), true);
96
97 prm.add_parameter("SourceTermWithConvection",
98 source_term_with_convection,
99 "Source term includes convective part.",
100 dealii::Patterns::Bool(),
101 true);
102
103 prm.add_parameter("BlendInSourceTerm",
104 blend_in_source_term,
105 "Blend in the aeroacoustic source term.",
106 dealii::Patterns::Bool(),
107 true);
108
109 prm.add_parameter("FluidToAcousticCouplingStrategy",
110 fluid_to_acoustic_coupling_strategy,
111 "Volume coupling strategy from the fluid to the acoustic field.",
112 Patterns::Enum<FluidToAcousticCouplingStrategy>(),
113 true);
114
115 prm.add_parameter("AcousticSourceTermComputation",
116 acoustic_source_term_computation,
117 "How to compute the acustic source term.",
118 Patterns::Enum<AcousticSourceTermComputation>(),
119 true);
120 }
121 prm.leave_subsection();
122 }
123
124 // mean density of underlying fluid
125 double density;
126
127 // The aero-acoustic source term is the material derivative of the
128 // pressure. Sometimes, it is sufficient to neglect the convective
129 // part of the material derivative.
130 bool source_term_with_convection;
131
132 // Blend in aero-acoustic source terms in time or space?
133 bool blend_in_source_term;
134
135 // Strategy to couple from fluid to acoustic
136 FluidToAcousticCouplingStrategy fluid_to_acoustic_coupling_strategy;
137
138 // How to compute the acustic source term
139 AcousticSourceTermComputation acoustic_source_term_computation;
140};
141
142} // namespace AeroAcoustic
143} // namespace ExaDG
144
145#endif /* EXADG_AERO_ACOUSTIC_USER_INTERFACE_INPUT_PARAMETERS_H_ */
Definition driver.cpp:33