ExaDG
Loading...
Searching...
No Matches
combined_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_CONVECTION_DIFFUSION_SPATIAL_DISCRETIZATION_OPERATORS_COMBINED_OPERATOR_H_
23#define INCLUDE_EXADG_CONVECTION_DIFFUSION_SPATIAL_DISCRETIZATION_OPERATORS_COMBINED_OPERATOR_H_
24
25#include <exadg/convection_diffusion/spatial_discretization/operators/convective_operator.h>
26#include <exadg/convection_diffusion/spatial_discretization/operators/diffusive_operator.h>
27#include <exadg/operators/mass_kernel.h>
28
29namespace ExaDG
30{
31namespace ConvDiff
32{
33template<int dim>
35{
38 unsteady_problem(false),
39 convective_problem(false),
40 diffusive_problem(false)
41 {
42 }
43
44 bool unsteady_problem;
45 bool convective_problem;
46 bool diffusive_problem;
47
48 Operators::ConvectiveKernelData<dim> convective_kernel_data;
49 Operators::DiffusiveKernelData diffusive_kernel_data;
50
51 std::shared_ptr<BoundaryDescriptor<dim> const> bc;
52};
53
54template<int dim, typename Number>
55class CombinedOperator : public OperatorBase<dim, Number, 1>
56{
57public:
58 typedef Number value_type;
59
60private:
62
63 typedef typename Base::IntegratorCell IntegratorCell;
64 typedef typename Base::IntegratorFace IntegratorFace;
65
66 typedef typename Base::VectorType VectorType;
67
68 typedef dealii::VectorizedArray<Number> scalar;
69 typedef dealii::Tensor<1, dim, dealii::VectorizedArray<Number>> vector;
70
71public:
73
78 void
79 initialize(dealii::MatrixFree<dim, Number> const & matrix_free,
80 dealii::AffineConstraints<Number> const & affine_constraints,
81 CombinedOperatorData<dim> const & data);
82
83 void
84 initialize(dealii::MatrixFree<dim, Number> const & matrix_free,
85 dealii::AffineConstraints<Number> const & affine_constraints,
86 CombinedOperatorData<dim> const & data,
87 std::shared_ptr<Operators::ConvectiveKernel<dim, Number>> convective_kernel,
88 std::shared_ptr<Operators::DiffusiveKernel<dim, Number>> diffusive_kernel);
89
91 get_data() const;
92
93 void
94 update_after_grid_motion();
95
96 dealii::LinearAlgebra::distributed::Vector<Number> const &
97 get_velocity() const;
98
99 void
100 set_velocity_copy(VectorType const & velocity) const;
101
102 void
103 set_velocity_ptr(VectorType const & velocity) const;
104
105 Number
106 get_scaling_factor_mass_operator() const;
107
108 void
109 set_scaling_factor_mass_operator(Number const & scaling_factor);
110
111private:
112 void
113 reinit_cell_derived(IntegratorCell & integrator, unsigned int const cell) const final;
114
115 void
116 reinit_face_derived(IntegratorFace & integrator_m,
117 IntegratorFace & integrator_p,
118 unsigned int const face) const final;
119
120 void
121 reinit_boundary_face_derived(IntegratorFace & integrator_m, unsigned int const face) const final;
122
123 void
124 reinit_face_cell_based_derived(IntegratorFace & integrator_m,
125 IntegratorFace & integrator_p,
126 unsigned int const cell,
127 unsigned int const face,
128 dealii::types::boundary_id const boundary_id) const final;
129
130 void
131 do_cell_integral(IntegratorCell & integrator) const final;
132
133 void
134 do_face_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const final;
135
136 void
137 do_face_int_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const final;
138
139 void
140 do_face_ext_integral(IntegratorFace & integrator_m, IntegratorFace & integrator_p) const final;
141
142 void
143 do_boundary_integral(IntegratorFace & integrator_m,
144 OperatorType const & operator_type,
145 dealii::types::boundary_id const & boundary_id) const final;
146
147 // TODO can be removed later once matrix-free evaluation allows accessing neighboring data for
148 // cell-based face loops
149 void
150 do_face_int_integral_cell_based(IntegratorFace & integrator_m,
151 IntegratorFace & integrator_p) const final;
152
153 CombinedOperatorData<dim> operator_data;
154
155 std::shared_ptr<MassKernel<dim, Number>> mass_kernel;
156 std::shared_ptr<Operators::ConvectiveKernel<dim, Number>> convective_kernel;
157 std::shared_ptr<Operators::DiffusiveKernel<dim, Number>> diffusive_kernel;
158
159 double scaling_factor_mass;
160};
161
162} // namespace ConvDiff
163} // namespace ExaDG
164
165#endif /* INCLUDE_EXADG_CONVECTION_DIFFUSION_SPATIAL_DISCRETIZATION_OPERATORS_COMBINED_OPERATOR_H_ \
166 */
Definition combined_operator.h:56
void initialize(dealii::MatrixFree< dim, Number > const &matrix_free, dealii::AffineConstraints< Number > const &affine_constraints, CombinedOperatorData< dim > const &data)
Definition combined_operator.cpp:36
Definition convective_operator.h:68
Definition diffusive_operator.h:49
Definition operator_base.h:98
Definition driver.cpp:33
Definition combined_operator.h:35
Definition convective_operator.h:41
Definition diffusive_operator.h:38
Definition operator_base.h:59