CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Creating patch on stl surface

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By simrego
  • 1 Post By clapointe
  • 1 Post By clapointe

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 15, 2018, 17:40
Default Creating patch on stl surface
  #1
Member
 
Obi
Join Date: Jul 2016
Location: Canada
Posts: 45
Rep Power: 10
obiscolly50 is on a distinguished road
Hi guys, so i have stl files for different faces in a geometry. How can i create custom (sub)patches on those faces within openFoam so that i can assign boundary conditions?

For example, defining a circular patch on a square stl surface, so that i can assign an inlet boundary condition to the circular patch.
obiscolly50 is offline   Reply With Quote

Old   October 16, 2018, 10:29
Default
  #2
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!


You can select the faces with topoSet then use the createPatch utility.

For topoSet you can use primitives or create the boundary you want as an STL file and you can use that to find the faces in the mesh.

But maybe your patch won't be the same as the wanted geometry since you can only use the faces you already have in the mesh.
simrego is offline   Reply With Quote

Old   October 16, 2018, 10:41
Default
  #3
Member
 
Obi
Join Date: Jul 2016
Location: Canada
Posts: 45
Rep Power: 10
obiscolly50 is on a distinguished road
Quote:
Originally Posted by simrego View Post
Hi!


You can select the faces with topoSet then use the createPatch utility.

For topoSet you can use primitives or create the boundary you want as an STL file and you can use that to find the faces in the mesh.

But maybe your patch won't be the same as the wanted geometry since you can only use the faces you already have in the mesh.
Thanks for the reply. Would you have any code snippet on how this can be applied to an stl file. I came across the topoSetDict yesterday, but I've not seen an example application to stl files.
obiscolly50 is offline   Reply With Quote

Old   October 16, 2018, 17:08
Default
  #4
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
An annotated topoSetDict is provided in the release : https://github.com/OpenFOAM/OpenFOAM...ed/topoSetDict. It looks like surfaceToCell (using your stl) and then cellToFace could get you what you want. In the past I've used stl's with snappy to streamline the process -- then patches are created automatically and unnecessary cells are removed.

Caelan
clapointe is offline   Reply With Quote

Old   October 17, 2018, 03:37
Default
  #5
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Like this you can create the faceZoneSet directly from the surface, you don't have to go on the longer way:

Code:
// Select based on surface. Orientation from normals on surface
 {
    name    fz0;
    type    faceZoneSet;
    action  new;
    source  searchableSurfaceToFaceZone;
    sourceInfo
    {
        surface triSurfaceMesh;
        // centre  (0.05 0.05 0.005);
        // radius  0.025;
        name  sphere.stl; // Optional name if surface triSurfaceMesh
    }
 }

Now I have no case to test this so maybe it won't be the perfect setup for the dictionary, but if it is not correct, the error will tell you exactly what's missing.
simrego is offline   Reply With Quote

Old   October 17, 2018, 10:22
Default
  #6
Member
 
Obi
Join Date: Jul 2016
Location: Canada
Posts: 45
Rep Power: 10
obiscolly50 is on a distinguished road
Quote:
Originally Posted by simrego View Post
Like this you can create the faceZoneSet directly from the surface, you don't have to go on the longer way:

Code:
// Select based on surface. Orientation from normals on surface
 {
    name    fz0;
    type    faceZoneSet;
    action  new;
    source  searchableSurfaceToFaceZone;
    sourceInfo
    {
        surface triSurfaceMesh;
        // centre  (0.05 0.05 0.005);
        // radius  0.025;
        name  sphere.stl; // Optional name if surface triSurfaceMesh
    }
 }

Now I have no case to test this so maybe it won't be the perfect setup for the dictionary, but if it is not correct, the error will tell you exactly what's missing.
Thank you i'll look more into the faceZone set. Another quick question: Is topoSet to be applied before or after meshing. I want to use snappyHexMesh, and do refinements based on the new patches created using topoSet. From the look of things, it seems as if i can only use topoSet after the mesh has been created?
obiscolly50 is offline   Reply With Quote

Old   October 17, 2018, 18:24
Default
  #7
Member
 
