v0.15.5
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
MoFEM::OpGetHONormalsOnFace< FIELD_DIM > Struct Template Reference

Calculate normal vectors at Gauss points of face elements. More...

#include "src/finite_elements/HODataOperators.hpp"

Inheritance diagram for MoFEM::OpGetHONormalsOnFace< FIELD_DIM >:
[legend]
Collaboration diagram for MoFEM::OpGetHONormalsOnFace< FIELD_DIM >:
[legend]

Public Types

using OP = FaceElementForcesAndSourcesCore::UserDataOperator
 
- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType {
  OPROW = 1 << 0 , OPCOL = 1 << 1 , OPROWCOL = 1 << 2 , OPSPACE = 1 << 3 ,
  OPLAST = 1 << 3
}
 Controls loop over entities on element. More...
 
using AdjCache = std::map< EntityHandle, std::vector< boost::weak_ptr< NumeredEntFiniteElement > > >
 
- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)>
 
using DoWorkRhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int side, EntityType type, EntitiesFieldData::EntData &data)>
 

Public Member Functions

 OpGetHONormalsOnFace (std::string field_name, bool add_field=false)
 Constructor for HO normal vectors calculation on faces.
 
 OpGetHONormalsOnFace (std::string field_name, boost::shared_ptr< MatrixDouble > tangent1_at_pts, boost::shared_ptr< MatrixDouble > tangent2_at_pts, boost::shared_ptr< MatrixDouble > normals_at_pts, bool add_field=false)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side.
 
- Public Member Functions inherited from MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
double getArea ()
 get area of face
 
VectorDoublegetNormal ()
 get triangle normal
 
VectorDoublegetTangent1 ()
 get triangle tangent 1
 
VectorDoublegetTangent2 ()
 get triangle tangent 2
 
auto getFTensor1Normal ()
 get normal as tensor
 
auto getFTensor1Tangent1 ()
 get tangentOne as tensor
 
auto getFTensor1Tangent2 ()
 get tangentTwo as tensor
 
int getNumNodes ()
 get element number of nodes
 
const EntityHandlegetConn ()
 get element connectivity
 
VectorDoublegetCoords ()
 get triangle coordinates
 
auto getFTensor1Coords ()
 get get coords at gauss points
 
MatrixDoublegetNormalsAtGaussPts ()
 if higher order geometry return normals at Gauss pts.
 
ublas::matrix_row< MatrixDoublegetNormalsAtGaussPts (const int gg)
 if higher order geometry return normals at Gauss pts.
 
MatrixDoublegetTangent1AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts.
 
MatrixDoublegetTangent2AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts.
 
auto getFTensor1NormalsAtGaussPts ()
 get normal at integration points
 
auto getFTensor1Tangent1AtGaussPts ()
 get tangent 1 at integration points
 
auto getFTensor1Tangent2AtGaussPts ()
 get tangent 2 at integration points
 
FaceElementForcesAndSourcesCoregetFaceFE ()
 return pointer to Generic Triangle Finite Element object
 
MoFEMErrorCode loopSideVolumes (const string fe_name, VolumeElementForcesAndSourcesCoreOnSide &fe_method)
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, const bool symm=true)
 Constructor for operators working on finite element spaces.
 
 UserDataOperator (const std::string field_name, const char type, const bool symm=true)
 Constructor for operators working on a single field.
 
 UserDataOperator (const std::string row_field_name, const std::string col_field_name, const char type, const bool symm=true)
 Constructor for operators working on two fields (bilinear forms)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement.
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle.
 
int getFEDim () const
 Get dimension of finite element.
 
EntityType getFEType () const
 Get dimension of finite element.
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer.
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity.
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element.
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices.
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices.
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object.
 
int getOpType () const
 Get operator types.
 
void setOpType (const OpType type)
 Set operator type.
 
void addOpType (const OpType type)
 Add operator type.
 
int getNinTheLoop () const
 get number of finite element in the loop
 
