This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Code sharing: e.g. convert WITH DOMAINS MARKERS from Medit to Dolfin-formats

0 votes

Hi everyone,

I'm probably not the only one who had restrictions due to the lack of converting domain markers using dolfin-convert, at least this is the case if you use TetGen's Medit (.mesh) format as input, which is a realy basic issue that fits not in the overall suitability of FEniCS in my opinion.
It is important for me, because I have arbitrarily shaped domains I can easily mark with TetGen PLCs but not with the standard FEniCS way anymore, e.g.:

class Obstacle(SubDomain):
    def inside(self, x, on_boundary):
        return (between(x[1], (0.5, 0.7)) and 
                between(x[0], (0.2, 1.0)))

If it would be even possible, it is inefficient to mark domains another time in FEniCS with long expressions instead of a few values using Tetgen. Thus, I manipulated dolfin-convert (easier than I thought) in just 2 hours and now I can automatically convert boundary- and domain markers from Medit .mesh format to .xml and also HDF5 (.h5) for parallelization support.

  1. Is it only a Medit's .mesh to .xml problem?
  2. Is there any other solution I missed?
  3. If there are others dealing with the same problem, I would like to share my code, maybe also as a template for doing the same with the other Input-formats like Gmesh. Is anyone interested in this?, Is there a platform for this?

  4. Despite this, I would like to share further code probably interested for some of us. I'm working on electromagnetic problems in geophysics and spent lots of time to find out how to implement more complicated curl-curl problems with imaginary numbers, source expressions, arbitrary domains, solvers etc., kind of a real FEniCS project with Python classes now. It would be way more information than the curl-curl-demo, which was my starting point, and cost me only a few hours. Is there an interest for a new EM demo/Tutorial?

Kind regards, Raphael

asked Dec 20, 2016 by RR FEniCS User (3,330 points)

Hi, for 3 I think posting a link here to some git repository is sufficient. Same goes for 4 but if you want the demo to be official you should swing the idea by the FEniCS dev mailing list.

...