Problem with the mesh while trying to solve the Navier Stokes equations with sfepy

Hey, I try to simulate laminar flow in microfluidics (for now I just use a simple cube), in order to do this I tried to modify the definition file for the Navier_stokes example and creat my own mesh with GMSH. I saved the mesh file as m3d.mesh, removed the triangles and the edges and used the command /script/convert_mesh.py meshes/3d/m3d.mesh meshes/3d/micro3d.mesh -r2 in order to produce a "useable" mesh. Nevertheless when running simple.py with my definition file I receive the following error message: Sfepy: creating regions... sfepy: Omega parsing failed : nodes in x>1.99999) .... etc. ...pyparsing.ParseException: Expected ''all'' ( at char 0),( line:1, col: 1)
I am not really a computer scientist but I guess that the problems comes from the mesh or the way I define my outlet region. If someone as any idea how I could fix my script I would be really happy and thanksful. Best regards Guillaume

Hi Guillaume,
On 05/22/2014 02:58 PM, 'G' via sfepy-devel wrote:
Hey, I try to simulate laminar flow in microfluidics (for now I just use a simple cube), in order to do this I tried to modify the definition file for the Navier_stokes example and creat my own mesh with GMSH.
That seems like a nice application! A word of warning though: SfePy does not have a dedicated Navier-Stokes solver (the Newton (+ and direct) solver use that is in the navier_stokes.py example is rather naive, and works for small problems with only, with viscosity "high enough"), and probably no CFD experts on this mailing list.
I saved the mesh file as m3d.mesh, removed the triangles and the edges and used the command /script/convert_mesh.py meshes/3d/m3d.mesh meshes/3d/micro3d.mesh -r2 in order to produce a "useable" mesh.
The mesh seems ok. See below.
Nevertheless when running simple.py with my definition file I receive the following error message: Sfepy: creating regions... sfepy: Omega parsing failed : nodes in x>1.99999) .... etc. ...pyparsing.ParseException: Expected ''all'' ( at char 0),( line:1, col: 1)
I am not really a computer scientist but I guess that the problems comes from the mesh or the way I define my outlet region. If someone as any idea how I could fix my script I would be really happy and thanksful.
This is caused by a different syntax for selecting regions that is valid from version 2013.3 - it seems that you have a new(er) sfepy, but an old example file. For the current syntax (and meaning) see [1]. The correct definitions are (with the long syntax of your example):
[1] http://sfepy.org/doc-devel/users_guide.html#regions
region_1000 = { 'name' : 'Omega', 'select' : 'all', }
region_0 = { 'name' : 'Walls', 'select' : 'vertices of surface -v (r.Outlet +v r.Inlet)', 'kind' : 'facet', } region_1 = { 'name' : 'Inlet', 'select' : 'vertices in (x < -1.9999)', # In 'kind' : 'facet', } region_2 = { 'name' : 'Outlet', 'select' : 'vertices in (x > 1.9999) ', # Out 'kind' : 'facet', }
I also recommend setting
'log' : {'text' : 'log.txt', 'plot' : 'log.pdf'},
'is_plot' : False,
in the 'newton' solver configuration. The 'is_plot' option is flaky (it does not plot anything on my current system) and will be removed. If you want to log the convergence, use the 'log' option.
Then your example works (= converges and produces some result :)).
Cheers, r.

Hey Robert, It works ! So thank you very much for the fast and helpful post. I just started working with sfepy but since I love python I will certainly use it more in the future and it seems like the possibilities are huge and the results nice looking ;) . Just one last question maybe: what program do you use to generate the meshes? Do you also use gmsh, because I find the manual post processing necessary to make the mesh work a little bit annoying. Anyway thanks again.
Best regards Guillaume
Le jeudi 22 mai 2014 14:58:21 UTC+2, G a écrit :
Hey, I try to simulate laminar flow in microfluidics (for now I just use a simple cube), in order to do this I tried to modify the definition file for the Navier_stokes example and creat my own mesh with GMSH. I saved the mesh file as m3d.mesh, removed the triangles and the edges and used the command /script/convert_mesh.py meshes/3d/m3d.mesh meshes/3d/micro3d.mesh -r2 in order to produce a "useable" mesh. Nevertheless when running simple.py with my definition file I receive the following error message: Sfepy: creating regions... sfepy: Omega parsing failed : nodes in x>1.99999) .... etc. ...pyparsing.ParseException: Expected ''all'' ( at char 0),( line:1, col:
I am not really a computer scientist but I guess that the problems comes from the mesh or the way I define my outlet region. If someone as any idea how I could fix my script I would be really happy and thanksful. Best regards Guillaume

On 05/23/2014 12:07 PM, 'G' via sfepy-devel wrote:
Hey Robert, It works ! So thank you very much for the fast and helpful post. I just started working with sfepy but since I love python I will certainly use it more in the future and it seems like the possibilities are huge and the results nice looking ;) . Just one last question maybe: what program do you use to generate the meshes? Do you also use gmsh, because I find the manual post processing necessary to make the mesh work a little bit annoying.
Try running
gmsh -3 something.geo -format mesh
This should not save the triangles and the edges. Otherwise I use mostly simple meshes generated by the scripts in script/, or ask other people to make me a mesh :)
Anyway thanks again.
Hth! r.
Best regards Guillaume
Le jeudi 22 mai 2014 14:58:21 UTC+2, G a écrit :
Hey, I try to simulate laminar flow in microfluidics (for now I just use a simple cube), in order to do this I tried to modify the definition file for the Navier_stokes example and creat my own mesh with GMSH. I saved the mesh file as m3d.mesh, removed the triangles and the edges and used the command /script/convert_mesh.py meshes/3d/m3d.mesh meshes/3d/micro3d.mesh -r2 in order to produce a "useable" mesh. Nevertheless when running simple.py with my definition file I receive the following error message: Sfepy: creating regions... sfepy: Omega parsing failed : nodes in x>1.99999) .... etc. ...pyparsing.ParseException: Expected ''all'' ( at char 0),( line:1, col:
I am not really a computer scientist but I guess that the problems comes from the mesh or the way I define my outlet region. If someone as any idea how I could fix my script I would be really happy and thanksful. Best regards Guillaume
participants (2)
-
G
-
Robert Cimrman