v0.16.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
MoFEM::VolumeElementForcesAndSourcesCore Struct Reference

Volume finite element base. More...

#include "src/finite_elements/VolumeElementForcesAndSourcesCore.hpp"

Inheritance diagram for MoFEM::VolumeElementForcesAndSourcesCore:
[legend]
Collaboration diagram for MoFEM::VolumeElementForcesAndSourcesCore:
[legend]

Classes

struct  UserDataOperator
 

Public Types

enum  Switches
 
- Public Types inherited from MoFEM::ForcesAndSourcesCore
typedef boost::function< int(int order_row, int order_col, int order_data)> RuleHookFun
 
typedef boost::function< MoFEMErrorCode(ForcesAndSourcesCore *fe_raw_ptr, int order_row, int order_col, int order_data)> GaussHookFun
 
- Public Types inherited from MoFEM::KspMethod
enum  KSPContext { CTX_SETFUNCTION , CTX_OPERATORS , CTX_KSPNONE }
 Context enumeration for KSP solver phases. More...
 
- Public Types inherited from MoFEM::PetscData
enum  DataContext {
  CTX_SET_NONE = 0 , CTX_SET_F = 1 << 0 , CTX_SET_A = 1 << 1 , CTX_SET_B = 1 << 2 ,
  CTX_SET_X = 1 << 3 , CTX_SET_DX = 1 << 4 , CTX_SET_X_T = 1 << 5 , CTX_SET_X_TT = 1 << 6 ,
  CTX_SET_TIME = 1 << 7
}
 Enumeration for data context flags. More...
 
using Switches = std::bitset< 8 >
 Bitset type for context switches.
 
- Public Types inherited from MoFEM::SnesMethod
enum  SNESContext { CTX_SNESSETFUNCTION , CTX_SNESSETJACOBIAN , CTX_SNESNONE }
 Context enumeration for SNES solver phases. More...
 
- Public Types inherited from MoFEM::TSMethod
enum  TSContext {
  CTX_TSSETRHSFUNCTION , CTX_TSSETRHSJACOBIAN , CTX_TSSETIFUNCTION , CTX_TSSETIJACOBIAN ,
  CTX_TSTSMONITORSET , CTX_TSNONE
}
 Context enumeration for TS solver phases. More...
 
- Public Types inherited from MoFEM::TaoMethod
enum  TAOContext { CTX_TAO_OBJECTIVE , CTX_TAO_GRADIENT , CTX_TAO_HESSIAN , CTX_TAO_NONE }
 Context enumeration for TAO solver phases. More...
 

Public Member Functions

 VolumeElementForcesAndSourcesCore (Interface &m_field)
 
DEPRECATED VolumeElementForcesAndSourcesCore (Interface &m_field, const EntityType type)
 
MoFEMErrorCode operator() ()
 Main operator function executed for each loop iteration.
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore
 ForcesAndSourcesCore (Interface &m_field)
 
boost::ptr_deque< UserDataOperator > & getOpPtrVector ()
 Use to push back operator for row operator.
 
auto & getElementPolynomialBase ()
 Get the Entity Polynomial Base object.
 
auto & getUserPolynomialBase ()
 Get the User Polynomial Base object.
 
virtual MoFEMErrorCode preProcess ()
 Pre-processing function executed at loop initialization.
 
virtual MoFEMErrorCode postProcess ()
 Post-processing function executed at loop completion.
 
int getMaxDataOrder () const
 Get max order of approximation for data fields.
 
int getMaxRowOrder () const
 Get max order of approximation for field in rows.
 
int getMaxColOrder () const
 Get max order of approximation for field in columns.
 
auto & getEntData (const FieldSpace space, const EntityType type, const int side)
 Get the entity data.
 
auto & getDataOnElementBySpaceArray ()
 Get data on entities and space.
 
auto & getDerivedDataOnElementBySpaceArray ()
 Get derived data on entities and space.
 
- Public Member Functions inherited from MoFEM::FEMethod
MoFEMErrorCode query_interface (boost::typeindex::type_index, UnknownInterface **iface) const
 Query interface for type casting.
 
 FEMethod ()=default
 Default constructor.
 
auto getFEName () const
 Get the name of the current finite element.
 
auto getDataDofsPtr () const
 Get pointer to DOF data for the current finite element.
 
auto getDataVectorDofsPtr () const
 Get pointer to vector DOF data for the current finite element.
 
const FieldEntity_vector_viewgetDataFieldEnts () const
 Get reference to data field entities for the current finite element.
 
boost::shared_ptr< FieldEntity_vector_view > & getDataFieldEntsPtr () const
 Get shared pointer to data field entities for the current finite element.
 
auto & getRowFieldEnts () const
 Get reference to row field entities for the current finite element.
 
auto & getRowFieldEntsPtr () const
 Get shared pointer to row field entities for the current finite element.
 
auto & getColFieldEnts () const
 Get reference to column field entities for the current finite element.
 
auto & getColFieldEntsPtr () const
 Get shared pointer to column field entities for the current finite element.
 
auto getRowDofsPtr () const
 Get pointer to row DOFs for the current finite element.
 
auto getColDofsPtr () const
 Get pointer to column DOFs for the current finite element.
 
auto getNumberOfNodes () const
 Get the number of nodes in the current finite element.
 
EntityHandle getFEEntityHandle () const
 Get the entity handle of the current finite element.
 
MoFEMErrorCode getNodeData (const std::string field_name, VectorDouble &data, const bool reset_dofs=true)
 Get nodal data for a specific field.
 
- Public Member Functions inherited from MoFEM::BasicMethod
 BasicMethod ()
 Default constructor.
 
virtual ~BasicMethod ()=default
 Virtual destructor.
 
int getNinTheLoop () const
 Get current loop iteration index.
 
int getLoopSize () const
 Get total loop size.
 
auto getLoHiFERank () const
 Get processor rank range for finite element iteration.
 
auto getLoFERank () const
 Get lower processor rank for finite element iteration.
 
auto getHiFERank () const
 Get upper processor rank for finite element iteration.
 
unsigned int getFieldBitNumber (std::string field_name) const
 Get bit number for a specific field by name.
 
MoFEMErrorCode copyBasicMethod (const BasicMethod &basic)
 Copy data from another BasicMethod instance.
 
boost::weak_ptr< CacheTuplegetCacheWeakPtr () const
 Get the cache weak pointer object.
 
- Public Member Functions inherited from MoFEM::KspMethod
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Query interface for type casting.
 
 KspMethod ()
 Default constructor.
 
virtual ~KspMethod ()=default
 Virtual destructor.
 
MoFEMErrorCode copyKsp (const KspMethod &ksp)
 Copy data from another KSP method.
 
