v0.14.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
MetaSpringBC::OpSpringFsMaterial Struct Reference

RHS-operator for the spring boundary condition element for ALE formulation. More...

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

Inheritance diagram for MetaSpringBC::OpSpringFsMaterial:
[legend]
Collaboration diagram for MetaSpringBC::OpSpringFsMaterial:
[legend]

Public Member Functions

MoFEMErrorCode doWork (int side, EntityType type, EntData &row_data)
 Operator for linear form, usually to calculate values on right hand side. More...
 
MoFEMErrorCode iNtegrate (EntData &row_data)
 Integrates and assembles to global RHS vector virtual work of springs on material positions for configurational changes for ALE formulation. More...
 
MoFEMErrorCode aSsemble (EntData &row_data)
 
 OpSpringFsMaterial (const string material_field, boost::shared_ptr< MetaSpringBC::DataAtIntegrationPtsSprings > data_at_pts, boost::shared_ptr< VolumeElementForcesAndSourcesCoreOnSide > side_fe, std::string &side_fe_name, MetaSpringBC::BlockOptionDataSprings &data)
 
- 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< MetaSpringBC::DataAtIntegrationPtsSpringsdataAtPts
 
boost::shared_ptr< VolumeElementForcesAndSourcesCoreOnSide > sideFe
 
std::string sideFeName
 
Vec F
 
MetaSpringBC::BlockOptionDataSpringsdAta
 
bool hoGeometry
 
VectorDouble nF
 
VectorInt rowIndices
 
int nbRows
 number of dofs on rows More...
 
int nbIntegrationPts
 number of integration points More...
 
- 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 []
 
virtual MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

RHS-operator for the spring boundary condition element for ALE formulation.

Integrates virtual work of springs on material positions involved in configurational changes and assembles components to RHS global vector.

Definition at line 715 of file SpringElement.hpp.

Constructor & Destructor Documentation

◆ OpSpringFsMaterial()

MetaSpringBC::OpSpringFsMaterial::OpSpringFsMaterial ( const string  material_field,
boost::shared_ptr< MetaSpringBC::DataAtIntegrationPtsSprings data_at_pts,
boost::shared_ptr< VolumeElementForcesAndSourcesCoreOnSide >  side_fe,
std::string &  side_fe_name,
MetaSpringBC::BlockOptionDataSprings data 
)
inline
Parameters
material_fieldString of field name for material positions for rows
data_at_ptsPointer to the common data for spring element
side_fePointer to the volume finite elements adjacent to the spring face element
side_fe_nameString of 3D element adjacent to the present springs elements
dataVariable containing data for normal and tangential stiffnesses of springs attached to the current element

Definition at line 788 of file SpringElement.hpp.

794 : UserDataOperator(material_field, UserDataOperator::OPROW),
795 dataAtPts(data_at_pts), sideFe(side_fe), sideFeName(side_fe_name),
796 dAta(data){};
ForcesAndSourcesCore::UserDataOperator UserDataOperator
MetaSpringBC::BlockOptionDataSprings & dAta
boost::shared_ptr< VolumeElementForcesAndSourcesCoreOnSide > sideFe
boost::shared_ptr< MetaSpringBC::DataAtIntegrationPtsSprings > dataAtPts

Member Function Documentation

◆ aSsemble()

MoFEMErrorCode MetaSpringBC::OpSpringFsMaterial::aSsemble ( EntData row_data)

Definition at line 1009 of file SpringElement.cpp.

1009 {
1011
1012 // get pointer to first global index on row
1013 const int *row_indices = &*row_data.getIndices().data().begin();
1014
1015 auto &data = *dataAtPts;
1016
1017 rowIndices.resize(nbRows, false);
1018 noalias(rowIndices) = row_data.getIndices();
1019 row_indices = &rowIndices[0];
1020 VectorDofs &dofs = row_data.getFieldDofs();
1021 VectorDofs::iterator dit = dofs.begin();
1022 for (int ii = 0; dit != dofs.end(); ++dit, ++ii) {
1023 if (data.forcesOnlyOnEntitiesRow.find((*dit)->getEnt()) ==
1024 data.forcesOnlyOnEntitiesRow.end()) {
1025 rowIndices[ii] = -1;
1026 }
1027 }
1028
1029 CHKERR VecSetOption(getSNESf(), VEC_IGNORE_NEGATIVE_INDICES, PETSC_TRUE);
1030 CHKERR VecSetValues(getSNESf(), nbRows, row_indices, &*nF.data().begin(),
1031 ADD_VALUES);
1032
1034}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Assemble PETSc vector.
ublas::vector< FEDofEntity *, DofsAllocator > VectorDofs
int nbRows
number of dofs on rows
const VectorDofs & getFieldDofs() const
get dofs data stature FEDofEntity
const VectorInt & getIndices() const
Get global indices of dofs on entity.

