Skip to content

Commit 41579ce

Browse files
connorjwardleo-collins
authored andcommitted
Merge pull request #4628 from firedrakeproject/connorjward/merge-release
2 parents aa8cdb0 + 8dbb017 commit 41579ce

File tree

12 files changed

+134
-45
lines changed

12 files changed

+134
-45
lines changed

.github/workflows/core.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
description: Whether to run the test suite
1616
type: boolean
1717
default: true
18+
build_docs:
19+
description: Whether to build the documentation
20+
type: boolean
21+
default: true
1822
test_macos:
1923
description: Whether to test using macOS
2024
type: boolean
@@ -42,6 +46,10 @@ on:
4246
description: Whether to run the test suite
4347
type: boolean
4448
default: true
49+
build_docs:
50+
description: Whether to build the documentation
51+
type: boolean
52+
default: true
4553
test_macos:
4654
description: Whether to test using macOS
4755
type: boolean
@@ -195,7 +203,7 @@ jobs:
195203
196204
: # Install from an sdist so we can make sure that it is not ill-formed
197205
pip install build
198-
python -m build ./firedrake-repo --sdist "$EXTRA_BUILD_ARGS"
206+
python -m build ./firedrake-repo --sdist $EXTRA_BUILD_ARGS
199207
200208
pip install --verbose $EXTRA_PIP_FLAGS \
201209
--no-binary h5py \
@@ -476,6 +484,7 @@ jobs:
476484
run: make lint GITHUB_ACTIONS_FORMATTING=1
477485

478486
build_docs:
487+
if: inputs.build_docs
479488
name: Build documentation
480489
runs-on: [self-hosted, Linux]
481490
container:

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
source_ref: ${{ inputs.branch }}
4848
target_branch: release
4949
run_tests: false
50+
build_docs: false
5051
upload_pypi: true
5152
secrets: inherit
5253

@@ -57,10 +58,11 @@ jobs:
5758
permissions:
5859
contents: write
5960
steps:
61+
- uses: actions/checkout@v5
6062
- name: Create release
6163
env:
6264
GH_TOKEN: ${{ github.token }}
63-
run: gh release create ${{ inputs.version }} --title ${{ inputs.version }} --generate-notes
65+
run: gh release create --title ${{ inputs.version }} --target ${{ inputs.branch }} --generate-notes ${{ inputs.version }}
6466

6567
docker:
6668
name: Build Docker containers

demos/full_waveform_inversion/full_waveform_inversion.py.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ for 3 wave sources. Therefore, we will have 3 emsemble members, each with 2 rank
8383
processes launched by mpiexec must therefore be equal to the product of number of ensemble members
8484
(3, in this case) with the number of processes to be used for each ensemble member (``M=2``, in this case).
8585
Additional details about the ensemble parallelism can be found in the
86-
`Firedrake documentation <https://www.firedrakeproject.org/parallelism.html#ensemble-parallelism>`_.
86+
`Firedrake documentation <https://www.firedrakeproject.org/ensemble_parallelism.html>`_.
8787

8888
The subcommunicators in each ensemble member are: ``Ensemble.comm`` and ``Ensemble.ensemble_comm``.
8989
``Ensemble.comm`` is the spatial communicator. ``Ensemble.ensemble_comm`` allows communication between

docs/source/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@
172172
r'https://www.hilton.com/en/hotels/leehnhn-hilton-leeds-city/',
173173
r'https://www.radissonhotels.com/en-us/hotels/park-plaza-leeds',
174174
r'https://www.radissonhotels.com/en-us/hotels/radisson-blu-leeds'
175+
r'https://www.radissonhotels.com/en-us/hotels/radisson-blu-leeds',
176+
r'https://all.accor.com/hotel/*',
175177
]
176178
linkcheck_timeout = 30
177179

docs/source/install.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,19 @@ firedrake-configure
6060
-------------------
6161

