Repository navigation
Replies: 3 comments 2 replies
Architectural Design: Goal-Oriented Dual Weighted Residual (DWR) Adaptivity via Bubble/Cone Localization
This framework integrates Goal-Oriented Dual Weighted Residual (DWR) error estimation into the 1. Architecture & Data Flow
2. User-Facing APIThe user API abstracts the underlying matrix transpositions, dual space mappings, and localization mechanics into a single setup call. from firedrake import *
# 1. Mesh and Hierarchy Setup
geo = SplineGeometry()
geo.AddCircle((0, 0), r=1.0)
coarse_mesh = Mesh(geo.GenerateMesh(maxh=0.5))
hierarchy = AdaptiveMeshHierarchy(coarse_mesh)
# 2. Primal Problem Definition (Low-order Space V)
V = FunctionSpace(hierarchy[0], "CG", 1)
u = Function(V)
v = TestFunction(V)
F = dot(grad(u), grad(u))*dot(grad(u), grad(v))*dx - f*v*dx # p-Laplacian example
# 3. Define the Goal Functional (Quantity of Interest)
J = u * dx
params = {
"snes_type": "newtonls",
"snes_adapt_type": "basic",
"pc_type": "mg"
}
prob = NonlinearVariationalProblem(F, u)
solver = NonlinearVariationalSolver(prob, solver_parameters=params)
# 4. Attach the Rognes-Logg DWR marking callback via goal and enrichment configurations
solver.set_dwr_marking_strategy(goal=J, extra_degree=1, fraction=0.15)
# 5. Execute. Adjoint solves happen implicitly via solveTranspose behind the scenes
solver.solve()
u_fine = solver.get_adapted_solution()3. Implementation Details3.1 Front-End Transpose Solve Implementation (
|
|
This is so much detail... I don't really want to read this. Can't you write a more concise summary (not AI) about what you want to do? We want to evaluate the high level ideas and this is a lot of effort to read and respond to. The plan you have here is basically an implementation detail that we don't need to see. |
|
In the DWR user-facing API: where does the tolerance on the goal functional error go? Or does it only do one refinement, and it's up to an outer loop to keep refining until the error tolerance is met? I confess I prefer the API in #4893 . |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Implementation Plan: PETSc
SNESAdaptwith Multigrid Hierarchy in FiredrakeThis document outlines the complete implementation plan for integrating PETSc's adaptive nonlinear solvers (
SNESAdapt) within Firedrake, with specialized support for geometric multigrid hierarchies built on top of Netgen geometries viangsPETSc.Due to the immutable nature of Firedrake's mesh topologies, in-place$h$ -adaptivity is replaced by an append-only, monotonic
MeshHierarchyextension. Netgen is used exclusively as a background geometric oracle to snap newly introduced boundary vertices to the true CAD surface, guaranteeing strict topological nestedness and optimal performance for Geometric Multigrid (PCMG) transfer operators.1. Architecture & Data Flow
DMLabelProduction: Firedrake takes the flagged data array from the function space level and automatically populates a native PETScDMLabelassigned to the mesh's underlyingDMPlex.DMRefinecall via a Python callback, triggering a topological split of the mesh guided by the generatedDMLabel, and appends a new discreteMeshobject to an append-onlyMeshHierarchy.PCMG(Preconditioner Multigrid) is notified of the depth increase, and Firedrake's nested restriction and prolongation operators are cleanly mapped to the new solver level.2. User-Facing API & Usage Sketch
This sketch demonstrates how a user defines a custom marking callback (e.g., executing a residual error estimation or threshold metric mapped to a$DG0$ space), connects it to the solver context, and solves using an automated
DMLabelpipeline.3. Code Implementation Blueprint
3.1 Extension of
MeshHierarchy(firedrake/mesh.py)Tracks the hierarchy depth and routes topological modifications guided by localized cell-marking indicators.
3.2 Automated
DMLabelConstruction Hook (firedrake/dmhooks.py)Converts high-level Firedrake element arrays into native low-level PETSc tracking structures mapped to
DMPlexpoints.3.3 Internal Solver Loop & Callback Bridge (
firedrake/variational_solver.py)Updates
NonlinearVariationalSolverto execute the user's marking logic, construct the requiredDMLabel, and unwrap the final result field.All reactions