39 #ifndef WALLTENSIONCYLINDRICAL_H 40 #define WALLTENSIONCYLINDRICAL_H 1
46 #include <boost/scoped_ptr.hpp> 47 #include <boost/multi_array.hpp> 49 #pragma GCC diagnostic ignored "-Wunused-variable" 50 #pragma GCC diagnostic ignored "-Wunused-parameter" 53 #include <Epetra_SerialDenseMatrix.h> 55 #pragma GCC diagnostic ignored "-Wunused-variable" 56 #pragma GCC diagnostic ignored "-Wunused-parameter" 59 #include <lifev/core/array/MatrixElemental.hpp> 60 #include <lifev/core/array/VectorElemental.hpp> 61 #include <lifev/core/array/MatrixEpetra.hpp> 62 #include <lifev/core/array/VectorEpetra.hpp> 64 #include <lifev/core/fem/Assembly.hpp> 65 #include <lifev/core/fem/AssemblyElemental.hpp> 66 #include <lifev/core/fem/FESpace.hpp> 67 #include <lifev/core/LifeV.hpp> 68 #include <lifev/core/util/Displayer.hpp> 69 #include <lifev/core/array/MapEpetra.hpp> 71 #include <lifev/core/filter/ExporterEnsight.hpp> 73 #include <lifev/core/filter/ExporterHDF5.hpp> 75 #include <lifev/core/filter/ExporterEmpty.hpp> 78 #include <lifev/structure/fem/AssemblyElementalStructure.hpp> 79 #include <lifev/structure/solver/StructuralConstitutiveLawData.hpp> 82 #include <lifev/structure/solver/WallTensionEstimatorData.hpp> 83 #include <lifev/structure/solver/WallTensionEstimator.hpp> 96 template <
typename Mesh>
105 typedef WallTensionEstimator<Mesh>
super;
164 void setup (
const dataPtr_Type& dataMaterial,
165 const analysisDataPtr_Type& tensionData,
251 template <
typename Mesh>
265 template <
typename Mesh>
268 const analysisDataPtr_Type& tensionData,
274 super::setup (dataMaterial, tensionData, FESpace, ETFESpace, comm, marker);
275 M_deformationCylindricalF.reset (
new matrix_Type (
this->M_FESpace->fieldDim(),
this->M_FESpace->fieldDim() ) );
276 M_changeOfVariableMatrix.reset (
new matrix_Type (
this->M_FESpace->fieldDim(),
this->M_FESpace->fieldDim() ) );
279 template <
typename Mesh>
284 * (
this->M_globalEigenvalues) *= 0.0;
285 if ( !
this->M_analysisData->recoveryVariable().compare (
"displacement") )
289 else if ( !
this->M_analysisData->recoveryVariable().compare (
"eigenvalues") )
299 template <
typename Mesh>
306 this->M_displayer->leaderPrint (
" \n*********************************\n ");
307 this->M_displayer->leaderPrint (
" Performing the analysis recovering the displacement..., ",
this->M_dataMaterial->solidTypeIsotropic() );
308 this->M_displayer->leaderPrint (
" \n*********************************\n ");
315 super::computeDisplacementGradient ( grDisplX, grDisplY, grDisplZ);
327 for (
UInt i (0); i <
this->M_FESpace->mesh()->numVolumes(); ++i )
331 this->M_FESpace->fe().updateFirstDerivQuadPt (
this->M_FESpace->mesh()->volumeList ( i ) );
332 UInt eleID =
this->M_FESpace->fe().currentLocalId();
333 this->M_marker =
this->M_FESpace->mesh()->volumeList ( i ).markerID();
336 matrix_Type gradientDispl (
this->M_FESpace->fieldDim(),
this->M_FESpace->fieldDim() );
337 gradientDispl.Scale ( 0.0 );
340 for (
UInt iNode = 0; iNode < (
UInt )
this->M_FESpace->fe().nbFEDof(); iNode++ )
342 UInt iloc =
this->M_FESpace->fe().patternFirst ( iNode );
344 for (
UInt iComp = 0; iComp <
this->M_FESpace->fieldDim(); ++iComp )
346 UInt ig =
this->M_FESpace->dof().localToGlobalMap ( eleID, iloc ) + iComp *
this->M_FESpace->dim() +
this->M_offset;
348 gradientDispl (iComp, 0) = grXRep[ig];
349 gradientDispl (iComp, 1) = grYRep[ig];
350 gradientDispl (iComp, 2) = grZRep[ig];
354 ( * (
this->M_cofactorF) ).Scale (0.0);
355 ( * (
this->M_firstPiola) ).Scale (0.0);
356 ( * (
this->M_sigma) ).Scale (0.0);
359 moveToCylindricalCoordinates ( gradientDispl, iloc, *M_deformationCylindricalF );
362 AssemblyElementalStructure::computeInvariantsRightCauchyGreenTensor (
this->M_invariants, *M_deformationCylindricalF, * (
this->M_cofactorF) );
365 this->M_material->computeLocalFirstPiolaKirchhoffTensor (* (
this->M_firstPiola), *M_deformationCylindricalF, * (
this->M_cofactorF),
this->M_invariants,
this->M_marker);
368 AssemblyElementalStructure::computeCauchyStressTensor (* (
this->M_sigma), * (
this->M_firstPiola),
this->M_invariants[3], *M_deformationCylindricalF);
371 AssemblyElementalStructure::computeEigenvalues (* (
this->M_sigma),
this->M_eigenvaluesR,
this->M_eigenvaluesI);
376 for (
UInt j (0); j <
this->M_eigenvaluesI.size(); ++j )
378 sum += std::abs (
this->M_eigenvaluesI[j] );
381 ASSERT ( sum < 1e-6 ,
"The eigenvalues of the Cauchy stress tensors have to be real!" );
383 std::sort (
this->M_eigenvaluesR.begin(),
this->M_eigenvaluesR.end() );
385 std::cout <<
"Saving eigenvalues" << i << std::endl;
388 for (
UInt icoor = 0; icoor <
this->M_FESpace->fieldDim(); ++icoor )
390 UInt ig =
this->M_FESpace->dof().localToGlobalMap ( eleID, iloc ) + icoor *
this->M_FESpace->dim() +
this->M_offset;
391 (* (
this->M_globalEigenvalues) ) (ig) =
this->M_eigenvaluesR[icoor];
403 this->M_displayer->leaderPrint (
"Analysis done in: ", chrono.diff() );
408 template <
typename Mesh>
415 this->M_displayer->leaderPrint (
" \n*********************************\n ");
416 this->M_displayer->leaderPrint (
" Performing the analysis recovering the tensions..., ",
this->M_dataMaterial->solidTypeIsotropic() );
417 this->M_displayer->leaderPrint (
" \n*********************************\n ");
422 super::constructPatchAreaVector ( patchArea );
429 Real refElemArea (0);
431 for (
UInt iq = 0; iq <
this->M_FESpace->qr().nbQuadPt(); iq++)
433 refElemArea +=
this->M_FESpace->qr().weight (iq);
436 Real wQuad (refElemArea /
this->M_FESpace->refFE().nbDof() );
439 std::vector<GeoVector> coords =
this->M_FESpace->refFE().refCoor();
440 std::vector<Real> weights (
this->M_FESpace->fe().nbFEDof(), wQuad);
441 fakeQuadratureRule
.setDimensionShape ( shapeDimension (
this->M_FESpace->refFE().shape() )
, this->M_FESpace->refFE().shape()
);
442 fakeQuadratureRule.setPoints (coords, weights);
445 this->M_FESpace->setQuadRule (fakeQuadratureRule);
447 UInt totalDof =
this->M_FESpace->dof().numTotalDof();
448 VectorElemental dk_loc (
this->M_FESpace->fe().nbFEDof(),
this->M_FESpace->fieldDim() );
451 std::vector<matrix_Type> vectorDeformationF (
this->M_FESpace->fe().nbFEDof(), * (
this->M_deformationF) );
455 VectorElemental elVecTens (
this->M_FESpace->fe().nbFEDof(),
this->M_FESpace->fieldDim() );
460 for (
UInt i = 0; i <
this->M_FESpace->mesh()->numVolumes(); ++i )
462 this->M_FESpace->fe().updateFirstDerivQuadPt (
this->M_FESpace->mesh()->volumeList ( i ) );
465 this->M_marker =
this->M_FESpace->mesh()->volumeList ( i ).markerID();
467 UInt eleID =
this->M_FESpace->fe().currentLocalId();
470 for (
UInt iNode = 0; iNode < (
UInt )
this->M_FESpace->fe().nbFEDof(); iNode++ )
472 UInt iloc =
this->M_FESpace->fe().patternFirst ( iNode );
474 for (
UInt iComp = 0; iComp <
this->M_FESpace->fieldDim(); ++iComp )
476 UInt ig =
this->M_FESpace->dof().localToGlobalMap ( eleID, iloc ) + iComp *
this->M_FESpace->dim() +
this->M_offset;
477 dk_loc[iloc + iComp *
this->M_FESpace->fe().nbFEDof()] = dRep[ig];
482 AssemblyElementalStructure::computeLocalDeformationGradientWithoutIdentity ( dk_loc, vectorDeformationF,
this->M_FESpace->fe() );
485 for (
UInt nDOF = 0; nDOF < (
UInt )
this->M_FESpace->fe().nbFEDof(); nDOF++ )
487 UInt iloc =
this->M_FESpace->fe().patternFirst ( nDOF );
488 vector_Type localDisplacement (
this->M_FESpace->fieldDim(), 0.0);
490 for (
UInt coor = 0; coor <
this->M_FESpace->fieldDim(); coor++ )
492 localDisplacement[coor] = iloc + coor *
this->M_FESpace->fe().nbFEDof();
495 this->M_sigma->Scale (0.0);
496 this->M_firstPiola->Scale (0.0);
497 this->M_cofactorF->Scale (0.0);
498 M_deformationCylindricalF->Scale (0.0);
500 moveToCylindricalCoordinates (vectorDeformationF[nDOF], iloc, *M_deformationCylindricalF);
503 AssemblyElementalStructure::computeInvariantsRightCauchyGreenTensor (
this->M_invariants, *M_deformationCylindricalF, * (
this->M_cofactorF) );
506 this->M_material->computeLocalFirstPiolaKirchhoffTensor (* (
this->M_firstPiola), *M_deformationCylindricalF, * (
this->M_cofactorF),
this->M_invariants,
this->M_marker);
509 AssemblyElementalStructure::computeCauchyStressTensor (* (
this->M_sigma), * (
this->M_firstPiola),
this->M_invariants[3], *M_deformationCylindricalF);
512 AssemblyElementalStructure::computeEigenvalues (* (
this->M_sigma),
this->M_eigenvaluesR,
this->M_eigenvaluesI);
517 for (
int i = 0; i <
this->M_eigenvaluesI.size(); i++ )
519 sum += std::abs (
this->M_eigenvaluesI[i]);
521 ASSERT_PRE ( sum < 1e-6 ,
"The eigenvalues of the Cauchy stress tensors have to be real!" );
523 std::sort (
this->M_eigenvaluesR.begin(),
this->M_eigenvaluesR.end() );
526 for (
int coor = 0; coor <
this->M_eigenvaluesR.size(); coor++ )
528 elVecTens[iloc + coor *
this->M_FESpace->fe().nbFEDof()] =
this->M_eigenvaluesR[coor];
532 super::reconstructElementaryVector ( elVecTens, patchAreaR, *
this->M_FESpace );
535 for (
UInt ic = 0; ic <
this->M_FESpace->fieldDim(); ++ic )
537 assembleVector (* (
this->M_globalEigenvalues), elVecTens,
this->M_FESpace->fe(),
this->M_FESpace->dof(), ic,
this->M_offset + ic * totalDof );
541 this->M_globalEigenvalues->globalAssemble();
544 this->M_displayer->leaderPrint (
"Analysis done in: ", chrono.diff() );
547 template <
typename Mesh>
555 UInt dim =
this->M_FESpace->dim();
560 for (
UInt iDOF = 0; iDOF < (
UInt )
this->M_FESpace->dof().numTotalDof(); iDOF++ )
563 if (
this->M_displacement->blockMap().LID (
static_cast<
EpetraInt_Type> (iDOF) ) != -1 )
566 (* (
this->M_sigma) ).Scale (0.0);
569 for (
UInt iComp = 0; iComp <
this->M_FESpace->fieldDim(); ++iComp )
571 Int LIDid =
this->M_displacement->blockMap().LID (
static_cast<
EpetraInt_Type> (iDOF + iComp * dim +
this->M_offset ) );
572 Int GIDid =
this->M_displacement->blockMap().GID (
static_cast<
EpetraInt_Type> (LIDid) );
573 (* (
this->M_sigma) ) (iComp, 0) = (*
this->M_sigmaX) (GIDid);
574 (* (
this->M_sigma) ) (iComp, 1) = (*
this->M_sigmaY) (GIDid);
575 (* (
this->M_sigma) ) (iComp, 2) = (*
this->M_sigmaZ) (GIDid);
579 AssemblyElementalStructure::computeEigenvalues (* (
this->M_sigma),
this->M_eigenvaluesR,
this->M_eigenvaluesI);
584 for (
int i = 0; i <
this->M_eigenvaluesI.size(); i++ )
586 sum += std::abs (
this->M_eigenvaluesI[i]);
588 ASSERT_PRE ( sum < 1e-6 ,
"The eigenvalues of the Cauchy stress tensors have to be real!" );
590 std::sort (
this->M_eigenvaluesR.begin(),
this->M_eigenvaluesR.end() );
593 for (
UInt icoor = 0; icoor <
this->M_FESpace->fieldDim(); ++icoor )
595 Int LIDid =
this->M_displacement->blockMap().LID (
static_cast<
EpetraInt_Type> (iDOF + icoor * dim +
this->M_offset) );
596 Int GIDid =
this->M_displacement->blockMap().GID (
static_cast<
EpetraInt_Type> (LIDid) );
597 (* (
this->M_globalEigenvalues) ) (GIDid) =
this->M_eigenvaluesR[icoor];
604 this->M_displayer->leaderPrint (
"Analysis done in: ", chrono.diff() );
608 template <
typename Mesh>
614 VectorElemental elVecSigmaX (
this->M_FESpace->fe().nbFEDof(),
this->M_FESpace->fieldDim() );
615 VectorElemental elVecSigmaY (
this->M_FESpace->fe().nbFEDof(),
this->M_FESpace->fieldDim() );
616 VectorElemental elVecSigmaZ (
this->M_FESpace->fe().nbFEDof(),
this->M_FESpace->fieldDim() );
624 super::constructPatchAreaVector ( patchArea );
631 Real refElemArea (0);
633 for (
UInt iq = 0; iq <
this->M_FESpace->qr().nbQuadPt(); iq++)
635 refElemArea +=
this->M_FESpace->qr().weight (iq);
638 Real wQuad (refElemArea /
this->M_FESpace->refFE().nbDof() );
641 std::vector<GeoVector> coords =
this->M_FESpace->refFE().refCoor();
642 std::vector<Real> weights (
this->M_FESpace->fe().nbFEDof(), wQuad);
643 fakeQuadratureRule
.setDimensionShape ( shapeDimension (
this->M_FESpace->refFE().shape() )
, this->M_FESpace->refFE().shape()
);
644 fakeQuadratureRule.setPoints (coords, weights);
647 this->M_FESpace->setQuadRule (fakeQuadratureRule);
649 this->M_displayer->leaderPrint (
" \n*********************************\n ");
650 this->M_displayer->leaderPrint (
" Performing the analysis recovering the Cauchy stresses..., ",
this->M_dataMaterial->solidTypeIsotropic() );
651 this->M_displayer->leaderPrint (
" \n*********************************\n ");
653 UInt totalDof =
this->M_FESpace->dof().numTotalDof();
654 VectorElemental dk_loc (
this->M_FESpace->fe().nbFEDof(),
this->M_FESpace->fieldDim() );
657 std::vector<matrix_Type> vectorDeformationF (
this->M_FESpace->fe().nbFEDof(), * (
this->M_deformationF) );
664 for (
UInt i = 0; i <
this->M_FESpace->mesh()->numVolumes(); ++i )
666 this->M_FESpace->fe().updateFirstDerivQuadPt (
this->M_FESpace->mesh()->volumeList ( i ) );
672 this->M_marker =
this->M_FESpace->mesh()->volumeList ( i ).markerID();
674 UInt eleID =
this->M_FESpace->fe().currentLocalId();
677 for (
UInt iNode = 0; iNode < (
UInt )
this->M_FESpace->fe().nbFEDof(); iNode++ )
679 UInt iloc =
this->M_FESpace->fe().patternFirst ( iNode );
681 for (
UInt iComp = 0; iComp <
this->M_FESpace->fieldDim(); ++iComp )
683 UInt ig =
this->M_FESpace->dof().localToGlobalMap ( eleID, iloc ) + iComp *
this->M_FESpace->dim() +
this->M_offset;
684 dk_loc[iloc + iComp *
this->M_FESpace->fe().nbFEDof()] = dRep[ig];
689 AssemblyElementalStructure::computeLocalDeformationGradientWithoutIdentity ( dk_loc, vectorDeformationF,
this->M_FESpace->fe() );
692 for (
UInt nDOF = 0; nDOF < (
UInt )
this->M_FESpace->fe().nbFEDof(); nDOF++ )
694 UInt iloc =
this->M_FESpace->fe().patternFirst ( nDOF );
696 vector_Type localDisplacement (
this->M_FESpace->fieldDim(), 0.0);
698 for (
UInt coor = 0; coor <
this->M_FESpace->fieldDim(); coor++ )
700 localDisplacement[coor] = iloc + coor *
this->M_FESpace->fe().nbFEDof();
703 this->M_sigma->Scale (0.0);
704 this->M_firstPiola->Scale (0.0);
705 this->M_cofactorF->Scale (0.0);
706 this->M_deformationCylindricalF->Scale (0.0);
708 moveToCylindricalCoordinates (vectorDeformationF[nDOF], iloc, *M_deformationCylindricalF);
711 AssemblyElementalStructure::computeInvariantsRightCauchyGreenTensor (
this->M_invariants, *M_deformationCylindricalF, * (
this->M_cofactorF) );
714 this->M_material->computeLocalFirstPiolaKirchhoffTensor (* (
this->M_firstPiola), *M_deformationCylindricalF, * (
this->M_cofactorF),
this->M_invariants,
this->M_marker);
717 AssemblyElementalStructure::computeCauchyStressTensor (* (
this->M_sigma), * (
this->M_firstPiola),
this->M_invariants[3], *M_deformationCylindricalF);
720 for (
int coor = 0; coor <
this->M_FESpace->fieldDim(); coor++ )
722 (elVecSigmaX) [iloc + coor *
this->M_FESpace->fe().nbFEDof()] = (* (
this->M_sigma) ) (coor, 0);
726 for (
int coor = 0; coor <
this->M_FESpace->fieldDim(); coor++ )
728 (elVecSigmaY) [iloc + coor *
this->M_FESpace->fe().nbFEDof()] = (* (
this->M_sigma) ) (coor, 1);
732 for (
int coor = 0; coor <
this->M_FESpace->fieldDim(); coor++ )
734 (elVecSigmaZ) [iloc + coor *
this->M_FESpace->fe().nbFEDof()] = (* (
this->M_sigma) ) (coor, 2);
739 super::reconstructElementaryVector ( elVecSigmaX, patchAreaR, *
this->M_FESpace );
740 super::reconstructElementaryVector ( elVecSigmaY, patchAreaR, *
this->M_FESpace );
741 super::reconstructElementaryVector ( elVecSigmaZ, patchAreaR, *
this->M_FESpace );
744 for (
UInt ic = 0; ic <
this->M_FESpace->fieldDim(); ++ic )
746 assembleVector (*
this->M_sigmaX, elVecSigmaX,
this->M_FESpace->fe(),
this->M_FESpace->dof(), ic,
this->M_offset + ic * totalDof );
747 assembleVector (*
this->M_sigmaY, elVecSigmaY,
this->M_FESpace->fe(),
this->M_FESpace->dof(), ic,
this->M_offset + ic * totalDof );
748 assembleVector (*
this->M_sigmaZ, elVecSigmaZ,
this->M_FESpace->fe(),
this->M_FESpace->dof(), ic,
this->M_offset + ic * totalDof );
753 this->M_sigmaX->globalAssemble();
754 this->M_sigmaY->globalAssemble();
755 this->M_sigmaZ->globalAssemble();
758 template <
typename Mesh>
765 (*M_changeOfVariableMatrix).Scale ( 0.0 );
766 (*M_deformationCylindricalF).Scale ( 0.0 );
769 Real xi (
this->M_FESpace->refFE().xi (iloc) );
770 Real eta (
this->M_FESpace->refFE().eta (iloc) );
771 Real zeta (
this->M_FESpace->refFE().zeta (iloc) );
776 this->M_FESpace->fe().coorMap (x, y, z, xi, eta, zeta);
780 Real theta = std::atan ( y / x );
783 (*M_changeOfVariableMatrix) (0, 0) = std::cos (theta);
784 (*M_changeOfVariableMatrix) (1, 0) = - std::sin (theta);
785 (*M_changeOfVariableMatrix) (2, 0) = 0.0;
786 (*M_changeOfVariableMatrix) (0, 1) = std::sin (theta);
787 (*M_changeOfVariableMatrix) (1, 1) = std::cos (theta);
788 (*M_changeOfVariableMatrix) (2, 1) = 0.0;
789 (*M_changeOfVariableMatrix) (0, 2) = 0.0;
790 (*M_changeOfVariableMatrix) (1, 2) = 0.0;
791 (*M_changeOfVariableMatrix) (2, 2) = 1.0;
794 deformationCylindricalF.Multiply (
'N',
'T', 1.0, gradientDispl, *M_changeOfVariableMatrix, 0.0 );
797 for (
Int icoor (0); icoor <
this->M_FESpace->fieldDim(); icoor++ )
799 deformationCylindricalF ( icoor, icoor ) += 1.0;
Epetra_SerialDenseMatrix matrix_Type
matrixPtr_Type M_deformationCylindricalF
Elementary matrix for the tensor F.
void setup(const dataPtr_Type &dataMaterial, const analysisDataPtr_Type &tensionData, const feSpacePtr_Type &FESpace, const feSpaceETPtr_Type &ETFESpace, const commPtr_Type &comm, UInt marker)
Setup the created object of the class WallTensionEstimatorCylindricalCoordinates. ...
WallTensionEstimator< Mesh > super
void setDimensionShape(const UInt &newDim, const ReferenceShapes &newShape)
Change the dimension and the shape.
void analyzeTensions()
Analyze Tensions: This method computes the Cauchy stress tensor and its principal values...
int32_type Int
Generic integer data.
virtual ~WallTensionEstimatorCylindricalCoordinates()
std::vector< LifeV::Real > vector_Type
super::commPtr_Type commPtr_Type
StructuralConstitutiveLawData data_Type
super::feSpace_Type feSpace_Type
std::shared_ptr< material_Type > materialPtr_Type
std::shared_ptr< Exporter< Mesh > > exporterPtr_Type
void analyzeTensionsRecoveryCauchyStressesCylindrical()
Analyze Tensions: This method computes the Cauchy stress tensor and its principal values...
std::shared_ptr< VectorEpetra > solutionVectPtr_Type
super::feSpaceET_Type feSpaceET_Type
super::comm_Type comm_Type
void analyzeTensionsRecoveryEigenvaluesCylindrical()
Analyze Tensions: This method computes the Cauchy stress tensor and its principal values...
VectorEpetra solutionVect_Type
void analyzeTensionsRecoveryDisplacementCylindrical()
Analyze Tensions: This method computes the Cauchy stress tensor and its principal values...
super::feSpaceETPtr_Type feSpaceETPtr_Type
double Real
Generic real data.
WallTensionEstimatorCylindricalCoordinates()
StructuralConstitutiveLaw< Mesh > material_Type
super::feSpacePtr_Type feSpacePtr_Type
std::shared_ptr< matrix_Type > matrixPtr_Type
QuadratureRule - The basis class for storing and accessing quadrature rules.
matrixPtr_Type M_changeOfVariableMatrix
DataElasticStructure - Data container for solid problems with elastic structure.
void moveToCylindricalCoordinates(matrix_Type &gradientDispl, UInt iloc, matrix_Type &deformationCylindricalF)
moveToCylindricalCoordinates: This methods brings the gradient of the displacement field computed wit...
int EpetraInt_Type
Epetra int type (can be int or long long, accordingly to release notes)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
WallTensionEstimatorData analysisData_Type
std::shared_ptr< vector_Type > vectorPtr_Type
void constructGlobalStressVector()
constructGlobalStressVector: This method construct the vectors {.,i} for i=x,y,z to have for each DOF...