v0.9.0
Public Member Functions | Public Attributes | List of all members
CellEngineering::OpCellCurlD Struct Reference

Calculate and assemble Z matrix. More...

#include <users_modules/cell_engineering/src/CellForces.hpp>

Inheritance diagram for CellEngineering::OpCellCurlD:
[legend]
Collaboration diagram for CellEngineering::OpCellCurlD:
[legend]

Public Member Functions

 OpCellCurlD (Mat a, const double eps_rho, const double eps_l)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 

Public Attributes

Mat A
 
const double epsRho
 
const double epsL
 
MatrixDouble C
 

Detailed Description

Calculate and assemble Z matrix.

Examples
cell_forces.cpp.

Definition at line 315 of file CellForces.hpp.

Constructor & Destructor Documentation

◆ OpCellCurlD()

CellEngineering::OpCellCurlD::OpCellCurlD ( Mat  a,
const double  eps_rho,
const double  eps_l 
)

Definition at line 322 of file CellForces.hpp.

324  "RHO", "RHO", UserDataOperator::OPROWCOL),
325  A(a), epsRho(eps_rho), epsL(eps_l) {
326  sYmm = false;
327  }
ForcesAndSourcesCore::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork()

MoFEMErrorCode CellEngineering::OpCellCurlD::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)

Definition at line 331 of file CellForces.hpp.

334  {
335 
337 
338  int nb_row = row_data.getIndices().size();
339  int nb_col = col_data.getIndices().size();
340 
341  if (nb_row == 0)
343  if (nb_col == 0)
345 
346  const VectorInt &row_indices = row_data.getIndices();
347  const VectorInt &col_indices = col_data.getIndices();
348 
349  const int nb_gauss_pts = row_data.getN().size1();
350 
351  auto t_diff_base_row = row_data.getFTensor2DiffN<3, 2>();
352  auto t_base_row = row_data.getFTensor1N<3>();
353 
358 
359  C.resize(nb_row, nb_col, false);
360  C.clear();
361  for (int gg = 0; gg != nb_gauss_pts; gg++) {
362  // get integration weights
363  const double val = getGaussPts()(2, gg) * getArea();
364  for (int rr = 0; rr != nb_row; rr++) {
365  const double curl_row = t_diff_base_row(1, 0) - t_diff_base_row(0, 1);
366  auto t_diff_base_col = col_data.getFTensor2DiffN<3, 2>(gg, 0);
367  auto t_base_col = col_data.getFTensor1N<3>(gg, 0);
368  for (int cc = 0; cc != nb_col; cc++) {
369  const double curl_col = t_diff_base_col(1, 0) - t_diff_base_col(0, 1);
370  const double diag = val * epsRho * t_base_row(i) * t_base_col(i);
371  const double curl =
372  epsL > 0 ? val * pow(epsL, -1) * curl_row * curl_col : 0;
373  C(rr, cc) += diag + curl;
374  ++t_diff_base_col;
375  ++t_base_col;
376  }
377  ++t_diff_base_row;
378  ++t_base_row;
379  }
380  }
381 
382  CHKERR MatSetValues(A, nb_row, &*row_indices.begin(), nb_col,
383  &*col_indices.begin(), &*C.data().begin(), ADD_VALUES);
384 
386  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
MoFEMErrorCode MatSetValues(Mat M, const DataForcesAndSourcesCore::EntData &row_data, const DataForcesAndSourcesCore::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
#define CHKERR
Inline error check.
Definition: definitions.h:596
ublas::vector< int, IntAllocator > VectorInt
Definition: Types.hpp:71
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

Member Data Documentation

◆ A

Mat CellEngineering::OpCellCurlD::A

Definition at line 318 of file CellForces.hpp.

◆ C

MatrixDouble CellEngineering::OpCellCurlD::C

Definition at line 329 of file CellForces.hpp.

◆ epsL

const double CellEngineering::OpCellCurlD::epsL

Definition at line 320 of file CellForces.hpp.

◆ epsRho

const double CellEngineering::OpCellCurlD::epsRho

Definition at line 319 of file CellForces.hpp.


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