v0.8.15
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::VolumeElementForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space)
 
 UserDataOperator (const std::string &field_name, const char type)
 
 UserDataOperator (const std::string &row_field_name, const std::string &col_field_name, const char type, const bool symm=true)
 
int getNumNodes ()
 get element number of nodes More...
 
const EntityHandlegetConn ()
 get element connectivity More...
 
double getVolume ()
 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 ()
 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 ()
 
const VolumeElementForcesAndSourcesCoregetVolumeFE ()
 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...
 
DEPRECATED auto getTensor1CoordsAtGaussPts ()
 
DEPRECATED auto getTensor1HoCoordsAtGaussPts ()
 
- 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)
 
virtual ~UserDataOperator ()
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
DEPRECATED MoFEMErrorCode getPorblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
virtual MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
DEPRECATED MoFEMErrorCode getPorblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
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...
 
Vec getSnesF () const
 
Vec getSnesX () const
 
Mat getSnesA () const
 
Mat getSnesB () const
 
Vec getTSu () const
 
Vec getTSu_t () 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...
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true, const bool do_vertices=true, const bool do_edges=true, const bool do_quads=true, const bool do_tris=true, const bool do_tets=true, const bool do_prisms=true)
 
virtual ~DataOperator ()
 
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 right hand side. More...
 
virtual MoFEMErrorCode opLhs (DataForcesAndSourcesCore &row_data, DataForcesAndSourcesCore &col_data, bool symm=true)
 
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 left hand side. More...
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool do_vertices, const bool do_edges, const bool do_quads, const bool do_tris, const bool do_tets, const bool do_prisms, const bool error_if_no_base=true)
 
virtual MoFEMErrorCode opRhs (DataForcesAndSourcesCore &data, const bool error_if_no_base=true)
 
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...
 
bool doVertices
 If false skip vertices. More...
 
bool doEdges
 If false skip edges. More...
 
bool doQuads
 
bool doTris
 
bool doTets
 
bool doPrisms
 

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 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 730 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 737 of file MixTransportElement.hpp.

740  flux_name, flux_name,
741  UserDataOperator::OPROWCOL | UserDataOperator::OPCOL),
742  cTx(ctx), Aij(aij), F(f) {
743  sYmm = true;
744  }
bool sYmm
If true assume that matrix is symmetric structure.
ForcesAndSourcesCore::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 760 of file MixTransportElement.hpp.

763  {
765  if (Aij == PETSC_NULL)
767  if (row_data.getIndices().size() == 0)
769  if (col_data.getIndices().size() == 0)
771  EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
772  int nb_row = row_data.getIndices().size();
773  int nb_col = col_data.getIndices().size();
774  NN.resize(nb_row, nb_col, false);
775  NN.clear();
778  invK.resize(3, 3, false);
779  // get access to resistivity data by tensor rank 2
781  &invK(0, 0), &invK(0, 1), &invK(0, 2), &invK(1, 0), &invK(1, 1),
782  &invK(1, 2), &invK(2, 0), &invK(2, 1), &invK(2, 2));
783  // Get base functions
784  auto t_n_hdiv_row = row_data.getFTensor1N<3>();
786  int nb_gauss_pts = row_data.getN().size1();
787  for (int gg = 0; gg != nb_gauss_pts; gg++) {
788  // get integration weight and multiply by element volume
789  double w = getGaussPts()(3, gg) * getVolume();
790  // in case that HO geometry is defined that below take into account that
791  // edges of element are curved
792  if (getHoGaussPtsDetJac().size() > 0) {
793  w *= getHoGaussPtsDetJac()(gg);
794  }
795  const double x = getCoordsAtGaussPts()(gg, 0);
796  const double y = getCoordsAtGaussPts()(gg, 1);
797  const double z = getCoordsAtGaussPts()(gg, 2);
798  // calculate receptivity (invers of conductivity)
799  CHKERR cTx.getResistivity(fe_ent, x, y, z, invK);
800  for (int kk = 0; kk != nb_row; kk++) {
802  &col_data.getVectorN<3>(gg)(0, HVEC0),
803  &col_data.getVectorN<3>(gg)(0, HVEC1),
804  &col_data.getVectorN<3>(gg)(0, HVEC2), 3);
805  t_row(j) = w * t_n_hdiv_row(i) * t_inv_k(i, j);
806  for (int ll = 0; ll != nb_col; ll++) {
807  NN(kk, ll) += t_row(j) * t_n_hdiv_col(j);
808  ++t_n_hdiv_col;
809  }
810  ++t_n_hdiv_row;
811  }
812  }
813  Mat a = (Aij != PETSC_NULL) ? Aij : getFEMethod()->ts_B;
814  CHKERR MatSetValues(a, nb_row, &row_data.getIndices()[0], nb_col,
815  &col_data.getIndices()[0], &NN(0, 0), ADD_VALUES);
816  // matrix is symmetric, assemble other part
817  if (row_side != col_side || row_type != col_type) {
818  transNN.resize(nb_col, nb_row);
819  noalias(transNN) = trans(NN);
820  CHKERR MatSetValues(a, nb_col, &col_data.getIndices()[0], nb_row,
821  &row_data.getIndices()[0], &transNN(0, 0),
822  ADD_VALUES);
823  }
824 
826  }
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
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:578
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ 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 835 of file MixTransportElement.hpp.

