v0.13.2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
OpElasticTools::OpInternalForceRhs< LOGSTRAIN, REACTIONS > Struct Template Reference

#include <users_modules/multifield_plasticity/src/ElasticOperators.hpp>

Inheritance diagram for OpElasticTools::OpInternalForceRhs< LOGSTRAIN, REACTIONS >:
[legend]
Collaboration diagram for OpElasticTools::OpInternalForceRhs< LOGSTRAIN, REACTIONS >:
[legend]

Public Member Functions

 OpInternalForceRhs (const std::string field_name, boost::shared_ptr< CommonData > common_data_ptr)
 [Calculate stress] More...
 
MoFEMErrorCode iNtegrate (EntData &data)
 [Internal force] More...
 
MoFEMErrorCode aSsemble (EntData &data)
 

Private Attributes

boost::shared_ptr< CommonDatacommonDataPtr
 

Detailed Description

template<bool LOGSTRAIN, bool REACTIONS>
struct OpElasticTools::OpInternalForceRhs< LOGSTRAIN, REACTIONS >

Definition at line 889 of file ElasticOperators.hpp.

Constructor & Destructor Documentation

◆ OpInternalForceRhs()

template<bool LOGSTRAIN, bool REACTIONS>
OpElasticTools::OpInternalForceRhs< LOGSTRAIN, REACTIONS >::OpInternalForceRhs ( const std::string  field_name,
boost::shared_ptr< CommonData common_data_ptr 
)

[Calculate stress]

Definition at line 392 of file ElasticOperators.cpp.

395 commonDataPtr(common_data_ptr) {}
FormsIntegrators< DomainEleOp >::Assembly< USER_ASSEMBLE >::OpBase DomainEleOpAssembly
constexpr auto field_name
@ OPROW
operator doWork function is executed on FE rows
boost::shared_ptr< CommonData > commonDataPtr

Member Function Documentation

◆ aSsemble()

template<bool LOGSTRAIN, bool REACTIONS>
MoFEMErrorCode OpElasticTools::OpInternalForceRhs< LOGSTRAIN, REACTIONS >::aSsemble ( EntData data)

Definition at line 449 of file ElasticOperators.cpp.

449 {
451 if (REACTIONS) {
452 auto react_ents = commonDataPtr->reactionEnts;
453 EntityHandle ent = getFEEntityHandle();
454
455 auto &vec = commonDataPtr->reactionsVec;
456 double *react_ptr;
457 CHKERR VecGetArray(vec, &react_ptr);
458
459 int rank = data.getFieldDofs()[0]->getNbOfCoeffs();
460 int ii = 0;
461 for (auto &dof : data.getFieldDofs()) {
462 auto ent = dof->getEnt();
463 double tag_val[rank];
464 auto idx = dof->getDofCoeffIdx();
465 auto &m_field = getPtrFE()->mField;
466 CHKERR m_field.get_moab().tag_get_data(commonDataPtr->reactionTag, &ent,
467 1, tag_val);
468 if (dof->getEntType() == MBVERTEX) {
469 const double react = this->locF(ii) / (*cache).young_modulus_inv;
470 tag_val[idx] += react;
471 if (react_ents.find(ent) != react_ents.end())
472 react_ptr[idx] += react;
473 }
474 ii++;
475 CHKERR m_field.get_moab().tag_set_data(commonDataPtr->reactionTag, &ent,
476 1, &tag_val);
477 }
478 CHKERR VecRestoreArray(vec, &react_ptr);
479 } else
481 this->getKSPf(), data, &*this->locF.data().begin(), ADD_VALUES);
482
484}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define CHKERR
Inline error check.
Definition: definitions.h:535
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
MoFEMErrorCode VecSetValues< EssentialBcStorage >(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Set values to vector in operator.
const VectorDofs & getFieldDofs() const
get dofs data stature FEDofEntity

◆ iNtegrate()

template<bool LOGSTRAIN, bool REACTIONS>
MoFEMErrorCode OpElasticTools::OpInternalForceRhs< LOGSTRAIN, REACTIONS >::iNtegrate ( EntData data)

[Internal force]

Definition at line 400 of file ElasticOperators.cpp.

400 {
402
403 const size_t nb_dofs = data.getIndices().size();
404 if (nb_dofs) {
405
406 const size_t nb_base_functions = data.getN().size2();
407 if (3 * nb_base_functions < nb_dofs)
408 SETERRQ(
409 PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
410 "Number of DOFs is larger than number of base functions on entity");
411
412 const size_t nb_gauss_pts = data.getN().size1();
413
414 auto t_w = getFTensor0IntegrationWeight();
415 auto t_stress =
416 getFTensor2SymmetricFromMat<3>(*(commonDataPtr->mStressPtr));
417 auto t_piola = getFTensor2FromMat<3, 3>(*(commonDataPtr->mPiolaStressPtr));
418 auto t_diff_base = data.getFTensor1DiffN<3>();
419
420 for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
421
422 double alpha = getMeasure() * t_w;
423 auto t_nf = getFTensor1FromArray<3, 3>(locF);
424 auto out_stress = to_non_symm(t_stress);
425
426 if (LOGSTRAIN) {
427 out_stress(i, j) = t_piola(i, j);
428 ++t_piola;
429 }
430
431 size_t bb = 0;
432 for (; bb != nb_dofs / 3; ++bb) {
433 t_nf(i) += alpha * t_diff_base(j) * out_stress(i, j);
434 ++t_diff_base;
435 ++t_nf;
436 }
437 for (; bb < nb_base_functions; ++bb)
438 ++t_diff_base;
439
440 ++t_stress;
441 ++t_w;
442 }
443 }
445}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
auto to_non_symm(T &symm)
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorInt & getIndices() const
Get global indices of dofs on entity.

Member Data Documentation

◆ commonDataPtr

template<bool LOGSTRAIN, bool REACTIONS>
boost::shared_ptr<CommonData> OpElasticTools::OpInternalForceRhs< LOGSTRAIN, REACTIONS >::commonDataPtr
private

Definition at line 896 of file ElasticOperators.hpp.


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