v0.9.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PoissonExample::OpResF_Domain Struct Reference

#include <users_modules/basic_finite_elements/poisson/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, DataForcesAndSourcesCore::EntData &row_data)
 This function is called by finite element. More...
 

Protected Member Functions

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

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 More...
 
int nbIntegrationPts
 number of integration points More...
 

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 672 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 
)
Examples
PoissonOperators.hpp.

Definition at line 674 of file PoissonOperators.hpp.

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

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode PoissonExample::OpResF_Domain::iNtegrate ( DataForcesAndSourcesCore::EntData data)
protectedvirtual

Integrate local entity vector.

Parameters
dataentity data on element row
Returns
error code

Reimplemented from PoissonExample::OpF.

Examples
PoissonOperators.hpp.

Definition at line 687 of file PoissonOperators.hpp.

687  {
689  // set size of local vector
690  locVec.resize(nbRows, false);
691  // clear local entity vector
692  locVec.clear();
693  // get finite element volume
694  double vol = getVolume();
695  // get integration weights
696  auto t_w = getFTensor0IntegrationWeight();
697  // get solution at integration point
698  auto t_u = getFTensor0FromVec(*fieldVals);
699  // get solution at integration point
700  auto t_grad = getFTensor1FromMat<3>(*gradVals);
701  // get base functions on entity
702  auto t_v = data.getFTensor0N();
703  // get base function gradient on rows
704  auto t_v_grad = data.getFTensor1DiffN<3>();
705  // get coordinates at integration points
706  auto t_coords = getFTensor1CoordsAtGaussPts();
707  // loop over all integration points
708  for (int gg = 0; gg != nbIntegrationPts; gg++) {
709  // evaluate constant term
710  const double alpha = vol * t_w;
711  const double source_term =
712  alpha * fSource(t_coords(NX), t_coords(NY), t_coords(NZ));
713  FTensor::Tensor1<double, 3> grad_term;
714  grad_term(i) = (alpha * A(t_u)) * t_grad(i);
715  // get element of local vector
717  &*locVec.data().begin());
718  // loop over base functions
719  for (int rr = 0; rr != nbRows; rr++) {
720  // add to local vector source term
721  t_a += t_v_grad(i) * grad_term(i) + t_v * source_term;
722  ++t_a; // move to next element of local vector
723  ++t_v; // move to next base function
724  ++t_v_grad; // move to next gradient of base function
725  }
726  ++t_w; // move to next integration weights
727  ++t_u; // move to next value
728  ++t_grad; // move to next gradient value
729  ++t_coords; // move to next physical coordinates at integration point
730  }
732  }
static FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:142
boost::shared_ptr< VectorDouble > fieldVals
FTensor::Index< 'i', 3 > i
FTensor::Number< 0 > NX
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
boost::function< double(const double)> A
FTensor::Number< 2 > NZ
FTensor::Number< 1 > NY
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
boost::shared_ptr< MatrixDouble > gradVals

Member Data Documentation

◆ A

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

Definition at line 734 of file PoissonOperators.hpp.

◆ fieldVals

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

Definition at line 735 of file PoissonOperators.hpp.

◆ gradVals

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

Definition at line 736 of file PoissonOperators.hpp.

◆ i

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

Definition at line 680 of file PoissonOperators.hpp.


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