- Public Member Functions inherited from MoFEM::PetscData
 PetscData ()
 Default constructor.
 
virtual ~PetscData ()=default
 Virtual destructor.
 
MoFEMErrorCode copyPetscData (const PetscData &petsc_data)
 Copy PETSc data from another instance.
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface.
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface.
 
virtual ~UnknownInterface ()=default
 
- Public Member Functions inherited from MoFEM::SnesMethod
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Query interface for type casting.
 
 SnesMethod ()
 Default constructor.
 
virtual ~SnesMethod ()=default
 Virtual destructor.
 
MoFEMErrorCode copySnes (const SnesMethod &snes)
 Copy SNES data from another instance.
 
- Public Member Functions inherited from MoFEM::TSMethod
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Query interface for type casting.
 
 TSMethod ()
 Default constructor.
 
virtual ~TSMethod ()=default
 Virtual destructor.
 
MoFEMErrorCode copyTs (const TSMethod &ts)
 Copy TS solver data from another instance.
 
- Public Member Functions inherited from MoFEM::TaoMethod
MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Query interface for type casting.
 
 TaoMethod ()
 Default constructor.
 
virtual ~TaoMethod ()=default
 Virtual destructor.
 
MoFEMErrorCode copyTao (const TaoMethod &tao)
 Copy TAO data from another instance.
 

Public Attributes

std::string meshPositionsFieldName
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore
InterfacemField
 
RuleHookFun getRuleHook
 Hook to get rule.
 
GaussHookFun setRuleHook
 Set function to calculate integration rule.
 
MatrixDouble gaussPts
 Matrix of integration points.
 
- Public Attributes inherited from MoFEM::FEMethod
std::string feName
 Name of the finite element being processed.
 
boost::shared_ptr< const NumeredEntFiniteElementnumeredEntFiniteElementPtr
 Shared pointer to finite element database structure.
 
boost::function< bool(FEMethod *fe_method_ptr)> exeTestHook
 Test function to determine if element should be skipped.
 
- Public Attributes inherited from MoFEM::BasicMethod
int nInTheLoop
 Current index of processed method in the loop.
 
int loopSize
 Total number of methods to process in the loop.
 
std::pair< int, int > loHiFERank
 Processor rank range for distributed finite element iteration.
 
int rAnk
 Current processor rank in MPI communicator.
 
int sIze
 Total number of processors in MPI communicator.
 
const RefEntity_multiIndexrefinedEntitiesPtr = nullptr
 Pointer to container of refined MoFEM DOF entities.
 
const RefElement_multiIndexrefinedFiniteElementsPtr = nullptr
 Pointer to container of refined finite element entities.
 
const ProblemproblemPtr = nullptr
 Raw pointer to current MoFEM problem instance.
 
const Field_multiIndexfieldsPtr = nullptr
 Raw pointer to fields multi-index container.
 
const FieldEntity_multiIndexentitiesPtr = nullptr
 Raw pointer to container of field entities.
 
const DofEntity_multiIndexdofsPtr = nullptr
 Raw pointer to container of degree of freedom entities.
 
const FiniteElement_multiIndexfiniteElementsPtr = nullptr
 Raw pointer to container of finite elements.
 
const EntFiniteElement_multiIndexfiniteElementsEntitiesPtr = nullptr
 Raw pointer to container of finite element entities.
 
const FieldEntityEntFiniteElementAdjacencyMap_multiIndexadjacenciesPtr = nullptr
 Raw pointer to container of adjacencies between DOFs and finite elements.
 
boost::function< MoFEMErrorCode()> preProcessHook
 Hook function for pre-processing operations.
 
boost::function< MoFEMErrorCode()> postProcessHook
 Hook function for post-processing operations.
 
boost::function< MoFEMErrorCode()> operatorHook
 Hook function for main operator execution.
 
boost::movelib::unique_ptr< boolvecAssembleSwitch
 Switch for vector assembly operations.
 
boost::movelib::unique_ptr< boolmatAssembleSwitch
 Switch for matrix assembly operations.
 
boost::weak_ptr< CacheTuplecacheWeakPtr
 Weak pointer to cached entity data.
 
- Public Attributes inherited from MoFEM::KspMethod
KSPContext ksp_ctx = CTX_KSPNONE
 Current KSP computation context.
 
KSP ksp = PETSC_NULLPTR
 PETSc KSP linear solver object.
 
Vec & ksp_f
 Reference to residual vector in KSP context.
 
Mat & ksp_A
 Reference to system matrix in KSP context.
 
Mat & ksp_B
 Reference to preconditioner matrix in KSP context.
 
- Public Attributes inherited from MoFEM::PetscData
Switches data_ctx = CtxSetNone
 Current data context switches.
 
Vec f = PETSC_NULLPTR
 PETSc residual vector.
 
Mat A = PETSC_NULLPTR
 PETSc Jacobian matrix.
 
Mat B = PETSC_NULLPTR
 PETSc preconditioner matrix.
 
Vec x = PETSC_NULLPTR
 PETSc solution vector.
 
Vec dx = PETSC_NULLPTR
 PETSc solution increment vector.
 
Vec x_t = PETSC_NULLPTR
 PETSc first time derivative vector.
 
Vec x_tt = PETSC_NULLPTR
 PETSc second time derivative vector.
 
- Public Attributes inherited from MoFEM::SnesMethod
SNESContext snes_ctx = CTX_SNESNONE
 Current SNES computation context.
 
SNES snes = PETSC_NULLPTR
 PETSc SNES nonlinear solver object.
 
Vec & snes_x
 Reference to current solution state vector.
 
Vec & snes_dx
 Reference to solution update/increment vector.
 
Vec & snes_f
 Reference to residual vector.
 
Mat & snes_A
 Reference to Jacobian matrix.
 
Mat & snes_B
 Reference to preconditioner of Jacobian matrix.
 
- Public Attributes inherited from MoFEM::TSMethod
TS ts = PETSC_NULLPTR
 PETSc time stepping solver object.
 
TSContext ts_ctx = CTX_TSNONE
 Current TS computation context.
 
PetscInt ts_step
 Current time step number.
 
PetscReal ts_a
 Shift parameter for U_t (see PETSc Time Solver documentation)
 
PetscReal ts_aa
 Shift parameter for U_tt (second time derivative)
 
PetscReal ts_t
 Current time value.
 
PetscReal ts_dt
 Current time step size.
 
Vec & ts_u
 Reference to current state vector U(t)
 
Vec & ts_u_t
 Reference to first time derivative of state vector dU/dt.
 
Vec & ts_u_tt
 Reference to second time derivative of state vector d²U/dt²
 
Vec & ts_F
 Reference to residual vector F(t,U,U_t,U_tt)
 
