v0.9.0
Public Member Functions | Public Attributes | List of all members
VolumeLengthQuality< TYPE > Struct Template Reference

Volume Length Quality. More...

#include <users_modules/basic_finite_elements/nonlinear_elastic_materials/src/VolumeLengthQuality.hpp>

Inheritance diagram for VolumeLengthQuality< TYPE >:
[legend]
Collaboration diagram for VolumeLengthQuality< TYPE >:
[legend]

Public Member Functions

 VolumeLengthQuality (VolumeLengthQualityType type, double alpha, double gamma)
 
MoFEMErrorCode getMaterialOptions ()
 
MoFEMErrorCode getEdgesFromElemCoords ()
 
MoFEMErrorCode calculateLrms ()
 Calculate mean element edge length. More...
 
MoFEMErrorCode calculateQ ()
 Calculate Q. More...
 
virtual MoFEMErrorCode calculateP_PiolaKirchhoffI (const NonlinearElasticElement::BlockData block_data, boost::shared_ptr< const NumeredEntFiniteElement > fe_ptr)
 Volume Length Quality. More...
 
- Public Member Functions inherited from NonlinearElasticElement::FunctionsToCalculatePiolaKirchhoffI< TYPE >
virtual ~FunctionsToCalculatePiolaKirchhoffI ()
 
MoFEMErrorCode dEterminant (ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 >> &a, TYPE &det)
 Calculate determinant of 3x3 matrix. More...
 
MoFEMErrorCode iNvert (TYPE det, ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 >> &a, ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 >> &inv_a)
 Calculate inverse of 3x3 matrix. More...
 
MoFEMErrorCode calculateC_CauchyDeformationTensor ()
 
MoFEMErrorCode calculateE_GreenStrain ()
 
MoFEMErrorCode calculateS_PiolaKirchhoffII ()
 
virtual MoFEMErrorCode setUserActiveVariables (int &nb_active_variables)
 add additional active variables More...
 
virtual MoFEMErrorCode setUserActiveVariables (VectorDouble &activeVariables)
 Add additional independent variables More complex physical models depend on gradient of defamation and some additional variables. For example can depend on temperature. This function adds additional independent variables to the model. More...
 
virtual MoFEMErrorCode calculateElasticEnergy (const BlockData block_data, boost::shared_ptr< const NumeredEntFiniteElement > fe_ptr)
 Calculate elastic energy density. More...
 
virtual MoFEMErrorCode calculateSiGma_EshelbyStress (const BlockData block_data, boost::shared_ptr< const NumeredEntFiniteElement > fe_ptr)
 Calculate Eshelby stress. More...
 
virtual MoFEMErrorCode getDataOnPostProcessor (std::map< std::string, std::vector< VectorDouble >> &field_map, std::map< std::string, std::vector< MatrixDouble >> &grad_map)
 Do operations when pre-process. More...
 

Public Attributes

int tYpe
 
double aLpha
 
double gAmma
 
VectorDouble coordsEdges
 
double lrmsSquared0
 
VectorDouble deltaChi
 
ublas::vector< TYPE > deltaX
 
ublas::matrix< TYPE > Q
 
ublas::matrix< TYPE > dXdChiT
 
TYPE lrmsSquared
 
TYPE q
 
TYPE b
 
TYPE detF
 
TYPE currentVolume
 
TYPE tMp
 
- Public Attributes inherited from NonlinearElasticElement::FunctionsToCalculatePiolaKirchhoffI< TYPE >
double lambda
 
double mu
 
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > F
 
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > C
 
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > E
 
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > S
 
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > invF
 
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > P
 
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > SiGma
 
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > h
 
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > H
 
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > invH
 
TYPE J
 
TYPE eNergy
 
TYPE detH
 
int gG
 Gauss point number. More...
 
CommonDatacommonDataPtr
 
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperatoropPtr
 pointer to finite element tetrahedral operator More...
 

Detailed Description

template<typename TYPE>
struct VolumeLengthQuality< TYPE >

Volume Length Quality.

Examples
mesh_smoothing.cpp.

Definition at line 44 of file VolumeLengthQuality.hpp.

Constructor & Destructor Documentation

◆ VolumeLengthQuality()

template<typename TYPE >
VolumeLengthQuality< TYPE >::VolumeLengthQuality ( VolumeLengthQualityType  type,
double  alpha,
double  gamma 
)

