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.00383/10.0 [00:06<4:56:05, 1777.22s/it]
1%| | 0.08076/10.0 [00:06<13:56, 84.36s/it]
10%|# | 1.04027/10.0 [00:06<00:58, 6.55s/it]
10%|# | 1.04027/10.0 [00:06<00:58, 6.56s/it]
100%|##########| 10.0/10.0 [00:06<00:00, 1.46it/s]
100%|##########| 10.0/10.0 [00:06<00:00, 1.46it/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.032 seconds)