File:Diffusion with absorber.gif
Summary
Description |
English: If you send light through a diffusive medium containing a absorbing region, you will see a shadow of the absorber from the other side. By illuminating and detecting from different direction one can reconstruct its position and shape (Diffuse Optical Tomography) |
Date | |
Source | https://twitter.com/j_bertolotti/status/1129300065078657024 |
Author | Jacopo Bertolotti |
Permission (Reusing this file) |
https://twitter.com/j_bertolotti/status/1030470604418428929 |
Mathematica 11.0 code
dimx = 500; dimy = 100; absorptioncoefficient = 0.9; reindex[x_] := {dimx*(x[[2]] - 1) + x[[1]], dimx*(x[[2]] - 1) + x[[1]]}; tmp = SparseArray[{Band[{1, 2}] -> 1/4, Band[{2, 1}] -> 1/4, Band[{1, dimx + 1}] -> 1/4, Band[{dimx + 1, 1}] -> 1/4}, {dimx*dimy, dimx*dimy}]; boundaries = Flatten@Table[{1 + dimx*(i - 1), dimx*i}, {i, 1, dimy}]; boundaries = Table[{boundaries[[i]], boundaries[[i]]}, {i, 1, Evaluate[Dimensions[boundaries][[1]]]}]; offset = 0; hsize = 5; sink = Flatten[Table[{i, j}, {i, 250 - hsize + offset, 250 + hsize + offset}, {j, dimy/2 - hsize, dimy/2 + hsize}], 1]; absorption = Partition[Flatten@Append[boundaries, Map[reindex, sink] ], 2]; diagonal = SparseArray[Band[{1, 1}] -> 1, {dimx*dimy, dimx*dimy}] - SparseArray[boundaries -> 1, {dimx*dimy, dimx*dimy}] - SparseArray[Map[reindex, sink] -> absorptioncoefficient, {dimx*dimy, dimx*dimy}]; T = diagonal.tmp; source = SparseArray[Band[{dimx*Round[dimy/1.2] + Round[dimx/2]}, {dimx*Round[dimy/1.2] + Round[dimx/2]}] -> 1, {dimx*dimy}]; u = Normal@source; timesteps = 8000; diffusion = Reap[ Do[ u = T.u; Sow[Partition[u, dimx]]; , timesteps];][[2, 1]]; evo = Table[ Grid[{{ListPlot[Mean[{diffusion[[j]][[1]], diffusion[[j + 1]][[1]]}], AspectRatio -> dimy/dimx , ImageSize -> Large, Axes -> False, Joined -> True, PlotStyle -> {Red}, PlotRange -> {0, Max[diffusion[[timesteps/2]][[1]]]}]}, {ArrayPlot[Mean[{diffusion[[j]], diffusion[[j + 1]]}], ColorFunction -> "SunsetColors" , ImageSize -> Large, Frame -> False]}}] , {j, 1, timesteps - 1, 100}]; ListAnimate[evo]
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
![]() ![]() |
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
|