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 {
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
108template<int dim, typename Number>
110
111template<int dim, typename Number>
112class OutputGenerator
113{
114public:
115 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
116
117 OutputGenerator(MPI_Comm const & comm);
118
119 void
120 setup(dealii::DoFHandler<dim> const & dof_handler_velocity_in,
121 dealii::DoFHandler<dim> const & dof_handler_pressure_in,
122 dealii::Mapping<dim> const & mapping_in,
123 OutputData const & output_data_in);
124
125 void
126 evaluate(
127 VectorType const & velocity,
128 VectorType const & pressure,
129 std::vector<dealii::ObserverPointer<SolutionField<dim, Number>>> const & additional_fields,
130 double const time,
131 bool const unsteady) const;
132
133 TimeControl time_control;
134
135private:
136 MPI_Comm const mpi_comm;
137
138 OutputData output_data;
139
140 dealii::ObserverPointer<dealii::DoFHandler<dim> const> dof_handler_velocity;
141 dealii::ObserverPointer<dealii::DoFHandler<dim> const> dof_handler_pressure;
142 dealii::ObserverPointer<dealii::Mapping<dim> const> mapping;
143};
144
145} // namespace IncNS
146} // namespace ExaDG
147
148#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