Definition at line 53 of file VolumeLengthQuality.hpp.

55  tYpe(type), aLpha(alpha), gAmma(gamma) {
57  CHKERRABORT(PETSC_COMM_WORLD, ierr);
58  }
MoFEMErrorCode getMaterialOptions()
Implementation of elastic (non-linear) St. Kirchhoff equation.

Member Function Documentation

◆ calculateLrms()

template<typename TYPE >
MoFEMErrorCode VolumeLengthQuality< TYPE >::calculateLrms ( )

Calculate mean element edge length.

\[ \Delta \boldsymbol\chi = \boldsymbol\chi^1 - \boldsymbol\chi^2 \]

\[ \Delta X = \mathbf{F} \Delta \boldsymbol\chi \]

\[ l_\textrm{rms} = \sqrt{\frac{1}{6} \sum_{i=0}^6 l_i^2 } = L_\textrm{rms}dl_\textrm{rms} \]

Definition at line 136 of file VolumeLengthQuality.hpp.

136  {
138  if (deltaChi.size() != 3) {
139  deltaChi.resize(3);
140  deltaX.resize(3);
141  dXdChiT.resize(3, 3);
142  }
143  lrmsSquared = 0;
144  lrmsSquared0 = 0;
145  dXdChiT.clear();
146  for (int ee = 0; ee < 6; ee++) {
147  for (int dd = 0; dd < 3; dd++) {
148  deltaChi[dd] = coordsEdges[6 * ee + dd] - coordsEdges[6 * ee + 3 + dd];
149  }
150  noalias(deltaX) = prod(this->F, deltaChi);
151  for (int dd = 0; dd < 3; dd++) {
152  lrmsSquared += (1. / 6.) * deltaX[dd] * deltaX[dd];
153  lrmsSquared0 += (1. / 6.) * deltaChi[dd] * deltaChi[dd];
154  }
155  noalias(dXdChiT) += outer_prod(deltaX, deltaChi);
156  }
158  }
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > F
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
ublas::matrix< TYPE > dXdChiT
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
ublas::vector< TYPE > deltaX
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ calculateP_PiolaKirchhoffI()

template<typename TYPE >
virtual MoFEMErrorCode VolumeLengthQuality< TYPE >::calculateP_PiolaKirchhoffI ( const NonlinearElasticElement::BlockData  block_data,
boost::shared_ptr< const NumeredEntFiniteElement >  fe_ptr 
)
virtual

Volume Length Quality.

Based on: Three‐dimensional brittle fracture: configurational‐force‐driven crack propagation International Journal for Numerical Methods in Engineering 97 (7), 531-550

\[ \mathcal{B}(a)=\frac{a}{2(1-\gamma)}-\ln{(a-\gamma)} \]

\[ q = q_0 b, \quad q_0 = 6\sqrt{2}\frac{V_0}{L^3_\textrm{rms}}, \quad b = \frac{\textrm{det}(\mathbf{F})}{\textrm{d}l^3_\textrm{rms}} \]

\[ \mathbf{P} = \mathcal{B}(a)\mathbf{Q}, \]

where \(a\) depending on problem could be \(q\) or \(b\).

Reimplemented from NonlinearElasticElement::FunctionsToCalculatePiolaKirchhoffI< TYPE >.

Definition at line 206 of file VolumeLengthQuality.hpp.