◆ doWork()

MoFEMErrorCode MetaSpringBC::OpSpringFsMaterial::doWork ( int  side,
EntityType  type,
EntData data 
)
virtual

Operator for linear form, usually to calculate values on right hand side.

Reimplemented from MoFEM::DataOperator.

Definition at line 887 of file SpringElement.cpp.

889 {
890
892
893 if (dAta.tRis.find(getNumeredEntFiniteElementPtr()->getEnt()) ==
894 dAta.tRis.end()) {
896 }
897
898 // get number of dofs on row
899 nbRows = row_data.getIndices().size();
900 // if no dofs on row, exit that work, nothing to do here
901 if (!nbRows)
903
904 nF.resize(nbRows, false);
905 nF.clear();
906
907 // get number of integration points
908 nbIntegrationPts = getGaussPts().size2();
909
910 // integrate local matrix for entity block
911 CHKERR iNtegrate(row_data);
912
913 // assemble local matrix
914 CHKERR aSsemble(row_data);
915
917}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
int nbIntegrationPts
number of integration points
MoFEMErrorCode aSsemble(EntData &row_data)
MoFEMErrorCode iNtegrate(EntData &row_data)
Integrates and assembles to global RHS vector virtual work of springs on material positions for confi...
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element

◆ iNtegrate()

MoFEMErrorCode MetaSpringBC::OpSpringFsMaterial::iNtegrate ( EntData row_data)

Integrates and assembles to global RHS vector virtual work of springs on material positions for configurational changes for ALE formulation.

Computes virtual work of springs on material positions for configurational changes:

\[ f_s ({\mathbf x}, {\mathbf X}, \delta \mathbf{X}) = -\int\limits_{\partial \Omega }^{} {{\delta \mathbf{X}^T} \cdot {\mathbf{F}^{\intercal}} \left[ k_{\rm n} \left( {\mathbf N} \otimes {\mathbf N} \right) + k_{\rm t} \left( {\mathbf I} - {\mathbf N} \otimes {\mathbf N} \right) \right] \left( {\mathbf x} - {\mathbf X} \right) \partial \Omega } \]

where \( \delta \mathbf{X} \) is material position variation, \( k_{\rm n} \) is the stiffness of the springs normal to the surface, \( k_{\rm t} \) is the stiffness of the springs tangential to the surface, \( {\mathbf N} \) is the normal to the surface vector based on material positions, \( {\mathbf x} \) is the vector of spatial positions or displacements of the surface with springs, \( {\mathbf X} \) is the vector of material positions and finally \(\mathbf{F}\) is the deformation gradient

\[ \mathbf{F} = \mathbf{h}(\mathbf{x})\,\mathbf{H}(\mathbf{X})^{-1} = \frac{\partial\mathbf{x}}{\partial\boldsymbol{\chi}} \frac{\partial\boldsymbol{\chi}}{\partial\mathbf{X}} \]

where \(\mathbf{h}\) and \(\mathbf{H}\) are the gradients of the spatial and material maps, respectively, and \(\boldsymbol{\chi}\) are the reference coordinates.

Definition at line 919 of file SpringElement.cpp.

