experiments/laser_and_mirrors.py

changeset 12
a0d61ac3719e
parent 10
0c9e19020217
equal deleted inserted replaced
11:c4f923017349 12:a0d61ac3719e
1 # 1 #
2 # Laser and mirrors convection-diffusion experiment with known diffusivity and convectivity 2 # Laser and mirrors convection-diffusion experiment with known diffusivity and convectivity
3 # 3 #
4 import laser_and_mirrors_aux 4 import laser_and_mirrors_aux
5 import numpy as np
6 from laser_and_mirrors_aux import generic_setup, reg_params
5 from measures import DiscreteMeasure_2_f64 7 from measures import DiscreteMeasure_2_f64
6 from pointsource_pde import Problem, RegTerm 8 from pointsource_pde import Problem, RegTerm
7 from pointsource_pde.compose import ( 9 from pointsource_pde.compose import (
8 ComposeFnWithOperator, 10 ComposeFnWithOperator,
9 InjectSecond, 11 InjectSecond,
14 16
15 # Override algorithm settings 17 # Override algorithm settings
16 algorithm_overrides = laser_and_mirrors_aux.algorithm_overrides 18 algorithm_overrides = laser_and_mirrors_aux.algorithm_overrides
17 19
18 20
19 # Setup routine 21 # Setup the problem
20 def setup(prefix): 22 def setup(
21 dat, auxtrue, _μ_bound, μ_true, plot_factory = laser_and_mirrors_aux.generic_setup( 23 prefix,
22 prefix 24 alpha=reg_params["alpha"],
25 c_noise=reg_params["c_noise"],
26 k_noise=reg_params["k_noise"],
27 noise=reg_params["noise"],
28 seed=reg_params["seed"],
29 sim_oversample=reg_params["sim_oversample"],
30 sim_oversample_time=reg_params["sim_oversample_time"],
31 ):
32 rng = np.random.default_rng(seed=seed)
33
34 dat, auxtrue, aux0, _μ_bound, μ_true, plot_factory, pde = generic_setup(
35 prefix,
36 rng=rng,
37 c_noise=c_noise,
38 k_noise=k_noise,
39 noise=noise,
40 sim_oversample=sim_oversample,
41 sim_oversample_time=sim_oversample_time,
23 ) 42 )
43
44 reg = RegTerm.NonnegRadon(alpha)
24 45
25 μ0 = DiscreteMeasure_2_f64([]) 46 μ0 = DiscreteMeasure_2_f64([])
26 47
27 reg = RegTerm.NonnegRadon(1.5e-6)
28
29 dat_simple = ComposeFnWithOperator(dat, InjectSecond(auxtrue)) 48 dat_simple = ComposeFnWithOperator(dat, InjectSecond(auxtrue))
49 dat_simple.curvature_bound_components = lambda: (None, None, None)
50 dat_simple.override_lipschitz = 1.0
30 51
31 print("Initial data term value:", dat_simple.apply(μ0)) 52 print("Initial data term value:", dat_simple.apply(μ0))
32 print("Data term value at true μ:", dat_simple.apply(μ_true)) 53 print("Data term value at true μ:", dat_simple.apply(μ_true))
33 54
34 return Problem( 55 return Problem(
35 dataterm=dat_simple, regterm=reg, μinit=μ0, plot_factory=plot_factory 56 dat_simple,
57 reg,
58 None,
59 None,
60 μ0,
61 plot_factory=plot_factory,
62 domain=pde.domain_dims,
36 ) 63 )

mercurial