v0.9.0
Public Member Functions | Public Attributes | List of all members
OpPressure Struct Reference
Inheritance diagram for OpPressure:
[legend]
Collaboration diagram for OpPressure:
[legend]

Public Member Functions

 OpPressure (const double pressure_val=1)
 
MoFEMErrorCode doWork (int side, EntityType type, DataForcesAndSourcesCore::EntData &data)
 

Public Attributes

double pressureVal
 
VectorDouble nF
 
FTensor::Index< 'i', 3 > i
 

Detailed Description

Examples
simple_elasticity.cpp.

Definition at line 244 of file simple_elasticity.cpp.

Constructor & Destructor Documentation

◆ OpPressure()

OpPressure::OpPressure ( const double  pressure_val = 1)

Definition at line 248 of file simple_elasticity.cpp.

250  pressureVal(pressure_val) {}
ForcesAndSourcesCore::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork()

MoFEMErrorCode OpPressure::doWork ( int  side,
EntityType  type,
DataForcesAndSourcesCore::EntData data 
)

Definition at line 257 of file simple_elasticity.cpp.

258  {
259 
261  // check that the faces have associated degrees of freedom
262  const int nb_dofs = data.getIndices().size();
263  if (nb_dofs == 0)
265 
266  // size of force vector associated to the entity
267  // set equal to the number of degrees of freedom of associated with the
268  // entity
269  nF.resize(nb_dofs, false);
270  nF.clear();
271 
272  // get number of gauss points
273  const int nb_gauss_pts = data.getN().size1();
274 
275  // create a 3d vector to be used as the normal to the face with length equal
276  // to the face area
277  auto t_normal = getFTensor1Normal();
278 
279  // get intergration weights
280  auto t_w = getFTensor0IntegrationWeight();
281 
282  // vector of base functions
283  auto t_base = data.getFTensor0N();
284 
285  // loop over all gauss points of the face
286  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
287  // weight of gg gauss point
288  double w = 0.5 * t_w;
289 
290  // create a vector t_nf whose pointer points an array of 3 pointers
291  // pointing to nF memory location of components
293  &nF[2]);
294  for (int bb = 0; bb != nb_dofs / 3; ++bb) {
295  // scale the three components of t_normal and pass them to the t_nf
296  // (hence to nF)
297  t_nf(i) += (w * pressureVal * t_base) * t_normal(i);
298  // move the pointer to next element of t_nf
299  ++t_nf;
300  // move to next base function
301  ++t_base;
302  }
303 
304  // move to next integration weight
305  ++t_w;
306  }
307 
308  // add computed values of pressure in the global right hand side vector
309  CHKERR VecSetValues(getFEMethod()->ksp_f, nb_dofs, &data.getIndices()[0],
310  &nF[0], ADD_VALUES);
311 
313  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
const VectorInt & getIndices() const
Get global indices of dofs on entity.
MoFEMErrorCode VecSetValues(Vec V, const DataForcesAndSourcesCore::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
#define CHKERR
Inline error check.
Definition: definitions.h:596
FTensor::Index< 'i', 3 > i
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
VectorDouble nF
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.

Member Data Documentation

◆ i

FTensor::Index<'i', 3> OpPressure::i

Definition at line 255 of file simple_elasticity.cpp.

◆ nF

VectorDouble OpPressure::nF

Definition at line 253 of file simple_elasticity.cpp.

◆ pressureVal

double OpPressure::pressureVal

Definition at line 246 of file simple_elasticity.cpp.


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