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

Assemble \(\int_\mathcal{T} \mathbf{A} \boldsymbol\sigma \cdot \boldsymbol\tau \textrm{d}\mathcal{T}\). More...

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

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

Public Member Functions

 OpTauDotSigma_HdivHdiv (MixTransportElement &ctx, const std::string flux_name, Mat aij, Vec f)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 Assemble matrix. More...
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 Assemble matrix. More...
 
- 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
 
MatrixDouble3by3 invK
 
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

Assemble \(\int_\mathcal{T} \mathbf{A} \boldsymbol\sigma \cdot \boldsymbol\tau \textrm{d}\mathcal{T}\).

Definition at line 728 of file MixTransportElement.hpp.

Constructor & Destructor Documentation

◆ OpTauDotSigma_HdivHdiv()

MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::OpTauDotSigma_HdivHdiv ( MixTransportElement ctx,
const std::string  flux_name,
Mat  aij,
Vec  f 
)

Definition at line 735 of file MixTransportElement.hpp.

738  flux_name, flux_name,
739  UserDataOperator::OPROWCOL | UserDataOperator::OPCOL),
740  cTx(ctx), Aij(aij), F(f) {
741  sYmm = true;
742  }
bool sYmm
If true assume that matrix is symmetric structure.
VolumeElementForcesAndSourcesCoreBase::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork() [1/2]

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

Assemble matrix.

Parameters
row_sidelocal index of row entity on element
col_sidelocal index of col entity on element
row_typetype of row entity, f.e. MBVERTEX, MBEDGE, or MBTET
col_typetype of col entity, f.e. MBVERTEX, MBEDGE, or MBTET
row_datadata for row
col_datadata for col
Returns
error code

Definition at line 758 of file MixTransportElement.hpp.