Mat & ts_A
 Reference to Jacobian matrix: dF/dU + a*dF/dU_t + aa*dF/dU_tt.
 
Mat & ts_B
 Reference to preconditioner matrix for ts_A.
 
- Public Attributes inherited from MoFEM::TaoMethod
TAOContext tao_ctx = CTX_TAO_NONE
 Current TAO computation context.
 
Tao tao = PETSC_NULLPTR
 PETSc TAO optimization solver object.
 
Vec & tao_x
 Reference to optimization variables vector.
 
Vec & tao_f
 Reference to gradient vector.
 
Mat & tao_A
 Reference to Hessian matrix.
 
Mat & tao_B
 Reference to preconditioner matrix for Hessian.
 

Protected Member Functions

virtual MoFEMErrorCode setIntegrationPts ()
 Set integration points.
 
virtual MoFEMErrorCode calculateVolumeAndJacobian ()
 Calculate element volume and Jacobian.
 
virtual MoFEMErrorCode calculateCoordinatesAtGaussPts ()
 Calculate coordinate at integration points.
 
virtual MoFEMErrorCode getSpaceBaseAndOrderOnElement ()
 Determine approximation space and order of base functions.
 
virtual MoFEMErrorCode transformBaseFunctions ()
 Transform base functions based on geometric element Jacobian.
 
- Protected Member Functions inherited from MoFEM::ForcesAndSourcesCore
MoFEMErrorCode getEntitySense (const EntityType type, boost::ptr_vector< EntitiesFieldData::EntData > &data) const
 get sense (orientation) of entity
 
MoFEMErrorCode getEntityDataOrder (const EntityType type, const FieldSpace space, boost::ptr_vector< EntitiesFieldData::EntData > &data) const
 Get the entity data order.
 
template<EntityType type>
MoFEMErrorCode getEntitySense (EntitiesFieldData &data) const
 Get the entity sense (orientation)
 
template<EntityType type>
MoFEMErrorCode getEntityDataOrder (EntitiesFieldData &data, const FieldSpace space) const
 Get the entity data order for given space.
 
MoFEMErrorCode getFaceNodes (EntitiesFieldData &data) const
 Get nodes on faces.
 
MoFEMErrorCode getSpacesAndBaseOnEntities (EntitiesFieldData &data) const
 Get field approximation space and base on entities.
 
virtual int getRule (int order_row, int order_col, int order_data)
 another variant of getRule
 
virtual MoFEMErrorCode setGaussPts (int order_row, int order_col, int order_data)
 set user specific integration rule
 
MoFEMErrorCode calHierarchicalBaseFunctionsOnElement (const FieldApproximationBase b)
 Calculate base functions.
 
MoFEMErrorCode calHierarchicalBaseFunctionsOnElement ()
 Calculate base functions.
 
MoFEMErrorCode calBernsteinBezierBaseFunctionsOnElement ()
 Calculate Bernstein-Bezier base.
 
MoFEMErrorCode createDataOnElement (EntityType type)
 Create a entity data on element object.
 
MoFEMErrorCode loopOverOperators ()
 Iterate user data operators.
 
template<typename EXTRACTOR >
MoFEMErrorCode getNodesIndices (const int bit_number, FieldEntity_vector_view &ents_field, VectorInt &nodes_indices, VectorInt &local_nodes_indices, EXTRACTOR &&extractor) const
 get node indices
 
MoFEMErrorCode getRowNodesIndices (EntitiesFieldData &data, const int bit_number) const
 get row node indices from FENumeredDofEntity_multiIndex
 
MoFEMErrorCode getColNodesIndices (EntitiesFieldData &data, const int bit_number) const
 get col node indices from FENumeredDofEntity_multiIndex
 
template<typename EXTRACTOR >
MoFEMErrorCode getEntityIndices (EntitiesFieldData &data, const int bit_number, FieldEntity_vector_view &ents_field, const EntityType type_lo, const EntityType type_hi, EXTRACTOR &&extractor) const
 
