ExaDG
Loading...
Searching...
No Matches
projection_operator.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_SPATIAL_DISCRETIZATION_OPERATORS_PROJECTION_OPERATOR_H_
23#define EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_OPERATORS_PROJECTION_OPERATOR_H_
24
25// ExaDG
26#include <exadg/incompressible_navier_stokes/spatial_discretization/operators/continuity_penalty_operator.h>
27#include <exadg/incompressible_navier_stokes/spatial_discretization/operators/divergence_penalty_operator.h>
28#include <exadg/operators/operator_base.h>
29
30namespace ExaDG
31{
32namespace IncNS
33{
34/*
35 * Combined divergence and continuity penalty operator: applies the operation
36 *
37 * mass operator + dt * divergence penalty operator + dt * continuity penalty operator .
38 *
39 * In detail
40 *
41 * Mass operator: ( v_h , u_h )_Omega^e where
42 *
43 * Divergence penalty operator: ( div(v_h) , tau_div * div(u_h) )_Omega^e
44 *
45 * Continuity penalty operator: ( v_h , tau_conti * jump(u_h) )_dOmega^e, where
46 *
47 * jump(u_h) = u_h^{-} - u_h^{+} or ( (u_h^{-} - u_h^{+})*normal ) * normal
48 *
49 * and
50 *
51 * v_h : test function
52 * u_h : solution
53 */
54
55/*
56 * Operator data.
57 */
58template<int dim>
59struct ProjectionOperatorData : public OperatorBaseData
60{
61 ProjectionOperatorData()
62 : OperatorBaseData(),
63 use_divergence_penalty(true),
64 use_continuity_penalty(true),
65 use_boundary_data(false)
66 {
67 }
68
69 // specify which penalty terms are used
70 bool use_divergence_penalty, use_continuity_penalty;
71
72 bool use_boundary_data;
73
74 std::shared_ptr<BoundaryDescriptorU<dim> const> bc;
75};
76
77template<int dim, typename Number>
78class ProjectionOperator : public OperatorBase<dim, Number, dim>
79{
80private:
81 typedef OperatorBase<dim, Number, dim> Base;
82
83 typedef dealii::Tensor<1, dim, dealii::VectorizedArray<Number>> vector;
84
85 typedef typename Base::VectorType VectorType;
86 typedef typename Base::IntegratorCell IntegratorCell;
87 typedef typename Base::IntegratorFace IntegratorFace;
88
91
92public:
93 typedef Number value_type;
94
95 ProjectionOperator() : velocity(nullptr), time_step_size(1.0)
96 {
97 }
98
99 void
100 initialize(dealii::MatrixFree<dim, Number> const & matrix_free,
101 dealii::AffineConstraints<Number> const & affine_constraints,
102 ProjectionOperatorData<dim> const & data,
103 Operators::DivergencePenaltyKernelData const & div_kernel_data,
104 Operators::ContinuityPenaltyKernelData const & conti_kernel_data);
105
106 void
107 initialize(dealii::MatrixFree<dim, Number> const & matrix_free,
108 dealii::AffineConstraints<Number> const & affine_constraints,
109 ProjectionOperatorData<dim> const & data,
110 std::shared_ptr<DivKernel> div_penalty_kernel,
111 std::shared_ptr<ContiKernel> conti_penalty_kernel);
112
114 get_data() const;
115
117 get_divergence_kernel_data() const;
118
120 get_continuity_kernel_data() const;
121
122 double
123 get_time_step_size() const;
124
125 dealii::LinearAlgebra::distributed::Vector<Number> const &
126 get_velocity() const;
127
128 void
129 update(VectorType const & velocity, double const & dt);
130
131private:
132 void
133 reinit_cell_derived(IntegratorCell & integrator, unsigned int const cell) const final;
134
135 void
136 reinit_face_derived(IntegratorFace & integrator_m,
137 IntegratorFace & integrator_p,
138 unsigned int const face) const final;
139
140 void
141 reinit_boundary_face_derived(IntegratorFace & integrator_m, unsigned int const face) const final;
142
143 void
144 reinit_face_cell_based_derived(IntegratorFace & integrator_m,
145 IntegratorFace & integrator_p,
146 unsigned int const cell,
147 unsigned int const face,
148 dealii::types::boundary_id const boundary_id) const final;
149
150 void
151 do_cell_integral(IntegratorCell & integrator) const final;
152
153 void
154 do_face_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const final;
155
156 void
157 do_face_int_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const final;
158
159 void
160 do_face_ext_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const final;
161
162 void
163 do_boundary_integral(IntegratorFace & integrator_m,
164 OperatorType const & operator_type,
165 dealii::types::boundary_id const & boundary_id) const final;
166
167 ProjectionOperatorData<dim> operator_data;
168
169 VectorType const * velocity;
170 double time_step_size;
171
172 std::shared_ptr<Operators::DivergencePenaltyKernel<dim, Number>> div_kernel;
173 std::shared_ptr<Operators::ContinuityPenaltyKernel<dim, Number>> conti_kernel;
174};
175
176} // namespace IncNS
177} // namespace ExaDG
178
179#endif /* EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_OPERATORS_PROJECTION_OPERATOR_H_ \
180 */
Definition continuity_penalty_operator.h:96
Definition divergence_penalty_operator.h:85
Definition driver.cpp:33
Definition continuity_penalty_operator.h:67
Definition divergence_penalty_operator.h:61
Definition projection_operator.h:60