v0.13.1
Loading...
Searching...
No Matches
EdgeForce.hpp
Go to the documentation of this file.
1
2/** \file EdgeForce.hpp
3 \ingroup mofem_static_boundary_conditions
4*/
5
6
7
8#ifndef __EDGE_FORCE_HPP__
9#define __EDGE_FORCE_HPP__
10
11/** \brief Force on edges and lines
12 */
13struct EdgeForce {
14
16 EdgeForce(MoFEM::Interface &m_field) : mField(m_field), fe(m_field, 1) {}
17
20 MyFE(MoFEM::Interface &m_field, int add_to_rule)
21 : EdgeElementForcesAndSourcesCore(m_field), addToRule(add_to_rule) {}
22 int getRule(int order) { return order + addToRule; };
23 };
24
26 MyFE &getLoopFe() { return fe; }
27
28 struct bCForce {
29 ForceCubitBcData data;
31 };
32 std::map<int, bCForce> mapForce;
33
34 boost::ptr_vector<MethodForForceScaling> methodsOp;
35
38
39 Vec F;
41 boost::ptr_vector<MethodForForceScaling> &methodsOp;
43
44 OpEdgeForce(const std::string field_name, Vec f, bCForce &data,
45 boost::ptr_vector<MethodForForceScaling> &methods_op,
46 bool use_snes_f = false);
47
48 VectorDouble wEights;
49 VectorDouble Nf;
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 /// Add element taking information from NODESET
62 static MoFEMErrorCode addElement(MoFEM::Interface &m_field,
63 const std::string field_name,
64 Range *intersect_ptr = NULL) {
66 CHKERR m_field.add_finite_element("FORCE_FE", MF_ZERO);
70 if (m_field.check_field("MESH_NODE_POSITIONS")) {
72 "FORCE_FE", "MESH_NODE_POSITIONS");
73 }
75 it)) {
76 Range tris;
77 CHKERR m_field.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
78 true);
79 Range edges;
80 CHKERR m_field.get_moab().get_entities_by_type(it->meshset, MBEDGE, edges,
81 true);
82 Range tris_edges;
83 CHKERR m_field.get_moab().get_adjacencies(tris, 1, false, tris_edges,
84 moab::Interface::UNION);
85 edges = subtract(edges, tris_edges);
86 if (intersect_ptr) {
87 edges = intersect(edges, *intersect_ptr);
88 }
89 CHKERR m_field.add_ents_to_finite_element_by_type(edges, MBEDGE,
90 "FORCE_FE");
91 }
93 }
94
95 /// Set integration point operators
96 static MoFEMErrorCode
98 boost::ptr_map<std::string, EdgeForce> &edge_forces, Vec F,
99 const std::string field_name,
100 std::string mesh_node_positions = "MESH_NODE_POSITIONS") {
102 string fe_name = "FORCE_FE";
103 edge_forces.insert(fe_name, new EdgeForce(m_field));
104 if (m_field.check_field(mesh_node_positions)) {
105 auto &fe = edge_forces.at(fe_name).getLoopFe();
106 fe.getOpPtrVector().push_back(
107 new OpGetHOTangentsOnEdge(mesh_node_positions));
108 }
110 it)) {
111 CHKERR edge_forces.at(fe_name).addForce(field_name, F,
112 it->getMeshsetId());
113 }
115 }
116};
117
118#endif //__EDGE_FORCE_HPP__
@ 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
@ 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
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 add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
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_col(const std::string &fe_name, const std::string &name_row)=0
set field col which finite element use
virtual bool check_field(const std::string &name) const =0
check if field is in database
#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
int getRule(int order)
Definition: EdgeForce.hpp:22
MyFE(MoFEM::Interface &m_field, int add_to_rule)
Definition: EdgeForce.hpp:20
boost::ptr_vector< MethodForForceScaling > & methodsOp
Definition: EdgeForce.hpp:41
VectorDouble wEights
Definition: EdgeForce.hpp:48
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Definition: EdgeForce.cpp:21
ForceCubitBcData data
Definition: EdgeForce.hpp:29
Force on edges and lines.
Definition: EdgeForce.hpp:13
MyFE & getLoopFe()
Definition: EdgeForce.hpp:26
MoFEM::Interface & mField
Definition: EdgeForce.hpp:15
MoFEMErrorCode addForce(const std::string field_name, Vec F, int ms_id, bool use_snes_f=false)
Definition: EdgeForce.cpp:93
boost::ptr_vector< MethodForForceScaling > methodsOp
Definition: EdgeForce.hpp:34
std::map< int, bCForce > mapForce
Definition: EdgeForce.hpp:32
EdgeForce(MoFEM::Interface &m_field)
Definition: EdgeForce.hpp:16
static MoFEMErrorCode setOperators(MoFEM::Interface &m_field, boost::ptr_map< std::string, EdgeForce > &edge_forces, Vec F, const std::string field_name, std::string mesh_node_positions="MESH_NODE_POSITIONS")
Set integration point operators.
Definition: EdgeForce.hpp:97
static MoFEMErrorCode addElement(MoFEM::Interface &m_field, const std::string field_name, Range *intersect_ptr=NULL)
Add element taking information from NODESET.
Definition: EdgeForce.hpp:62
virtual moab::Interface & get_moab()=0
Deprecated interface functions.