1(example-petsc-elasticity)= 2 3# Solid mechanics mini-app 4 5This example is located in the subdirectory {file}`examples/solids`. 6It solves the steady-state static momentum balance equations using unstructured high-order finite/spectral element spatial discretizations. 7As for the {ref}`example-petsc-navier-stokes` case, the solid mechanics elasticity example has been developed using PETSc, so that the pointwise physics (defined at quadrature points) is separated from the parallelization and meshing concerns. 8 9In this mini-app, we consider three formulations used in solid mechanics applications: linear elasticity, Neo-Hookean hyperelasticity at small strain, and Neo-Hookean hyperelasticity at finite strain. 10We provide the strong and weak forms of static balance of linear momentum in the small strain and finite strain regimes. 11The stress-strain relationship (constitutive law) for each of the material models is provided. 12Due to the nonlinearity of material models in Neo-Hookean hyperelasticity, the Newton linearization of the material models is provided. 13 14:::{note} 15Linear elasticity and small-strain hyperelasticity can both by obtained from the finite-strain hyperelastic formulation by linearization of geometric and constitutive nonlinearities. 16The effect of these linearizations is sketched in the diagram below, where $\bm \sigma$ and $\bm \epsilon$ are stress and strain, respectively, in the small strain regime, while $\bm S$ and $\bm E$ are their finite-strain generalizations (second Piola-Kirchoff tensor and Green-Lagrange strain tensor, respectively) defined in the initial configuration, and $\mathsf C$ is a linearized constitutive model. 17 18$$ 19\begin{CD} 20 {\overbrace{\bm S(\bm E)}^{\text{Finite Strain Hyperelastic}}} 21 @>{\text{constitutive}}>{\text{linearization}}> 22 {\overbrace{\bm S = \mathsf C \bm E}^{\text{St. Venant-Kirchoff}}} \\ 23 @V{\text{geometric}}V{\begin{smallmatrix}\bm E \to \bm \epsilon \\ \bm S \to \bm \sigma \end{smallmatrix}}V 24 @V{\begin{smallmatrix}\bm E \to \bm \epsilon \\ \bm S \to \bm \sigma \end{smallmatrix}}V{\text{geometric}}V \\ 25 {\underbrace{\bm \sigma(\bm \epsilon)}_\text{Small Strain Hyperelastic}} 26 @>{\text{constitutive}}>\text{linearization}> 27 {\underbrace{\bm \sigma = \mathsf C \bm \epsilon}_\text{Linear Elastic}} 28\end{CD} 29$$ (hyperelastic-cd) 30::: 31 32(running-elasticity)= 33 34## Running the mini-app 35 36```{include} README.md 37:start-after: inclusion-solids-marker 38``` 39 40(problem-linear-elasticity)= 41 42## Linear Elasticity 43 44The strong form of the static balance of linear momentum at small strain for the three-dimensional linear elasticity problem is given by {cite}`hughes2012finite`: 45 46$$ 47\nabla \cdot \bm{\sigma} + \bm{g} = \bm{0} 48$$ (lin-elas) 49 50where $\bm{\sigma}$ and $\bm{g}$ are stress and forcing functions, respectively. 51We multiply {math:numref}`lin-elas` by a test function $\bm v$ and integrate the divergence term by parts to arrive at the weak form: find $\bm u \in \mathcal V \subset H^1(\Omega)$ such that 52 53$$ 54\int_{\Omega}{ \nabla \bm{v} \tcolon \bm{\sigma}} \, dV 55- \int_{\partial \Omega}{\bm{v} \cdot \left(\bm{\sigma} \cdot \hat{\bm{n}}\right)} \, dS 56- \int_{\Omega}{\bm{v} \cdot \bm{g}} \, dV 57= 0, \quad \forall \bm v \in \mathcal V, 58$$ (lin-elas-weak) 59 60where $\bm{\sigma} \cdot \hat{\bm{n}}|_{\partial \Omega}$ is replaced by an applied force/traction boundary condition written in terms of the initial configuration. 61When inhomogeneous Dirichlet boundary conditions are present, $\mathcal V$ is an affine space that satisfies those boundary conditions. 62 63### Constitutive modeling 64 65In their most general form, constitutive models define $\bm \sigma$ in terms of state variables. 66In the model taken into consideration in the present mini-app, the state variables are constituted by the vector displacement field $\bm u$, and its gradient $\nabla \bm u$. 67We begin by defining the symmetric (small/infintesimal) strain tensor as 68 69$$ 70\bm{\epsilon} = \dfrac{1}{2}\left(\nabla \bm{u} + \nabla \bm{u}^T \right). 71$$ (small-strain) 72 73This constitutive model $\bm \sigma(\bm \epsilon)$ is a linear tensor-valued function of a tensor-valued input, but we will consider the more general nonlinear case in other models below. 74In these cases, an arbitrary choice of such a function will generally not be invariant under orthogonal transformations and thus will not admissible as a physical model must not depend on the coordinate system chosen to express it. 75In particular, given an orthogonal transformation $Q$, we desire 76 77$$ 78Q \bm \sigma(\bm \epsilon) Q^T = \bm \sigma(Q \bm \epsilon Q^T), 79$$ (elastic-invariance) 80 81which means that we can change our reference frame before or after computing $\bm \sigma$, and get the same result either way. 82Constitutive relations in which $\bm \sigma$ is uniquely determined by $\bm \epsilon$ while satisfying the invariance property {math:numref}`elastic-invariance` are known as Cauchy elastic materials. 83Here, we define a strain energy density functional $\Phi(\bm \epsilon) \in \mathbb R$ and obtain the strain energy from its gradient, 84 85$$ 86\bm \sigma(\bm \epsilon) = \frac{\partial \Phi}{\partial \bm \epsilon}. 87$$ (strain-energy-grad) 88 89:::{note} 90The strain energy density functional cannot be an arbitrary function $\Phi(\bm \epsilon)$; it can only depend on *invariants*, scalar-valued functions $\gamma$ satisfying 91 92$$ 93\gamma(\bm \epsilon) = \gamma(Q \bm \epsilon Q^T) 94$$ 95 96for all orthogonal matrices $Q$. 97::: 98 99For the linear elasticity model, the strain energy density is given by 100 101$$ 102\bm{\Phi} = \frac{\lambda}{2} (\operatorname{trace} \bm{\epsilon})^2 + \mu \bm{\epsilon} : \bm{\epsilon} . 103$$ 104 105The constitutive law (stress-strain relationship) is therefore given by its gradient, 106 107$$ 108\bm\sigma = \lambda (\operatorname{trace} \bm\epsilon) \bm I_3 + 2 \mu \bm\epsilon, 109$$ 110 111where $\bm I_3$ is the $3 \times 3$ identity matrix, the colon represents a double contraction (over both indices of $\bm \epsilon$), and the Lamé parameters are given by 112 113$$ 114\begin{aligned} \lambda &= \frac{E \nu}{(1 + \nu)(1 - 2 \nu)} \\ \mu &= \frac{E}{2(1 + \nu)} \end{aligned}. 115$$ 116 117The constitutive law (stress-strain relationship) can also be written as 118 119$$ 120\bm{\sigma} = \mathsf{C} \!:\! \bm{\epsilon}. 121$$ (linear-stress-strain) 122 123For notational convenience, we express the symmetric second order tensors $\bm \sigma$ and $\bm \epsilon$ as vectors of length 6 using the [Voigt notation](https://en.wikipedia.org/wiki/Voigt_notation). 124Hence, the fourth order elasticity tensor $\mathsf C$ (also known as elastic moduli tensor or material stiffness tensor) can be represented as 125 126$$ 127\mathsf C = \begin{pmatrix} 128\lambda + 2\mu & \lambda & \lambda & & & \\ 129\lambda & \lambda + 2\mu & \lambda & & & \\ 130\lambda & \lambda & \lambda + 2\mu & & & \\ 131& & & \mu & & \\ 132& & & & \mu & \\ 133& & & & & \mu 134\end{pmatrix}. 135$$ (linear-elasticity-tensor) 136 137Note that the incompressible limit $\nu \to \frac 1 2$ causes $\lambda \to \infty$, and thus $\mathsf C$ becomes singular. 138 139(problem-hyper-small-strain)= 140 141## Hyperelasticity at Small Strain 142 143The strong and weak forms given above, in {math:numref}`lin-elas` and {math:numref}`lin-elas-weak`, are valid for Neo-Hookean hyperelasticity at small strain. 144However, the strain energy density differs and is given by 145 146$$ 147\bm{\Phi} = \lambda (1 + \operatorname{trace} \bm{\epsilon}) (\log(1 + \operatorname{trace} \bm\epsilon) - 1) + \mu \bm{\epsilon} : \bm{\epsilon} . 148$$ 149 150As above, we have the corresponding constitutive law given by 151 152$$ 153\bm{\sigma} = \lambda \log(1 + \operatorname{trace} \bm\epsilon) \bm{I}_3 + 2\mu \bm{\epsilon} 154$$ (eq-neo-hookean-small-strain) 155 156where $\bm{\epsilon}$ is defined as in {math:numref}`small-strain`. 157 158### Newton linearization 159 160Due to nonlinearity in the constitutive law, we require a Newton linearization of {math:numref}`eq-neo-hookean-small-strain`. 161To derive the Newton linearization, we begin by expressing the derivative, 162 163$$ 164\diff \bm{\sigma} = \dfrac{\partial \bm{\sigma}}{\partial \bm{\epsilon}} \tcolon \diff \bm{\epsilon} 165$$ 166 167where 168 169$$ 170\diff \bm{\epsilon} = \dfrac{1}{2}\left( \nabla \diff \bm{u} + \nabla \diff \bm{u}^T \right) 171$$ 172 173and 174 175$$ 176\diff \nabla \bm{u} = \nabla \diff \bm{u} . 177$$ 178 179Therefore, 180 181$$ 182\diff \bm{\sigma} = \bar{\lambda} \cdot \operatorname{trace} \diff \bm{\epsilon} \cdot \bm{I}_3 + 2\mu \diff \bm{\epsilon} 183$$ (derss) 184 185where we have introduced the symbol 186 187$$ 188\bar{\lambda} = \dfrac{\lambda}{1 + \epsilon_v } 189$$ 190 191where volumetric strain is given by $\epsilon_v = \sum_i \epsilon_{ii}$. 192 193Equation {math:numref}`derss` can be written in Voigt matrix notation as follows: 194 195$$ 196\begin{pmatrix} 197 \diff \sigma_{11} \\ 198 \diff \sigma_{22} \\ 199 \diff \sigma_{33} \\ 200 \diff \sigma_{23} \\ 201 \diff \sigma_{13} \\ 202 \diff \sigma_{12} 203\end{pmatrix} = 204\begin{pmatrix} 205 2 \mu +\bar{\lambda} & \bar{\lambda} & \bar{\lambda} & & & \\ 206 \bar{\lambda} & 2 \mu +\bar{\lambda} & \bar{\lambda} & & & \\ 207 \bar{\lambda} & \bar{\lambda} & 2 \mu +\bar{\lambda} & & & \\ 208 & & & \mu & & \\ 209 & & & & \mu & \\ 210 & & & & & \mu \\ 211\end{pmatrix} 212\begin{pmatrix} 213 \diff \epsilon_{11} \\ 214 \diff \epsilon_{22} \\ 215 \diff \epsilon_{33} \\ 216 2 \diff \epsilon_{23} \\ 217 2 \diff \epsilon_{13} \\ 218 2 \diff \epsilon_{12} 219\end{pmatrix}. 220$$ (mdss) 221 222(problem-hyperelasticity-finite-strain)= 223 224## Hyperelasticity at Finite Strain 225 226In the *total Lagrangian* approach for the Neo-Hookean hyperelasticity problem, the discrete equations are formulated with respect to the initial configuration. 227In this formulation, we solve for displacement $\bm u(\bm X)$ in the reference frame $\bm X$. 228The notation for elasticity at finite strain is inspired by {cite}`holzapfel2000nonlinear` to distinguish between the current and initial configurations. 229As explained in the {ref}`common-notation` section, we denote by capital letters the reference frame and by small letters the current one. 230 231The strong form of the static balance of linear-momentum at *finite strain* (total Lagrangian) is given by: 232 233$$ 234- \nabla_X \cdot \bm{P} - \rho_0 \bm{g} = \bm{0} 235$$ (sblFinS) 236 237where the $_X$ in $\nabla_X$ indicates that the gradient is calculated with respect to the initial configuration in the finite strain regime. 238$\bm{P}$ and $\bm{g}$ are the *first Piola-Kirchhoff stress* tensor and the prescribed forcing function, respectively. 239$\rho_0$ is known as the *initial* mass density. 240The tensor $\bm P$ is not symmetric, living in the current configuration on the left and the initial configuration on the right. 241 242$\bm{P}$ can be decomposed as 243 244$$ 245\bm{P} = \bm{F} \, \bm{S}, 246$$ (1st2nd) 247 248where $\bm S$ is the *second Piola-Kirchhoff stress* tensor, a symmetric tensor defined entirely in the initial configuration, and $\bm{F} = \bm I_3 + \nabla_X \bm u$ is the deformation gradient. 249Different constitutive models can define $\bm S$. 250 251### Constitutive modeling 252 253For the constitutive modeling of hyperelasticity at finite strain, we begin by defining two symmetric tensors in the initial configuration, the right Cauchy-Green tensor 254 255$$ 256\bm C = \bm F^T \bm F 257$$ 258 259and the Green-Lagrange strain tensor 260 261$$ 262\bm E = \frac 1 2 (\bm C - \bm I_3) = \frac 1 2 \Big( \nabla_X \bm u + (\nabla_X \bm u)^T + (\nabla_X \bm u)^T \nabla_X \bm u \Big), 263$$ (eq-green-lagrange-strain) 264 265the latter of which converges to the linear strain tensor $\bm \epsilon$ in the small-deformation limit. 266The constitutive models considered, appropriate for large deformations, express $\bm S$ as a function of $\bm E$, similar to the linear case, shown in equation {math:numref}`linear-stress-strain`, which expresses the relationship between $\bm\sigma$ and $\bm\epsilon$. 267 268Recall that the strain energy density functional can only depend upon invariants. 269We will assume without loss of generality that $\bm E$ is diagonal and take its set of eigenvalues as the invariants. 270It is clear that there can be only three invariants, and there are many alternate choices, such as $\operatorname{trace}(\bm E), \operatorname{trace}(\bm E^2), \lvert \bm E \rvert$, and combinations thereof. 271It is common in the literature for invariants to be taken from $\bm C = \bm I_3 + 2 \bm E$ instead of $\bm E$. 272 273For example, if we take the compressible Neo-Hookean model, 274 275$$ 276\begin{aligned} 277\Phi(\bm E) &= \frac{\lambda}{2}(\log J)^2 - \mu \log J + \frac \mu 2 (\operatorname{trace} \bm C - 3) \\ 278 &= \frac{\lambda}{2}(\log J)^2 - \mu \log J + \mu \operatorname{trace} \bm E, 279\end{aligned} 280$$ (neo-hookean-energy) 281 282where $J = \lvert \bm F \rvert = \sqrt{\lvert \bm C \rvert}$ is the determinant of deformation (i.e., volume change) and $\lambda$ and $\mu$ are the Lamé parameters in the infinitesimal strain limit. 283 284To evaluate {math:numref}`strain-energy-grad`, we make use of 285 286$$ 287\frac{\partial J}{\partial \bm E} = \frac{\partial \sqrt{\lvert \bm C \rvert}}{\partial \bm E} = \lvert \bm C \rvert^{-1/2} \lvert \bm C \rvert \bm C^{-1} = J \bm C^{-1}, 288$$ 289 290where the factor of $\frac 1 2$ has been absorbed due to $\bm C = \bm I_3 + 2 \bm E.$ 291Carrying through the differentiation {math:numref}`strain-energy-grad` for the model {math:numref}`neo-hookean-energy`, we arrive at 292 293$$ 294\bm S = \lambda \log J \bm C^{-1} + \mu (\bm I_3 - \bm C^{-1}). 295$$ (neo-hookean-stress) 296 297:::{tip} 298An equivalent form of {math:numref}`neo-hookean-stress` is 299 300$$ 301\bm S = \lambda \log J \bm C^{-1} + 2 \mu \bm C^{-1} \bm E, 302$$ (neo-hookean-stress-stable) 303 304which is more numerically stable for small $\bm E$, and thus preferred for computation. 305Note that the product $\bm C^{-1} \bm E$ is also symmetric, and that $\bm E$ should be computed using {math:numref}`eq-green-lagrange-strain`. 306 307Similarly, it is preferable to compute $\log J$ using `log1p`, especially in case of nearly incompressible materials. 308To sketch this idea, suppose we have the $2\times 2$ non-symmetric matrix $\bm{F} = \left( \begin{smallmatrix} 1 + u_{0,0} & u_{0,1} \\ u_{1,0} & 1 + u_{1,1} \end{smallmatrix} \right)$. 309Then we compute 310 311$$ 312\log J = \mathtt{log1p}(u_{0,0} + u_{1,1} + u_{0,0} u_{1,1} - u_{0,1} u_{1,0}), 313$$ (log1p) 314 315which gives accurate results even in the limit when the entries $u_{i,j}$ are very small. 316For example, if $u_{i,j} \sim 10^{-8}$, then naive computation of $\bm I_3 - \bm C^{-1}$ and $\log J$ will have a relative accuracy of order $10^{-8}$ in double precision and no correct digits in single precision. 317When using the stable choices above, these quantities retain full $\varepsilon_{\text{machine}}$ relative accuracy. 318::: 319 320:::{dropdown} Mooney-Rivlin model 321While the Neo-Hookean model depends on just two scalar invariants, $\mathbb I_1 = \trace \bm C = 3 + 2\trace \bm E$ and $J$, Mooney-Rivlin models depend on the additional invariant, $\mathbb I_2 = \frac 1 2 (\mathbb I_1^2 - \bm C \tcolon \bm C)$. 322A coupled Mooney-Rivlin strain energy density (cf. Neo-Hookean {math:numref}`neo-hookean-energy`) is {cite}`holzapfel2000nonlinear` 323 324$$ 325\Phi(\mathbb{I_1}, \mathbb{I_2}, J) = \frac{\lambda}{2}(\log J)^2 - (\mu_1 + 2\mu_2) \log J + \frac{\mu_1}{2}(\mathbb{I_1} - 3) + \frac{\mu_2}{2}(\mathbb{I_2} - 3). 326$$ (mooney-rivlin-energy_coupled) 327 328We differentiate $\Phi$ as in the Neo-Hookean case {math:numref}`neo-hookean-stress` to yield the second Piola-Kirchoff tensor, 329 330$$ 331\begin{aligned} 332\bm S &= \lambda \log J \bm{C}^{-1} - (\mu_1 + 2\mu_2) \bm{C}^{-1} + \mu_1\bm I_3 + \mu_2(\mathbb{I_1} \bm I_3 - \bm C) \\ 333&= (\lambda \log J - \mu_1 - 2\mu_2) \bm C^{-1} + (\mu_1 + \mu_2 \mathbb I_1) \bm I_3 - \mu_2 \bm C, 334\end{aligned} 335$$ (mooney-rivlin-stress_coupled) 336 337where we have used 338 339$$ 340\begin{aligned} 341\frac{\partial \mathbb{I_1}}{\partial \bm E} &= 2 \bm I_3, & \frac{\partial \mathbb{I_2}}{\partial \bm E} &= 2 \mathbb I_1 \bm I_3 - 2 \bm C, & \frac{\partial \log J}{\partial \bm E} &= \bm{C}^{-1}. 342\end{aligned} 343$$ (None) 344 345This is a common model for vulcanized rubber, with a shear modulus (defined for the small-strain limit) of $\mu_1 + \mu_2$ that should be significantly smaller than the first Lamé parameter $\lambda$. 346::: 347 348:::{dropdown} Mooney-Rivlin strain energy comparison 349We apply traction to a block and plot integrated strain energy $\Phi$ as a function of the loading paramater. 350 351```{eval-rst} 352.. altair-plot:: 353 :hide-code: 354 355 import altair as alt 356 import pandas as pd 357 nh = pd.read_csv("source/examples/solids/output/NH-strain.csv") 358 nh["model"] = "Neo-Hookean" 359 nh["parameters"] = "E=2.8, nu=0.4" 360 361 mr = pd.read_csv("source/examples/solids/output/MR-strain.csv") 362 mr["model"] = "Mooney-Rivlin; Neo-Hookean equivalent" 363 mr["parameters"] = "mu_1=1, mu_2=0, nu=.4" 364 365 mr1 = pd.read_csv("source/examples/solids/output/MR-strain1.csv") 366 mr1["model"] = "Mooney-Rivlin" 367 mr1["parameters"] = "mu_1=0.5, mu_2=0.5, nu=.4" 368 369 df = pd.concat([nh, mr, mr1]) 370 highlight = alt.selection_single( 371 on = "mouseover", 372 nearest = True, 373 fields=["model", "parameters"], 374 ) 375 base = alt.Chart(df).encode( 376 alt.X("increment"), 377 alt.Y("energy", scale=alt.Scale(type="sqrt")), 378 alt.Color("model"), 379 alt.Tooltip(("model", "parameters")), 380 opacity=alt.condition(highlight, alt.value(1), alt.value(.5)), 381 size=alt.condition(highlight, alt.value(2), alt.value(1)), 382 ) 383 base.mark_point().add_selection(highlight) + base.mark_line() 384``` 385::: 386 387:::{note} 388One can linearize {math:numref}`neo-hookean-stress` around $\bm E = 0$, for which $\bm C = \bm I_3 + 2 \bm E \to \bm I_3$ and $J \to 1 + \operatorname{trace} \bm E$, therefore {math:numref}`neo-hookean-stress` reduces to 389 390$$ 391\bm S = \lambda (\trace \bm E) \bm I_3 + 2 \mu \bm E, 392$$ (eq-st-venant-kirchoff) 393 394which is the St. Venant-Kirchoff model (constitutive linearization without geometric linearization; see {math:numref}`hyperelastic-cd`). 395 396This model can be used for geometrically nonlinear mechanics (e.g., snap-through of thin structures), but is inappropriate for large strain. 397 398Alternatively, one can drop geometric nonlinearities, $\bm E \to \bm \epsilon$ and $\bm C \to \bm I_3$, while retaining the nonlinear dependence on $J \to 1 + \operatorname{trace} \bm \epsilon$, thereby yielding {math:numref}`eq-neo-hookean-small-strain` (see {math:numref}`hyperelastic-cd`). 399::: 400 401### Weak form 402 403We multiply {math:numref}`sblFinS` by a test function $\bm v$ and integrate by parts to obtain the weak form for finite-strain hyperelasticity: 404find $\bm u \in \mathcal V \subset H^1(\Omega_0)$ such that 405 406$$ 407\int_{\Omega_0}{\nabla_X \bm{v} \tcolon \bm{P}} \, dV 408 - \int_{\Omega_0}{\bm{v} \cdot \rho_0 \bm{g}} \, dV 409 - \int_{\partial \Omega_0}{\bm{v} \cdot (\bm{P} \cdot \hat{\bm{N}})} \, dS 410 = 0, \quad \forall \bm v \in \mathcal V, 411$$ (hyperelastic-weak-form-initial) 412 413where $\bm{P} \cdot \hat{\bm{N}}|_{\partial\Omega}$ is replaced by any prescribed force/traction boundary condition written in terms of the initial configuration. 414This equation contains material/constitutive nonlinearities in defining $\bm S(\bm E)$, as well as geometric nonlinearities through $\bm P = \bm F\, \bm S$, $\bm E(\bm F)$, and the body force $\bm g$, which must be pulled back from the current configuration to the initial configuration. 415Discretization of {math:numref}`hyperelastic-weak-form-initial` produces a finite-dimensional system of nonlinear algebraic equations, which we solve using Newton-Raphson methods. 416One attractive feature of Galerkin discretization is that we can arrive at the same linear system by discretizing the Newton linearization of the continuous form; that is, discretization and differentiation (Newton linearization) commute. 417 418### Newton linearization 419 420To derive a Newton linearization of {math:numref}`hyperelastic-weak-form-initial`, we begin by expressing the derivative of {math:numref}`1st2nd` in incremental form, 421 422$$ 423\diff \bm P = \frac{\partial \bm P}{\partial \bm F} \!:\! \diff \bm F = \diff \bm F\, \bm S + \bm F \underbrace{\frac{\partial \bm S}{\partial \bm E} \!:\! \diff \bm E}_{\diff \bm S} 424$$ (eq-diff-P) 425 426where 427 428$$ 429\diff \bm E = \frac{\partial \bm E}{\partial \bm F} \!:\! \diff \bm F = \frac 1 2 \Big( \diff \bm F^T \bm F + \bm F^T \diff \bm F \Big) 430$$ 431 432and $\diff\bm F = \nabla_X\diff\bm u$. 433The quantity ${\partial \bm S} / {\partial \bm E}$ is known as the incremental elasticity tensor, and is analogous to the linear elasticity tensor $\mathsf C$ of {math:numref}`linear-elasticity-tensor`. 434We now evaluate $\diff \bm S$ for the Neo-Hookean model {math:numref}`neo-hookean-stress`, 435 436$$ 437\diff\bm S = \frac{\partial \bm S}{\partial \bm E} \!:\! \diff \bm E 438= \lambda (\bm C^{-1} \!:\! \diff\bm E) \bm C^{-1} 439 + 2 (\mu - \lambda \log J) \bm C^{-1} \diff\bm E \, \bm C^{-1}, 440$$ (eq-neo-hookean-incremental-stress) 441 442where we have used 443 444$$ 445\diff \bm C^{-1} = \frac{\partial \bm C^{-1}}{\partial \bm E} \!:\! \diff\bm E = -2 \bm C^{-1} \diff \bm E \, \bm C^{-1} . 446$$ 447 448:::{note} 449In the small-strain limit, $\bm C \to \bm I_3$ and $\log J \to 0$, thereby reducing {math:numref}`eq-neo-hookean-incremental-stress` to the St. Venant-Kirchoff model {math:numref}`eq-st-venant-kirchoff`. 450::: 451 452:::{dropdown} Newton linearization of Mooney-Rivlin 453Similar to {math:numref}`eq-neo-hookean-incremental-stress`, we differentiate {math:numref}`mooney-rivlin-stress_coupled` using variational notation, 454 455$$ 456\begin{aligned} 457\diff\bm S &= \lambda (\bm C^{-1} \tcolon \diff\bm E) \bm C^{-1} \\ 458&\quad + 2(\mu_1 + 2\mu_2 - \lambda \log J) \bm C^{-1} \diff\bm E \bm C^{-1} \\ 459&\quad + 2 \mu_2 \Big[ \trace (\diff\bm E) \bm I_3 - \diff\bm E\Big] . 460\end{aligned} 461$$ (mooney-rivlin-dS-coupled) 462 463Note that this agrees with {math:numref}`eq-neo-hookean-incremental-stress` if $\mu_1 = \mu, \mu_2 = 0$. 464Moving from Neo-Hookean to Mooney-Rivlin modifies the second term and adds the third. 465::: 466 467:::{dropdown} Cancellation vs symmetry 468Some cancellation is possible (at the expense of symmetry) if we substitute {math:numref}`eq-neo-hookean-incremental-stress` into {math:numref}`eq-diff-P`, 469 470$$ 471\begin{aligned} 472\diff \bm P &= \diff \bm F\, \bm S 473 + \lambda (\bm C^{-1} : \diff \bm E) \bm F^{-T} + 2(\mu - \lambda \log J) \bm F^{-T} \diff\bm E \, \bm C^{-1} \\ 474&= \diff \bm F\, \bm S 475 + \lambda (\bm F^{-T} : \diff \bm F) \bm F^{-T} + (\mu - \lambda \log J) \bm F^{-T} (\bm F^T \diff \bm F + \diff \bm F^T \bm F) \bm C^{-1} \\ 476&= \diff \bm F\, \bm S 477 + \lambda (\bm F^{-T} : \diff \bm F) \bm F^{-T} + (\mu - \lambda \log J) \Big( \diff \bm F\, \bm C^{-1} + \bm F^{-T} \diff \bm F^T \bm F^{-T} \Big), 478\end{aligned} 479$$ (eq-diff-P-dF) 480 481where we have exploited $\bm F \bm C^{-1} = \bm F^{-T}$ and 482 483$$ 484\begin{aligned} \bm C^{-1} \!:\! \diff \bm E = \bm C_{IJ}^{-1} \diff \bm E_{IJ} &= \frac 1 2 \bm F_{Ik}^{-1} \bm F_{Jk}^{-1} (\bm F_{\ell I} \diff \bm F_{\ell J} + \diff \bm F_{\ell I} \bm F_{\ell J}) \\ &= \frac 1 2 \Big( \delta_{\ell k} \bm F_{Jk}^{-1} \diff \bm F_{\ell J} + \delta_{\ell k} \bm F_{Ik}^{-1} \diff \bm F_{\ell I} \Big) \\ &= \bm F_{Ik}^{-1} \diff \bm F_{kI} = \bm F^{-T} \!:\! \diff \bm F. \end{aligned} 485$$ 486 487We prefer to compute with {math:numref}`eq-neo-hookean-incremental-stress` because {math:numref}`eq-diff-P-dF` is more expensive, requiring access to (non-symmetric) $\bm F^{-1}$ in addition to (symmetric) $\bm C^{-1} = \bm F^{-1} \bm F^{-T}$, having fewer symmetries to exploit in contractions, and being less numerically stable. 488::: 489 490:::{dropdown} $\diff\bm S$ in index notation 491It is sometimes useful to express {math:numref}`eq-neo-hookean-incremental-stress` in index notation, 492 493$$ 494\begin{aligned} 495\diff\bm S_{IJ} &= \frac{\partial \bm S_{IJ}}{\partial \bm E_{KL}} \diff \bm E_{KL} \\ 496 &= \lambda (\bm C^{-1}_{KL} \diff\bm E_{KL}) \bm C^{-1}_{IJ} + 2 (\mu - \lambda \log J) \bm C^{-1}_{IK} \diff\bm E_{KL} \bm C^{-1}_{LJ} \\ 497 &= \underbrace{\Big( \lambda \bm C^{-1}_{IJ} \bm C^{-1}_{KL} + 2 (\mu - \lambda \log J) \bm C^{-1}_{IK} \bm C^{-1}_{JL} \Big)}_{\mathsf C_{IJKL}} \diff \bm E_{KL} \,, 498\end{aligned} 499$$ (eq-neo-hookean-incremental-stress-index) 500 501where we have identified the effective elasticity tensor $\mathsf C = \mathsf C_{IJKL}$. 502It is generally not desirable to store $\mathsf C$, but rather to use the earlier expressions so that only $3\times 3$ tensors (most of which are symmetric) must be manipulated. 503That is, given the linearization point $\bm F$ and solution increment $\diff \bm F = \nabla_X (\diff \bm u)$ (which we are solving for in the Newton step), we compute $\diff \bm P$ via 504 5051. recover $\bm C^{-1}$ and $\log J$ (either stored at quadrature points or recomputed), 5062. proceed with $3\times 3$ matrix products as in {math:numref}`eq-neo-hookean-incremental-stress` or the second line of {math:numref}`eq-neo-hookean-incremental-stress-index` to compute $\diff \bm S$ while avoiding computation or storage of higher order tensors, and 5073. conclude by {math:numref}`eq-diff-P`, where $\bm S$ is either stored or recomputed from its definition exactly as in the nonlinear residual evaluation. 508::: 509 510Note that the Newton linearization of {math:numref}`hyperelastic-weak-form-initial` may be written as a weak form for linear operators: find $\diff\bm u \in \mathcal V_0$ such that 511 512$$ 513\int_{\Omega_0} \nabla_X \bm v \!:\! \diff\bm P dV = \text{rhs}, \quad \forall \bm v \in \mathcal V_0, 514$$ 515 516where $\diff \bm P$ is defined by {math:numref}`eq-diff-P` and {math:numref}`eq-neo-hookean-incremental-stress`, and $\mathcal V_0$ is the homogeneous space corresponding to $\mathcal V$. 517 518:::{note} 519The decision of whether to recompute or store functions of the current state $\bm F$ depends on a roofline analysis {cite}`williams2009roofline,brown2010` of the computation and the cost of the constitutive model. 520For low-order elements where flops tend to be in surplus relative to memory bandwidth, recomputation is likely to be preferable, where as the opposite may be true for high-order elements. 521Similarly, analysis with a simple constitutive model may see better performance while storing little or nothing while an expensive model such as Arruda-Boyce {cite}`arruda1993largestretch`, which contains many special functions, may be faster when using more storage to avoid recomputation. 522In the case where complete linearization is preferred, note the symmetry $\mathsf C_{IJKL} = \mathsf C_{KLIJ}$ evident in {math:numref}`eq-neo-hookean-incremental-stress-index`, thus $\mathsf C$ can be stored as a symmetric $6\times 6$ matrix, which has 21 unique entries. 523Along with 6 entries for $\bm S$, this totals 27 entries of overhead compared to computing everything from $\bm F$. 524This compares with 13 entries of overhead for direct storage of $\{ \bm S, \bm C^{-1}, \log J \}$, which is sufficient for the Neo-Hookean model to avoid all but matrix products. 525::: 526 527(problem-hyperelasticity-finite-strain-current-configuration)= 528 529## Hyperelasticity in current configuration 530 531In the preceeding discussion, all equations have been formulated in the initial configuration. 532This may feel convenient in that the computational domain is clearly independent of the solution, but there are some advantages to defining the equations in the current configuration. 533 5341. Body forces (like gravity), traction, and contact are more easily defined in the current configuration. 5352. Mesh quality in the initial configuration can be very bad for large deformation. 5363. The required storage and numerical representation can be smaller in the current configuration. 537 538Most of the benefit in case 3 can be attained solely by moving the Jacobian representation to the current configuration {cite}`davydov2020matrix`, though residual evaluation may also be slightly faster in current configuration. 539There are multiple commuting paths from the nonlinear weak form in initial configuration {math:numref}`hyperelastic-weak-form-initial` to the Jacobian weak form in current configuration {math:numref}`jacobian-weak-form-current`. 540One may push forward to the current configuration and then linearize or linearize in initial configuration and then push forward, as summarized below. 541 542$$ 543\begin{CD} 544 {\overbrace{\nabla_X \bm{v} \tcolon \bm{FS}}^{\text{Initial Residual}}} 545 @>{\text{push forward}}>{}> 546 {\overbrace{\nabla_x \bm{v} \tcolon \bm{\tau}}^{\text{Current Residual}}} \\ 547 @V{\text{linearize}}V{\begin{smallmatrix} \diff\bm F = \nabla_X\diff\bm u \\ \diff\bm S(\diff\bm E) \end{smallmatrix}}V 548 @V{\begin{smallmatrix} \diff\nabla_x\bm v = -\nabla_x\bm v \nabla_x \diff\bm u \\ \diff\bm\tau(\diff\bm\epsilon) \end{smallmatrix}}V{\text{linearize}}V \\ 549 {\underbrace{\nabla_X\bm{v}\tcolon \Big(\diff\bm{F}\bm{S} + \bm{F}\diff\bm{S}\Big)}_\text{Initial Jacobian}} 550 @>{\text{push forward}}>{}> 551 {\underbrace{\nabla_x\bm{v}\tcolon \Big(\diff\bm{\tau} -\bm{\tau}(\nabla_x \diff\bm{u})^T \Big)}_\text{Current Jacobian}} 552\end{CD} 553$$ (initial-current-linearize) 554 555We will follow both paths for consistency and because both intermediate representations may be useful for implementation. 556 557### Push forward, then linearize 558 559The first term of {math:numref}`hyperelastic-weak-form-initial` can be rewritten in terms of the symmetric Kirchhoff stress tensor 560$\bm{\tau}=J\bm{\sigma}=\bm{P}\bm{F}^T = \bm F \bm S \bm F^T$ as 561 562$$ 563\nabla_X \bm{v} \tcolon \bm{P} = \nabla_X \bm{v} \tcolon \bm{\tau}\bm{F}^{-T} = \nabla_X \bm{v}\bm{F}^{-1} \tcolon \bm{\tau} = \nabla_x \bm{v} \tcolon \bm{\tau} 564$$ 565 566therefore, the weak form in terms of $\bm{\tau}$ and $\nabla_x$ with integral over $\Omega_0$ is 567 568$$ 569\int_{\Omega_0}{\nabla_x \bm{v} \tcolon \bm{\tau}} \, dV 570 - \int_{\Omega_0}{\bm{v} \cdot \rho_0 \bm{g}} \, dV 571 - \int_{\partial \Omega_0}{\bm{v}\cdot(\bm{P}\cdot\hat{\bm{N}})} \, dS 572 = 0, \quad \forall \bm v \in \mathcal V. 573$$ (hyperelastic-weak-form-current) 574 575#### Linearize in current configuration 576 577To derive a Newton linearization of {math:numref}`hyperelastic-weak-form-current`, first we define 578 579$$ 580\nabla_x \diff \bm{u} = \nabla_X \diff \bm{u} \ \bm{F}^{-1} = \diff \bm{F} \bm{F}^{-1} 581$$ (nabla_xdu) 582 583and $\bm{\tau}$ for Neo-Hookean materials as the push forward of {math:numref}`neo-hookean-stress` 584 585$$ 586\bm{\tau} = \bm{F}\bm{S}\bm{F}^T = \mu (\bm{b} - \bm I_3) + \lambda \log J \bm{I}_3, 587$$ (tau-neo-hookean) 588 589where $\bm{b} = \bm{F} \bm{F}^T$, is the left Cauchy-Green tensor. 590Then by expanding the directional derivative of $\nabla_x \bm{v} \tcolon \bm{\tau}$, we arrive at 591 592$$ 593\diff \ (\nabla_x \bm{v} \tcolon \bm{\tau}) = \diff \ (\nabla_x \bm{v})\tcolon \bm{\tau} + \nabla_x \bm{v} \tcolon \diff \bm{\tau} . 594$$ (hyperelastic-linearization-current1) 595 596The first term of {math:numref}`hyperelastic-linearization-current1` can be written as 597 598$$ 599\begin{aligned} \diff \ (\nabla_x \bm{v})\tcolon \bm{\tau} &= \diff \ (\nabla_X \bm{v} \bm{F}^{-1})\tcolon \bm{\tau} = \Big(\underbrace{\nabla_X (\diff \bm{v})}_{0}\bm{F}^{-1} + \nabla_X \bm{v}\diff \bm{F}^{-1}\Big)\tcolon \bm{\tau}\\ &= \Big(-\nabla_X \bm{v} \bm{F}^{-1}\diff\bm{F}\bm{F}^{-1}\Big)\tcolon \bm{\tau}=\Big(-\nabla_x \bm{v} \diff\bm{F}\bm{F}^{-1}\Big)\tcolon \bm{\tau}\\ &= \Big(-\nabla_x \bm{v} \nabla_x \diff\bm{u} \Big)\tcolon \bm{\tau}= -\nabla_x \bm{v}\tcolon\bm{\tau}(\nabla_x \diff\bm{u})^T \,, \end{aligned} 600$$ 601 602where we have used $\diff \bm{F}^{-1}=-\bm{F}^{-1} \diff \bm{F} \bm{F}^{-1}$ and {math:numref}`nabla_xdu`. 603Using this and {math:numref}`hyperelastic-linearization-current1` in {math:numref}`hyperelastic-weak-form-current` yields the weak form in the current configuration 604 605$$ 606\int_{\Omega_0} \nabla_x \bm v \tcolon \Big(\diff\bm\tau - \bm\tau (\nabla_x \diff\bm u)^T \Big) = \text{rhs}. 607$$ (jacobian-weak-form-current) 608 609In the following, we will sometimes make use of the incremental strain tensor in the current configuration, 610 611$$ 612\diff\bm\epsilon \equiv \frac{1}{2}\Big(\nabla_x \diff\bm{u} + (\nabla_x \diff\bm{u})^T \Big) . 613$$ 614 615:::{dropdown} Deriving $\diff\bm\tau$ for Neo-Hookean material 616To derive a useful expression of $\diff\bm\tau$ for Neo-Hookean materials, we will use the representations 617 618$$ 619\begin{aligned} 620\diff \bm{b} &= \diff \bm{F} \bm{F}^T + \bm{F} \diff \bm{F}^T \\ 621&= \nabla_x \diff \bm{u} \ \bm{b} + \bm{b} \ (\nabla_x \diff \bm{u})^T \\ 622&= (\nabla_x \diff\bm u)(\bm b - \bm I_3) + (\bm b - \bm I_3) (\nabla_x \diff\bm u)^T + 2 \diff\bm\epsilon 623\end{aligned} 624$$ 625 626and 627 628$$ 629\begin{aligned} \diff\ (\log J) &= \frac{\partial \log J}{\partial \bm{b}}\tcolon \diff \bm{b} = \frac{\partial J}{J\partial \bm{b}}\tcolon \diff \bm{b}=\frac{1}{2}\bm{b}^{-1}\tcolon \diff \bm{b} \\ &= \frac 1 2 \bm b^{-1} \tcolon \Big(\nabla_x \diff\bm u \ \bm b + \bm b (\nabla_x \diff\bm u)^T \Big) \\ &= \trace (\nabla_x \diff\bm u) \\ &= \trace \diff\bm\epsilon . \end{aligned} 630$$ 631 632Substituting into {math:numref}`tau-neo-hookean` gives 633 634$$ 635\begin{aligned} 636\diff \bm{\tau} &= \mu \diff \bm{b} + \lambda \trace (\diff\bm\epsilon) \bm I_3 \\ 637&= \underbrace{2 \mu \diff\bm\epsilon + \lambda \trace (\diff\bm\epsilon) \bm I_3 - 2\lambda \log J \diff\bm\epsilon}_{\bm F \diff\bm S \bm F^T} \\ 638&\quad + (\nabla_x \diff\bm u)\underbrace{\Big( \mu (\bm b - \bm I_3) + \lambda \log J \bm I_3 \Big)}_{\bm\tau} \\ 639&\quad + \underbrace{\Big( \mu (\bm b - \bm I_3) + \lambda \log J \bm I_3 \Big)}_{\bm\tau} (\nabla_x \diff\bm u)^T , 640\end{aligned} 641$$ (dtau-neo-hookean) 642 643where the final expression has been identified according to 644 645$$ 646\diff\bm\tau = \diff\ (\bm F \bm S \bm F^T) = (\nabla_x \diff\bm u) \bm\tau + \bm F \diff\bm S \bm F^T + \bm\tau(\nabla_x \diff\bm u)^T. 647$$ 648::: 649 650Collecting terms, we may thus opt to use either of the two forms 651 652$$ 653\begin{aligned} 654\diff \bm{\tau} -\bm{\tau}(\nabla_x \diff\bm{u})^T &= (\nabla_x \diff\bm u)\bm\tau + \bm F \diff\bm S \bm F^T \\ 655&= (\nabla_x \diff\bm u)\bm\tau + \lambda \trace(\diff\bm\epsilon) \bm I_3 + 2(\mu - \lambda \log J) \diff\bm\epsilon, 656\end{aligned} 657$$ (cur_simp_Jac) 658 659with the last line showing the especially compact representation available for Neo-Hookean materials. 660 661### Linearize, then push forward 662 663We can move the derivatives to the current configuration via 664 665$$ 666\nabla_X \bm v \!:\! \diff\bm P = (\nabla_X \bm v) \bm F^{-1} \!:\! \diff \bm P \bm F^T = \nabla_x \bm v \!:\! \diff\bm P \bm F^T 667$$ 668 669and expand 670 671$$ 672\begin{aligned} 673\diff\bm P \bm F^T &= \diff\bm F \bm S \bm F^T + \bm F \diff\bm S \bm F^T \\ 674&= \underbrace{\diff\bm F \bm F^{-1}}_{\nabla_x \diff\bm u} \underbrace{\bm F \bm S \bm F^T}_{\bm\tau} + \bm F \diff\bm S \bm F^T . 675\end{aligned} 676$$ 677 678:::{dropdown} Representation of $\bm F \diff\bm S \bm F^T$ for Neo-Hookean materials 679Now we push {math:numref}`eq-neo-hookean-incremental-stress` forward via 680 681$$ 682\begin{aligned} 683\bm F \diff\bm S \bm F^T &= \lambda (\bm C^{-1} \!:\! \diff\bm E) \bm F \bm C^{-1} \bm F^T 684 + 2 (\mu - \lambda \log J) \bm F \bm C^{-1} \diff\bm E \, \bm C^{-1} \bm F^T \\ 685 &= \lambda (\bm C^{-1} \!:\! \diff\bm E) \bm I_3 + 2 (\mu - \lambda \log J) \bm F^{-T} \diff\bm E \, \bm F^{-1} \\ 686 &= \lambda \operatorname{trace}(\nabla_x \diff\bm u) \bm I_3 + 2 (\mu - \lambda \log J) \diff\bm \epsilon 687\end{aligned} 688$$ 689 690where we have used 691 692$$ 693\begin{aligned} 694\bm C^{-1} \!:\! \diff\bm E &= \bm F^{-1} \bm F^{-T} \!:\! \bm F^T \diff\bm F \\ 695&= \operatorname{trace}(\bm F^{-1} \bm F^{-T} \bm F^T \diff \bm F) \\ 696&= \operatorname{trace}(\bm F^{-1} \diff\bm F) \\ 697&= \operatorname{trace}(\diff \bm F \bm F^{-1}) \\ 698&= \operatorname{trace}(\nabla_x \diff\bm u) 699\end{aligned} 700$$ 701 702and 703 704$$ 705\begin{aligned} 706\bm F^{-T} \diff\bm E \, \bm F^{-1} &= \frac 1 2 \bm F^{-T} (\bm F^T \diff\bm F + \diff\bm F^T \bm F) \bm F^{-1} \\ 707&= \frac 1 2 (\diff \bm F \bm F^{-1} + \bm F^{-T} \diff\bm F^T) \\ 708&= \frac 1 2 \Big(\nabla_x \diff\bm u + (\nabla_x\diff\bm u)^T \Big) \equiv \diff\bm\epsilon. 709\end{aligned} 710$$ 711::: 712 713Collecting terms, the weak form of the Newton linearization for Neo-Hookean materials in the current configuration is 714 715$$ 716\int_{\Omega_0} \nabla_x \bm v \!:\! \Big( (\nabla_x \diff\bm u) \bm\tau + \lambda \operatorname{trace}(\diff\bm\epsilon)\bm I_3 + 2(\mu - \lambda\log J)\diff \bm\epsilon \Big) dV = \text{rhs}, 717$$ (jacobian-weak-form-current2) 718 719which equivalent to Algorithm 2 of {cite}`davydov2020matrix` and requires only derivatives with respect to the current configuration. Note that {math:numref}`cur_simp_Jac` and {math:numref}`jacobian-weak-form-current2` have recovered the same representation 720using different algebraic manipulations. 721 722:::{tip} 723We define a second order *Green-Euler* strain tensor (cf. Green-Lagrange strain {math:numref}`eq-green-lagrange-strain`) as 724 725$$ 726\bm e = \frac 1 2 \Big(\bm{b} - \bm{I}_3 \Big) = \frac 1 2 \Big( \nabla_X \bm{u} + (\nabla_X \bm{u})^T + \nabla_X \bm{u} \, (\nabla_X \bm{u})^T \Big). 727$$ (green-euler-strain) 728 729Then, the Kirchhoff stress tensor {math:numref}`tau-neo-hookean` can be written as 730 731$$ 732\bm \tau = \lambda \log J \bm I_{3} + 2\mu \bm e, 733$$ (tau-neo-hookean-stable) 734 735which is more numerically stable for small strain, and thus preferred for computation. Note that the $\log J$ is computed via `log1p` {math:numref}`log1p`, as we discussed in the previous tip. 736::: 737 738### Jacobian representation 739 740We have implemented four storage variants for the Jacobian in our finite strain hyperelasticity. In each case, some variables are computed during residual evaluation and used during Jacobian application. 741 742```{eval-rst} 743.. list-table:: Four algorithms for Jacobian action in finite strain hyperelasticity problem 744 :header-rows: 1 745 746 * - Option :code:`-problem` 747 - Static storage 748 - Computed storage 749 - # scalars 750 - Equations 751 752 753 * - :code:`FSInitial-NH1` 754 - :math:`\nabla_{X} \hat X, \operatorname{det}\nabla_{\hat X} X` 755 - :math:`\nabla_X \bm u` 756 - 19 757 - :math:numref:`eq-diff-P` :math:numref:`eq-neo-hookean-incremental-stress` 758 759 * - :code:`FSInitial-NH2` 760 - :math:`\nabla_{X} \hat X, \operatorname{det}\nabla_{\hat X} X` 761 - :math:`\nabla_X \bm u, \bm C^{-1}, \lambda \log J` 762 - 26 763 - :math:numref:`eq-diff-P` :math:numref:`eq-neo-hookean-incremental-stress` 764 765 * - :code:`FSCurrent-NH1` 766 - :math:`\nabla_{X} \hat X, \operatorname{det}\nabla_{\hat X} X` 767 - :math:`\nabla_X \bm u` 768 - 19 769 - :math:numref:`jacobian-weak-form-current` :math:numref:`nabla_xdu` 770 771 * - :code:`FSCurrent-NH2` 772 - :math:`\operatorname{det}\nabla_{\hat X} X` 773 - :math:`\nabla_x \hat X, \bm \tau, \lambda \log J` 774 - 17 775 - :math:numref:`jacobian-weak-form-current` :math:numref:`jacobian-weak-form-current2` 776``` 777