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:07<?, ?it/s]
0%| | 0.00358/10.0 [00:07<6:03:29, 2181.74s/it]
1%| | 0.07166/10.0 [00:07<18:03, 109.10s/it]
8%|8 | 0.8456/10.0 [00:07<01:24, 9.25s/it]
8%|8 | 0.8456/10.0 [00:07<01:24, 9.26s/it]
100%|##########| 10.0/10.0 [00:07<00:00, 1.28it/s]
100%|##########| 10.0/10.0 [00:07<00:00, 1.28it/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 8.046 seconds)