v0.13.0
Public Member Functions | Private Attributes | List of all members
OpURhs Struct Reference
Inheritance diagram for OpURhs:
[legend]
Collaboration diagram for OpURhs:
[legend]

Public Member Functions

 OpURhs (const std::string field_name, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > u_dot_ptr, boost::shared_ptr< MatrixDouble > grad_u_ptr, boost::shared_ptr< MatrixDouble > grad_h_ptr)
 
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data)
 Class dedicated to integrate operator. More...
 
- 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)
 
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. More...
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntData &row_data)
 Do calculations for the right hand side. More...
 

Private Attributes

boost::shared_ptr< MatrixDouble > uPtr
 
boost::shared_ptr< MatrixDouble > uDotPtr
 
boost::shared_ptr< MatrixDouble > uGradPtr
 
boost::shared_ptr< MatrixDouble > hGradPtr
 

Additional Inherited Members

- Public Types inherited from MoFEM::OpBaseImpl< A, EleOp >
using OpType = typename EleOp::OpType
 
using EntData = EntitiesFieldData::EntData
 
- Protected Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
template<int DIM>
FTensor::Tensor1< FTensor::PackPtr< double *, DIM >, DIM > getNf ()
 
template<int DIM>
FTensor::Tensor2< FTensor::PackPtr< double *, DIM >, DIM, DIM > getLocMat (const int rr)
 
virtual MoFEMErrorCode iNtegrate (EntData &row_data, EntData &col_data)
 Integrate grad-grad operator. More...
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data, const bool trans)=0
 
virtual MoFEMErrorCode aSsemble (EntData &data)=0
 
- Protected Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
int nbRows
 number of dofs on rows More...
 
int nbCols
 number if dof on column More...
 
int nbIntegrationPts
 number of integration points More...
 
int nbRowBaseFunctions
 number or row base functions More...
 
int rowSide
 row side number More...
 
int colSide
 column side number More...
 
EntityType rowType
 row type More...
 
EntityType colType
 column type More...
 
bool assembleTranspose
 
bool onlyTranspose
 
MatrixDouble locMat
 local entity block matrix More...
 
MatrixDouble locMatTranspose
 local entity block matrix More...
 
VectorDouble locF
 local entity vector More...
 

Detailed Description

Examples
shallow_wave.cpp.

Definition at line 97 of file shallow_wave.cpp.

Constructor & Destructor Documentation

◆ OpURhs()

OpURhs::OpURhs ( const std::string  field_name,
boost::shared_ptr< MatrixDouble >  u_ptr,
boost::shared_ptr< MatrixDouble >  u_dot_ptr,
boost::shared_ptr< MatrixDouble >  grad_u_ptr,
boost::shared_ptr< MatrixDouble >  grad_h_ptr 
)

Definition at line 99 of file shallow_wave.cpp.

103  : AssemblyDomainEleOp(field_name, field_name, AssemblyDomainEleOp::OPROW),
104  uPtr(u_ptr), uDotPtr(u_dot_ptr), uGradPtr(grad_u_ptr),
105  hGradPtr(grad_h_ptr) {}
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::OpBase AssemblyDomainEleOp
boost::shared_ptr< MatrixDouble > uDotPtr
boost::shared_ptr< MatrixDouble > uGradPtr
boost::shared_ptr< MatrixDouble > hGradPtr
boost::shared_ptr< MatrixDouble > uPtr

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode OpURhs::iNtegrate ( EntitiesFieldData::EntData data)
virtual

Class dedicated to integrate operator.

Parameters
dataentity data on element row
Returns
error code

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

Definition at line 107 of file shallow_wave.cpp.

107  {
109 
110  const double vol = getMeasure();
111  auto t_w = getFTensor0IntegrationWeight();
112  auto t_row_base = row_data.getFTensor0N();
113  auto t_row_diff_base = row_data.getFTensor1DiffN<3>();
114  auto t_dot_u = getFTensor1FromMat<3>(*uDotPtr);
115  auto t_u = getFTensor1FromMat<3>(*uPtr);
116  auto t_grad_u = getFTensor2FromMat<3, 3>(*uGradPtr);
117  auto t_grad_h = getFTensor1FromMat<3>(*hGradPtr);
118  auto t_coords = getFTensor1CoordsAtGaussPts();
119  auto t_normal = getFTensor1NormalsAtGaussPts();
120 
121  for (int gg = 0; gg != nbIntegrationPts; gg++) {
122 
123  const double alpha = t_w * vol;
124  auto t_nf = getFTensor1FromArray<3, 3>(locF);
125 
128 
129  const auto a = std::sqrt(t_coords(i) * t_coords(i));
130  const auto sin_fi = t_coords(2) / a;
131  const auto f = 2 * omega * sin_fi;
132 
134  t_r(i) = t_normal(i);
135  t_r.normalize();
136 
137  constexpr auto t_kd = FTensor::Kronecker_Delta<double>();
139  t_P(i, j) = t_r(i) * t_r(j);
140  t_Q(i, j) = t_kd(i, j) - t_P(i, j);
141 
143  t_A(i, m) = levi_civita(i, j, m) * t_r(j);
144 
145  t_rhs(m) = t_Q(m, i) * (t_dot_u(i) + t_grad_u(i, j) * t_u(j) +
146  f * t_A(i, j) * t_u(j) + g * t_grad_h(i));
147  t_rhs_grad(m, j) = t_Q(m, i) * (mu * t_grad_u(i, j));
148 
149  t_rhs(m) += t_P(m, j) * t_u(j);
150 
151  int rr = 0;
152  for (; rr != nbRows / 3; ++rr) {
153  t_nf(i) += alpha * t_row_base * t_rhs(i);
154  t_nf(i) += alpha * t_row_diff_base(j) * t_rhs_grad(i, j);
155  ++t_row_base;
156  ++t_row_diff_base;
157  ++t_nf;
158  }
159  for (; rr < nbRowBaseFunctions; ++rr) {
160  ++t_row_base;
161  ++t_row_diff_base;
162  }
163 
164  ++t_w;
165  ++t_u;
166  ++t_dot_u;
167  ++t_grad_u;
168  ++t_grad_h;
169  ++t_coords;
170  ++t_normal;
171  }
172 
174  }
constexpr double a
Kronecker Delta class.
Tensor1< T, Tensor_Dim > normalize()
constexpr double alpha
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
constexpr auto t_kd
constexpr std::enable_if<(Dim0<=2 &&Dim1<=2), Tensor2_Expr< Levi_Civita< T >, T, Dim0, Dim1, i, j > >::type levi_civita(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
levi_civita functions to make for easy adhoc use
constexpr double mu
FTensor::Index< 'j', 3 > j
constexpr double omega
FTensor::Index< 'i', 3 > i
constexpr double g
FTensor::Index< 'm', 3 > m
VectorDouble locF
local entity vector
int nbRows
number of dofs on rows
int nbIntegrationPts
number of integration points
int nbRowBaseFunctions
number or row base functions

Member Data Documentation

◆ hGradPtr

boost::shared_ptr<MatrixDouble> OpURhs::hGradPtr
private

Definition at line 180 of file shallow_wave.cpp.

◆ uDotPtr

boost::shared_ptr<MatrixDouble> OpURhs::uDotPtr
private

Definition at line 178 of file shallow_wave.cpp.

◆ uGradPtr

boost::shared_ptr<MatrixDouble> OpURhs::uGradPtr
private

Definition at line 179 of file shallow_wave.cpp.

◆ uPtr

boost::shared_ptr<MatrixDouble> OpURhs::uPtr
private

Definition at line 177 of file shallow_wave.cpp.


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