dolfin-convert independent bodies model

Asked by Niklas

Dear Community,

I have been able to import a model from Inventor-Fusion (OS X) STEP file via NETGEN (Ubuntu) Diffpack to dolfin XML and work with it in Fenics. The model describes a simple geometry of a box an a rectangular or cylinder shaped piping that passes through the box. The domains (pipe and surrounding) were imported fine, thanks to this forum.

In that model however the two bodies overlapped, the box was still modeled as a whole, rather than the surrounding of the piping. When I fixed that in the model (cut out the piping and reinserted as a second body in the gap) and processed the file in exactly the same manner, the dolfin-convert keeps throwing an Assertion error:

Convert from Diffpack tetrahedral grid format to DOLFIN XML.
Expecting 1219 vertices
Found all vertices
Expecting 5729 cells
Traceback (most recent call last):
  File "/usr/bin/dolfin-convert", line 131, in <module>
    main(sys.argv[1:])
  File "/usr/bin/dolfin-convert", line 78, in main
    meshconvert.convert2xml(ifilename, ofilename, iformat=iformat)
  File "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/meshconvert.py", line 1291, in convert2xml
    convert(ifilename, XmlHandler(ofilename), iformat=iformat)
  File "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/meshconvert.py", line 1327, in convert
    diffpack2xml(ifilename, ofilename)

  File "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/meshconvert.py", line 935, in diffpack2xml
    assert(len(marker_intersection)==1)
AssertionError

Guessing from the source it has to to with facet intersection. I have tried out a series of other formats and the Windows versions of both Inventor and Netgen, usually with worse results. When importing via Abaqus format, the dolfin-convert will run through. However the boundaries are lost and the domains get very interesting indices (a 7+ digit long, instead of an int [1,2,..]), which then breaks my fenics script.

If anybody has an idea, it is more than welcome...

Question information

Language:
English Edit question
Status:
Answered
For:
FEniCS Project Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Blechta (blechta) said :
#1

On Mon, 29 Apr 2013 07:36:09 -0000
Niklas <email address hidden> wrote:
> New question #227740 on FEniCS Project:
> https://answers.launchpad.net/fenics/+question/227740
>
> Dear Community,
>
> I have been able to import a model from Inventor-Fusion (OS X) STEP
> file via NETGEN (Ubuntu) Diffpack to dolfin XML and work with it in
> Fenics. The model describes a simple geometry of a box an a
> rectangular or cylinder shaped piping that passes through the box.
> The domains (pipe and surrounding) were imported fine, thanks to this
> forum.
>
> In that model however the two bodies overlapped, the box was still
> modeled as a whole, rather than the surrounding of the piping. When I
> fixed that in the model (cut out the piping and reinserted as a
> second body in the gap) and processed the file in exactly the same
> manner, the dolfin-convert keeps throwing an Assertion error:
>
> Convert from Diffpack tetrahedral grid format to DOLFIN XML.
> Expecting 1219 vertices
> Found all vertices
> Expecting 5729 cells
> Traceback (most recent call last):
> File "/usr/bin/dolfin-convert", line 131, in <module>
> main(sys.argv[1:])
> File "/usr/bin/dolfin-convert", line 78, in main
> meshconvert.convert2xml(ifilename, ofilename, iformat=iformat)
> File
> "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/meshconvert.py",
> line 1291, in convert2xml convert(ifilename, XmlHandler(ofilename),
> iformat=iformat) File
> "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/meshconvert.py",
> line 1327, in convert diffpack2xml(ifilename, ofilename)
>
> File
> "/usr/lib/python2.7/dist-packages/dolfin_utils/meshconvert/meshconvert.py",
> line 935, in diffpack2xml assert(len(marker_intersection)==1)
> AssertionError
>
> Guessing from the source it has to to with facet intersection. I have
> tried out a series of other formats and the Windows versions of both
> Inventor and Netgen, usually with worse results. When importing via
> Abaqus format, the dolfin-convert will run through. However the
> boundaries are lost and the domains get very interesting indices (a
> 7+ digit long, instead of an int [1,2,..]), which then breaks my
> fenics script.

This could happen because of negative markers which are then converted
to unsigned int or size_t. Try avoiding negative markers.

