Skip to content

Commit 9e8c597

Browse files
committed
Merge branch 'main' into release
2 parents 512ee20 + 77ae57c commit 9e8c597

File tree

227 files changed

+8543
-7763
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+8543
-7763
lines changed

.github/workflows/fenicsx-tests.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
path: ./ffcx
4343
repository: FEniCS/ffcx
4444
ref: main
45+
4546
- name: Install FFCx
4647
run: |
4748
cd ffcx
@@ -55,8 +56,6 @@ jobs:
5556
container: fenicsproject/test-env:nightly-openmpi
5657

5758
env:
58-
CC: clang
59-
CXX: clang++
6059

6160
PETSC_ARCH: linux-gnu-complex-32
6261
OMPI_ALLOW_RUN_AS_ROOT: 1

.github/workflows/pythonapp.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
branches:
1010
- "**"
1111
tags:
12-
- "v*"
12+
- "**"
1313
pull_request:
1414
branches:
1515
- main
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
matrix:
2222
os: [ubuntu-latest, macos-latest]
23-
python-version: ['3.7', '3.8', '3.9', '3.10']
23+
python-version: ['3.8', '3.9', '3.10', '3.11']
2424

2525
steps:
2626
- uses: actions/checkout@v3
@@ -35,7 +35,7 @@ jobs:
3535
- name: Check documentation style
3636
run: |
3737
python -m pip install pydocstyle
38-
python -m pydocstyle .
38+
python -m pydocstyle ufl/
3939
- name: Install UFL
4040
run: python -m pip install .[ci]
4141
- name: Run unit tests

.github/workflows/tsfc-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ jobs:
4242
pip install git+https://github.com/FInAT/FInAT.git#egg=finat
4343
pip install git+https://github.com/firedrakeproject/loopy.git#egg=loopy
4444
pip install .[ci]
45+
pip install pytest
4546
- name: Run tsfc unit tests
4647
run: python3 -m pytest tsfc/tests

AUTHORS

+2
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ Contributors:
2828
| Corrado Maurini <[email protected]>
2929
| Jack S. Hale <[email protected]>
3030
| Tuomas Airaksinen <[email protected]>
31+
| Nacime Bouziani <[email protected]>
3132
| Reuben W. Hill <[email protected]>
33+
| Nacime Bouziani <[email protected]>

demo/Constant.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,20 @@
1818
# Modified by Martin Sandve Alnes, 2009
1919
#
2020
# Test form for scalar and vector constants.
21-
from ufl import (Coefficient, Constant, FiniteElement, TestFunction,
22-
TrialFunction, VectorConstant, dot, dx, grad, inner, triangle)
21+
from ufl import (Coefficient, Constant, FiniteElement, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorConstant,
22+
VectorElement, dot, dx, grad, inner, triangle)
2323

2424
cell = triangle
2525
element = FiniteElement("Lagrange", cell, 1)
26+
domain = Mesh(VectorElement("Lagrange", cell, 1))
27+
space = FunctionSpace(domain, element)
2628

27-
v = TestFunction(element)
28-
u = TrialFunction(element)
29-
f = Coefficient(element)
29+
v = TestFunction(space)
30+
u = TrialFunction(space)
31+
f = Coefficient(space)
3032

31-
c = Constant(cell)
32-
d = VectorConstant(cell)
33+
c = Constant(space)
34+
d = VectorConstant(space)
3335

3436
a = c * dot(grad(v), grad(u)) * dx
3537
L = inner(d, grad(v)) * dx

demo/ConvectionJacobi.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
# Author: Martin Sandve Alnes
33
# Date: 2008-10-03
44
#
5-
from ufl import (Coefficient, TestFunction, TrialFunction, VectorElement, dot,
6-
dx, grad, triangle)
5+
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dot, dx, grad, triangle
76

87
element = VectorElement("Lagrange", triangle, 1)
8+
domain = Mesh(VectorElement("Lagrange", triangle, 1))
9+
space = FunctionSpace(domain, element)
910

