|
19 | 19 | "source": [ |
20 | 20 | "# Linear elasticity\n", |
21 | 21 | "\n", |
22 | | - "*This work is adapted from an earlier FEniCS tutorial.*\n", |
| 22 | + "*This work is adapted from a previous FEniCS tutorial no longer online*\n", |
23 | 23 | "\n", |
24 | 24 | "Having studied a few scalar-valued problems, we now move on to a vector-valued problem. The equations of linear elasticity. Here, we'll treat the isotropic case.\n", |
25 | 25 | "\n", |
26 | 26 | "For small deformations, the governing equation is:\n", |
27 | 27 | "\n", |
28 | 28 | "$$ -\\nabla \\cdot \\sigma = f \\text{ in } \\Omega, $$\n", |
29 | | - "with\n", |
30 | | - "$$ \\DeclareMathOperator{\\Tr}{Tr}\n", |
31 | | - "\\text{the stress tensor}\\quad \\sigma := \\lambda \\Tr(\\epsilon)\\mathbb{I} + 2\\mu\\epsilon\\\\\n", |
32 | | - "\\text{and the symmetric strain rate tensor}\\quad \\epsilon := \\frac{1}{2}\\left(\\nabla u + (\\nabla u)^T\\right), $$\n", |
| 29 | + "with the stress tensor:\n", |
| 30 | + "$$ \\sigma := \\lambda \\Tr(\\epsilon)\\mathbb{I} + 2\\mu\\epsilon$$\n", |
| 31 | + "and the symmetric strain rate tensor:\n", |
| 32 | + "$$\\epsilon := \\frac{1}{2}\\left(\\nabla u + (\\nabla u)^T\\right), $$\n", |
33 | 33 | "where $u$ is the unknown vector displacement field, and $\\mu$ and $\\lambda$ are the Lamè parameters.\n", |
34 | 34 | "\n", |
35 | 35 | "As before, the variational formulation consists of multiplying by a test function in some suitable finite element space, $v \\in V$, and integrating. Note that this time, the solution $u$, and hence the test space $V$ are *vector*-valued (so multiplication actually means taking the inner product).\n", |
|
110 | 110 | "metadata": {}, |
111 | 111 | "outputs": [], |
112 | 112 | "source": [ |
113 | | - "bc = DirichletBC(V, as_vector([0., 0.]), 1)" |
| 113 | + "bc = DirichletBC(V, Constant([0, 0]), 1)" |
114 | 114 | ] |
115 | 115 | }, |
116 | 116 | { |
|
264 | 264 | " lambda_ = Constant(0.25)\n", |
265 | 265 | " Id = Identity(mesh.geometric_dimension()) # 2x2 Identity tensor\n", |
266 | 266 | " \n", |
267 | | - " bc = DirichletBC(V, as_vector([0., 0.]), 1)\n", |
| 267 | + " bc = DirichletBC(V, Constant([0, 0]), 1)\n", |
268 | 268 | " u = TrialFunction(V)\n", |
269 | 269 | " v = TestFunction(V)\n", |
270 | 270 | " a = inner(sigma(u), epsilon(v))*dx\n", |
|
345 | 345 | "\n", |
346 | 346 | " def sigma(u):\n", |
347 | 347 | " return lambda_*div(u)*Id + 2*mu*epsilon(u) \n", |
348 | | - " bc = DirichletBC(V, as_vector([0., 0.]), 1)\n", |
| 348 | + " bc = DirichletBC(V, Constant([0, 0]), 1)\n", |
349 | 349 | " u = TrialFunction(V)\n", |
350 | 350 | " v = TestFunction(V)\n", |
351 | 351 | " a = inner(sigma(u), epsilon(v))*dx\n", |
|
356 | 356 | " b0 = Function(V)\n", |
357 | 357 | " b1 = Function(V)\n", |
358 | 358 | " b2 = Function(V)\n", |
359 | | - " b0.interpolate(as_vector([1., 0.]))\n", |
360 | | - " b1.interpolate(as_vector([0., 1.]))\n", |
| 359 | + " b0.interpolate(Constant([1, 0]))\n", |
| 360 | + " b1.interpolate(Constant([0, 1]))\n", |
361 | 361 | " b2.interpolate(as_vector([-y, x]))\n", |
362 | 362 | " nullmodes = VectorSpaceBasis([b0, b1, b2])\n", |
363 | 363 | " # Make sure they're orthonormal.\n", |
|
0 commit comments