Note
Click here to download the full example code
2.5. Simple diffusion equation¶
This example solves a simple diffusion equation in two dimensions.
Out:
0%| | 0/10.0 [00:00<?, ?it/s]
Initializing: 0%| | 0/10.0 [00:00<?, ?it/s]
0%| | 0/10.0 [00:11<?, ?it/s]
0%| | 0.00316/10.0 [00:11<9:57:11, 3584.24s/it]
0%| | 0.05/10.0 [00:11<37:34, 226.63s/it]
7%|7 | 0.70165/10.0 [00:11<02:30, 16.16s/it]
7%|7 | 0.70165/10.0 [00:11<02:30, 16.17s/it]
100%|##########| 10.0/10.0 [00:11<00:00, 1.13s/it]
100%|##########| 10.0/10.0 [00:11<00:00, 1.13s/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.541 seconds)