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

Public Member Functions

 OpULhs_dU (const std::string field_name_row, const std::string field_name_col, boost::shared_ptr< MatrixDouble > u_ptr, boost::shared_ptr< MatrixDouble > grad_u_ptr)
 
MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Integrate grad-grad 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 > uGradPtr
 

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 aSsemble (EntData &row_data, EntData &col_data, const bool trans)=0
 
virtual MoFEMErrorCode iNtegrate (EntData &data)
 Class dedicated to integrate operator. More...
 
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 183 of file shallow_wave.cpp.

Constructor & Destructor Documentation

◆ OpULhs_dU()

OpULhs_dU::OpULhs_dU ( const std::string  field_name_row,
const std::string  field_name_col,
boost::shared_ptr< MatrixDouble >  u_ptr,
boost::shared_ptr< MatrixDouble >  grad_u_ptr 
)

Definition at line 185 of file shallow_wave.cpp.

188  : AssemblyDomainEleOp(field_name_row, field_name_col,
189  AssemblyDomainEleOp::OPROWCOL),
190  uPtr(u_ptr), uGradPtr(grad_u_ptr) {
191  this->sYmm = false;
192  }
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::OpBase AssemblyDomainEleOp
boost::shared_ptr< MatrixDouble > uPtr
boost::shared_ptr< MatrixDouble > uGradPtr

Member Function Documentation

◆ iNtegrate()

MoFEMErrorCode OpULhs_dU::iNtegrate ( EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)
virtual

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 194 of file shallow_wave.cpp.

195  {
197 
198  const double vol = getMeasure();
199  auto t_w = getFTensor0IntegrationWeight();
200  auto t_row_base = row_data.getFTensor0N();
201  auto t_row_diff_base = row_data.getFTensor1DiffN<3>();
202  auto t_coords = getFTensor1CoordsAtGaussPts();
203  auto t_normal = getFTensor1NormalsAtGaussPts();
204 
205  auto t_u = getFTensor1FromMat<3>(*uPtr);
206  auto t_grad_u = getFTensor2FromMat<3, 3>(*uGradPtr);
207 
208  auto get_t_mat = [&](const int rr) {
210  &locMat(rr + 0, 0), &locMat(rr + 0, 1), &locMat(rr + 0, 2),
211 
212  &locMat(rr + 1, 0), &locMat(rr + 1, 1), &locMat(rr + 1, 2),
213 
214  &locMat(rr + 2, 0), &locMat(rr + 2, 1), &locMat(rr + 2, 2)};
215  };
216 
217  const auto ts_a = getFEMethod()->ts_a;
218 
219  for (int gg = 0; gg != nbIntegrationPts; gg++) {
220 
221  const auto a = std::sqrt(t_coords(i) * t_coords(i));
222  const auto sin_fi = t_coords(2) / a;
223  const auto f = 2 * omega * sin_fi;
224 
226  t_r(i) = t_normal(i);
227  t_r.normalize();
228 
229  constexpr auto t_kd = FTensor::Kronecker_Delta<double>();
231  t_P(i, j) = t_r(i) * t_r(j);
232  t_Q(i, j) = t_kd(i, j) - t_P(i, j);
233 
235  t_A(i, m) = levi_civita(i, j, m) * t_r(j);
236 
238  t_rhs_du(m, j) =
239  t_Q(m, i) * (ts_a * t_kd(i, j) + t_grad_u(i, j) + f * t_A(i, j)) +
240  t_P(m, j);
241 
242  const double alpha = t_w * vol;
243 
244  int rr = 0;
245  for (; rr != nbRows / 3; rr++) {
246 
247  auto t_col_base = col_data.getFTensor0N(gg, 0);
248  auto t_col_diff_base = col_data.getFTensor1DiffN<3>(gg, 0);
249  auto t_mat = get_t_mat(3 * rr);
250 
251  for (int cc = 0; cc != nbCols / 3; cc++) {
252  t_mat(i, j) += (alpha * t_row_base * t_col_base) * t_rhs_du(i, j);
253  t_mat(i, j) += (alpha * mu) * t_Q(i, j) *
254  (t_row_diff_base(m) * t_col_diff_base(m));
255  ++t_col_diff_base;
256  ++t_col_base;
257  ++t_mat;
258  }
259  ++t_row_base;
260  ++t_row_diff_base;
261  }
262  for (; rr < nbRowBaseFunctions; ++rr) {
263  ++t_row_base;
264  ++t_row_diff_base;
265  }
266 
267  ++t_w;
268  ++t_coords;
269  ++t_normal;
270  ++t_u;
271  ++t_grad_u;
272  }
273 
275  }
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
FTensor::Index< 'm', 3 > m
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.
int nbRows
number of dofs on rows
int nbIntegrationPts
number of integration points
MatrixDouble locMat
local entity block matrix
int nbCols
number if dof on column
int nbRowBaseFunctions
number or row base functions

Member Data Documentation

◆ uGradPtr

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

Definition at line 279 of file shallow_wave.cpp.

◆ uPtr

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

Definition at line 278 of file shallow_wave.cpp.


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