PolyDiM
C++ library for POLYtopal DIscretization Methods
Loading...
Searching...
No Matches
VEM_MCC_2D_Velocity_LocalSpace.hpp
Go to the documentation of this file.
1// _LICENSE_HEADER_
2//
3// Copyright (C) 2019 - 2025.
4// Terms register on the GPL-3.0 license.
5//
6// This file can be redistributed and/or modified under the license terms.
7//
8// See top level LICENSE file for more details.
9//
10// This file can be used citing references in CITATION.cff file.
11
12#ifndef __VEM_MCC_2D_Velocity_LocalSpace_HPP
13#define __VEM_MCC_2D_Velocity_LocalSpace_HPP
14
15#include "Eigen/Eigen"
18#include "Monomials_2D.hpp"
20#include "VEM_MCC_Utilities.hpp"
21#include <vector>
22
23namespace Polydim
24{
25namespace VEM
26{
27namespace MCC
28{
29
33{
34 private:
37
38 void InitializeProjectorsComputation(const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_ReferenceElement_Data &reference_element_data,
39 const unsigned int &numEdges,
40 const Eigen::Vector3d &polygonCentroid,
41 const double &polygonMeasure,
42 const double &polygonDiameter,
43 const Eigen::MatrixXd &internalQuadraturePoints,
44 const Eigen::VectorXd &internalQuadratureWeights,
45 const Eigen::MatrixXd &boundaryQuadraturePoints,
47
48 void ComputeL2Projectors(const double &polygonMeasure,
49 const Eigen::VectorXd &internalQuadratureWeights,
50 const Eigen::MatrixXd &B2Nabla,
52
53 void ComputeDivergenceCoefficients(const double &polytopeMeasure,
54 const Eigen::MatrixXd &W2,
56
57 void ComputeValuesOnBoundary(const Eigen::MatrixXd &polytopeVertices,
58 const Eigen::MatrixXd &edgeNormals,
59 const std::vector<bool> &edgeDirections,
60 const Eigen::VectorXd &boundaryQuadratureWeights,
61 Eigen::MatrixXd &W2,
62 Eigen::MatrixXd &B2Nabla,
64
65 void ComputePolynomialBasisDofs(const double &polytopeMeasure, Polydim::VEM::MCC::VEM_MCC_2D_Velocity_LocalSpace_Data &localSpace) const
66 {
67 localSpace.Dmatrix = utilities.ComputePolynomialBasisDofs(localSpace.Dimension,
68 polytopeMeasure,
69 localSpace.Order,
70 localSpace.Nk,
74 localSpace.NumBasisFunctions,
76 localSpace.Gmatrix);
77 };
78
79 public:
83
85 const Polydim::VEM::MCC::ProjectionTypes &projectionType) const
86 {
87 switch (projectionType)
88 {
90 return utilities.ComputeDofiDofiStabilizationMatrix(localSpace.Pi0k, localSpace.Measure, localSpace.Dmatrix);
91 default:
92 throw std::runtime_error("not valid projection type");
93 }
94 }
95
96 inline std::vector<Eigen::MatrixXd> ComputeBasisFunctionsValues(const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_LocalSpace_Data &localSpace,
97 const Polydim::VEM::MCC::ProjectionTypes &projectionType) const
98 {
99 switch (projectionType)
100 {
102 return utilities.ComputeBasisFunctionsValues(localSpace.Dimension, localSpace.Pi0k, localSpace.GkVanderInternal);
103 default:
104 throw std::runtime_error("not valid projectors");
105 }
106 }
107
108 inline std::vector<Eigen::MatrixXd> ComputeBasisFunctionsValues(
111 const Polydim::VEM::MCC::ProjectionTypes &projectionType,
112 const Eigen::MatrixXd &points) const
113 {
114 switch (projectionType)
115 {
116
118 const unsigned int numQuadrature = points.cols();
119
120 const Eigen::MatrixXd VanderInternalKp1 =
121 monomials.Vander(reference_element_data.MonomialsKp1, points, localSpace.Centroid, localSpace.Diameter);
122 const Eigen::MatrixXd VanderInternal = VanderInternalKp1.leftCols(localSpace.Nk);
123 Eigen::MatrixXd VanderInternal2k(localSpace.Dimension * localSpace.Nk, localSpace.Dimension * points.cols());
124 VanderInternal2k << VanderInternal.transpose(),
125 Eigen::MatrixXd::Zero(VanderInternal.cols(), VanderInternal.rows()),
126 Eigen::MatrixXd::Zero(VanderInternal.cols(), VanderInternal.rows()), VanderInternal.transpose();
127
128 const Eigen::MatrixXd GkNablaVanderInternal = localSpace.TkNabla * VanderInternal2k;
129 const Eigen::MatrixXd GkBigOPlusVanderInternal = localSpace.TkBigOPlus * VanderInternal2k;
130
131 Eigen::MatrixXd GkVanderInternal =
132 Eigen::MatrixXd::Zero(localSpace.Dimension * localSpace.Nk, localSpace.Dimension * numQuadrature);
133
134 GkVanderInternal << GkNablaVanderInternal, GkBigOPlusVanderInternal;
135
136 const Eigen::MatrixXd temp = GkVanderInternal.transpose() * localSpace.Pi0k;
137 std::vector<Eigen::MatrixXd> result(localSpace.Dimension,
138 Eigen::MatrixXd::Zero(localSpace.Dimension, localSpace.Pi0k.cols()));
139
140 for (unsigned int d = 0; d < localSpace.Dimension; d++)
141 result[d] = temp.middleRows(numQuadrature * d, numQuadrature);
142
143 return result;
144 }
145 default:
146 throw std::runtime_error("not valid projector type");
147 }
148 }
149
151 {
152 return localSpace.VanderInternal * localSpace.Vmatrix;
153 }
154
156 {
157 return localSpace.VanderInternal;
158 }
159
162 const Eigen::MatrixXd &points) const
163 {
164 return monomials.Vander(reference_element_data.MonomialsKp1, points, localSpace.Centroid, localSpace.Diameter)
165 .leftCols(localSpace.Nk);
166 }
167};
168} // namespace MCC
169} // namespace VEM
170} // namespace Polydim
171
172#endif
Definition Monomials_2D.hpp:22
Eigen::MatrixXd Vander(const Polydim::Utilities::Monomials_Data &data, const Eigen::MatrixXd &points, const Eigen::Vector3d &centroid, const double &diam) const
Definition Monomials_2D.hpp:55
Interface class for the velocity space of 2D Mixed Conforming Constant degree Virtual Element Methods...
Definition I_VEM_MCC_2D_Velocity_LocalSpace.hpp:30
Interface class for the velocity space of 2D Mixed Conforming Constant degree Virtual Element Methods...
Definition VEM_MCC_2D_Velocity_LocalSpace.hpp:33
Polydim::VEM::MCC::VEM_MCC_2D_Velocity_LocalSpace_Data CreateLocalSpace(const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_ReferenceElement_Data &reference_element_data, const Polydim::VEM::MCC::VEM_MCC_2D_Polygon_Geometry &polygon) const
Compute data of VEM space on a polygon.
Definition VEM_MCC_2D_Velocity_LocalSpace.cpp:25
Eigen::MatrixXd ComputePolynomialsValues(const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_LocalSpace_Data &localSpace) const
Compute values of the polynomial basis at default quadrature points.
Definition VEM_MCC_2D_Velocity_LocalSpace.hpp:155
std::vector< Eigen::MatrixXd > ComputeBasisFunctionsValues(const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_LocalSpace_Data &localSpace, const Polydim::VEM::MCC::ProjectionTypes &projectionType) const
Compute values of a suitable projection of basis functions at default quadrature points.
Definition VEM_MCC_2D_Velocity_LocalSpace.hpp:96
Eigen::MatrixXd ComputePolynomialsValues(const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_ReferenceElement_Data &reference_element_data, const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_LocalSpace_Data &localSpace, const Eigen::MatrixXd &points) const
Compute values of the polynomial basis at given points.
Definition VEM_MCC_2D_Velocity_LocalSpace.hpp:160
Eigen::MatrixXd ComputeDofiDofiStabilizationMatrix(const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_LocalSpace_Data &localSpace, const Polydim::VEM::MCC::ProjectionTypes &projectionType) const
Compute matrix representation of dofi-dofi stabilization.
Definition VEM_MCC_2D_Velocity_LocalSpace.hpp:84
Eigen::MatrixXd ComputeBasisFunctionsDivergenceValues(const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_LocalSpace_Data &localSpace) const
Compute values of the divergence of basis functions at default quadrature points.
Definition VEM_MCC_2D_Velocity_LocalSpace.hpp:150
std::vector< Eigen::MatrixXd > ComputeBasisFunctionsValues(const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_ReferenceElement_Data &reference_element_data, const Polydim::VEM::MCC::VEM_MCC_2D_Velocity_LocalSpace_Data &localSpace, const Polydim::VEM::MCC::ProjectionTypes &projectionType, const Eigen::MatrixXd &points) const
Definition VEM_MCC_2D_Velocity_LocalSpace.hpp:108
ProjectionTypes
Definition VEM_MCC_Utilities.hpp:25
Definition FEM_MCC_2D_LocalSpace.cpp:17
Definition VEM_MCC_2D_LocalSpace_Data.hpp:26
Definition VEM_MCC_2D_LocalSpace_Data.hpp:42
Eigen::MatrixXd VanderInternal
Definition VEM_MCC_2D_LocalSpace_Data.hpp:58
double Measure
Definition VEM_MCC_2D_LocalSpace_Data.hpp:70
unsigned int Dimension
Definition VEM_MCC_2D_LocalSpace_Data.hpp:45
unsigned int NumNablaInternalBasisFunctions
Definition VEM_MCC_2D_LocalSpace_Data.hpp:49
unsigned int NumBasisFunctions
Definition VEM_MCC_2D_LocalSpace_Data.hpp:53
Eigen::MatrixXd TkBigOPlus
Definition VEM_MCC_2D_LocalSpace_Data.hpp:82
Eigen::MatrixXd Dmatrix
Definition VEM_MCC_2D_LocalSpace_Data.hpp:94
unsigned int NumBigOPlusInternalBasisFunctions
Definition VEM_MCC_2D_LocalSpace_Data.hpp:51
Eigen::Vector3d Centroid
Definition VEM_MCC_2D_LocalSpace_Data.hpp:71
Eigen::MatrixXd Gmatrix
Definition VEM_MCC_2D_LocalSpace_Data.hpp:95
unsigned int Nk
Definition VEM_MCC_2D_LocalSpace_Data.hpp:78
unsigned int Order
Definition VEM_MCC_2D_LocalSpace_Data.hpp:43
Eigen::MatrixXd GkVanderBoundaryTimesNormal
Definition VEM_MCC_2D_LocalSpace_Data.hpp:84
double Diameter
Definition VEM_MCC_2D_LocalSpace_Data.hpp:69
Eigen::MatrixXd TkNabla
Definition VEM_MCC_2D_LocalSpace_Data.hpp:81
Eigen::MatrixXd GkVanderInternal
Definition VEM_MCC_2D_LocalSpace_Data.hpp:83
Eigen::MatrixXd Pi0k
Definition VEM_MCC_2D_LocalSpace_Data.hpp:65
unsigned int NumBoundaryBasisFunctions
Definition VEM_MCC_2D_LocalSpace_Data.hpp:47
Eigen::MatrixXd Vmatrix
Definition VEM_MCC_2D_LocalSpace_Data.hpp:97
Definition I_VEM_MCC_2D_ReferenceElement.hpp:45
Utilities::Monomials_Data MonomialsKp1
Definition I_VEM_MCC_2D_ReferenceElement.hpp:54
Definition VEM_MCC_Utilities.hpp:30
Eigen::MatrixXd ComputePolynomialBasisDofs(const unsigned int dimension, const double &polytopeMeasure, const unsigned int &order, const unsigned int &Nk, const unsigned int &NumBoundaryBasisFunctions, const unsigned int &NumNablaInternalBasisFunctions, const unsigned int &NumBigOPlusInternalBasisFunctions, const unsigned int &NumBasisFunctions, const Eigen::MatrixXd &GkVanderBoundaryTimesNormal, const Eigen::MatrixXd &Gmatrix) const
Definition VEM_MCC_Utilities.hpp:31
std::vector< Eigen::MatrixXd > ComputeBasisFunctionsValues(const unsigned int dimension, const Eigen::MatrixXd &projector, const Eigen::MatrixXd &GVander) const
Definition VEM_MCC_Utilities.hpp:226
Eigen::MatrixXd ComputeDofiDofiStabilizationMatrix(const Eigen::MatrixXd &projector, const double &coefficient, const Eigen::MatrixXd &DMatrix) const
Definition VEM_MCC_Utilities.hpp:57