Note
Go to the end to download the full example code
2.5 Simple diffusion equation
This example solves a simple diffusion equation in two dimensions.
0%| | 0/10.0 [00:00<?, ?it/s]
Initializing: 0%| | 0/10.0 [00:00<?, ?it/s]
0%| | 0/10.0 [00:10<?, ?it/s]
0%| | 0.004/10.0 [00:10<7:32:58, 2718.90s/it]
0%| | 0.018/10.0 [00:10<1:40:31, 604.24s/it]
6%|▌ | 0.604/10.0 [00:10<02:49, 18.03s/it]
58%|█████▊ | 5.791/10.0 [00:10<00:07, 1.90s/it]
58%|█████▊ | 5.791/10.0 [00:11<00:08, 1.92s/it]
100%|██████████| 10.0/10.0 [00:11<00:00, 1.11s/it]
100%|██████████| 10.0/10.0 [00:11<00:00, 1.11s/it]
from pde import DiffusionPDE, ScalarField, UnitGrid
grid = UnitGrid([64, 64]) # generate grid
state = ScalarField.random_uniform(grid, 0.2, 0.3) # generate initial condition
eq = DiffusionPDE(diffusivity=0.1) # define the pde
result = eq.solve(state, t_range=10)
result.plot()
Total running time of the script: (0 minutes 11.289 seconds)