v0.9.1
Public Member Functions | Public Attributes | List of all members
MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv Struct Reference

\( \int_\mathcal{T} \textrm{div}[\boldsymbol\sigma] v \textrm{d}\mathcal{T} \) More...

#include <users_modules/basic_finite_elements/mix_transport/src/MixTransportElement.hpp>

Inheritance diagram for MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv:
[legend]
Collaboration diagram for MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv:
[legend]

Public Member Functions

 OpVDivSigma_L2Hdiv (MixTransportElement &ctx, const std::string val_name_row, string flux_name_col, Mat aij, Vec f)
 Constructor. More...
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Do calculations. More...
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 
- Public Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase::UserDataOperator
int getNumNodes ()
 get element number of nodes More...
 
const EntityHandlegetConn ()
 get element connectivity More...
 
double getVolume () const
 element volume (linear geometry) More...
 
doublegetVolume ()
 element volume (linear geometry) More...
 
FTensor::Tensor2< double *, 3, 3 > & getJac ()
 get element Jacobian More...
 
FTensor::Tensor2< double *, 3, 3 > & getInvJac ()
 get element inverse Jacobian More...
 
double getMeasure () const
 get measure of element More...
 
doublegetMeasure ()
 get measure of element More...
 
VectorDoublegetCoords ()
 nodal coordinates More...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
MatrixDoublegetHoCoordsAtGaussPts ()
 coordinate at Gauss points (if hierarchical approximation of element geometry) More...
 
MatrixDoublegetHoGaussPtsJac ()
 
MatrixDoublegetHoGaussPtsInvJac ()
 
VectorDoublegetHoGaussPtsDetJac ()
 
auto getFTenosr0HoMeasure ()
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
auto getFTensor1HoCoordsAtGaussPts ()
 Get coordinates at integration points taking geometry from field. More...
 
auto getFTensor2HoGaussPtsJac ()
 
auto getFTensor2HoGaussPtsInvJac ()
 
VolumeElementForcesAndSourcesCoreBasegetVolumeFE () const
 return pointer to Generic Volume Finite Element object More...
 
MoFEMErrorCode getDivergenceOfHDivBaseFunctions (int side, EntityType type, DataForcesAndSourcesCore::EntData &data, int gg, VectorDouble &div)
 Get divergence of base functions at integration point. More...
 
MoFEMErrorCode getCurlOfHCurlBaseFunctions (int side, EntityType type, DataForcesAndSourcesCore::EntData &data, int gg, MatrixDouble &curl)
 Get curl of base functions at integration point. More...
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPLAST, 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...
 
boost::weak_ptr< SideNumber > getSideNumberPtr (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 ()
 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...
 
const std::string & getFEName () const
 Get name of the element. More...
 
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
 
DEPRECATED Vec getSnesF () const
 
DEPRECATED Vec getSnesX () const
 
DEPRECATED Mat getSnesA () const
 
DEPRECATED 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 getTSa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
DEPRECATED MoFEMErrorCode getPorblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
- 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, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &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...
 

Public Attributes

MixTransportElementcTx
 
Mat Aij
 
Vec F
 
MatrixDouble NN
 
MatrixDouble transNN
 
VectorDouble divVec
 
VectorDouble Nf
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
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...
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType { OPROW = 1 << 0, OPCOL = 1 << 1, OPROWCOL = 1 << 2, OPLAST = 1 << 3 }
 Controls loop over entities on element. More...
 
- Protected Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCoreBase::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

\( \int_\mathcal{T} \textrm{div}[\boldsymbol\sigma] v \textrm{d}\mathcal{T} \)

Definition at line 935 of file MixTransportElement.hpp.

Constructor & Destructor Documentation

◆ OpVDivSigma_L2Hdiv()

MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv::OpVDivSigma_L2Hdiv ( MixTransportElement ctx,
const std::string  val_name_row,
string  flux_name_col,
Mat  aij,
Vec  f 
)

Constructor.

Definition at line 945 of file MixTransportElement.hpp.

948  val_name_row, flux_name_col,
949  UserDataOperator::OPROW | UserDataOperator::OPROWCOL),
950  cTx(ctx), Aij(aij), F(f) {
951 
952  // this operator is not symmetric setting this variable makes element
953  // operator to loop over element entities without
954  // assumption that off-diagonal matrices are symmetric.
955  sYmm = false;
956  }
bool sYmm
If true assume that matrix is symmetric structure.
VolumeElementForcesAndSourcesCoreBase::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork() [1/2]

MoFEMErrorCode MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)