6262
To simplify the installation process, Firedrake provides a utility script called
63-
``firedrake-configure``. This script can be downloaded by executing::
63+
``firedrake-configure``. This script can be downloaded by executing:
6464

65-
$ curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/main/scripts/firedrake-configure
65+
.. only:: release
66+
67+
.. code-block:: text
68+
69+
$ curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/release/scripts/firedrake-configure
70+
71+
.. only:: main
72+
73+
.. code-block:: text
74+
75+
$ curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/main/scripts/firedrake-configure
6676
6777
Note that ``firedrake-configure`` **does not install Firedrake for you**. It
6878
is simply a helper script that emits the configuration options that Firedrake

firedrake/adjoint/ensemble_reduced_functional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class EnsembleReducedFunctional(AbstractReducedFunctional):
8585
The functionals :math:`J_i` and the control must be defined over a common
8686
`ensemble.comm` communicator. To understand more about how ensemble parallelism
8787
works, please refer to the `Firedrake manual
88-
<https://www.firedrakeproject.org/parallelism.html#ensemble-parallelism>`_.
88+
<https://www.firedrakeproject.org/ensemble_parallelism.html>`_.
8989
"""
9090
def __init__(self, functional, control, ensemble, scatter_control=True,
9191
gather_functional=None,

firedrake/adjoint_utils/variational_solver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def wrapper(self, *args, **kwargs):
2727
# Try again without expanding derivatives,
2828
# as dFdu might have been simplied to an empty Form
2929
self._ad_adj_F = adjoint(dFdu, derivatives_expanded=True)
30-
except (TypeError, NotImplementedError):
30+
except (ValueError, TypeError, NotImplementedError):
3131
self._ad_adj_F = None
3232
self._ad_kwargs = {'Jp': self.Jp, 'form_compiler_parameters': self.form_compiler_parameters, 'is_linear': self.is_linear}
3333
self._ad_count_map = {}

firedrake/assemble.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,23 @@ def assemble(expr, *args, **kwargs):
6060
`ufl.classes.Measure` in the form. For example, if a
6161
``quadrature_degree`` of 4 is specified in this argument, but a degree of
6262
3 is requested in the measure, the latter will be used.
63-
mat_type : str
63+
mat_type : str | None
6464
String indicating how a 2-form (matrix) should be
6565
assembled -- either as a monolithic matrix (``"aij"`` or ``"baij"``),
66-
a block matrix (``"nest"``), or left as a `matrix.ImplicitMatrix` giving
66+
a block matrix (``"nest"``), or left as a :class:`firedrake.matrix.ImplicitMatrix` giving
6767
matrix-free actions (``'matfree'``). If not supplied, the default value in
68-
``parameters["default_matrix_type"]`` is used. BAIJ differs
69-
from AIJ in that only the block sparsity rather than the dof
68+
``parameters["default_matrix_type"]`` is used. ``"baij"``` differs
69+
from ``"aij"`` in that only the block sparsity rather than the DoF
7070
sparsity is constructed. This can result in some memory
7171
savings, but does not work with all PETSc preconditioners.
72-
BAIJ matrices only make sense for non-mixed matrices.
73-
sub_mat_type : str
72+
``"baij"`` matrices only make sense for non-mixed matrices with arguments
73+
on a :func:`firedrake.functionspace.VectorFunctionSpace`.
74+
75+
NOTE
76+
----
77+
For the assembly of a 0-form or 1-form arising from the action of a 2-form,
78+
the default matrix type is ``"matfree"``.
79+
sub_mat_type : str | None
7480
String indicating the matrix type to
7581
use *inside* a nested block matrix. Only makes sense if
7682
``mat_type`` is ``nest``. May be one of ``"aij"`` or ``"baij"``. If
@@ -154,7 +160,10 @@ def get_assembler(form, *args, **kwargs):
154160
is_base_form_preprocessed = kwargs.pop('is_base_form_preprocessed', False)
155161
fc_params = kwargs.get('form_compiler_parameters', None)
156162
if isinstance(form, ufl.form.BaseForm) and not is_base_form_preprocessed:
157-
mat_type = kwargs.get('mat_type', None)
163+
# If not assembling a matrix, internal BaseForm nodes are matfree by default
164+
# Otherwise, the default matrix type is firedrake.parameters["default_matrix_type"]
165+
default_mat_type = "matfree" if len(form.arguments()) < 2 else None
166+
mat_type = kwargs.get('mat_type', default_mat_type)
158167
# Preprocess the DAG and restructure the DAG
159168
# Only pre-process `form` once beforehand to avoid pre-processing for each assembly call
160169
form = BaseFormAssembler.preprocess_base_form(form, mat_type=mat_type, form_compiler_parameters=fc_params)

firedrake/variational_solver.py

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import ufl
24
from itertools import chain
35
from contextlib import ExitStack
@@ -131,14 +133,38 @@ def dm(self):
131133
return self.u_restrict.function_space().dm
132134

133135
@staticmethod
134-
def compute_bc_lifting(J, u):
135-
"""Return the action of the bilinear form J (without bcs) on a Function u."""
136+
def compute_bc_lifting(J: ufl.BaseForm | slate.TensorBase,
137+
u: Function,
138+
L: ufl.BaseForm | slate.TensorBase | 0 = 0):
139+
"""Compute the residual after lifting DirichletBCs.
140+
141+
Parameters
142+
----------
143+
J
144+
The Jacobian bilinear form.
145+
u
146+
The Function on which DirichletBCs are applied.
147+
L
148+
The unlifted residual linear form.
149+
150+
Return
151+
------
152+
F : ufl.BaseForm | slate.TensorBase
153+
The residual J*u-L after lifting DirichletBCs.
154+
"""
136155
if isinstance(J, MatrixBase) and J.has_bcs:
137156
# Extract the full form without bcs
138157
if not isinstance(J.a, (ufl.BaseForm, slate.slate.TensorBase)):
139158
raise TypeError(f"Could not remove bcs from {type(J).__name__}.")
140159
J = J.a
141-
return ufl_expr.action(J, u)
160+
F = ufl_expr.action(J, u)
161+
if isinstance(F, slate.slate.TensorBase) and not isinstance(L, (ufl.Form, slate.slate.TensorBase)):
162+
# Slate expressions should not combine with assembled Cofunctions
163+
# because assemble(AssembledVector(L)) repeats element summation on L
164+
F = ufl.FormSum((F, 1), (L, -1))
165+
elif L != 0:
166+
F = F - L
167+
return F
142168

143169

144170
class NonlinearVariationalSolver(OptionsManager, NonlinearVariationalSolverMixin):
@@ -403,14 +429,12 @@ def __init__(self, a, L, u, bcs=None, aP=None,
403429
"""
404430
# In the linear case, the Jacobian is the equation LHS (J=a).
405431
# Jacobian is checked in superclass, but let's check L here.
406-
if not isinstance(L, (ufl.BaseForm, slate.slate.TensorBase)) and L == 0:
407-
F = self.compute_bc_lifting(a, u)
408-
else:
409-
if not isinstance(L, (ufl.BaseForm, slate.slate.TensorBase)):
410-
raise TypeError("Provided RHS is a '%s', not a Form or Slate Tensor" % type(L).__name__)
432+
if isinstance(L, (ufl.BaseForm, slate.slate.TensorBase)):
411433
if len(L.arguments()) != 1 and not L.empty():
412434
raise ValueError("Provided RHS is not a linear form")
413-
F = self.compute_bc_lifting(a, u) - L
435+
elif L != 0:
436+
raise TypeError(f"Provided RHS is a '{type(L).__name__}', not a Form or Slate Tensor")
437+
F = self.compute_bc_lifting(a, u, L=L)
414438