836  {
838  if (F == PETSC_NULL)
840  int nb_row = data.getIndices().size();
841  if (nb_row == 0)
843 
844  EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
845  Nf.resize(nb_row);
846  Nf.clear();
849  invK.resize(3, 3, false);
850  Nf.resize(nb_row);
851  Nf.clear();
852  // get access to resistivity data by tensor rank 2
854  &invK(0, 0), &invK(0, 1), &invK(0, 2), &invK(1, 0), &invK(1, 1),
855  &invK(1, 2), &invK(2, 0), &invK(2, 1), &invK(2, 2));
856  // get base functions
857  auto t_n_hdiv = data.getFTensor1N<3>();
858  auto t_flux = getFTensor1FromMat<3>(cTx.fluxesAtGaussPts);
859  int nb_gauss_pts = data.getN().size1();
860  for (int gg = 0; gg < nb_gauss_pts; gg++) {
861  double w = getGaussPts()(3, gg) * getVolume();
862  if (getHoGaussPtsDetJac().size() > 0) {
863  w *= getHoGaussPtsDetJac()(gg);
864  }
865  const double x = getCoordsAtGaussPts()(gg, 0);
866  const double y = getCoordsAtGaussPts()(gg, 1);
867  const double z = getCoordsAtGaussPts()(gg, 2);
868  CHKERR cTx.getResistivity(fe_ent, x, y, z, invK);
869  for (int ll = 0; ll != nb_row; ll++) {
870  Nf[ll] += w * t_n_hdiv(i) * t_inv_k(i, j) * t_flux(j);
871  ++t_n_hdiv;
872  }
873  ++t_flux;
874  }
875  CHKERR VecSetValues(F, nb_row, &data.getIndices()[0], &Nf[0], ADD_VALUES);
876 
878  }
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
MatrixDouble fluxesAtGaussPts
fluxes at integration points on element
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
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:578
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

Member Data Documentation

◆ Aij

Mat MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::Aij

Definition at line 734 of file MixTransportElement.hpp.

◆ cTx

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

Definition at line 733 of file MixTransportElement.hpp.

◆ F

Vec MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::F

Definition at line 735 of file MixTransportElement.hpp.

◆ invK

MatrixDouble3by3 MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::invK

Definition at line 747 of file MixTransportElement.hpp.

◆ Nf

VectorDouble MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::Nf

Definition at line 748 of file MixTransportElement.hpp.

◆ NN

MatrixDouble MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::NN

Definition at line 746 of file MixTransportElement.hpp.

◆ transNN

MatrixDouble MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::transNN

Definition at line 746 of file MixTransportElement.hpp.


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