|
5 | 5 |
|
6 | 6 | import basix.ufl
|
7 | 7 | # Modified by Garth N. Wells, 2009
|
8 |
| -from ufl import (Coefficient, Constant, FacetNormal, Identity, |
9 |
| - SpatialCoordinate, TestFunction, TrialFunction, derivative, |
10 |
| - det, diff, dot, ds, dx, exp, grad, inner, inv, tetrahedron, |
11 |
| - tr, variable) |
| 8 | +from ufl import (Coefficient, Constant, FacetNormal, FunctionSpace, Identity, |
| 9 | + Mesh, SpatialCoordinate, TestFunction, TrialFunction, |
| 10 | + derivative, det, diff, dot, ds, dx, exp, grad, inner, inv, |
| 11 | + tetrahedron, tr, variable) |
12 | 12 |
|
13 | 13 | # Cell and its properties
|
14 | 14 | cell = tetrahedron
|
15 | 15 | d = cell.geometric_dimension()
|
16 |
| -N = FacetNormal(cell) |
17 |
| -x = SpatialCoordinate(cell) |
18 | 16 |
|
19 | 17 | # Elements
|
20 | 18 | u_element = basix.ufl.element("P", cell.cellname(), 2, shape=(3, ))
|
21 | 19 | p_element = basix.ufl.element("P", cell.cellname(), 1)
|
22 | 20 | A_element = basix.ufl.element("P", cell.cellname(), 1, shape=(3, 3))
|
23 | 21 |
|
| 22 | +# Spaces |
| 23 | +domain = Mesh(basix.ufl.element("Lagrange", cell.cellname(), 1, shape=(3, ))) |
| 24 | +u_space = FunctionSpace(domain, u_element) |
| 25 | +p_space = FunctionSpace(domain, p_element) |
| 26 | +A_space = FunctionSpace(domain, A_element) |
| 27 | + |
| 28 | +# Cell properties |
| 29 | +N = FacetNormal(domain) |
| 30 | +x = SpatialCoordinate(domain) |
| 31 | + |
24 | 32 | # Test and trial functions
|
25 |
| -v = TestFunction(u_element) |
26 |
| -w = TrialFunction(u_element) |
| 33 | +v = TestFunction(u_space) |
| 34 | +w = TrialFunction(u_space) |
27 | 35 |
|
28 | 36 | # Displacement at current and two previous timesteps
|
29 |
| -u = Coefficient(u_element) |
30 |
| -up = Coefficient(u_element) |
31 |
| -upp = Coefficient(u_element) |
| 37 | +u = Coefficient(u_space) |
| 38 | +up = Coefficient(u_space) |
| 39 | +upp = Coefficient(u_space) |
32 | 40 |
|
33 | 41 | # Time parameters
|
34 |
| -dt = Constant(cell) |
| 42 | +dt = Constant(domain) |
35 | 43 |
|
36 | 44 | # Fiber field
|
37 |
| -A = Coefficient(A_element) |
| 45 | +A = Coefficient(A_space) |
38 | 46 |
|
39 | 47 | # External forces
|
40 |
| -T = Coefficient(u_element) |
41 |
| -p0 = Coefficient(p_element) |
| 48 | +T = Coefficient(u_space) |
| 49 | +p0 = Coefficient(p_space) |
42 | 50 |
|
43 | 51 | # Material parameters FIXME
|
44 |
| -rho = Constant(cell) |
45 |
| -K = Constant(cell) |
46 |
| -c00 = Constant(cell) |
47 |
| -c11 = Constant(cell) |
48 |
| -c22 = Constant(cell) |
| 52 | +rho = Constant(domain) |
| 53 | +K = Constant(domain) |
| 54 | +c00 = Constant(domain) |
| 55 | +c11 = Constant(domain) |
| 56 | +c22 = Constant(domain) |
49 | 57 |
|
50 | 58 | # Deformation gradient
|
51 | 59 | I = Identity(d)
|
|
0 commit comments