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