v0.14.0
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
OpH1LhsSkeleton Struct Reference

Operator the left hand side matrix. More...

Inheritance diagram for OpH1LhsSkeleton:
[legend]
Collaboration diagram for OpH1LhsSkeleton:
[legend]

Public Member Functions

 OpH1LhsSkeleton (boost::shared_ptr< FaceSideEle > side_fe_ptr, boost::shared_ptr< MatrixDouble > d_mat_ptr)
 Construct a new OpH1LhsSkeleton. More...
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
- Public Member Functions inherited from MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
double getArea ()
 get area of face More...
 
VectorDoublegetNormal ()
 get triangle normal More...
 
VectorDoublegetTangent1 ()
 get triangle tangent 1 More...
 
VectorDoublegetTangent2 ()
 get triangle tangent 2 More...
 
auto getFTensor1Normal ()
 get normal as tensor More...
 
auto getFTensor1Tangent1 ()
 get tangentOne as tensor More...
 
auto getFTensor1Tangent2 ()
 get tangentTwo as tensor More...
 
int getNumNodes ()
 get element number of nodes More...
 
const EntityHandlegetConn ()
 get element connectivity More...
 
VectorDoublegetCoords ()
 get triangle coordinates More...
 
auto getFTensor1Coords ()
 get get coords at gauss points More...
 
MatrixDoublegetNormalsAtGaussPts ()
 if higher order geometry return normals at Gauss pts. More...
 
ublas::matrix_row< MatrixDoublegetNormalsAtGaussPts (const int gg)
 if higher order geometry return normals at Gauss pts. More...
 
MatrixDoublegetTangent1AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
MatrixDoublegetTangent2AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
auto getFTensor1NormalsAtGaussPts ()
 get normal at integration points More...
 
auto getFTensor1Tangent1AtGaussPts ()
 get tangent 1 at integration points More...
 
auto getFTensor1Tangent2AtGaussPts ()
 get tangent 2 at integration points More...
 
FaceElementForcesAndSourcesCoregetFaceFE ()
 return pointer to Generic Triangle Finite Element object More...
 
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)
 
 UserDataOperator (const std::string field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string row_field_name, const std::string col_field_name, const char type, const bool symm=true)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
int getFEDim () const
 Get dimension of finite element. More...
 
EntityType getFEType () const
 Get dimension of finite element. More...
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer. More...
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity. More...
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
std::string getFEName () const
 Get name of the element. More...
 
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 More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
double getMeasure () const
 get measure of element More...
 
doublegetMeasure ()
 get measure of element More...
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, 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. More...
 
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. More...
 
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. More...
 
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. More...
 
- 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. More...
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Private Attributes

boost::shared_ptr< FaceSideElesideFEPtr
 pointer to element to get data on edge/face sides More...
 
MatrixDouble locMat
 local operator matrix More...
 
boost::shared_ptr< MatrixDouble > dMatPtr
 

Additional Inherited Members

- 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 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. More...
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity. More...
 
booldoVertices
 \deprectaed If false skip vertices More...
 
booldoEdges
 \deprectaed If false skip edges More...
 
booldoQuads
 \deprectaed More...
 
booldoTris
 \deprectaed More...
 
booldoTets
 \deprectaed More...
 
booldoPrisms
 \deprectaed More...
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 
virtual MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Operator the left hand side matrix.

Examples
plate.cpp.

Definition at line 121 of file plate.cpp.

Constructor & Destructor Documentation

◆ OpH1LhsSkeleton()

OpH1LhsSkeleton::OpH1LhsSkeleton ( boost::shared_ptr< FaceSideEle side_fe_ptr,
boost::shared_ptr< MatrixDouble >  mat_d_ptr 
)

Construct a new OpH1LhsSkeleton.

Parameters
side_fe_ptrpointer to FE to evaluate side elements
Parameters
side_fe_ptrpointer to FE to evaluate side elements
Examples
plate.cpp.

Definition at line 506 of file plate.cpp.

