ExaDG
Loading...
Searching...
No Matches
line_plot_data.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2021 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_INCOMPRESSIBLE_NAVIER_STOKES_POSTPROCESSOR_LINE_PLOT_DATA_H_
23#define EXADG_INCOMPRESSIBLE_NAVIER_STOKES_POSTPROCESSOR_LINE_PLOT_DATA_H_
24
25// deal.II
26#include <deal.II/base/point.h>
27
28// ExaDG
29#include <exadg/postprocessor/time_control_statistics.h>
30#include <exadg/utilities/print_functions.h>
31
32// C/C++
33#include <memory>
34
35namespace ExaDG
36{
37namespace IncNS
38{
39enum class QuantityType
40{
41 Undefined,
42 Velocity,
43 Pressure,
44 SkinFriction,
45 ReynoldsStresses,
46 PressureCoefficient
47};
48
49struct Quantity
50{
51 Quantity() : type(QuantityType::Undefined)
52 {
53 }
54
55 Quantity(QuantityType const & quantity_type) : type(quantity_type)
56 {
57 }
58
59 virtual ~Quantity()
60 {
61 }
62
63 QuantityType type;
64};
65
66template<int dim>
67struct QuantityPressureCoefficient : Quantity
68{
69 QuantityPressureCoefficient() : Quantity(), reference_point(dealii::Point<dim>())
70 {
71 }
72
73 dealii::Point<dim> reference_point;
74};
75
76template<int dim>
77struct QuantitySkinFriction : Quantity
78{
79 QuantitySkinFriction()
80 : Quantity(),
81 viscosity(1.0),
82 normal_vector(dealii::Tensor<1, dim, double>()),
83 tangent_vector(dealii::Tensor<1, dim, double>())
84 {
85 }
86
87 double viscosity;
88 dealii::Tensor<1, dim, double> normal_vector;
89 dealii::Tensor<1, dim, double> tangent_vector;
90};
91
92template<int dim>
93struct Line
94{
95 Line() : n_points(2), name("line")
96 {
97 }
98
99 virtual ~Line()
100 {
101 }
102
103 /*
104 * begin and end points of line
105 */
106 dealii::Point<dim> begin;
107 dealii::Point<dim> end;
108
109 /*
110 * number of data points written along a line
111 */
112 unsigned int n_points;
113
114 /*
115 * name of line
116 */
117 std::string name;
118
119 /*
120 * Specify for which fields/quantities to write output
121 */
122 std::vector<std::shared_ptr<Quantity>> quantities;
123};
124
125/*
126 * Derived data structure in order to perform additional averaging
127 * in circumferential direction for rotationally symmetric problems.
128 *
129 * Note that the implementation assumes that line->begin is the
130 * center of the circle for circumferential averaging.
131 */
132template<int dim>
133struct LineCircumferentialAveraging : Line<dim>
134{
135 LineCircumferentialAveraging()
136 : Line<dim>(),
137 average_circumferential(false),
138 n_points_circumferential(4),
139 normal_vector(dealii::Tensor<1, dim>())
140 {
141 }
142
143 // activate averaging in circumferential direction
144 bool average_circumferential;
145
146 // number of points used for averaging in circumferential direction
147 // only used in average_circumferential == true
148 unsigned int n_points_circumferential;
149
150 // defines the averaging plane along with the begin and end points
151 // of the line. Has to be specified if averaging in circumferential
152 // direction is activated.
153 dealii::Tensor<1, dim> normal_vector;
154};
155
156/*
157 * Derived data structure in order to perform additional averaging
158 * in homogeneous direction.
159 */
160template<int dim>
161struct LineHomogeneousAveraging : Line<dim>
162{
163 LineHomogeneousAveraging()
164 : Line<dim>(), average_homogeneous_direction(false), averaging_direction(0)
165 {
166 }
167
168 // activate averaging in homogeneous direction
169 bool average_homogeneous_direction;
170
171 // has to be specified in case of averaging in homogeneous direction
172 unsigned int averaging_direction; // x = 0, y = 1, z = 2
173};
174
175template<int dim>
176struct LinePlotDataBase
177{
178 LinePlotDataBase() : directory("output/"), precision(10)
179 {
180 }
181
182 void
183 print_base(dealii::ConditionalOStream & pcout)
184 {
185 pcout << " Line plot data:" << std::endl;
186 print_parameter(pcout, "Directory", directory);
187 print_parameter(pcout, "Precision", precision);
188 print_parameter(pcout, "Line", lines.name);
189 print_parameter(pcout, " Quantity", lines.quantity);
190 }
191
192 /*
193 * output folder
194 */
195 std::string directory;
196
197 /*
198 * precision (number of decimal places when writing to files)
199 */
200 unsigned int precision;
201
202 /*
203 * a vector of lines along which we want to write output
204 */
205 std::vector<std::shared_ptr<Line<dim>>> lines;
206};
207
208
209template<int dim>
210struct LinePlotData : public LinePlotDataBase<dim>
211{
212 TimeControlData time_control_data;
213
214 void
215 print(dealii::ConditionalOStream & pcout)
216 {
217 if(time_control_data.is_active)
218 {
219 this->print_base();
220 // only makes sense in unsteady case
221 time_control_data.print(pcout, true);
222 }
223 }
224};
225
226template<int dim>
227struct LinePlotDataStatistics : public LinePlotDataBase<dim>
228{
229 TimeControlDataStatistics time_control_data_statistics;
230
231 void
232 print(dealii::ConditionalOStream & pcout)
233 {
234 if(time_control_data_statistics.time_control_data.is_active)
235 {
236 this->print_base();
237 // only makes sense in unsteady case
238 time_control_data_statistics.print(pcout, true);
239 }
240 }
241};
242
243} // namespace IncNS
244} // namespace ExaDG
245
246#endif /* EXADG_INCOMPRESSIBLE_NAVIER_STOKES_POSTPROCESSOR_LINE_PLOT_DATA_H_ */
Definition driver.cpp:33
Definition line_plot_data.h:228
Definition line_plot_data.h:211
Definition time_control_statistics.h:31
Definition time_control.h:40