int getLoopSize () const
 get size of elements in the loop
 
std::string getFEName () const
 Get name of the element.
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTStimeStep () const
 
double getTSa () const
 
double getTSaa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element
 
auto getFTensor0IntegrationWeight ()
 Get integration weights.
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3)
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry.
 
double getMeasure () const
 get measure of element
 
doublegetMeasure ()
 get measure of element
 
MoFEM::InterfacegetMField ()
 
moab::Interface & getMoab ()
 
virtual boost::weak_ptr< ForcesAndSourcesCoregetSubPipelinePtr () const
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, boost::shared_ptr< Range > fe_range=nullptr, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy, AdjCache *adj_cache=nullptr)
 User calls this function to loop over elements on the side of face. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *this_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over the same element using a different set of integration points. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations.
 
MoFEMErrorCode loopRange (const string &fe_name, ForcesAndSourcesCore *range_fe, boost::shared_ptr< Range > fe_range, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 Iterate over range of elements.
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side.
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not.
 
void setSymm ()
 set if operator is executed taking in account symmetry
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem
 

Private Member Functions

MatrixDoublegetTangent1AtGaussPts ()
 
MatrixDoublegetTangent2AtGaussPts ()
 
MatrixDoublegetNormalsAtGaussPts ()
 

Private Attributes

boost::shared_ptr< MatrixDoubletangent1AtPts
 
boost::shared_ptr< MatrixDoubletangent2AtPts
 
boost::shared_ptr< MatrixDoublenormalsAtPts
 
bool addField = false
 if true add field values, do not overwrite
 

Additional Inherited Members

- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
bool sYmm
 If true assume that matrix is symmetric structure.
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity.
 
booldoVertices
 \deprectaed If false skip vertices
 
booldoEdges
 \deprectaed If false skip edges
 
booldoQuads
 \deprectaed
 
booldoTris
 \deprectaed
 
booldoTets
 \deprectaed
 
booldoPrisms
 \deprectaed
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

template<int FIELD_DIM = 3>
struct MoFEM::OpGetHONormalsOnFace< FIELD_DIM >

Calculate normal vectors at Gauss points of face elements.

This template structure computes normal vectors at integration points for face elements using high-order geometry approximation. It's essential for boundary conditions, surface integrals, and flux calculations in finite element methods.

Template Parameters
FIELD_DIMDimension of the field for normal calculation (default: 3)
Examples
mofem/atom_tests/hcurl_curl_operator.cpp, mofem/tutorials/vec-4_shallow_wave/approx_sphere.cpp, and mofem/tutorials/vec-4_shallow_wave/shallow_wave.cpp.

Definition at line 401 of file HODataOperators.hpp.

Member Typedef Documentation

◆ OP

Definition at line 404 of file HODataOperators.hpp.

Constructor & Destructor Documentation

◆ OpGetHONormalsOnFace() [1/2]

template<int FIELD_DIM = 3>
MoFEM::OpGetHONormalsOnFace< FIELD_DIM >::OpGetHONormalsOnFace ( std::string  field_name,
bool  add_field = false 
)
inline

Constructor for HO normal vectors calculation on faces.

Parameters
field_nameField name where normal vectors will be stored
add_fieldIf true, add to existing field values; if false, overwrite (default: false)

Definition at line 412 of file HODataOperators.hpp.

413 : OP(field_name, OPROW), addField(add_field) {}
constexpr auto field_name
@ OPROW
operator doWork function is executed on FE rows
FaceElementForcesAndSourcesCore::UserDataOperator OP
bool addField
if true add field values, do not overwrite

◆ OpGetHONormalsOnFace() [2/2]

template<int FIELD_DIM = 3>
MoFEM::OpGetHONormalsOnFace< FIELD_DIM >::OpGetHONormalsOnFace ( std::string  field_name,
boost::shared_ptr< MatrixDouble tangent1_at_pts,
boost::shared_ptr< MatrixDouble tangent2_at_pts,
boost::shared_ptr< MatrixDouble normals_at_pts,
bool  add_field = false 
)
inline

Definition at line 415 of file HODataOperators.hpp.

420 : OP(field_name, OPROW), tangent1AtPts(tangent1_at_pts),
421 tangent2AtPts(tangent2_at_pts), normalsAtPts(normals_at_pts),
422 addField(add_field) {}
boost::shared_ptr< MatrixDouble > normalsAtPts
boost::shared_ptr< MatrixDouble > tangent1AtPts
boost::shared_ptr< MatrixDouble > tangent2AtPts

Member Function Documentation

◆ doWork()

template<int FIELD_DIM>
MoFEMErrorCode MoFEM::OpGetHONormalsOnFace< FIELD_DIM >::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)
virtual