415439
super(LinearVariationalProblem, self).__init__(F, u, bcs=bcs, J=a, Jp=aP,
416440
form_compiler_parameters=form_compiler_parameters,

pyproject.toml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "firedrake"
33
# <year>.<month>.<patch>
44
# TODO RELEASE
5-
version = "2025.11.0.dev0"
5+
version = "2025.10.2.dev0"
66
description = "An automated system for the portable solution of partial differential equations using the finite element method"
77
readme = "README.rst"
88
license = "LGPL-3.0-or-later"
@@ -20,22 +20,21 @@ dependencies = [
2020
"decorator<=4.4.2",
2121
"mpi4py>3; python_version >= '3.13'",
2222
"mpi4py; python_version < '3.13'",
23-
# TODO RELEASE: use releases
24-
"fenics-ufl @ git+https://github.com/FEniCS/ufl.git@main",
25-
"firedrake-fiat @ git+https://github.com/firedrakeproject/fiat.git",
23+
# TODO RELEASE
24+
"fenics-ufl @ git+https://github.com/FEniCS/ufl.git@release",
25+
# TODO RELEASE
26+
"firedrake-fiat @ git+https://github.com/firedrakeproject/fiat.git@release",
2627
"h5py>3.12.1",
28+
"immutabledict",
2729
"libsupermesh",
2830
"loopy>2024.1",
2931
"numpy",
3032
"packaging",
31-
# TODO RELEASE
32-
# "petsc4py==3.23.4",
33-
# TODO RELEASE
34-
# "petsctools",
33+
"petsc4py==3.24.0",
34+
"petsctools",
3535
"pkgconfig",
3636
"progress",
37-
# TODO RELEASE: use a release
38-
"pyadjoint-ad @ git+https://github.com/dolfin-adjoint/pyadjoint",
37+
"pyadjoint-ad>=2025.10.0",
3938
"pycparser",
4039
"pytools[siphash]",
4140
"requests",
@@ -91,12 +90,10 @@ jax = [
9190
"jax",
9291
]
9392
netgen = [
94-
# TODO RELEASE
95-
# "ngsPETSc",
93+
"ngsPETSc>=0.1.1",
9694
]
9795
slepc = [
98-
# TODO RELEASE
99-
# "slepc4py==3.23.2",
96+
"slepc4py==3.24.0",
10097
]
10198
torch = [ # requires passing '--extra-index-url' to work
10299
"torch",
@@ -110,16 +107,15 @@ ci = [
110107
"mpi-pytest>=2025.7",
111108
"nbval",
112109
"networkx",
113-
"ngsPETSc",
110+
"ngsPETSc>=0.1.1",
114111
"pdf2image",
115112
"pygraphviz",
116113
"pylit",
117114
"pytest",
118115
"pytest-split", # needed for firedrake-run-split-tests
119116
"pytest-timeout",
120117
"pytest-xdist",
121-
# TODO RELEASE
122-
# "slepc4py==3.23.2",
118+
"slepc4py==3.24.0",
123119
"torch", # requires passing '--extra-index-url' to work
124120
]
125121
docker = [ # Used in firedrake-vanilla container
@@ -135,8 +131,7 @@ docker = [ # Used in firedrake-vanilla container
135131
"pytest-split", # needed for firedrake-run-split-tests
136132
"pytest-timeout",
137133
"pytest-xdist",
138-
# TODO RELEASE
139-
# "slepc4py==3.23.2",
134+
"slepc4py==3.24.0",
140135
]
141136

142137
[build-system]
@@ -150,8 +145,7 @@ requires = [
150145
"pkgconfig",
151146
"pybind11",
152147
"setuptools>=77.0.3",
153-
# TODO RELEASE
154-
# "petsc4py==3.23.4",
148+
"petsc4py==3.24.0",
155149
"rtree>=1.2",
156150
]
157151
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)