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