/ proof-of-concept / fastandaccurate
Sign in
proof-of-concept / fastandaccurate
fastandaccurate / docs / problems / laplace-dirichlet-2d.md
154 lines · 6.8 KBCodeBlameHistory
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 1# Problem: laplace-dirichlet-2d (version 1)
3This document is the canonical statement of the problem. Results refer to
4it by the pair (problem id, problem version); any change that could alter
5a measured number requires a version bump.
7## The problem
9Solve the Laplace equation
11 Δu = 0 in Ω, u = g on ∂Ω,
13where Ω is the star-shaped plane domain bounded by the curve
15 x(t) = r(t) (cos t, sin t), r(t) = 1 + a cos(k t), t ∈ [0, 2π),
17and g is Dirichlet data specified below. The problem is posed in the
18continuum: a solver receives the curve and the data as functions, chooses
19its own discretization, and is scored on the values it returns at a fixed
20set of evaluation points.
22## The exact solution
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 24The data g is manufactured from an exact harmonic function u*, and
25g = u* restricted to ∂Ω. Since u* is harmonic in Ω, it is the unique
26solution, and errors are measured against it directly rather than
27against a reference computation. Two data families are used.
29**log-sources.** A sum of three logarithmic point sources placed outside
30the domain:
32 u*(x) = Σ_j c_j log |x − s_j|, c = (1.0, −0.6, 0.8).
34Source s_j is the boundary point at parameter φ_j = 2π(j−1)/3 + 0.4
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 35pushed a distance d along the outward unit normal.
37**branch-point.** The real part of a complex square root:
39 u*(z) = Re √(w), w = −(z − z₀) e^{−iθ₀},
41where z₀ is the boundary point at parameter 0.4 pushed a distance d
42along the outward unit normal and θ₀ is its polar angle. The principal
43branch cut w ≤ 0 maps to the radial ray from z₀ away from the origin,
44which cannot meet a domain star-shaped about the origin, so u* is
45harmonic on the closed domain; its nearest singularity is the branch
46point z₀ itself. In real arithmetic, Re √w = √((|w| + Re w)/2).
48In both families the distance d controls difficulty: u* continues
49harmonically only up to its singularities, so the smaller d, the shorter
50the distance the data continues past the boundary, and methods whose
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 51representations assume a generous continuation lose it. A solver must
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 52not use knowledge of the sources or branch point; they exist only to
53manufacture g.
55## Official instances
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 57| id | a | k | d | family | character |
58|---|---|---|---|---|---|
59| disk-easy | 0 | 0 | 0.5 | log-sources | the unit disk, distant sources |
60| star-medium | 0.2 | 3 | 0.4 | log-sources | mild geometry, comfortable continuation |
61| star-hard | 0.3 | 5 | 0.08 | log-sources | wavy boundary, data barely continues |
62| star-branch | 0.2 | 3 | 0.4 | branch-point | star-medium's geometry with the other data family |
64star-branch repeats star-medium's geometry and singularity distance with
65the branch-point family. The pair separates the data family from its
66singularity structure: a method whose accuracy depended on a coincidence
67between its representation and the data-generating family would score
68differently on the two, while a method governed by the continuation
69distance scores alike.
71Committed results exist only at these instances, so every solver is
72compared on identical inputs. The parameters may be varied freely in the
73site's interactive views, but such runs are not recorded.
75## What is scored
7fcfeb0Densify evaluation set to 289 points; evaluation-point overlay now a toggle, default offJeremy Magland 77Each instance fixes 289 evaluation points: 32 rays at angles
78θ_j = 2πj/32 + 0.13 (j = 0, …, 31), radial fractions
79ρ ∈ {0.1, 0.2, …, 0.9} along each ray (the point at fraction ρ on ray
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 80θ is ρ r(θ) (cos θ, sin θ)), ordered radius-major, plus the origin last.
81The solver returns u at exactly these points. Reported errors are
83 relMax = max_i |u_i − u*_i| / max_i |u*_i|,
84 relL2 = ( Σ_i (u_i − u*_i)² / Σ_i u*_i² )^{1/2}.
86relMax is the headline number; both are recorded. Note that the
87evaluation points deliberately stay a modest distance inside the domain
88(fraction 0.9 at most). Accuracy very close to the boundary is a genuine
89and separate difficulty (the close-evaluation problem for integral
90methods, boundary-layer resolution for grid methods) and a future
91problem version may add a near-boundary target set; version 1 does not
92test it.
94## Timing protocol
96One run is a full call of the solver, including its own discretization,
97assembly, solve, and evaluation. The harness performs one untimed warmup
98run (which absorbs numbl's JIT compilation and is recorded separately as
99the cold time), then N timed runs (N = 3 unless stated), and reports the
100median as the solve time. All timing is tic/toc inside the MATLAB
101session, so browser and node runs measure the same thing. Times from
102different machines are not comparable; every result records its
103environment, and comparisons across environments are the reader's
104responsibility.
106## Solver interface
108A solver is a MATLAB function file
110 function out = solver(prob, n)
112where n is the solver's own resolution parameter (its meaning is the
113solver's choice; the standard sweep list is declared in the solver's
114manifest) and prob is a struct with fields
116| field | meaning |
117|---|---|
118| `prob.curve` | `@(t) -> [x y]`, boundary point at parameter t (column vectors in, m×2 out) |
119| `prob.curveD` | first derivative of the curve with respect to t |
120| `prob.curveDD` | second derivative |
121| `prob.g` | `@(t) -> g`, Dirichlet data at boundary parameter t |
7fcfeb0Densify evaluation set to 289 points; evaluation-point overlay now a toggle, default offJeremy Magland 122| `prob.evalXY` | 289×2, the evaluation points |
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 123| `prob.vizXY` | m×2, visualization grid points (m = 0 when not requested) |
7fcfeb0Densify evaluation set to 289 points; evaluation-point overlay now a toggle, default offJeremy Magland 125The return value is a struct: `out.uEval` (289×1, required) and
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 126`out.uGrid` (m×1; `[]` when `prob.vizXY` is empty). The solver must not
127reconstruct the sources analytically or otherwise special-case the known
128solution; submissions are reviewed for this.
130## Visualization grid
132When requested, `prob.vizXY` lists a 200×200 grid of points over the
133bounding square [−R, R]², R = 1.05(1 + |a|), with flat index
134p = ix·200 + iy for x = xs[ix], y = xs[iy] (y varies fastest, MATLAB
135meshgrid column order). Points outside Ω are included and the viewer
136masks them; grid values are never scored.
138## Limitations
140The exact solution is smooth and free of boundary singularities, so this
141problem does not test corner handling, nonsmooth data, or interior
142sources (a nonzero right-hand side would exclude plain boundary-integral
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 143methods; that belongs to a different problem). In particular, every
144instance's solution is real-analytic in a neighborhood of the closed
145domain, which favors methods that exploit analyticity (fundamental
146solutions, boundary integral equations, spectral collocation) over
147low-order discretizations; this is a property of manufactured smooth
148benchmarks in general, not of the particular families chosen. The
149star-branch instance exists because most instances manufacture the data
150from exterior log charges, the same function class the MFS
151representation draws on; comparing it with star-medium checks that
152scores follow the continuation distance rather than the family. The
153domain family is star-shaped by construction, which some methods can
154exploit.
↑↓ move↵openescclose