Obi
Join Date: Jul 2016
Location: Canada
Posts: 45
Rep Power: 10
obiscolly50 is on a distinguished road
Quote:
Originally Posted by clapointe View Post
An annotated topoSetDict is provided in the release : https://github.com/OpenFOAM/OpenFOAM...ed/topoSetDict. It looks like surfaceToCell (using your stl) and then cellToFace could get you what you want. In the past I've used stl's with snappy to streamline the process -- then patches are created automatically and unnecessary cells are removed.

Caelan
Thanks for the reply. Using the surfaceToCell method, how can i specify a primitive region (e.g, a circle) to be selected before being converted using cellToFace? I just need a circular external face to be selected and designated an inlet boundary condition.

Thanks
obiscolly50 is offline   Reply With Quote

Old   October 18, 2018, 03:41
Default
  #8
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Quote:
Originally Posted by obiscolly50 View Post
Thank you i'll look more into the faceZone set. Another quick question: Is topoSet to be applied before or after meshing. I want to use snappyHexMesh, and do refinements based on the new patches created using topoSet. From the look of things, it seems as if i can only use topoSet after the mesh has been created?

topoSet must be used after snappy. It does nothing with the mesh, it is just for "mark" the points/faces/cells. Then in the createPatch utility you can use these "groups" (in your case faceZones) to specify the new patches based on the "groups" (faceZones) you "marked" with topoSet.
(Some expert foamers may say it is not just a "marker", but I think it is easier to understand what's happening if you imagine the process like this.)
Liangyuan likes this.
simrego is offline   Reply With Quote

Old   March 19, 2019, 07:03
Default
  #9
Senior Member
 
Join Date: Nov 2011
Posts: 109
Rep Power: 15
robboflea is on a distinguished road
Quote:
Originally Posted by simrego View Post
topoSet must be used after snappy. It does nothing with the mesh, it is just for "mark" the points/faces/cells. Then in the createPatch utility you can use these "groups" (in your case faceZones) to specify the new patches based on the "groups" (faceZones) you "marked" with topoSet.
(Some expert foamers may say it is not just a "marker", but I think it is easier to understand what's happening if you imagine the process like this.)

Hi all,


I am having the same problem but cannot seem to get hold of this after extensive googling. I have a stl file (not generated by me). I basically need to take a square patch on a certain boundary and mark it as an inlet (same thing for an outlet patch). I am happy to use Snappy for meshing.


Can anyone outline a step-by-step process to make this work? Particularly I am not clear how this would work with topoSet if this has to be executed after Snappy. How will Snappy know where are the edges of the inlet boundary patch? This cannot be achieved by just re-assigning the boundary faces to a different patch: one needs to remesh the domain to make sure that boundary patch is resolved properly.


Any help to clarify the issue would be appreciated.


Rob
robboflea is offline   Reply With Quote

Old   March 19, 2019, 12:05
Default
  #10
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
If I understand correctly, you have the stl file that is some outline for your domain, and then want to create inlets/outlets on this new domain. So,

1: blockMesh to create background mesh
2: snappy to make mesh in stl shape
3: topoSet to select inlet faces
4: createPatch to create inlet patch
5: topoSet to select outlet faces
6: createPatch to create outlet patch

You can condense a few steps (ie selected multiple sets using one topoSet call) but this should get it done. There are various tutorials that use topoSet/createPatch.

Caelan
Kummi likes this.
clapointe is offline   Reply With Quote

Old   March 19, 2019, 13:07
Default
  #11
Senior Member
 
Join Date: Nov 2011
Posts: 109
Rep Power: 15
robboflea is on a distinguished road
Hi Caelan,


yes that's correct. Thanks a lot for the reply. There is something still unclear, however. Let's assume, in order to simplify things, that my domain is a cube. Let's suppose also that my inlet and outlet are of circular shape (diameter half or the cube length), sitting on two opposite faces of the cube.


If I first mesh the cube, there is nothing that will tell snappy to make sure to have the inlet and outlet circles as edges so that no cells will be partially on the 'wall' region and partially on the 'inlet' (or 'outlet') region. In other words, how can I make sure that the 'inlet' and 'outlet' circles will be perfectly discretized?


Should I do this on the cad or is OpenFOAM able to handle this somehow?



Thanks a lot!


Rob
robboflea is offline   Reply With Quote

Old   March 19, 2019, 13:12
Default
  #12
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
I am not sure what the problem is. Using snappy you will make the mesh conform to the stl, for lack of a better description. The cells outside of the stl will have been removed. If you are talking about making perfect circles for the inlet/outlet, that's a different question that I'm sure others have asked. If you are talking about simply selecting rectangular sets of faces, you do not need to use snappy -- topoSet/createPatch will do.

Caelan
clapointe is offline   Reply With Quote

Old   March 19, 2019, 13:21
Default
  #13
Senior Member
 
Join Date: Nov 2011
Posts: 109
Rep Power: 15
robboflea is on a distinguished road
Hi Caelan,


yes my point is precisely how to make perfect circles for the inlet/outlet.


Those geometrical entities are not part of the CAD itself. The cad is just a plain cube. I was wondering if I can define, using OpenFOAM tools, a part of the surfaces of the cad (circles in this specific case) to be the inlet and the outlet. I assume this has to be made before the first mesh is calculated but I may be wrong (quite a novice in OpenFOAM)



Thanks a lot!


Rob
robboflea is offline   Reply With Quote

Old   March 19, 2019, 13:33
Default
  #14
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
If your domain geometry is just a cube, you can create it with blockmesh. As for the inlet/outlet shape, I'm sure others have asked about making circular patches -- I suggest looking around. I imagine one method is some combination of snappy, mergeMesh, and extrudeMesh but have not done it myself. If you are fine with "mostly" circular then cylinderToCell then selecting a subset of that selection for the faces you want could be the way to go.

Caelan
robboflea likes this.
clapointe is offline   Reply With Quote

Old   March 2, 2020, 05:33
Default
  #15
Member
 
vincent
Join Date: Apr 2011
Posts: 45
Rep Power: 15
vince_44 is on a distinguished road
Hi foamers,


I need some help. I work with OpenFOAM 1806.


I have a STL CAD. On one face(I post an image with face in red), I would like apply an inlet condition to simulate an air injection.


When I try topoSet + creatPatch, I have the follow message :


→ FAOM FATAL ERROR :
Face 26398775 specified in set inletFaces is not an external face of the mesh.
This application can only repatch existing boundary faces.


So if I can't use topoSet and creatPatch, how can I do ?


Vincent

p { margin-bottom: 0.25cm; line-height: 120%; }
Attached Images
File Type: jpg echappement.jpg (36.3 KB, 165 views)
Attached Files
File Type: txt topoSetDict.txt (1.7 KB, 104 views)
File Type: txt createPatchDict.txt (1.2 KB, 79 views)
vince_44 is offline   Reply With Quote

Old   March 2, 2020, 05:41
Default
  #16
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
You have some internal faces in the faceZone. You can use createPatch on external faces only. So in topoSet you have to exclude the internal faces from the set, and it will be fine.
simrego is offline   Reply With Quote

Old   March 3, 2020, 11:12
Default
  #17
Member
 
vincent
Join Date: Apr 2011
Posts: 45
Rep Power: 15
vince_44 is on a distinguished road
Hi Simrego


Thanks for your answer. What is the command to exclude the internal faces in topoSet?



I search wihtout found.


All the best
vince_44 is offline   Reply With Quote

Old   March 3, 2020, 11:23
Default
  #18
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!


I can't find a nice way now, but you can do it like:


Code:
//    source patchToFace;
//    sourceInfo
//    {
//        name ".*"; 
 //    }//  All faces of all patch
With this you can have a faceZone which contains only the boundary faces, but all of them. Then you can get the union with the set you want thus you will have only boundary faces in the final set. See the options there:

https://github.com/OpenFOAM/OpenFOAM...et/topoSetDict
simrego is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 05:13
[Commercial meshers] Mesh conversion problem (fluent3DMeshToFoam) Aadhavan OpenFOAM Meshing & Mesh Conversion 2 March 8, 2018 02:47
[GAMBIT] periodic faces not matching Aadhavan ANSYS Meshing & Geometry 6 August 31, 2013 12:25
[mesh manipulation] Using createPatch in place of couplePatches sripplinger OpenFOAM Meshing & Mesh Conversion 8 November 13, 2009 08:14
CFX4.3 -build analysis form Chie Min CFX 5 July 13, 2001 00:19


All times are GMT -4. The time now is 17:28.