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

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

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

Public Member Functions

 OpDomainLhs (std::string row_field_name, std::string col_field_name, boost::shared_ptr< VectorDouble > field_vec, boost::shared_ptr< MatrixDouble > field_grad_mat)
 
MoFEMErrorCode iNtegrate (EntData &row_data, EntData &col_data)
 Integrate grad-grad 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

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 aSsemble (EntData &row_data, EntData &col_data, const bool trans)
 Assemble local matrix into global matrix.
 
virtual MoFEMErrorCode iNtegrate (EntData &)
 Class dedicated to integrate operator.
 
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 39 of file nonlinear_poisson_2d.hpp.

Constructor & Destructor Documentation

◆ OpDomainLhs()

NonlinearPoissonOps::OpDomainLhs::OpDomainLhs ( std::string  row_field_name,
std::string  col_field_name,
boost::shared_ptr< VectorDouble >  field_vec,
boost::shared_ptr< MatrixDouble >  field_grad_mat 
)
inline

Definition at line 41 of file nonlinear_poisson_2d.hpp.

45 : AssemblyDomainEleOp(row_field_name, col_field_name,
46 DomainEleOp::OPROWCOL),
47 fieldVec(field_vec), fieldGradMat(field_grad_mat) {}
boost::shared_ptr< VectorDouble > fieldVec
boost::shared_ptr< MatrixDouble > fieldGradMat

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode NonlinearPoissonOps::OpDomainLhs::iNtegrate ( EntData &  ,
EntData &   
)
inlinevirtual

Integrate grad-grad operator.

Parameters
row_datarow data (consist base functions on row entity)
col_datacolumn data (consist base functions on column entity)
Returns
error code

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

Definition at line 49 of file nonlinear_poisson_2d.hpp.

50 {
52
53 auto &locLhs = AssemblyDomainEleOp::locMat;
54
55 const int nb_row_dofs = row_data.getIndices().size();
56 const int nb_col_dofs = col_data.getIndices().size();
57 // get element area
58 const double area = getMeasure();
59
60 // get number of integration points
61 const int nb_integration_points = getGaussPts().size2();
62 // get integration weights
63 auto t_w = getFTensor0IntegrationWeight();
64 // get solution (field value) at integration points
65 auto t_field = getFTensor0FromVec(*fieldVec);
66 // get gradient of field at integration points
67 auto t_field_grad = getFTensor1FromMat<2>(*fieldGradMat);
68
69 // get base functions on row
70 auto t_row_base = row_data.getFTensor0N();
71 // get derivatives of base functions on row
72 auto t_row_diff_base = row_data.getFTensor1DiffN<2>();
73
74 // START THE LOOP OVER INTEGRATION POINTS TO CALCULATE LOCAL MATRIX
75 for (int gg = 0; gg != nb_integration_points; gg++) {
76 const double a = t_w * area;
77
78 for (int rr = 0; rr != nb_row_dofs; ++rr) {
79 // get base functions on column
80 auto t_col_base = col_data.getFTensor0N(gg, 0);
81 // get derivatives of base functions on column
82 auto t_col_diff_base = col_data.getFTensor1DiffN<2>(gg, 0);
83
84 for (int cc = 0; cc != nb_col_dofs; cc++) {
85 locLhs(rr, cc) += (((1 + t_field * t_field) * t_row_diff_base(i) *
86 t_col_diff_base(i)) +
87 (2.0 * t_field * t_field_grad(i) *
88 t_row_diff_base(i) * t_col_base)) *
89 a;
90
91 // move to the next base functions on column
92 ++t_col_base;
93 // move to the derivatives of the next base function on column
94 ++t_col_diff_base;
95 }
96
97 // move to the next base function on row
98 ++t_row_base;
99 // move to the derivatives of the next base function on row
100 ++t_row_diff_base;
101 }
102
103 // move to the weight of the next integration point
104 ++t_w;
105 // move to the solution (field value) at the next integration point
106 ++t_field;
107 // move to the gradient of field value at the next integration point
108 ++t_field_grad;
109 }
110
112 }
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
MatrixDouble locMat
local entity block matrix

Member Data Documentation

◆ fieldGradMat

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

Definition at line 116 of file nonlinear_poisson_2d.hpp.

◆ fieldVec

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

Definition at line 115 of file nonlinear_poisson_2d.hpp.


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