9#ifndef __KELVIN_VOIGT_DAMPER_HPP__
10#define __KELVIN_VOIGT_DAMPER_HPP__
13#error "MoFEM need to be compiled with ADOL-C"
56 MatrixBoundedArray<TYPE, 9>
F;
57 MatrixBoundedArray<TYPE, 9>
FDot;
58 MatrixBoundedArray<TYPE, 9>
61 MatrixBoundedArray<TYPE, 9>
63 MatrixBoundedArray<TYPE, 9>
65 MatrixBoundedArray<TYPE, 9>
invF;
91 for (
int ii = 0; ii < 3; ii++) {
119 for (
int ii = 0; ii < 3; ii++) {
139 invF.resize(3, 3,
false);
141 using Mat3 = MatrixBoundedArray<TYPE, 9>;
142 auto t_dashpotFirstPiolaKirchhoffStress =
143 GetFTensor2FromArrayImpl<3, 3, 0, Mat3>::get(
145 auto t_dashpotCauchyStress =
148 auto t_F = GetFTensor2FromArrayImpl<3, 3, 0, Mat3>::get(
F, 0, 0);
150 GetFTensor2FromArrayImpl<3, 3, 0, Mat3>::get(
invF, 0, 0);
157 J = determinantTensor3by3(t_F);
158 CHKERR invertTensor3by3(t_F,
J, t_invF);
159 t_dashpotFirstPiolaKirchhoffStress(
i,
j) =
160 J * (t_dashpotCauchyStress(
i,
k) * t_invF(
j,
k));
166 typedef boost::ptr_map<int, KelvinVoigtDamper::ConstitutiveEquation<adouble>>
267 bool calc_val,
bool calc_grad,
bool calc_dot =
false,
268 EntityType zero_at_type = MBVERTEX)
278 EntitiesFieldData::EntData &data) {
281 int nb_dofs = data.getFieldData().size();
285 int rank = data.getFieldDofs()[0]->getNbOfCoeffs();
286 int nb_gauss_pts = data.getN().size1();
294 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
301 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
321 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
322 for (
int rr1 = 0; rr1 < rank; rr1++)
331 for (
int gg = 0; gg < nb_gauss_pts; gg++) {
332 for (
int rr1 = 0; rr1 < rank; rr1++) {
333 for (
int rr2 = 0; rr2 < 3; rr2++) {
335 t_diff_disp(rr1, rr2);
361 CommonData &common_data,
bool calculate_residual,
362 bool calculate_jacobian)
382 cE.
F.resize(3, 3,
false);
383 cE.
FDot.resize(3, 3,
false);
386 MatrixDouble &F_dot =
392 for (
int dd1 = 0; dd1 < 3; dd1++) {
393 for (
int dd2 = 0; dd2 < 3; dd2++) {
394 cE.
F(dd1, dd2) <<=
F(dd1, dd2);
398 for (
int dd1 = 0; dd1 < 3; dd1++) {
399 for (
int dd2 = 0; dd2 < 3; dd2++) {
400 cE.
FDot(dd1, dd2) <<= F_dot(dd1, dd2);
414 for (
int d1 = 0; d1 < 3; d1++) {
415 for (
int d2 = 0; d2 < 3; d2++) {
435 "ADOL-C function evaluation with error r = %d", r);
451 "ADOL-C function evaluation with error");
453 }
catch (
const std::exception &ex) {
454 std::ostringstream ss;
455 ss <<
"throw in method: " << ex.what() << std::endl;
474 MatrixDouble &F_dot =
476 int nb_active_variables = 0;
479 for (
int dd1 = 0; dd1 < 3; dd1++) {
480 for (
int dd2 = 0; dd2 < 3; dd2++) {
485 for (
int dd1 = 0; dd1 < 3; dd1++) {
486 for (
int dd2 = 0; dd2 < 3; dd2++) {
493 "Number of active variables does not much");
524 MoFEMErrorCode
doWork(
int row_side, EntityType row_type,
525 EntitiesFieldData::EntData &row_data) {
528 if (row_type != MBVERTEX)
555 MoFEMErrorCode
aSemble(
int row_side, EntityType row_type,
556 EntitiesFieldData::EntData &row_data) {
558 int nb_dofs = row_data.getIndices().size();
559 int *indices_ptr = &row_data.getIndices()[0];
575 MoFEMErrorCode
doWork(
int row_side, EntityType row_type,
576 EntitiesFieldData::EntData &row_data) {
583 int nb_dofs = row_data.getIndices().size();
587 nF.resize(nb_dofs,
false);
589 int nb_gauss_pts = row_data.getN().size1();
590 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
591 const MatrixAdaptor &diffN = row_data.getDiffN(gg, nb_dofs / 3);
592 const MatrixDouble &stress =
595 for (
int dd = 0; dd < nb_dofs / 3; dd++) {
596 for (
int rr = 0; rr < 3; rr++) {
597 for (
int nn = 0; nn < 3; nn++) {
598 nF[3 * dd + rr] += val * diffN(dd, nn) * stress(rr, nn);
615 MoFEMErrorCode
aSemble(
int row_side,
int col_side, EntityType row_type,
617 EntitiesFieldData::EntData &row_data,
618 EntitiesFieldData::EntData &col_data) {
620 int nb_row = row_data.getIndices().size();
621 int nb_col = col_data.getIndices().size();
622 int *row_indices_ptr = &row_data.getIndices()[0];
623 int *col_indices_ptr = &col_data.getIndices()[0];
625 col_indices_ptr, &
K(0, 0), ADD_VALUES);
628 if (row_side != col_side || row_type != col_type) {
629 transK.resize(nb_col, nb_row,
false);
632 nb_row, row_indices_ptr, &
transK(0, 0),
646 common_data.spatialPositionName),
652 int nb_col = col_data.getIndices().size();
655 const MatrixAdaptor diffN = col_data.getDiffN(gg, nb_col / 3);
657 for (
int dd = 0; dd < nb_col / 3; dd++) {
658 for (
int jj = 0; jj < 3; jj++) {
659 double a = diffN(dd, jj);
660 for (
int rr = 0; rr < 3; rr++) {
661 for (
int ii = 0; ii < 9;
663 dStress_dx(ii, 3 * dd + rr) += jac_stress(ii, 3 * rr + jj) *
a;
670 MoFEMErrorCode
doWork(
int row_side,
int col_side, EntityType row_type,
672 EntitiesFieldData::EntData &row_data,
673 EntitiesFieldData::EntData &col_data) {
680 int nb_row = row_data.getIndices().size();
681 int nb_col = col_data.getIndices().size();
686 K.resize(nb_row, nb_col,
false);
688 int nb_gauss_pts = row_data.getN().size1();
689 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
694 const MatrixAdaptor &diffN = row_data.getDiffN(gg, nb_row / 3);
696 for (
int dd1 = 0; dd1 < nb_row / 3; dd1++) {
697 for (
int rr1 = 0; rr1 < 3; rr1++) {
698 for (
int dd2 = 0; dd2 < nb_col / 3; dd2++) {
699 for (
int rr2 = 0; rr2 < 3; rr2++) {
700 K(3 * dd1 + rr1, 3 * dd2 + rr2) +=
701 (diffN(dd1, 0) *
dStress_dx(3 * rr1 + 0, 3 * dd2 + rr2) +
702 diffN(dd1, 1) *
dStress_dx(3 * rr1 + 1, 3 * dd2 + rr2) +
703 diffN(dd1, 2) *
dStress_dx(3 * rr1 + 2, 3 * dd2 + rr2));
712 CHKERR aSemble(row_side, col_side, row_type, col_type, row_data,
725 common_data.spatialPositionName),
731 int nb_col = col_data.getIndices().size();
734 const MatrixAdaptor diffN = col_data.getDiffN(gg, nb_col / 3);
736 for (
int dd = 0; dd < nb_col / 3; dd++) {
737 for (
int jj = 0; jj < 3; jj++) {
738 double a = diffN(dd, jj);
739 for (
int rr = 0; rr < 3; rr++) {
740 for (
int ii = 0; ii < 9;
750 MoFEMErrorCode
doWork(
int row_side,
int col_side, EntityType row_type,
752 EntitiesFieldData::EntData &row_data,
753 EntitiesFieldData::EntData &col_data) {
760 int nb_row = row_data.getIndices().size();
761 int nb_col = col_data.getIndices().size();
766 K.resize(nb_row, nb_col,
false);
768 int nb_gauss_pts = row_data.getN().size1();
769 for (
int gg = 0; gg != nb_gauss_pts; gg++) {
774 const MatrixAdaptor &diffN = row_data.getDiffN(gg, nb_row / 3);
776 for (
int dd1 = 0; dd1 < nb_row / 3; dd1++) {
777 for (
int rr1 = 0; rr1 < 3; rr1++) {
778 for (
int dd2 = 0; dd2 < nb_col / 3; dd2++) {
779 for (
int rr2 = 0; rr2 < 3; rr2++) {
780 K(3 * dd1 + rr1, 3 * dd2 + rr2) +=
781 (diffN(dd1, 0) *
dStress_dot(3 * rr1 + 0, 3 * dd2 + rr2) +
782 diffN(dd1, 1) *
dStress_dot(3 * rr1 + 1, 3 * dd2 + rr2) +
783 diffN(dd1, 2) *
dStress_dot(3 * rr1 + 2, 3 * dd2 + rr2));
792 CHKERR aSemble(row_side, col_side, row_type, col_type, row_data,
803 if (it->getName().compare(0, 6,
"DAMPER") == 0) {
804 std::vector<double> data;
805 CHKERR it->getAttributes(data);
806 if (data.size() < 2) {
807 SETERRQ(PETSC_COMM_SELF, 1,
"Data inconsistency");
825 fe_ptr->getOpPtrVector().push_back(
826 new OpCalculateVectorFieldGradient<3, 3>(
831 fe_ptr->getOpPtrVector().push_back(
832 new OpCalculateVectorFieldGradientDot<3, 3>(
840 std::vector<int> tags;
ForcesAndSourcesCore::UserDataOperator UserDataOperator
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
implementation of Data Operators for Forces and Sources
constexpr auto field_name
MoFEMErrorCode aSemble(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
AssembleMatrix(string row_name, string col_name)
MoFEMErrorCode aSemble(int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
AssembleVector(string field_name)
Dumper material parameters.
double vBeta
Poisson ration spring alpha.
double gBeta
Sheer modulus spring alpha.
Common data for nonlinear_elastic_elem model.
std::map< int, int > nbActiveVariables
boost::shared_ptr< MatrixDouble > dataAtGaussTmpPtr
std::vector< MatrixDouble > dashpotFirstPiolaKirchhoffStress
std::vector< double * > jacRowPtr
string spatialPositionNameDot
std::vector< MatrixDouble > jacStress
string spatialPositionName
string meshNodePositionName
std::map< std::string, std::vector< MatrixDouble > > gradAtGaussPts
std::map< std::string, std::vector< VectorDouble > > dataAtGaussPts
std::map< int, int > nbActiveResults
boost::shared_ptr< MatrixDouble > gradDataAtGaussTmpPtr
Constitutive model functions.
FTensor::Index< 'j', 3 > j
virtual ~ConstitutiveEquation()=default
MatrixBoundedArray< TYPE, 9 > FDot
Rate of gradient of deformation.
FTensor::Index< 'k', 3 > k
MatrixBoundedArray< TYPE, 9 > invF
Inverse of gradient of deformation.
FTensor::Index< 'i', 3 > i
MatrixBoundedArray< TYPE, 9 > F
Gradient of deformation.
virtual MoFEMErrorCode calculateFirstPiolaKirchhoffStress()
Calculate First Piola-Kirchhoff Stress Dashpot stress.
MatrixBoundedArray< TYPE, 9 > gradientUDot
Rate of gradient of displacements.
virtual MoFEMErrorCode calculateDashpotCauchyStress()
Calculate Cauchy dashpot stress.
MatrixBoundedArray< TYPE, 9 > engineringStrainDot
virtual MoFEMErrorCode calculateEngineeringStrainDot()
Calculate strain rate.
MatrixBoundedArray< TYPE, 9 > dashpotFirstPiolaKirchhoffStress
Stress generated by spring beta.
ConstitutiveEquation(BlockMaterialData &data, bool is_displacement=true)
MatrixBoundedArray< TYPE, 9 > dashpotCauchyStress
Stress generated by spring beta.
TYPE traceEngineeringStrainDot
TYPE J
Jacobian of gradient of deformation.
definition of volume element
int addToRule
Takes into account HO geometry.
MoFEMErrorCode postProcess()
Post-processing function executed at loop completion.
DamperFE(MoFEM::Interface &m_field, CommonData &common_data)
MoFEMErrorCode preProcess()
Pre-processing function executed at loop initialization.
OpGetDataAtGaussPts(const std::string field_name, CommonData &common_data, bool calc_val, bool calc_grad, bool calc_dot=false, EntityType zero_at_type=MBVERTEX)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator field value.
std::map< int, int > & nbActiveVariables
MoFEMErrorCode calculateJacobian(TagEvaluate te)
bool calculateJacobianBool
bool calculateResidualBool
MoFEMErrorCode doWork(int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
std::map< int, int > & nbActiveResults
KelvinVoigtDamper::ConstitutiveEquation< adouble > & cE
MoFEMErrorCode calculateAtIntPtsDamperStress()
VectorDouble activeVariables
MoFEMErrorCode calculateFunction(TagEvaluate te, double *ptr)
OpJacobian(const std::string field_name, std::vector< int > tags, KelvinVoigtDamper::ConstitutiveEquation< adouble > &ce, CommonData &common_data, bool calculate_residual, bool calculate_jacobian)
MoFEMErrorCode recordDamperStress()
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
MoFEMErrorCode get_dStress_dot(EntitiesFieldData::EntData &col_data, int gg)
OpLhsdxdot(CommonData &common_data)
MoFEMErrorCode doWork(int row_side, int col_side, EntityType row_type, EntityType col_type, EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
OpLhsdxdx(CommonData &common_data)
MoFEMErrorCode get_dStress_dx(EntitiesFieldData::EntData &col_data, int gg)
Assemble internal force vector.
OpRhsStress(CommonData &common_data)
MoFEMErrorCode doWork(int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
Implementation of Kelvin Voigt Damper.
MoFEMErrorCode setBlockDataMap()
ConstitutiveEquationMap constitutiveEquationMap
std::map< int, BlockMaterialData > blockMaterialDataMap
KelvinVoigtDamper(MoFEM::Interface &m_field)
MoFEMErrorCode setOperators(const int tag)
boost::ptr_map< int, KelvinVoigtDamper::ConstitutiveEquation< adouble > > ConstitutiveEquationMap
MoFEM::Interface & mField
virtual moab::Interface & get_moab()=0
bool sYmm
If true assume that matrix is symmetric structure.
Deprecated interface functions.
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
@ OPCOL
operator doWork function is executed on FE columns
@ OPROW
operator doWork function is executed on FE rows
@ OPROWCOL
operator doWork is executed on FE rows &columns
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
virtual MoFEMErrorCode preProcess()
Pre-processing function executed at loop initialization.
boost::ptr_deque< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.
PetscReal ts_a
Shift parameter for U_t (see PETSc Time Solver documentation)
double getVolume() const
element volume (linear geometry)
Volume finite element base.
VolumeElementForcesAndSourcesCore(Interface &m_field)