Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
cls_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_cls_assemblers_h
5#define lethe_cls_assemblers_h
6
8
10#include <solvers/copy_data.h>
12
13/**
14 * @brief A pure virtual class that serves as an interface for all
15 * of the assemblers for the CLS solver.
16 *
17 * @tparam dim Integer that denotes the number of spatial dimensions.
18 *
19 * @ingroup assemblers
20 */
21template <int dim>
24
25/**
26 * @brief A pure virtual class that serves as an interface for all
27 * the assemblers for the CLS solver on internal faces.
28 *
29 * @tparam dim Integer that denotes the number of spatial dimensions.
30 *
31 * @ingroup assemblers
32 */
33template <int dim>
36
37
38/**
39 * @brief A pure virtual class that serves as an interface for all
40 * of the assemblers for CLS subequation solvers.
41 *
42 * @tparam dim Integer that denotes the number of spatial dimensions.
43 *
44 * @tparam ScratchDataType Type of scratch data object used for linear system
45 * assembly.
46 *
47 *
48 * @ingroup assemblers
49 */
50template <typename ScratchDataType>
53
54/**
55 * @brief Class that assembles the core of the CLS solver.
56 * According to the following weak form:
57 * \f$\mathbf{u} \cdot T \cdot \nabla T =0 \f$ with an SUPG
58 * stabilization
59 *
60 * @tparam dim An integer that denotes the number of spatial dimensions
61 *
62 * @ingroup assemblers
63 */
64template <int dim>
66{
67public:
76
77 /**
78 * @brief assemble_matrix Assembles the matrix
79 * @param scratch_data (see base class)
80 * @param copy_data (see base class)
81 */
82 virtual void
83 assemble_matrix(const CLSScratchData<dim> &scratch_data,
84 StabilizedMethodsCopyData &copy_data) override;
85
86
87 /**
88 * @brief assemble_rhs Assembles the rhs
89 * @param scratch_data (see base class)
90 * @param copy_data (see base class)
91 */
92 virtual void
93 assemble_rhs(const CLSScratchData<dim> &scratch_data,
94 StabilizedMethodsCopyData &copy_data) override;
95
96 const std::shared_ptr<SimulationControl> simulation_control;
99
100 // Controls if the compressibility term is assembled in the CLS equation
101 const bool compressible;
102};
103
104
105/**
106 * @brief Class that assembles the transient time arising from BDF time
107 * integration for the CLS equation. For example, if a BDF1 scheme is
108 * chosen, the following is assembled
109 * \f$\frac{\mathbf{T}^{t+\Delta t}-\mathbf{T}^{t}}{\Delta t}\f$
110 *
111 * @tparam dim An integer that denotes the number of spatial dimensions
112 *
113 * @ingroup assemblers
114 */
115template <int dim>
117{
118public:
119 CLSAssemblerBDF(const std::shared_ptr<SimulationControl> &simulation_control)
121 {}
122
123 /**
124 * @brief assemble_matrix Assembles the matrix
125 * @param scratch_data (see base class)
126 * @param copy_data (see base class)
127 */
128
129 virtual void
130 assemble_matrix(const CLSScratchData<dim> &scratch_data,
131 StabilizedMethodsCopyData &copy_data) override;
132
133 /**
134 * @brief assemble_rhs Assembles the rhs
135 * @param scratch_data (see base class)
136 * @param copy_data (see base class)
137 */
138 virtual void
139 assemble_rhs(const CLSScratchData<dim> &scratch_data,
140 StabilizedMethodsCopyData &copy_data) override;
141
142 const std::shared_ptr<SimulationControl> simulation_control;
143};
144
145
146/**
147 * @brief Assemble the Discontinuity-Capturing Directional Dissipation (DCDD)
148 * stabilization term for the CLS phase indicator.
149 *
150 * @note For more information see Tezduyar, T. E. (2003). Computation of
151 * moving boundaries and interfaces and stabilization parameters. International
152 * Journal for Numerical Methods in Fluids, 43(5), 555-575. The implementation
153 * is based on equations (70) and (79), which are adapted for the CLS solver.
154 *
155 * @tparam dim Integer that denotes the number of spatial dimensions.
156 *
157 * @ingroup assemblers
158 */
159template <int dim>
161{
162public:
163 /**
164 * @brief Default constructor of the assembler.
165 *
166 * @param[in] simulation_control SimulationControl object that holds
167 * information related to the control of the steady-state or transient
168 * simulation. This is used to extrapolate velocity solutions in time for
169 * transient simulations.
170 *
171 * @param[in] stabilization_parameters Parameters for the stabilization to
172 * get the value of the diffusion coefficient.
173 */
175 const std::shared_ptr<SimulationControl> &simulation_control,
176 const Parameters::Stabilization &stabilization_parameters)
178 , diffusion_constant(stabilization_parameters.dcdd_diffusion_coeff)
179 {}
180
181 /**
182 * @brief Assemble the matrix
183 *
184 * @param[in] scratch_data (see base class).
185 *
186 * @param[in,out] copy_data (see base class).
187 */
188 virtual void
189 assemble_matrix(const CLSScratchData<dim> &scratch_data,
190 StabilizedMethodsCopyData &copy_data) override;
191
192 /**
193 * @brief Assemble the right-hand side (rhs).
194 *
195 * @param[in] scratch_data (see base class)
196 *
197 * @param[in,out] copy_data (see base class)
198 */
199 virtual void
200 assemble_rhs(const CLSScratchData<dim> &scratch_data,
201 StabilizedMethodsCopyData &copy_data) override;
202
203 const std::shared_ptr<SimulationControl> simulation_control;
204
205 /// Diffusion coefficient
206 const double diffusion_constant;
207};
208
209
210/**
211 * @brief Class that assembles the core (cells) of the CLS equation for DG elements.
212 * This class assembles the weak form of:
213 * \f$\mathbf{u} \cdot \nabla \phi = 0 \f$
214 *
215 * @tparam dim An integer that denotes the number of spatial dimensions
216 *
217 * @ingroup assemblers
218 */
219template <int dim>
221{
222public:
224
225 /**
226 * @brief Assemble the matrix
227 * @param[in] scratch_data (see base class)
228 * @param[in,out] copy_data (see base class)
229 */
230 virtual void
231 assemble_matrix(const CLSScratchData<dim> &scratch_data,
232 StabilizedMethodsCopyData &copy_data) override;
233
234
235 /**
236 * @brief Assemble the rhs
237 * @param[in] scratch_data (see base class)
238 * @param[in,out] copy_data (see base class)
239 */
240 virtual void
241 assemble_rhs(const CLSScratchData<dim> &scratch_data,
242 StabilizedMethodsCopyData &copy_data) override;
243};
244
245
246/**
247 * @brief Assembles the symmetric interior penalty Galerkin (SIPG) method (or
248 * Nitsche's method) for internal faces. This assembler is only required
249 * when solving the CLS equation using a discontinuous Galerkin
250 * discretization.
251 *
252 * @tparam dim An integer that denotes the number of spatial dimensions
253 *
254 * @ingroup assemblers
255 */
256template <int dim>
258{
259public:
260 CLSAssemblerSIPG() = default;
261
262 /**
263 * @brief Interface to call the matrix assembly
264 * @param[in] scratch_data Scratch data containing the CLS
265 * information. It is important to note that the scratch data has to have been
266 * re-inited before calling for matrix assembly.
267 * @param[in,out] copy_data Destination where the local_rhs and local_matrix
268 * should be copied.
269 */
270 virtual void
271 assemble_matrix(const CLSScratchData<dim> &scratch_data,
272 StabilizedDGMethodsCopyData &copy_data) override;
273
274
275 /**
276 * @brief Interface for the call to rhs
277 * @param[in] scratch_data Scratch data containing the CLS
278 * information. It is important to note that the scratch data has to have been
279 * re-inited before calling for matrix assembly.
280 * @param[in,out] copy_data Destination where the local_rhs and local_matrix
281 * should be copied.
282 */
283 virtual void
284 assemble_rhs(const CLSScratchData<dim> &scratch_data,
285 StabilizedDGMethodsCopyData &copy_data) override;
286};
287
288
289#endif
virtual void assemble_rhs(const CLSScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
assemble_rhs Assembles the rhs
const std::shared_ptr< SimulationControl > simulation_control
virtual void assemble_matrix(const CLSScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
assemble_matrix Assembles the matrix
CLSAssemblerBDF(const std::shared_ptr< SimulationControl > &simulation_control)
const Parameters::CLS cls_parameters
const bool compressible
const std::shared_ptr< SimulationControl > simulation_control
const Parameters::FEM fem_parameters
CLSAssemblerCore(const std::shared_ptr< SimulationControl > &simulation_control, const Parameters::FEM fem_parameters, const Parameters::CLS cls_parameters)
virtual void assemble_matrix(const CLSScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
assemble_matrix Assembles the matrix
virtual void assemble_rhs(const CLSScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
assemble_rhs Assembles the rhs
const std::shared_ptr< SimulationControl > simulation_control
const double diffusion_constant
Diffusion coefficient.
virtual void assemble_matrix(const CLSScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assemble the matrix.
CLSAssemblerDCDDStabilization(const std::shared_ptr< SimulationControl > &simulation_control, const Parameters::Stabilization &stabilization_parameters)
Default constructor of the assembler.
virtual void assemble_rhs(const CLSScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assemble the right-hand side (rhs).
virtual void assemble_rhs(const CLSScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assemble the rhs.
CLSAssemblerDGCore()=default
virtual void assemble_matrix(const CLSScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data) override
Assemble the matrix.
CLSAssemblerSIPG()=default
virtual void assemble_matrix(const CLSScratchData< dim > &scratch_data, StabilizedDGMethodsCopyData &copy_data) override
Interface to call the matrix assembly.
virtual void assemble_rhs(const CLSScratchData< dim > &scratch_data, StabilizedDGMethodsCopyData &copy_data) override
Interface for the call to rhs.
Store the information required by the assembly procedure for a CLS free surface equation....
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
PhysicsAssemblerBase< ScratchDataType, StabilizedMethodsCopyData > CLSSubequationAssemblerBase
A pure virtual class that serves as an interface for all of the assemblers for CLS subequation solver...
PhysicsAssemblerBase< CLSScratchData< dim >, StabilizedMethodsCopyData > CLSAssemblerBase
A pure virtual class that serves as an interface for all of the assemblers for the CLS solver.
PhysicsFaceAssemblerBase< CLSScratchData< dim >, StabilizedDGMethodsCopyData > CLSFaceAssemblerBase
A pure virtual class that serves as an interface for all the assemblers for the CLS solver on interna...
Simulation control classes for managing time-stepping and iteration control in Lethe.
CLS - Defines the parameters for free surface simulations using the CLS method. Has to be declared be...
FEM - The finite element section controls the properties of the finite element method....
Stabilization - Defines parameters for an advanced control over the stabilization strategy used by th...
Definition parameters.h:988