experiments/laser_and_mirrors2.py

changeset 12
a0d61ac3719e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/experiments/laser_and_mirrors2.py	Sun Oct 04 13:02:26 2026 -0500
@@ -0,0 +1,67 @@
+#
+# Laser and mirrors convection-diffusion experiment with known diffusivity and convectivity
+#
+import laser_and_mirrors_aux
+import numpy as np
+from laser_and_mirrors_aux import generic_setup, reg_params
+from measures import DiscreteMeasure_2_f64
+from pointsource_pde import Problem, RegTerm
+from pointsource_pde.compose import (
+    ComposeFnWithOperator,
+    InjectSecond,
+)
+
+# Give name to the problem
+name = "laser_and_mirrors2"
+
+# Override algorithm settings
+algorithm_overrides = laser_and_mirrors_aux.algorithm_overrides
+
+
+# Setup the problem
+def setup(
+    prefix,
+    alpha=reg_params["alpha"],
+    c_noise=reg_params["c_noise"],
+    k_noise=reg_params["k_noise"],
+    noise=reg_params["noise"],
+    seed=reg_params["seed"],
+    sim_oversample=reg_params["sim_oversample"],
+    sim_oversample_time=reg_params["sim_oversample_time"],
+):
+    rng = np.random.default_rng(seed=seed)
+
+    dat, auxtrue, aux0, _μ_bound, μ_true, plot_factory, pde = generic_setup(
+        prefix,
+        rng=rng,
+        μ_true=DiscreteMeasure_2_f64([([0.2, 0.3], 0.15), ([0.4, 0.1], 0.04)]),
+        k=0.02,
+        r=0.1,
+        θ=120 * np.pi / 180,
+        c_noise=c_noise,
+        k_noise=k_noise,
+        noise=noise,
+        sim_oversample=sim_oversample,
+        sim_oversample_time=sim_oversample_time,
+    )
+
+    reg = RegTerm.NonnegRadon(alpha)
+
+    μ0 = DiscreteMeasure_2_f64([])
+
+    dat_simple = ComposeFnWithOperator(dat, InjectSecond(auxtrue))
+    dat_simple.curvature_bound_components = lambda: (None, None, None)
+    dat_simple.override_lipschitz = 1.0
+
+    print("Initial data term value:", dat_simple.apply(μ0))
+    print("Data term value at true μ:", dat_simple.apply(μ_true))
+
+    return Problem(
+        dat_simple,
+        reg,
+        None,
+        None,
+        μ0,
+        plot_factory=plot_factory,
+        domain=pde.domain_dims,
+    )

mercurial