MoFEMErrorCode getEntityRowIndices (EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
 
MoFEMErrorCode getEntityColIndices (EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
 
MoFEMErrorCode getNoFieldRowIndices (EntitiesFieldData &data, const int bit_number) const
 get col NoField indices
 
MoFEMErrorCode getNoFieldColIndices (EntitiesFieldData &data, const int bit_number) const
 get col NoField indices
 
MoFEMErrorCode getBitRefLevelOnData ()
 
MoFEMErrorCode getNodesFieldData (EntitiesFieldData &data, const int bit_number) const
 Get data on nodes.
 
MoFEMErrorCode getEntityFieldData (EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
 
template<typename EXTRACTOR >
MoFEMErrorCode getNoFieldEntityFieldData (EntitiesFieldData &data, const int bit_number, EXTRACTOR &&extractor) const
 Get field data on entities where no field is defined.
 
MoFEMErrorCode getProblemNodesIndices (const std::string &field_name, const NumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
 get indices of nodal indices which are declared for problem but not this particular element
 
MoFEMErrorCode getProblemTypeIndices (const std::string &field_name, const NumeredDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorInt &indices) const
 get indices by type (generic function) which are declared for problem but not this particular element
 
MoFEMErrorCode getProblemNodesRowIndices (const std::string &field_name, VectorInt &nodes_indices) const
 
MoFEMErrorCode getProblemTypeRowIndices (const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
 
MoFEMErrorCode getProblemNodesColIndices (const std::string &field_name, VectorInt &nodes_indices) const
 
MoFEMErrorCode getProblemTypeColIndices (const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
 
virtual int getRule (int order)
 
virtual MoFEMErrorCode setGaussPts (int order)
 

Protected Attributes

VectorDouble coords
 
MatrixDouble3by3 jAc
 
MatrixDouble3by3 invJac
 
OpSetInvJacH1 opSetInvJacH1
 
OpSetContravariantPiolaTransform opContravariantPiolaTransform
 
OpSetCovariantPiolaTransform opCovariantPiolaTransform
 
OpSetInvJacHdivAndHcurl opSetInvJacHdivAndHcurl
 
doublevOlume
 
int num_nodes
 
const EntityHandle * conn
 
FTensor::Tensor2< double *, 3, 3 > tJac
 
FTensor::Tensor2< double *, 3, 3 > tInvJac
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore
const std::array< boost::shared_ptr< EntitiesFieldData >, LASTSPACEdataOnElement
 Entity data on element entity rows fields.
 
const std::array< boost::shared_ptr< EntitiesFieldData >, LASTSPACEderivedDataOnElement
 Entity data on element entity columns fields.
 
EntitiesFieldDatadataNoField
 
EntitiesFieldDatadataH1
 
EntitiesFieldDatadataHcurl
 
EntitiesFieldDatadataHdiv
 
EntitiesFieldDatadataL2
 
boost::ptr_deque< UserDataOperatoropPtrVector
 Vector of finite element users data operators.
 
EntityType lastEvaluatedElementEntityType
 Last evaluated type of element entity.
 
MatrixDouble coordsAtGaussPts
 coordinated at gauss points
 
double elementMeasure
 

Friends

class UserDataOperator
 

Additional Inherited Members

- Static Public Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version.
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version.
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version.
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version.
 
- Static Public Attributes inherited from MoFEM::PetscData
static constexpr Switches CtxSetNone = PetscData::Switches(CTX_SET_NONE)
 No data switch.
 
static constexpr Switches CtxSetF = PetscData::Switches(CTX_SET_F)
 Residual vector switch.
 
static constexpr Switches CtxSetA = PetscData::Switches(CTX_SET_A)
 Jacobian matrix switch.
 
static constexpr Switches CtxSetB = PetscData::Switches(CTX_SET_B)
 Preconditioner matrix switch.
 
static constexpr Switches CtxSetX = PetscData::Switches(CTX_SET_X)
 Solution vector switch.
 
static constexpr Switches CtxSetDX = PetscData::Switches(CTX_SET_DX)
 Solution increment switch.
 
static constexpr Switches CtxSetX_T = PetscData::Switches(CTX_SET_X_T)
 First time derivative switch.
 
static constexpr Switches CtxSetX_TT = PetscData::Switches(CTX_SET_X_TT)
 Second time derivative switch.
 
static constexpr Switches CtxSetTime = PetscData::Switches(CTX_SET_TIME)
 Time value switch.
 

Detailed Description

Volume finite element base.

User is implementing own operator at Gauss point level, by class derived from VolumeElementForcesAndSourcesCore::UserDataOperator. Arbitrary number of operator can be added by pushing objects to OpPtrVector

Examples
cell_forces.cpp, mofem/atom_tests/build_large_problem.cpp, mofem/atom_tests/child_and_parent.cpp, mofem/atom_tests/field_evaluator.cpp, mofem/atom_tests/forces_and_sources_testing_users_base.cpp, mofem/atom_tests/operators_tests.cpp, mofem/atom_tests/schur_test_diag_mat.cpp, mofem/atom_tests/test_cache_on_entities.cpp, mofem/tutorials/adv-0_plasticity/plastic.cpp, mofem/tutorials/cor-10_navier_stokes/navier_stokes.cpp, mofem/tutorials/cor-2to5_analytical_poisson/src/PoissonOperators.hpp, mofem/tutorials/cor-6_simple_elasticity/simple_elasticity.cpp, mofem/tutorials/cor-7_elasticity_mixed_formulation/elasticity_mixed_formulation.cpp, mofem/tutorials/fun-0_hello_world/hello_world.cpp, mofem/tutorials/fun-1_integration/integration.cpp, mofem/tutorials/fun-2_plot_base/plot_base.cpp, mofem/tutorials/max-0_magnetostatics/src/MagneticElement.hpp, mofem/tutorials/max-1_lorentz_force//lorentz_force.cpp, mofem/tutorials/scl-0_least_squares/approximation.cpp, mofem/tutorials/vec-1_eigen_elasticity/eigen_elastic.cpp, mofem/tutorials/vec-3_nonlinear_dynamics/nonlinear_dynamic_elastic.cpp, mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_element.cpp, mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_scaled_with_density_element.cpp, mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp, mofem/users_modules/bone_remodelling/src/Remodeling.hpp, plastic.cpp, and thermoplastic.cpp.

Definition at line 26 of file VolumeElementForcesAndSourcesCore.hpp.

Member Enumeration Documentation

◆ Switches

Definition at line 40 of file VolumeElementForcesAndSourcesCore.hpp.

40 {
41 };

Constructor & Destructor Documentation

◆ VolumeElementForcesAndSourcesCore() [1/2]

MoFEM::VolumeElementForcesAndSourcesCore::VolumeElementForcesAndSourcesCore ( Interface m_field)

Definition at line 11 of file VolumeElementForcesAndSourcesCore.cpp.

14 meshPositionsFieldName("MESH_NODE_POSITIONS"), coords(24), jAc(3, 3),
18 tJac(&jAc(0, 0), &jAc(0, 1), &jAc(0, 2), &jAc(1, 0), &jAc(1, 1),
19 &jAc(1, 2), &jAc(2, 0), &jAc(2, 1), &jAc(2, 2)),
20 tInvJac(&invJac(0, 0), &invJac(0, 1), &invJac(0, 2), &invJac(1, 0),
21 &invJac(1, 1), &invJac(1, 2), &invJac(2, 0), &invJac(2, 1),
22 &invJac(2, 2)) {}

◆ VolumeElementForcesAndSourcesCore() [2/2]

MoFEM::VolumeElementForcesAndSourcesCore::VolumeElementForcesAndSourcesCore ( Interface m_field,
const EntityType  type 
)

Member Function Documentation

◆ calculateCoordinatesAtGaussPts()

MoFEMErrorCode MoFEM::VolumeElementForcesAndSourcesCore::calculateCoordinatesAtGaussPts ( )
protectedvirtual

Calculate coordinate at integration points.

Returns
Error code

Definition at line 252 of file VolumeElementForcesAndSourcesCore.cpp.

252 {
254 // Get coords at Gauss points
255 FTensor::Index<'i', 3> i;
256
257 auto &shape_functions = dataH1.dataOnEntities[MBVERTEX][0].getN(NOBASE);
258 double *shape_functions_ptr = &*shape_functions.data().begin();
259 const size_t nb_base_functions = shape_functions.size2();
260 const size_t nb_gauss_pts = gaussPts.size2();
261 coordsAtGaussPts.resize(nb_gauss_pts, 3, false);
262 coordsAtGaussPts.clear();
263 FTensor::Tensor1<FTensor::PackPtr<double *, 3>, 3> t_coords_at_gauss_ptr(
264 &coordsAtGaussPts(0, 0), &coordsAtGaussPts(0, 1),
265 &coordsAtGaussPts(0, 2));
267 shape_functions_ptr);
268 for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
270 &coords[0], &coords[1], &coords[2]);
271 for (int bb = 0; bb != nb_base_functions; ++bb) {
272 t_coords_at_gauss_ptr(i) += t_coords(i) * t_shape_functions;
273 ++t_coords;
274 ++t_shape_functions;
275 };
276 ++t_coords_at_gauss_ptr;
277 }
279}
@ NOBASE
Definition definitions.h:59
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FTensor::Index< 'i', SPACE_DIM > i
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
MatrixDouble coordsAtGaussPts
coordinated at gauss points
MatrixDouble gaussPts
Matrix of integration points.

◆ calculateVolumeAndJacobian()

MoFEMErrorCode MoFEM::VolumeElementForcesAndSourcesCore::calculateVolumeAndJacobian ( )
protectedvirtual

Calculate element volume and Jacobian.

Note that at that point is assumed that geometry is exclusively defined by corner nodes.

Returns
Error code

Definition at line 195 of file VolumeElementForcesAndSourcesCore.cpp.

195 {
197 const auto ent = numeredEntFiniteElementPtr->getEnt();
198 const auto type = numeredEntFiniteElementPtr->getEntType();
199 CHKERR mField.get_moab().get_connectivity(ent, conn, num_nodes, true);
200 coords.resize(3 * num_nodes, false);
201 CHKERR mField.get_moab().get_coords(conn, num_nodes, &*coords.data().begin());
202
203 auto get_tet_t_diff_n = [&]() {
207 };
208
209 auto get_hex_t_diff_n = [&]() {
214 };
215
216 auto get_t_diff_n = [&]() {
217 if (type == MBTET)
218 return get_tet_t_diff_n();
219 return get_hex_t_diff_n();
220 };
221
222 auto t_diff_n = get_t_diff_n();
223
225 &coords[0], &coords[1], &coords[2]);
226 FTensor::Index<'i', 3> i;
227 FTensor::Index<'j', 3> j;
228 jAc.clear();
229
230 for (size_t n = 0; n != num_nodes; ++n) {
231 tJac(i, j) += t_coords(i) * t_diff_n(j);
232 ++t_coords;
233 ++t_diff_n;
234 }
237
238 if (type == MBTET)
239 vOlume *= G_TET_W1[0] / 6.;
240
241#ifndef NDEBUG
242 if (vOlume <= std::numeric_limits<double>::epsilon() || vOlume != vOlume) {
243 MOFEM_LOG("SELF", Sev::warning) << "Volume is zero " << vOlume;
244 MOFEM_LOG("SELF", Sev::warning) << "Coords " << coords << endl;
245 }
246#endif
247
249}
std::string type
#define CHKERR
Inline error check.
static const double G_TET_W1[]
Definition fem_tools.h:1115
#define MOFEM_LOG(channel, severity)
Log.
const double n
refractive index of diffusive medium
FTensor::Index< 'j', 3 > j
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
virtual moab::Interface & get_moab()=0
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
Shared pointer to finite element database structure.
static constexpr std::array< double, 24 > diffShapeFunMBHEXAtCenter
Definition Tools.hpp:218
static constexpr std::array< double, 12 > diffShapeFunMBTET
Definition Tools.hpp:271

◆ getSpaceBaseAndOrderOnElement()

MoFEMErrorCode MoFEM::VolumeElementForcesAndSourcesCore::getSpaceBaseAndOrderOnElement ( )
protectedvirtual

Determine approximation space and order of base functions.

Returns
Error code

Definition at line 282 of file VolumeElementForcesAndSourcesCore.cpp.

282 {
284
287
288 auto type = numeredEntFiniteElementPtr->getEntType();
289 auto dim_type = CN::Dimension(type);
290
291 auto get_data_on_ents = [&](auto lower_dim, auto space) {
293 auto data = dataOnElement[space];
294 data->facesNodes = dataH1.facesNodes;
295 data->facesNodesOrder = dataH1.facesNodesOrder;
296 for (auto dd = dim_type; dd >= lower_dim; --dd) {
297 int nb_ents = moab::CN::NumSubEntities(type, dd);
298 for (int ii = 0; ii != nb_ents; ++ii) {
299 auto sub_ent_type = moab::CN::SubEntityType(type, dd, ii);
300 if ((dataH1.spacesOnEntities[sub_ent_type]).test(space)) {
301 auto &data_on_ent = data->dataOnEntities[sub_ent_type];
302 CHKERR getEntitySense(sub_ent_type, data_on_ent);
303 CHKERR getEntityDataOrder(sub_ent_type, space, data_on_ent);
304 data->spacesOnEntities[sub_ent_type].set(space);
305 }
306 }
307 }
309 };
310
311 CHKERR get_data_on_ents(1, H1); // H1
312 CHKERR get_data_on_ents(1, HCURL); // Hcurl
313 CHKERR get_data_on_ents(2, HDIV); // Hdiv
314 CHKERR get_data_on_ents(3, L2); // L2
315
317}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ L2
field with C-1 continuity
Definition definitions.h:88
@ H1
continuous field
Definition definitions.h:85
@ HCURL
field with continuous tangents
Definition definitions.h:86
@ HDIV
field with continuous normal traction
Definition definitions.h:87
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition ddTensor0.hpp:33
MatrixInt facesNodes
nodes on finite element faces
std::array< std::bitset< LASTSPACE >, MBMAXTYPE > spacesOnEntities
spaces on entity types
MatrixInt facesNodesOrder
order of face nodes on element
MoFEMErrorCode getEntityDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< EntitiesFieldData::EntData > &data) const
Get the entity data order.
MoFEMErrorCode getSpacesAndBaseOnEntities(EntitiesFieldData &data) const
Get field approximation space and base on entities.
const std::array< boost::shared_ptr< EntitiesFieldData >, LASTSPACE > dataOnElement
Entity data on element entity rows fields.
MoFEMErrorCode getFaceNodes(EntitiesFieldData &data) const
Get nodes on faces.
MoFEMErrorCode getEntitySense(const EntityType type, boost::ptr_vector< EntitiesFieldData::EntData > &data) const
get sense (orientation) of entity

◆ operator()()

MoFEMErrorCode MoFEM::VolumeElementForcesAndSourcesCore::operator() ( )
virtual

Main operator function executed for each loop iteration.

This virtual function is called for every item (finite element, entity, etc.) in the loop. It is the core computation function typically used for:

  • Calculating element local matrices and vectors
  • Assembling contributions to global system
  • Element-level post-processing operations
Returns
Error code indicating success or failure

Reimplemented from MoFEM::ForcesAndSourcesCore.

Reimplemented in MoFEM::VolumeElementForcesAndSourcesCoreOnSide.

Definition at line 413 of file VolumeElementForcesAndSourcesCore.cpp.

413 {
415
416 const auto type = numeredEntFiniteElementPtr->getEntType();
418 switch (type) {
419 case MBTET:
421 boost::shared_ptr<BaseFunction>(new TetPolynomialBase(this));
422 break;
423 case MBHEX:
425 boost::shared_ptr<BaseFunction>(new HexPolynomialBase());
426 break;
427 default:
429 }
432 }
433
437 if (gaussPts.size2() == 0)
442
444
445 // Iterate over operators
447
449}
MoFEMErrorCode calHierarchicalBaseFunctionsOnElement()
Calculate base functions.
MoFEMErrorCode loopOverOperators()
Iterate user data operators.
auto & getElementPolynomialBase()
Get the Entity Polynomial Base object.
EntityType lastEvaluatedElementEntityType
Last evaluated type of element entity.
MoFEMErrorCode createDataOnElement(EntityType type)
Create a entity data on element object.
MoFEMErrorCode calBernsteinBezierBaseFunctionsOnElement()
Calculate Bernstein-Bezier base.
virtual MoFEMErrorCode transformBaseFunctions()
Transform base functions based on geometric element Jacobian.
virtual MoFEMErrorCode setIntegrationPts()
Set integration points.
virtual MoFEMErrorCode getSpaceBaseAndOrderOnElement()
Determine approximation space and order of base functions.
virtual MoFEMErrorCode calculateVolumeAndJacobian()
Calculate element volume and Jacobian.
virtual MoFEMErrorCode calculateCoordinatesAtGaussPts()
Calculate coordinate at integration points.

