/ concept-collection / fastandaccurate
Sign in
concept-collection / fastandaccurate
fastandaccurate / docs / problems / laplace-dirichlet-2d.md
134 lines · 6.0 KBPreviewCodeBlameHistoryRaw
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
24The data g is manufactured from an exact harmonic function, a sum of
25three logarithmic point sources placed outside the domain:
27 u*(x) = Σ_j c_j log |x − s_j|, c = (1.0, −0.6, 0.8).
29Source s_j is the boundary point at parameter φ_j = 2π(j−1)/3 + 0.4
30pushed a distance d along the outward unit normal, and g = u* restricted
31to ∂Ω. Since u* is harmonic in Ω, it is the unique solution, and errors
32are measured against it directly rather than against a reference
33computation. The distance d controls difficulty: u* continues
34harmonically only up to the sources, so the smaller d, the shorter the
35distance the data continues past the boundary, and methods whose
36representations assume a generous continuation lose it. A solver must
37not use knowledge of the sources; they exist only to manufacture g.
39## Official instances
41| id | a | k | d | character |
42|---|---|---|---|---|
43| disk-easy | 0 | 0 | 0.5 | the unit disk, distant sources |
44| star-medium | 0.2 | 3 | 0.4 | mild geometry, comfortable continuation |
45| star-hard | 0.3 | 5 | 0.08 | wavy boundary, data barely continues |
47Committed results exist only at these instances, so every solver is
48compared on identical inputs. The parameters may be varied freely in the
49site's interactive views, but such runs are not recorded.
51## What is scored
53Each instance fixes 289 evaluation points: 32 rays at angles
54θ_j = 2πj/32 + 0.13 (j = 0, …, 31), radial fractions
55ρ ∈ {0.1, 0.2, …, 0.9} along each ray (the point at fraction ρ on ray
56θ is ρ r(θ) (cos θ, sin θ)), ordered radius-major, plus the origin last.
57The solver returns u at exactly these points. Reported errors are
59 relMax = max_i |u_i − u*_i| / max_i |u*_i|,
60 relL2 = ( Σ_i (u_i − u*_i)² / Σ_i u*_i² )^{1/2}.
62relMax is the headline number; both are recorded. Note that the
63evaluation points deliberately stay a modest distance inside the domain
64(fraction 0.9 at most). Accuracy very close to the boundary is a genuine
65and separate difficulty (the close-evaluation problem for integral
66methods, boundary-layer resolution for grid methods) and a future
67problem version may add a near-boundary target set; version 1 does not
68test it.
70## Timing protocol
72One run is a full call of the solver, including its own discretization,
73assembly, solve, and evaluation. The harness performs two untimed warmup
74runs (the first of which is recorded separately as the cold time), then N
75timed runs (N = 5 unless stated), and reports the **fastest** of them as
76the solve time. The minimum is used rather than the mean or median
77because everything that interferes with a measurement (scheduling, other
78load, residual JIT compilation) only ever adds time, so the fastest run
79is the least contaminated estimate of the solver's own cost; every
80individual timing is recorded in the result file regardless. Where a
81sweep shares one process across resolutions, as the MATLAB runner does,
82warmup runs precede the sweep as well, so that the first resolution does
83not absorb the session's one-time costs. All timing is tic/toc inside the
84solver's own runtime, so browser, node and MATLAB runs measure the same
85thing. Times from different machines are not comparable; every result
86records its environment, and comparisons across environments are the
87reader's responsibility.
89Note that solve time need not increase with the resolution parameter n. A
90solver whose cost is dominated by a per-target near-field computation can
91get *slower* as n decreases, since coarser panels put more targets in the
92near field. Work-precision curves are therefore drawn as parametric
93curves in n, and may double back in time; a point that is both slower and
94less accurate than another point on the same curve is simply dominated.
96## Solver interface
98A solver is a MATLAB function file
100 function out = solver(prob, n)
102where n is the solver's own resolution parameter (its meaning is the
103solver's choice; the standard sweep list is declared in the solver's
104manifest) and prob is a struct with fields
106| field | meaning |
107|---|---|
108| `prob.curve` | `@(t) -> [x y]`, boundary point at parameter t (column vectors in, m×2 out) |
109| `prob.curveD` | first derivative of the curve with respect to t |
110| `prob.curveDD` | second derivative |
111| `prob.g` | `@(t) -> g`, Dirichlet data at boundary parameter t |
112| `prob.evalXY` | 289×2, the evaluation points |
113| `prob.vizXY` | m×2, visualization grid points (m = 0 when not requested) |
115The return value is a struct: `out.uEval` (289×1, required) and
116`out.uGrid` (m×1; `[]` when `prob.vizXY` is empty). The solver must not
117reconstruct the sources analytically or otherwise special-case the known
118solution; submissions are reviewed for this.
120## Visualization grid
122When requested, `prob.vizXY` lists a 200×200 grid of points over the
123bounding square [−R, R]², R = 1.05(1 + |a|), with flat index
124p = ix·200 + iy for x = xs[ix], y = xs[iy] (y varies fastest, MATLAB
125meshgrid column order). Points outside Ω are included and the viewer
126masks them; grid values are never scored.
128## Limitations
130The exact solution is smooth and free of boundary singularities, so this
131problem does not test corner handling, nonsmooth data, or interior
132sources (a nonzero right-hand side would exclude plain boundary-integral
133methods; that belongs to a different problem). The domain family is
134star-shaped by construction, which some methods can exploit.
moveopenescclose