v0.16.0
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
MetaNeumannForces Struct Reference

Set of high-level function declaring elements and setting operators to apply forces/fluxes. More...

#include "users_modules/basic_finite_elements/src/SurfacePressure.hpp"

Static Public Member Functions

static MoFEMErrorCode addNeumannBCElements (MoFEM::Interface &m_field, const std::string field_name, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS", Range *intersect_ptr=NULL)
 Declare finite element.
 
static MoFEMErrorCode setMomentumFluxOperators (MoFEM::Interface &m_field, boost::ptr_map< std::string, NeumannForcesSurface > &neumann_forces, Vec F, const std::string field_name, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS")
 Set operators to finite elements calculating right hand side vector.
 
static MoFEMErrorCode addNeumannFluxBCElements (MoFEM::Interface &m_field, const std::string field_name, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS")
 
static MoFEMErrorCode setMassFluxOperators (MoFEM::Interface &m_field, boost::ptr_map< std::string, NeumannForcesSurface > &neumann_forces, Vec F, const std::string field_name, const std::string mesh_nodals_positions="MESH_NODE_POSITIONS")
 

Detailed Description

Set of high-level function declaring elements and setting operators to apply forces/fluxes.

Definition at line 1261 of file SurfacePressure.hpp.

Member Function Documentation

◆ addNeumannBCElements()

MoFEMErrorCode MetaNeumannForces::addNeumannBCElements ( MoFEM::Interface m_field,
const std::string  field_name,
const std::string  mesh_nodals_positions = "MESH_NODE_POSITIONS",
Range intersect_ptr = NULL 
)
static

Declare finite element.

Search cubit sidesets and blocksets with pressure bc and declare surface elemen

Block set has to have name “PRESSURE”. Can have name “PRESSURE_01” or any other name with prefix. The first attribute of block set is pressure value.

Parameters
m_fieldInterface insurance
field_nameField name (f.e. DISPLACEMENT)
mesh_nodals_positionsName of field on which ho-geometry is defined
intersect_ptrPointer to range to interect meshset entities
Returns
Error code
Examples
mofem/tutorials/cor-10_navier_stokes/navier_stokes.cpp, mofem/tutorials/cor-7_elasticity_mixed_formulation/elasticity_mixed_formulation.cpp, mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp, and mofem/users_modules/basic_finite_elements/nonlinear_elasticity/nonlinear_dynamics.cpp.

Definition at line 1974 of file SurfacePressure.cpp.

1976 {
1978
1979 // Define boundary element that operates on rows, columns and data of a
1980 // given field
1981 CHKERR m_field.add_finite_element("FORCE_FE", MF_ZERO);
1985 if (m_field.check_field(mesh_nodals_positions)) {
1987 mesh_nodals_positions);
1988 }
1989 // Add entities to that element, here we add all triangles with FORCESET
1990 // from cubit
1992 it)) {
1993 Range tris;
1994 CHKERR m_field.get_moab().get_entities_by_dimension(it->meshset, 2, tris,
1995 true);
1996 if (intersect_ptr)
1997 tris = intersect(tris, *intersect_ptr);
1998 CHKERR m_field.add_ents_to_finite_element_by_dim(tris, 2, "FORCE_FE");
1999 }
2000
2001 CHKERR m_field.add_finite_element("PRESSURE_FE", MF_ZERO);
2004 CHKERR m_field.modify_finite_element_add_field_data("PRESSURE_FE",
2005 field_name);
2006 if (m_field.check_field(mesh_nodals_positions)) {
2007 CHKERR m_field.modify_finite_element_add_field_data("PRESSURE_FE",
2008 mesh_nodals_positions);
2009 }
2010
2012 SIDESET | PRESSURESET, it)) {
2013 Range tris;
2014 CHKERR m_field.get_moab().get_entities_by_dimension(it->meshset, 2, tris,
2015 true);
2016 if (intersect_ptr)
2017 tris = intersect(tris, *intersect_ptr);
2018 CHKERR m_field.add_ents_to_finite_element_by_dim(tris, 2, "PRESSURE_FE");
2019 }
2020
2021 // Reading forces from BLOCKSET
2022
2023 const string block_set_force_name("FORCE");
2024 // search for block named FORCE and add its attributes to FORCE_FE element
2026 if (it->getName().compare(0, block_set_force_name.length(),
2027 block_set_force_name) == 0) {
2028 Range tris;
2029 CHKERR m_field.get_moab().get_entities_by_dimension(it->meshset, 2, tris,
2030 true);
2031 if (intersect_ptr)
2032 tris = intersect(tris, *intersect_ptr);
2033 CHKERR m_field.add_ents_to_finite_element_by_dim(tris, 2, "FORCE_FE");
2034 }
2035 }
2036 // search for block named PRESSURE and add its attributes to PRESSURE_FE
2037 // element
2038 const string block_set_pressure_name("PRESSURE");
2040 if (it->getName().compare(0, block_set_pressure_name.length(),
2041 block_set_pressure_name) == 0) {
2042 Range tris;
2043 CHKERR m_field.get_moab().get_entities_by_dimension(it->meshset, 2, tris,
2044 true);
2045 if (intersect_ptr)
2046 tris = intersect(tris, *intersect_ptr);
2047 CHKERR m_field.add_ents_to_finite_element_by_dim(tris, 2, "PRESSURE_FE");
2048 }
2049 }
2050
2051 // search for block named LINEAR_PRESSURE and add its attributes to
2052 // PRESSURE_FE element
2053 const string block_set_linear_pressure_name("LINEAR_PRESSURE");
2055 if (it->getName().compare(0, block_set_linear_pressure_name.length(),
2056 block_set_linear_pressure_name) == 0) {
2057 Range tris;
2058 CHKERR m_field.get_moab().get_entities_by_dimension(it->meshset, 2, tris,
2059 true);
2060 if (intersect_ptr)
2061 tris = intersect(tris, *intersect_ptr);
2062 CHKERR m_field.add_ents_to_finite_element_by_dim(tris, 2, "PRESSURE_FE");
2063 }
2064 }
2065
2067}
@ MF_ZERO
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ PRESSURESET
@ FORCESET
@ NODESET
@ SIDESET
@ BLOCKSET
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
virtual MoFEMErrorCode add_ents_to_finite_element_by_dim(const EntityHandle entities, const int dim, const std::string name, const bool recursive=true)=0
add entities to 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
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 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 modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
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.
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
constexpr auto field_name
virtual moab::Interface & get_moab()=0