◆ setIntegrationPts()

MoFEMErrorCode MoFEM::VolumeElementForcesAndSourcesCore::setIntegrationPts ( )
protectedvirtual

Set integration points.

Returns
Error code

Definition at line 28 of file VolumeElementForcesAndSourcesCore.cpp.

28 {
30
31 int order_data = getMaxDataOrder();
32 int order_row = getMaxRowOrder();
33 int order_col = getMaxColOrder();
34 const auto type = numeredEntFiniteElementPtr->getEntType();
35
36 auto get_rule_by_type = [&]() {
37 switch (type) {
38 case MBHEX:
39 return getRule(order_row + 1, order_col + 1, order_data + 1);
40 default:
41 return getRule(order_row, order_col, order_data);
42 }
43 };
44
45 const int rule = get_rule_by_type();
46
47 auto calc_base_for_tet = [&]() {
49 const size_t nb_gauss_pts = gaussPts.size2();
50 auto &base = dataH1.dataOnEntities[MBVERTEX][0].getN(NOBASE);
51 auto &diff_base = dataH1.dataOnEntities[MBVERTEX][0].getDiffN(NOBASE);
52 base.resize(nb_gauss_pts, 4, false);
53 diff_base.resize(nb_gauss_pts, 12, false);
54 CHKERR Tools::shapeFunMBTET(&*base.data().begin(), &gaussPts(0, 0),
55 &gaussPts(1, 0), &gaussPts(2, 0), nb_gauss_pts);
56 double *diff_shape_ptr = &*diff_base.data().begin();
57 for (int gg = 0; gg != nb_gauss_pts; ++gg) {
58 for (int nn = 0; nn != 4; ++nn) {
59 for (int dd = 0; dd != 3; ++dd, ++diff_shape_ptr) {
60 *diff_shape_ptr = Tools::diffShapeFunMBTET[3 * nn + dd];
61 }
62 }
63 }
65 };
66
67 auto calc_base_for_hex = [&]() {
69 const size_t nb_gauss_pts = gaussPts.size2();
70 auto &base = dataH1.dataOnEntities[MBVERTEX][0].getN(NOBASE);
71 auto &diff_base = dataH1.dataOnEntities[MBVERTEX][0].getDiffN(NOBASE);
72 base.resize(nb_gauss_pts, 8, false);
73 diff_base.resize(nb_gauss_pts, 24, false);
74 for (int gg = 0; gg != nb_gauss_pts; ++gg) {
75 const double ksi = gaussPts(0, gg);
76 const double zeta = gaussPts(1, gg);
77 const double eta = gaussPts(2, gg);
78 base(gg, 0) = N_MBHEX0(ksi, zeta, eta);
79 base(gg, 1) = N_MBHEX1(ksi, zeta, eta);
80 base(gg, 2) = N_MBHEX2(ksi, zeta, eta);
81 base(gg, 3) = N_MBHEX3(ksi, zeta, eta);
82 base(gg, 4) = N_MBHEX4(ksi, zeta, eta);
83 base(gg, 5) = N_MBHEX5(ksi, zeta, eta);
84 base(gg, 6) = N_MBHEX6(ksi, zeta, eta);
85 base(gg, 7) = N_MBHEX7(ksi, zeta, eta);
86 diff_base(gg, 0 * 3 + 0) = diffN_MBHEX0x(zeta, eta);
87 diff_base(gg, 1 * 3 + 0) = diffN_MBHEX1x(zeta, eta);
88 diff_base(gg, 2 * 3 + 0) = diffN_MBHEX2x(zeta, eta);
89 diff_base(gg, 3 * 3 + 0) = diffN_MBHEX3x(zeta, eta);
90 diff_base(gg, 4 * 3 + 0) = diffN_MBHEX4x(zeta, eta);
91 diff_base(gg, 5 * 3 + 0) = diffN_MBHEX5x(zeta, eta);
92 diff_base(gg, 6 * 3 + 0) = diffN_MBHEX6x(zeta, eta);
93 diff_base(gg, 7 * 3 + 0) = diffN_MBHEX7x(zeta, eta);
94 diff_base(gg, 0 * 3 + 1) = diffN_MBHEX0y(ksi, eta);
95 diff_base(gg, 1 * 3 + 1) = diffN_MBHEX1y(ksi, eta);
96 diff_base(gg, 2 * 3 + 1) = diffN_MBHEX2y(ksi, eta);
97 diff_base(gg, 3 * 3 + 1) = diffN_MBHEX3y(ksi, eta);
98 diff_base(gg, 4 * 3 + 1) = diffN_MBHEX4y(ksi, eta);
99 diff_base(gg, 5 * 3 + 1) = diffN_MBHEX5y(ksi, eta);
100 diff_base(gg, 6 * 3 + 1) = diffN_MBHEX6y(ksi, eta);
101 diff_base(gg, 7 * 3 + 1) = diffN_MBHEX7y(ksi, eta);
102 diff_base(gg, 0 * 3 + 2) = diffN_MBHEX0z(ksi, zeta);
103 diff_base(gg, 1 * 3 + 2) = diffN_MBHEX1z(ksi, zeta);
104 diff_base(gg, 2 * 3 + 2) = diffN_MBHEX2z(ksi, zeta);
105 diff_base(gg, 3 * 3 + 2) = diffN_MBHEX3z(ksi, zeta);
106 diff_base(gg, 4 * 3 + 2) = diffN_MBHEX4z(ksi, zeta);
107 diff_base(gg, 5 * 3 + 2) = diffN_MBHEX5z(ksi, zeta);
108 diff_base(gg, 6 * 3 + 2) = diffN_MBHEX6z(ksi, zeta);
109 diff_base(gg, 7 * 3 + 2) = diffN_MBHEX7z(ksi, zeta);
110 }
112 };
113
114 auto set_integration_pts_for_hex = [&]() {
117 rule);
119 };
120
121 auto set_integration_pts_for_tet = [&]() {
123 const auto xiao_rule =
125 if (!xiao_rule) {
127 "Xiao--Gimbutas tetrahedron rule is available for polynomial "
128 "orders 0 to %d; requested %d",
130 }
131 if (xiao_rule->numBarycentricCoordinates != 4) {
133 "wrong number of tetrahedron barycentric coordinates");
134 }
135
136 const size_t nb_gauss_pts = xiao_rule->numPoints;
137 gaussPts.resize(4, nb_gauss_pts, false);
138 cblas_dcopy(nb_gauss_pts, &xiao_rule->points[1], 4, &gaussPts(0, 0), 1);
139 cblas_dcopy(nb_gauss_pts, &xiao_rule->points[2], 4, &gaussPts(1, 0), 1);
140 cblas_dcopy(nb_gauss_pts, &xiao_rule->points[3], 4, &gaussPts(2, 0), 1);
141 cblas_dcopy(nb_gauss_pts, xiao_rule->weights, 1, &gaussPts(3, 0), 1);
142
143 auto &base = dataH1.dataOnEntities[MBVERTEX][0].getN(NOBASE);
144 auto &diff_base = dataH1.dataOnEntities[MBVERTEX][0].getDiffN(NOBASE);
145 base.resize(nb_gauss_pts, 4, false);
146 diff_base.resize(nb_gauss_pts, 12, false);
147 double *shape_ptr = &*base.data().begin();
148 cblas_dcopy(4 * nb_gauss_pts, xiao_rule->points, 1, shape_ptr, 1);
149 double *diff_shape_ptr = &*diff_base.data().begin();
150 for (int gg = 0; gg != nb_gauss_pts; ++gg) {
151 for (int nn = 0; nn != 4; ++nn) {
152 for (int dd = 0; dd != 3; ++dd, ++diff_shape_ptr) {
153 *diff_shape_ptr = Tools::diffShapeFunMBTET[3 * nn + dd];
154 }
155 }
156 }
158 };
159
160 if (rule >= 0) {
161 switch (type) {
162 case MBTET:
163 CHKERR set_integration_pts_for_tet();
164 break;
165 case MBHEX:
166 CHKERR set_integration_pts_for_hex();
167 CHKERR calc_base_for_hex();
168 break;
169 default:
170 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
171 "Element type not implemented: %d", type);
172 }
173 } else {
174 // If rule is negative, set user defined integration points
175 CHKERR setGaussPts(order_row, order_col, order_data);
176 const size_t nb_gauss_pts = gaussPts.size2();
177 if (nb_gauss_pts) {
178 switch (type) {
179 case MBTET: {
180 CHKERR calc_base_for_tet();
181 } break;
182 case MBHEX:
183 CHKERR calc_base_for_hex();
184 break;
185 default:
186 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
187 "Element type not implemented: %d", type);
188 }
189 }
190 }
191
193}
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
#define diffN_MBHEX3z(x, y)
Definition fem_tools.h:98
#define diffN_MBHEX7z(x, y)
Definition fem_tools.h:102
#define diffN_MBHEX7y(x, z)
Definition fem_tools.h:94
#define diffN_MBHEX6x(y, z)
Definition fem_tools.h:85
#define N_MBHEX7(x, y, z)
Definition fem_tools.h:78
#define N_MBHEX3(x, y, z)
Definition fem_tools.h:74
#define N_MBHEX5(x, y, z)
Definition fem_tools.h:76
#define diffN_MBHEX1y(x, z)
Definition fem_tools.h:88
#define diffN_MBHEX3y(x, z)
Definition fem_tools.h:90
#define diffN_MBHEX4y(x, z)
Definition fem_tools.h:91
#define diffN_MBHEX5x(y, z)
Definition fem_tools.h:84
#define diffN_MBHEX1z(x, y)
Definition fem_tools.h:96
#define diffN_MBHEX4z(x, y)
Definition fem_tools.h:99
#define diffN_MBHEX6y(x, z)
Definition fem_tools.h:93
#define diffN_MBHEX6z(x, y)
Definition fem_tools.h:101
#define N_MBHEX4(x, y, z)
Definition fem_tools.h:75
#define N_MBHEX0(x, y, z)
Definition fem_tools.h:71
#define N_MBHEX6(x, y, z)
Definition fem_tools.h:77
#define diffN_MBHEX5z(x, y)
Definition fem_tools.h:100
#define N_MBHEX2(x, y, z)
Definition fem_tools.h:73
#define diffN_MBHEX0x(y, z)
Definition fem_tools.h:79
#define diffN_MBHEX1x(y, z)
Definition fem_tools.h:80
#define diffN_MBHEX2z(x, y)
Definition fem_tools.h:97
#define diffN_MBHEX5y(x, z)
Definition fem_tools.h:92
#define diffN_MBHEX4x(y, z)
Definition fem_tools.h:83
#define N_MBHEX1(x, y, z)
Definition fem_tools.h:72
#define diffN_MBHEX3x(y, z)
Definition fem_tools.h:82
#define diffN_MBHEX2y(x, z)
Definition fem_tools.h:89
#define diffN_MBHEX0y(x, z)
Definition fem_tools.h:87
#define diffN_MBHEX0z(x, y)
Definition fem_tools.h:95
#define diffN_MBHEX2x(y, z)
Definition fem_tools.h:81
#define diffN_MBHEX7x(y, z)
Definition fem_tools.h:86
double eta
const Rule * getTetrahedronRule(const int order)
virtual MPI_Comm & get_comm() const =0
int getMaxRowOrder() const
Get max order of approximation for field in rows.
virtual MoFEMErrorCode setGaussPts(int order_row, int order_col, int order_data)
set user specific integration rule
int getMaxDataOrder() const
Get max order of approximation for data fields.
int getMaxColOrder() const
Get max order of approximation for field in columns.
virtual int getRule(int order_row, int order_col, int order_data)
another variant of getRule
static MoFEMErrorCode outerProductOfEdgeIntegrationPtsForHex(MatrixDouble &pts, const int edge0, const int edge1, const int edge2)
Definition Tools.cpp:662
static MoFEMErrorCode shapeFunMBTET(double *shape, const double *ksi, const double *eta, const double *zeta, const double nb)
Calculate shape functions on tetrahedron.
Definition Tools.hpp:767
double zeta
Viscous hardening.
Definition plastic.cpp:131