208  {
210 
212  CHKERR this->dEterminant(this->F, detF);
213  if (this->invF.size1() != 3)
214  this->invF.resize(3, 3);
215 
216  CHKERR this->iNvert(detF, this->F, this->invF);
218  CHKERR calculateQ();
219 
220  double lrms03 = lrmsSquared0 * sqrt(lrmsSquared0);
221  b = detF / (lrmsSquared * sqrt(lrmsSquared) / lrms03);
222 
223  currentVolume = detF * this->opPtr->getVolume();
224  q = 6. * sqrt(2.) * currentVolume / (lrmsSquared * sqrt(lrmsSquared));
225 
226  if (this->P.size1() != 3)
227  this->P.resize(3, 3);
228 
229  switch (tYpe) {
230  case QUALITY:
231  // Only use for testing, simple quality gradient
232  noalias(this->P) = q * Q;
233  break;
234  case BARRIER_AND_QUALITY:
235  // This is used form mesh smoothing
236  tMp = q / (1.0 - gAmma) - 1.0 / (q - gAmma);
237  noalias(this->P) = tMp * Q;
238  break;
240  // Works well with Arbitrary Lagrangian Formulation
241  tMp = b / (1.0 - gAmma) - 1.0 / (b - gAmma);
242  noalias(this->P) = tMp * Q;
243  break;
245  // When scaled by volume works well with ALE and face flipping.
246  // Works well with smooth crack propagation
247  tMp = currentVolume;
248  tMp *= b / (1.0 - gAmma) - 1.0 / (b - gAmma);
249  noalias(this->P) = tMp * Q;
250  break;
251  }
252 
253  // Divide by volume, to make units as they should be
254  this->P *= aLpha / this->opPtr->getVolume();
255 
257  }
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > F
MoFEMErrorCode calculateLrms()
Calculate mean element edge length.
MoFEMErrorCode dEterminant(ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 >> &a, TYPE &det)
Calculate determinant of 3x3 matrix.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > P
MoFEMErrorCode calculateQ()
Calculate Q.
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator * opPtr
pointer to finite element tetrahedral operator
ublas::matrix< TYPE > Q
#define CHKERR
Inline error check.
Definition: definitions.h:596
MoFEMErrorCode getEdgesFromElemCoords()
MoFEMErrorCode iNvert(TYPE det, ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 >> &a, ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 >> &inv_a)
Calculate inverse of 3x3 matrix.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > invF

◆ calculateQ()

template<typename TYPE >
MoFEMErrorCode VolumeLengthQuality< TYPE >::calculateQ ( )

Calculate Q.

\[ \mathbf{Q} = \mathbf{F}^{-\mathsf{T}} - \frac{1}{2} \frac{1}{l^2_\textrm{rms}} \sum_i^6 \Delta\mathbf{X}_i \Delta\boldsymbol\chi_i^\mathsf{T} \]

Definition at line 174 of file VolumeLengthQuality.hpp.