◆ addNeumannFluxBCElements()

MoFEMErrorCode MetaNeumannForces::addNeumannFluxBCElements ( MoFEM::Interface m_field,
const std::string  field_name,
const std::string  mesh_nodals_positions = "MESH_NODE_POSITIONS" 
)
static

Definition at line 2143 of file SurfacePressure.cpp.

2145 {
2147
2148 CHKERR m_field.add_finite_element("FLUX_FE", MF_ZERO);
2152 if (m_field.check_field(mesh_nodals_positions)) {
2154 mesh_nodals_positions);
2155 }
2156
2158 SIDESET | PRESSURESET, it)) {
2159 Range tris;
2160 CHKERR m_field.get_moab().get_entities_by_dimension(it->meshset, 2, tris,
2161 true);
2162 CHKERR m_field.add_ents_to_finite_element_by_dim(tris, 2, "FLUX_FE");
2163 }
2164
2166}

◆ setMassFluxOperators()

MoFEMErrorCode MetaNeumannForces::setMassFluxOperators ( MoFEM::Interface m_field,
boost::ptr_map< std::string, NeumannForcesSurface > &  neumann_forces,
Vec  F,
const std::string  field_name,
const std::string  mesh_nodals_positions = "MESH_NODE_POSITIONS" 
)
static

Definition at line 2168 of file SurfacePressure.cpp.