◆ transformBaseFunctions()

MoFEMErrorCode MoFEM::VolumeElementForcesAndSourcesCore::transformBaseFunctions ( )
protectedvirtual

Transform base functions based on geometric element Jacobian.

This function apply transformation to base functions and its derivatives. For example when base functions for H-div are present the Piola-Transformation is applied to base functions and their derivatives.

Returns
Error code

Definition at line 319 of file VolumeElementForcesAndSourcesCore.cpp.

319 {
321
322 if (numeredEntFiniteElementPtr->getEntType() == MBTET) {
323 // OK that code is not nice.
324 MatrixDouble new_diff_n;
325 for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
326 FTensor::Index<'i', 3> i;
327 FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
328 EntitiesFieldData::EntData &data = dataH1.dataOnEntities[MBVERTEX][0];
329 if ((data.getDiffN(base).size1() == 4) &&
330 (data.getDiffN(base).size2() == 3)) {
331 const size_t nb_gauss_pts = gaussPts.size2();
332 const size_t nb_base_functions = 4;
333 new_diff_n.resize(nb_gauss_pts, 3 * nb_base_functions, false);
334 double *new_diff_n_ptr = &*new_diff_n.data().begin();
336 new_diff_n_ptr, &new_diff_n_ptr[1], &new_diff_n_ptr[2]);
337 double *t_diff_n_ptr = &*data.getDiffN(base).data().begin();
338 for (unsigned int gg = 0; gg != nb_gauss_pts; gg++) {
340 t_diff_n_ptr, &t_diff_n_ptr[1], &t_diff_n_ptr[2]);
341 for (unsigned int bb = 0; bb != nb_base_functions; bb++) {
342 t_new_diff_n(i) = t_diff_n(i);
343 ++t_new_diff_n;
344 ++t_diff_n;
345 }
346 }
347 data.getDiffN(base).resize(new_diff_n.size1(), new_diff_n.size2(),
348 false);
349 data.getDiffN(base).swap(new_diff_n);
350 }
351 }
352 }
353
354 if (dataH1.spacesOnEntities[MBVERTEX].test(H1))
356
357 std::array<std::bitset<LASTSPACE>, 4> spaces_by_dim{
358
359 std::bitset<LASTSPACE>(0), //
360 std::bitset<LASTSPACE>(0), //
361 std::bitset<LASTSPACE>(0), //
362 std::bitset<LASTSPACE>(0)
363
364 };
365 for (auto type = MBEDGE; type != MBENTITYSET; ++type) {
366 spaces_by_dim[CN::Dimension(type)] |= dataH1.spacesOnEntities[type];
367 }
368
369 if (
370
371 spaces_by_dim[1].test(HCURL) || //
372 spaces_by_dim[2].test(HCURL) || //
373 spaces_by_dim[3].test(HCURL)
374
375 ) {
378 }
379
380 if (spaces_by_dim[2].test(HDIV) || spaces_by_dim[3].test(HDIV)) {
382 // Fix for tetrahedrons
383 if (numeredEntFiniteElementPtr->getEntType() == MBTET) {
384 for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
385 FieldApproximationBase base = static_cast<FieldApproximationBase>(b);
386 for (auto t : {MBTRI, MBTET}) {
387 for (auto &d : dataHdiv.dataOnEntities[t]) {
388 d.getN(base) /= 6;
389 d.getDiffN(base) /= 6;
390 }
391 }
392 }
393 }
395 }
396
397 if (spaces_by_dim[3].test(L2)) {
399 }
400
402}
FieldApproximationBase
approximation base
Definition definitions.h:58
@ LASTBASE
Definition definitions.h:69
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
constexpr double t
plate stiffness
Definition plate.cpp:58
virtual MoFEMErrorCode opRhs(EntitiesFieldData &data, const bool error_if_no_base=false)