Do calculations.

Parameters
row_sidelocal index of entity on row
col_sidelocal index of entity on column
row_typetype of row entity
col_typetype of col entity
row_datarow data structure carrying information about base functions, DOFs indices, etc.
col_datacolumn data structure carrying information about base functions, DOFs indices, etc.
Returns
error code

Definition at line 973 of file MixTransportElement.hpp.

976  {
978  if (Aij == PETSC_NULL)
980  if (row_data.getFieldData().size() == 0)
982  if (col_data.getFieldData().size() == 0)
984  int nb_row = row_data.getFieldData().size();
985  int nb_col = col_data.getFieldData().size();
986  NN.resize(nb_row, nb_col);
987  NN.clear();
988  divVec.resize(nb_col, false);
989  int nb_gauss_pts = row_data.getN().size1();
990  for (int gg = 0; gg < nb_gauss_pts; gg++) {
991  double w = getGaussPts()(3, gg) * getVolume();
992  if (getHoGaussPtsDetJac().size() > 0) {
993  w *= getHoGaussPtsDetJac()(gg);
994  }
995  CHKERR getDivergenceOfHDivBaseFunctions(col_side, col_type, col_data,
996  gg, divVec);
997  ;
998  noalias(NN) += w * outer_prod(row_data.getN(gg), divVec);
999  }
1000  CHKERR MatSetValues(Aij, nb_row, &row_data.getIndices()[0], nb_col,
1001  &col_data.getIndices()[0], &NN(0, 0), ADD_VALUES);
1002  transNN.resize(nb_col, nb_row);
1003  ublas::noalias(transNN) = -trans(NN);
1004  CHKERR MatSetValues(Aij, nb_col, &col_data.getIndices()[0], nb_row,
1005  &row_data.getIndices()[0], &transNN(0, 0),
1006  ADD_VALUES);
1008  }
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
MoFEMErrorCode MatSetValues(Mat M, const DataForcesAndSourcesCore::EntData &row_data, const DataForcesAndSourcesCore::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
MoFEMErrorCode getDivergenceOfHDivBaseFunctions(int side, EntityType type, DataForcesAndSourcesCore::EntData &data, int gg, VectorDouble &div)
Get divergence of base functions at integration point.
double w(const double g, const double t)
Definition: ContactOps.hpp:160

◆ doWork() [2/2]

MoFEMErrorCode MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)

Definition at line 1010 of file MixTransportElement.hpp.

1011  {
1013  if (data.getIndices().size() == 0)
1015  if (data.getIndices().size() != data.getN().size2()) {
1016  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1017  "data inconsistency");
1018  }
1019  int nb_row = data.getIndices().size();
1020  Nf.resize(nb_row);
1021  Nf.clear();
1022  int nb_gauss_pts = data.getN().size1();
1023  for (int gg = 0; gg < nb_gauss_pts; gg++) {
1024  double w = getGaussPts()(3, gg) * getVolume();
1025  if (getHoGaussPtsDetJac().size() > 0) {
1026  w *= getHoGaussPtsDetJac()(gg);
1027  }
1028  noalias(Nf) += w * data.getN(gg) * cTx.divergenceAtGaussPts[gg];
1029  }
1030  CHKERR VecSetValues(F, nb_row, &data.getIndices()[0], &Nf[0], ADD_VALUES);
1031  ;
1033  }
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:514
VectorDouble divergenceAtGaussPts
divergence at integration points on element
MoFEMErrorCode VecSetValues(Vec V, const DataForcesAndSourcesCore::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
#define CHKERR
Inline error check.
Definition: definitions.h:602
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:413
double w(const double g, const double t)
Definition: ContactOps.hpp:160

Member Data Documentation

◆ Aij

Mat MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv::Aij

Definition at line 939 of file MixTransportElement.hpp.

◆ cTx

MixTransportElement& MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv::cTx

Definition at line 938 of file MixTransportElement.hpp.

◆ divVec

VectorDouble MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv::divVec

Definition at line 959 of file MixTransportElement.hpp.

◆ F

Vec MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv::F

Definition at line 940 of file MixTransportElement.hpp.

◆ Nf

VectorDouble MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv::Nf

Definition at line 959 of file MixTransportElement.hpp.

◆ NN

MatrixDouble MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv::NN

Definition at line 958 of file MixTransportElement.hpp.

◆ transNN

MatrixDouble MixTransport::MixTransportElement::OpVDivSigma_L2Hdiv::transNN

Definition at line 958 of file MixTransportElement.hpp.


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