Operator for linear form, usually to calculate values on right hand side.

Reimplemented from MoFEM::DataOperator.

Definition at line 834 of file HODataOperators.hpp.

835 {
837
840
841 auto get_ftensor1 = [](MatrixDouble &m) {
843 &m(0, 0), &m(0, 1), &m(0, 2));
844 };
845
846 unsigned int nb_dofs = data.getFieldData().size();
847 if (nb_dofs != 0) {
848
849 int nb_gauss_pts = data.getN().size1();
850 auto &tangent1_at_gauss_pts = getTangent1AtGaussPts();
851 auto &tangent2_at_gauss_pts = getTangent2AtGaussPts();
852 tangent1_at_gauss_pts.resize(nb_gauss_pts, 3, false);
853 tangent2_at_gauss_pts.resize(nb_gauss_pts, 3, false);
854
855 switch (type) {
856 case MBVERTEX: {
857 if (!addField) {
858 tangent1_at_gauss_pts.clear();
859 tangent2_at_gauss_pts.clear();
860 }
861 }
862 case MBEDGE:
863 case MBTRI:
864 case MBQUAD: {
865
866#ifndef NDEBUG
867 if (2 * data.getN().size2() != data.getDiffN().size2()) {
868 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
869 "expected two derivative in local element coordinates");
870 }
871 if (nb_dofs % FIELD_DIM != 0) {
872 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
873 "expected that number of dofs is multiplicative of field "
874 "dimension");
875 }
876#endif
877
878 if (nb_dofs > FIELD_DIM * data.getN().size2()) {
879 unsigned int nn = 0;
880 for (; nn != nb_dofs; nn++) {
881 if (!data.getFieldDofs()[nn]->getActive())
882 break;
883 }
884 if (nn > FIELD_DIM * data.getN().size2()) {
885 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
886 "Data inconsistency for base %s",
887 ApproximationBaseNames[data.getBase()]);
888 } else {
889 nb_dofs = nn;
890 if (!nb_dofs)
892 }
893 }
894 const int nb_base_functions = data.getN().size2();
895 auto t_base = data.getFTensor0N();
896 auto t_diff_base = data.getFTensor1DiffN<2>();
897 auto t_t1 = get_ftensor1(tangent1_at_gauss_pts);
898 auto t_t2 = get_ftensor1(tangent2_at_gauss_pts);
899 for (int gg = 0; gg != nb_gauss_pts; ++gg) {
900 auto t_data = data.getFTensor1FieldData<FIELD_DIM>();
901 int bb = 0;
902 for (; bb != nb_dofs / FIELD_DIM; ++bb) {
904 t_t1(i) += t_data(i) * t_diff_base(N0);
905 t_t2(i) += t_data(i) * t_diff_base(N1);
906 ++t_data;
907 ++t_base;
908 ++t_diff_base;
909 }
910 for (; bb != nb_base_functions; ++bb) {
911 ++t_base;
912 ++t_diff_base;
913 }
914 ++t_t1;
915 ++t_t2;
916 }
917 } break;
918 default:
919 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
920 }
921 }
922
923 if (moab::CN::Dimension(type) == 2) {
924
925 auto &normal_at_gauss_pts = getNormalsAtGaussPts();
926 auto &tangent1_at_gauss_pts = getTangent1AtGaussPts();
927 auto &tangent2_at_gauss_pts = getTangent2AtGaussPts();
928
929 const auto nb_gauss_pts = tangent1_at_gauss_pts.size1();
930 normal_at_gauss_pts.resize(nb_gauss_pts, 3, false);
931
932 auto t_normal = get_ftensor1(normal_at_gauss_pts);
933 auto t_t1 = get_ftensor1(tangent1_at_gauss_pts);
934 auto t_t2 = get_ftensor1(tangent2_at_gauss_pts);
935 for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
936 FTensor::Index<'i', 3> i;
937 FTensor::Index<'j', 3> j;
938 FTensor::Index<'k', 3> k;
939 t_normal(j) = FTensor::levi_civita(i, j, k) * t_t1(k) * t_t2(i);
940 ++t_normal;
941 ++t_t1;
942 ++t_t2;
943 }
944 }
945
947}
constexpr int FIELD_DIM
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
@ MOFEM_NOT_IMPLEMENTED
Definition definitions.h:32
static const char *const ApproximationBaseNames[]
Definition definitions.h:72
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
constexpr std::enable_if<(Dim0<=2 &&Dim1<=2), Tensor2_Expr< Levi_Civita< T >, T, Dim0, Dim1, i, j > >::type levi_civita(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
levi_civita functions to make for easy adhoc use
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
FTensor::Index< 'm', 3 > m
MatrixDouble & getTangent1AtGaussPts()
MatrixDouble & getTangent2AtGaussPts()
MatrixDouble & getNormalsAtGaussPts()

◆ getNormalsAtGaussPts()

template<int FIELD_DIM = 3>
MatrixDouble & MoFEM::OpGetHONormalsOnFace< FIELD_DIM >::getNormalsAtGaussPts ( )
inlineprivate

Definition at line 436 of file HODataOperators.hpp.

436 {
438 }
MatrixDouble & getNormalsAtGaussPts()
if higher order geometry return normals at Gauss pts.

◆ getTangent1AtGaussPts()

template<int FIELD_DIM = 3>
MatrixDouble & MoFEM::OpGetHONormalsOnFace< FIELD_DIM >::getTangent1AtGaussPts ( )
inlineprivate

Definition at line 428 of file HODataOperators.hpp.

428 {
430 }
MatrixDouble & getTangent1AtGaussPts()
if higher order geometry return tangent vector to triangle at Gauss pts.

◆ getTangent2AtGaussPts()

template<int FIELD_DIM = 3>
MatrixDouble & MoFEM::OpGetHONormalsOnFace< FIELD_DIM >::getTangent2AtGaussPts ( )
inlineprivate

Definition at line 432 of file HODataOperators.hpp.

432 {
434 }
MatrixDouble & getTangent2AtGaussPts()
if higher order geometry return tangent vector to triangle at Gauss pts.

Member Data Documentation

◆ addField

template<int FIELD_DIM = 3>
bool MoFEM::OpGetHONormalsOnFace< FIELD_DIM >::addField = false
private

if true add field values, do not overwrite

Definition at line 444 of file HODataOperators.hpp.

◆ normalsAtPts

template<int FIELD_DIM = 3>
boost::shared_ptr<MatrixDouble> MoFEM::OpGetHONormalsOnFace< FIELD_DIM >::normalsAtPts
private

Definition at line 442 of file HODataOperators.hpp.

◆ tangent1AtPts

template<int FIELD_DIM = 3>
boost::shared_ptr<MatrixDouble> MoFEM::OpGetHONormalsOnFace< FIELD_DIM >::tangent1AtPts
private

Definition at line 440 of file HODataOperators.hpp.

◆ tangent2AtPts

template<int FIELD_DIM = 3>
boost::shared_ptr<MatrixDouble> MoFEM::OpGetHONormalsOnFace< FIELD_DIM >::tangent2AtPts
private

Definition at line 441 of file HODataOperators.hpp.


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