freitreppe
freitreppe

Reputation: 21

1D spherical grid in FiPy

I would like to solve the diffusion equation in FiPy in spherical coordinates on a 1D grid. I would also like the left boundary to be at r=0.1, not r=0.

I can't find a module for 1D spherical symmetry; only cylindrical. I figure I do it with Grid1D and simply write the del^2 operator in spherical coordinates, then multiply through by r^2 (as mentioned here). However, I still don't know how to specify the locations of the boundaries.

Could someone advise me how to do this? Many thanks.

Upvotes: 1

Views: 362

Answers (1)

jeguyer
jeguyer

Reputation: 2484

All fipy meshes can be offset by a vector of appropriate dimension, e.g.,

>>> m = fp.Grid1D(nx=10, dx=.1) + [[1.5]]
>>> print m.x
[1.55 1.65 1.75 1.85 1.95 2.05 2.15 2.25 2.35 2.45]

A spherically symmetric mesh, mirrored on CylindricalUniformGrid1D, would be a welcome pull request.

Upvotes: 1

Related Questions