Template Class Inclusions¶
Defined in File inclusions.h
Inheritance Relationships¶
Base Type¶
public dealii::ParameterAcceptor
Class Documentation¶
-
template<int spacedim>
class Inclusions : public dealii::ParameterAcceptor¶ Class for handling inclusions in an immersed boundary method.
This class provides functionality for handling inclusions in an immersed boundary method. It stores the positions, radii, and Fourier coefficients of the inclusions, and provides methods for computing their normals, center, and direction. It also provides methods for initializing the inclusions from a file, setting up particles for the inclusions, and getting degrees of freedom associated with each inclusion.
Fourier coefficients
Data on the boundary of an inclusion (a circle in 2D, the cross-section of a cylinder in 3D) is represented in the Fourier basis
Fourier mode \(m\) is the constant for \(m=0\), \(\cos(k\theta)\) for \(m=2k-1\), and \(\sin(k\theta)\) for \(m=2k\). The basis functions are not normalized: each of them has maximum value one.\[ 1,\ \cos\theta,\ \sin\theta,\ \cos 2\theta,\ \sin 2\theta,\ \dots \]For a problem with
n_vector_componentscomponents, every mode is repeated once per component. A coefficient index \(c\) refers to Fourier mode \(c / n_{\text{vector components}}\) and vector component \(c \% n_{\text{vector components}}\). For example, in 3D the indices 0, 1, 2 are the constant mode in x, y, z, the indices 3, 4, 5 are \(\cos\theta\) in x, y, z, and the indices 6, 7, 8 are \(\sin\theta\) in x, y, z. The constant mode always has index 0, and every data line (from the “Data file” or the “Reference inclusion data”) uses this same indexing, starting from the constant mode.The coefficients in use are chosen with two parameters:
“Selection of Fourier coefficients”: an explicit list of coefficient indices. Each selected index becomes one degree of freedom of the Lagrange multiplier of each inclusion, in the order of the list.
”Number of fourier coefficients”: the number of coefficients in use.
initialize() combines them as follows:
Selection given, number 0: the selection is used, and the number is set to the size of the selection.
Selection given, number equal to its size: the selection is used.
Selection given, number different from its size: an exception is thrown.
No selection, number 0: no coefficients are used. The Lagrange multiplier has no degrees of freedom, and the inclusions do not couple to the bulk problem, even if inclusions and data are given. A message on rank zero reports this case when inclusions exist.
No selection, number \(N>0\): the indices \(0,\dots,N\,n_{\text{vector components}}-1\) are used, i.e., all vector components of the first \(N\) Fourier modes.
n_dofs_per_inclusion() always returns the number of coefficients in use. Code that groups the Lagrange multiplier by inclusion must use it rather than get_n_coefficients(): in the last case the two differ by a factor
n_vector_components.Public Functions
-
inline Inclusions(const unsigned int n_vector_components = 1)¶
Class for computing the inclusions of a given mesh.
- Parameters:
n_vector_components – Number of vector components.
-
inline types::global_dof_index n_dofs() const¶
Returns the number of degrees of freedom in the system.
- Returns:
The number of degrees of freedom.
-
inline types::global_dof_index n_particles() const¶
Returns the number of particles in the system.
- Returns:
The number of particles in the system.
-
inline types::global_dof_index n_inclusions() const¶
Returns the number of inclusions in the mesh.
- Returns:
The number of inclusions in the mesh.
-
inline unsigned int n_global_segments() const¶
-
inline unsigned int n_local_segments() const¶
-
inline unsigned int n_dofs_per_inclusion() const¶
Number of degrees of freedom associated to each inclusion.
This is the number of Fourier coefficients in use, i.e., the size of the selection after initialize(). It can be zero. See the class documentation for how the selection is built.
-
inline void initialize()¶
Reinit all reference points and normals, read the inclusions file and the data file, and build the selection of Fourier coefficients.
The selection is built from “Number of fourier coefficients” and “Selection of Fourier coefficients” as described in the class documentation. An explicit selection whose size differs from a nonzero number of coefficients throws an exception. An empty selection is replaced by all vector components of the first get_n_coefficients() modes, and an explicit selection with zero coefficients sets the number of coefficients to the size of the selection.
This function appends the inclusions read from file and fills the selection, so it must be called only once per set of parameters.
-
inline std::vector<types::global_dof_index> get_dof_indices(const types::global_dof_index &quadrature_id) const¶
Returns the degrees of freedom indices associated with a given quadrature point.
- Parameters:
quadrature_id – The global index of the quadrature point.
- Returns:
A vector containing the degrees of freedom indices.
-
inline void setup_inclusions_particles(const parallel::TriangulationBase<spacedim> &tria)¶
Sets up the inclusions particles for the given triangulation.
- Parameters:
tria – The triangulation to set up the inclusions particles for.
-
inline const IndexSet &locally_owned_source_inclusions() const¶
Source ownership is retained even when the center is outside.
-
inline IndexSet locally_owned_source_points() const¶
-
inline const std::vector<bool> &source_point_membership() const¶
Membership in locally_owned_source_points() order.
-
template<typename Callback>
inline void for_each_source_point(const Callback &callback) const¶ Visit the original source samples, including exterior points.
-
template<typename MatrixType>
inline void assemble_coupling_mass_matrix(MatrixType &matrix) const¶
-
template<typename MatrixType>
inline void assemble_overlap_mass_matrix(MatrixType &matrix) const¶
-
template<typename MatrixType>
inline void assemble_outside_mass_matrix(MatrixType &matrix) const¶
-
inline types::global_dof_index get_inclusion_id(const types::global_dof_index &quadrature_id) const¶
Quadrature id to inclusion id.
- Parameters:
quadrature_id –
- Returns:
const types::global_dof_index
-
inline unsigned int get_component(const types::global_dof_index &dof_index) const¶
Get the ith component for the given dof index.
- Parameters:
dof_index – A number in [0,n_dofs())
- Returns:
unsigned int The index of the current component
-
inline unsigned int get_fourier_component(const types::global_dof_index &dof_index) const¶
Get the ith Fourier component for the given dof index.
- Parameters:
dof_index – A number in [0,n_dofs())
- Returns:
unsigned int The index of the current component
-
inline double get_inclusion_data(const types::global_dof_index &inclusion_id, const types::global_dof_index &dof_index) const¶
Get the Fourier data for the given local dof index.
- Parameters:
inclusion_id – A number in [0,n_inclusions())
dof_index – A number in [0,n_dofs_per_inclusion())
- Returns:
unsigned int The index of the current component
-
inline double get_inclusion_data(const types::global_dof_index &inclusion_id, const types::global_dof_index &dof_index, const Point<spacedim> &point) const¶
Get the Fourier data for the given local dof index, computed at the given quadrature point.
- Parameters:
inclusion_id – A number in [0,n_inclusions())
dof_index – A number in [0,n_dofs_per_inclusion())
point – The inclusion quadrature point location
- Returns:
unsigned int The index of the current component
-
inline const Tensor<1, spacedim> &get_normal(const types::global_dof_index &quadrature_id) const¶
Get the normal.
- Parameters:
quadrature_id –
- Returns:
const Tensor<1, spacedim>&
-
inline double get_JxW(const types::global_dof_index &particle_id) const¶
return weight for integration normal direction of an inclusion at a quadrature point
- Parameters:
particle_id –
- Returns:
const Tensor<1, spacedim>&
-
inline const std::vector<double> &get_fe_values(const types::global_dof_index particle_id) const¶
Get a list of fe values.
- Parameters:
particle_id –
- Returns:
const std::vector<double>&
-
inline Point<spacedim> get_center(const types::global_dof_index &inclusion_id) const¶
Get the center of the inclusion.
- Parameters:
inclusion_id –
- Returns:
Point<spacedim>
-
inline double get_radius(const types::global_dof_index &inclusion_id) const¶
Get the radius of the inclusion.
- Parameters:
inclusion_id –
- Returns:
double
-
inline double get_section_measure(const types::global_dof_index &inclusion_id) const¶
Get the measure of the section of the inclusion.
- Parameters:
inclusion_id –
- Returns:
double
-
inline Tensor<1, spacedim> get_direction(const types::global_dof_index &inclusion_id) const¶
Get the direction of the inclusion.
- Parameters:
inclusion_id –
- Returns:
Tensor<1, spacedim>
-
inline Tensor<2, spacedim> get_rotation(const types::global_dof_index &inclusion_id) const¶
Get the rotation of the inclusion.
- Parameters:
inclusion_id –
- Returns:
Tensor<2, spacedim>
-
inline const std::vector<Point<spacedim>> &get_current_support_points(const types::global_dof_index &inclusion_id) const¶
Return support points of one inclusion in current configuration.
-
inline void output_particles(const std::string &filename) const¶
print the inclusions in parallel on a .vtu file
- Parameters:
filename –
-
inline void update_displacement_hdf5()¶
Update the displacement data after the initialization reading from a hdf5 file.
-
inline void update_inclusions_data(std::vector<double> new_data)¶
Update the displacement data after the initialization, 3D case only.
- Parameters:
new_data – vector of lenght equal to the number of inclusions or to the number of vessels, elements of the vector are the new values to be assigned for normal expansion
-
inline void update_inclusions_data(std::vector<std::vector<double>> new_data)¶
Update inclusion data by vessel-wise sampled profiles.
-
inline int get_vesselID(const types::global_dof_index &inclusion_id) const¶
3D return the vessel that a given inclusion belongs to, 2D return 0
- Parameters:
inclusion_id –
- Returns:
unsigned int of vessel id
-
inline void update_single_inclusion_data_along_normal(const types::global_dof_index &inclusion_id, const double nd)¶
Update one inclusion using a scalar normal-displacement value.
-
inline void update_single_vessel_data(const types::global_dof_index&, const std::vector<double>)¶
Placeholder for vessel-wise updates with vector-valued payloads.
-
inline unsigned int get_n_vessels() const¶
Return number of vessel currently detected.
-
inline unsigned int get_n_coefficients() const¶
Return the value of “Number of fourier coefficients”.
After initialize() this is the size of the selection when a selection was given, and the number of Fourier modes otherwise. In the second case each mode contributes
n_vector_componentscoefficients, so this is not the number of degrees of freedom per inclusion for vector problems. Use n_dofs_per_inclusion() for that.
-
inline unsigned int get_inclusions_in_vessel(unsigned int vessel_id) const¶
Return number of inclusions mapped to a given vessel id.
-
inline std::vector<unsigned int> get_selected_coefficients() const¶
Return the Fourier coefficient indices in use.
After initialize() this is the explicit selection, or the indices generated from get_n_coefficients() when no selection was given. Entry j is the coefficient of local degree of freedom j of each inclusion.
-
inline void set_n_q_points(unsigned int n_q)¶
-
inline void set_n_coefficients(unsigned int n_coefficients)¶
Set “Number of fourier coefficients”.
Call before initialize(). See the class documentation for how it combines with the selection.
-
inline void set_fourier_coefficients(std::vector<unsigned int> temp)¶
Set “Selection of Fourier coefficients”.
Call before initialize(). An empty vector means no explicit selection.
-
inline void build_segment_index_vector()¶
-
inline unsigned int get_segment_index(const types::global_dof_index &quadrature_id) const¶
-
inline std::vector<unsigned int> get_inclusions_in_a_segment(unsigned int segment_index) const¶
-
inline double get_average_vessel_radius(unsigned int vessel_id)¶
-
inline double get_vessel_length(unsigned int vessel_id)¶
Public Members
-
double modulation_frequency = 0.0¶
Frequency used to modulate inclusion boundary data in time.
-
double phase_shift = 0.0¶
-
Particles::ParticleHandler<spacedim> inclusions_as_particles¶
Particle representation of inclusion quadrature points.
-
std::vector<std::vector<double>> inclusions¶
-
std::string data_file = ""¶
Optional ASCII file containing coefficient data.
-
std::vector<std::vector<double>> inclusions_data¶
Per-inclusion coefficient vectors used by coupling assembly.
-
std::vector<double> reference_inclusion_data¶
Default coefficients replicated when no data file is provided.
-
std::map<unsigned int, std::vector<types::global_dof_index>> map_vessel_inclusions¶
Mapping from vessel id to indices of associated inclusions.
-
bool cluster_with_segments = false¶
Switch for the clustering of inclusions dofs into segments.
Friends
- friend class MatrixFreeCouplingOperator