Sat, 01 Aug 2026 13:27:15 -0500
LOCAL_DEPS_HACK
|
1
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
1 | # |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
2 | # Laser and mirrors convection-diffusion experiment with known diffusivity and convectivity |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
3 | # |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
4 | import laser_and_mirrors_aux |
| 12 | 5 | import numpy as np |
| 6 | from laser_and_mirrors_aux import generic_setup, reg_params | |
|
1
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
7 | from measures import DiscreteMeasure_2_f64 |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
8 | from pointsource_pde import Problem, RegTerm |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
9 | from pointsource_pde.compose import ( |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
10 | ComposeFnWithOperator, |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
11 | InjectSecond, |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
12 | ) |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
13 | |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
14 | # Give name to the problem |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
15 | name = "laser_and_mirrors" |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
16 | |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
17 | # Override algorithm settings |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
18 | algorithm_overrides = laser_and_mirrors_aux.algorithm_overrides |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
19 | |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
20 | |
| 12 | 21 | # Setup the problem |
| 22 | def setup( | |
| 23 | 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, | |
|
1
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
42 | ) |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
43 | |
| 12 | 44 | reg = RegTerm.NonnegRadon(alpha) |
| 45 | ||
|
1
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
46 | μ0 = DiscreteMeasure_2_f64([]) |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
47 | |
|
3
c3a4f4bb87f7
Dolfin update, fixes, additional experiment, build instructions.
Tuomo Valkonen <tuomov@iki.fi>
parents:
1
diff
changeset
|
48 | dat_simple = ComposeFnWithOperator(dat, InjectSecond(auxtrue)) |
| 12 | 49 | dat_simple.curvature_bound_components = lambda: (None, None, None) |
| 50 | dat_simple.override_lipschitz = 1.0 | |
|
10
0c9e19020217
Update to pointsource_algs 3-part curvature_bound_components
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
51 | |
|
3
c3a4f4bb87f7
Dolfin update, fixes, additional experiment, build instructions.
Tuomo Valkonen <tuomov@iki.fi>
parents:
1
diff
changeset
|
52 | print("Initial data term value:", dat_simple.apply(μ0)) |
|
c3a4f4bb87f7
Dolfin update, fixes, additional experiment, build instructions.
Tuomo Valkonen <tuomov@iki.fi>
parents:
1
diff
changeset
|
53 | print("Data term value at true μ:", dat_simple.apply(μ_true)) |
|
1
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
54 | |
|
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
55 | return Problem( |
| 12 | 56 | dat_simple, |
| 57 | reg, | |
| 58 | None, | |
| 59 | None, | |
| 60 | μ0, | |
| 61 | plot_factory=plot_factory, | |
| 62 | domain=pde.domain_dims, | |
|
1
a4137aedcb3a
Initial working version for known convectivity and diffusivity
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff
changeset
|
63 | ) |