Note
Go to the end to download the full example code.
2.2.3 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:04<?, ?it/s]
0%| | 0.005/10.0 [00:04<2:39:07, 955.21s/it]
2%|▏ | 0.247/10.0 [00:04<03:08, 19.36s/it]
37%|███▋ | 3.743/10.0 [00:04<00:08, 1.30s/it]
37%|███▋ | 3.743/10.0 [00:04<00:08, 1.33s/it]
100%|██████████| 10.0/10.0 [00:04<00:00, 2.01it/s]
100%|██████████| 10.0/10.0 [00:04<00:00, 2.01it/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 5.061 seconds)