14 #if !defined(KRATOS_GEO_STATIC_CONDENSATION_UTILITY_H_INCLUDED )
15 #define KRATOS_GEO_STATIC_CONDENSATION_UTILITY_H_INCLUDED
56 const std::vector<int> & rDofList)
59 const SizeType num_dofs_condensed = rDofList.size();
61 const double numerical_limit = std::numeric_limits<double>::epsilon();
68 KRATOS_ERROR_IF(std::abs(detK22) < numerical_limit) <<
"Element " << rTheElement.
Id()
69 <<
" is singular !" << std::endl;
72 K_temp =
prod(K_temp,sub_matrices[2]);
73 K_temp =
prod(sub_matrices[1],K_temp);
74 K_temp = sub_matrices[0]-K_temp;
78 rLeftHandSideMatrix.
clear();
84 dofA = remaining_dof_list[
i];
87 dofB = remaining_dof_list[
j];
88 rLeftHandSideMatrix(dofA,dofB) = K_temp(
i,
j);
104 const std::vector<int> & rDofList)
111 const SizeType num_dofs_condensed = rDofList.size();
114 KRATOS_ERROR_IF(num_dofs_remaining != remaining_dof_list.size()) <<
"unequal remaining dof size" << std::endl;
116 std::vector<MatrixType> sub_matrices(4);
117 sub_matrices[0] =
ZeroMatrix(num_dofs_remaining, num_dofs_remaining);
118 sub_matrices[1] =
ZeroMatrix(num_dofs_remaining, num_dofs_condensed);
119 sub_matrices[2] =
ZeroMatrix(num_dofs_condensed, num_dofs_remaining);
120 sub_matrices[3] =
ZeroMatrix(num_dofs_condensed, num_dofs_condensed);
123 remaining_dof_list, num_dofs_remaining, num_dofs_remaining);
126 rDofList, num_dofs_remaining, num_dofs_condensed);
129 remaining_dof_list, num_dofs_condensed, num_dofs_remaining);
132 rDofList, num_dofs_condensed, num_dofs_condensed);
146 const std::vector<int> & rDofList)
149 const SizeType num_dofs_condensed = rDofList.size();
152 std::vector<int> remaining_dofs_vec(0);
159 if (current_dof == rDofList[
j]) check =
true;
162 else remaining_dofs_vec.push_back(current_dof);
164 return remaining_dofs_vec;
182 const std::vector<int>& rVecA,
183 const std::vector<int>& rVecB,
193 current_dof_a = rVecA[
i];
196 current_dof_b = rVecB[
j];
197 Submatrix(
i,
j) = rLeftHandSideMatrix(current_dof_a, current_dof_b);
214 Vector& rLocalizedDofVector,
216 const std::vector<int>& rDofList,
220 const double numerical_limit = std::numeric_limits<double>::epsilon();
222 const SizeType num_dofs_condensed = rDofList.size();
226 const SizeType num_dofs_remaining = num_dofs_element - num_dofs_condensed;
235 for (
SizeType i=0;
i<num_dofs_remaining; ++
i) remaining_dofs_disp[
i] = rLocalizedDofVector[remaining_dof_list[
i]];
239 double detK22 = 0.00;
242 KRATOS_ERROR_IF(std::abs(detK22) < numerical_limit) <<
"Element " << rTheElement.
Id() <<
" is singular !" << std::endl;
246 CondensedDofsDisp =
prod(sub_matrices[2],remaining_dofs_disp);
247 CondensedDofsDisp = -
prod(K22_inv,CondensedDofsDisp);
251 for (
int i=0; i<static_cast<int>(num_dofs_element); ++
i)
257 if (
i == rDofList[
j])
259 rValues[
i] = CondensedDofsDisp[
j];
271 if (
i == remaining_dof_list[
j])
273 rValues[
i] = remaining_dofs_disp[
j];
292 return all_dof_values.size();
Base class for all Elements.
Definition: element.h:60
virtual void GetValuesVector(Vector &values, int Step=0) const
Definition: element.h:300
This utilitiy condenses given degrees of freedom from any element stiffness matrix to model e....
Definition: static_condensation_utility.h:40
Element ElementType
Definition: static_condensation_utility.h:42
static SizeType GetNumDofsElement(ElementType &rTheElement)
This function returns the number of dofs of the respective element by using the following input:
Definition: static_condensation_utility.h:288
Matrix MatrixType
Definition: static_condensation_utility.h:44
static void ConvertingCondensation(ElementType &rTheElement, Vector &rLocalizedDofVector, Vector &rValues, const std::vector< int > &rDofList, const MatrixType &rLeftHandSideMatrix)
This function re-calculates the condensed degree of freedom in relation to the remaining dofs by usin...
Definition: static_condensation_utility.h:212
static std::vector< MatrixType > CalculateSchurComplements(ElementType &rTheElement, const MatrixType &rLeftHandSideMatrix, const std::vector< int > &rDofList)
This function calculates the 4 schur-complements linking the dofs to be condensed to the dofs to rema...
Definition: static_condensation_utility.h:101
static void CondenseLeftHandSide(ElementType &rTheElement, MatrixType &rLeftHandSideMatrix, const std::vector< int > &rDofList)
This function is the main operation of this utility. It sorts the reference matrix w....
Definition: static_condensation_utility.h:53
static void FillSchurComplements(MatrixType &Submatrix, const MatrixType &rLeftHandSideMatrix, const std::vector< int > &rVecA, const std::vector< int > &rVecB, const SizeType &rSizeA, const SizeType &rSizeB)
This function creates the single schur-complements, called by CalculateSchurComplements,...
Definition: static_condensation_utility.h:179
std::size_t SizeType
Definition: static_condensation_utility.h:43
static std::vector< int > CreateRemainingDofList(ElementType &rTheElement, const std::vector< int > &rDofList)
This function creates a list containing all dofs to remain by using the following inputs:
Definition: static_condensation_utility.h:144
IndexType Id() const
Definition: indexed_object.h:107
void clear()
Definition: amatrix_interface.h:284
static BoundedMatrix< double, TDim, TDim > InvertMatrix(const BoundedMatrix< double, TDim, TDim > &rInputMatrix, double &rInputMatrixDet, const double Tolerance=ZeroTolerance)
Calculates the inverse of a 2x2, 3x3 and 4x4 matrices (using bounded matrix for performance)
Definition: math_utils.h:197
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
Internals::Matrix< double, AMatrix::dynamic, 1 > Vector
Definition: amatrix_interface.h:472
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
AMatrix::MatrixProductExpression< TExpression1Type, TExpression2Type > prod(AMatrix::MatrixExpression< TExpression1Type, TCategory1 > const &First, AMatrix::MatrixExpression< TExpression2Type, TCategory2 > const &Second)
Definition: amatrix_interface.h:568
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17