v0.8.4
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...
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element where columns 0,1,2 are x,y,z coordinates respectively and column 3 is a weight value for example getGaussPts()(1,13) returns y coordinate of 13th Gauss point on particular volume element More...
 
FTensor::Tensor0< double * > getFTensor0IntegrationWeight ()
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
MatrixDoublegetHoCoordsAtGaussPts ()
 coordinate at Gauss points (if hierarchical approximation of element geometry) More...
 
MatrixDoublegetHoGaussPtsInvJac ()
 
VectorDoublegetHoGaussPtsDetJac ()
 
FTensor::Tensor0< double * > getFTenosr0HoMeasure ()
 
FTensor::Tensor1< double *, 3 > getTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
FTensor::Tensor1< double *, 3 > getFTensor1HoCoordsAtGaussPts ()
 Get coordinates at integration points taking geometry from field. More...
 
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...
 
- 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
 
- 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 707 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 713 of file MixTransportElement.hpp.

717  :
719  flux_name,flux_name,
720  UserDataOperator::OPROWCOL|UserDataOperator::OPCOL
721  ),
722  cTx(ctx),
723  Aij(aij),
724  F(f) {
725  sYmm = true;
726  }
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 742 of file MixTransportElement.hpp.

747  {
748 
750  try {
751  if(Aij == PETSC_NULL) MoFEMFunctionReturnHot(0);
752  if(row_data.getIndices().size()==0) MoFEMFunctionReturnHot(0);
753  if(col_data.getIndices().size()==0) MoFEMFunctionReturnHot(0);
754  EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
755  int nb_row = row_data.getIndices().size();
756  int nb_col = col_data.getIndices().size();
757  NN.resize(nb_row,nb_col,false);
758  NN.clear();
761  invK.resize(3,3,false);
762  // get access to resistivity data by tensor rank 2
764  &invK(0,0),&invK(0,1),&invK(0,2),
765  &invK(1,0),&invK(1,1),&invK(1,2),
766  &invK(2,0),&invK(2,1),&invK(2,2)
767  );
768  // Get base functions
769  auto t_n_hdiv_row = row_data.getFTensor1HdivN<3>();
771  int nb_gauss_pts = row_data.getHdivN().size1();
772  for(int gg = 0;gg!=nb_gauss_pts;gg++) {
773  // get integration weight and multiply by element volume
774  double w = getGaussPts()(3,gg)*getVolume();
775  // in case that HO geometry is defined that below take into account that
776  // edges of element are curved
777  if(getHoGaussPtsDetJac().size()>0) {
778  w *= getHoGaussPtsDetJac()(gg);
779  }
780  const double x = getCoordsAtGaussPts()(gg,0);
781  const double y = getCoordsAtGaussPts()(gg,1);
782  const double z = getCoordsAtGaussPts()(gg,2);
783  // calculate receptivity (invers of conductivity)
784  ierr = cTx.getResistivity(fe_ent,x,y,z,invK); CHKERRG(ierr);
785  for(int kk = 0;kk!=nb_row;kk++) {
787  &col_data.getHdivN(gg)(0,HDIV0),
788  &col_data.getHdivN(gg)(0,HDIV1),
789  &col_data.getHdivN(gg)(0,HDIV2),3
790  );
791  t_row(j) = w*t_n_hdiv_row(i)*t_inv_k(i,j);
792  for(int ll = 0;ll!=nb_col;ll++) {
793  NN(kk,ll) += t_row(j)*t_n_hdiv_col(j);
794  ++t_n_hdiv_col;
795  }
796  ++t_n_hdiv_row;
797  }
798  }
799  Mat a = (Aij!=PETSC_NULL) ? Aij : getFEMethod()->ts_B;
800  ierr = MatSetValues(
801  a,
802  nb_row,&row_data.getIndices()[0],
803  nb_col,&col_data.getIndices()[0],
804  &NN(0,0),ADD_VALUES
805  ); CHKERRG(ierr);
806  // matrix is symmetric, assemble other part
807  if(row_side != col_side || row_type != col_type) {
808  transNN.resize(nb_col,nb_row);
809  noalias(transNN) = trans(NN);
810  ierr = MatSetValues(
811  a,
812  nb_col,&col_data.getIndices()[0],
813  nb_row,&row_data.getIndices()[0],
814  &transNN(0,0),ADD_VALUES
815  ); CHKERRG(ierr);
816  }
817  } catch (const std::exception& ex) {
818  std::ostringstream ss;
819  ss << "throw in method: " << ex.what() << std::endl;
820  SETERRQ(PETSC_COMM_SELF,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
821  }
822 
824  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:565
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
virtual MoFEMErrorCode getResistivity(const EntityHandle ent, const double x, const double y, const double z, MatrixDouble3by3 &inv_k)
natural (Dirichlet) boundary conditions (set values)
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element where columns 0,1,2 are x,y,z coordinates respectively and column 3 is a weight value for example getGaussPts()(1,13) returns y coordinate of 13th Gauss point on particular volume element

◆ 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.

835  {
836 
838  try {
839  if(F==PETSC_NULL) MoFEMFunctionReturnHot(0);
840  int nb_row = data.getIndices().size();
841  if(nb_row==0) MoFEMFunctionReturnHot(0);
842 
843  EntityHandle fe_ent = getNumeredEntFiniteElementPtr()->getEnt();
844  // cerr << data.getIndices() << endl;
845  // cerr << data.getHdivN() << endl;
846  Nf.resize(nb_row);
847  Nf.clear();
850  invK.resize(3,3,false);
851  Nf.resize(nb_row);
852  Nf.clear();
853  // get access to resistivity data by tensor rank 2
855  &invK(0,0),&invK(0,1),&invK(0,2),
856  &invK(1,0),&invK(1,1),&invK(1,2),
857  &invK(2,0),&invK(2,1),&invK(2,2)
858  );
859  // get base functions
860  auto t_n_hdiv = data.getFTensor1HdivN<3>();
861  auto t_flux = getFTensor1FromMat<3>(cTx.fluxesAtGaussPts);
862  int nb_gauss_pts = data.getHdivN().size1();
863  for(int gg = 0;gg<nb_gauss_pts;gg++) {
864  double w = getGaussPts()(3,gg)*getVolume();
865  if(getHoGaussPtsDetJac().size()>0) {
866  w *= getHoGaussPtsDetJac()(gg);
867  }
868  const double x = getCoordsAtGaussPts()(gg,0);
869  const double y = getCoordsAtGaussPts()(gg,1);
870  const double z = getCoordsAtGaussPts()(gg,2);
871  ierr = cTx.getResistivity(fe_ent,x,y,z,invK); CHKERRG(ierr);
872  for(int ll = 0;ll!=nb_row;ll++) {
873  Nf[ll] += w*t_n_hdiv(i)*t_inv_k(i,j)*t_flux(j);
874  ++t_n_hdiv;
875  }
876  ++t_flux;
877  }
878  ierr = VecSetValues(
879  F,nb_row,&data.getIndices()[0],&Nf[0],ADD_VALUES
880  ); CHKERRG(ierr);
881 
882  } catch (const std::exception& ex) {
883  cerr << data.getFieldData() << endl;
884  cerr << data.getIndices() << endl;
885  cerr << data.getN() << endl;
886  cerr << data.getDiffN() << endl;
887  std::ostringstream ss;
888  ss << "throw in method:"
889  << " type: " << type
890  << " side: " << side << " "
891  << ex.what() << std::endl;
892  SETERRQ(PETSC_COMM_SELF,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
893  }
895  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:565
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
MatrixDouble fluxesAtGaussPts
fluxes at integration points on 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)
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element where columns 0,1,2 are x,y,z coordinates respectively and column 3 is a weight value for example getGaussPts()(1,13) returns y coordinate of 13th Gauss point on particular volume element

Member Data Documentation

◆ Aij

Mat MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::Aij

Definition at line 710 of file MixTransportElement.hpp.

◆ cTx

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

Definition at line 709 of file MixTransportElement.hpp.

◆ F

Vec MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::F

Definition at line 711 of file MixTransportElement.hpp.

◆ invK

MatrixDouble3by3 MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::invK

Definition at line 729 of file MixTransportElement.hpp.

◆ Nf

VectorDouble MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::Nf

Definition at line 730 of file MixTransportElement.hpp.

◆ NN

MatrixDouble MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::NN

Definition at line 728 of file MixTransportElement.hpp.

◆ transNN

MatrixDouble MixTransport::MixTransportElement::OpTauDotSigma_HdivHdiv::transNN

Definition at line 728 of file MixTransportElement.hpp.


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