v0.14.0
Public Member Functions | Public Attributes | List of all members
ConvectiveMassElement::OpEnergy Struct Reference

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

Inheritance diagram for ConvectiveMassElement::OpEnergy:
[legend]
Collaboration diagram for ConvectiveMassElement::OpEnergy:
[legend]

Public Member Functions

 OpEnergy (const std::string field_name, BlockData &data, CommonData &common_data, SmartPetscObj< Vec > v)
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
 

Public Attributes

BlockDatadAta
 
CommonDatacommonData
 
SmartPetscObj< Vec > V
 
boollInear
 
MatrixDouble3by3 h
 
MatrixDouble3by3 H
 
MatrixDouble3by3 invH
 
MatrixDouble3by3 F
 
VectorDouble3 v
 

Detailed Description

Definition at line 261 of file ConvectiveMassElement.hpp.

Constructor & Destructor Documentation

◆ OpEnergy()

ConvectiveMassElement::OpEnergy::OpEnergy ( const std::string  field_name,
BlockData data,
CommonData common_data,
SmartPetscObj< Vec >  v 
)

Definition at line 727 of file ConvectiveMassElement.cpp.

732  field_name, ForcesAndSourcesCore::UserDataOperator::OPROW),
733  dAta(data), commonData(common_data), V(v, true),

Member Function Documentation

◆ doWork()

MoFEMErrorCode ConvectiveMassElement::OpEnergy::doWork ( int  row_side,
EntityType  row_type,
EntitiesFieldData::EntData row_data 
)

Definition at line 737 of file ConvectiveMassElement.cpp.

738  {
740 
741  if (row_type != MBVERTEX) {
743  }
744  if (dAta.tEts.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
745  dAta.tEts.end()) {
747  }
748 
749  {
750  double energy = 0;
751  for (unsigned int gg = 0; gg < row_data.getN().size1(); gg++) {
752  double val = getVolume() * getGaussPts()(3, gg);
753  double rho0 = dAta.rho0;
754  double rho;
755  if (lInear) {
756  rho = rho0;
757  } else {
758  h.resize(3, 3);
759  noalias(h) =
762  .size() > 0) {
763  H.resize(3, 3);
764  noalias(H) =
766  auto detH = determinantTensor3by3(H);
767  invH.resize(3, 3);
768  CHKERR invertTensor3by3(H, detH, invH);
769  F.resize(3, 3);
770  noalias(F) = prod(h, invH);
771  } else {
772  F.resize(3, 3);
773  noalias(F) = h;
774  }
775  double detF = determinantTensor3by3(F);
776  rho = detF * rho0;
777  }
778  v.resize(3);
780  energy += 0.5 * (rho * val) * inner_prod(v, v);
781  }
782  CHKERR VecSetValue(V, 0, energy, ADD_VALUES);
783  }
784 
786 }

Member Data Documentation

◆ commonData

CommonData& ConvectiveMassElement::OpEnergy::commonData

Definition at line 265 of file ConvectiveMassElement.hpp.

◆ dAta

BlockData& ConvectiveMassElement::OpEnergy::dAta

Definition at line 264 of file ConvectiveMassElement.hpp.

◆ F

MatrixDouble3by3 ConvectiveMassElement::OpEnergy::F

Definition at line 272 of file ConvectiveMassElement.hpp.

◆ h

MatrixDouble3by3 ConvectiveMassElement::OpEnergy::h

Definition at line 272 of file ConvectiveMassElement.hpp.

◆ H

MatrixDouble3by3 ConvectiveMassElement::OpEnergy::H

Definition at line 272 of file ConvectiveMassElement.hpp.

◆ invH

MatrixDouble3by3 ConvectiveMassElement::OpEnergy::invH

Definition at line 272 of file ConvectiveMassElement.hpp.

◆ lInear

bool& ConvectiveMassElement::OpEnergy::lInear

Definition at line 267 of file ConvectiveMassElement.hpp.

◆ V

SmartPetscObj<Vec> ConvectiveMassElement::OpEnergy::V

Definition at line 266 of file ConvectiveMassElement.hpp.

◆ v

VectorDouble3 ConvectiveMassElement::OpEnergy::v

Definition at line 273 of file ConvectiveMassElement.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:460
ConvectiveMassElement::OpEnergy::F
MatrixDouble3by3 F
Definition: ConvectiveMassElement.hpp:272
ConvectiveMassElement::OpEnergy::dAta
BlockData & dAta
Definition: ConvectiveMassElement.hpp:264
ConvectiveMassElement::OpEnergy::lInear
bool & lInear
Definition: ConvectiveMassElement.hpp:267
rho
double rho
Definition: plastic.cpp:140
ConvectiveMassElement::OpEnergy::commonData
CommonData & commonData
Definition: ConvectiveMassElement.hpp:265
ConvectiveMassElement::BlockData::tEts
Range tEts
elements in block set
Definition: ConvectiveMassElement.hpp:119
ConvectiveMassElement::CommonData::spatialVelocities
string spatialVelocities
Definition: ConvectiveMassElement.hpp:137
ConvectiveMassElement::CommonData::dataAtGaussPts
std::map< std::string, std::vector< VectorDouble > > dataAtGaussPts
Definition: ConvectiveMassElement.hpp:133
ConvectiveMassElement::OpEnergy::v
VectorDouble3 v
Definition: ConvectiveMassElement.hpp:273
MoFEM::invertTensor3by3
MoFEMErrorCode invertTensor3by3(ublas::matrix< T, L, A > &jac_data, ublas::vector< T, A > &det_data, ublas::matrix< T, L, A > &inv_jac_data)
Calculate inverse of tensor rank 2 at integration points.
Definition: Templates.hpp:1588
ConvectiveMassElement::CommonData::gradAtGaussPts
std::map< std::string, std::vector< MatrixDouble > > gradAtGaussPts
Definition: ConvectiveMassElement.hpp:134
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
ConvectiveMassElement::OpEnergy::V
SmartPetscObj< Vec > V
Definition: ConvectiveMassElement.hpp:266
ConvectiveMassElement::OpEnergy::H
MatrixDouble3by3 H
Definition: ConvectiveMassElement.hpp:272
ConvectiveMassElement::CommonData::spatialPositions
string spatialPositions
Definition: ConvectiveMassElement.hpp:135
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
ConvectiveMassElement::CommonData::lInear
bool lInear
Definition: ConvectiveMassElement.hpp:129
ConvectiveMassElement::BlockData::rho0
double rho0
reference density
Definition: ConvectiveMassElement.hpp:117
MoFEM::determinantTensor3by3
static auto determinantTensor3by3(T &t)
Calculate the determinant of a 3x3 matrix or a tensor of rank 2.
Definition: Templates.hpp:1540
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:1318
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
ConvectiveMassElement::OpEnergy::h
MatrixDouble3by3 h
Definition: ConvectiveMassElement.hpp:272
ConvectiveMassElement::CommonData::meshPositions
string meshPositions
Definition: ConvectiveMassElement.hpp:136
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
ConvectiveMassElement::OpEnergy::invH
MatrixDouble3by3 invH
Definition: ConvectiveMassElement.hpp:272