v0.10.0
EdgeForce.hpp
Go to the documentation of this file.
1 
2 /** \file EdgeForce.hpp
3  \ingroup mofem_static_boundary_conditions
4 */
5 
6 /* This file is part of MoFEM.
7  * MoFEM is free software: you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation, either version 3 of the License, or (at your
10  * option) any later version.
11  *
12  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
19 
20 #ifndef __EDGE_FORCE_HPP__
21 #define __EDGE_FORCE_HPP__
22 
23 /** \brief Force on edges and lines
24  */
25 struct EdgeForce {
26 
28  EdgeForce(MoFEM::Interface &m_field) : mField(m_field), fe(m_field, 1) {}
29 
31  int addToRule;
32  MyFE(MoFEM::Interface &m_field, int add_to_rule)
33  : EdgeElementForcesAndSourcesCore(m_field), addToRule(add_to_rule) {}
34  int getRule(int order) { return order + addToRule; };
35  };
36 
38  MyFE &getLoopFe() { return fe; }
39 
40  struct bCForce {
41  ForceCubitBcData data;
42  Range eDges;
43  };
44  std::map<int, bCForce> mapForce;
45 
46  boost::ptr_vector<MethodForForceScaling> methodsOp;
47 
48  struct OpEdgeForce
50 
51  Vec F;
53  boost::ptr_vector<MethodForForceScaling> &methodsOp;
54  bool useSnesF;
55 
56  OpEdgeForce(const std::string field_name, Vec f, bCForce &data,
57  boost::ptr_vector<MethodForForceScaling> &methods_op,
58  bool use_snes_f = false);
59 
62 
63  MoFEMErrorCode doWork(int side, EntityType type,
65  };
66 
67  MoFEMErrorCode addForce(const std::string field_name, Vec F, int ms_id,
68  bool use_snes_f = false);
69 };
70 
72 
73  /// Add element taking information from NODESET
75  const std::string field_name,
76  Range *intersect_ptr = NULL) {
78  CHKERR m_field.add_finite_element("FORCE_FE", MF_ZERO);
79  CHKERR m_field.modify_finite_element_add_field_row("FORCE_FE", field_name);
80  CHKERR m_field.modify_finite_element_add_field_col("FORCE_FE", field_name);
81  CHKERR m_field.modify_finite_element_add_field_data("FORCE_FE", field_name);
82  if (m_field.check_field("MESH_NODE_POSITIONS")) {
84  "FORCE_FE", "MESH_NODE_POSITIONS");
85  }
87  it)) {
88  Range tris;
89  CHKERR m_field.get_moab().get_entities_by_type(it->meshset, MBTRI, tris,
90  true);
91  Range edges;
92  CHKERR m_field.get_moab().get_entities_by_type(it->meshset, MBEDGE, edges,
93  true);
94  Range tris_edges;
95  CHKERR m_field.get_moab().get_adjacencies(tris, 1, false, tris_edges,
96  moab::Interface::UNION);
97  edges = subtract(edges, tris_edges);
98  if (intersect_ptr) {
99  edges = intersect(edges, *intersect_ptr);
100  }
101  CHKERR m_field.add_ents_to_finite_element_by_type(edges, MBEDGE,
102  "FORCE_FE");
103  }
105  }
106 
107  /// Set integration point operators
108  static MoFEMErrorCode
110  boost::ptr_map<std::string, EdgeForce> &edge_forces, Vec F,
111  const std::string field_name) {
113  string fe_name = "FORCE_FE";
114  edge_forces.insert(fe_name, new EdgeForce(m_field));
116  it)) {
117  CHKERR edge_forces.at(fe_name).addForce(field_name, F,
118  it->getMeshsetId());
119  }
121  }
122 };
123 
124 #endif //__EDGE_FORCE_HPP__
int getRule(int order)
Definition: EdgeForce.hpp:34
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
MoFEMErrorCode doWork(int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
Definition: EdgeForce.cpp:33
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
Deprecated interface functions.
virtual moab::Interface & get_moab()=0
std::map< int, bCForce > mapForce
Definition: EdgeForce.hpp:44
boost::ptr_vector< MethodForForceScaling > & methodsOp
Definition: EdgeForce.hpp:53
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
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:74
MoFEM::Interface & mField
Definition: EdgeForce.hpp:27
boost::ptr_vector< MethodForForceScaling > methodsOp
Definition: EdgeForce.hpp:46
Edge finite elementUser is implementing own operator at Gauss points level, by own object derived fro...
MyFE & getLoopFe()
Definition: EdgeForce.hpp:38
EdgeForce(MoFEM::Interface &m_field)
Definition: EdgeForce.hpp:28
ForceCubitBcData data
Definition: EdgeForce.hpp:41
DataForcesAndSourcesCore::EntData EntData
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
MyFE(MoFEM::Interface &m_field, int add_to_rule)
Definition: EdgeForce.hpp:32
OpEdgeForce(const std::string field_name, Vec f, bCForce &data, boost::ptr_vector< MethodForForceScaling > &methods_op, bool use_snes_f=false)
Definition: EdgeForce.cpp:26
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
#define CHKERR
Inline error check.
Definition: definitions.h:604
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string &name_filed)=0
set finite element field data
Force on edges and lines.
Definition: EdgeForce.hpp:25
constexpr int order
static MoFEMErrorCode setOperators(MoFEM::Interface &m_field, boost::ptr_map< std::string, EdgeForce > &edge_forces, Vec F, const std::string field_name)
Set integration point operators.
Definition: EdgeForce.hpp:109
VectorDouble wEights
Definition: EdgeForce.hpp:60
virtual bool check_field(const std::string &name) const =0
check if field is in database
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 MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
ublas::vector< double, DoubleAllocator > VectorDouble
Definition: Types.hpp:74
MoFEMErrorCode addForce(const std::string field_name, Vec F, int ms_id, bool use_snes_f=false)
Definition: EdgeForce.cpp:109