v0.8.23
Public Member Functions | Public Attributes | List of all members
AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL > Struct Template Reference

Rhs operator used to build matrix. More...

#include <users_modules/helmholtz/src/AnalyticalDirichletHelmholtz.hpp>

Inheritance diagram for AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >:
[legend]
Collaboration diagram for AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >:
[legend]

Public Member Functions

 OpRhs (const string field_name, Range tris, MatrixDouble &ho_coords, boost::shared_ptr< FUNEVAL > function_evaluator, int field_number)
 
PetscErrorCode doWork (int side, EntityType type, DataForcesAndSurcesCore::EntData &data)
 
- Public Member Functions inherited from MoFEM::FaceElementForcesAndSourcesCore::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)
 
double getArea ()
 get area of face More...
 
double getMeasure ()
 get measure of element 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...
 
DEPRECATED auto getTensor1Normal ()
 
auto getFTensor1Tangent1 ()
 get tangentOne as tensor More...
 
DEPRECATED auto getTensor1Tangent1 ()
 
auto getFTensor2Tangent1 ()
 get tangentTwo as tensor More...
 
DEPRECATED auto getTensor2Tangent1 ()
 
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...
 
DEPRECATED auto getTensor1Coords ()
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
auto getFTensor1CoordsAtGaussPts ()
 get coordinates at Gauss pts. More...
 
DEPRECATED auto getTensor1CoordsAtGaussPts ()
 
MatrixDoublegetHoCoordsAtGaussPts ()
 coordinate at Gauss points (if hierarchical approximation of element geometry) More...
 
auto getFTensor1HoCoordsAtGaussPts ()
 get coordinates at Gauss pts (takes in account ho approx. of geometry) More...
 
DEPRECATED auto getTensor1HoCoordsAtGaussPts ()
 
MatrixDoublegetNormalsAtGaussPts ()
 if higher order geometry return normals at Gauss pts. More...
 
DEPRECATED MatrixDoublegetNormalsAtGaussPt ()
 
ublas::matrix_row< MatrixDoublegetNormalsAtGaussPts (const int gg)
 if higher order geometry return normals at Gauss pts. More...
 
DEPRECATED auto getNormalsAtGaussPt (const int gg)
 
MatrixDoublegetTangent1AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
DEPRECATED MatrixDoublegetTangent1AtGaussPt ()
 
MatrixDoublegetTangent2AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
DEPRECATED MatrixDoublegetTangent2AtGaussPt ()
 
auto getFTensor1NormalsAtGaussPts ()
 get normal at integration points More...
 
DEPRECATED auto getTensor1NormalsAtGaussPt ()
 
auto getFTensor1Tangent1AtGaussPts ()
 get tangent 1 at integration points More...
 
DEPRECATED auto getTensor1Tangent1AtGaussPt ()
 
auto getFTensor1Tangent2AtGaussPts ()
 get tangent 2 at integration points More...
 
DEPRECATED auto getTensor1Tangent2AtGaussPt ()
 
DEPRECATED const FaceElementForcesAndSourcesCoregetFaceElementForcesAndSourcesCore ()
 
DEPRECATED const FaceElementForcesAndSourcesCoregetTriFE ()
 
const FaceElementForcesAndSourcesCoregetFaceFE ()
 return pointer to Generic Triangle Finite Element object More...
 
MoFEMErrorCode loopSideVolumes (const string &fe_name, VolumeElementForcesAndSourcesCoreOnSide &method)
 
- 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...
 
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)
 
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...
 
