v0.14.0
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  */
13 struct 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
34  struct OpNodalForce
36 
37  Vec F;
38  bool useSnesF;
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 
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,
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;
69  Tag thScale;
70 
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) {}
86  Nf *= dOf->getFieldData();
88  }
89  };
90 
91  /// Add element taking information from NODESET
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__
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MetaNodalForces::TagForceScale::sCale
double * sCale
Definition: NodalForce.hpp:68
NodalForce::OpNodalForce::OpNodalForce
OpNodalForce(const std::string field_name, Vec _F, bCForce &data, boost::ptr_vector< MethodForForceScaling > &methods_op, bool use_snes_f=false)
Definition: NodeForce.cpp:18
NodalForce::getLoopFe
MyFE & getLoopFe()
Definition: NodalForce.hpp:23
NodalForce::bCForce::data
ForceCubitBcData data
Definition: NodalForce.hpp:26
MetaNodalForces::TagForceScale
Scale force based on tag value "_LoadFactor_Scale_".
Definition: NodalForce.hpp:66
NodalForce::mField
MoFEM::Interface & mField
Definition: NodalForce.hpp:15
NodalForce::OpNodalForce::Nf
VectorDouble Nf
Definition: NodalForce.hpp:46
MetaNodalForces::addElement
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
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
_F
#define _F(n)
Definition: quad.c:25
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
NodalForce::methodsOp
boost::ptr_vector< MethodForForceScaling > methodsOp
Definition: NodalForce.hpp:31
MetaNodalForces::DofForceScale::scaleNf
MoFEMErrorCode scaleNf(const FEMethod *fe, VectorDouble &Nf)
Definition: NodalForce.hpp:84
NodalForce
Force applied to nodes.
Definition: NodalForce.hpp:13
MetaNodalForces::TagForceScale::thScale
Tag thScale
Definition: NodalForce.hpp:69
MetaNodalForces
Definition: NodalForce.hpp:59
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MetaNodalForces::setOperators
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
NodalForce::OpNodalForce::F
Vec F
Definition: NodalForce.hpp:37
NODESET
@ NODESET
Definition: definitions.h:159
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
FEMethod
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
NodalForce::OpNodalForce::dAta
bCForce & dAta
Definition: NodalForce.hpp:39
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
NodalForce::bCForce
Definition: NodalForce.hpp:25
FORCESET
@ FORCESET
Definition: definitions.h:164
NodalForce::OpNodalForce::useSnesF
bool useSnesF
Definition: NodalForce.hpp:38
NodalForce::fe
MyFE fe
Definition: NodalForce.hpp:22
convert.type
type
Definition: convert.py:64
MetaNodalForces::DofForceScale::dOf
boost::shared_ptr< DofEntity > dOf
Definition: NodalForce.hpp:82
MetaNodalForces::TagForceScale::scaleNf
MoFEMErrorCode scaleNf(const FEMethod *fe, VectorDouble &Nf)
Definition: NodeForce.cpp:107
MethodForForceScaling
Class used to scale loads, f.e. in arc-length control.
Definition: MethodForForceScaling.hpp:11
MetaNodalForces::TagForceScale::TagForceScale
TagForceScale(MoFEM::Interface &m_field)
Definition: NodeForce.cpp:84
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_field)=0
set finite element field data
NodalForce::OpNodalForce
Operator to assemble nodal force into right hand side vector.
Definition: NodalForce.hpp:34
NodalForce::OpNodalForce::methodsOp
boost::ptr_vector< MethodForForceScaling > & methodsOp
Definition: NodalForce.hpp:40
EntData
EntitiesFieldData::EntData EntData
Definition: child_and_parent.cpp:37
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
NodalForce::MyFE
Definition: NodalForce.hpp:18
NodalForce::mapForce
std::map< int, bCForce > mapForce
Definition: NodalForce.hpp:29
MetaNodalForces::DofForceScale
Scale force based on some DOF value.
Definition: NodalForce.hpp:81
Range
NodalForce::OpNodalForce::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Definition: NodeForce.cpp:26
MF_ZERO
@ MF_ZERO
Definition: definitions.h:111
MetaNodalForces::DofForceScale::DofForceScale
DofForceScale(boost::shared_ptr< DofEntity > dof)
Definition: NodalForce.hpp:83
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
MetaNodalForces::TagForceScale::mField
MoFEM::Interface & mField
Definition: NodalForce.hpp:67
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
NodalForce::MyFE::MyFE
MyFE(MoFEM::Interface &m_field)
Definition: NodeForce.cpp:15
NodalForce::NodalForce
NodalForce(MoFEM::Interface &m_field)
Definition: NodalForce.hpp:16
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
NodalForce::bCForce::nOdes
Range nOdes
Definition: NodalForce.hpp:27
MoFEM::VertexElementForcesAndSourcesCore::UserDataOperator
default operator for VERTEX element
Definition: VertexElementForcesAndSourcesCore.hpp:37
NodalForce::addForce
MoFEMErrorCode addForce(const std::string field_name, Vec F, int ms_id, bool use_snes_f=false)
Definition: NodeForce.cpp:68
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEM::VertexElementForcesAndSourcesCore
Vertex finite element.
Definition: VertexElementForcesAndSourcesCore.hpp:28
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
F
@ F
Definition: free_surface.cpp:394