Chaste Commit::ca8ccdedf819b6e02855bc0e8e6f50bdecbc5208
AbstractIsotropicIncompressibleMaterialLaw.cpp
1/*
2
3Copyright (c) 2005-2024, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright notice,
15 this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 * Neither the name of the University of Oxford nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35
36#include "AbstractIsotropicIncompressibleMaterialLaw.hpp"
37
38template<unsigned DIM>
42
43template<unsigned DIM>
45 c_matrix<double,DIM,DIM>& rC,
46 c_matrix<double,DIM,DIM>& rInvC,
47 double pressure,
48 c_matrix<double,DIM,DIM>& rT,
50 bool computeDTdE)
51{
52 assert((DIM==2) || (DIM==3)); // LCOV_EXCL_LINE
53
54 static c_matrix<double,DIM,DIM> identity = identity_matrix<double>(DIM);
55
56 double I1 = Trace(rC);
57 double I2 = SecondInvariant(rC);
58
59 double w1 = Get_dW_dI1(I1, I2);
60 double w2; // only computed if DIM==3
61
62 // Compute stress: **** See FiniteElementImplementations document. ****
63 //
64 // T = dW_dE
65 // = 2 * w1 * dI1_dC_MN + 2 * w2 * dI1_dC_MN - p * invC
66 // = 2 * w1 * delta_MN + 2 * w2 * (I1 delta_MN - C_MN) - p * invC
67 //
68 // (where w1 = dW/dI1, etc).
69
70 rT = 2*w1*identity - pressure*rInvC;
71 if (DIM==3)
72 {
73 w2 = Get_dW_dI2(I1, I2);
74 rT += 2*w2*(I1*identity - rC);
75 }
76
77 // Compute stress derivative if required: **** See FiniteElementImplementations document. ****
78 //
79 // The stress derivative dT_{MN}/dE_{PQ} is
80 //
81 // dT_dE = 4 * w11 * dI1_dC_MN * dI1_dC_PQ
82 // + 4 * w1 * d2I1_dC2
83 // + 4 * w22 * dI2_dC_MN * dI2_dC_PQ
84 // + 4 * w2 * d2I2_dC2
85 // + 4 * w12 * (dI1_dC_MN*dI2_dC_PQ + dI1_dC_PQ*dI2_dC_MN)
86 // - 2 * pressure * d_invC_dC;
87 //
88 // where
89 // dI1_dC_MN = (M==N); // ie delta_{MN}
90 // dI1_dC_PQ = (P==Q);
91 // d2I1_dC2 = 0;
92 //
93 // dI2_dC_MN = I1*(M==N)-C[M][N];
94 // dI2_dC_PQ = I1*(P==Q)-C[P][Q];
95 // d2I2_dC2 = (M==N)*(P==Q)-(M==P)*(N==Q);
96 //
97 // d_invC_dC = -invC[M][P]*invC[Q][N];
98 //
99 if (computeDTdE)
100 {
101 double w11 = Get_d2W_dI1(I1,I2);
102
103 double w12;
104 double w22;
105
106 if (DIM==3)
107 {
108 w22 = Get_d2W_dI2(I1, I2);
109 w12 = Get_d2W_dI1I2(I1, I2);
110 }
111
112 for (unsigned M=0; M<DIM; M++)
113 {
114 for (unsigned N=0; N<DIM; N++)
115 {
116 for (unsigned P=0; P<DIM; P++)
117 {
118 for (unsigned Q=0; Q<DIM; Q++)
119 {
120 rDTdE(M,N,P,Q) = 4 * w11 * (M==N) * (P==Q)
121 + 2 * pressure * rInvC(M,P) * rInvC(Q,N);
122
123 if (DIM==3)
124 {
125 rDTdE(M,N,P,Q) += 4 * w22 * (I1*(M==N) - rC(M,N)) * (I1*(P==Q) - rC(P,Q))
126 + 4 * w2 * ((M==N)*(P==Q) - (M==P)*(N==Q))
127 + 4 * w12 * ((M==N)*(I1*(P==Q) - rC(P,Q)) + (P==Q)*(I1*(M==N) - rC(M,N)));
128 }
129 }
130 }
131 }
133 }
134}
135
136template <unsigned DIM>
138{
139 if constexpr (DIM == 2)
140 {
141 return 2 * Get_dW_dI1(2, 0);
143 else if constexpr (DIM == 3)
144 {
145 return 2 * Get_dW_dI1(3, 3) + 4 * Get_dW_dI2(3, 3);
146 }
147 else
148 {
150 }
152
153// Explicit instantiation
#define NEVER_REACHED
T SecondInvariant(const c_matrix< T, 3, 3 > &rM)
T Trace(const c_matrix< T, 1, 1 > &rM)
void ComputeStressAndStressDerivative(c_matrix< double, DIM, DIM > &rC, c_matrix< double, DIM, DIM > &rInvC, double pressure, c_matrix< double, DIM, DIM > &rT, FourthOrderTensor< DIM, DIM, DIM, DIM > &rDTdE, bool computeDTdE)