v0.10.0
Public Member Functions | Private Attributes | List of all members
OpElasticTools::OpCentrifugalForce Struct Reference

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

Inheritance diagram for OpElasticTools::OpCentrifugalForce:
[legend]
Collaboration diagram for OpElasticTools::OpCentrifugalForce:
[legend]

Public Member Functions

 OpCentrifugalForce (const std::string field_name, boost::shared_ptr< CommonData > common_data_ptr)
 
MoFEMErrorCode doWork (int side, EntityType type, EntData &data)
 [Body force] More...
 

Private Attributes

boost::shared_ptr< CommonDatacommonDataPtr
 

Detailed Description

Definition at line 868 of file ElasticOperators.hpp.

Constructor & Destructor Documentation

◆ OpCentrifugalForce()

OpElasticTools::OpCentrifugalForce::OpCentrifugalForce ( const std::string  field_name,
boost::shared_ptr< CommonData common_data_ptr 
)

Definition at line 764 of file ElasticOperators.cpp.

766  : DomainEleOp(field_name, DomainEleOp::OPROW),
767  commonDataPtr(common_data_ptr) {}
boost::shared_ptr< CommonData > commonDataPtr
DomainEle::UserDataOperator DomainEleOp

Member Function Documentation

◆ doWork()

MoFEMErrorCode OpElasticTools::OpCentrifugalForce::doWork ( int  side,
EntityType  type,
EntData data 
)

[Body force]

Definition at line 770 of file ElasticOperators.cpp.

771  {
773 
774  const size_t nb_dofs = data.getIndices().size();
775  if (nb_dofs) {
776 
777  const size_t nb_base_functions = data.getN().size2();
778  if (3 * nb_base_functions < nb_dofs)
779  SETERRQ(
780  PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
781  "Number of DOFs is larger than number of base functions on entity");
782 
783  const size_t nb_gauss_pts = data.getN().size1();
784  std::array<double, MAX_DOFS_ON_ENTITY> nf;
785  std::fill(&nf[0], &nf[nb_dofs], 0);
786 
787  auto t_w = getFTensor0IntegrationWeight();
788  auto t_base = data.getFTensor0N();
789  auto t_coords = getFTensor1CoordsAtGaussPts();
790 
791  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
792 
793  double alpha = getMeasure() * t_w * (*cache).density;
794 
795  Tensor1<double, 3> cen_vec;
796  cen_vec(i) = (*cache).Omega(i, k) * (*cache).Omega(k, j) * t_coords(j);
797 
798  Tensor1<PackPtr<double *, 3>, 3> t_nf{&nf[0], &nf[1], &nf[2]};
799  size_t bb = 0;
800  for (; bb != nb_dofs / 3; ++bb) {
801  t_nf(i) += alpha * t_base * cen_vec(i);
802  ++t_base;
803  ++t_nf;
804  }
805  for (; bb < nb_base_functions; ++bb)
806  ++t_base;
807 
808  ++t_w;
809  ++t_coords;
810  }
811 
812  CHKERR VecSetValues(getKSPf(), data, nf.data(), ADD_VALUES);
813  }
814 
816 }
FTensor::Index< 'j', 2 > j
Definition: ElasticOps.hpp:27
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
const VectorInt & getIndices() const
Get global indices of dofs on entity.
FTensor::Index< 'k', 2 > k
Definition: ElasticOps.hpp:28
FTensor::Index< 'i', 2 > i
[Common data]
Definition: ElasticOps.hpp:26
#define CHKERR
Inline error check.
Definition: definitions.h:604
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.

Member Data Documentation

◆ commonDataPtr

boost::shared_ptr<CommonData> OpElasticTools::OpCentrifugalForce::commonDataPtr
private

Definition at line 874 of file ElasticOperators.hpp.


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