Repository navigation
Add the FEM solution interface on PDETimeSeriesSolution - #8
Merged
Merged
Conversation
FEMMetadata as the problem_type of a DAEProblem (or NonlinearProblem) makes solve return a SciMLBase.PDETimeSeriesSolution (PDENoTimeSolution when steady) indexed in the PDESystem variables: vertex-valued fields, traces on boundary pieces, facet-mean normal fluxes, first derivatives, point evaluation with NaN outside the mesh, and VTK export (spec section 7.8). Only space.dh is read from the space, so the FEMSpace slots in later. Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: 79577b03-59e1-4632-bd76-f6fcde70b991 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
A new Solution test group solves u_t = Δu with u = sin(t) on an inlet, lowered by hand with Ferrite to a DAEProblem, on a unit square, an L-shape and a P1 + P2 two-field case, plus a steady Laplace solution and a graded mesh where Ferrite's nearest-node point search misses an interior point. Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: 79577b03-59e1-4632-bd76-f6fcde70b991 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Codex round 1: the L2 projection of the gradient now integrates at order 2p, so P2 fields reproduce polynomial derivatives exactly; the time-span check accepts solutions saved backwards; .pvd file attributes are XML-escaped. SciMLBase compat rises to the 3.58 floor the wrapper relies on. Docstrings move to a new API page so Documenter's missing_docs check passes, and a flagged variable name is renamed for typos. Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: 79577b03-59e1-4632-bd76-f6fcde70b991 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Independent review: (1) the point-search fallback passes cellset to PointEvalHandler, a keyword added in Ferrite 1.6, so Ferrite compat is now 1.7, the spec floor and the space-layer PR's bound. (3) sol[Dx(u)] assembled and factorised a fresh L2Projector per saved step; it now builds one per key and reuses it with project(proj, qpvals, qr), with identical results and a test that the call allocates far less than one projector per step. (2) The trace tests do not claim the spec 7.8 exit check. They prove the wrapper bit-for-bit (sol[u(t, Γ)] equals the raw inlet dofs) and show sin(t) agreement at the solve tolerance (1e-3 by default, 1e-9 at 1e-10 tolerances); the testset is now named 'wrapper trace equals the raw inlet dofs'. The 9.4e-5 raw violation at default tolerances is a solver/lowering matter, and the 1e-12 trace check on the Gmsh L-shape is owned by the front-end PR through the numeric DAE path. Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: 79577b03-59e1-4632-bd76-f6fcde70b991 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Codex round on de8e95c: PointValues, CellValues and FacetValues defaulted to linear geometry, so pointwise and projected derivatives and normal_flux threw on QuadraticTriangle meshes. They now take Ferrite.geometric_interpolation of the grid's cell type (spec 6.2). A new testset checks P2 fields on a QuadraticTriangle mesh: point values, pointwise and projected derivatives and facet fluxes are exact for linear and quadratic data. Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: 79577b03-59e1-4632-bd76-f6fcde70b991 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Codex on 475ba16: piece_nodes took a facet's nodes from Ferrite.facets, which lists vertices only, so on quadratic meshes the traces dropped the mid-edge boundary nodes that sol[x] and sol[u] contain. It now maps each facet to its local nodes through the geometric interpolation's facet dofs (Ferrite.dirichlet_facetdof_indices, which replaces facets in the QA ignore list). Columns stay sorted node ids, so they index sol[x]. New tests on a QuadraticTriangle mesh check that the inlet has all five nodes and that steady and transient traces equal the field at those nodes; the test assembly now uses the mesh's geometric interpolation too. Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: 79577b03-59e1-4632-bd76-f6fcde70b991 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: 79577b03-59e1-4632-bd76-f6fcde70b991 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Codex: _wrap_parts allocated Float64 buffers, so a complex-valued solution threw InexactError on wrap. The wrapper, the steady conversion, point evaluation (with a NaN of the field's type outside the mesh), pointwise and projected gradients and normal_flux now take their scalar type from the dof vector. A Complex coefficients testset covers steady and transient wraps, sol[u], point evaluation with an outside point, traces, derivatives and fluxes. The API page from master said nothing is exported; it now names the five exports and keeps the @autodocs block. Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: 79577b03-59e1-4632-bd76-f6fcde70b991 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Codex on 9e5b4be: Ferrite.project assembles into real buffers, so a complex field with a nonzero gradient threw InexactError in sol[Dx(u)]; the earlier complex test only had constant fields. Complex quadrature-point values are now projected as real and imaginary parts with the same projector and recombined. A Complex gradients testset checks a complex linear P1 and a complex quadratic P2 field: projected and pointwise Dx and Dy and the inlet normal flux are exact. Agent-Harness: Claude Code 2.1.310 Agent-Model: claude-opus-5-5 Agent-Session: 79577b03-59e1-4632-bd76-f6fcde70b991 Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
The merge brought space.jl from master, which defines the same method as solution.jl; the overwrite breaks precompilation (Aqua persistent-tasks check). Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Aqua deps_compat requires a compat entry for the SparseArrays dep. Agent-Harness: Claude Code 2.1.312 Agent-Model: claude-sonnet-5-5 Agent-Session: 43e03fde-3384-4386-bae9-03e81f19ba7c Agent-Review: unreviewed Co-authored-by: Claude Code <agent@noreply.juliahub.com>
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.
Problem
solveon a FEM-discretized problem needs to return a solution indexed in thePDESystemvariables (spec §7.8), as MethodOfLines does withMOLMetadata. Without it, users get a bareDAESolution.This is PR 3 of the M2 series (linear Ferrite backend and numeric DAE path). It stands alone on master. It reads only
space.dhfrom the space, so it does not depend on #2. It and #2/#6 all add sections todocs/src/api.mdand entries totest/test_groups.toml, so later merges need a trivial union of those sections.Change
FieldInfoandFEMMetadata{hasTime, DH, PDE, Sp} <: SciMLBase.AbstractDiscretizationMetadata{hasTime}, with thePDETimeSeriesSolution(sol, md)/PDENoTimeSolution(sol, md)outer constructors. PassingFEMMetadataas the positionalproblem_typeof aDAEProblemmakessolvereturnPDETimeSeriesSolution{…, FEMMetadata}. A steadyNonlinearProblem{iip}withtime === nothinggives aPDENoTimeSolution.sol[t]returns the saved times.sol[x]returns the coordinates of every mesh node, in the order of the(x, y)pairing.sol[u(t,x,y)]isnt × nnodes, built withevaluate_at_grid_nodes, so P2 dofs that are not mesh nodes are dropped.sol[u, k, :]returns one time row.sol[u(t, Γ)]andsol(t, Γ; dv)have columnspiece_nodes(sol, Γ). These include mid-edge nodes on quadratic meshes and also indexsol[x].normal_flux(sol, dv, Γ)returns the facet-mean ∇u·n.sol(…; dv = Dx(u)); at the nodes withsol[Dx(u)], an L2 projection integrated at order 2p with one projector per call. Second-derivative keys are rejected, and the error names the accepted keys.sol(t, x, y; dv)interpolates the dof vector in time, then evaluates it withPointEvalHandler. Vector arguments give a tensor product and scalar arguments drop their axis.sol(t, pts::Vector{<:Vec})evaluates at scattered points.sol(t, x, y)withoutdvreturns one value per field.outside = :error. Points that Ferrite's nearest-node search misses are searched again among cells whose bounding box contains them.FEMInterpolantcaches the PointEvalHandler for the last point set.write_vtk(sol, base)writes one .vtu file per step plus a .pvd file with XML-escaped names.Spec deviation: on a mesh, "an array shaped like the domain" is
nt × nnodes(spec §7.8), not a tensor grid.Tests
New
Solutiongroup in test/Solution/solution.jl: 190/190 pass (1m58s);GROUP=Core1/1,GROUP=QA20/20; Runic and typos clean; docs build clean. The tests solve heat DAEs lowered by hand with Ferrite in test/shared/heat.jl (u_t = Δu with u = sin(t) on the facet set "inlet", DFBDF) and check the wrapper exactly against the raw dofs. The §7.8 1e-12 trace check on the Gmsh L-shape is exercised through the full front end in the follow-up front-end PR.The eager wrap takes 0.028 s at 11 810 dofs (u P1 + w P2) with 82 steps.
Branches covered
solvewraps toPDETimeSeriesSolution{…, FEMMetadata}over aDAESolution(square, L-shape, two fields).sol[t],sol[x],sol[y]return node coordinates.sol[u(t,x,y)]isnt × nnodes; for P1 it is a permutation of the dofs.sol[u, k, :]works andsol[u, end, :]is rejected.sol.original_sol[u_arr]works for one field and for two.sol(t_k, x, y; dv)matches a direct PointEvalHandler evaluation to 1e-14, for P1 and for P2.sol(t, x, y)withoutdv, for one and two fields;sol(t, pts::Vector{Vec}; dv); PointEvalHandler cache reuse.outside = :errorthrows a DomainError; the fallback search finds points Ferrite's search misses (graded mesh).piece_nodesindexessol[x];sol(t, Γ; dv)works; an unknown piece errors.normal_flux: transient shape, exact steady value, exact values on quadratic geometry, error for a non-field argument.sol[Dx(u)]andsol[Dy(u)]; exact for P1 linear and P2 quadratic data; one projector per call; exact on quadratic geometry.Dy(Dy(u))is rejected for indexing and for calls; aDt(u)key is rejected.write_vtkwrites nt .vtu files and a .pvd with nt entries, with XML escaping.PDENoTimeSolution:sol[u(x,y)],sol(x, y),sol[u(Γ)],sol(Γ), NaN outside.show(sol)does not throw.Notes for review
u(t, Γ)accepting aDomainSets.Domainargument, unwrapped withSymbolicUtils.unwrap_const. It is tested with a stand-in piece type; the front-end PR exercises the real PDEBaseBoundaryPiece.piece_nodesuses the non-publicFerrite.dirichlet_facetdof_indices(QA-ignored); Ferrite 1.7 has no public facet-to-node accessor._orderand_geometryassume Lagrange interpolations and a grid with a single cell type.Codex review: rounds 1-4 changes requested (all fixed with regression tests; an independent review during the Codex outage also contributed the Ferrite floor and projector-reuse fixes); final round on a3f8157: approve (0 findings).
🤖 Posted by an AI agent · harness: Claude Code 2.1.310 · model: claude-opus-5-5
Review: unreviewed
Session: 79577b03-59e1-4632-bd76-f6fcde70b991