Skip to content

Commit 6e78790

Browse files
committed
merge conflict
2 parents 1765fd8 + 15bdd53 commit 6e78790

Some content is hidden

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

60 files changed

+2620
-755
lines changed

demos/saddle_point_pc/saddle_point_systems.py.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Finally, at each mesh size, we print out the number of cells in the
180180
mesh and the number of iterations the solver took to converge ::
181181

182182
#
183-
print(w.function_space().mesh().num_cells(), solver.snes.ksp.getIterationNumber())
183+
print(w.function_space().mesh().unique().num_cells(), solver.snes.ksp.getIterationNumber())
184184

185185
The resulting convergence is unimpressive:
186186

@@ -282,7 +282,7 @@ applying the action of blocks, so we can use a block matrix format. ::
282282
for n in range(8):
283283
solver, w = build_problem(n, parameters, block_matrix=True)
284284
solver.solve()
285-
print(w.function_space().mesh().num_cells(), solver.snes.ksp.getIterationNumber())
285+
print(w.function_space().mesh().unique().num_cells(), solver.snes.ksp.getIterationNumber())
286286

287287
The resulting convergence is algorithmically good, however, the larger
288288
problems still take a long time.
@@ -367,7 +367,7 @@ Let's see what happens. ::
367367
for n in range(8):
368368
solver, w = build_problem(n, parameters, block_matrix=True)
369369
solver.solve()
370-
print(w.function_space().mesh().num_cells(), solver.snes.ksp.getIterationNumber())
370+
print(w.function_space().mesh().unique().num_cells(), solver.snes.ksp.getIterationNumber())
371371

372372
This is much better, the problem takes much less time to solve and
373373
when observing the iteration counts for inverting :math:`S` we can see
@@ -422,7 +422,7 @@ and so we no longer need a flexible Krylov method. ::
422422
for n in range(8):
423423
solver, w = build_problem(n, parameters, block_matrix=True)
424424
solver.solve()
425-
print(w.function_space().mesh().num_cells(), solver.snes.ksp.getIterationNumber())
425+
print(w.function_space().mesh().unique().num_cells(), solver.snes.ksp.getIterationNumber())
426426

427427
This results in the following GMRES iteration counts
428428

@@ -487,7 +487,7 @@ variable. We can provide it as an :class:`~.AuxiliaryOperatorPC` via a python pr
487487
for n in range(8):
488488
solver, w = build_problem(n, parameters, aP=None, block_matrix=False)
489489
solver.solve()
490-
print(w.function_space().mesh().num_cells(), solver.snes.ksp.getIterationNumber())
490+
print(w.function_space().mesh().unique().num_cells(), solver.snes.ksp.getIterationNumber())
491491

492492
This actually results in slightly worse convergence than the diagonal
493493
approximation we used above.
@@ -571,7 +571,7 @@ Let's see what the iteration count looks like now. ::
571571
for n in range(8):
572572
solver, w = build_problem(n, parameters, aP=riesz, block_matrix=True)
573573
solver.solve()
574-
print(w.function_space().mesh().num_cells(), solver.snes.ksp.getIterationNumber())
574+
print(w.function_space().mesh().unique().num_cells(), solver.snes.ksp.getIterationNumber())
575575

576576
============== ==================
577577
Mesh elements GMRES iterations

docs/source/conf.py

Lines changed: 3 additions & 3 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

@@ -413,10 +415,8 @@
413415

414416
intersphinx_mapping = {
415417
'pyop2': ('https://op2.github.io/PyOP2', None),
416-
'ufl': ('https://fenics.readthedocs.io/projects/ufl/en/latest/', None),
417418
'ufl': ('https://docs.fenicsproject.org/ufl/main/', None),
418-
'FIAT': ('https://fenics.readthedocs.io/projects/fiat/en/latest/', None),
419-
'FInAT': ('https://finat.github.io/FInAT/', None),
419+
'FIAT': ('https://firedrakeproject.org/fiat', None),
420420
'petsctools': ('https://firedrakeproject.org/petsctools/', None),
421421
'mpi4py': ('https://mpi4py.readthedocs.io/en/stable/', None),
422422
'h5py': ('http://docs.h5py.org/en/latest/', None),

docs/source/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ should be followed:
590590
591591
#. Install Firedrake in editable mode without build isolation::
592592

593-
$ pip install --no-build-isolation --no-binary h5py --editable './firedrake[check]'
593+
$ pip install --no-build-isolation --no-binary h5py --editable './firedrake[check,docs]'
594594

595595

596596
Editing subpackages

firedrake/adjoint_utils/blocks/solving.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ def _should_compute_boundary_adjoint(self, relevant_dependencies):
163163
def adj_sol(self):
164164
return self.adj_state
165165

166+
@adj_sol.setter
167+
def adj_sol(self, value):
168+
if self.adj_state is None:
169+
self.adj_state = value.copy(deepcopy=True)
170+
else:
171+
self.adj_state.assign(value)
172+
166173
def prepare_evaluate_adj(self, inputs, adj_inputs, relevant_dependencies):
167174
fwd_block_variable = self.get_outputs()[0]
168175
u = fwd_block_variable.output
@@ -187,7 +194,7 @@ def prepare_evaluate_adj(self, inputs, adj_inputs, relevant_dependencies):
187194
adj_sol, adj_sol_bdy = self._assemble_and_solve_adj_eq(
188195
dFdu_form, dJdu, compute_bdy
189196
)
190-
self.adj_state = adj_sol
197+
self.adj_sol = adj_sol
191198
if self.adj_cb is not None:
192199
self.adj_cb(adj_sol)
193200
if self.adj_bdy_cb is not None and compute_bdy:
@@ -408,7 +415,7 @@ def prepare_evaluate_hessian(self, inputs, hessian_inputs, adj_inputs,
408415
firedrake.derivative(dFdu_form, fwd_block_variable.saved_output,
409416
tlm_output))
410417

411-
adj_sol = self.adj_state
418+
adj_sol = self.adj_sol
412419
if adj_sol is None:
413420
raise RuntimeError("Hessian computation was run before adjoint.")
414421
bdy = self._should_compute_boundary_adjoint(relevant_dependencies)
@@ -726,7 +733,7 @@ def prepare_evaluate_adj(self, inputs, adj_inputs, relevant_dependencies):
726733
relevant_dependencies
727734
)
728735
adj_sol, adj_sol_bdy = self._adjoint_solve(adj_inputs[0], compute_bdy)
729-
self.adj_state = adj_sol
736+
self.adj_sol = adj_sol
730737
if self.adj_cb is not None:
731738
self.adj_cb(adj_sol)
732739
if self.adj_bdy_cb is not None and compute_bdy:

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 = {}

0 commit comments

Comments
 (0)