509 dMatPtr(mat_d_ptr) {}
@ NOSPACE
Definition: definitions.h:83
BoundaryEle::UserDataOperator BoundaryEleOp
Definition: plate.cpp:33
@ OPSPACE
operator do Work is execute on space data
boost::shared_ptr< MatrixDouble > dMatPtr
Definition: plate.cpp:138
boost::shared_ptr< FaceSideEle > sideFEPtr
pointer to element to get data on edge/face sides
Definition: plate.cpp:136

Member Function Documentation

◆ doWork()

MoFEMErrorCode OpH1LhsSkeleton::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.

Examples
plate.cpp.

Definition at line 511 of file plate.cpp.

512 {
514
515 // Collect data from side domian elements
516 CHKERR loopSideFaces("dFE", *sideFEPtr);
517 const auto in_the_loop =
518 sideFEPtr->nInTheLoop; // return number of elements on the side
519
520 // calculate penalty
521 const double s = getMeasure() / (areaMap[0] + areaMap[1]);
522 const double p = penalty * s;
523
524 // get normal of the face or edge
525 auto t_normal = getFTensor1Normal();
526 t_normal.normalize();
527
528 // Elastic stiffness tensor (4th rank tensor with minor and major
529 // symmetry)
530 auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*dMatPtr);
531
532 // get number of integration points on face
533 const size_t nb_integration_pts = getGaussPts().size2();
534
535 // beta paramter is zero, when penalty method is used, also, takes value 1,
536 // when boundary edge/face is evaluated, and 2 when is skeleton edge/face.
537 const double beta = static_cast<double>(nitsche) / (in_the_loop + 1);
538
539 auto integrate = [&](auto sense_row, auto &row_ind, auto &row_diff,
540 auto &row_diff2, auto sense_col, auto &col_ind,
541 auto &col_diff, auto &col_diff2) {
543
544 // number of dofs, for homogenous approximation this value is
545 // constant.
546 const auto nb_rows = row_ind.size();
547 const auto nb_cols = col_ind.size();
548
549 const auto nb_row_base_functions = row_diff.size2() / SPACE_DIM;
550
551 if (nb_cols) {
552
553 // resize local element matrix
554 locMat.resize(nb_rows, nb_cols, false);
555 locMat.clear();
556
557 // get base functions, and integration weights
558 auto t_diff_row_base = get_diff_ntensor(row_diff);
559 auto t_diff2_row_base = get_diff2_ntensor(row_diff2);
560
561 auto t_w = getFTensor0IntegrationWeight();
562
563 // iterate integration points on face/edge
564 for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
565
566 // t_w is integration weight, and measure is element area, or
567 // volume, depending if problem is in 2d/3d.
568 const double alpha = getMeasure() * t_w;
569 auto t_mat = locMat.data().begin();
570
571 // iterate rows
572 size_t rr = 0;
573 for (; rr != nb_rows; ++rr) {
574
576 t_mv(i, j) = t_D(i, j, k, l) * t_diff2_row_base(k, l);
577
578 // calculate tetting function
580 t_vn_plus(i, j) = beta * (phi * t_mv(i, j) / p);
582 t_vn(i, j) = (t_diff_row_base(j) * (t_normal(i) * sense_row)) -
583 t_vn_plus(i, j);
584
585 // get base functions on columns
586 auto t_diff_col_base = get_diff_ntensor(col_diff, gg, 0);
587 auto t_diff2_col_base = get_diff2_ntensor(col_diff2, gg, 0);
588
589 // iterate columns
590 for (size_t cc = 0; cc != nb_cols; ++cc) {
591
593 t_mu(i, j) = t_D(i, j, k, l) * t_diff2_col_base(k, l);
594
595 // // calculate variance of tested function
597 t_un(i, j) = -p * ((t_diff_col_base(j) * (t_normal(i) * sense_col) -
598 beta * t_mu(i, j) / p));
599
600 // assemble matrix
601 *t_mat -= alpha * (t_vn(i, j) * t_un(i, j));
602 *t_mat -= alpha * (t_vn_plus(i, j) * (beta * t_mu(i, j)));
603
604 // move to next column base and element of matrix
605 ++t_diff_col_base;
606 ++t_diff2_col_base;
607 ++t_mat;
608 }
609
610 // move to next row base
611 ++t_diff_row_base;
612 ++t_diff2_row_base;
613 }
614
615 // this is obsolete for this particular example, we keep it for
616 // generality. in case of multi-physcis problems diffrent fields
617 // can chare hierarchical base but use diffrent approx. order,
618 // so is possible to have more base functions than DOFs on
619 // element.
620 for (; rr < nb_row_base_functions; ++rr) {
621 ++t_diff_row_base;
622 ++t_diff2_row_base;
623 }
624
625 ++t_w;
626 }
627
628 // assemble system
629 CHKERR ::MatSetValues(getKSPB(), nb_rows, &*row_ind.begin(),
630 col_ind.size(), &*col_ind.begin(),
631 &*locMat.data().begin(), ADD_VALUES);
632 }
633
635 };
636
637 // iterate the sides rows
638 for (auto s0 : {LEFT_SIDE, RIGHT_SIDE}) {
639
640 const auto sense_row = senseMap[s0];
641
642 for (auto x0 = 0; x0 != indicesSideMap[s0].size(); ++x0) {
643
644 for (auto s1 : {LEFT_SIDE, RIGHT_SIDE}) {
645 const auto sense_col = senseMap[s1];
646
647 for (auto x1 = 0; x1 != indicesSideMap[s1].size(); ++x1) {
648
649 CHKERR integrate(sense_row, indicesSideMap[s0][x0],
650 diffBaseSideMap[s0][x0], diff2BaseSideMap[s0][x0],
651
652 sense_col, indicesSideMap[s1][x1],
653 diffBaseSideMap[s1][x1], diff2BaseSideMap[s1][x1]
654
655 );
656 }
657 }
658 }
659 }
660
662}
static Index< 'p', 3 > p
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
auto get_diff_ntensor(T &base_mat)
Definition: plate.cpp:479
@ LEFT_SIDE
Definition: plate.cpp:93
@ RIGHT_SIDE
Definition: plate.cpp:93
std::array< std::vector< MatrixDouble >, 2 > diff2BaseSideMap
Definition: plate.cpp:101
FTensor::Index< 'j', SPACE_DIM > j
Definition: plate.cpp:62
std::array< std::vector< MatrixDouble >, 2 > diffBaseSideMap
Definition: plate.cpp:99
FTensor::Index< 'k', SPACE_DIM > k
Definition: plate.cpp:63
FTensor::Index< 'i', SPACE_DIM > i
Definition: plate.cpp:61
constexpr int SPACE_DIM
dimension of space
Definition: plate.cpp:18
FTensor::Index< 'l', SPACE_DIM > l
Definition: plate.cpp:64
static double nitsche
Definition: plate.cpp:69
std::array< double, 2 > areaMap
Definition: plate.cpp:102
std::array< std::vector< VectorInt >, 2 > indicesSideMap
indices on rows for left hand-side
Definition: plate.cpp:97
std::array< int, 2 > senseMap
Definition: plate.cpp:103
static double penalty
Definition: plate.cpp:66
static double phi
Definition: plate.cpp:67
auto get_diff2_ntensor(T &base_mat)
Definition: plate.cpp:490
auto getFTensor0IntegrationWeight()
Get integration weights.
double getMeasure() const
get measure of element
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
MatrixDouble locMat
local operator matrix
Definition: plate.cpp:137

Member Data Documentation

◆ dMatPtr

boost::shared_ptr<MatrixDouble> OpH1LhsSkeleton::dMatPtr
private
Examples
plate.cpp.

Definition at line 138 of file plate.cpp.

◆ locMat

MatrixDouble OpH1LhsSkeleton::locMat
private

local operator matrix

Examples
plate.cpp.

Definition at line 137 of file plate.cpp.

◆ sideFEPtr

boost::shared_ptr<FaceSideEle> OpH1LhsSkeleton::sideFEPtr
private

pointer to element to get data on edge/face sides

Examples
plate.cpp.

Definition at line 136 of file plate.cpp.


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