Singularity in the domain #244
-
Hello Dr. Zwicker, I am trying to simulate a spherical symmetric diffusion problem on with BCs
Any help is appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
It looks to me as if you want to use the laplace operator in spherical coordinates. If so, the situation might be simpler than you even thought. You can simply use a from pde import PDE, SphericalSymGrid, MemoryStorage, ScalarField, plot_kymograph
# Definition of the PDE
eq = PDE({"u": f"laplace(u)"}, bc=[{"derivative": 0}, {"value": 1}])
grid = SphericalSymGrid(1, 32) # generate grid
field = ScalarField(grid, 0) # generate initial condition
storage = MemoryStorage() # store intermediate information of the simulation
res = eq.solve(field, 1, dt=0.001, adaptive=True, tracker=storage.tracker(0.01)) # solve the PDE
plot_kymograph(storage) # visualize the result in a space-time plot Note that I also adjusted some other parameters to create a nicer plot. In particular, I used adaptive time stepping to prevent instabilities. |
Beta Was this translation helpful? Give feedback.
It looks to me as if you want to use the laplace operator in spherical coordinates. If so, the situation might be simpler than you even thought. You can simply use a
SphericalSymGrid
, which implements the correct laplacian: