Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
ib_stencil.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_ib_stencil_h
5#define lethe_ib_stencil_h
6
7#include <core/ib_particle.h>
8
9#include <vector>
10
11using namespace dealii;
12
13/**
14 * @brief Define where the sharp immersed-boundaries are imposed on Eulerian grid.
15 *
16 * @tparam dim An integer that denotes the dimension of the space in which
17 * the flow is solved.
18 */
19template <int dim>
21{
22public:
23 /**
24 * @brief Return the number of points used by the interpolation stencil (excluding the
25 * dof itself) for a stencil of a given degree.
26 *
27 * @param[in] degree Stencil degree.
28 *
29 * @return Number of points used by the interpolation stencil.
30 */
31 virtual unsigned int
32 number_of_interpolation_support_points(const unsigned int degree);
33
34 /**
35 * @brief Find the DOF at which we try to apply the IB by interpolation
36 * and the location of the support points to do so.
37 *
38 * Define the points for the IB stencil, based on the degree and the particle
39 * position as well as the DOF position. Depending on the degree, the output
40 * variable "point" change definition. In the case of stencil degrees 1 to 4
41 * the variable point returns the position of the DOF directly. In the case of
42 * high degree stencil, it returns the position of the point that is on the
43 * IB. The variable "interpolation points" return the points used to define
44 * the cell used for the stencil definition and the locations of the points
45 * used in the stencil calculation.
46 *
47 * @param[in] degree Stencil degree.
48 *
49 * @param[in] length_ratio Length ratio between the 2 side of the stencil.
50 *
51 * @param[in] p IB particle that cuts the cell.
52 *
53 * @param[in] dof_point Support point of the DOF.
54 *
55 * @param[in] cell_guess Guess of the cell containing the evaluation point,
56 * which is useful to reduce computation time.
57 *
58 * @return Tuple containing (point, interpolation_points).
59 */
60 virtual std::tuple<Point<dim>, std::vector<Point<dim>>>
62 const unsigned int degree,
63 const double length_ratio,
65 const Point<dim> &dof_point,
66 const typename DoFHandler<dim>::active_cell_iterator &cell_guess);
67
68 /**
69 * @brief See overloaded function.
70 */
71 virtual std::tuple<Point<dim>, std::vector<Point<dim>>>
72 support_points_for_interpolation(const unsigned int degree,
73 const double length_ratio,
75 const Point<dim> &dof_point);
76
77 /**
78 * @brief Define the point used to define the cell used for the stencil calculation.
79 *
80 * @param[in] p IB particle that cuts the cell.
81 *
82 * @param[in] dof_point support point of the DOF.
83 *
84 * @param[in] cell_guess Guess of the cell containing the evaluation point,
85 * which is useful to reduce computation time.
86 */
87 virtual Point<dim>
90 const Point<dim> &dof_point,
91 const typename DoFHandler<dim>::active_cell_iterator &cell_guess);
92
93 /**
94 * @brief See overloaded function.
95 */
96 virtual Point<dim>
97 point_for_cell_detection(IBParticle<dim> &p, const Point<dim> &dof_point);
98
99 /**
100 * @brief Return the coefficients (weights) of the stencil.
101 *
102 * The coefficients of the IB stencil assume a length between the
103 * distance of the farthest interpolation point to the DOF, and the distance
104 * between the IB and the DOF of 1/8. The coefficients are defined from the
105 * coefficient of the DOF to the coefficient of the farthest interpolation
106 * point (sorted by increasing distance).
107 *
108 * @param[in] degree Stencil degree.
109 *
110 * @param[in] length_ratio Length ratio between the 2 side of the stencil.
111 */
112 virtual std::vector<double>
113 coefficients(const unsigned int degree, const double length_ratio);
114
115 /**
116 * @brief Return the velocity of the IB used in the RHS of the equation.
117 *
118 * @param[in] p IB particle that cuts the cell.
119 *
120 * @param[in] dof_point Support point of the DOF.
121 *
122 * @param[in] component Stencil component of the dof (vx=0,vy=1,vz=2).
123 *
124 * @param[in] cell_guess Guess of the cell containing the evaluation point,
125 * which is useful to reduce computation time.
126 */
127 virtual double
129 const Point<dim> &dof_point,
130 const unsigned int component,
131 const typename DoFHandler<dim>::active_cell_iterator &cell_guess);
132
133 /**
134 * @brief See overloaded function.
135 */
136 virtual double
138 const Point<dim> &dof_point,
139 const unsigned int component);
140
141private:
142 /**
143 * @brief Return the points on the reference 1D element for the polynomial base.
144 *
145 * @param[in] degree Degree of the stencil.
146 */
147 void
148 p_base(const unsigned int degree);
149
150 /**
151 * @brief Points of the reference 1D stencil.
152 */
153 std::vector<double> reference_points;
154};
155
156
157
158#endif // LETHE_IB_STENCILS_H
Define the behavior of a specific particle for the sharp interface IB solver.
Definition ib_particle.h:26
Define where the sharp immersed-boundaries are imposed on Eulerian grid.
Definition ib_stencil.h:21
void p_base(const unsigned int degree)
Return the points on the reference 1D element for the polynomial base.
Definition ib_stencil.cc:27
virtual std::tuple< Point< dim >, std::vector< Point< dim > > > support_points_for_interpolation(const unsigned int degree, const double length_ratio, IBParticle< dim > &p, const Point< dim > &dof_point, const typename DoFHandler< dim >::active_cell_iterator &cell_guess)
Find the DOF at which we try to apply the IB by interpolation and the location of the support points ...
Definition ib_stencil.cc:99
virtual double ib_velocity(IBParticle< dim > &p, const Point< dim > &dof_point, const unsigned int component, const typename DoFHandler< dim >::active_cell_iterator &cell_guess)
Return the velocity of the IB used in the RHS of the equation.
virtual std::vector< double > coefficients(const unsigned int degree, const double length_ratio)
Return the coefficients (weights) of the stencil.
Definition ib_stencil.cc:43
virtual Point< dim > point_for_cell_detection(IBParticle< dim > &p, const Point< dim > &dof_point, const typename DoFHandler< dim >::active_cell_iterator &cell_guess)
Define the point used to define the cell used for the stencil calculation.
virtual unsigned int number_of_interpolation_support_points(const unsigned int degree)
Return the number of points used by the interpolation stencil (excluding the dof itself) for a stenci...
Definition ib_stencil.cc:11
std::vector< double > reference_points
Points of the reference 1D stencil.
Definition ib_stencil.h:153