5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 1// Problem: laplace-dirichlet-2d.
2// The canonical statement lives in docs/problems/laplace-dirichlet-2d.md.
3// This module defines the official instances and the canonical spec object
4// that identifies a (problem, instance) pair in results and, later, in
5// cache keys.
7export const PROBLEM_ID = "laplace-dirichlet-2d";
8export const PROBLEM_VERSION = 1;
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 10/** The family the exact solution is manufactured from. */
11export type DataFamily = "log-sources" | "branch-point";
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 13export interface Laplace2dInstance {
14 /** Short stable identifier used in results and URLs. */
15 id: string;
16 label: string;
17 /** Boundary r(t) = 1 + a cos(k t). */
18 a: number;
19 k: number;
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 20 /** Distance of the exact solution's singularities beyond the boundary. */
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 21 d: number;
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 22 family: DataFamily;
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 23 description: string;
24}
26export const INSTANCES: Laplace2dInstance[] = [
27 {
28 id: "disk-easy",
29 label: "Disk, distant sources",
30 a: 0,
31 k: 0,
32 d: 0.5,
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 33 family: "log-sources",
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 34 description:
35 "The unit disk with sources half a radius beyond the boundary. " +
36 "Every reasonable method should reach high accuracy quickly.",
37 },
38 {
39 id: "star-medium",
40 label: "3-lobe star, moderate sources",
41 a: 0.2,
42 k: 3,
43 d: 0.4,
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 44 family: "log-sources",
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 45 description:
46 "A gently star-shaped domain; the data continues comfortably past " +
47 "the boundary, so geometric convergence is attainable but the " +
48 "geometry is no longer trivial.",
49 },
50 {
51 id: "star-hard",
52 label: "5-lobe star, close sources",
53 a: 0.3,
54 k: 5,
55 d: 0.08,
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 56 family: "log-sources",
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 57 description:
58 "A wavier domain with sources only 0.08 beyond the boundary. The " +
59 "data barely continues past the boundary, which defeats methods " +
60 "whose representation assumes it does.",
61 },
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 62 {
63 id: "star-branch",
64 label: "3-lobe star, branch-point data",
65 a: 0.2,
66 k: 3,
67 d: 0.4,
68 family: "branch-point",
69 description:
70 "Identical geometry and singularity distance to star-medium, but " +
71 "the data comes from a branch-point singularity (the real part of " +
72 "a complex square root) rather than log point charges, so the pair " +
73 "tests whether behavior depends on the data family or only on its " +
74 "singularity distance.",
75 },
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 76];
78export function getInstance(id: string): Laplace2dInstance {
79 const inst = INSTANCES.find((i) => i.id === id);
80 if (!inst) throw new Error(`Unknown instance: ${id}`);
81 return inst;
82}
84/**
85 * The canonical spec object for an instance. Serialized with sorted keys,
86 * this string identifies the instance exactly (results carry it, and a
87 * future artifact cache hashes it).
88 */
89export function canonicalSpec(inst: Laplace2dInstance) {
90 return {
91 a: inst.a,
92 d: inst.d,
3677e1fAdd star-branch instance: branch-point data family alongside the log-charge familyJeremy Magland 93 family: inst.family,
5127df5fastandaccurate: PDE solver benchmarks, laplace-dirichlet-2d with MFS and Nystrom DLP solversJeremy Magland 94 instance: inst.id,
95 k: inst.k,
96 problem: PROBLEM_ID,
97 problemVersion: PROBLEM_VERSION,
98 };
99}
101export function canonicalSpecJson(inst: Laplace2dInstance): string {
102 const spec = canonicalSpec(inst);
103 const keys = Object.keys(spec).sort();
104 return JSON.stringify(spec, keys);
105}