v0.15.5
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Smoother::OpJacobianSmoother Struct Reference

#include "tools/src/Smoother.hpp"

Inheritance diagram for Smoother::OpJacobianSmoother:
[legend]
Collaboration diagram for Smoother::OpJacobianSmoother:
[legend]

Public Member Functions

 OpJacobianSmoother (const std::string field_name, BlockData &data, CommonData &common_data, int tag, bool jacobian)
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 
 OpJacobianSmoother (const std::string field_name, NonlinearElasticElement::BlockData &data, NonlinearElasticElement::CommonData &common_data, int tag, bool jacobian)
 
MoFEMErrorCode calculateStress (const int gg)
 Calculate Paola-Kirchhoff I stress.
 
- Public Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
int getNumNodes ()
 get element number of nodes
 
const EntityHandlegetConn ()
 get element connectivity
 
double getVolume () const
 element volume (linear geometry)
 
doublegetVolume ()
 element volume (linear geometry)
 
FTensor::Tensor2< double *, 3, 3 > & getJac ()
 get element Jacobian
 
FTensor::Tensor2< double *, 3, 3 > & getInvJac ()
 get element inverse Jacobian
 
VectorDoublegetCoords ()
 nodal coordinates
 
VolumeElementForcesAndSourcesCoregetVolumeFE () const
 return pointer to Generic Volume Finite Element object
 
- Public Member Functions inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
 UserDataOperator (const FieldSpace space, const char type=OPSPACE, const bool symm=true)
 Constructor for operators working on finite element spaces.
 
 UserDataOperator (const std::string field_name, const char type, const bool symm=true)
 Constructor for operators working on a single field.
 
 UserDataOperator (const std::string row_field_name, const std::string col_field_name, const char type, const bool symm=true)
 Constructor for operators working on two fields (bilinear forms)
 
boost::shared_ptr< const NumeredEntFiniteElementgetNumeredEntFiniteElementPtr () const
 Return raw pointer to NumeredEntFiniteElement.
 
EntityHandle getFEEntityHandle () const
 Return finite element entity handle.
 
int getFEDim () const
 Get dimension of finite element.
 
EntityType getFEType () const
 Get dimension of finite element.
 
boost::weak_ptr< SideNumbergetSideNumberPtr (const int side_number, const EntityType type)
 Get the side number pointer.
 
EntityHandle getSideEntity (const int side_number, const EntityType type)
 Get the side entity.
 
int getNumberOfNodesOnElement () const
 Get the number of nodes on finite element.
 
MoFEMErrorCode getProblemRowIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get row indices.
 