Friends And Related Symbol Documentation

◆ UserDataOperator

friend class UserDataOperator
friend

Definition at line 106 of file VolumeElementForcesAndSourcesCore.hpp.

Member Data Documentation

◆ conn

const EntityHandle* MoFEM::VolumeElementForcesAndSourcesCore::conn
protected

Definition at line 102 of file VolumeElementForcesAndSourcesCore.hpp.

◆ coords

VectorDouble MoFEM::VolumeElementForcesAndSourcesCore::coords
protected

Definition at line 90 of file VolumeElementForcesAndSourcesCore.hpp.

◆ invJac

MatrixDouble3by3 MoFEM::VolumeElementForcesAndSourcesCore::invJac
protected

Definition at line 92 of file VolumeElementForcesAndSourcesCore.hpp.

◆ jAc

MatrixDouble3by3 MoFEM::VolumeElementForcesAndSourcesCore::jAc
protected

Definition at line 91 of file VolumeElementForcesAndSourcesCore.hpp.

◆ meshPositionsFieldName

std::string MoFEM::VolumeElementForcesAndSourcesCore::meshPositionsFieldName
Deprecated:
DO NOT USE!

Definition at line 33 of file VolumeElementForcesAndSourcesCore.hpp.

◆ num_nodes

int MoFEM::VolumeElementForcesAndSourcesCore::num_nodes
protected

