2.5. Simple diffusion equation

This example solves a simple diffusion equation in two dimensions.

simple

Out:

  0%|          | 0/10.0 [00:00<?, ?it/s]
Initializing:   0%|          | 0/10.0 [00:00<?, ?it/s]
  0%|          | 0/10.0 [00:12<?, ?it/s]
  0%|          | 0.00316/10.0 [00:12<10:38:21, 3831.34s/it]
  1%|          | 0.05625/10.0 [00:12<35:41, 215.33s/it]
  8%|7         | 0.79754/10.0 [00:12<02:19, 15.19s/it]
  8%|7         | 0.79754/10.0 [00:12<02:19, 15.21s/it]
100%|##########| 10.0/10.0 [00:12<00:00,  1.21s/it]
100%|##########| 10.0/10.0 [00:12<00:00,  1.21s/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 12.326 seconds)

Gallery generated by Sphinx-Gallery