v0.14.0
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  */
13 struct EdgeForce {
14 
16  EdgeForce(MoFEM::Interface &m_field) : mField(m_field), fe(m_field, 1) {}
17 
19  int addToRule;
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 
36  struct OpEdgeForce
38 
39  Vec F;
41  boost::ptr_vector<MethodForForceScaling> &methodsOp;
42  bool useSnesF;
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 
50 
51  MoFEMErrorCode doWork(int side, EntityType type,
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
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  auto field_ptr = m_field.get_field_structure(field_name);
107  const int nb_coefficients = field_ptr->getNbOfCoeffs();
108  if (nb_coefficients == 3) {
109  fe.getOpPtrVector().push_back(
110  new OpGetHOTangentsOnEdge<3>(mesh_node_positions));
111  }
112  else if (nb_coefficients == 2) {
113  fe.getOpPtrVector().push_back(
114  new OpGetHOTangentsOnEdge<2>(mesh_node_positions));
115  }
116  }
118  it)) {
119  CHKERR edge_forces.at(fe_name).addForce(field_name, F,
120  it->getMeshsetId());
121  }
123  }
124 };
125 
126 #endif //__EDGE_FORCE_HPP__
EdgeForce::OpEdgeForce::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Definition: EdgeForce.cpp:21
MoFEM::EdgeElementForcesAndSourcesCore
Edge finite element.
Definition: EdgeElementForcesAndSourcesCore.hpp:30
EdgeForce::OpEdgeForce::methodsOp
boost::ptr_vector< MethodForForceScaling > & methodsOp
Definition: EdgeForce.hpp:41
EdgeForce::MyFE::MyFE
MyFE(MoFEM::Interface &m_field, int add_to_rule)
Definition: EdgeForce.hpp:20
MoFEM::Field::getNbOfCoeffs
FieldCoefficientsNumber getNbOfCoeffs() const
Get number of field coefficients.
Definition: FieldMultiIndices.hpp:188
EdgeForce
Force on edges and lines.
Definition: EdgeForce.hpp:13
EdgeElementForcesAndSourcesCore
EdgeForce::OpEdgeForce::wEights
VectorDouble wEights
Definition: EdgeForce.hpp:48
EdgeForce::MyFE::getRule
int getRule(int order)
Definition: EdgeForce.hpp:22
EdgeForce::methodsOp
boost::ptr_vector< MethodForForceScaling > methodsOp
Definition: EdgeForce.hpp:34
MoFEM::CoreInterface::modify_finite_element_add_field_row
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
MoFEM::CoreInterface::get_field_structure
virtual const Field * get_field_structure(const std::string &name, enum MoFEMTypes bh=MF_EXIST) const =0
get field structure
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
_IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_
#define _IT_CUBITMESHSETS_BY_BCDATA_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet in a moFEM field.
Definition: MeshsetsManager.hpp:49
order
constexpr int order
Definition: dg_projection.cpp:18
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
NODESET
@ NODESET
Definition: definitions.h:146
MoFEM::CoreInterface::add_ents_to_finite_element_by_type
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
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
EdgeForce::MyFE
Definition: EdgeForce.hpp:18
MoFEM::CoreInterface::add_finite_element
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
MoFEM::CoreInterface::modify_finite_element_add_field_col
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
MetaEdgeForces
Definition: EdgeForce.hpp:59
FORCESET
@ FORCESET
Definition: definitions.h:151
convert.type
type
Definition: convert.py:64
EdgeForce::bCForce::eDges
Range eDges
Definition: EdgeForce.hpp:30
EdgeForce::bCForce::data
ForceCubitBcData data
Definition: EdgeForce.hpp:29
EdgeForce::fe
MyFE fe
Definition: EdgeForce.hpp:25
EdgeForce::EdgeForce
EdgeForce(MoFEM::Interface &m_field)
Definition: EdgeForce.hpp:16
EdgeForce::OpEdgeForce::useSnesF
bool useSnesF
Definition: EdgeForce.hpp:42
MoFEM::CoreInterface::check_field
virtual bool check_field(const std::string &name) const =0
check if field is in database
EntData
EntitiesFieldData::EntData EntData
Definition: child_and_parent.cpp:37
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
EdgeForce::mField
MoFEM::Interface & mField
Definition: EdgeForce.hpp:15
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator
default operator for EDGE element
Definition: EdgeElementForcesAndSourcesCore.hpp:68
MetaEdgeForces::addElement
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
Range
MF_ZERO
@ MF_ZERO
Definition: definitions.h:98
EdgeForce::addForce
MoFEMErrorCode addForce(const std::string field_name, Vec F, int ms_id, bool use_snes_f=false)
Definition: EdgeForce.cpp:93
HenckyOps::f
auto f
Definition: HenckyOps.hpp:15
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
EdgeForce::OpEdgeForce::F
Vec F
Definition: EdgeForce.hpp:39
MoFEM::CoreInterface::modify_finite_element_add_field_data
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_filed)=0
set finite element field data
EdgeForce::OpEdgeForce
Definition: EdgeForce.hpp:36
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
EdgeForce::bCForce
Definition: EdgeForce.hpp:28
EdgeForce::OpEdgeForce::dAta
bCForce & dAta
Definition: EdgeForce.hpp:40
EdgeForce::getLoopFe
MyFE & getLoopFe()
Definition: EdgeForce.hpp:26
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
EdgeForce::OpEdgeForce::OpEdgeForce
OpEdgeForce(const std::string field_name, Vec f, bCForce &data, boost::ptr_vector< MethodForForceScaling > &methods_op, bool use_snes_f=false)
Definition: EdgeForce.cpp:14
EdgeForce::mapForce
std::map< int, bCForce > mapForce
Definition: EdgeForce.hpp:32
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
EdgeForce::MyFE::addToRule
int addToRule
Definition: EdgeForce.hpp:19
F
@ F
Definition: free_surface.cpp:394
MetaEdgeForces::setOperators
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
EdgeForce::OpEdgeForce::Nf
VectorDouble Nf
Definition: EdgeForce.hpp:49