v0.14.0
Loading...
Searching...
No Matches
NodalForce.hpp
Go to the documentation of this file.
1/** \file NodalForce.hpp
2 \ingroup mofem_static_boundary_conditions
3*/
4
5
6
7#ifndef __NODAL_FORCES_HPP__
8#define __NODAL_FORCES_HPP__
9
10/** \brief Force applied to nodes
11 * \ingroup mofem_static_boundary_conditions
12 */
13struct NodalForce {
14
16 NodalForce(MoFEM::Interface &m_field) : mField(m_field), fe(m_field) {}
17
19 MyFE(MoFEM::Interface &m_field);
20 };
21
23 MyFE &getLoopFe() { return fe; }
24
25 struct bCForce {
26 ForceCubitBcData data;
28 };
29 std::map<int, bCForce> mapForce;
30
31 boost::ptr_vector<MethodForForceScaling> methodsOp;
32
33 /// \brief Operator to assemble nodal force into right hand side vector
36
37 Vec F;
40 boost::ptr_vector<MethodForForceScaling> &methodsOp;
41
42 OpNodalForce(const std::string field_name, Vec _F, bCForce &data,
43 boost::ptr_vector<MethodForForceScaling> &methods_op,
44 bool use_snes_f = false);
45
46 VectorDouble Nf;
47
48 /** Executed for each entity on element, i.e. in this case Vertex element
49 has only one entity, that is vertex
50 */
51 MoFEMErrorCode doWork(int side, EntityType type,
52 EntitiesFieldData::EntData &data);
53 };
54
55 MoFEMErrorCode addForce(const std::string field_name, Vec F, int ms_id,
56 bool use_snes_f = false);
57};
58
60
61 /** \brief Scale force based on tag value "_LoadFactor_Scale_"
62
63 This is obsolete, is kept to have back compatibility with fracture code.
64
65 */
68 double *sCale;
70
72 MoFEMErrorCode scaleNf(const FEMethod *fe, VectorDouble &Nf);
73 };
74
75 /**
76 * \brief Scale force based on some DOF value
77 *
78 * That dof usually will be associated with dof used for arc-length control
79 *
80 */
82 boost::shared_ptr<DofEntity> dOf;
83 DofForceScale(boost::shared_ptr<DofEntity> dof) : dOf(dof) {}
84 MoFEMErrorCode scaleNf(const FEMethod *fe, VectorDouble &Nf) {
86 Nf *= dOf->getFieldData();
88 }
89 };
90
91 /// Add element taking information from NODESET
92 static MoFEMErrorCode addElement(MoFEM::Interface &m_field,
93 const std::string field_name,
94 Range *intersect_ptr = NULL) {
96 CHKERR m_field.add_finite_element("FORCE_FE", MF_ZERO);
101 it)) {
102 Range tris;
103 CHKERR m_field.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
104 true);
105 Range edges;
106 CHKERR m_field.get_moab().get_entities_by_type(it->meshset, MBEDGE, edges,
107 true);
108 Range tris_nodes;
109 CHKERR m_field.get_moab().get_connectivity(tris, tris_nodes);
110 Range edges_nodes;
111 CHKERR m_field.get_moab().get_connectivity(edges, edges_nodes);
112 Range nodes;
113 CHKERR m_field.get_moab().get_entities_by_type(it->meshset, MBVERTEX,
114 nodes, true);
115 nodes = subtract(nodes, tris_nodes);
116 nodes = subtract(nodes, edges_nodes);
117 if (intersect_ptr) {
118 nodes = intersect(nodes, *intersect_ptr);
119 }
120 CHKERR m_field.add_ents_to_finite_element_by_type(nodes, MBVERTEX,
121 "FORCE_FE");
122 }
124 }
125
126 /// Set integration point operators
127 static MoFEMErrorCode
129 boost::ptr_map<std::string, NodalForce> &nodal_forces, Vec F,
130 const std::string field_name) {
132 string fe_name = "FORCE_FE";
133 nodal_forces.insert(fe_name, new NodalForce(m_field));
135 it)) {
136 CHKERR nodal_forces.at(fe_name).addForce(field_name, F,
137 it->getMeshsetId());
138 }
140 }
141};
142
143#endif //__NODAL_FORCES_HPP__
@ MF_ZERO
Definition: definitions.h:98
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ FORCESET
Definition: definitions.h:151
@ NODESET
Definition: definitions.h:146
#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
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
@ F
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
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
constexpr auto field_name
#define _F(n)
Definition: quad.c:25
Scale force based on some DOF value.
Definition: NodalForce.hpp:81
MoFEMErrorCode scaleNf(const FEMethod *fe, VectorDouble &Nf)
Definition: NodalForce.hpp:84
boost::shared_ptr< DofEntity > dOf
Definition: NodalForce.hpp:82
DofForceScale(boost::shared_ptr< DofEntity > dof)
Definition: NodalForce.hpp:83
Scale force based on tag value "_LoadFactor_Scale_".
Definition: NodalForce.hpp:66
MoFEM::Interface & mField
Definition: NodalForce.hpp:67
MoFEMErrorCode scaleNf(const FEMethod *fe, VectorDouble &Nf)
Definition: NodeForce.cpp:107
static MoFEMErrorCode setOperators(MoFEM::Interface &m_field, boost::ptr_map< std::string, NodalForce > &nodal_forces, Vec F, const std::string field_name)
Set integration point operators.
Definition: NodalForce.hpp:128
static MoFEMErrorCode addElement(MoFEM::Interface &m_field, const std::string field_name, Range *intersect_ptr=NULL)
Add element taking information from NODESET.
Definition: NodalForce.hpp:92
Class used to scale loads, f.e. in arc-length control.
virtual moab::Interface & get_moab()=0
Deprecated interface functions.
Operator to assemble nodal force into right hand side vector.
Definition: NodalForce.hpp:35
boost::ptr_vector< MethodForForceScaling > & methodsOp
Definition: NodalForce.hpp:40
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Definition: NodeForce.cpp:26
ForceCubitBcData data
Definition: NodalForce.hpp:26
Force applied to nodes.
Definition: NodalForce.hpp:13
MoFEM::Interface & mField
Definition: NodalForce.hpp:15
NodalForce(MoFEM::Interface &m_field)
Definition: NodalForce.hpp:16
MyFE & getLoopFe()
Definition: NodalForce.hpp:23
MoFEMErrorCode addForce(const std::string field_name, Vec F, int ms_id, bool use_snes_f=false)
Definition: NodeForce.cpp:68
boost::ptr_vector< MethodForForceScaling > methodsOp
Definition: NodalForce.hpp:31
std::map< int, bCForce > mapForce
Definition: NodalForce.hpp:29