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:08<?, ?it/s]
0%| | 0.004/10.0 [00:09<6:15:31, 2254.00s/it]
0%| | 0.021/10.0 [00:09<1:11:24, 429.36s/it]
8%|▊ | 0.76/10.0 [00:09<01:49, 11.88s/it]
72%|███████▏ | 7.167/10.0 [00:09<00:03, 1.28s/it]
72%|███████▏ | 7.167/10.0 [00:09<00:03, 1.28s/it]
100%|██████████| 10.0/10.0 [00:09<00:00, 1.09it/s]
100%|██████████| 10.0/10.0 [00:09<00:00, 1.09it/s]
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 9.340 seconds)