MoFEMErrorCode getProblemColIndices (const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
 Get col indices.
 
const FEMethodgetFEMethod () const
 Return raw pointer to Finite Element Method object.
 
int getOpType () const
 Get operator types.
 
void setOpType (const OpType type)
 Set operator type.
 
void addOpType (const OpType type)
 Add operator type.
 
int getNinTheLoop () const
 get number of finite element in the loop
 
int getLoopSize () const
 get size of elements in the loop
 
std::string getFEName () const
 Get name of the element.
 
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
 
auto getFTensor0IntegrationWeight ()
 Get integration weights.
 
MatrixDoublegetCoordsAtGaussPts ()
 Gauss points and weight, matrix (nb. of points x 3)
 
auto getFTensor1CoordsAtGaussPts ()
 Get coordinates at integration points assuming linear geometry.
 
double getMeasure () const
 get measure of element
 
doublegetMeasure ()
 get measure of element
 
MoFEM::InterfacegetMField ()
 
moab::Interface & getMoab ()
 
virtual boost::weak_ptr< ForcesAndSourcesCoregetSubPipelinePtr () const
 
MoFEMErrorCode loopSide (const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, boost::shared_ptr< Range > fe_range=nullptr, 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.
 
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.
 
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.
 
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.
 
MoFEMErrorCode loopRange (const string &fe_name, ForcesAndSourcesCore *range_fe, boost::shared_ptr< Range > fe_range, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
 Iterate over range of elements.
 
- 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.
 
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.
 
virtual MoFEMErrorCode opRhs (EntitiesFieldData &data, const bool error_if_no_base=false)
 
bool getSymm () const
 Get if operator uses symmetry of DOFs or not.
 
void setSymm ()
 set if operator is executed taking in account symmetry
 
void unSetSymm ()
 unset if operator is executed for non symmetric problem
 
- Public Member Functions inherited from NonlinearElasticElement::OpJacobianPiolaKirchhoffStress
 OpJacobianPiolaKirchhoffStress (const std::string field_name, BlockData &data, CommonData &common_data, int tag, bool jacobian, bool ale, bool field_disp)
 Construct operator to calculate Piola-Kirchhoff stress or its derivatives over gradient deformation.
 
virtual MoFEMErrorCode recordTag (const int gg)
 Record ADOL-C tape.
 
virtual MoFEMErrorCode playTag (const int gg)
 Play ADOL-C tape.
 
virtual bool recordTagForIntegrationPoint (const int gg)
 Cgeck if tape is recorded for given integration point.
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
 Calculate stress or jacobian at gauss points.
 

Public Attributes

BlockDatadAta
 
CommonDatacommonData
 
const int tag
 
const bool computeJacobian
 
VectorDouble activeVars
 
VectorDouble results
 
MatrixDouble jacMat
 
- 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.
 
std::array< bool, MBMAXTYPE > doEntities
 If true operator is executed for entity.
 
booldoVertices
 \deprectaed If false skip vertices
 
booldoEdges
 \deprectaed If false skip edges
 
booldoQuads
 \deprectaed
 
booldoTris
 \deprectaed
 
booldoTets
 \deprectaed
 
booldoPrisms
 \deprectaed
 
- Public Attributes inherited from NonlinearElasticElement::OpJacobianPiolaKirchhoffStress
BlockDatadAta
 
CommonDatacommonData
 
int tAg
 
int adlocReturnValue
 
bool jAcobian
 if true Jacobian is calculated
 
bool fUnction
 if true stress i calculated
 
bool aLe
 true if arbitrary Lagrangian-Eulerian formulation
 
bool fieldDisp
 
VectorDouble activeVariables
 
int nbActiveVariables
 
std::vector< MatrixDouble > * ptrh
 
std::vector< MatrixDouble > * ptrH
 
FTensor::Index< 'i', 3 > i
 
FTensor::Index< 'j', 3 > j
 
FTensor::Index< 'k', 3 > k
 

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 Member Functions inherited from MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator
MoFEMErrorCode setPtrFE (ForcesAndSourcesCore *ptr)
 
- Protected Attributes inherited from MoFEM::ForcesAndSourcesCore::UserDataOperator
ForcesAndSourcesCoreptrFE
 

Detailed Description

Definition at line 289 of file Smoother.hpp.

Constructor & Destructor Documentation

◆ OpJacobianSmoother() [1/2]

Smoother::OpJacobianSmoother::OpJacobianSmoother ( const std::string  field_name,
BlockData data,
CommonData common_data,
int  tag,
bool  jacobian 
)
inline

Definition at line 300 of file Smoother.hpp.

302 : DomainEleOp(field_name, UserDataOperator::OPROW), dAta(data),
303 commonData(common_data), tag(tag), computeJacobian(jacobian) {
304 std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE], false);
305 }
constexpr auto field_name
std::array< bool, MBMAXTYPE > doEntities
If true operator is executed for entity.
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator DomainEleOp
Definition Smoother.hpp:197

◆ OpJacobianSmoother() [2/2]

Smoother::OpJacobianSmoother::OpJacobianSmoother ( const std::string  field_name,
NonlinearElasticElement::BlockData data,
NonlinearElasticElement::CommonData common_data,
int  tag,
bool  jacobian 
)
inline

Definition at line 134 of file Smoother.hpp.

139 field_name, data, common_data, tag, jacobian, false, false) {}

Member Function Documentation

◆ calculateStress()

MoFEMErrorCode Smoother::OpJacobianSmoother::calculateStress ( const int  gg)
inlinevirtual

Calculate Paola-Kirchhoff I stress.

Returns
error code

Reimplemented from NonlinearElasticElement::OpJacobianPiolaKirchhoffStress.

Definition at line 141 of file Smoother.hpp.

141 {
143
144 CHKERR dAta.materialAdoublePtr->calculateP_PiolaKirchhoffI(
146
147 commonData.sTress[gg].resize(3, 3, false);
148 for (int dd1 = 0; dd1 < 3; dd1++) {
149 for (int dd2 = 0; dd2 < 3; dd2++) {
150 dAta.materialAdoublePtr->P(dd1, dd2) >>=
151 (commonData.sTress[gg])(dd1, dd2);
152 }
153 }
154
156 }
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
boost::shared_ptr< CalculatePK1< adouble > > materialAdoublePtr
Definition Smoother.hpp:225
std::vector< MatrixDouble > sTress
Definition Smoother.hpp:211

◆ doWork()

MoFEMErrorCode Smoother::OpJacobianSmoother::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData &  data 
)
inline

Definition at line 307 of file Smoother.hpp.

