v0.14.0
Public Member Functions | Public Attributes | List of all members
NeumannForcesSurface::OpNeumannPressureLhs_dx_dX Struct Reference

LHS-operator for pressure element (spatial configuration) More...

#include <users_modules/basic_finite_elements/src/SurfacePressure.hpp>

Inheritance diagram for NeumannForcesSurface::OpNeumannPressureLhs_dx_dX:
[legend]
Collaboration diagram for NeumannForcesSurface::OpNeumannPressureLhs_dx_dX:
[legend]

Public Member Functions

MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Compute left-hand side. More...
 
 OpNeumannPressureLhs_dx_dX (const string field_name_1, const string field_name_2, boost::shared_ptr< DataAtIntegrationPts > data_at_pts, Mat aij, bCPressure &data, bool ho_geometry=false)
 
- Public Member Functions inherited from MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
double getArea ()
 get area of face More...
 
VectorDoublegetNormal ()
 get triangle normal More...
 
VectorDoublegetTangent1 ()
 get triangle tangent 1 More...
 
VectorDoublegetTangent2 ()
 get triangle tangent 2 More...
 
auto getFTensor1Normal ()
 get normal as tensor More...
 
auto getFTensor1Tangent1 ()
 get tangentOne as tensor More...
 
auto getFTensor1Tangent2 ()
 get tangentTwo as tensor More...
 
int getNumNodes ()
 get element number of nodes More...
 
const EntityHandlegetConn ()
 get element connectivity More...
 
VectorDoublegetCoords ()
 get triangle coordinates More...
 
auto getFTensor1Coords ()
 get get coords at gauss points More...
 
MatrixDoublegetNormalsAtGaussPts ()
 if higher order geometry return normals at Gauss pts. More...
 
ublas::matrix_row< MatrixDoublegetNormalsAtGaussPts (const int gg)
 if higher order geometry return normals at Gauss pts. More...
 
MatrixDoublegetTangent1AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
MatrixDoublegetTangent2AtGaussPts ()
 if higher order geometry return tangent vector to triangle at Gauss pts. More...
 
auto getFTensor1NormalsAtGaussPts ()
 get normal at integration points More...
 
auto getFTensor1Tangent1AtGaussPts ()
 get tangent 1 at integration points More...
 
auto getFTensor1Tangent2AtGaussPts ()
 get tangent 2 at integration points More...
 
FaceElementForcesAndSourcesCoregetFaceFE ()
 return pointer to Generic Triangle Finite Element object More...
 
MoFEMErrorCode loopSideVolumes (const string fe_name, VolumeElementForcesAndSourcesCoreOnSide &fe_method)
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, const bool symm=true)
 
 UserDataOperator (const std::string field_name, const char type, const bool symm=true)
 
 UserDataOperator (const std::string row_field_name, const std::string col_field_name, const char type, const bool symm=true)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement. More...
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle. More...
 
int getFEDim () const
 Get dimension of finite element. More...
 
EntityType getFEType () const
 Get dimension of finite element. More...
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer. More...
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity. More...
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element. More...
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices. More...
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices. More...
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object. More...
 
int getOpType () const
 Get operator types. More...
 
void setOpType (const OpType type)
 Set operator type. More...
 
void addOpType (const OpType type)
 Add operator type. More...
 
int getNinTheLoop () const
 get number of finite element in the loop More...
 
int getLoopSize () const
 get size of elements in the loop More...
 
std::string getFEName () const
 Get name of the element. More...
 
ForcesAndSourcesCoregetPtrFE () const
 
ForcesAndSourcesCoregetSidePtrFE () const
 
ForcesAndSourcesCoregetRefinePtrFE () const
 
const PetscData::SwitchesgetDataCtx () const
 
const KspMethod::KSPContext getKSPCtx () const
 
const SnesMethod::SNESContext getSNESCtx () const
 
const TSMethod::TSContext getTSCtx () const
 
Vec getKSPf () const
 
Mat getKSPA () const
 
Mat getKSPB () const
 
Vec getSNESf () const
 
Vec getSNESx () const
 
Mat getSNESA () const
 
Mat getSNESB () const
 
Vec getTSu () const
 
Vec getTSu_t () const
 
Vec getTSu_tt () const
 
Vec getTSf () const
 
Mat getTSA () const
 
Mat getTSB () const
 