>
> If anybody has an idea, it is more than welcome...
>
>

Revision history for this message
Martin Sandve Alnæs (martinal) said :
#2

The "interesting" large number you see is most likely max uint, which is what undefined markers are stored as.

What do you mean by "boundaries are lost"? Does mesh.domains().facet_domains() return None? Which dolfin version?

Revision history for this message
Niklas (ntschech) said :
#3

Hello and thank you both for the quick reply!

By "boundaries are lost", I mean that the xml does not contain any boundary marker information, only domains as MeshVaueCollection. In contrast, the diffpack intermediate preserves the facets recognized by NETGEN and stores them in the *_marker_1 files.

How could I check for negative markers? In NETGEN I let the STEP-Doctor run over the model and it did not seem to recognize inwards faced facets. The markers for boundary conditions are also shown as positive integers, only. Or am I shooting at something completely different, here?

Revision history for this message
Niklas (ntschech) said :
#4

...I am using the latest build from the PPA under Ubuntu 12.10.
And mesh.domains().facet_domains() returns "None".

Revision history for this message
Niklas (ntschech) said :
#5

As the error points to face intersection: Is it possible that the source are the matching faces of the inner piping body (outer face) and the outer box (inner face)? If so, what would be the correct modeling for such a problem? In the end I need the two bodies for domain markers...

Revision history for this message
Niklas (ntschech) said :
#6

Hello Community,

I am still not able to resolve this problem. How are inline objects in general modeled when used in fenics? I have put quite some work on fenics and the sourrounding workflow and as this feature is a deal breaker for me, I would hate to give that up...

Revision history for this message
Johan Hake (johan-hake) said :
#7

Can you upload your mesh to a server? I do not think there are intersecting faces. meshconvert does not check for that. What it might be is that diffpack allows several markers per vertex, which can result in several markers per face. dolfin does not support that and the assertion is for that. Butit might be that we could fix this more gracefully than just break.

Revision history for this message
Niklas (ntschech) said :
#8

Hello Johan,

I uploaded the file to:

[URL=http://www.file-upload.net/download-7546386/test8.grid.html]test8.grid[/URL]

Thanks a lot for looking into it.

Revision history for this message
Johan Hake (johan-hake) said :
#9

As I suspected, your mesh includes several markers for some faces. If you ensure that each face only has one marker the conversion should go through. We could save the other marker to an second file but it would be difficult to make it deterministic.

Revision history for this message
Niklas (ntschech) said :
#10

Ok, I tried to completely restrict the number of markers per node to 1 in the grid file. This leads to:

line 857, in diffpack2xml
    x = map(float, re.split("[\s,]+", m.group(1)))
AttributeError: 'NoneType' object has no attribute 'group'

I am sure there is a more straight forewords solution to this, as this kind of model will show up in any heating / cooling problem, where you have a surrounding fluid...

Is there possibly a mesher around that creates more compatible meshes than NETGEN?

Revision history for this message
Johan Hake (johan-hake) said :
#11

On 05/03/2013 12:21 PM, Niklas wrote:
> Question #227740 on FEniCS Project changed:
> https://answers.launchpad.net/fenics/+question/227740
>
> Status: Answered => Open
>
> Niklas is still having a problem:
> Ok, I tried to completely restrict the number of markers per node to 1
> in the grid file.

That is not what I meant. Try to get 1 marker per face. The way diffpack
register face markers are to save them as vertex markers. If two faces
with different markers are neighbors they share 1 vertex. This vertex
need to have both markers.

> This leads to:
>
> line 857, in diffpack2xml
> x = map(float, re.split("[\s,]+", m.group(1)))
> AttributeError: 'NoneType' object has no attribute 'group'

This might be caused by how you removed the markers. How did you do that?

> I am sure there is a more straight forewords solution to this, as this
> kind of model will show up in any heating / cooling problem, where you
> have a surrounding fluid...

Sure there are. Do not despair...

> Is there possibly a mesher around that creates more compatible meshes
> than NETGEN?

There probably are. Also there are CSG based mesher in the development
version of dolfin, probably also in 1.2. Have you tried that?

Johan

Can you help with this problem?

Provide an answer of your own, or ask Niklas for more information if necessary.

To post a message you must log in.