ExaDG
Loading...
Searching...
No Matches
momentum_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 INCLUDE_EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_OPERATORS_MOMENTUM_OPERATOR_H_
23#define INCLUDE_EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_OPERATORS_MOMENTUM_OPERATOR_H_
24
25#include <exadg/incompressible_navier_stokes/spatial_discretization/operators/convective_operator.h>
26#include <exadg/incompressible_navier_stokes/spatial_discretization/operators/viscous_operator.h>
27#include <exadg/operators/mass_kernel.h>
28#include <exadg/operators/operator_base.h>
29
30namespace ExaDG
31{
32namespace IncNS
33{
34template<int dim>
35struct MomentumOperatorData : public OperatorBaseData
36{
37 MomentumOperatorData()
38 : OperatorBaseData(), unsteady_problem(false), convective_problem(false), viscous_problem(false)
39 {
40 }
41
42 bool unsteady_problem;
43 bool convective_problem;
44 bool viscous_problem;
45
46 Operators::ConvectiveKernelData convective_kernel_data;
47 Operators::ViscousKernelData viscous_kernel_data;
48
49 std::shared_ptr<BoundaryDescriptorU<dim> const> bc;
50};
51
52template<int dim, typename Number>
53class MomentumOperator : public OperatorBase<dim, Number, dim>
54{
55private:
56 typedef dealii::VectorizedArray<Number> scalar;
57 typedef dealii::Tensor<1, dim, dealii::VectorizedArray<Number>> vector;
58 typedef dealii::Tensor<2, dim, dealii::VectorizedArray<Number>> tensor;
59
60 typedef OperatorBase<dim, Number, dim> Base;
61
62 typedef typename Base::VectorType VectorType;
63 typedef typename Base::IntegratorCell IntegratorCell;
64 typedef typename Base::IntegratorFace IntegratorFace;
65
66public:
67 // required by preconditioner interfaces
68 typedef Number value_type;
69
70 MomentumOperator();
71
76 void
77 initialize(dealii::MatrixFree<dim, Number> const & matrix_free,
78 dealii::AffineConstraints<Number> const & affine_constraints,
79 MomentumOperatorData<dim> const & data);
80
81 void
82 initialize(dealii::MatrixFree<dim, Number> const & matrix_free,
83 dealii::AffineConstraints<Number> const & affine_constraints,
84 MomentumOperatorData<dim> const & data,
85 std::shared_ptr<Operators::ViscousKernel<dim, Number>> viscous_kernel,
86 std::shared_ptr<Operators::ConvectiveKernel<dim, Number>> convective_kernel);
87
89 get_data() const;
90
92 get_convective_kernel_data() const;
93
95 get_viscous_kernel_data() const;
96
97 dealii::LinearAlgebra::distributed::Vector<Number> const &
98 get_velocity() const;
99
100 /*
101 * Interface required by Newton solver.
102 */
103 void
104 set_solution_linearization(VectorType const & velocity);
105
106 /*
107 * Update of operator (required, e.g., for multigrid).
108 */
109 void
110 update_after_grid_motion();
111
112 void
113 set_velocity_copy(VectorType const & velocity) const;
114
115 void
116 set_velocity_ptr(VectorType const & velocity) const;
117
118 Number
119 get_scaling_factor_mass_operator() const;
120
121 void
122 set_scaling_factor_mass_operator(Number const & number);
123
124 /*
125 * Interfaces of OperatorBase.
126 */
127 void
128 rhs(VectorType & dst) const final;
129
130 void
131 rhs_add(VectorType & dst) const final;
132
133 void
134 evaluate(VectorType & dst, VectorType const & src) const final;
135
136 void
137 evaluate_add(VectorType & dst, VectorType const & src) const final;
138
139private:
140 void
141 reinit_cell_derived(IntegratorCell & integrator, unsigned int const cell) const final;
142
143 void
144 reinit_face_derived(IntegratorFace & integrator_m,
145 IntegratorFace & integrator_p,
146 unsigned int const face) const final;
147
148 void
149 reinit_boundary_face_derived(IntegratorFace & integrator_m, unsigned int const face) const final;
150
151 void
152 reinit_face_cell_based_derived(IntegratorFace & integrator_m,
153 IntegratorFace & integrator_p,
154 unsigned int const cell,
155 unsigned int const face,
156 dealii::types::boundary_id const boundary_id) const final;
157
158 // linearized operator
159 void
160 do_cell_integral(IntegratorCell & integrator) const final;
161
162 // linearized operator
163 void
164 do_face_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const final;
165
166 // linearized operator
167 void
168 do_face_int_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const final;
169
170 // linearized operator
171
172 // TODO
173 // This function is currently only needed due to limitations of deal.II which do
174 // currently not allow to access neighboring data in case of cell-based face loops.
175 // Once this functionality is available, this function should be removed again.
176 void
177 do_face_int_integral_cell_based(IntegratorFace & integrator_m,
178 IntegratorFace & integrator_p) const final;
179
180 // linearized operator
181 void
182 do_face_ext_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const final;
183
184 // linearized operator
185 void
186 do_boundary_integral(IntegratorFace & integrator,
187 OperatorType const & operator_type,
188 dealii::types::boundary_id const & boundary_id) const final;
189
190 MomentumOperatorData<dim> operator_data;
191
192 std::shared_ptr<MassKernel<dim, Number>> mass_kernel;
193 std::shared_ptr<Operators::ConvectiveKernel<dim, Number>> convective_kernel;
194 std::shared_ptr<Operators::ViscousKernel<dim, Number>> viscous_kernel;
195
196 double scaling_factor_mass;
197};
198
199} // namespace IncNS
200} // namespace ExaDG
201
202#endif /* INCLUDE_EXADG_INCOMPRESSIBLE_NAVIER_STOKES_SPATIAL_DISCRETIZATION_OPERATORS_MOMENTUM_OPERATOR_H_ \
203 */
void initialize(dealii::MatrixFree< dim, Number > const &matrix_free, dealii::AffineConstraints< Number > const &affine_constraints, MomentumOperatorData< dim > const &data)
Definition momentum_operator.cpp:35
Definition convective_operator.h:63
Definition viscous_operator.h:63
Definition driver.cpp:33
Definition momentum_operator.h:36
Definition convective_operator.h:37
Definition viscous_operator.h:40