gmsh Mesh refinement region

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

solosails
Posts: 22
Joined: Mon Feb 19, 2018 7:38 pm
Contact:

gmsh Mesh refinement region

Postby solosails » Fri Mar 02, 2018 12:16 pm

I have been trying to mesh using gmsh, using a very simple cube inside a cube - the outer cube being the domain, and the inner cube being the part to check flow around.

I can make gmsh make an even 3D mesh of both of these objects by joining them as a compound - however, I need to refine the mesh around the object cube - no matter what I do, I always get an error , any advice how to refine a gmsh region using gmsh?

Started GMSH meshing ...

Part to mesh: Name --> Box, Label --> domain, ShapeType --> Solid
CharacteristicLengthMax: 86.6025403784
CharacteristicLengthMin: 0.0
ElementOrder: 1
ElementDimension: 3
c:\users\woody\appdata\local\temp\Box_Geometry.brep
c:\users\woody\appdata\local\temp\Box_Mesh_TmpGmsh.unv
c:\users\woody\appdata\local\temp\shape2mesh.geo
C:/Program Files/FreeCAD_0.17/bin/gmsh.exe
No mesh group objects.
No analysis members for group meshing.
{}
Mesh regions, we need to get the elements.
Traceback (most recent call last):
File "C:\Users\Woody\AppData\Roaming\FreeCAD\Mod\CfdOF\_TaskPanelCfdMeshGmsh.py", line 174, in runMeshProcess
gmsh_mesh.get_group_data()
File "C:\Users\Woody\AppData\Roaming\FreeCAD\Mod\CfdOF\CfdGmshTools.py", line 279, in get_group_data
ele_shape = FemMeshTools.get_element(shape, elems) # the method getElement(element) does not return Solid elements
File "C:\Program Files\FreeCAD_0.17\Mod\Fem\femmesh\meshtools.py", line 1454, in get_element
return part.Shape.getElement(element) # Face, Edge, Vertex
AttributeError: 'Part.Solid' object has no attribute 'Shape'
User avatar
bernd
Posts: 7745
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: gmsh Mesh refinement region

Postby bernd » Fri Mar 02, 2018 4:41 pm

have you read the first part of FEM_Shear_of_a_Composite_Block

Would you post your FreeCAD file?
User avatar
oliveroxtoby
Posts: 256
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: gmsh Mesh refinement region

Postby oliveroxtoby » Sun Mar 04, 2018 9:16 pm

solosails wrote:
Fri Mar 02, 2018 12:16 pm
I have been trying to mesh using gmsh, using a very simple cube inside a cube - the outer cube being the domain, and the inner cube being the part to check flow around.

I can make gmsh make an even 3D mesh of bot of these objects by joining them as a compound - however, I need to refine the mesh around the object cube - no matter what I do, I always get an error , any advice how to refine a gmsh region using gmsh?

Started GMSH meshing ...

Part to mesh: Name --> Box, Label --> domain, ShapeType --> Solid
CharacteristicLengthMax: 86.6025403784
CharacteristicLengthMin: 0.0
ElementOrder: 1
ElementDimension: 3
c:\users\woody\appdata\local\temp\Box_Geometry.brep
c:\users\woody\appdata\local\temp\Box_Mesh_TmpGmsh.unv
c:\users\woody\appdata\local\temp\shape2mesh.geo
C:/Program Files/FreeCAD_0.17/bin/gmsh.exe
No mesh group objects.
No analysis members for group meshing.
{}
Mesh regions, we need to get the elements.
Traceback (most recent call last):
File "C:\Users\Woody\AppData\Roaming\FreeCAD\Mod\CfdOF\_TaskPanelCfdMeshGmsh.py", line 174, in runMeshProcess
gmsh_mesh.get_group_data()
File "C:\Users\Woody\AppData\Roaming\FreeCAD\Mod\CfdOF\CfdGmshTools.py", line 279, in get_group_data
ele_shape = FemMeshTools.get_element(shape, elems) # the method getElement(element) does not return Solid elements
File "C:\Program Files\FreeCAD_0.17\Mod\Fem\femmesh\meshtools.py", line 1454, in get_element
return part.Shape.getElement(element) # Face, Edge, Vertex
AttributeError: 'Part.Solid' object has no attribute 'Shape'
Could you try again? Fixed some bugs.
thschrader
Posts: 1394
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: gmsh Mesh refinement region

Postby thschrader » Mon Mar 05, 2018 8:35 am

oliveroxtoby wrote:
Sun Mar 04, 2018 9:16 pm
Could you try again? Fixed some bugs.
Updated cfd-of-wb via addon-manager, mesh refinement works, both cfd/fem.
@solosails: if you want to do a flow-simulation around the inner cube, you must
subtract the inner cube from the outer cube (part-wb: boolean-cut), not joining them,
as you wrote above.
system:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13346 (Git)
Build type: Release
Branch: master
Hash: 22ee06de8441bfcc9fded2c6de4232d763fb11bc
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: German/Germany (de_DE)
cfd.JPG
cfd.JPG (135.55 KiB) Viewed 1145 times
fem.JPG
fem.JPG (151.89 KiB) Viewed 1145 times
solosails
Posts: 22
Joined: Mon Feb 19, 2018 7:38 pm
Contact:

Re: gmsh Mesh refinement region

Postby solosails » Sun Mar 11, 2018 10:22 am

Hi all,

Thanks for the responses, and sorry for delay in reply. , I forgot to check the notification box on the post for replies.

I will try the suggested methods which (Boolean cut) sounds like wherebim going wrong!

Thanks again!
solosails
Posts: 22
Joined: Mon Feb 19, 2018 7:38 pm
Contact:

Re: gmsh Mesh refinement region

Postby solosails » Sun Mar 11, 2018 12:19 pm

Hi all, that solved it for me thank you!

Ps is there a way to add boundary layers using gmsh?

Thanks.
User avatar
bernd
Posts: 7745
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: gmsh Mesh refinement region

Postby bernd » Sun Mar 11, 2018 12:32 pm

the boundary layer of FEM can, but I do not know if CFD can use it?
User avatar
oliveroxtoby
Posts: 256
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: gmsh Mesh refinement region

Postby oliveroxtoby » Sun Mar 11, 2018 2:35 pm

bernd wrote:
Sun Mar 11, 2018 12:32 pm
the boundary layer of FEM can, but I do not know if CFD can use it?
No, we haven't added this feature. We tend to favour CfMesh for CFD meshes so it's unlikely this will be added unless someone else does so.
User avatar
bernd
Posts: 7745
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: gmsh Mesh refinement region

Postby bernd » Sun Mar 11, 2018 3:17 pm

@oliver:
did you really copy the gmsh module from FEM? Why not just use the object from FEM ?
User avatar
oliveroxtoby
Posts: 256
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: gmsh Mesh refinement region

Postby oliveroxtoby » Sun Mar 11, 2018 4:35 pm

bernd wrote:
Sun Mar 11, 2018 3:17 pm
@oliver:
did you really copy the gmsh module from FEM? Why not just use the object from FEM ?
Hi Bernd

In respect of gmsh, our code hasn't changed much from what was in the CFD workbench when we forked CfdOF from it. We haven't focused much at all on gmsh as we find the cut-cell Cartesian meshers better suited to our needs for CFD. Using the FEM object directly sounds like a much better plan, but will have to go to the to-do list, as it'll be difficult to prioritise for one of us. If someone else has time, then great! Thanks for the suggestion :)

Oliver