RSS

FiPy: Solving PDEs on irregular meshes

In this example we will revisit the basic problem of determining the potential between a grounded plate and a circle/sphere on an electrostatic potential. In [3] we had approximated the potential with a homogeneous charge on the ring and grounded the plate by putting a mirror charge behind the plate.

In more complex situations the position and shape of a mirror charge is not trivial. Therefore we use a numerical PDE solver.

Generating the mesh in gmsh

Gmsh screenshotAs we have seen on tha page "FiPy: Solving PDEs with Python" [1] boundary conditions can only be defined on exterior faces of a mesh. Even in the simple case of a grounded plate and a circle on a defined potential one has to generate a mesh that fullfills the boundary conditions in gmsh [2].

Running the simulation

Before running the simulation one has to adapt the script from [1] to import a mesh instead of generating a regular one -- as you can see here. Then one can successfully define a boundary condition on the inner exterior face of the mesh and run the simulation.

Solution to Laplace EquationThe result looks quite similar to the result from the previous example, but this time we can precisely extract physical quantities from the plot (, if the colorbar legend was in the plot).

References

  1. http://hasenkopf2000.net/wiki/page/fipy-solving-pdes-python/
  2. http://geuz.org/gmsh/
  3. http://hasenkopf2000.net/wiki/page/classical-numerical-integration-problem/#variation