# Filling out a mesh (for Fenics FEM)

I have been using Fenics to model some simple electrostatic problems, but now I need to simulate more complicated geometries. Assuming

• I have created a mesh of several objects, and know their positions in space
• Each node in those objects carries properties of those objects (dielectric constant/etc)

which software and approach should I use to subdivide the free space between these objects (and some bounding box style boundary), so that

• Mesh density depends on distance from objects / geometric complexity
• Fenics will know where the boundary is, and the boundary conditions (zero potential at "infinity")
• Fenics will know the values of charge / dielectric in this free space (set to some default for example)

In my simple problems I have used hand coded functions for determining boundary, calculating boundary conditions, and for objects (such as a capacitor's plates) I have used their geometry to assign charges/etc (for example if (distance from sphere center < radius) charge = 1.0 else 0)

Refer to dolfin-convert script installed within FEniCS, and its manual page,

\$ man dolfin-convert


for supported mesh formats. Then pick some software generating those formats.

Note that cell functions (useful for specifying permitivities in your case) and/or facet functions (useful for boundary and interfacial conditions) are not fully supported by dolfin-convert for all formats. To get those details one can dive into <PYTHONPATH>/dolfin_utils/meshconvert/meshconvert.py or simply try.

AFAIK, at least Triangle (2D) and Gmsh (2D and 3D) formats are quite well supported by dolfin-convert.

• thanks, i have been trying with gmsh for the geometry and it seem fine, but i am lost when it comes to defining the cell functions. i'll have a look through the docs when i get my meshes working Nov 18, 2014 at 9:07
• after a bit of mucking around renaming surfaces i got gmsh and dolfin-convert to cooperate Nov 19, 2014 at 3:54