919 {
921
923
924 // check that the faces have associated degrees of freedom
925 const int nb_dofs = data.getIndices().size();
926 if (nb_dofs == 0)
928
929 CHKERR dataAtPts->getBlockData(dAta);
930
931 // get integration weights
932 auto t_w = getFTensor0IntegrationWeight();
933
934 // FTensor indices
938
939 const double normal_stiffness = dataAtPts->springStiffnessNormal;
940 const double tangent_stiffness = dataAtPts->springStiffnessTangent;
941
942 // create a 3d vector to be used as the normal to the face with length equal
943 // to the face area
945 FTensor::Tensor2<double, 3, 3> t_normal_projection;
946 FTensor::Tensor2<double, 3, 3> t_tangent_projection;
947
948 // Extract solution at Gauss points
949 auto t_solution_at_gauss_point = getFTensor1FromMat<3>(*dataAtPts->xAtPts);
950 auto t_init_solution_at_gauss_point =
951 getFTensor1FromMat<3>(*dataAtPts->xInitAtPts);
952 FTensor::Tensor1<double, 3> t_displacement_at_gauss_point;
953
954 auto t_normal_1 = getFTensor1FromMat<3>(dataAtPts->normalVector);
955
956 auto t_F = getFTensor2FromMat<3, 3>(*dataAtPts->FMat);
957
958 // loop over all Gauss points of the face
959 for (int gg = 0; gg != nbIntegrationPts; ++gg) {
960 t_normal(i) = t_normal_1(i);
961
962 const double normal_length = std::sqrt(t_normal(k) * t_normal(k));
963 t_normal(i) = t_normal(i) / normal_length;
964 t_normal_projection(i, j) = t_normal(i) * t_normal(j);
965 t_tangent_projection(i, j) = t_normal_projection(i, j);
966 t_tangent_projection(0, 0) -= 1;
967 t_tangent_projection(1, 1) -= 1;
968 t_tangent_projection(2, 2) -= 1;
969 // Calculate the displacement at the Gauss point
970 t_displacement_at_gauss_point(i) =
971 t_solution_at_gauss_point(i) - t_init_solution_at_gauss_point(i);
972
973 double w = t_w * 0.5 * normal_length; // area was constant
974
975 auto t_base_func = data.getFTensor0N(gg, 0);
976
977 // create a vector t_nf whose pointer points an array of 3 pointers
978 // pointing to nF memory location of components
980 &nF[2]);
981
982 for (int rr = 0; rr != nb_dofs / 3; ++rr) { // loop over the nodes
983
984 t_nf(i) -= w * t_base_func * normal_stiffness * t_F(k, i) *
985 t_normal_projection(k, j) * t_displacement_at_gauss_point(j);
986 t_nf(i) += w * t_base_func * tangent_stiffness * t_F(k, i) *
987 t_tangent_projection(k, j) * t_displacement_at_gauss_point(j);
988
989 // move to next base function
990 ++t_base_func;
991 // move the pointer to next element of t_nf
992 ++t_nf;
993 }
994 // move to next integration weight
995 ++t_w;
996 // move to the solutions at the next Gauss point
997 ++t_solution_at_gauss_point;
998 ++t_init_solution_at_gauss_point;
999 ++t_normal_1;
1000 ++t_F;
1001 }
1002 // add computed values of spring in the global right hand side vector
1003 // Vec f = getFEMethod()->ksp_f != PETSC_NULL ? getFEMethod()->ksp_f
1004 // : getFEMethod()->snes_f;
1005 // CHKERR VecSetValues(f, nb_dofs, &data.getIndices()[0], &nF[0], ADD_VALUES);
1007}
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
double w(const double g, const double t)
MoFEMErrorCode loopSideVolumes(const string fe_name, VolumeElementForcesAndSourcesCoreOnSide &fe_method)
auto getFTensor0IntegrationWeight()
Get integration weights.

Member Data Documentation

◆ dAta

MetaSpringBC::BlockOptionDataSprings& MetaSpringBC::OpSpringFsMaterial::dAta

Definition at line 722 of file SpringElement.hpp.

◆ dataAtPts

boost::shared_ptr<MetaSpringBC::DataAtIntegrationPtsSprings> MetaSpringBC::OpSpringFsMaterial::dataAtPts

Definition at line 718 of file SpringElement.hpp.

◆ F

Vec MetaSpringBC::OpSpringFsMaterial::F

Definition at line 721 of file SpringElement.hpp.

◆ hoGeometry

bool MetaSpringBC::OpSpringFsMaterial::hoGeometry

Definition at line 723 of file SpringElement.hpp.

◆ nbIntegrationPts

int MetaSpringBC::OpSpringFsMaterial::nbIntegrationPts

number of integration points

Definition at line 730 of file SpringElement.hpp.

◆ nbRows

int MetaSpringBC::OpSpringFsMaterial::nbRows

number of dofs on rows

Definition at line 729 of file SpringElement.hpp.

◆ nF

VectorDouble MetaSpringBC::OpSpringFsMaterial::nF

Definition at line 725 of file SpringElement.hpp.

◆ rowIndices

VectorInt MetaSpringBC::OpSpringFsMaterial::rowIndices

Definition at line 727 of file SpringElement.hpp.

◆ sideFe

boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnSide> MetaSpringBC::OpSpringFsMaterial::sideFe

Definition at line 719 of file SpringElement.hpp.

◆ sideFeName

std::string MetaSpringBC::OpSpringFsMaterial::sideFeName

Definition at line 720 of file SpringElement.hpp.


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