constitutive_laws.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2022 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 // Header file for ConstitutiveLaw objects that will be used in all
27 // elasticity-type elements
28 
29 #ifndef OOMPH_CONSTITUTIVE_LAWS_HEADER
30 #define OOMPH_CONSTITUTIVE_LAWS_HEADER
31 
32 // Config header generated by autoconfig
33 #ifdef HAVE_CONFIG_H
34 #include <oomph-lib-config.h>
35 #endif
36 
37 // OOMPH-LIB includes
38 #include "../generic/oomph_utilities.h"
39 #include "../generic/matrices.h"
40 
41 namespace oomph
42 {
43  //=====================================================================
46  //====================================================================
48  {
49  public:
52 
54  virtual ~StrainEnergyFunction() {}
55 
56 
58  virtual double W(const DenseMatrix<double>& gamma)
59  {
60  std::string error_message =
61  "The strain-energy function as a function of the strain-tensor,\n";
62  error_message +=
63  "gamma, is not implemented for this strain energy function.\n";
64 
65  throw OomphLibError(
67  return 0.0;
68  }
69 
70 
72  virtual double W(const Vector<double>& I)
73  {
74  std::string error_message =
75  "The strain-energy function as a function of the strain\n ";
76  error_message +=
77  "invariants, I1, I2, I3, is not implemented for this strain\n ";
78  error_message += "energy function\n";
79 
80  throw OomphLibError(
82  return 0.0;
83  }
84 
85 
89  virtual void derivative(const DenseMatrix<double>& gamma,
90  DenseMatrix<double>& dWdgamma)
91  {
92  throw OomphLibError(
93  "Sorry, the FD setup of dW/dgamma hasn't been implemented yet",
96  }
97 
98 
103  {
104  // Calculate the derivatives of the strain-energy-function wrt the strain
105  // invariants
106  double FD_Jstep = 1.0e-8; // Usual comments about global stuff
107  double energy = W(I);
108 
109  // Loop over the strain invariants
110  for (unsigned i = 0; i < 3; i++)
111  {
112  // Store old value
113  double I_prev = I[i];
114  // Increase ith strain invariant
115  I[i] += FD_Jstep;
116  // Get the new value of the strain energy
117  double energy_new = W(I);
118  // Calculate the value of the derivative
119  dWdI[i] = (energy_new - energy) / FD_Jstep;
120  // Reset value of ith strain invariant
121  I[i] = I_prev;
122  }
123  }
124 
130  };
131 
132 
136 
137 
138  //=====================================================================
143  //====================================================================
145  {
146  public:
148  MooneyRivlin(double* c1_pt, double* c2_pt)
149  : StrainEnergyFunction(), C1_pt(c1_pt), C2_pt(c2_pt)
150  {
151  }
152 
154  virtual ~MooneyRivlin() {}
155 
157  double W(const DenseMatrix<double>& gamma)
158  {
160  }
161 
163  double W(const Vector<double>& I)
164  {
165  return (*C1_pt) * (I[0] - 3.0) + (*C2_pt) * (I[1] - 3.0);
166  }
167 
168 
172  {
173  dWdI[0] = (*C1_pt);
174  dWdI[1] = (*C2_pt);
175  dWdI[2] = 0.0;
176  }
177 
183  {
184  return true;
185  }
186 
187 
188  private:
190  double* C1_pt;
191 
193  double* C2_pt;
194  };
195 
196 
200 
201 
202  //=====================================================================
213  //====================================================================
215  {
216  public:
220  GeneralisedMooneyRivlin(double* nu_pt, double* c1_pt)
222  Nu_pt(nu_pt),
223  C1_pt(c1_pt),
224  E_pt(new double(1.0)),
225  Must_delete_e(true)
226  {
227  }
228 
231  GeneralisedMooneyRivlin(double* nu_pt, double* c1_pt, double* e_pt)
233  Nu_pt(nu_pt),
234  C1_pt(c1_pt),
235  E_pt(e_pt),
236  Must_delete_e(false)
237  {
238  }
239 
240 
243  {
244  if (Must_delete_e) delete E_pt;
245  }
246 
248  double W(const DenseMatrix<double>& gamma)
249  {
251  }
252 
253 
255  double W(const Vector<double>& I)
256  {
257  double G = (*E_pt) / (2.0 * (1.0 + (*Nu_pt)));
258  return 0.5 * ((*C1_pt) * (I[0] - 3.0) + (G - (*C1_pt)) * (I[1] - 3.0) +
259  ((*C1_pt) - 2.0 * G) * (I[2] - 1.0) +
260  (1.0 - (*Nu_pt)) * G * (I[2] - 1.0) * (I[2] - 1.0) /
261  (2.0 * (1.0 - 2.0 * (*Nu_pt))));
262  }
263 
264 
268  {
269  double G = (*E_pt) / (2.0 * (1.0 + (*Nu_pt)));
270  dWdI[0] = 0.5 * (*C1_pt);
271  dWdI[1] = 0.5 * (G - (*C1_pt));
272  dWdI[2] = 0.5 * ((*C1_pt) - 2.0 * G +
273  2.0 * (1.0 - (*Nu_pt)) * G * (I[2] - 1.0) /
274  (2.0 * (1.0 - 2.0 * (*Nu_pt))));
275  }
276 
277 
283  {
284  return false;
285  }
286 
287  private:
289  double* Nu_pt;
290 
292  double* C1_pt;
293 
295  double* E_pt;
296 
300  };
301 
302 
306 
307 
308  //===========================================================================
469  //==========================================================================
471  {
472  protected:
475 
478  const DenseMatrix<double>& M2);
479 
483  const DenseMatrix<double>& G,
485 
488  double calculate_contravariant(const DenseMatrix<double>& Gcov,
489  DenseMatrix<double>& Gcontra);
490 
495  RankFourTensor<double>& dGcontra_dG,
496  DenseMatrix<double>& d_detG_dG);
497 
498 
499  public:
502 
503 
505  virtual ~ConstitutiveLaw() {}
506 
507 
513  const DenseMatrix<double>& g,
514  const DenseMatrix<double>& G,
516 
530  const DenseMatrix<double>& g,
531  const DenseMatrix<double>& G,
532  const DenseMatrix<double>& sigma,
533  RankFourTensor<double>& d_sigma_dG,
534  const bool& symmetrize_tensor = true);
535 
536 
548  const DenseMatrix<double>& g,
549  const DenseMatrix<double>& G,
550  DenseMatrix<double>& sigma_dev,
551  DenseMatrix<double>& G_contra,
552  double& Gdet)
553  {
554  throw OomphLibError(
555  "Incompressible formulation not implemented for this constitutive law",
558  }
559 
574  const DenseMatrix<double>& g,
575  const DenseMatrix<double>& G,
576  const DenseMatrix<double>& sigma,
577  const double& detG,
578  const double& interpolated_solid_p,
579  RankFourTensor<double>& d_sigma_dG,
580  DenseMatrix<double>& d_detG_dG,
581  const bool& symmetrize_tensor = true);
582 
583 
593  const DenseMatrix<double>& g,
594  const DenseMatrix<double>& G,
595  DenseMatrix<double>& sigma_dev,
596  DenseMatrix<double>& Gcontra,
597  double& gen_dil,
598  double& inv_kappa)
599  {
600  throw OomphLibError(
601  "Near-incompressible formulation not implemented for constitutive law",
604  }
605 
617  const DenseMatrix<double>& g,
618  const DenseMatrix<double>& G,
619  const DenseMatrix<double>& sigma,
620  const double& gen_dil,
621  const double& inv_kappa,
622  const double& interpolated_solid_p,
623  RankFourTensor<double>& d_sigma_dG,
624  DenseMatrix<double>& d_gen_dil_dG,
625  const bool& symmetrize_tensor = true);
626 
627 
633  };
634 
635 
639 
640 
641  //========================================================================
697  //=========================================================================
699  {
700  public:
703  GeneralisedHookean(double* nu_pt, double* e_pt)
704  : ConstitutiveLaw(), Nu_pt(nu_pt), E_pt(e_pt), Must_delete_e(false)
705  {
706  }
707 
712  GeneralisedHookean(double* nu_pt)
713  : ConstitutiveLaw(),
714  Nu_pt(nu_pt),
715  E_pt(new double(1.0)),
716  Must_delete_e(true)
717  {
718  }
719 
720 
723  {
724  if (Must_delete_e) delete E_pt;
725  }
726 
732  const DenseMatrix<double>& G,
734 
735 
747  const DenseMatrix<double>& G,
748  DenseMatrix<double>& sigma_dev,
749  DenseMatrix<double>& G_contra,
750  double& Gdet);
751 
752 
762  const DenseMatrix<double>& G,
763  DenseMatrix<double>& sigma_dev,
764  DenseMatrix<double>& Gcontra,
765  double& gen_dil,
766  double& inv_kappa);
767 
768 
774  {
775  return false;
776  }
777 
778  private:
780  double* Nu_pt;
781 
783  double* E_pt;
784 
788  };
789 
790 
794 
795 
796  //=====================================================================
799  //=====================================================================
801  {
802  private:
805 
806  public:
809  StrainEnergyFunction* const& strain_energy_function_pt)
810  : ConstitutiveLaw(), Strain_energy_function_pt(strain_energy_function_pt)
811  {
812  }
813 
820  const DenseMatrix<double>& G,
822 
823 
835  const DenseMatrix<double>& G,
836  DenseMatrix<double>& sigma_dev,
837  DenseMatrix<double>& G_contra,
838  double& Gdet);
839 
840 
850  const DenseMatrix<double>& G,
851  DenseMatrix<double>& sigma_dev,
852  DenseMatrix<double>& Gcontra,
853  double& gen_dil,
854  double& inv_kappa);
855 
856 
862  {
864  }
865  };
866 
867 } // namespace oomph
868 
869 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
JacobiRotation< float > G
Definition: Jacobi_makeGivens.cpp:2
M1<< 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12;Map< MatrixXf > M2(M1.data(), 6, 2)
MatrixXf M1
Definition: Tutorial_SlicingCol.cpp:1
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
Definition: constitutive_laws.h:471
void error_checking_in_input(const DenseMatrix< double > &g, const DenseMatrix< double > &G, DenseMatrix< double > &sigma)
Definition: constitutive_laws.cc:71
virtual void calculate_second_piola_kirchhoff_stress(const DenseMatrix< double > &g, const DenseMatrix< double > &G, DenseMatrix< double > &sigma_dev, DenseMatrix< double > &Gcontra, double &gen_dil, double &inv_kappa)
Definition: constitutive_laws.h:592
virtual bool requires_incompressibility_constraint()=0
double calculate_contravariant(const DenseMatrix< double > &Gcov, DenseMatrix< double > &Gcontra)
The function to calculate the contravariant tensor from a covariant one.
Definition: constitutive_laws.cc:113
virtual void calculate_d_second_piola_kirchhoff_stress_dG(const DenseMatrix< double > &g, const DenseMatrix< double > &G, const DenseMatrix< double > &sigma, RankFourTensor< double > &d_sigma_dG, const bool &symmetrize_tensor=true)
Definition: constitutive_laws.cc:352
void calculate_d_contravariant_dG(const DenseMatrix< double > &Gcov, RankFourTensor< double > &dGcontra_dG, DenseMatrix< double > &d_detG_dG)
Definition: constitutive_laws.cc:225
bool is_matrix_square(const DenseMatrix< double > &M)
Test whether a matrix is square.
Definition: constitutive_laws.cc:36
ConstitutiveLaw()
Empty constructor.
Definition: constitutive_laws.h:501
bool are_matrices_of_equal_dimensions(const DenseMatrix< double > &M1, const DenseMatrix< double > &M2)
Test whether two matrices are of equal dimensions.
Definition: constitutive_laws.cc:52
virtual void calculate_second_piola_kirchhoff_stress(const DenseMatrix< double > &g, const DenseMatrix< double > &G, DenseMatrix< double > &sigma)=0
virtual ~ConstitutiveLaw()
Empty virtual destructor.
Definition: constitutive_laws.h:505
virtual void calculate_second_piola_kirchhoff_stress(const DenseMatrix< double > &g, const DenseMatrix< double > &G, DenseMatrix< double > &sigma_dev, DenseMatrix< double > &G_contra, double &Gdet)
Definition: constitutive_laws.h:547
Definition: constitutive_laws.h:699
virtual ~GeneralisedHookean()
Virtual destructor.
Definition: constitutive_laws.h:722
bool Must_delete_e
Definition: constitutive_laws.h:787
GeneralisedHookean(double *nu_pt)
Definition: constitutive_laws.h:712
void calculate_second_piola_kirchhoff_stress(const DenseMatrix< double > &g, const DenseMatrix< double > &G, DenseMatrix< double > &sigma)
Definition: constitutive_laws.cc:682
double * E_pt
Young's modulus.
Definition: constitutive_laws.h:783
bool requires_incompressibility_constraint()
Definition: constitutive_laws.h:773
double * Nu_pt
Poisson ratio.
Definition: constitutive_laws.h:780
GeneralisedHookean(double *nu_pt, double *e_pt)
Definition: constitutive_laws.h:703
Definition: constitutive_laws.h:215
GeneralisedMooneyRivlin(double *nu_pt, double *c1_pt)
Definition: constitutive_laws.h:220
bool requires_incompressibility_constraint()
Definition: constitutive_laws.h:282
double W(const Vector< double > &I)
Return the strain energy in terms of the strain invariants.
Definition: constitutive_laws.h:255
bool Must_delete_e
Definition: constitutive_laws.h:299
double * E_pt
Young's modulus.
Definition: constitutive_laws.h:295
GeneralisedMooneyRivlin(double *nu_pt, double *c1_pt, double *e_pt)
Definition: constitutive_laws.h:231
virtual ~GeneralisedMooneyRivlin()
Virtual destructor.
Definition: constitutive_laws.h:242
double W(const DenseMatrix< double > &gamma)
Return the strain energy in terms of strain tensor.
Definition: constitutive_laws.h:248
void derivatives(Vector< double > &I, Vector< double > &dWdI)
Definition: constitutive_laws.h:267
double * Nu_pt
Poisson's ratio.
Definition: constitutive_laws.h:289
double * C1_pt
Mooney-Rivlin parameter.
Definition: constitutive_laws.h:292
Definition: constitutive_laws.h:801
StrainEnergyFunction * Strain_energy_function_pt
Pointer to the strain energy function.
Definition: constitutive_laws.h:804
bool requires_incompressibility_constraint()
Definition: constitutive_laws.h:861
IsotropicStrainEnergyFunctionConstitutiveLaw(StrainEnergyFunction *const &strain_energy_function_pt)
Constructor takes a pointer to the strain energy function.
Definition: constitutive_laws.h:808
void calculate_second_piola_kirchhoff_stress(const DenseMatrix< double > &g, const DenseMatrix< double > &G, DenseMatrix< double > &sigma)
Definition: constitutive_laws.cc:896
Definition: constitutive_laws.h:145
void derivatives(Vector< double > &I, Vector< double > &dWdI)
Definition: constitutive_laws.h:171
double * C2_pt
Pointer to second Mooney Rivlin constant.
Definition: constitutive_laws.h:193
virtual ~MooneyRivlin()
Empty Virtual destructor.
Definition: constitutive_laws.h:154
double W(const DenseMatrix< double > &gamma)
Return the strain energy in terms of strain tensor.
Definition: constitutive_laws.h:157
double W(const Vector< double > &I)
Return the strain energy in terms of the strain invariants.
Definition: constitutive_laws.h:163
double * C1_pt
Pointer to first Mooney Rivlin constant.
Definition: constitutive_laws.h:190
MooneyRivlin(double *c1_pt, double *c2_pt)
Constructor takes the pointer to the value of the constants.
Definition: constitutive_laws.h:148
bool requires_incompressibility_constraint()
Definition: constitutive_laws.h:182
Definition: oomph_definitions.h:222
A Rank 4 Tensor class.
Definition: matrices.h:1701
Definition: constitutive_laws.h:48
StrainEnergyFunction()
Constructor takes no arguments.
Definition: constitutive_laws.h:51
virtual bool requires_incompressibility_constraint()=0
virtual void derivative(const DenseMatrix< double > &gamma, DenseMatrix< double > &dWdgamma)
Definition: constitutive_laws.h:89
virtual ~StrainEnergyFunction()
Empty virtual destructor.
Definition: constitutive_laws.h:54
virtual double W(const DenseMatrix< double > &gamma)
Return the strain energy in terms of the strain tensor.
Definition: constitutive_laws.h:58
virtual void derivatives(Vector< double > &I, Vector< double > &dWdI)
Definition: constitutive_laws.h:102
virtual double W(const Vector< double > &I)
Return the strain energy in terms of the strain invariants.
Definition: constitutive_laws.h:72
#define I
Definition: main.h:127
int sigma
Definition: calibrate.py:179
Mdouble gamma(Mdouble gamma_in)
This is the gamma function returns the true value for the half integer value.
Definition: ExtendedMath.cc:116
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86