v0.8.23
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 51 of file VolumeLengthQuality.hpp.

54  tYpe(type), aLpha(alpha), gAmma(gamma) {
56  CHKERRABORT(PETSC_COMM_WORLD, ierr);
57  }
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 139 of file VolumeLengthQuality.hpp.

139  {
141  if (deltaChi.size() != 3) {
142  deltaChi.resize(3);
143  deltaX.resize(3);
144  dXdChiT.resize(3, 3);
145  }
146  lrmsSquared = 0;
147  lrmsSquared0 = 0;
148  dXdChiT.clear();
149  for (int ee = 0; ee < 6; ee++) {
150  for (int dd = 0; dd < 3; dd++) {
151  deltaChi[dd] =
152  coordsEdges[6 * ee + dd] - coordsEdges[6 * ee + 3 + dd];
153  }
154  noalias(deltaX) = prod(this->F, deltaChi);
155  for (int dd = 0; dd < 3; dd++) {
156  lrmsSquared += (1. / 6.) * deltaX[dd] * deltaX[dd];
157  lrmsSquared0 += (1. / 6.) * deltaChi[dd] * deltaChi[dd];
158  }
159  noalias(dXdChiT) += outer_prod(deltaX, deltaChi);
160  }
162  }
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 210 of file VolumeLengthQuality.hpp.

212  {
214 
216  CHKERRG(ierr);
217 
218  ierr = this->dEterminant(this->F, detF);
219  CHKERRG(ierr);
220  if (this->invF.size1() != 3) {
221  this->invF.resize(3, 3);
222  }
223  ierr = this->iNvert(detF, this->F, this->invF);
224  CHKERRG(ierr);
225 
226  ierr = calculateLrms();
227  CHKERRG(ierr);
228  ierr = calculateQ();
229  CHKERRG(ierr);
230 
231  double lrms03 = lrmsSquared0 * sqrt(lrmsSquared0);
232  b = detF / (lrmsSquared * sqrt(lrmsSquared) / lrms03);
233 
234  currentVolume = detF * this->opPtr->getVolume();
235  q = 6. * sqrt(2.) * currentVolume / (lrmsSquared * sqrt(lrmsSquared));
236 
237  // std::cerr << "b " << b << std::endl;
238  // std::cerr << "q " << q << std::endl;
239 
240  if (this->P.size1() != 3) {
241  this->P.resize(3, 3);
242  }
243 
244  switch (tYpe) {
245  case QUALITY:
246  // Only use for testing, simple quality gradient
247  noalias(this->P) = q * Q;
248  break;
249  case BARRIER_AND_QUALITY:
250  // This is used form mesh smoothing
251  tMp = q / (1.0 - gAmma) - 1.0 / (q - gAmma);
252  noalias(this->P) = tMp * Q;
253  break;
255  // Works well with Arbitrary Lagrangian Formulation
256  tMp = b / (1.0 - gAmma) - 1.0 / (b - gAmma);
257  noalias(this->P) = tMp * Q;
258  break;
260  // When scaled by volume works well with ALE and face flipping.
261  // Works well with smooth crack propagation
262  tMp = currentVolume;
263  tMp *= b / (1.0 - gAmma) - 1.0 / (b - gAmma);
264  noalias(this->P) = tMp * Q;
265  break;
266  }
267 
268  // Divide by volume, to make units as they should be
269  this->P *= aLpha / this->opPtr->getVolume();
270 
272  }
ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > F
MoFEMErrorCode calculateLrms()
Calculate mean element edge length.
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 MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:544
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
MoFEMErrorCode dEterminant(ublas::matrix< TYPE, ublas::row_major, ublas::bounded_array< TYPE, 9 > > &a, TYPE &det)
Calculate determinant of 3x3 matrix.
MoFEMErrorCode getEdgesFromElemCoords()
#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 178 of file VolumeLengthQuality.hpp.

178  {
180  if (Q.size1() == 0) {
181  Q.resize(3, 3);
182  }
183  noalias(Q) = trans(this->invF) - 0.5 * dXdChiT / lrmsSquared;
185  }
#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 92 of file VolumeLengthQuality.hpp.

92  {
94  if (coordsEdges.empty()) {
95  coordsEdges.resize(6 * 2 * 3, false);
96  }
97  cblas_dcopy(3, &this->opPtr->getCoords()[0 * 3], 1,
98  &coordsEdges[0 * 3 * 2 + 0], 1);
99  cblas_dcopy(3, &this->opPtr->getCoords()[1 * 3], 1,
100  &coordsEdges[0 * 3 * 2 + 3], 1);
101  cblas_dcopy(3, &this->opPtr->getCoords()[0 * 3], 1,
102  &coordsEdges[1 * 3 * 2 + 0], 1);
103  cblas_dcopy(3, &this->opPtr->getCoords()[2 * 3], 1,
104  &coordsEdges[1 * 3 * 2 + 3], 1);
105  cblas_dcopy(3, &this->opPtr->getCoords()[0 * 3], 1,
106  &coordsEdges[2 * 3 * 2 + 0], 1);
107  cblas_dcopy(3, &this->opPtr->getCoords()[3 * 3], 1,
108  &coordsEdges[2 * 3 * 2 + 3], 1);
109  cblas_dcopy(3, &this->opPtr->getCoords()[1 * 3], 1,
110  &coordsEdges[3 * 3 * 2 + 0], 1);
111  cblas_dcopy(3, &this->opPtr->getCoords()[2 * 3], 1,
112  &coordsEdges[3 * 3 * 2 + 3], 1);
113  cblas_dcopy(3, &this->opPtr->getCoords()[1 * 3], 1,
114  &coordsEdges[4 * 3 * 2 + 0], 1);
115  cblas_dcopy(3, &this->opPtr->getCoords()[3 * 3], 1,
116  &coordsEdges[4 * 3 * 2 + 3], 1);
117  cblas_dcopy(3, &this->opPtr->getCoords()[2 * 3], 1,
118  &coordsEdges[5 * 3 * 2 + 0], 1);
119  cblas_dcopy(3, &this->opPtr->getCoords()[3 * 3], 1,
120  &coordsEdges[5 * 3 * 2 + 3], 1);
122  }
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 59 of file VolumeLengthQuality.hpp.

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

Member Data Documentation

◆ aLpha

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

Definition at line 48 of file VolumeLengthQuality.hpp.

◆ b

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

Definition at line 88 of file VolumeLengthQuality.hpp.

◆ coordsEdges

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

Definition at line 82 of file VolumeLengthQuality.hpp.

◆ currentVolume

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

Definition at line 88 of file VolumeLengthQuality.hpp.

◆ deltaChi

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

Definition at line 84 of file VolumeLengthQuality.hpp.

◆ deltaX

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

Definition at line 86 of file VolumeLengthQuality.hpp.

◆ detF

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

Definition at line 88 of file VolumeLengthQuality.hpp.

◆ dXdChiT

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

Definition at line 87 of file VolumeLengthQuality.hpp.

◆ gAmma

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

Definition at line 49 of file VolumeLengthQuality.hpp.

◆ lrmsSquared

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

Definition at line 88 of file VolumeLengthQuality.hpp.

◆ lrmsSquared0

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

Definition at line 83 of file VolumeLengthQuality.hpp.

◆ Q

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

Definition at line 87 of file VolumeLengthQuality.hpp.

◆ q

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

Definition at line 88 of file VolumeLengthQuality.hpp.

◆ tMp

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

Definition at line 88 of file VolumeLengthQuality.hpp.

◆ tYpe

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

Definition at line 47 of file VolumeLengthQuality.hpp.


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