ExaDG
Loading...
Searching...
No Matches
lift_and_drag_calculation.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_POSTPROCESSOR_LIFT_AND_DRAG_CALCULATION_H_
23#define INCLUDE_EXADG_POSTPROCESSOR_LIFT_AND_DRAG_CALCULATION_H_
24
25// deal.ii
26#include <deal.II/base/conditional_ostream.h>
27#include <deal.II/matrix_free/matrix_free.h>
28
29// ExaDG
30#include <exadg/postprocessor/time_control.h>
31
32namespace ExaDG
33{
35{
37 : viscosity(1.0),
38 reference_value(1.0),
39 directory("output/"),
40 filename_lift("lift"),
41 filename_drag("drag")
42 {
43 }
44
45 /*
46 * Data to control output: Set is_active also in the unsteady case
47 */
48 TimeControlData time_control_data;
49
50 /*
51 * Kinematic viscosity
52 */
53 double viscosity;
54
55 /*
56 * c_L = L / (1/2 rho U^2 A) = L / (reference_value)
57 */
58 double reference_value;
59
60 /*
61 * set containing boundary ID's of the surface area used
62 * to calculate lift and drag coefficients
63 */
64 std::set<dealii::types::boundary_id> boundary_IDs;
65
66 /*
67 * filenames
68 */
69 std::string directory;
70 std::string filename_lift;
71 std::string filename_drag;
72
73 void
74 print(dealii::ConditionalOStream & pcout, bool unsteady) const;
75};
76
77template<int dim, typename Number>
79{
80public:
81 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
82
83 LiftAndDragCalculator(MPI_Comm const & comm);
84
85 void
86 setup(dealii::DoFHandler<dim> const & dof_handler_velocity_in,
87 dealii::MatrixFree<dim, Number> const & matrix_free_in,
88 unsigned int const dof_index_velocity_in,
89 unsigned int const dof_index_pressure_in,
90 unsigned int const quad_index_in,
91 LiftAndDragData const & lift_and_drag_data_in);
92
93 void
94 evaluate(VectorType const & velocity, VectorType const & pressure, double const time) const;
95
96 TimeControl time_control;
97
98private:
99 MPI_Comm const mpi_comm;
100
101 mutable bool clear_files;
102
103 dealii::SmartPointer<dealii::DoFHandler<dim> const> dof_handler_velocity;
104 dealii::MatrixFree<dim, Number> const * matrix_free;
105 unsigned int dof_index_velocity, dof_index_pressure, quad_index;
106
107 mutable double c_L_min, c_L_max, c_D_min, c_D_max;
108
109 LiftAndDragData data;
110};
111
112} // namespace ExaDG
113
114
115#endif /* INCLUDE_EXADG_POSTPROCESSOR_LIFT_AND_DRAG_CALCULATION_H_ */
Definition lift_and_drag_calculation.h:79
Definition time_control.h:64
Definition driver.cpp:33
Definition lift_and_drag_calculation.h:35
Definition time_control.h:40