88// License: geo_mechanics_application/license.txt
99//
1010// Main authors: Richard Faasse
11+ // Gennady Markelov
1112//
12- #include " line_interface_element .h"
13+ #include " interface_element .h"
1314
1415#include " custom_utilities/dof_utilities.h"
1516#include " custom_utilities/element_utilities.hpp"
1617#include " custom_utilities/equation_of_motion_utilities.h"
1718#include " custom_utilities/geometry_utilities.h"
1819#include " interface_stress_state.h"
1920#include " lobatto_integration_scheme.h"
21+ #include " lumped_integration_scheme.h"
2022
2123namespace
2224{
@@ -60,42 +62,54 @@ std::vector<Matrix> CalculateConstitutiveMatricesAtIntegrationPoints(
6062namespace Kratos
6163{
6264
63- LineInterfaceElement::LineInterfaceElement (IndexType NewId,
64- const Geometry<GeometricalObject::NodeType>::Pointer& rGeometry,
65- const Properties::Pointer& rProperties)
66- : Element(NewId, rGeometry, rProperties),
67- mIntegrationScheme (std::make_unique<LobattoIntegrationScheme>(GetGeometry().PointsNumber() / 2)),
68- mStressStatePolicy(std::make_unique<Line2DInterfaceStressState>())
65+ InterfaceElement::InterfaceElement (IndexType NewId,
66+ const Geometry<GeometricalObject::NodeType>::Pointer& rGeometry,
67+ const Properties::Pointer& rProperties,
68+ std::unique_ptr<StressStatePolicy> pStressStatePolicy)
69+ : Element(NewId, rGeometry, rProperties), mpStressStatePolicy(std::move(pStressStatePolicy))
6970{
71+ MakeIntegrationSchemeAndAssignFunction ();
7072}
7173
72- LineInterfaceElement::LineInterfaceElement (IndexType NewId, const GeometryType::Pointer& rGeometry)
73- : Element(NewId, rGeometry) ,
74- mIntegrationScheme( std::make_unique<LobattoIntegrationScheme>(GetGeometry().PointsNumber() / 2)),
75- mStressStatePolicy (std::make_unique<Line2DInterfaceStressState>( ))
74+ InterfaceElement::InterfaceElement (IndexType NewId,
75+ const GeometryType::Pointer& rGeometry,
76+ std::unique_ptr<StressStatePolicy> pStressStatePolicy)
77+ : Element(NewId, rGeometry), mpStressStatePolicy (std::move(pStressStatePolicy ))
7678{
79+ MakeIntegrationSchemeAndAssignFunction ();
7780}
7881
79- Element::Pointer LineInterfaceElement::Create (IndexType NewId,
80- const NodesArrayType& rNodes,
81- PropertiesType::Pointer pProperties) const
82+ void InterfaceElement::MakeIntegrationSchemeAndAssignFunction ()
83+ {
84+ if (GetGeometry ().LocalSpaceDimension () == 1 ) {
85+ mIntegrationScheme = std::make_unique<LobattoIntegrationScheme>(GetGeometry ().PointsNumber () / 2 );
86+ mfpCalculateRotationMatrix = GeometryUtilities::Calculate2DRotationMatrixForLineGeometry;
87+ } else {
88+ mIntegrationScheme = std::make_unique<LumpedIntegrationScheme>(GetGeometry ().PointsNumber () / 2 );
89+ mfpCalculateRotationMatrix = GeometryUtilities::Calculate3DRotationMatrixForPlaneGeometry;
90+ }
91+ }
92+
93+ Element::Pointer InterfaceElement::Create (IndexType NewId,
94+ const NodesArrayType& rNodes,
95+ PropertiesType::Pointer pProperties) const
8296{
8397 return Create (NewId, this ->GetGeometry ().Create (rNodes), pProperties);
8498}
8599
86- Element::Pointer LineInterfaceElement ::Create (IndexType NewId,
87- GeometryType::Pointer pGeometry,
88- PropertiesType::Pointer pProperties) const
100+ Element::Pointer InterfaceElement ::Create (IndexType NewId,
101+ GeometryType::Pointer pGeometry,
102+ PropertiesType::Pointer pProperties) const
89103{
90- return make_intrusive<LineInterfaceElement >(NewId, pGeometry, pProperties);
104+ return make_intrusive<InterfaceElement >(NewId, pGeometry, pProperties, mpStressStatePolicy-> Clone () );
91105}
92106
93- void LineInterfaceElement ::EquationIdVector (EquationIdVectorType& rResult, const ProcessInfo&) const
107+ void InterfaceElement ::EquationIdVector (EquationIdVectorType& rResult, const ProcessInfo&) const
94108{
95109 rResult = Geo::DofUtilities::ExtractEquationIdsFrom (GetDofs ());
96110}
97111
98- void LineInterfaceElement ::CalculateLeftHandSide (MatrixType& rLeftHandSideMatrix, const ProcessInfo&)
112+ void InterfaceElement ::CalculateLeftHandSide (MatrixType& rLeftHandSideMatrix, const ProcessInfo&)
99113{
100114 // Currently, the left-hand side matrix only includes the stiffness matrix. In the future, it
101115 // will also include water pressure contributions and coupling terms.
@@ -104,7 +118,7 @@ void LineInterfaceElement::CalculateLeftHandSide(MatrixType& rLeftHandSideMatrix
104118 CalculateConstitutiveMatricesAtIntegrationPoints (), CalculateIntegrationCoefficients ());
105119}
106120
107- void LineInterfaceElement ::CalculateRightHandSide (Element::VectorType& rRightHandSideVector, const ProcessInfo&)
121+ void InterfaceElement ::CalculateRightHandSide (Element::VectorType& rRightHandSideVector, const ProcessInfo&)
108122{
109123 // Currently, the right-hand side only includes the internal force vector. In the future, it
110124 // will also include water pressure contributions and coupling terms.
@@ -116,17 +130,17 @@ void LineInterfaceElement::CalculateRightHandSide(Element::VectorType& rRightHan
116130 local_b_matrices, tractions, integration_coefficients);
117131}
118132
119- void LineInterfaceElement ::CalculateLocalSystem (MatrixType& rLeftHandSideMatrix,
120- VectorType& rRightHandSideVector,
121- const ProcessInfo& rCurrentProcessInfo)
133+ void InterfaceElement ::CalculateLocalSystem (MatrixType& rLeftHandSideMatrix,
134+ VectorType& rRightHandSideVector,
135+ const ProcessInfo& rCurrentProcessInfo)
122136{
123137 CalculateLeftHandSide (rLeftHandSideMatrix, rCurrentProcessInfo);
124138 CalculateRightHandSide (rRightHandSideVector, rCurrentProcessInfo);
125139}
126140
127- void LineInterfaceElement ::CalculateOnIntegrationPoints (const Variable<Vector>& rVariable,
128- std::vector<Vector>& rOutput,
129- const ProcessInfo& rCurrentProcessInfo)
141+ void InterfaceElement ::CalculateOnIntegrationPoints (const Variable<Vector>& rVariable,
142+ std::vector<Vector>& rOutput,
143+ const ProcessInfo& rCurrentProcessInfo)
130144{
131145 if (rVariable == STRAIN) {
132146 const auto local_b_matrices = CalculateLocalBMatricesAtIntegrationPoints ();
@@ -140,22 +154,22 @@ void LineInterfaceElement::CalculateOnIntegrationPoints(const Variable<Vector>&
140154 }
141155}
142156
143- void LineInterfaceElement ::CalculateOnIntegrationPoints (const Variable<ConstitutiveLaw::Pointer>& rVariable,
144- std::vector<ConstitutiveLaw::Pointer>& rOutput,
145- const ProcessInfo&)
157+ void InterfaceElement ::CalculateOnIntegrationPoints (const Variable<ConstitutiveLaw::Pointer>& rVariable,
158+ std::vector<ConstitutiveLaw::Pointer>& rOutput,
159+ const ProcessInfo&)
146160{
147161 KRATOS_ERROR_IF_NOT (rVariable == CONSTITUTIVE_LAW)
148162 << " Cannot calculate on integration points: got unexpected variable " << rVariable.Name () << " \n " ;
149163
150164 rOutput = mConstitutiveLaws ;
151165}
152166
153- void LineInterfaceElement ::GetDofList (DofsVectorType& rElementalDofList, const ProcessInfo&) const
167+ void InterfaceElement ::GetDofList (DofsVectorType& rElementalDofList, const ProcessInfo&) const
154168{
155169 rElementalDofList = GetDofs ();
156170}
157171
158- void LineInterfaceElement ::Initialize (const ProcessInfo& rCurrentProcessInfo)
172+ void InterfaceElement ::Initialize (const ProcessInfo& rCurrentProcessInfo)
159173{
160174 Element::Initialize (rCurrentProcessInfo);
161175
@@ -170,7 +184,7 @@ void LineInterfaceElement::Initialize(const ProcessInfo& rCurrentProcessInfo)
170184 }
171185}
172186
173- int LineInterfaceElement ::Check (const ProcessInfo& rCurrentProcessInfo) const
187+ int InterfaceElement ::Check (const ProcessInfo& rCurrentProcessInfo) const
174188{
175189 int error = Element::Check (rCurrentProcessInfo);
176190 if (error != 0 ) return error;
@@ -189,30 +203,29 @@ int LineInterfaceElement::Check(const ProcessInfo& rCurrentProcessInfo) const
189203 return 0 ;
190204}
191205
192- Element::DofsVectorType LineInterfaceElement ::GetDofs () const
206+ Element::DofsVectorType InterfaceElement ::GetDofs () const
193207{
194208 const auto no_Pw_geometry_yet = Geometry<Node>{};
195209 return Geo::DofUtilities::ExtractUPwDofsFromNodes (GetGeometry (), no_Pw_geometry_yet,
196210 GetGeometry ().WorkingSpaceDimension ());
197211}
198212
199- std::vector<Matrix> LineInterfaceElement ::CalculateLocalBMatricesAtIntegrationPoints () const
213+ std::vector<Matrix> InterfaceElement ::CalculateLocalBMatricesAtIntegrationPoints () const
200214{
201215 const auto & r_integration_points = mIntegrationScheme ->GetIntegrationPoints ();
202216 const auto shape_function_values_at_integration_points =
203217 GeoElementUtilities::EvaluateShapeFunctionsAtIntegrationPoints (r_integration_points, GetGeometry ());
204218
205219 auto result = std::vector<Matrix>{};
206220 result.reserve (shape_function_values_at_integration_points.size ());
207- auto calculate_local_b_matrix = [&r_geometry = GetGeometry (), p_policy = mStressStatePolicy .get ()](
208- const auto & rShapeFunctionValuesAtIntegrationPoint,
209- const auto & rIntegrationPoint) {
221+ auto calculate_local_b_matrix = [&r_geometry = GetGeometry (), this ](const auto & rShapeFunctionValuesAtIntegrationPoint,
222+ const auto & rIntegrationPoint) {
210223 // For interface elements, the shape function gradients are not used, since these are
211224 // non-continuum elements. Therefore, we pass an empty matrix.
225+ const auto rotation_matrix = mfpCalculateRotationMatrix (r_geometry, rIntegrationPoint);
212226 const auto dummy_gradients = Matrix{};
213- return Matrix{prod (
214- GeometryUtilities::Calculate2DRotationMatrixForLineGeometry (r_geometry, rIntegrationPoint),
215- p_policy->CalculateBMatrix (dummy_gradients, rShapeFunctionValuesAtIntegrationPoint, r_geometry))};
227+ return Matrix{prod (rotation_matrix, mpStressStatePolicy->CalculateBMatrix (dummy_gradients, rShapeFunctionValuesAtIntegrationPoint,
228+ r_geometry))};
216229 };
217230 std::transform (shape_function_values_at_integration_points.begin (),
218231 shape_function_values_at_integration_points.end (), r_integration_points.begin (),
@@ -221,21 +234,20 @@ std::vector<Matrix> LineInterfaceElement::CalculateLocalBMatricesAtIntegrationPo
221234 return result;
222235}
223236
224- std::vector<double > LineInterfaceElement ::CalculateIntegrationCoefficients () const
237+ std::vector<double > InterfaceElement ::CalculateIntegrationCoefficients () const
225238{
226239 const auto determinants_of_jacobian = CalculateDeterminantsOfJacobiansAtIntegrationPoints (
227240 mIntegrationScheme ->GetIntegrationPoints (), GetGeometry ());
228241 return mIntegrationCoefficientsCalculator .Run <>(mIntegrationScheme ->GetIntegrationPoints (),
229242 determinants_of_jacobian, this );
230243}
231244
232- std::vector<Matrix> LineInterfaceElement ::CalculateConstitutiveMatricesAtIntegrationPoints ()
245+ std::vector<Matrix> InterfaceElement ::CalculateConstitutiveMatricesAtIntegrationPoints ()
233246{
234247 return ::CalculateConstitutiveMatricesAtIntegrationPoints (mConstitutiveLaws , GetProperties ());
235248}
236249
237- std::vector<Vector> LineInterfaceElement::CalculateRelativeDisplacementsAtIntegrationPoints (
238- const std::vector<Matrix>& rLocalBMatrices) const
250+ std::vector<Vector> InterfaceElement::CalculateRelativeDisplacementsAtIntegrationPoints (const std::vector<Matrix>& rLocalBMatrices) const
239251{
240252 const Geometry<Node> no_Pw_geometry;
241253 const auto dofs = Geo::DofUtilities::ExtractUPwDofsFromNodes (
@@ -255,7 +267,7 @@ std::vector<Vector> LineInterfaceElement::CalculateRelativeDisplacementsAtIntegr
255267 return result;
256268}
257269
258- std::vector<Vector> LineInterfaceElement ::CalculateTractionsAtIntegrationPoints (const std::vector<Vector>& rRelativeDisplacements)
270+ std::vector<Vector> InterfaceElement ::CalculateTractionsAtIntegrationPoints (const std::vector<Vector>& rRelativeDisplacements)
259271{
260272 // We have to make a copy of each relative displacement vector, since setting it at the
261273 // constitutive law parameters requires a reference to a _mutable_ object!
@@ -276,4 +288,9 @@ std::vector<Vector> LineInterfaceElement::CalculateTractionsAtIntegrationPoints(
276288 return result;
277289}
278290
291+ // Instances of this class can not be copied but can be moved. Check that at compile time.
292+ static_assert (!std::is_copy_constructible_v<InterfaceElement>);
293+ static_assert (!std::is_copy_assignable_v<InterfaceElement>);
294+ static_assert (std::is_move_constructible_v<InterfaceElement>);
295+ static_assert (std::is_move_assignable_v<InterfaceElement>);
279296} // namespace Kratos
0 commit comments