v0.15.0
Loading...
Searching...
No Matches
PoissonExample::OpResF_Domain Struct Reference

#include "tutorials/cor-2to5/src/PoissonOperators.hpp"

Inheritance diagram for PoissonExample::OpResF_Domain:
[legend]
Collaboration diagram for PoissonExample::OpResF_Domain:
[legend]

Public Member Functions

 OpResF_Domain (FSource f_source, boost::function< double(const double)> a, boost::shared_ptr< VectorDouble > &field_vals, boost::shared_ptr< MatrixDouble > &grad_vals)
 
- Public Member Functions inherited from PoissonExample::OpF
 OpF (FSource f_source)
 
- Public Member Functions inherited from PoissonExample::OpBaseRhs< VolumeElementForcesAndSourcesCore::UserDataOperator >
 OpBaseRhs (const std::string field_name)
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
 This function is called by finite element.
 
virtual MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &data)=0
 Class dedicated to integrate operator.
 
virtual MoFEMErrorCode aSsemble (EntitiesFieldData::EntData &data)=0
 Class dedicated to assemble operator to global system vector.
 

Protected Member Functions

MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &data)
 Integrate local entity vector.
 
- Protected Member Functions inherited from PoissonExample::OpF
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &data)
 Integrate local entity vector.
 
MoFEMErrorCode aSsemble (EntitiesFieldData::EntData &data)
 assemble local entity vector to the global right hand side
 

Protected Attributes

FTensor::Index< 'i', 3 > i
 
boost::function< double(const double)> A
 
boost::shared_ptr< VectorDouble > fieldVals
 
boost::shared_ptr< MatrixDouble > gradVals
 
- Protected Attributes inherited from PoissonExample::OpF
FTensor::Number< 0 > NX
 
FTensor::Number< 1 > NY
 
FTensor::Number< 2 > NZ
 
FSource fSource
 
VectorDouble locVec
 
- Protected Attributes inherited from PoissonExample::OpBaseRhs< VolumeElementForcesAndSourcesCore::UserDataOperator >
int nbRows
 < error code
 
int nbIntegrationPts
 number of integration points
 

Additional Inherited Members

- Public Types inherited from PoissonExample::OpF
typedef boost::function< double(const double, const double, const double)> FSource
 

Detailed Description

Definition at line 662 of file PoissonOperators.hpp.

Constructor & Destructor Documentation

◆ OpResF_Domain()

PoissonExample::OpResF_Domain::OpResF_Domain ( FSource f_source,
boost::function< double(const double)> a,
boost::shared_ptr< VectorDouble > & field_vals,
boost::shared_ptr< MatrixDouble > & grad_vals )
inline
Examples
PoissonOperators.hpp.

Definition at line 664 of file PoissonOperators.hpp.

667 : OpF(f_source), A(a), fieldVals(field_vals), gradVals(grad_vals) {}
constexpr double a
OpF(FSource f_source)
boost::shared_ptr< MatrixDouble > gradVals
boost::shared_ptr< VectorDouble > fieldVals
boost::function< double(const double)> A

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode PoissonExample::OpResF_Domain::iNtegrate ( EntitiesFieldData::EntData & data)
inlineprotected

Integrate local entity vector.

Parameters
dataentity data on element row
Returns
error code
Examples
PoissonOperators.hpp.

Definition at line 677 of file PoissonOperators.hpp.

677 {
679 // set size of local vector
680 locVec.resize(nbRows, false);
681 // clear local entity vector
682 locVec.clear();
683 // get finite element volume
684 double vol = getVolume();
685 // get integration weights
686 auto t_w = getFTensor0IntegrationWeight();
687 // get solution at integration point
688 auto t_u = getFTensor0FromVec(*fieldVals);
689 // get solution at integration point
690 auto t_grad = getFTensor1FromMat<3>(*gradVals);
691 // get base functions on entity
692 auto t_v = data.getFTensor0N();
693 // get base function gradient on rows
694 auto t_v_grad = data.getFTensor1DiffN<3>();
695 // get coordinates at integration points
696 auto t_coords = getFTensor1CoordsAtGaussPts();
697 // loop over all integration points
698 for (int gg = 0; gg != nbIntegrationPts; gg++) {
699 // evaluate constant term
700 const double alpha = vol * t_w;
701 const double source_term =
702 alpha * fSource(t_coords(NX), t_coords(NY), t_coords(NZ));
704 grad_term(i) = (alpha * A(t_u)) * t_grad(i);
705 // get element of local vector
707 &*locVec.data().begin());
708 // loop over base functions
709 for (int rr = 0; rr != nbRows; rr++) {
710 // add to local vector source term
711 t_a += t_v_grad(i) * grad_term(i) + t_v * source_term;
712 ++t_a; // move to next element of local vector
713 ++t_v; // move to next base function
714 ++t_v_grad; // move to next gradient of base function
715 }
716 ++t_w; // move to next integration weights
717 ++t_u; // move to next value
718 ++t_grad; // move to next gradient value
719 ++t_coords; // move to next physical coordinates at integration point
720 }
722 }
#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()
FTensor::Tensor1< FTensor::PackPtr< T *, S >, Tensor_Dim > getFTensor1FromMat(ublas::matrix< T, L, A > &data)
Get tensor rank 1 (vector) form data matrix.
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
FTensor::Number< 2 > NZ
FTensor::Number< 1 > NY
FTensor::Number< 0 > NX

Member Data Documentation

◆ A

boost::function<double(const double)> PoissonExample::OpResF_Domain::A
protected
Examples
PoissonOperators.hpp.

Definition at line 724 of file PoissonOperators.hpp.

◆ fieldVals

boost::shared_ptr<VectorDouble> PoissonExample::OpResF_Domain::fieldVals
protected
Examples
PoissonOperators.hpp.

Definition at line 725 of file PoissonOperators.hpp.

◆ gradVals

boost::shared_ptr<MatrixDouble> PoissonExample::OpResF_Domain::gradVals
protected
Examples
PoissonOperators.hpp.

Definition at line 726 of file PoissonOperators.hpp.

◆ i

FTensor::Index<'i', 3> PoissonExample::OpResF_Domain::i
protected
Examples
PoissonOperators.hpp.

Definition at line 670 of file PoissonOperators.hpp.


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