174  {
176  if (Q.size1() == 0) {
177  Q.resize(3, 3);
178  }
179  noalias(Q) = trans(this->invF) - 0.5 * dXdChiT / lrmsSquared;
181  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
ublas::matrix< TYPE > dXdChiT
ublas::matrix< TYPE > Q
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > invF

◆ getEdgesFromElemCoords()

template<typename TYPE >
MoFEMErrorCode VolumeLengthQuality< TYPE >::getEdgesFromElemCoords ( )

Get coordinates of edges using cannonical element numeration

Definition at line 89 of file VolumeLengthQuality.hpp.

89  {
91  if (coordsEdges.empty()) {
92  coordsEdges.resize(6 * 2 * 3, false);
93  }
94  cblas_dcopy(3, &this->opPtr->getCoords()[0 * 3], 1,
95  &coordsEdges[0 * 3 * 2 + 0], 1);
96  cblas_dcopy(3, &this->opPtr->getCoords()[1 * 3], 1,
97  &coordsEdges[0 * 3 * 2 + 3], 1);
98  cblas_dcopy(3, &this->opPtr->getCoords()[0 * 3], 1,
99  &coordsEdges[1 * 3 * 2 + 0], 1);
100  cblas_dcopy(3, &this->opPtr->getCoords()[2 * 3], 1,
101  &coordsEdges[1 * 3 * 2 + 3], 1);
102  cblas_dcopy(3, &this->opPtr->getCoords()[0 * 3], 1,
103  &coordsEdges[2 * 3 * 2 + 0], 1);
104  cblas_dcopy(3, &this->opPtr->getCoords()[3 * 3], 1,
105  &coordsEdges[2 * 3 * 2 + 3], 1);
106  cblas_dcopy(3, &this->opPtr->getCoords()[1 * 3], 1,
107  &coordsEdges[3 * 3 * 2 + 0], 1);
108  cblas_dcopy(3, &this->opPtr->getCoords()[2 * 3], 1,
109  &coordsEdges[3 * 3 * 2 + 3], 1);
110  cblas_dcopy(3, &this->opPtr->getCoords()[1 * 3], 1,
111  &coordsEdges[4 * 3 * 2 + 0], 1);
112  cblas_dcopy(3, &this->opPtr->getCoords()[3 * 3], 1,
113  &coordsEdges[4 * 3 * 2 + 3], 1);
114  cblas_dcopy(3, &this->opPtr->getCoords()[2 * 3], 1,
115  &coordsEdges[5 * 3 * 2 + 0], 1);
116  cblas_dcopy(3, &this->opPtr->getCoords()[3 * 3], 1,
117  &coordsEdges[5 * 3 * 2 + 3], 1);
119  }
void cblas_dcopy(const int N, const double *X, const int incX, double *Y, const int incY)
Definition: cblas_dcopy.c:11
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
MoFEM::VolumeElementForcesAndSourcesCore::UserDataOperator * opPtr
pointer to finite element tetrahedral operator
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

◆ getMaterialOptions()

template<typename TYPE >
MoFEMErrorCode VolumeLengthQuality< TYPE >::getMaterialOptions ( )

Definition at line 60 of file VolumeLengthQuality.hpp.

60  {
62  CHKERR PetscOptionsBegin(PETSC_COMM_WORLD, "",
63  "Get VolumeLengthQuality material options",
64  "none");
65  CHKERR PetscOptionsEList(
66  "-volume_length_type", "Volume length quality type", "",
68  VolumeLengthQualityTypeNames[tYpe], &tYpe, PETSC_NULL);
69  CHKERR PetscOptionsScalar("-volume_length_alpha",
70  "volume length alpha parameter", "", aLpha,
71  &aLpha, PETSC_NULL);
72  CHKERR PetscOptionsScalar("-volume_length_gamma",
73  "volume length parameter (barrier)", "", gAmma,
74  &gAmma, PETSC_NULL);
75  ierr = PetscOptionsEnd();
77  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:501
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
#define CHKERR
Inline error check.
Definition: definitions.h:596
static const char * VolumeLengthQualityTypeNames[]

Member Data Documentation

◆ aLpha

template<typename TYPE >
double VolumeLengthQuality< TYPE >::aLpha

Definition at line 50 of file VolumeLengthQuality.hpp.

◆ b

template<typename TYPE >
TYPE VolumeLengthQuality< TYPE >::b

Definition at line 85 of file VolumeLengthQuality.hpp.

◆ coordsEdges

template<typename TYPE >
VectorDouble VolumeLengthQuality< TYPE >::coordsEdges

Definition at line 79 of file VolumeLengthQuality.hpp.

◆ currentVolume

template<typename TYPE >
TYPE VolumeLengthQuality< TYPE >::currentVolume

Definition at line 85 of file VolumeLengthQuality.hpp.

◆ deltaChi

template<typename TYPE >
VectorDouble VolumeLengthQuality< TYPE >::deltaChi

Definition at line 81 of file VolumeLengthQuality.hpp.

◆ deltaX

template<typename TYPE >
ublas::vector<TYPE> VolumeLengthQuality< TYPE >::deltaX

Definition at line 83 of file VolumeLengthQuality.hpp.

◆ detF

template<typename TYPE >
TYPE VolumeLengthQuality< TYPE >::detF

Definition at line 85 of file VolumeLengthQuality.hpp.

◆ dXdChiT

template<typename TYPE >
ublas::matrix<TYPE> VolumeLengthQuality< TYPE >::dXdChiT

Definition at line 84 of file VolumeLengthQuality.hpp.

◆ gAmma

template<typename TYPE >
double VolumeLengthQuality< TYPE >::gAmma

Definition at line 51 of file VolumeLengthQuality.hpp.

◆ lrmsSquared

template<typename TYPE >
TYPE VolumeLengthQuality< TYPE >::lrmsSquared

Definition at line 85 of file VolumeLengthQuality.hpp.

◆ lrmsSquared0

template<typename TYPE >
double VolumeLengthQuality< TYPE >::lrmsSquared0

Definition at line 80 of file VolumeLengthQuality.hpp.

◆ Q

template<typename TYPE >
ublas::matrix<TYPE> VolumeLengthQuality< TYPE >::Q

Definition at line 84 of file VolumeLengthQuality.hpp.

◆ q

template<typename TYPE >
TYPE VolumeLengthQuality< TYPE >::q

Definition at line 85 of file VolumeLengthQuality.hpp.

◆ tMp

template<typename TYPE >
TYPE VolumeLengthQuality< TYPE >::tMp

Definition at line 85 of file VolumeLengthQuality.hpp.

◆ tYpe

template<typename TYPE >
int VolumeLengthQuality< TYPE >::tYpe

Definition at line 49 of file VolumeLengthQuality.hpp.


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