308 {
310
311 if (type != MBVERTEX)
313
314 const auto nb_gauss_pts = getGaussPts().size2();
315 auto &mat_grad = *commonData.matGradPtr;
316 if (mat_grad.size2() != nb_gauss_pts)
318
319 auto t_grad = getFTensor2FromMat<3, 3>(mat_grad);
320
321 FTensor::Index<'i', 3> i;
322 FTensor::Index<'j', 3> j;
323 FTensor::Index<'k', 3> k;
324 FTensor::Index<'l', 3> l;
325
326 if (!computeJacobian) {
327 auto &mat_p = *commonData.matFirstPiolaStressPtr;
328 mat_p.resize(9, nb_gauss_pts, false);
329 mat_p.clear();
330 auto t_p = getFTensor2FromMat<3, 3>(mat_p);
331 if (!dAta.materialDoublePtr) {
332 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
333 "Material pointer not set");
334 }
335 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
336 dAta.materialDoublePtr->opPtr = this;
337 dAta.materialDoublePtr->gG = gg;
338 for (int ii = 0; ii < 3; ++ii) {
339 for (int jj = 0; jj < 3; ++jj) {
340 dAta.materialDoublePtr->F(ii, jj) = t_grad(ii, jj);
341 }
342 }
343
344 CHKERR dAta.materialDoublePtr->calculateP_PiolaKirchhoffI();
345 for (int ii = 0; ii < 3; ++ii)
346 for (int jj = 0; jj < 3; ++jj)
347 t_p(ii, jj) = dAta.materialDoublePtr->P(ii, jj);
348
349 ++t_grad;
350 ++t_p;
351 }
353 }
354
356 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
357 "AD material pointer not set");
358 }
359
360 MatrixDouble &mat_tangent = *commonData.matTangentPtr;
361 mat_tangent.resize(81, nb_gauss_pts, false);
362 mat_tangent.clear();
363 auto t_dP_dF = getFTensor4FromMat<3, 3, 3, 3, 1>(mat_tangent);
364
365 activeVars.resize(9, false);
366 results.resize(9, false);
367 jacMat.resize(9, 9, false);
368
369 bool tag_recorded = false;
370 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
371 int idx = 0;
372 for (int ii = 0; ii < 3; ++ii) {
373 for (int jj = 0; jj < 3; ++jj) {
374 activeVars[idx++] = t_grad(ii, jj);
375 }
376 }
377
378 if (!tag_recorded) {
379 trace_on(tag);
380 idx = 0;
381 dAta.materialAdoublePtr->opPtr = this;
382 dAta.materialAdoublePtr->gG = gg;
383 for (int ii = 0; ii < 3; ++ii) {
384 for (int jj = 0; jj < 3; ++jj) {
385 dAta.materialAdoublePtr->F(ii, jj) <<= activeVars[idx++];
386 }
387 }
388 CHKERR dAta.materialAdoublePtr->calculateP_PiolaKirchhoffI();
389 idx = 0;
390 for (int ii = 0; ii < 3; ++ii) {
391 for (int jj = 0; jj < 3; ++jj) {
392 dAta.materialAdoublePtr->P(ii, jj) >>= results[idx++];
393 }
394 }
395 trace_off();
396 tag_recorded = true;
397 }
398
399 double *jac_ptr[9];
400 for (int rr = 0; rr < 9; ++rr)
401 jac_ptr[rr] = &jacMat(rr, 0);
402
403 int r = ::jacobian(tag, 9, 9, &activeVars[0], jac_ptr);
404 if (r < 0)
405 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
406 "ADOL-C function evaluation with error");
407
408 for (int ii = 0; ii < 3; ++ii) {
409 for (int jj = 0; jj < 3; ++jj) {
410 for (int kk = 0; kk < 3; ++kk) {
411 for (int ll = 0; ll < 3; ++ll) {
412 t_dP_dF(ii, jj, kk, ll) =
413 jacMat(ii * 3 + jj, kk * 3 + ll);
414 }
415 }
416 }
417 }
418
419 ++t_grad;
420 ++t_dP_dF;
421 }
422
424 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
FTensor::Index< 'l', 3 > l
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
int r
Definition sdf.py:205
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
boost::shared_ptr< CalculatePK1< double > > materialDoublePtr
Definition Smoother.hpp:227
boost::shared_ptr< MatrixDouble > matTangentPtr
Definition Smoother.hpp:208
boost::shared_ptr< MatrixDouble > matFirstPiolaStressPtr
Definition Smoother.hpp:207
boost::shared_ptr< MatrixDouble > matGradPtr
Definition Smoother.hpp:206

Member Data Documentation

◆ activeVars

VectorDouble Smoother::OpJacobianSmoother::activeVars

Definition at line 296 of file Smoother.hpp.

◆ commonData

CommonData& Smoother::OpJacobianSmoother::commonData

Definition at line 293 of file Smoother.hpp.

◆ computeJacobian

const bool Smoother::OpJacobianSmoother::computeJacobian

Definition at line 295 of file Smoother.hpp.

◆ dAta

BlockData& Smoother::OpJacobianSmoother::dAta

Definition at line 292 of file Smoother.hpp.

◆ jacMat

MatrixDouble Smoother::OpJacobianSmoother::jacMat

Definition at line 298 of file Smoother.hpp.

◆ results

VectorDouble Smoother::OpJacobianSmoother::results

Definition at line 297 of file Smoother.hpp.

◆ tag

const int Smoother::OpJacobianSmoother::tag

Definition at line 294 of file Smoother.hpp.


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