ExaDG
Toggle main menu visibility
Loading...
Searching...
No Matches
include
exadg
incompressible_navier_stokes
postprocessor
inflow_data_calculator.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_INFLOW_DATA_CALCULATOR_H_
23
#define EXADG_INCOMPRESSIBLE_NAVIER_STOKES_POSTPROCESSOR_INFLOW_DATA_CALCULATOR_H_
24
25
// deal.II
26
#include <deal.II/base/exceptions.h>
27
#include <deal.II/base/point.h>
28
#include <deal.II/dofs/dof_handler.h>
29
#include <deal.II/fe/mapping_q.h>
30
#include <deal.II/lac/la_parallel_vector.h>
31
32
// ExaDG
33
#include <exadg/utilities/print_functions.h>
34
35
namespace
ExaDG
36
{
37
namespace
IncNS
38
{
39
/*
40
* inflow data: use velocity at the outflow of one domain as inflow-BC for another domain
41
*
42
* The outflow boundary has to be the y-z plane at a given x-coordinate. The velocity is written at
43
* n_points_y in y-direction and n_points_z in z-direction, which has to be specified by the user.
44
*/
45
enum class
InflowGeometry
46
{
47
Cartesian,
48
Cylindrical
49
};
50
51
template
<
int
dim>
52
struct
InflowData
53
{
54
InflowData()
55
: write_inflow_data(
false
),
56
inflow_geometry(InflowGeometry::Cartesian),
57
normal_direction(0),
58
normal_coordinate(0.0),
59
n_points_y(2),
60
n_points_z(2),
61
y_values(
nullptr
),
62
z_values(
nullptr
),
63
array(
nullptr
)
64
{
65
}
66
67
void
68
print(dealii::ConditionalOStream & pcout)
69
{
70
if
(write_inflow_data ==
true
)
71
{
72
print_parameter(pcout,
"Normal direction"
, normal_direction);
73
print_parameter(pcout,
"Normal coordinate"
, normal_coordinate);
74
print_parameter(pcout,
"Number of points in y-direction"
, n_points_y);
75
print_parameter(pcout,
"Number of points in z-direction"
, n_points_z);
76
}
77
}
78
79
// write the data?
80
bool
write_inflow_data;
81
82
InflowGeometry inflow_geometry;
83
84
// direction normal to inflow surface: has to be 0 (x), 1 (y), or 2 (z)
85
unsigned
int
normal_direction;
86
// position of inflow plane in the direction normal to the inflow surface
87
double
normal_coordinate;
88
// specify the number of data points (grid points) in y- and z-direction
89
unsigned
int
n_points_y;
90
unsigned
int
n_points_z;
91
92
// Vectors with the y-coordinates, z-coordinates (in physical space)
93
std::vector<double> * y_values;
94
std::vector<double> * z_values;
95
// and the velocity values at n_points_y*n_points_z points
96
std::vector<dealii::Tensor<1, dim, double>> * array;
97
};
98
99
template
<
int
dim,
typename
Number>
100
class
InflowDataCalculator
101
{
102
public
:
103
InflowDataCalculator(
InflowData<dim>
const
& inflow_data, MPI_Comm
const
& comm);
104
105
void
106
setup(dealii::DoFHandler<dim>
const
& dof_handler_velocity, dealii::Mapping<dim>
const
& mapping);
107
108
void
109
calculate(dealii::LinearAlgebra::distributed::Vector<Number>
const
& velocity);
110
111
private
:
112
dealii::ObserverPointer<dealii::DoFHandler<dim>
const
> dof_handler_velocity;
113
dealii::ObserverPointer<dealii::Mapping<dim>
const
> mapping;
114
InflowData<dim>
inflow_data;
115
bool
inflow_data_has_been_initialized;
116
117
MPI_Comm
const
mpi_comm;
118
119
std::vector<
120
std::vector<std::pair<std::vector<dealii::types::global_dof_index>, std::vector<Number>>>>
121
array_dof_indices_and_shape_values;
122
123
std::vector<unsigned int> array_counter;
124
};
125
126
}
// namespace IncNS
127
}
// namespace ExaDG
128
129
#endif
/* EXADG_INCOMPRESSIBLE_NAVIER_STOKES_POSTPROCESSOR_INFLOW_DATA_CALCULATOR_H_ */
ExaDG
Definition
driver.cpp:33
ExaDG::IncNS::InflowData
Definition
inflow_data_calculator.h:53
Generated by
1.17.0