Definition at line 101 of file VolumeElementForcesAndSourcesCore.hpp.

◆ opContravariantPiolaTransform

OpSetContravariantPiolaTransform MoFEM::VolumeElementForcesAndSourcesCore::opContravariantPiolaTransform
protected

Definition at line 95 of file VolumeElementForcesAndSourcesCore.hpp.

◆ opCovariantPiolaTransform

OpSetCovariantPiolaTransform MoFEM::VolumeElementForcesAndSourcesCore::opCovariantPiolaTransform
protected

Definition at line 96 of file VolumeElementForcesAndSourcesCore.hpp.

◆ opSetInvJacH1

OpSetInvJacH1 MoFEM::VolumeElementForcesAndSourcesCore::opSetInvJacH1
protected

Definition at line 94 of file VolumeElementForcesAndSourcesCore.hpp.

◆ opSetInvJacHdivAndHcurl

OpSetInvJacHdivAndHcurl MoFEM::VolumeElementForcesAndSourcesCore::opSetInvJacHdivAndHcurl
protected

Definition at line 97 of file VolumeElementForcesAndSourcesCore.hpp.

◆ tInvJac

FTensor::Tensor2<double *, 3, 3> MoFEM::VolumeElementForcesAndSourcesCore::tInvJac
protected

Definition at line 104 of file VolumeElementForcesAndSourcesCore.hpp.

◆ tJac

FTensor::Tensor2<double *, 3, 3> MoFEM::VolumeElementForcesAndSourcesCore::tJac
protected

Definition at line 103 of file VolumeElementForcesAndSourcesCore.hpp.

◆ vOlume

double& MoFEM::VolumeElementForcesAndSourcesCore::vOlume
protected

Definition at line 99 of file VolumeElementForcesAndSourcesCore.hpp.


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