2171 {
2173 bool ho_geometry = m_field.check_field(mesh_nodals_positions);
2174
2175 string fe_name;
2176 fe_name = "FLUX_FE";
2177 neumann_forces.insert(fe_name, new NeumannForcesSurface(m_field));
2178
2179 auto &nf = neumann_forces.at(fe_name);
2180 auto &fe = nf.getLoopFe();
2181
2182 if (ho_geometry)
2183 CHKERR AddHOOps<2, 3, 3>::add(fe.getOpPtrVector(), {},
2184 mesh_nodals_positions);
2185
2187 SIDESET | PRESSURESET, it)) {
2188 CHKERR nf.addFlux(field_name, F, it->getMeshsetId(), ho_geometry);
2189 }
2191}
@ F
Add operators pushing bases from local to physical configuration.
Finite element and operators to apply force/pressures applied to surfaces.

◆ setMomentumFluxOperators()

MoFEMErrorCode MetaNeumannForces::setMomentumFluxOperators ( MoFEM::Interface m_field,
boost::ptr_map< std::string, NeumannForcesSurface > &  neumann_forces,
Vec  F,
const std::string  field_name,
const std::string  mesh_nodals_positions = "MESH_NODE_POSITIONS" 
)
static

Set operators to finite elements calculating right hand side vector.

Parameters
m_fieldInterface
neumann_forcesMap of pointers to force/pressure elements
FRight hand side vector
field_nameField name (f.e. DISPLACEMENT)
mesh_nodals_positionsName of field on which ho-geometry is defined
Returns
Error code
Examples
mofem/tutorials/cor-10_navier_stokes/navier_stokes.cpp, mofem/tutorials/cor-7_elasticity_mixed_formulation/elasticity_mixed_formulation.cpp, and mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp.

Definition at line 2069 of file SurfacePressure.cpp.

2072 {
2074 bool ho_geometry = m_field.check_field(mesh_nodals_positions);
2075 // Add forces
2076 {
2077 std::string fe_name = "FORCE_FE";
2078 neumann_forces.insert(fe_name, new NeumannForcesSurface(m_field));
2079 auto &nf = neumann_forces.at(fe_name);
2080 auto &fe = nf.getLoopFe();
2081
2082 if (ho_geometry)
2083 CHKERR AddHOOps<2, 3, 3>::add(fe.getOpPtrVector(), {},
2084 mesh_nodals_positions);
2085
2087 it)) {
2088 CHKERR nf.addForce(field_name, F, it->getMeshsetId(), ho_geometry, false);
2089 }
2090 // Reading forces from BLOCKSET
2091 const string block_set_force_name("FORCE");
2093 if (it->getName().compare(0, block_set_force_name.length(),
2094 block_set_force_name) == 0) {
2095 CHKERR nf.addForce(field_name, F, it->getMeshsetId(), ho_geometry,
2096 true);
2097 }
2098 }
2099 }
2100
2101 // Add pressures
2102 {
2103 std::string fe_name = "PRESSURE_FE";
2104 neumann_forces.insert(fe_name, new NeumannForcesSurface(m_field));
2105
2106 auto &nf = neumann_forces.at(fe_name);
2107 auto &fe = nf.getLoopFe();
2108
2109 if (ho_geometry)
2110 CHKERR AddHOOps<2, 3, 3>::add(fe.getOpPtrVector(), {},
2111 mesh_nodals_positions);
2112
2114 m_field, SIDESET | PRESSURESET, it)) {
2115 CHKERR nf.addPressure(field_name, F, it->getMeshsetId(), ho_geometry,
2116 false);
2117 }
2118
2119 // Reading pressures from BLOCKSET
2120 const string block_set_pressure_name("PRESSURE");
2122 if (it->getName().compare(0, block_set_pressure_name.length(),
2123 block_set_pressure_name) == 0) {
2124 CHKERR nf.addPressure(field_name, F, it->getMeshsetId(), ho_geometry,
2125 true);
2126 }
2127 }
2128
2129 // Reading pressures from BLOCKSET
2130 const string block_set_linear_pressure_name("LINEAR_PRESSURE");
2132 if (it->getName().compare(0, block_set_linear_pressure_name.length(),
2133 block_set_linear_pressure_name) == 0) {
2134 CHKERR nf.addLinearPressure(field_name, F, it->getMeshsetId(),
2135 ho_geometry);
2136 }
2137 }
2138 }
2139
2141}

The documentation for this struct was generated from the following files: