Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
tracer_assemblers.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2021-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_tracer_assemblers_h
5#define lethe_tracer_assemblers_h
6
9
10#include <solvers/copy_data.h>
14
15/**
16 * @brief A pure virtual class that serves as an interface for all
17 * of the assemblers for the Tracer equation
18 *
19 * @tparam dim An integer that denotes the number of spatial dimensions
20 *
21 * @ingroup assemblers
22 */
23template <int dim>
26
27/**
28 * @brief A pure virtual class that serves as an interface for boundary and
29 * internal faces that occur when using a discontinuous Galerkin discretization.
30 * The main difference between the TracerFaceAssembler and the TracerAssembler
31 * is that the TracerFaceAssembler assembles the matrix and rhs for internal
32 * faces and thus requires the StabilizedDGMethodsCopyData class.
33 *
34 * @tparam dim An integer that denotes the number of spatial dimensions
35 *
36 * @ingroup assemblers
37 */
38template <int dim>
41
42/**
43 * @brief Class that assembles the core of the Tracer equation.
44 * This class assembles the weak form of:
45 * \f$\mathbf{u} \cdot \nabla T - D \nabla^2T = S \f$ with an SUPG
46 * stabilization
47 *
48 * @tparam dim An integer that denotes the number of spatial dimensions
49 *
50 * @ingroup assemblers
51 */
52template <int dim>
54{
55public:
57 const std::shared_ptr<SimulationControl> &simulation_control)
59 {}
60
61 /**
62 * @brief Assembles the matrix
63 * @param[in] scratch_data (see base class)
64 * @param[in,out] copy_data (see base class)
65 */
66 virtual void
67 assemble_matrix(const TracerScratchData<dim> &scratch_data,
68 StabilizedMethodsCopyData &copy_data) override;
69
70 /**
71 * @brief Assembles the rhs
72 * @param[in] scratch_data (see base class)
73 * @param[in,out] copy_data (see base class)
74 */
75 virtual void
76 assemble_rhs(const TracerScratchData<dim> &scratch_data,
77 StabilizedMethodsCopyData &copy_data) override;
78
79 const std::shared_ptr<SimulationControl> simulation_control;
80};
81
82
83/**
84 * @brief Class that assembles the core (cells) of the Tracer equation for DG elements.
85 * This class assembles the weak form of:
86 * \f$\mathbf{u} \cdot \nabla T - D \nabla^2T =S \f$
87 *
88 * @tparam dim An integer that denotes the number of spatial dimensions
89 *
90 * @ingroup assemblers
91 */
92template <int dim>
94{
95public:
96 /**
97 * @brief Default destructor.
98 */
99 virtual ~TracerAssemblerDGCore() = default;
100
101 /**
102 * @brief Assembles the matrix
103 * @param[in] scratch_data (see base class)
104 * @param[in,out] copy_data (see base class)
105 */
106 virtual void
107 assemble_matrix(const TracerScratchData<dim> &scratch_data,
108 StabilizedMethodsCopyData &copy_data) override;
109
110
111 /**
112 * @brief Assembles the rhs
113 * @param[in] scratch_data (see base class)
114 * @param[in,out] copy_data (see base class)
115 */
116 virtual void
117 assemble_rhs(const TracerScratchData<dim> &scratch_data,
118 StabilizedMethodsCopyData &copy_data) override;
119};
120
121
122/**
123 * @brief Class that assembles the transient time arising from BDF time
124 * integration for the Tracer equations. For example, if a BDF1 scheme is
125 * chosen, the following is assembled
126 * \f$\frac{\mathbf{T}^{t+\Delta t}-\mathbf{T}^{t}}{\Delta t}\f$
127 *
128 * @tparam dim An integer that denotes the number of spatial dimensions
129 *
130 * @ingroup assemblers
131 */
132template <int dim>
134{
135public:
137 const std::shared_ptr<SimulationControl> &simulation_control)
139 {}
140
141 /**
142 * @brief Assembles the matrix
143 * @param[in] scratch_data (see base class)
144 * @param[in,out] copy_data (see base class)
145 */
146
147 virtual void
148 assemble_matrix(const TracerScratchData<dim> &scratch_data,
149 StabilizedMethodsCopyData &copy_data) override;
150
151 /**
152 * @brief Assembles the rhs
153 * @param[in] scratch_data (see base class)
154 * @param[in,out] copy_data (see base class)
155 */
156 virtual void
157 assemble_rhs(const TracerScratchData<dim> &scratch_data,
158 StabilizedMethodsCopyData &copy_data) override;
159
160 // The simulation control is a necessary part of the transient terms.
161 const std::shared_ptr<SimulationControl> simulation_control;
162};
163
164/**
165 * @brief Assembles the symmetric interior penalty (SIPG) method (or
166 * Nitsche's method) for internal faces. This assembler is only required
167 * when solving the Tracer equation using a discontinuous Galerkin
168 * discretization.
169 *
170 * @tparam dim An integer that denotes the number of spatial dimensions
171 *
172 * @ingroup assemblers
173 */
174template <int dim>
176{
177public:
179
180 /**
181 * @brief Interface for the call to matrix assembly
182 * @param[in] scratch_data Scratch data containing the Tracer
183 * information. It is important to note that the scratch data has to have been
184 * re-inited before calling for matrix assembly.
185 * @param[in,out] copy_data Destination where the local_rhs and local_matrix
186 * should be copied
187 */
188 virtual void
189 assemble_matrix(const TracerScratchData<dim> &scratch_data,
190 StabilizedDGMethodsCopyData &copy_data) override;
191
192
193 /**
194 * @brief Interface for the call to rhs
195 * @param[in] scratch_data Scratch data containing the Tracer
196 * information. It is important to note that the scratch data has to have been
197 * re-inited before calling for matrix assembly.
198 * @param[in,out] copy_data Destination where the local_rhs and local_matrix
199 * should be copied
200 */
201 virtual void
202 assemble_rhs(const TracerScratchData<dim> &scratch_data,
203 StabilizedDGMethodsCopyData &copy_data) override;
204};
205
206/**
207 * @brief Assembles Nitsche's method for boundary faces.
208 * This assembler is only required when solving the Tracer equation using a
209 * discontinuous Galerkin discretization since the boundary conditions have
210 * to be weakly imposed.
211 *
212 * @tparam dim An integer that denotes the number of spatial dimensions
213 *
214 * @ingroup assemblers
215 */
216template <int dim>
218{
219public:
222 &p_tracer_boundary_conditions)
223 : tracer_boundary_conditions(p_tracer_boundary_conditions)
224 {}
225
226 /**
227 * @brief Interface for the call to matrix assembly
228 * @param[in] scratch_data Scratch data containing the Tracer
229 * information. It is important to note that the scratch data has to have been
230 * re-inited before calling for matrix assembly.
231 * @param[in,out] copy_data Destination where the local_rhs and local_matrix
232 * should be copied
233 */
234 virtual void
235 assemble_matrix(const TracerScratchData<dim> &scratch_data,
236 StabilizedDGMethodsCopyData &copy_data) override;
237
238
239 /**
240 * @brief Interface for the call to rhs
241 * @param[in] scratch_data Scratch data containing the Tracer
242 * information. It is important to note that the scratch data has to have been
243 * re-inited before calling for matrix assembly.
244 * @param[in,out] copy_data Destination where the local_rhs and local_matrix
245 * should be copied
246 */
247 virtual void
248 assemble_rhs(const TracerScratchData<dim> &scratch_data,
249 StabilizedDGMethodsCopyData &copy_data) override;
250
252};
253
254/**
255 * @brief Class that assembles the reaction source term of the Tracer equation.
256 * It assembles the term:
257 * \f$ S = - R \= - k C \f$
258 * Where C is the tracer concentration and k is a reaction rate prefactor that
259 * changes depending on the underlying model. For power law of base rate
260 * $\alpha$ and order $n$, the model is: \f$ S = - R \= - (\alpha C^(n-1)) C \f$
261 *
262 * @tparam dim An integer that denotes the number of spatial dimensions
263 *
264 * @ingroup assemblers
265 */
266template <int dim>
268{
269public:
271 const std::shared_ptr<SimulationControl> &simulation_control)
273 {}
274
275 /**
276 * @brief Assembles the matrix
277 * @param[in] scratch_data (see base class)
278 * @param[in,out] copy_data (see base class)
279 */
280 virtual void
281 assemble_matrix(const TracerScratchData<dim> &scratch_data,
282 StabilizedMethodsCopyData &copy_data) override;
283
284 /**
285 * @brief Assembles the rhs
286 * @param[in] scratch_data (see base class)
287 * @param[in,out] copy_data (see base class)
288 */
289 virtual void
290 assemble_rhs(const TracerScratchData<dim> &scratch_data,
291 StabilizedMethodsCopyData &copy_data) override;
292
293 const std::shared_ptr<SimulationControl> simulation_control;
294};
295
296
297
298#endif
This class manages the boundary conditions for Tracer solver It introduces the boundary functions and...
Base class for assembler objects of physics and subequations.
Base class for assembler objects of physics and subequations that require a face assembly....
Responsible for storing the information calculated using the discontinuous galerkin (DG) assembly of ...
Definition copy_data.h:127
Class responsible for storing the information calculated using the assembly of stabilized scalar equa...
Definition copy_data.h:67
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_rhs(const TracerScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assembles the rhs.
TracerAssemblerBDF(const std::shared_ptr< SimulationControl > &simulation_control)
virtual void assemble_matrix(const TracerScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assembles the matrix.
BoundaryConditions::TracerBoundaryConditions< dim > tracer_boundary_conditions
TracerAssemblerBoundaryNitsche(const BoundaryConditions::TracerBoundaryConditions< dim > &p_tracer_boundary_conditions)
virtual void assemble_rhs(const TracerScratchData< dim > &scratch_data, StabilizedDGMethodsCopyData &copy_data) override
Interface for the call to rhs.
virtual void assemble_matrix(const TracerScratchData< dim > &scratch_data, StabilizedDGMethodsCopyData &copy_data) override
Interface for the call to matrix assembly.
TracerAssemblerCore(const std::shared_ptr< SimulationControl > &simulation_control)
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_rhs(const TracerScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assembles the rhs.
virtual void assemble_matrix(const TracerScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assembles the matrix.
Class that assembles the core (cells) of the Tracer equation for DG elements. This class assembles th...
virtual void assemble_rhs(const TracerScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assembles the rhs.
virtual void assemble_matrix(const TracerScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assembles the matrix.
virtual ~TracerAssemblerDGCore()=default
Default destructor.
virtual void assemble_matrix(const TracerScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assembles the matrix.
TracerAssemblerReaction(const std::shared_ptr< SimulationControl > &simulation_control)
virtual void assemble_rhs(const TracerScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assembles the rhs.
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_matrix(const TracerScratchData< dim > &scratch_data, StabilizedDGMethodsCopyData &copy_data) override
Interface for the call to matrix assembly.
TracerAssemblerSIPG()=default
virtual void assemble_rhs(const TracerScratchData< dim > &scratch_data, StabilizedDGMethodsCopyData &copy_data) override
Interface for the call to rhs.
Class that stores the information required by the assembly procedure for a Tracer advection-diffusion...
Simulation control classes for managing time-stepping and iteration control in Lethe.
PhysicsFaceAssemblerBase< TracerScratchData< dim >, StabilizedDGMethodsCopyData > TracerFaceAssemblerBase
A pure virtual class that serves as an interface for boundary and internal faces that occur when usin...
PhysicsAssemblerBase< TracerScratchData< dim >, StabilizedMethodsCopyData > TracerAssemblerBase
A pure virtual class that serves as an interface for all of the assemblers for the Tracer equation.