v0.14.0
Public Member Functions | Protected Attributes | List of all members
Example::OpRhs Struct Reference
Inheritance diagram for Example::OpRhs:
[legend]
Collaboration diagram for Example::OpRhs:
[legend]

Public Member Functions

 OpRhs (boost::shared_ptr< MatrixDouble > u_grad_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 

Protected Attributes

boost::shared_ptr< MatrixDouble > uGradPtr
 

Detailed Description

Use problem specific implementation for second stage of heat methid

Definition at line 69 of file heat_method.cpp.

Constructor & Destructor Documentation

◆ OpRhs()

Example::OpRhs::OpRhs ( boost::shared_ptr< MatrixDouble >  u_grad_ptr)
Examples
heat_method.cpp.

Definition at line 422 of file heat_method.cpp.

423  : DomainEleOp("U", DomainEleOp::OPROW), uGradPtr(u_grad_ptr) {}

Member Function Documentation

◆ doWork()

MoFEMErrorCode Example::OpRhs::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)
Examples
heat_method.cpp.

Definition at line 425 of file heat_method.cpp.

426  {
428 
430 
431  auto nb_dofs = data.getIndices().size();
432  if (nb_dofs) {
433 
434  auto t_grad = getFTensor1FromMat<3>(*uGradPtr);
435 
436  auto nb_base_functions = data.getN().size2();
437  auto nb_gauss_pts = getGaussPts().size2();
438  std::array<double, MAX_DOFS_ON_ENTITY> nf;
439  std::fill(nf.begin(), &nf[nb_dofs], 0);
440 
441  auto t_diff_base = data.getFTensor1DiffN<3>();
442  auto t_w = getFTensor0IntegrationWeight();
443  auto a = getMeasure();
444 
445  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
446  double alpha = t_w * a;
447 
448  const auto l2 = t_grad(i) * t_grad(i);
450  if (l2 > std::numeric_limits<double>::epsilon())
451  t_one(i) = t_grad(i) / std::sqrt(l2);
452  else
453  t_one(i) = 0;
454 
455  size_t bb = 0;
456  for (; bb != nb_dofs; ++bb) {
457  nf[bb] -= alpha * t_diff_base(i) * t_one(i);
458  ++t_diff_base;
459  }
460 
461  for (; bb < nb_base_functions; ++bb) {
462  ++t_diff_base;
463  }
464 
465  ++t_grad;
466  }
467 
468  CHKERR VecSetValues<MoFEM::EssentialBcStorage>(getKSPf(), data, &nf[0],
469  ADD_VALUES);
470  }
471 
473 }

Member Data Documentation

◆ uGradPtr

boost::shared_ptr<MatrixDouble> Example::OpRhs::uGradPtr
protected
Examples
heat_method.cpp.

Definition at line 77 of file heat_method.cpp.


The documentation for this struct was generated from the following file:
FTensor::Tensor1< double, 3 >
DomainEleOp
DomainEle::UserDataOperator DomainEleOp
Definition: heat_method.cpp:31
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
a
constexpr double a
Definition: approx_sphere.cpp:30
MoFEM::EntitiesFieldData::EntData::getIndices
const VectorInt & getIndices() const
Get global indices of dofs on entity.
Definition: EntitiesFieldData.hpp:1214
Example::OpRhs::uGradPtr
boost::shared_ptr< MatrixDouble > uGradPtr
Definition: heat_method.cpp:77
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', 3 >
MoFEM::EntitiesFieldData::EntData::getFTensor1DiffN
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
Definition: EntitiesFieldData.cpp:526
MoFEM::EntitiesFieldData::EntData::getN
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
Definition: EntitiesFieldData.hpp:1318
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359