ExaDG
Loading...
Searching...
No Matches
line_plot_calculation_statistics_homogeneous.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_CALCULATION_STATISTICS_HOMOGENEOUS_H_
23#define EXADG_INCOMPRESSIBLE_NAVIER_STOKES_POSTPROCESSOR_LINE_PLOT_CALCULATION_STATISTICS_HOMOGENEOUS_H_
24
25// C/C++
26#include <fstream>
27
28// deal.II
29#include <deal.II/base/quadrature_lib.h>
30#include <deal.II/dofs/dof_handler.h>
31#include <deal.II/fe/mapping_q.h>
32#include <deal.II/lac/la_parallel_vector.h>
33
34// ExaDG
35#include <exadg/incompressible_navier_stokes/postprocessor/line_plot_data.h>
36#include <exadg/postprocessor/time_control.h>
37
38namespace ExaDG
39{
40namespace IncNS
41{
42/*
43 * This function calculates statistics along lines over time
44 * and one spatial, homogeneous direction (averaging_direction = {0,1,2}), e.g.,
45 * in the x-direction with a line in the y-z plane.
46 *
47 * NOTE: This functionality can only be used for hypercube meshes and for geometries/meshes for
48 * which the cells are aligned with the coordinate axis.
49 */
50
51template<int dim, typename Number>
52class LinePlotCalculatorStatisticsHomogeneous
53{
54public:
55 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
56
57 typedef typename std::vector<
58 std::pair<typename dealii::DoFHandler<dim>::active_cell_iterator, dealii::Point<dim>>>
59 TYPE;
60
61 LinePlotCalculatorStatisticsHomogeneous(dealii::DoFHandler<dim> const & dof_handler_velocity_in,
62 dealii::DoFHandler<dim> const & dof_handler_pressure_in,
63 dealii::Mapping<dim> const & mapping_in,
64 MPI_Comm const & mpi_comm_in);
65
66 void
67 setup(LinePlotDataStatistics<dim> const & data_in);
68
69 void
70 evaluate(VectorType const & velocity, VectorType const & pressure);
71
72 void
73 write_output() const;
74
75 TimeControlStatistics time_control_statistics;
76
77private:
78 void
79 print_headline(std::ofstream & f, unsigned int const number_of_samples) const;
80
81 void
82 do_evaluate(VectorType const & velocity, VectorType const & pressure);
83
84 void
85 do_evaluate_velocity(VectorType const & velocity,
86 Line<dim> const & line,
87 unsigned int const line_iterator);
88
89 void
90 do_evaluate_pressure(VectorType const & pressure,
91 Line<dim> const & line,
92 unsigned int const line_iterator);
93
94 void
95 average_pressure_for_given_point(VectorType const & pressure,
96 TYPE const & vector_cells_and_ref_points,
97 double & length_local,
98 double & pressure_local);
99
100 void
101 find_points_and_weights(dealii::Point<dim> const & point_in_ref_coord,
102 std::vector<dealii::Point<dim>> & points,
103 std::vector<double> & weights,
104 unsigned int const averaging_direction,
105 dealii::QGauss<1> const & gauss_1d);
106
107 void
108 do_write_output() const;
109
110 mutable bool clear_files;
111
112 dealii::DoFHandler<dim> const & dof_handler_velocity;
113 dealii::DoFHandler<dim> const & dof_handler_pressure;
114 dealii::Mapping<dim> const & mapping;
115 MPI_Comm mpi_comm;
116
118
119 // Global points
120 std::vector<std::vector<dealii::Point<dim>>> global_points;
121
122 // For all lines: for all points along the line: list of all relevant cells and points in ref
123 // coordinates
124 std::vector<std::vector<std::vector<
125 std::pair<typename dealii::DoFHandler<dim>::active_cell_iterator, dealii::Point<dim>>>>>
126 cells_and_ref_points_velocity;
127
128 // For all lines: for all points along the line: list of all relevant cells and points in ref
129 // coordinates
130 std::vector<std::vector<std::vector<
131 std::pair<typename dealii::DoFHandler<dim>::active_cell_iterator, dealii::Point<dim>>>>>
132 cells_and_ref_points_pressure;
133
134 // For all lines: for pressure reference point: list of all relevant cells and points in ref
135 // coordinates
136 std::vector<std::vector<
137 std::pair<typename dealii::DoFHandler<dim>::active_cell_iterator, dealii::Point<dim>>>>
138 cells_and_ref_points_ref_pressure;
139
140 // number of samples for averaging in time
141 unsigned int number_of_samples;
142
143 // homogeneous direction for averaging in space
144 unsigned int averaging_direction;
145
146 // Velocity quantities
147 // For all lines: for all points along the line
148 std::vector<std::vector<dealii::Tensor<1, dim, double>>> velocity_global;
149
150 // Skin Friction quantities
151 // For all lines: for all points along the line
152 std::vector<std::vector<double>> wall_shear_global;
153
154 // Reynolds Stress quantities
155 // For all lines: for all points along the line
156 std::vector<std::vector<dealii::Tensor<2, dim, double>>> reynolds_global;
157
158 // Pressure quantities
159 // For all lines: for all points along the line
160 std::vector<std::vector<double>> pressure_global;
161 // For all lines
162 std::vector<double> reference_pressure_global;
163
164 // write final output
165 bool write_final_output;
166};
167
168} // namespace IncNS
169} // namespace ExaDG
170
171#endif /* EXADG_INCOMPRESSIBLE_NAVIER_STOKES_POSTPROCESSOR_LINE_PLOT_CALCULATION_STATISTICS_HOMOGENEOUS_H_ \
172 */
Definition time_control_statistics.h:44
Definition driver.cpp:33
Definition line_plot_data.h:228
Definition line_plot_data.h:94