10-
u = TrialFunction(element)
11-
v = TestFunction(element)
12-
w = Coefficient(element)
11+
u = TrialFunction(space)
12+
v = TestFunction(space)
13+
w = Coefficient(space)
1314

1415
a = dot(dot(u, grad(w)) + dot(w, grad(u)), v) * dx

demo/ConvectionJacobi2.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
# Author: Martin Sandve Alnes
33
# Date: 2008-10-03
44
#
5-
from ufl import (Coefficient, TestFunction, TrialFunction, VectorElement, dx,
6-
i, j, triangle)
5+
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dx, i, j, triangle
76

87
element = VectorElement("Lagrange", triangle, 1)
8+
domain = Mesh(VectorElement("Lagrange", triangle, 1))
9+
space = FunctionSpace(domain, element)
910

10-
u = TrialFunction(element)
11-
v = TestFunction(element)
12-
w = Coefficient(element)
11+
u = TrialFunction(space)
12+
v = TestFunction(space)
13+
w = Coefficient(space)
1314

1415
a = (u[j] * w[i].dx(j) + w[j] * u[i].dx(j)) * v[i] * dx

demo/ConvectionVector.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# Author: Martin Sandve Alnes
33
# Date: 2008-10-03
44
#
5-
from ufl import (Coefficient, TestFunction, VectorElement, dot, dx, grad,
6-
triangle)
5+
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, VectorElement, dot, dx, grad, triangle
76

87
element = VectorElement("Lagrange", triangle, 1)
8+
domain = Mesh(VectorElement("Lagrange", triangle, 1))
9+
space = FunctionSpace(domain, element)
910

10-
v = TestFunction(element)
11-
w = Coefficient(element)
11+
v = TestFunction(space)
12+
w = Coefficient(space)
1213

1314
a = dot(dot(w, grad(w)), v) * dx

demo/Elasticity.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
# Modified by: Martin Sandve Alnes
44
# Date: 2009-01-12
55
#
6-
from ufl import (TestFunction, TrialFunction, VectorElement, dx, grad, inner,
7-
tetrahedron)
6+
from ufl import FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dx, grad, inner, tetrahedron
87

98
element = VectorElement("Lagrange", tetrahedron, 1)
9+
domain = Mesh(VectorElement("Lagrange", tetrahedron, 1))
10+
space = FunctionSpace(domain, element)
1011

11-
v = TestFunction(element)
12-
u = TrialFunction(element)
12+
v = TestFunction(space)
13+
u = TrialFunction(space)
1314

1415

1516
def epsilon(v):

demo/EnergyNorm.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
#
1818
# This example demonstrates how to define a functional, here
1919
# the energy norm (squared) for a reaction-diffusion problem.
20-
from ufl import Coefficient, FiniteElement, dot, dx, grad, tetrahedron
20+
from ufl import Coefficient, FiniteElement, FunctionSpace, Mesh, VectorElement, dot, dx, grad, tetrahedron
2121

2222
element = FiniteElement("Lagrange", tetrahedron, 1)
23+
domain = Mesh(VectorElement("Lagrange", tetrahedron, 1))
24+
space = FunctionSpace(domain, element)
2325

24-
v = Coefficient(element)
26+
v = Coefficient(space)
2527
a = (v * v + dot(grad(v), grad(v))) * dx

demo/Equation.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,18 @@
3434
# the unknown u to the right-hand side, all terms may
3535
# be listed on one line and left- and right-hand sides
3636
# extracted by lhs() and rhs().
37-
from ufl import (Coefficient, FiniteElement, TestFunction, TrialFunction, dot,
38-
dx, grad, lhs, rhs, triangle)
37+
from ufl import (Coefficient, FiniteElement, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dot, dx,
38+
grad, lhs, rhs, triangle)
3939

4040
element = FiniteElement("Lagrange", triangle, 1)
41+
domain = Mesh(VectorElement("Lagrange", triangle, 1))
42+
space = FunctionSpace(domain, element)
4143

4244
k = 0.1
4345

44-
v = TestFunction(element)
45-
u = TrialFunction(element)
46-
u0 = Coefficient(element)
46+
v = TestFunction(space)
47+
u = TrialFunction(space)
48+
u0 = Coefficient(space)
4749