DEPRECATED MoFEMErrorCode getPorblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 
DEPRECATED MoFEMErrorCode getPorblemColIndices (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, 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 left 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 right 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

Range tRis
 
MatrixDoublehoCoords
 
boost::shared_ptr< FUNEVAL > functionEvaluator
 
int fieldNumber
 
VectorDouble NTf
 
VectorInt iNdices
 
- 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

template<typename FUNEVAL>
struct AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >

Rhs operator used to build matrix.

Definition at line 84 of file AnalyticalDirichletHelmholtz.hpp.

Constructor & Destructor Documentation

◆ OpRhs()

template<typename FUNEVAL >
AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >::OpRhs ( const string  field_name,
Range  tris,
MatrixDouble ho_coords,
boost::shared_ptr< FUNEVAL >  function_evaluator,
int  field_number 
)

Definition at line 91 of file AnalyticalDirichletHelmholtz.hpp.

94  :
95  FaceElementForcesAndSourcesCore::UserDataOperator(field_name,ForcesAndSurcesCore::UserDataOperator::OPROW),
96  tRis(tris),
97  hoCoords(ho_coords),functionEvaluator(function_evaluator),
98  fieldNumber(field_number)
99  {
100 
101  }
ForcesAndSourcesCore::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork()

template<typename FUNEVAL >
PetscErrorCode AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >::doWork ( int  side,
EntityType  type,
DataForcesAndSurcesCore::EntData &  data 
)

Definition at line 106 of file AnalyticalDirichletHelmholtz.hpp.

108  {
109  PetscFunctionBegin;
110  PetscErrorCode ierr;
111 
112  try {
113 
114  unsigned int nb_row = data.getIndices().size();
115  if(nb_row==0) PetscFunctionReturn(0);
116  if(tRis.find(getNumeredEntFiniteElementPtr()->getEnt()) == tRis.end()) {
117  PetscFunctionReturn(0);
118  }
119 
120  const FENumeredDofEntity *dof_ptr;
121  ierr = getNumeredEntFiniteElementPtr()->getRowDofsByPetscGlobalDofIdx(data.getIndices()[0],&dof_ptr); CHKERRQ(ierr);
122  unsigned int rank = dof_ptr->getNbOfCoeffs();
123 
124  NTf.resize(nb_row/rank);
125  iNdices.resize(nb_row/rank);
126 
127  for(unsigned int gg = 0;gg<data.getN().size1();gg++) {
128 
129  double x,y,z;
130  double val = getGaussPts()(2,gg);
131  if(hoCoords.size1() == data.getN().size1()) {
132  double area = ublas::norm_2(getNormalsAtGaussPt(gg))*0.5;
133  val *= area;
134  x = hoCoords(gg,0);
135  y = hoCoords(gg,1);
136  z = hoCoords(gg,2);
137  } else {
138  val *= getArea();
139  x = getCoordsAtGaussPts()(gg,0);
140  y = getCoordsAtGaussPts()(gg,1);
141  z = getCoordsAtGaussPts()(gg,2);
142  }
143 
144  VectorDouble a;
145  try {
146 
147  a = (*functionEvaluator)(x,y,z)[fieldNumber];
148 
149  } catch (exception& ex) {
150  ostringstream ss;
151  ss << "thorw in method: " << ex.what() << " at line " << __LINE__ << " in file " << __FILE__;
152  SETERRQ(PETSC_COMM_SELF,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
153  }
154  if(a.size()!=rank) {
155  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
156  }
157 
158 
159  for(unsigned int rr = 0;rr<rank;rr++) {
160 
161  ublas::noalias(iNdices) = ublas::vector_slice<VectorInt >
162  (data.getIndices(), ublas::slice(rr, rank, data.getIndices().size()/rank));
163 
164  noalias(NTf) = data.getN(gg,nb_row/rank)*a[rr]*val;
165  ierr = VecSetValues(getFEMethod()->snes_f,iNdices.size(),
166  &iNdices[0],&*NTf.data().begin(),ADD_VALUES); CHKERRQ(ierr);
167 
168  }
169 
170  }
171 
172 
173  } catch (const std::exception& ex) {
174  ostringstream ss;
175  ss << "throw in method: " << ex.what() << endl;
176  SETERRQ(PETSC_COMM_SELF,1,ss.str().c_str());
177  }
178 
179  PetscFunctionReturn(0);
180  }
keeps information about indexed dofs for the finite element
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
FieldCoefficientsNumber getNbOfCoeffs() const
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
CHKERRQ(ierr)
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
MoFEMErrorCode VecSetValues(Vec V, const DataForcesAndSourcesCore::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
ublas::vector< double, DoubleAllocator > VectorDouble
Definition: Types.hpp:76

Member Data Documentation

◆ fieldNumber

template<typename FUNEVAL >
int AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >::fieldNumber

Definition at line 89 of file AnalyticalDirichletHelmholtz.hpp.

◆ functionEvaluator

template<typename FUNEVAL >
boost::shared_ptr<FUNEVAL> AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >::functionEvaluator

Definition at line 88 of file AnalyticalDirichletHelmholtz.hpp.

◆ hoCoords

template<typename FUNEVAL >
MatrixDouble& AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >::hoCoords

Definition at line 87 of file AnalyticalDirichletHelmholtz.hpp.

◆ iNdices

template<typename FUNEVAL >
VectorInt AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >::iNdices

Definition at line 104 of file AnalyticalDirichletHelmholtz.hpp.

◆ NTf

template<typename FUNEVAL >
VectorDouble AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >::NTf

Definition at line 103 of file AnalyticalDirichletHelmholtz.hpp.

◆ tRis

template<typename FUNEVAL >
Range AnalyticalDirichletHelmholtzBC::ApproxField::OpRhs< FUNEVAL >::tRis

Definition at line 86 of file AnalyticalDirichletHelmholtz.hpp.


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