v0.16.0
Loading...
Searching...
No Matches
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< MatrixDoubleuGradPtr
 

Detailed Description

Use problem specific implementation for second stage of heat methid

Definition at line 70 of file heat_method.cpp.

Constructor & Destructor Documentation

◆ OpRhs()

Example::OpRhs::OpRhs ( boost::shared_ptr< MatrixDouble u_grad_ptr)
Examples
mofem/tutorials/scl-9_heat_method/heat_method.cpp.

Definition at line 417 of file heat_method.cpp.

418 : DomainEleOp("U", DomainEleOp::OPROW), uGradPtr(u_grad_ptr) {}
boost::shared_ptr< MatrixDouble > uGradPtr
DomainEle::UserDataOperator DomainEleOp

Member Function Documentation

◆ doWork()

MoFEMErrorCode Example::OpRhs::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)
Examples
mofem/tutorials/scl-9_heat_method/heat_method.cpp.

Definition at line 420 of file heat_method.cpp.

421 {
423
424 FTensor::Index<'i', 3> i;
425
426 auto nb_dofs = data.getIndices().size();
427 if (nb_dofs) {
428
429 auto t_grad = getFTensor1FromMat<3>(*uGradPtr);
430
431 auto nb_base_functions = data.getN().size2();
432 auto nb_gauss_pts = getGaussPts().size2();
433 std::array<double, MAX_DOFS_ON_ENTITY> nf;
434 std::fill(nf.begin(), &nf[nb_dofs], 0);
435
436 auto t_diff_base = data.getFTensor1DiffN<3>();
437 auto t_w = getFTensor0IntegrationWeight();
438 auto a = getMeasure();
439
440 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
441 double alpha = t_w * a;
442
443 const auto l2 = t_grad(i) * t_grad(i);
445 if (l2 > std::numeric_limits<double>::epsilon())
446 t_one(i) = t_grad(i) / std::sqrt(l2);
447 else
448 t_one(i) = 0;
449
450 size_t bb = 0;
451 for (; bb != nb_dofs; ++bb) {
452 nf[bb] -= alpha * t_diff_base(i) * t_one(i);
453 ++t_diff_base;
454 }
455
456 for (; bb < nb_base_functions; ++bb) {
457 ++t_diff_base;
458 }
459
460 ++t_grad;
461 }
462
463 CHKERR VecSetValues<MoFEM::EssentialBcStorage>(getKSPf(), data, &nf[0],
464 ADD_VALUES);
465 }
466
468}
constexpr double a
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'i', SPACE_DIM > i
auto getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.

Member Data Documentation

◆ uGradPtr

boost::shared_ptr<MatrixDouble> Example::OpRhs::uGradPtr
protected

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