Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
solid_constraints.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_solid_constraints_h
5#define lethe_solid_constraints_h
6
7#include <deal.II/base/types.h>
8
9#include <deal.II/dofs/dof_handler.h>
10
11#include <deal.II/fe/fe_system.h>
12
13#include <deal.II/lac/affine_constraints.h>
14
15#include <vector>
16
17/**
18 * @brief Constrain velocity DOFs of a solid cell.
19 *
20 * @param [in] fe Finite element used to extract the different components.
21 * Inherently, we assume that this fe has dim+1 component and corresponds
22 * to a Navier-Stokes problem.
23 *
24 * @param[in] local_dof_indices Vector of a cell's local DOF indices.
25 *
26 * @param[in] non_zero_constraints If this parameter is true, it indicates
27 * that the constraints used are non-zero constraints. If
28 * this is set to false, the constraints are zero constraints.
29 *
30 * @param[out] constraints Homogeneous constraints holding object.
31 */
32template <int dim>
33void
35 const dealii::FiniteElement<dim> &fe,
36 const std::vector<dealii::types::global_dof_index> &local_dof_indices,
37 const bool &non_zero_constraints,
38 dealii::AffineConstraints<double> &constraints);
39
40/**
41 * @brief Turn regions of the mesh where the @p material_id>0 into a solid
42 * block by injecting velocity and pressure DOFs into the constraints.
43 *
44 * It is achieved by imposing \f$\mathbf{u}=0\f$ within the cells which have a
45 * @p material_id>0. In addition, solid cells which are not connected to the
46 * fluid by any means also get a pressure Dirichlet boundary condition which
47 * fixes the pressure to 0. It ensures that the linear system is well-posed.
48 * Right now, this routine only supports the usage of 1 solid domain, but
49 * eventually it could be extended to more than one. By default, the fluid
50 * domain is assumed to have a @p material_id=0 and the rest of the domains
51 * have a @p material_id>0.
52 *
53 * @param[in] dof_handler DoFHandler for which the solid region is
54 * established. In the majority of cases this is the DoFHandler that is a
55 * member of this class, but if a multigrid preconditioner, constraints must
56 * be built at every level. In this case, this DoFHandler can be the
57 * DoFHandler at any of the multigrid level.
58 *
59 *
60 * @param[in] locally_owned_dofs The locally owned DoFs for the dof_handler.
61 * Used to filter pressure DoFs that should receive a
62 * Dirichlet constraint when their cell is fully
63 * disconnected from the fluid.
64 *
65 * @param[in] non_zero_constraints If this parameter is true, it indicates
66 * that the constraints used for the solid domain are the non-zero constraints.
67 * If this is set to false, the constraints being used are zero constraints.
68 *
69 * @param[in] constraints Set of constraints on which the solid domain
70 * constraint is applied.
71 */
72template <int dim, typename DofsType>
73void
74establish_solid_domain(const dealii::DoFHandler<dim> &dof_handler,
75 const DofsType &locally_owned_dofs,
76 const bool non_zero_constraints,
77 dealii::AffineConstraints<double> &constraints);
78
79/**
80 * @brief Multigrid-level variant of establish_solid_domain for the local
81 * smoothing multigrid (LSMG) preconditioner.
82 *
83 * Unlike the active-cell version above, this overload walks the cells of a
84 * specific multigrid level using @p mg_cell_iterators_on_level and uses
85 * @p get_mg_dof_indices, so the DOF indices it adds to the constraint object
86 * match the multigrid-level IndexSet with which @p constraints was reinit'd
87 * (i.e. @p locally_owned_mg_dofs(level) and the corresponding locally
88 * relevant level DoFs). Using the active-cell version on an LSMG level
89 * constraint object triggers the @p local_lines.is_element(line_n) assertion
90 * inside @p AffineConstraints::add_line because active and MG DoF numberings
91 * are unrelated.
92 *
93 * The @p material_id is inherited from active cells by their parents on
94 * coarser levels, so the solid/fluid classification is well defined on MG
95 * levels.
96 *
97 * @param[in] dof_handler DoFHandler distributed with @p distribute_mg_dofs.
98 *
99 * @param[in] level Multigrid level on which constraints are built.
100 *
101 * @param[in] locally_owned_mg_dofs The locally owned MG DoFs on @p level
102 * (i.e. @p dof_handler.locally_owned_mg_dofs(level)). Used to filter pressure
103 * DoFs that should receive a Dirichlet constraint when their cell is fully
104 * disconnected from the fluid.
105 *
106 * @param[in] non_zero_constraints If true, set inhomogeneous (zero-valued)
107 * constraints; otherwise add homogeneous constraints.
108 *
109 * @param[in,out] constraints Level constraint object to populate.
110 */
111template <int dim>
112void
113establish_solid_domain_lsmg(const dealii::DoFHandler<dim> &dof_handler,
114 const unsigned int level,
115 const dealii::IndexSet &locally_owned_mg_dofs,
116 const bool non_zero_constraints,
117 dealii::AffineConstraints<double> &constraints);
118
119#endif
void establish_solid_domain(const dealii::DoFHandler< dim > &dof_handler, const DofsType &locally_owned_dofs, const bool non_zero_constraints, dealii::AffineConstraints< double > &constraints)
Turn regions of the mesh where the material_id>0 into a solid block by injecting velocity and pressur...
void establish_solid_domain_lsmg(const dealii::DoFHandler< dim > &dof_handler, const unsigned int level, const dealii::IndexSet &locally_owned_mg_dofs, const bool non_zero_constraints, dealii::AffineConstraints< double > &constraints)
Multigrid-level variant of establish_solid_domain for the local smoothing multigrid (LSMG) preconditi...
void constrain_solid_cell_velocity_dofs(const dealii::FiniteElement< dim > &fe, const std::vector< dealii::types::global_dof_index > &local_dof_indices, const bool &non_zero_constraints, dealii::AffineConstraints< double > &constraints)
Constrain velocity DOFs of a solid cell.