2.7. Spherically symmetric PDE

This example illustrates how to solve a PDE in a spherically symmetric geometry.

spherical grid
  0%|          | 0/0.1 [00:00<?, ?it/s]
Initializing:   0%|          | 0/0.1 [00:00<?, ?it/s]
  0%|          | 0/0.1 [00:01<?, ?it/s]
  8%|8         | 0.008/0.1 [00:01<00:22, 240.64s/it]
 42%|####2     | 0.042/0.1 [00:01<00:02, 45.85s/it]
 42%|####2     | 0.042/0.1 [00:01<00:02, 45.87s/it]
100%|##########| 0.1/0.1 [00:01<00:00, 19.27s/it]
100%|##########| 0.1/0.1 [00:01<00:00, 19.27s/it]

from pde import DiffusionPDE, ScalarField, SphericalSymGrid

grid = SphericalSymGrid(radius=[1, 5], shape=128)  # generate grid
state = ScalarField.random_uniform(grid)  # generate initial condition

eq = DiffusionPDE(0.1)  # define the PDE
result = eq.solve(state, t_range=0.1, dt=0.001)

result.plot(kind="image")

Total running time of the script: ( 0 minutes 2.128 seconds)