Note
Click here 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:06<?, ?it/s]
0%| | 0.0038/10.0 [00:06<5:03:42, 1822.90s/it]
1%| | 0.07747/10.0 [00:06<14:48, 89.51s/it]
9%|9 | 0.94527/10.0 [00:06<01:06, 7.34s/it]
9%|9 | 0.94527/10.0 [00:06<01:06, 7.35s/it]
100%|##########| 10.0/10.0 [00:06<00:00, 1.44it/s]
100%|##########| 10.0/10.0 [00:06<00:00, 1.44it/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 7.177 seconds)