ExaDG
Loading...
Searching...
No Matches
output_generator.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_OUTPUT_GENERATOR_H_
23#define INCLUDE_EXADG_INCOMPRESSIBLE_NAVIER_STOKES_POSTPROCESSOR_OUTPUT_GENERATOR_H_
24
25#include <exadg/postprocessor/output_data_base.h>
26#include <exadg/postprocessor/solution_field.h>
27#include <exadg/postprocessor/time_control.h>
28
29namespace ExaDG
30{
31namespace IncNS
32{
33struct OutputData : public OutputDataBase
34{
35 OutputData()
36 : write_vorticity(false),
37 write_divergence(false),
38 write_shear_rate(false),
39 write_viscosity(false),
40 write_velocity_magnitude(false),
41 write_vorticity_magnitude(false),
42 write_streamfunction(false),
43 write_q_criterion(false),
44 mean_velocity(TimeControlData()),
45 write_cfl(false),
46 write_aspect_ratio(false)
47 {
48 }
49
50 void
51 print(dealii::ConditionalOStream & pcout, bool unsteady)
52 {
53 OutputDataBase::print(pcout, unsteady);
54
55 print_parameter(pcout, "Write vorticity", write_vorticity);
56 print_parameter(pcout, "Write divergence", write_divergence);
57 print_parameter(pcout, "Write shear rate", write_shear_rate);
58 print_parameter(pcout, "Write viscosity", write_viscosity);
59 print_parameter(pcout, "Write velocity magnitude", write_velocity_magnitude);
60 print_parameter(pcout, "Write vorticity magnitude", write_vorticity_magnitude);
61 print_parameter(pcout, "Write streamfunction", write_streamfunction);
62 print_parameter(pcout, "Write Q criterion", write_q_criterion);
63
64 mean_velocity.print(pcout, unsteady);
65 }
66
67 // write vorticity of velocity field
68 bool write_vorticity;
69
70 // write divergence of velocity field
71 bool write_divergence;
72
73 // write shear rate of velocity field
74 bool write_shear_rate;
75
76 // write viscosity depending on viscosity field
77 bool write_viscosity;
78
79 // write velocity magnitude
80 bool write_velocity_magnitude;
81
82 // write vorticity magnitude
83 bool write_vorticity_magnitude;
84
85 // Calculate streamfunction in order to visualize streamlines!
86 // Note that this option is only available in 2D!
87 // To calculate the streamfunction Psi, a Poisson equation is solved
88 // with homogeneous Dirichlet BC's. Accordingly, this approach can only be
89 // used for flow problems where the whole boundary is one streamline, e.g.,
90 // cavity-type flow problems where the velocity is tangential to the boundary
91 // on one part of the boundary and 0 (no-slip) on the rest of the boundary.
92 bool write_streamfunction;
93
94 // write Q criterion
95 bool write_q_criterion;
96
97 // Average velocity field over time for statistically steady, turbulent
98 // flow problems in order to visualize the time-averaged velocity field.
99 // Of course, this module can also be used for statistically unsteady problems,
100 // but in this case the mean velocity field is probably not meaningful.
101 TimeControlData mean_velocity;
102
103
104 // write cfl
105 bool write_cfl;
106
107 // write aspect ratio
108 bool write_aspect_ratio;
109};
110
111template<int dim, typename Number>
113
114template<int dim, typename Number>
115class OutputGenerator
116{
117public:
118 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
119
120 OutputGenerator(MPI_Comm const & comm);
121
122 void
123 setup(dealii::DoFHandler<dim> const & dof_handler_velocity_in,
124 dealii::DoFHandler<dim> const & dof_handler_pressure_in,
125 dealii::Mapping<dim> const & mapping_in,
126 OutputData const & output_data_in);
127
128 void
129 evaluate(VectorType const & velocity,
130 VectorType const & pressure,
131 std::vector<dealii::SmartPointer<SolutionField<dim, Number>>> const & additional_fields,
132 double const time,
133 bool const unsteady) const;
134
135 TimeControl time_control;
136
137private:
138 MPI_Comm const mpi_comm;
139
140 OutputData output_data;
141
142 dealii::SmartPointer<dealii::DoFHandler<dim> const> dof_handler_velocity;
143 dealii::SmartPointer<dealii::DoFHandler<dim> const> dof_handler_pressure;
144 dealii::SmartPointer<dealii::Mapping<dim> const> mapping;
145};
146
147} // namespace IncNS
148} // namespace ExaDG
149
150#endif /* INCLUDE_EXADG_INCOMPRESSIBLE_NAVIER_STOKES_POSTPROCESSOR_OUTPUT_GENERATOR_H_ */
Definition spatial_operator_base.h:68
Definition solution_field.h:39
Definition time_control.h:64
Definition driver.cpp:33
Definition output_generator.h:34
Definition time_control.h:40