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 417 of file HODataOperators.hpp.

Member Typedef Documentation

◆ OP

Definition at line 420 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 428 of file HODataOperators.hpp.

429 : 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 431 of file HODataOperators.hpp.

436 : OP(field_name, OPROW), tangent1AtPts(tangent1_at_pts),
437 tangent2AtPts(tangent2_at_pts), normalsAtPts(normals_at_pts),
438 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 850 of file HODataOperators.hpp.

851 {
853
856
857 auto get_ftensor1 = [](MatrixDouble &m) {
859 &m(0, 0), &m(0, 1), &m(0, 2));
860 };
861
862 unsigned int nb_dofs = data.getFieldData().size();
863 if (nb_dofs != 0) {
864
865 int nb_gauss_pts = data.getN().size1();
866 auto &tangent1_at_gauss_pts = getTangent1AtGaussPts();
867 auto &tangent2_at_gauss_pts = getTangent2AtGaussPts();
868 tangent1_at_gauss_pts.resize(nb_gauss_pts, 3, false);
869 tangent2_at_gauss_pts.resize(nb_gauss_pts, 3, false);
870
871 switch (type) {
872 case MBVERTEX: {
873 if (!addField) {
874 tangent1_at_gauss_pts.clear();
875 tangent2_at_gauss_pts.clear();
876 }
877 }
878 case MBEDGE:
879 case MBTRI:
880 case MBQUAD: {
881
882#ifndef NDEBUG
883 if (2 * data.getN().size2() != data.getDiffN().size2()) {
884 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
885 "expected two derivative in local element coordinates");
886 }
887 if (nb_dofs % FIELD_DIM != 0) {
888 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
889 "expected that number of dofs is multiplicative of field "
890 "dimension");
891 }
892#endif
893
894 if (nb_dofs > FIELD_DIM * data.getN().size2()) {
895 unsigned int nn = 0;
896 for (; nn != nb_dofs; nn++) {
897 if (!data.getFieldDofs()[nn]->getActive())
898 break;
899 }
900 if (nn > FIELD_DIM * data.getN().size2()) {
901 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
902 "Data inconsistency for base %s",
903 ApproximationBaseNames[data.getBase()]);
904 } else {
905 nb_dofs = nn;
906 if (!nb_dofs)
908 }
909 }
910 const int nb_base_functions = data.getN().size2();
911 auto t_base = data.getFTensor0N();
912 auto t_diff_base = data.getFTensor1DiffN<2>();
913 auto t_t1 = get_ftensor1(tangent1_at_gauss_pts);
914 auto t_t2 = get_ftensor1(tangent2_at_gauss_pts);
915 for (int gg = 0; gg != nb_gauss_pts; ++gg) {
916 auto t_data = data.getFTensor1FieldData<FIELD_DIM>();
917 int bb = 0;
918 for (; bb != nb_dofs / FIELD_DIM; ++bb) {
920 t_t1(i) += t_data(i) * t_diff_base(N0);
921 t_t2(i) += t_data(i) * t_diff_base(N1);
922 ++t_data;
923 ++t_base;
924 ++t_diff_base;
925 }
926 for (; bb != nb_base_functions; ++bb) {
927 ++t_base;
928 ++t_diff_base;
929 }
930 ++t_t1;
931 ++t_t2;
932 }
933 } break;
934 default:
935 SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
936 }
937 }
938
939 if (moab::CN::Dimension(type) == 2) {
940
941 auto &normal_at_gauss_pts = getNormalsAtGaussPts();
942 auto &tangent1_at_gauss_pts = getTangent1AtGaussPts();
943 auto &tangent2_at_gauss_pts = getTangent2AtGaussPts();
944
945 const auto nb_gauss_pts = tangent1_at_gauss_pts.size1();
946 normal_at_gauss_pts.resize(nb_gauss_pts, 3, false);
947
948 auto t_normal = get_ftensor1(normal_at_gauss_pts);
949 auto t_t1 = get_ftensor1(tangent1_at_gauss_pts);
950 auto t_t2 = get_ftensor1(tangent2_at_gauss_pts);
951 for (unsigned int gg = 0; gg != nb_gauss_pts; ++gg) {
952 FTensor::Index<'i', 3> i;
953 FTensor::Index<'j', 3> j;
954 FTensor::Index<'k', 3> k;
955 t_normal(j) = FTensor::levi_civita(i, j, k) * t_t1(k) * t_t2(i);
956 ++t_normal;
957 ++t_t1;
958 ++t_t2;
959 }
960 }
961
963}
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 452 of file HODataOperators.hpp.

452 {
454 }
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 444 of file HODataOperators.hpp.

444 {
446 }
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 448 of file HODataOperators.hpp.

448 {
450 }
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 460 of file HODataOperators.hpp.

◆ normalsAtPts

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

Definition at line 458 of file HODataOperators.hpp.

◆ tangent1AtPts

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

Definition at line 456 of file HODataOperators.hpp.

◆ tangent2AtPts

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

Definition at line 457 of file HODataOperators.hpp.


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