int getTSstep () const
 
double getTStime () const
 
double getTStimeStep () const
 
double getTSa () const
 
double getTSaa () const
 
MatrixDoublegetGaussPts ()
 matrix of integration (Gauss) points for Volume Element More...
 
auto getFTensor0IntegrationWeight ()
 Get integration weights. More...
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3) More...
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry. More...
 
double getMeasure () const
 get measure of element More...
 
doublegetMeasure ()
 get measure of element More...
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy, AdjCache *adj_cache=nullptr)
 User calls this function to loop over elements on the side of face. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopThis (const string &fe_name, ForcesAndSourcesCore *this_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over the same element using a different set of integration points. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopParent (const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations. More...
 
MoFEMErrorCode loopChildren (const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 User calls this function to loop over parent elements. This function calls finite element with its operator to do calculations. More...
 
- Public Member Functions inherited from MoFEM::DataOperator
 DataOperator (const bool symm=true)
 
virtual ~DataOperator ()=default
 
virtual MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Operator for bi-linear form, usually to calculate values on left hand side. More...
 
virtual MoFEMErrorCode opLhs (EntitiesFieldData &row_data, EntitiesFieldData &col_data)
 
virtual MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not. More...
 
void setSymm ()
 set if operator is executed taking in account symmetry More...
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem More...
 

Public Attributes

boost::shared_ptr< DataAtIntegrationPtsdataAtIntegrationPts
 
Mat Aij
 
bCPressuredAta
 
bool hoGeometry
 
MatrixDouble NN
 
- Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
char opType
 
std::string rowFieldName
 
std::string colFieldName
 
FieldSpace sPace
 
- Public Attributes inherited from MoFEM::DataOperator
DoWorkLhsHookFunType doWorkLhsHook
 
DoWorkRhsHookFunType doWorkRhsHook
 
bool sYmm
 If true assume that matrix is symmetric structure. More...
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity. More...
 
booldoVertices
 \deprectaed If false skip vertices More...
 
booldoEdges
 \deprectaed If false skip edges More...
 
booldoQuads
 \deprectaed More...
 
booldoTris
 \deprectaed More...
 
booldoTets
 \deprectaed More...
 
booldoPrisms
 \deprectaed More...
 

Additional Inherited Members

- Public Types inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
enum  OpType {
  OPROW = 1 << 0, OPCOL = 1 << 1, OPROWCOL = 1 << 2, OPSPACE = 1 << 3,
  OPLAST = 1 << 3
}
 Controls loop over entities on element. More...
 
using AdjCache = std::map< EntityHandle, std::vector< boost::weak_ptr< NumeredEntFiniteElement > >>
 
- Public Types inherited from MoFEM::DataOperator
using DoWorkLhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)>
 
using DoWorkRhsHookFunType = boost::function< MoFEMErrorCode(DataOperator *op_ptr, int side, EntityType type, EntitiesFieldData::EntData &data)>
 
- Static Public Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
static const char *const OpTypeNames []
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

LHS-operator for pressure element (spatial configuration)

Computes linearisation of the spatial component with respect to material coordinates.

Definition at line 259 of file SurfacePressure.hpp.

Constructor & Destructor Documentation

◆ OpNeumannPressureLhs_dx_dX()

NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::OpNeumannPressureLhs_dx_dX ( const string  field_name_1,
const string  field_name_2,
boost::shared_ptr< DataAtIntegrationPts data_at_pts,
Mat  aij,
bCPressure data,
bool  ho_geometry = false 
)
inline

Definition at line 307 of file SurfacePressure.hpp.

311  : UserDataOperator(field_name_1, field_name_2,
313  dataAtIntegrationPts(data_at_pts), Aij(aij), dAta(data),
314  hoGeometry(ho_geometry) {
315  sYmm = false; // This will make sure to loop over all entities
316  };

Member Function Documentation

◆ doWork()

MoFEMErrorCode NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)

Compute left-hand side.

Computes linearisation of the spatial component with respect to material coordinates.

Virtual work of the surface pressure corresponding to a test function of the spatial configuration \((\delta\mathbf{x})\):

\[ \delta W^\text{spatial}_p(\mathbf{X}, \delta\mathbf{x}) = \int\limits_\mathcal{T} p\,\mathbf{N}(\mathbf{X}) \cdot \delta\mathbf{x}\, \textrm{d}\mathcal{T} = \int\limits_{\mathcal{T}_{\xi}} p\left(\frac{\partial\mathbf{X}}{\partial\xi}\times\frac{\partial \mathbf{X}} {\partial\eta}\right) \cdot \delta\mathbf{x}\, \textrm{d}\xi\textrm{d}\eta, \]

where \(p\) is pressure, \(\mathbf{N}\) is a normal to the face in the material configuration and \(\xi, \eta\) are coordinates in the parent space \((\mathcal{T}_\xi)\).

Linearisation with respect to a variation of material coordinates \((\Delta\mathbf{X})\):

\[ \textrm{D} \delta W^\text{spatial}_p(\mathbf{X}, \delta\mathbf{x}) [\Delta\mathbf{X}] = \int\limits_{\mathcal{T}_{\xi}} p\left[ \frac{\partial\mathbf{X}}{\partial\xi} \cdot \left(\frac{\partial \Delta \mathbf{X}}{\partial\eta}\times\delta\mathbf{x}\right) -\frac{\partial\mathbf{X}} {\partial\eta} \cdot \left(\frac{\partial\Delta \mathbf{X}}{\partial\xi}\times \delta\mathbf{x}\right)\right] \textrm{d}\xi\textrm{d}\eta \]

Definition at line 265 of file SurfacePressure.cpp.

268  {
270 
271  if (dAta.tRis.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
272  dAta.tRis.end()) {
274  }
275 
276  const int row_nb_dofs = row_data.getIndices().size();
277  if (!row_nb_dofs)
279  const int col_nb_dofs = col_data.getIndices().size();
280  if (!col_nb_dofs)
282  const int nb_gauss_pts = row_data.getN().size1();
283 
284  int nb_base_fun_row = row_data.getFieldData().size() / 3;
285  int nb_base_fun_col = col_data.getFieldData().size() / 3;
286 
287  NN.resize(3 * nb_base_fun_row, 3 * nb_base_fun_col, false);
288  NN.clear();
289 
293 
294  auto get_tensor2 = [](MatrixDouble &m, const int r, const int c) {
296  &m(r + 0, c + 0), &m(r + 0, c + 1), &m(r + 0, c + 2), &m(r + 1, c + 0),
297  &m(r + 1, c + 1), &m(r + 1, c + 2), &m(r + 2, c + 0), &m(r + 2, c + 1),
298  &m(r + 2, c + 2));
299  };
300 
301  auto make_vec_der = [](auto t_N, auto t_1, auto t_2) {
306  t_n(i, j) = 0;
307  t_n(i, j) += FTensor::levi_civita(i, j, k) * t_2(k) * t_N(0);
308  t_n(i, j) -= FTensor::levi_civita(i, j, k) * t_1(k) * t_N(1);
309  return t_n;
310  };
311 
312  double lambda = 1;
313  if (auto arc_dof = dataAtIntegrationPts->arcLengthDof.lock()) {
314  lambda = arc_dof->getFieldData();
315  }
316 
317  auto t_w = getFTensor0IntegrationWeight();
318  auto t_1 = getFTensor1FromMat<3>(dataAtIntegrationPts->tangent1);
319  auto t_2 = getFTensor1FromMat<3>(dataAtIntegrationPts->tangent2);
320  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
321 
322  double val = 0.5 * t_w * lambda;
323 
324  auto t_N = col_data.getFTensor1DiffN<2>(gg, 0);
325 
326  int bbc = 0;
327  for (; bbc != nb_base_fun_col; ++bbc) {
328  auto t_base = row_data.getFTensor0N(gg, 0);
329 
330  int bbr = 0;
331  for (; bbr != nb_base_fun_row; ++bbr) {
332 
333  auto t_d_n = make_vec_der(t_N, t_1, t_2);
334 
335  auto t_assemble = get_tensor2(NN, 3 * bbr, 3 * bbc);
336 
337  // TODO: handle hoGeometry
338  t_assemble(i, k) += val * dAta.data.data.value1 * t_base * t_d_n(i, k);
339 
340  ++t_base;
341  }
342  ++t_N;
343  }
344  ++t_w;
345  ++t_1;
346  ++t_2;
347  }
348 
349  // get pointer to first global index on row
350  const int *row_indices = &*row_data.getIndices().data().begin();
351  // get pointer to first global index on column
352  const int *col_indices = &*col_data.getIndices().data().begin();
353 
354  Mat B = getFEMethod()->ksp_B != PETSC_NULL ? getFEMethod()->ksp_B
355  : getFEMethod()->snes_B;
356 
357  CHKERR MatSetValues(B, row_nb_dofs, row_indices, col_nb_dofs, col_indices,
358  &*NN.data().begin(), ADD_VALUES);
359 
361 }

