Mesh import error: _split_fluid

I am trying to import my mesh so I can PyFR however I am being met with the following error.

christopher@dear5b-cuda:~/PDE_Sim$ pyfr import pde_assem.msh pde_assem.pyfrm

Traceback (most recent call last):
File "/home/christopher/miniconda3/bin/pyfr", line 11, in <module>
load_entry_point('pyfr==1.6.0', 'console_scripts', 'pyfr')()
File "/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/__main__.py", line 110, in main
File "/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/__main__.py", line 124, in process_import
File "/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/readers/base.py", line 23, in to_pyfrm
File "/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/readers/gmsh.py", line 200, in _to_raw_pyfrm
File "/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/readers/base.py", line 179, in get_connectivity
File "/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/readers/base.py", line 96, in _split_fluid
KeyError: 4

I am on a linux system running ubuntu 16.04 but am fairly new to linux and python so its very possible I have made some mistake somewhere or it is something that would be painfully obvious to anyone else.
My goal is to simulate the mixing of two fluids inside a long cylinder under different injection configurations if that is relevant at all.
Please let me know if there is any other information I can supply to help get to the bottom of this and thank you for your time.

Hi Dallas – may be an error in the way your mesh file defines the fluid elements.
If your mesh is generated by gmsh, and if you can send the .geo file, I can take a look.
Nigel

The geometry was created in solidworks and exported as a .stl. I then used gmsh to convert it to .msh so my guess is something went wrong in the conversion.
Here are the steps I used:

File → Merge → “filename.stl”
Geometry → Elementary entities → Add → New → Volume, click on the surface to build the volume
Mesh → 3D
I will attach the .stl and .geo files
Thank you

PDE Assem2.geo (110 Bytes)

PDE Assem2.STL (6.22 MB)

Hi Dallas - thanks for sending the .geo and STL geometry files.

Just checking - I see a long, thin tube with 4 holes near one end, plus two cylindrical disks at the other end, punched through with more holes.

  • Are you trying to mesh inside the “walls” of the structure, or some volume that encloses the structure?
  • What sort of boundary conditions do you need?
  • Can your version of gmsh actually create a mesh from that input?

I’m using gmsh 3.02, and can’t get a valid mesh.
Nigel

PS: Dallas, gmsh can work directly with IGES and STEP formats.

If you can export your SolidWorks geometry in one of these (OpenCascade-friendly) formats, they might work better than an STL approximation.

just a thought - Nigel

Hi Dallas,

Few more things, you need to specify the BC and fluid domain in the msh.

Cheers,
Mathi

Thank you for the responses. I have remade my geometry using gmsh so I wont need to worry about converting it. I am not sure how I am supposed to specify the BC and fluid domain though. Are the BC just me calling out the different surfaces and the fluid domain just the volume because thats all I’ve really been able to find online. If so then how do I add a second fluid and specify how each is entering the chamber? Again this stuff might be really obvious and I am just a big ape smashing keys at a computer.

Thank you

Forgot to add that I am still running into a key error and attach files
christopher@dear5b-cuda:~/PDE_Sim$ pyfr import PDE_Assemb.msh PDE_Assemb.pyfrm
Traceback (most recent call last):
File “/home/christopher/miniconda3/bin/pyfr”, line 11, in
load_entry_point(‘pyfr==1.6.0’, ‘console_scripts’, ‘pyfr’)()
File “/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/main.py”, line 110, in main
File “/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/main.py”, line 124, in process_import
File “/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/readers/base.py”, line 23, in to_pyfrm
File “/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/readers/gmsh.py”, line 200, in _to_raw_pyfrm
File “/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/readers/base.py”, line 179, in get_connectivity
File “/home/christopher/miniconda3/lib/python3.6/site-packages/pyfr-1.6.0-py3.6.egg/pyfr/readers/base.py”, line 96, in _split_fluid
KeyError: 7

PDE_Assemb.geo (1.1 KB)

PDE_Assemb.msh (14.4 KB)

Dallas - nice work with the new boolean cylinders!

I’ve attached an adjusted .geo input (Assemb_v2.geo) that generates a mesh (44,897 tetrahedra) which PyFR should be able to load.

At the top of the file you can see I use variables {x1, x2, x3} to toggle a shorted barrel length (makes it easier to examine the mesh).

However, given the geometry, I’m not sure which region you intend to be the actual simulation (“fluid”) domain… ?

Loading the attached .geo into gmsh and pressing [Mesh -> 3d], I see 5 small cylinders labeled “inlet1” : “inlet5” going from (x= -2 : x= 0) through the wide disk, as inlets into the long barrel chamber formed by your “inside wall” surface.

Question: do you want to model the structure generated by this geometry, or some volume enclosing this structure? i.e., do you want to simulate the inlet/pipe material, or some fluid flowing through the pipe?

Nigel

Assemb_v2.geo (1.68 KB)