4850
F = v * (u - u0) * dx + k * dot(grad(v), grad(0.5 * (u0 + u))) * dx
4951

demo/ExplicitConvection.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
# Author: Martin Sandve Alnes
33
# Date: 2008-10-03
44
#
5-
from ufl import (Coefficient, TestFunction, TrialFunction, VectorElement, dot,
6-
dx, grad, triangle)
5+
from ufl import Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dot, dx, grad, triangle
76

87
element = VectorElement("Lagrange", triangle, 1)
8+
domain = Mesh(VectorElement("Lagrange", triangle, 1))
9+
space = FunctionSpace(domain, element)
910

10-
u = TrialFunction(element)
11-
v = TestFunction(element)
12-
w = Coefficient(element)
11+
u = TrialFunction(space)
12+
v = TestFunction(space)
13+
w = Coefficient(space)
1314

1415
a = dot(dot(w, grad(u)), v) * dx

demo/FEEC.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
2424
and their aliases.
2525
"""
26-
from ufl import (FiniteElement, TestFunction, TestFunctions, TrialFunction,
27-
TrialFunctions, dx)
26+
from ufl import (FiniteElement, FunctionSpace, Mesh, TestFunction, TestFunctions, TrialFunction, TrialFunctions,
27+
VectorElement, dx)
2828
from ufl import exterior_derivative as d
2929
from ufl import inner, interval, tetrahedron, triangle
3030

@@ -38,17 +38,19 @@
3838

3939
# Testing exterior derivative
4040
V = FiniteElement(family, cell, r, form_degree=k)
41-
v = TestFunction(V)
42-
u = TrialFunction(V)
41+
domain = Mesh(VectorElement("Lagrange", cell, 1))
42+
space = FunctionSpace(domain, V)
43+
v = TestFunction(space)
44+
u = TrialFunction(space)
4345

4446
a = inner(d(u), d(v)) * dx
4547

4648
# Testing mixed formulation of Hodge Laplace
4749
if k > 0 and k < tdim + 1:
4850
S = FiniteElement(family, cell, r, form_degree=k - 1)
4951
W = S * V
50-
(sigma, u) = TrialFunctions(W)
51-
(tau, v) = TestFunctions(W)
52+
mixed_space = FunctionSpace(domain, W)
53+
(sigma, u) = TrialFunctions(mixed_space)
54+
(tau, v) = TestFunctions(mixed_space)
5255

53-
a = (inner(sigma, tau) - inner(d(tau), u) +
54-
inner(d(sigma), v) + inner(d(u), d(v))) * dx
56+
a = (inner(sigma, tau) - inner(d(tau), u) + inner(d(sigma), v) + inner(d(u), d(v))) * dx

demo/FunctionOperators.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
# along with UFL. If not, see <http://www.gnu.org/licenses/>.
1717
#
1818
# Test form for operators on Coefficients.
19-
from ufl import (Coefficient, FiniteElement, TestFunction, TrialFunction,
20-
dot, dx, grad, sqrt, triangle, max_value)
19+
from ufl import (Coefficient, FiniteElement, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement, dot, dx,
20+
grad, max_value, sqrt, triangle)
2121

2222
element = FiniteElement("Lagrange", triangle, 1)
23+
domain = Mesh(VectorElement("Lagrange", triangle, 1))
24+
space = FunctionSpace(domain, element)
2325

24-
v = TestFunction(element)
25-
u = TrialFunction(element)
26-
f = Coefficient(element)
27-
g = Coefficient(element)
26+
v = TestFunction(space)
27+
u = TrialFunction(space)
28+
f = Coefficient(space)
29+
g = Coefficient(space)
2830

2931
a = sqrt(1 / max_value(1 / f, -1 / f)) * sqrt(g) * dot(grad(v), grad(u)) * dx + v * u * sqrt(f * g) * g * dx

demo/H1norm.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
# Author: Martin Sandve Alnes
33
# Date: 2008-10-03
44
#
5-
from ufl import Coefficient, FiniteElement, dot, dx, grad, triangle
5+
from ufl import Coefficient, FiniteElement, FunctionSpace, Mesh, VectorElement, dot, dx, grad, triangle
66

77
element = FiniteElement("Lagrange", triangle, 1)
8+
domain = Mesh(VectorElement("Lagrange", triangle, 1))
9+
space = FunctionSpace(domain, element)
810

9-
f = Coefficient(element)
11+
f = Coefficient(space)
1012

1113
a = (f * f + dot(grad(f), grad(f))) * dx

demo/HarmonicMap.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
# Author: Martin Alnes
44
# Date: 2009-04-09
55
#
6-
from ufl import (Coefficient, FiniteElement, VectorElement,
7-
derivative, dot, dx, grad, inner, triangle)
6+
from ufl import (Coefficient, FiniteElement, FunctionSpace, Mesh, VectorElement, derivative, dot, dx, grad, inner,
7+
triangle)
88

99
cell = triangle
1010
X = VectorElement("Lagrange", cell, 1)
1111
Y = FiniteElement("Lagrange", cell, 1)
12+
domain = Mesh(VectorElement("Lagrange", cell, 1))
13+
X_space = FunctionSpace(domain, X)
14+
Y_space = FunctionSpace(domain, Y)
1215

13-
x = Coefficient(X)
14-
y = Coefficient(Y)
16+
x = Coefficient(X_space)
17+
y = Coefficient(Y_space)
1518

1619
L = inner(grad(x), grad(x)) * dx + dot(x, x) * y * dx
1720

demo/HarmonicMap2.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
# Author: Martin Alnes
44
# Date: 2009-04-09
55
#
6-
from ufl import (Coefficient, FiniteElement, VectorElement, derivative, dot,
7-
dx, grad, inner, split, triangle)
6+
from ufl import (Coefficient, FiniteElement, FunctionSpace, Mesh, VectorElement, derivative, dot, dx, grad, inner,
7+
split, triangle)
88

99
cell = triangle
1010
X = VectorElement("Lagrange", cell, 1)
1111
Y = FiniteElement("Lagrange", cell, 1)
1212
M = X * Y
13+
domain = Mesh(VectorElement("Lagrange", cell, 1))
14+
space = FunctionSpace(domain, M)
1315

14-
u = Coefficient(M)
16+
u = Coefficient(space)
1517
x, y = split(u)
1618

1719
L = inner(grad(x), grad(x)) * dx + dot(x, x) * y * dx

demo/Heat.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,20 @@
2020
# The bilinear form a(v, u1) and linear form L(v) for
2121
# one backward Euler step with the heat equation.
2222
#
23-
from ufl import (Coefficient, Constant, FiniteElement, TestFunction,
24-
TrialFunction, dot, dx, grad, triangle)
23+
from ufl import (Coefficient, Constant, FiniteElement, FunctionSpace, Mesh, TestFunction, TrialFunction, VectorElement,
24+
dot, dx, grad, triangle)
2525

2626
cell = triangle
2727
element = FiniteElement("Lagrange", cell, 1)
28+
domain = Mesh(VectorElement("Lagrange", cell, 1))
29+
space = FunctionSpace(domain, element)
2830

29-
v = TestFunction(element) # Test function
30-
u1 = TrialFunction(element) # Value at t_n
31-
u0 = Coefficient(element) # Value at t_n-1
32-
c = Coefficient(element) # Heat conductivity
33-
f = Coefficient(element) # Heat source
34-
k = Constant(cell) # Time step
31+
v = TestFunction(space) # Test function
32+
u1 = TrialFunction(space) # Value at t_n
33+
u0 = Coefficient(space) # Value at t_n-1
34+
c = Coefficient(space) # Heat conductivity
35+
f = Coefficient(space) # Heat source
36+
k = Constant(domain) # Time step
3537

3638
a = v * u1 * dx + k * c * dot(grad(v), grad(u1)) * dx
3739
L = v * u0 * dx + k * v * f * dx

0 commit comments

Comments
 (0)