v0.16.3
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
NonlinearPoissonOps::OpDomainRhs Struct Reference

#include "tutorials/scl-4_nonlinear_poisson_2d/src/nonlinear_poisson_2d.hpp"

Inheritance diagram for NonlinearPoissonOps::OpDomainRhs:
[legend]
Collaboration diagram for NonlinearPoissonOps::OpDomainRhs:
[legend]

Public Member Functions

 OpDomainRhs (std::string field_name, ScalarFunc source_term_function, boost::shared_ptr< VectorDouble > field_vec, boost::shared_ptr< MatrixDouble > field_grad_mat)
 
MoFEMErrorCode iNtegrate (EntData &data)
 Class dedicated to integrate operator.
 
- Public Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
 OpBaseImpl (const std::string row_field_name, const std::string col_field_name, const OpType type, boost::shared_ptr< Range > ents_ptr=nullptr)
 Constructor for base operator implementation.
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 Do calculations for the left hand side.
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntData &row_data)
 Do calculations for the right hand side.
 

Private Attributes

ScalarFunc sourceTermFunc
 
boost::shared_ptr< VectorDouble > fieldVec
 
boost::shared_ptr< MatrixDouble > fieldGradMat
 

Additional Inherited Members

- Public Types inherited from MoFEM::OpBaseImpl< A, EleOp >
using OpType = typename EleOp::OpType
 
using EntData = EntitiesFieldData::EntData
 
using MatSetValuesHook = boost::function< MoFEMErrorCode(ForcesAndSourcesCore::UserDataOperator *op_ptr, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, MatrixDouble &m)>
 
- Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
TimeFun timeScalingFun
 assumes that time variable is set
 
FEFun feScalingFun
 set by fe entity handle
 
boost::shared_ptr< Range > entsPtr
 Entities on which element is run.
 
- Static Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
static MatSetValuesHook matSetValuesHook
 
- Protected Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
template<int DIM>
auto getNf ()
 Get local vector tensor for assembly.
 
template<int ROW_DIM, int COL_DIM = ROW_DIM>
FTensor::Tensor2< FTensor::PackPtr< double *, COL_DIM >, ROW_DIM, COL_DIM > getLocMat (const int rr)
 Get local matrix tensor for assembly.
 
virtual MoFEMErrorCode iNtegrate (EntData &, EntData &)
 Integrate grad-grad operator.
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data, const bool trans)
 Assemble local matrix into global matrix.
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 Assemble local vector into global vector.
 
virtual size_t getNbOfBaseFunctions (EntitiesFieldData::EntData &data)
 Get number of base functions.
 
- Protected Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
int nbRows
 number of dofs on rows
 
int nbCols
 number if dof on column
 
int nbIntegrationPts
 number of integration points
 
int nbRowBaseFunctions
 number or row base functions
 
int rowSide
 row side number
 
int colSide
 column side number
 
EntityType rowType
 row type
 
EntityType colType
 column type
 
bool assembleTranspose
 
bool onlyTranspose
 
MatrixDouble locMat
 local entity block matrix
 
MatrixDouble locMatTranspose
 local entity block matrix
 
VectorDouble locF
 local entity vector
 

Detailed Description

Definition at line 119 of file nonlinear_poisson_2d.hpp.

Constructor & Destructor Documentation

◆ OpDomainRhs()

NonlinearPoissonOps::OpDomainRhs::OpDomainRhs ( std::string  field_name,
ScalarFunc  source_term_function,
boost::shared_ptr< VectorDouble >  field_vec,
boost::shared_ptr< MatrixDouble >  field_grad_mat 
)
inline

Definition at line 121 of file nonlinear_poisson_2d.hpp.

125 : AssemblyDomainEleOp(field_name, field_name, AssemblyDomainEleOp::OPROW),
126 sourceTermFunc(source_term_function), fieldVec(field_vec),
127 fieldGradMat(field_grad_mat) {}
constexpr auto field_name
boost::shared_ptr< VectorDouble > fieldVec
boost::shared_ptr< MatrixDouble > fieldGradMat

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode NonlinearPoissonOps::OpDomainRhs::iNtegrate ( EntData &  )
inlinevirtual

Class dedicated to integrate operator.

Parameters
dataentity data on element row
Returns
error code

Reimplemented from MoFEM::OpBaseImpl< A, EleOp >.

Definition at line 129 of file nonlinear_poisson_2d.hpp.

129 {
131
132 auto &nf = AssemblyDomainEleOp::locF;
133
134
135 // get element area
136 const double area = getMeasure();
137
138 // get number of integration points
139 const int nb_integration_points = getGaussPts().size2();
140 // get integration weights
141 auto t_w = getFTensor0IntegrationWeight();
142 // get coordinates of the integration point
143 auto t_coords = getFTensor1CoordsAtGaussPts();
144 // get solution (field value) at integration point
145 auto t_field = getFTensor0FromVec(*fieldVec);
146 // get gradient of field value of integration point
147 auto t_field_grad = getFTensor1FromMat<2>(*fieldGradMat);
148
149 // get base function
150 auto t_base = data.getFTensor0N();
151 // get derivatives of base function
152 auto t_grad_base = data.getFTensor1DiffN<2>();
153
154 // START THE LOOP OVER INTEGRATION POINTS TO CALCULATE LOCAL VECTOR
155 for (int gg = 0; gg != nb_integration_points; gg++) {
156 const double a = t_w * area;
157 double body_source =
158 sourceTermFunc(t_coords(0), t_coords(1), t_coords(2));
159
160 // calculate the local vector
161 for (int rr = 0; rr != AssemblyDomainEleOp::nbRows; rr++) {
162 nf[rr] +=
163 (-t_base * body_source +
164 t_grad_base(i) * t_field_grad(i) * (1 + t_field * t_field)) *
165 a;
166
167 // move to the next base function
168 ++t_base;
169 // move to the derivatives of the next base function
170 ++t_grad_base;
171 }
172
173 // move to the weight of the next integration point
174 ++t_w;
175 // move to the coordinates of the next integration point
176 ++t_coords;
177 // move to the solution (field value) at the next integration point
178 ++t_field;
179 // move to the gradient of field value at the next integration point
180 ++t_field_grad;
181
182 }
183
185 }
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()
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.
FTensor::Index< 'i', 2 > i
VectorDouble locF
local entity vector
int nbRows
number of dofs on rows

Member Data Documentation

◆ fieldGradMat

boost::shared_ptr<MatrixDouble> NonlinearPoissonOps::OpDomainRhs::fieldGradMat
private

Definition at line 190 of file nonlinear_poisson_2d.hpp.

◆ fieldVec

boost::shared_ptr<VectorDouble> NonlinearPoissonOps::OpDomainRhs::fieldVec
private

Definition at line 189 of file nonlinear_poisson_2d.hpp.

◆ sourceTermFunc

ScalarFunc NonlinearPoissonOps::OpDomainRhs::sourceTermFunc
private

Definition at line 188 of file nonlinear_poisson_2d.hpp.


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