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