Member Data Documentation

◆ Aij

Mat NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::Aij

Definition at line 262 of file SurfacePressure.hpp.

◆ dAta

bCPressure& NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::dAta

Definition at line 263 of file SurfacePressure.hpp.

◆ dataAtIntegrationPts

boost::shared_ptr<DataAtIntegrationPts> NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::dataAtIntegrationPts

Definition at line 261 of file SurfacePressure.hpp.

◆ hoGeometry

bool NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::hoGeometry

Definition at line 264 of file SurfacePressure.hpp.

◆ NN

MatrixDouble NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::NN

Definition at line 266 of file SurfacePressure.hpp.


The documentation for this struct was generated from the following files:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
MoFEM::MatSetValues
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
Definition: EntitiesFieldData.hpp:1631
MoFEM::KspMethod::ksp_B
Mat & ksp_B
Definition: LoopMethods.hpp:91
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
MoFEM::SnesMethod::snes_B
Mat & snes_B
preconditioner of jacobian matrix
Definition: LoopMethods.hpp:124
MoFEM::EntitiesFieldData::EntData::getFieldData
const VectorDouble & getFieldData() const
get dofs values
Definition: EntitiesFieldData.hpp:1241
FTensor::levi_civita
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
Definition: Levi_Civita.hpp:617
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROWCOL
@ OPROWCOL
operator doWork is executed on FE rows &columns
Definition: ForcesAndSourcesCore.hpp:569
sdf.r
int r
Definition: sdf.py:8
FTensor::Tensor2< double *, 3, 3 >
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFTensor0IntegrationWeight
auto getFTensor0IntegrationWeight()
Get integration weights.
Definition: ForcesAndSourcesCore.hpp:1239
MoFEM::EntitiesFieldData::EntData::getFTensor0N
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
Definition: EntitiesFieldData.hpp:1489
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEM::EntitiesFieldData::EntData::getIndices
const VectorInt & getIndices() const
Get global indices of dofs on entity.
Definition: EntitiesFieldData.hpp:1201
MoFEM::ForcesAndSourcesCore::UserDataOperator::getNumeredEntFiniteElementPtr
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
Definition: ForcesAndSourcesCore.hpp:999
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', 3 >
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEMethod
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
Definition: ForcesAndSourcesCore.hpp:1041
MoFEM::PressureCubitBcData::data
_data_ data
Definition: BCData.hpp:387
NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::dAta
bCPressure & dAta
Definition: SurfacePressure.hpp:263
NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::hoGeometry
bool hoGeometry
Definition: SurfacePressure.hpp:264
NeumannForcesSurface::bCPressure::tRis
Range tRis
Definition: SurfacePressure.hpp:93
MoFEM::EntitiesFieldData::EntData::getFTensor1DiffN
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
Definition: EntitiesFieldData.cpp:526
MoFEM::EntitiesFieldData::EntData::getN
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
Definition: EntitiesFieldData.hpp:1305
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
NeumannForcesSurface::bCPressure::data
PressureCubitBcData data
Definition: SurfacePressure.hpp:92
lambda
static double lambda
Definition: incompressible_elasticity.cpp:199
NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::dataAtIntegrationPts
boost::shared_ptr< DataAtIntegrationPts > dataAtIntegrationPts
Definition: SurfacePressure.hpp:261
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::NN
MatrixDouble NN
Definition: SurfacePressure.hpp:266
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
MoFEM::DataOperator::sYmm
bool sYmm
If true assume that matrix is symmetric structure.
Definition: DataOperators.hpp:82
NeumannForcesSurface::OpNeumannPressureLhs_dx_dX::Aij
Mat Aij
Definition: SurfacePressure.hpp:262
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
MoFEM::ForcesAndSourcesCore::UserDataOperator::UserDataOperator
UserDataOperator(const FieldSpace space, const char type=OPSPACE, const bool symm=true)
Definition: ForcesAndSourcesCore.cpp:1942