Repository navigation
Conversation
pefarrell
requested changes
Oct 5, 2026
pefarrell
previously approved these changes
Oct 5, 2026
pbrubeck
force-pushed
the
pbrubeck/goal-adaptive-callback
branch
from
November 24, 2026 13:48
aadab0b to
f29280f
Compare
pbrubeck
force-pushed
the
pbrubeck/goal-adaptive-callback
branch
3 times, most recently
from
November 25, 2026 10:33
b8a266d to
48e0dcc
Compare
pbrubeck
force-pushed
the
pbrubeck/goal-adaptive-callback-demos
branch
3 times, most recently
from
November 25, 2026 18:38
9d4ba17 to
36b47dd
Compare
pbrubeck
force-pushed
the
pbrubeck/goal-adaptive-callback
branch
3 times, most recently
from
November 25, 2026 22:35
7b7f5bc to
bb9fab0
Compare
pbrubeck
force-pushed
the
pbrubeck/goal-adaptive-callback-demos
branch
from
November 26, 2026 10:24
b909ae9 to
62d5f65
Compare
Add a GoalOrientedMarker that marks cells from a dual-weighted residual estimate, and drive adaptive refinement with SNES grid sequencing. A marking callback that returns None stops grid sequencing. solve() accepts a marking_callback, and the adjoint solves drop it. Add _SNESContext.solve_jacobian, which solves the dual problems with the current Jacobian and its KSP. Replace check_snes_convergence with check_convergence, which also checks a KSP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assisted-by: OpenAI Codex
Use SNES grid sequencing and GoalOrientedMarker to refine the mesh for a boundary flux goal.
pbrubeck
force-pushed
the
pbrubeck/goal-adaptive-callback-demos
branch
from
November 26, 2026 10:25
62d5f65 to
8d759ba
Compare
Replace the initial guess interpolated from the exact solution with the solution of a Poisson problem. Scale it by the minimiser of the energy along it, then run the adaptive solve with the trust-region Newton method and the energy as its objective. Derive the residual from the energy. Use the net outward flux through the top boundary as the goal, plot the DWR estimate against the true error, and plot the solution under the adapted mesh right after the solve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The marker weighted the primal residual by the dual error alone. For a goal at which the problem is stationary, such as the energy of a minimisation problem, the dual solution is zero, so the estimate was zero and the adaptation stopped on the first mesh. Add the adjoint residual weighted by the primal error, and take the mean of the two weighted residuals. The enriched primal solution gives the primal error, so the estimate needs no further global solves. The remainder of the estimate is cubic in the errors. The cell indicators localise both residuals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Put the adaptive solve and the plots in a helper that starts each goal from the same initial mesh and initial guess. Plot the solution with the adapted mesh next to the convergence of the estimate for each goal. Explain the symmetrised estimate, and how it reduces for the energy goal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pbrubeck
force-pushed
the
pbrubeck/goal-adaptive-callback-demos
branch
from
November 27, 2026 18:09
dea250a to
40bd921
Compare
Assisted-by: OpenAI Codex
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a demo of goal-oriented mesh adaptivity with the dual-weighted residual
(DWR) method, using the marking callback and the adaptive
solve-estimate-mark-refine cycle from #5273. This PR is stacked on #5273 and
targets
pbrubeck/goal-adaptive-callback.demos/goal_oriented_nonlinear_p_laplacianThe demo solves a strongly nonlinear p-Laplacian (p = 5) on the unit square,
with a manufactured solution, and adapts the mesh for a goal functional. The
goal is the integral of the normal derivative through the top boundary.
(
snes_grid_sequence,goal_atol/goal_rtol,goal_marking_fraction,goal_monitor).GoalOrientedMarkertoNonlinearVariationalSolverand supply an exactsolution so that the monitor reports effectivity indices.
marker.estimatesand the solution on the final meshfrom
solver.solve().The text explains how the marker estimates the discretisation and algebraic
errors separately and reports when the algebraic error dominates.
The demo is listed in the advanced tutorials and in
tests/firedrake/demos/test_demos_run.py. Its references are indemos/demo_references.bib.🤖 Generated with Claude Code. Branch cleanup
assisted by OpenAI Codex.