761  {
763  if (Aij == PETSC_NULL)
765  if (row_data.getIndices().size() == 0)
767  if (col_data.getIndices().size() == 0)
769  EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
770  int nb_row = row_data.getIndices().size();
771  int nb_col = col_data.getIndices().size();
772  NN.resize(nb_row, nb_col, false);
773  NN.clear();
776  invK.resize(3, 3, false);
777  // get access to resistivity data by tensor rank 2
779  &invK(0, 0), &invK(0, 1), &invK(0, 2), &invK(1, 0), &invK(1, 1),
780  &invK(1, 2), &invK(2, 0), &invK(2, 1), &invK(2, 2));
781  // Get base functions
782  auto t_n_hdiv_row = row_data.getFTensor1N<3>();
784  int nb_gauss_pts = row_data.getN().size1();
785  for (int gg = 0; gg != nb_gauss_pts; gg++) {
786  // get integration weight and multiply by element volume
787  double w = getGaussPts()(3, gg) * getVolume();
788  // in case that HO geometry is defined that below take into account that
789  // edges of element are curved
790  if (getHoGaussPtsDetJac().size() > 0) {
791  w *= getHoGaussPtsDetJac()(gg);
792  }
793  const double x = getCoordsAtGaussPts()(gg, 0);
794  const double y = getCoordsAtGaussPts()(gg, 1);
795  const double z = getCoordsAtGaussPts()(gg, 2);
796  // calculate receptivity (invers of conductivity)
797  CHKERR cTx.getResistivity(fe_ent, x, y, z, invK);
798  for (int kk = 0; kk != nb_row; kk++) {
800  &col_data.getVectorN<3>(gg)(0, HVEC0),
801  &col_data.getVectorN<3>(gg)(0, HVEC1),
802  &col_data.getVectorN<3>(gg)(0, HVEC2), 3);
803  t_row(j) = w * t_n_hdiv_row(i) * t_inv_k(i, j);
804  for (int ll = 0; ll != nb_col; ll++) {
805  NN(kk, ll) += t_row(j) * t_n_hdiv_col(j);
806  ++t_n_hdiv_col;
807  }
808  ++t_n_hdiv_row;
809  }
810  }
811  Mat a = (Aij != PETSC_NULL) ? Aij : getFEMethod()->ts_B;
812  CHKERR MatSetValues(a, nb_row, &row_data.getIndices()[0], nb_col,
813  &col_data.getIndices()[0], &NN(0, 0), ADD_VALUES);
814  // matrix is symmetric, assemble other part
815  if (row_side != col_side || row_type != col_type) {
816  transNN.resize(nb_col, nb_row);
817  noalias(transNN) = trans(NN);
818  CHKERR MatSetValues(a, nb_col, &col_data.getIndices()[0], nb_row,
819  &row_data.getIndices()[0], &transNN(0, 0),
820  ADD_VALUES);
821  }
822 
824  }
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
Mat & ts_B
Preconditioner for ts_A.
#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
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)
MoFEMErrorCode MatSetValues(Mat M, const DataForcesAndSourcesCore::EntData &row_data, const DataForcesAndSourcesCore::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
virtual MoFEMErrorCode getResistivity(const EntityHandle ent, const double x, const double y, const double z, MatrixDouble3by3 &inv_k)
natural (Dirichlet) boundary conditions (set values)
#define CHKERR
Inline error check.
Definition: definitions.h:602
FTensor::Index< 'j', 2 > j
Definition: ContactOps.hpp:27
#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
FTensor::Index< 'i', 2 > i
[Common data]
Definition: ContactOps.hpp:26

◆ doWork() [2/2]

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

Assemble matrix.

Parameters
sidelocal index of row entity on element
typetype of row entity, f.e. MBVERTEX, MBEDGE, or MBTET
datadata for row
Returns
error code

Definition at line 833 of file MixTransportElement.hpp.

834  {
836  if (F == PETSC_NULL)
838  int nb_row = data.getIndices().size();
839  if (nb_row == 0)
841 
842  EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
843  Nf.resize(nb_row);
844  Nf.clear();
847  invK.resize(3, 3, false);
848  Nf.resize(nb_row);
849  Nf.clear();
850  // get access to resistivity data by tensor rank 2
852  &invK(0, 0), &invK(0, 1), &invK(0, 2), &invK(1, 0), &invK(1, 1),
853  &invK(1, 2), &invK(2, 0), &invK(2, 1), &invK(2, 2));
854  // get base functions
855  auto t_n_hdiv = data.getFTensor1N<3>();
856  auto t_flux = getFTensor1FromMat<3>(cTx.fluxesAtGaussPts);
857  int nb_gauss_pts = data.getN().size1();
858  for (int gg = 0; gg < nb_gauss_pts; gg++) {
859  double w = getGaussPts()(3, gg) * getVolume();
860  if (getHoGaussPtsDetJac().size() > 0) {
861  w *= getHoGaussPtsDetJac()(gg);
862  }
863  const double x = getCoordsAtGaussPts()(gg, 0);
864  const double y = getCoordsAtGaussPts()(gg, 1);
865  const double z = getCoordsAtGaussPts()(gg, 2);
866  CHKERR cTx.getResistivity(fe_ent, x, y, z, invK);
867  for (int ll = 0; ll != nb_row; ll++) {
868  Nf[ll] += w * t_n_hdiv(i) * t_inv_k(i, j) * t_flux(j);
869  ++t_n_hdiv;
870  }
871  ++t_flux;
872  }
873  CHKERR VecSetValues(F, nb_row, &data.getIndices()[0], &Nf[0], ADD_VALUES);
874 
876  }
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
MatrixDouble fluxesAtGaussPts
fluxes at integration points on element
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)
virtual MoFEMErrorCode getResistivity(const EntityHandle ent, const double x, const double y, const double z, MatrixDouble3by3 &inv_k)
natural (Dirichlet) boundary conditions (set values)
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
FTensor::Index< 'j', 2 > j
Definition: ContactOps.hpp:27
#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
FTensor::Index< 'i', 2 > i
[Common data]
Definition: ContactOps.hpp:26

Member Data Documentation

◆ Aij

Mat MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::Aij

Definition at line 732 of file MixTransportElement.hpp.

◆ cTx

MixTransportElement& MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::cTx

Definition at line 731 of file MixTransportElement.hpp.

◆ F

Vec MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::F

Definition at line 733 of file MixTransportElement.hpp.

◆ invK

MatrixDouble3by3 MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::invK

Definition at line 745 of file MixTransportElement.hpp.

◆ Nf

VectorDouble MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::Nf

Definition at line 746 of file MixTransportElement.hpp.

◆ NN

MatrixDouble MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::NN

Definition at line 744 of file MixTransportElement.hpp.

◆ transNN

MatrixDouble MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::transNN

Definition at line 744 of file MixTransportElement.hpp.


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