v0.13.2
Loading...
Searching...
No Matches
MortarContactProblem.hpp
Go to the documentation of this file.
1/* This file is part of MoFEM.
2 * MoFEM is free software: you can redistribute it and/or modify it under
3 * the terms of the GNU Lesser General Public License as published by the
4 * Free Software Foundation, either version 3 of the License, or (at your
5 * option) any later version.
6 *
7 * MoFEM is distributed in the hope that it will be useful, but WITHOUT
8 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10 * License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
14
15#ifndef __MORTAR_CONTACT_PROBLEM_HPP__
16#define __MORTAR_CONTACT_PROBLEM_HPP__
17
19
20 using ContactOp = ContactPrismElementForcesAndSourcesCore::UserDataOperator;
21
23 Range pRisms; // All boundary surfaces
24 };
25
26 map<int, MortarContactPrismsData>
27 setOfMortarContactPrism; ///< maps side set id with appropriate FluxData
28
32 boost::shared_ptr<ContactSearchKdTree::ContactCommonData_multiIndex>
34
37 MoFEM::Interface &m_field,
38 boost::shared_ptr<ContactSearchKdTree::ContactCommonData_multiIndex>
39 contact_commondata_multi_index,
40 std::string spat_pos, std::string mat_pos, bool newton_cotes = false)
42 m_field, spat_pos, mat_pos, newton_cotes),
43 mField(m_field),
44 contactCommondataMultiIndex(contact_commondata_multi_index),
45 newtonCotes(newton_cotes) {}
46
47 int getRule(int order) { return -1; };
48
49 // function to calculate area of triangle (copy from moab/CslamUtils.cpp)
50 inline double area2D(double *a, double *b, double *c) {
51 // (b-a)x(c-a) / 2
52 return ((b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0])) /
53 2;
54 }
55 virtual MoFEMErrorCode setGaussPts(int order);
56
57 // Destructor
59 };
60
63
64 boost::shared_ptr<VectorDouble> referenceGapPtr;
65 boost::shared_ptr<MatrixDouble> referencePositionAtGaussPtsMasterPtr;
66 boost::shared_ptr<MatrixDouble> referencePositionAtGaussPtsSlavePtr;
67
71 mField(m_field) {
73 referenceGapPtr = boost::make_shared<VectorDouble>();
74 referencePositionAtGaussPtsMasterPtr = boost::make_shared<MatrixDouble>();
75 referencePositionAtGaussPtsSlavePtr = boost::make_shared<MatrixDouble>();
76 }
77
78 private:
80 };
81
83
84 static double lAmbda;
85
86 MoFEMErrorCode scaleNf(const FEMethod *fe, VectorDouble &nf) {
88 nf *= lAmbda;
90 }
91 };
92
94 const string element_name, const string field_name,
95 const string lagrange_field_name, Range &range_slave_master_prisms,
96 string material_position_field_name = "MESH_NODE_POSITIONS",
97 bool eigen_pos_flag = false,
98 const string eigen_node_field_name = "EIGEN_SPATIAL_POSITIONS") {
100
102
103 if (range_slave_master_prisms.size() > 0) {
104
106 lagrange_field_name);
107
109 field_name);
110
112 lagrange_field_name);
114 field_name);
115
117 lagrange_field_name);
118
120 field_name);
121
122 if (eigen_pos_flag)
124 element_name, eigen_node_field_name);
125
126 CHKERR
128 "MESH_NODE_POSITIONS");
129
130 setOfMortarContactPrism[1].pRisms = range_slave_master_prisms;
131
132 // Adding range_slave_master_prisms to Element element_name
133 mField.add_ents_to_finite_element_by_type(range_slave_master_prisms,
134 MBPRISM, element_name);
135 }
136
138 }
139
140 /**
141 * @brief Function that adds field data for spatial positions and Lagrange
142 * multipliers to rows and columns, provides access to field data and adds
143 * prism entities to element.
144 *
145 * @param element_name String for the element name
146 * @param field_name String of field name for spatial
147 * position
148 * @param lagrange_field_name String of field name for Lagrange
149 * multipliers
150 * @param mesh_node_field_name String of field name for material
151 * positions
152 * @param range_slave_master_prisms Range for prism entities used to create
153 * contact elements
154 * @return Error code
155 *
156 */
157 MoFEMErrorCode addMortarContactElementALE(const string element_name,
158 const string field_name,
159 const string mesh_node_field_name,
160 const string lagrange_field_name,
161 Range &range_slave_master_prisms) {
163
165
166 if (range_slave_master_prisms.size() > 0) {
167
169 lagrange_field_name);
170
172 field_name);
174 mesh_node_field_name);
175
177 lagrange_field_name);
179 field_name);
181 mesh_node_field_name);
182
184 lagrange_field_name);
185
187 field_name);
188
190 mesh_node_field_name);
191
192 setOfSimpleContactPrism[1].pRisms = range_slave_master_prisms;
193
194 Range ents_to_add = range_slave_master_prisms;
195 Range current_ents_with_fe;
197 current_ents_with_fe);
198 Range ents_to_remove;
199 ents_to_remove = subtract(current_ents_with_fe, ents_to_add);
201 ents_to_remove);
203 element_name);
204 }
205
207 }
208
210 const string element_name, const string field_name,
211 const string lagrange_field_name, const string prev_conv_field_name,
212 const string tangent_lagrange_field_name,
213 Range &range_slave_master_prisms,
214 string material_position_field_name = "MESH_NODE_POSITIONS") {
216
218
219 //============================================================================================================
220 // C row as Lagrange_mul and col as DISPLACEMENT
221
223 lagrange_field_name);
224
226
227 // CT col as Lagrange_mul and row as DISPLACEMENT
228
230 lagrange_field_name);
231
233
234 // data
236 lagrange_field_name);
237
239 field_name);
240
241 CHKERR
243 "MESH_NODE_POSITIONS");
244
245 CHKERR
247 prev_conv_field_name);
248
249 setOfMortarContactPrism[1].pRisms = range_slave_master_prisms;
250 mField.add_ents_to_finite_element_by_type(range_slave_master_prisms,
251 MBPRISM, element_name);
252
254 }
255
256 double cnValue;
257 boost::shared_ptr<double> cnValuePtr;
258
260 boost::shared_ptr<ContactSearchKdTree::ContactCommonData_multiIndex>
263
265 MoFEM::Interface &m_field,
266 boost::shared_ptr<ContactSearchKdTree::ContactCommonData_multiIndex>
267 contact_commondata_multi_index,
268 boost::shared_ptr<double> cn_value_ptr, bool newton_cotes = false)
269 : SimpleContactProblem(m_field, cn_value_ptr, newton_cotes),
270 mField(m_field),
271 contactCommondataMultiIndex(contact_commondata_multi_index),
272 cnValuePtr(cn_value_ptr), newtonCotes(newton_cotes) {
273 cnValue = *cnValuePtr.get();
274 }
275
276 /**
277 * @brief Element used to integrate on slave surfaces. It convects integration
278 * points on slaves, so that quantities like gap from master are evaluated at
279 * correct points.
280 *
281 */
283
285 MoFEM::Interface &m_field,
286 boost::shared_ptr<ContactSearchKdTree::ContactCommonData_multiIndex>
287 contact_commondata_multi_index,
288 std::string spat_pos, std::string mat_pos, bool newton_cotes = false)
289 : MortarContactElement(m_field, contact_commondata_multi_index,
290 spat_pos, mat_pos, newton_cotes),
291 convectPtr(new ConvectSlaveIntegrationPts(this, spat_pos, mat_pos)) {}
292
293 inline boost::shared_ptr<ConvectSlaveIntegrationPts> getConvectPtr() {
294 return convectPtr;
295 }
296
297 int getRule(int order) { return -1; }
298
299 MoFEMErrorCode setGaussPts(int order);
300
301 protected:
302 boost::shared_ptr<ConvectSlaveIntegrationPts> convectPtr;
303 };
304
305 /**
306 * @brief Element used to integrate on master surfaces. It convects
307 * integration points on slaves, so that quantities like Lagrange multiplier
308 * from master are evaluated at correct points.
309 *
310 */
314
315 int getRule(int order) { return -1; }
316
317 MoFEMErrorCode setGaussPts(int order);
318 };
319
320 MoFEMErrorCode setContactOperatorsRhs(
321 boost::shared_ptr<MortarContactElement> fe_rhs_mortar_contact,
322 boost::shared_ptr<CommonDataMortarContact> common_data_mortar_contact,
323 string field_name, string lagrange_field_name, bool is_alm = false,
324 bool is_eigen_pos_field = false,
325 string eigen_pos_field_name = "EIGEN_SPATIAL_POSITIONS",
326 bool use_reference_coordinates = false);
327
328 MoFEMErrorCode setMasterForceOperatorsRhs(
329 boost::shared_ptr<MortarContactElement> fe_rhs_mortar_contact,
330 boost::shared_ptr<CommonDataMortarContact> common_data_mortar_contact,
331 string field_name, string lagrange_field_name, bool is_alm = false,
332 bool is_eigen_pos_field = false,
333 string eigen_pos_field_name = "EIGEN_SPATIAL_POSITIONS",
334 bool use_reference_coordinates = false);
335
336 MoFEMErrorCode setContactOperatorsLhs(
337 boost::shared_ptr<MortarContactElement> fe_lhs_mortar_contact,
338 boost::shared_ptr<CommonDataMortarContact> common_data_mortar_contact,
339 string field_name, string lagrange_field_name, bool is_alm = false,
340 bool is_eigen_pos_field = false,
341 string eigen_pos_field_name = "EIGEN_SPATIAL_POSITIONS",
342 bool use_reference_coordinates = false);
343
344 MoFEMErrorCode setContactOperatorsLhs(
345 boost::shared_ptr<MortarConvectMasterContactElement>
346 fe_lhs_simple_contact,
347 boost::shared_ptr<CommonDataMortarContact> common_data_simple_contact,
348 string field_name, string lagrange_field_name, bool is_alm = false,
349 bool is_eigen_pos_field = false,
350 string eigen_pos_field_name = "EIGEN_SPATIAL_POSITIONS",
351 bool use_reference_coordinates = false);
352
353 MoFEMErrorCode setMasterForceOperatorsLhs(
354 boost::shared_ptr<MortarContactElement> fe_lhs_mortar_contact,
355 boost::shared_ptr<CommonDataMortarContact> common_data_mortar_contact,
356 string field_name, string lagrange_field_name, bool is_alm = false,
357 bool is_eigen_pos_field = false,
358 string eigen_pos_field_name = "EIGEN_SPATIAL_POSITIONS",
359 bool use_reference_coordinates = false);
360
361 MoFEMErrorCode setMasterForceOperatorsLhs(
362 boost::shared_ptr<MortarConvectSlaveContactElement> fe_lhs_mortar_contact,
363 boost::shared_ptr<CommonDataMortarContact> common_data_mortar_contact,
364 string field_name, string lagrange_field_name, bool is_alm = false,
365 bool is_eigen_pos_field = false,
366 string eigen_pos_field_name = "EIGEN_SPATIAL_POSITIONS",
367 bool use_reference_coordinates = false);
368
369 MoFEMErrorCode setContactOperatorsForPostProc(
370 boost::shared_ptr<MortarContactElement> fe_post_proc_mortar_contact,
371 boost::shared_ptr<CommonDataMortarContact> common_data_mortar_contact,
372 MoFEM::Interface &m_field, string field_name, string lagrange_field_name,
373 moab::Interface &moab_out, bool alm_flag = false,
374 bool is_eigen_pos_field = false,
375 string eigen_pos_field_name = "EIGEN_SPATIAL_POSITIONS",
376 bool is_displacements = false, Range post_proc_surface = Range(),
377 double post_proc_gap_tol = 0.0);
378
379 /**
380 * @brief Function for the mortar contact element that sets the user data
381 * post processing operators
382 *
383 * @param fe_post_proc_simple_contact Pointer to the FE instance for post
384 * processing
385 * @param common_data_simple_contact Pointer to the common data for
386 * mortar contact element
387 * @param field_name String of field name for spatial
388 * positions
389 * @param mesh_node_field_name String of field name for material
390 * positions
391 * @param lagrange_field_name String of field name for Lagrange
392 * multipliers
393 * @param side_fe_name String of 3D element adjacent to
394 * the present contact element
395 * @return Error code
396 *
397 */
399 boost::shared_ptr<MortarContactElement> fe_rhs_simple_contact_ale,
400 boost::shared_ptr<CommonDataMortarContact> common_data_simple_contact,
401 const string field_name, const string mesh_node_field_name,
402 const string lagrange_field_name, const string side_fe_name);
403
404 /**
405 * @brief Function for the mortar contact element that sets the user data
406 * LHS-operators
407 *
408 * @param fe_lhs_simple_contact_ale Pointer to the FE instance for LHS
409 * @param common_data_simple_contact Pointer to the common data for
410 * mortar contact element
411 * @param field_name String of field name for spatial
412 * positions
413 * @param mesh_node_field_name String of field name for material
414 * positions
415 * @param lagrange_field_name String of field name for Lagrange
416 * multipliers
417 * @param side_fe_name String of 3D element adjacent to the
418 * present contact element
419 * @return Error code
420 *
421 */
423 boost::shared_ptr<MortarContactElement> fe_lhs_simple_contact_ale,
424 boost::shared_ptr<CommonDataMortarContact> common_data_simple_contact,
425 const string field_name, const string mesh_node_field_name,
426 const string lagrange_field_name, const string side_fe_name);
427
428 /**
429 * @brief Function for the mortar contact element that sets the user data
430 * LHS-operators
431 *
432 * @param fe_lhs_simple_contact_ale Pointer to the FE instance for LHS
433 * @param common_data_simple_contact Pointer to the common data for
434 * mortar contact element
435 * @param field_name String of field name for spatial
436 * positions
437 * @param mesh_node_field_name String of field name for material
438 * positions
439 * @param lagrange_field_name String of field name for Lagrange
440 * multipliers
441 * @return Error code
442 *
443 */
444 MoFEMErrorCode setContactOperatorsLhsALE(
445 boost::shared_ptr<MortarContactElement> fe_lhs_simple_contact_ale,
446 boost::shared_ptr<CommonDataMortarContact> common_data_simple_contact,
447 const string field_name, const string mesh_node_field_name,
448 const string lagrange_field_name);
449
450}; // end of MortarContactProblem
451#endif
constexpr double a
@ MF_ZERO
Definition: definitions.h:98
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string name_row)=0
set field col which finite element use
virtual MoFEMErrorCode add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string &name, const bool recursive=true)=0
add entities to finite element
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_filed)=0
set finite element field data
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string name_row)=0
set field row which finite element use
virtual MoFEMErrorCode get_finite_element_entities_by_handle(const std::string name, Range &ents) const =0
get entities in the finite element by handle
const double c
speed of light (cm/ns)
constexpr auto field_name
Class used to scale loads, f.e. in arc-length control.
virtual MoFEMErrorCode remove_ents_from_finite_element(const std::string name, const EntityHandle meshset, const EntityType type, int verb=DEFAULT_VERBOSITY)=0
remove entities from given refinement level to finite element database
Deprecated interface functions.
boost::shared_ptr< MatrixDouble > referencePositionAtGaussPtsSlavePtr
boost::shared_ptr< VectorDouble > referenceGapPtr
boost::shared_ptr< MatrixDouble > referencePositionAtGaussPtsMasterPtr
MoFEMErrorCode scaleNf(const FEMethod *fe, VectorDouble &nf)
virtual MoFEMErrorCode setGaussPts(int order)
MortarContactElement(MoFEM::Interface &m_field, boost::shared_ptr< ContactSearchKdTree::ContactCommonData_multiIndex > contact_commondata_multi_index, std::string spat_pos, std::string mat_pos, bool newton_cotes=false)
boost::shared_ptr< ContactSearchKdTree::ContactCommonData_multiIndex > contactCommondataMultiIndex
double area2D(double *a, double *b, double *c)
Element used to integrate on slave surfaces. It convects integration points on slaves,...
boost::shared_ptr< ConvectSlaveIntegrationPts > getConvectPtr()
boost::shared_ptr< ConvectSlaveIntegrationPts > convectPtr
MortarConvectMasterContactElement(MoFEM::Interface &m_field, boost::shared_ptr< ContactSearchKdTree::ContactCommonData_multiIndex > contact_commondata_multi_index, std::string spat_pos, std::string mat_pos, bool newton_cotes=false)
Element used to integrate on master surfaces. It convects integration points on slaves,...
MoFEMErrorCode setContactOperatorsRhsALEMaterial(boost::shared_ptr< MortarContactElement > fe_rhs_simple_contact_ale, boost::shared_ptr< CommonDataMortarContact > common_data_simple_contact, const string field_name, const string mesh_node_field_name, const string lagrange_field_name, const string side_fe_name)
Function for the mortar contact element that sets the user data post processing operators.
MoFEMErrorCode setContactOperatorsLhsALE(boost::shared_ptr< MortarContactElement > fe_lhs_simple_contact_ale, boost::shared_ptr< CommonDataMortarContact > common_data_simple_contact, const string field_name, const string mesh_node_field_name, const string lagrange_field_name)
Function for the mortar contact element that sets the user data LHS-operators.
MoFEMErrorCode setContactOperatorsLhsALEMaterial(boost::shared_ptr< MortarContactElement > fe_lhs_simple_contact_ale, boost::shared_ptr< CommonDataMortarContact > common_data_simple_contact, const string field_name, const string mesh_node_field_name, const string lagrange_field_name, const string side_fe_name)
Function for the mortar contact element that sets the user data LHS-operators.
MoFEMErrorCode setContactOperatorsLhs(boost::shared_ptr< MortarContactElement > fe_lhs_mortar_contact, boost::shared_ptr< CommonDataMortarContact > common_data_mortar_contact, string field_name, string lagrange_field_name, bool is_alm=false, bool is_eigen_pos_field=false, string eigen_pos_field_name="EIGEN_SPATIAL_POSITIONS", bool use_reference_coordinates=false)
MoFEMErrorCode setContactOperatorsRhs(boost::shared_ptr< MortarContactElement > fe_rhs_mortar_contact, boost::shared_ptr< CommonDataMortarContact > common_data_mortar_contact, string field_name, string lagrange_field_name, bool is_alm=false, bool is_eigen_pos_field=false, string eigen_pos_field_name="EIGEN_SPATIAL_POSITIONS", bool use_reference_coordinates=false)
MoFEMErrorCode setContactOperatorsForPostProc(boost::shared_ptr< MortarContactElement > fe_post_proc_mortar_contact, boost::shared_ptr< CommonDataMortarContact > common_data_mortar_contact, MoFEM::Interface &m_field, string field_name, string lagrange_field_name, moab::Interface &moab_out, bool alm_flag=false, bool is_eigen_pos_field=false, string eigen_pos_field_name="EIGEN_SPATIAL_POSITIONS", bool is_displacements=false, Range post_proc_surface=Range(), double post_proc_gap_tol=0.0)
boost::shared_ptr< double > cnValuePtr
MortarContactProblem(MoFEM::Interface &m_field, boost::shared_ptr< ContactSearchKdTree::ContactCommonData_multiIndex > contact_commondata_multi_index, boost::shared_ptr< double > cn_value_ptr, bool newton_cotes=false)
MoFEMErrorCode setMasterForceOperatorsRhs(boost::shared_ptr< MortarContactElement > fe_rhs_mortar_contact, boost::shared_ptr< CommonDataMortarContact > common_data_mortar_contact, string field_name, string lagrange_field_name, bool is_alm=false, bool is_eigen_pos_field=false, string eigen_pos_field_name="EIGEN_SPATIAL_POSITIONS", bool use_reference_coordinates=false)
MoFEMErrorCode addMortarContactElement(const string element_name, const string field_name, const string lagrange_field_name, Range &range_slave_master_prisms, string material_position_field_name="MESH_NODE_POSITIONS", bool eigen_pos_flag=false, const string eigen_node_field_name="EIGEN_SPATIAL_POSITIONS")
boost::shared_ptr< ContactSearchKdTree::ContactCommonData_multiIndex > contactCommondataMultiIndex
map< int, MortarContactPrismsData > setOfMortarContactPrism
maps side set id with appropriate FluxData
ContactPrismElementForcesAndSourcesCore::UserDataOperator ContactOp
MoFEMErrorCode setMasterForceOperatorsLhs(boost::shared_ptr< MortarContactElement > fe_lhs_mortar_contact, boost::shared_ptr< CommonDataMortarContact > common_data_mortar_contact, string field_name, string lagrange_field_name, bool is_alm=false, bool is_eigen_pos_field=false, string eigen_pos_field_name="EIGEN_SPATIAL_POSITIONS", bool use_reference_coordinates=false)
MoFEMErrorCode addMortarContactFrictionElement(const string element_name, const string field_name, const string lagrange_field_name, const string prev_conv_field_name, const string tangent_lagrange_field_name, Range &range_slave_master_prisms, string material_position_field_name="MESH_NODE_POSITIONS")
MoFEMErrorCode addMortarContactElementALE(const string element_name, const string field_name, const string mesh_node_field_name, const string lagrange_field_name, Range &range_slave_master_prisms)
Function that adds field data for spatial positions and Lagrange multipliers to rows and columns,...
Element used to integrate on slave surfaces. It convects integration points on slaves,...
Class used to convect integration points on slave and master, and to calculate directional direvative...
Set of functions declaring elements and setting operators to apply contact conditions between surface...
map< int, SimpleContactPrismsData > setOfSimpleContactPrism
maps side set id with appropriate FluxData