CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[snappyHexMesh] How can I add patches?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 5, 2013, 12:26
Default How can I add patches?
  #1
Member
 
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14
Claudio87 is on a distinguished road
Hallo everybody!

I asked for the same in another post (here: http://www.cfd-online.com/Forums/ope...tml#post405854 ).

I have this problem.
I want to make a simple simulation in a pipe, with the surface imported as .stl file, so using SHM. This is what I've done: I created a background mesh with blockMesh, then I used SHM with the surface imported as .stl file.
OF creates just one patch for my pipe (the surface I imported), one for all of it. So I have a total of 5 patches: 4 for the faces of the background mesh and only one for the pipe. Instead, I'd like to have more of them for the pipe, like inlet, outlet, internal and external surfaces... But i don't know how to do!
Infact, I tried to launch a simulation, with simpleFoam: it works, but of course outside of the pipe, not inside! This because I can give it (in the simplest case) just a velocity, that is the same all around the pipe, on all my unique patch! It is of course unuseful!

My question is: how can I add the other patches? Or what can I do?
Every kind of suggestion is well accepted , thank you!!

Regards,
Claudio
Claudio87 is offline   Reply With Quote

Old   February 5, 2013, 18:08
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Claudio,

From the title, I'm guessing this should answer your question: http://www.cfd-online.com/Forums/ope...tml#post354714 post #2

But from your description... I'm more inclined to the following leading you to the correct answer: http://openfoamwiki.net/index.php/Sn...-region_meshes

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 6, 2013, 19:05
Default
  #3
Member
 
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14
Claudio87 is on a distinguished road
Hi Bruno,
thank you for your answer and your suggestions.
Today I gave a look to those, and to many others threads! But I didn't find a solution for my problem.
I read some createPatchDict from several tutorials, but I'm not sure about how it works...
The case I'm tring to do is just a simple case for a similar problem with a more difficult geometry; so, I'd like to find a solution I could apply also to that other problem!

Most of the threads I have read concerned about adding a new patch as a new surface. But I want to add this patch only as the inlet of my pipe (then, the inlet of the fluid)! So I don't think is this the case of a multi-region mesh.
Maybe I just repeat what I wrote yesterday, but I have the geometry of the pipe (with a thikness) and I want to do my simulation inside it. To do this, I need to apply (in my very simple case) a velocity only on the inlet.

Probably is my foult, but I didn't understand what to do, or how to do, if the solution is using createPatch.
I attach my test case (the STL, blockMeshDict and snappyHexMeshDict). If you have time, could you give a look?! Thank you a lot in advance!!

Best regards,
Claudio
Attached Files
File Type: gz snappy_pipe.tar.gz (5.7 KB, 11 views)
Claudio87 is offline   Reply With Quote

Old   February 7, 2013, 12:21
Default
  #4
Member
 
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14
Claudio87 is on a distinguished road
Hi Bruno.

Today I have read many other threads about the argument... What I've found as solution is to use: 1) autoPatch or 2)createPatch. Right?

Another solution (that I think would be the easier in my case) is create the new patch as intersection between two existing patches (mentioned here: http://www.cfd-online.com/Forums/ope...pyhexmesh.html post#4)...but I don't know how to do. In fact, I'd like to obtain my patch as intersection between the inlet surface of the external cube (my background mesh) and the inner circle base of the pipe on that surface. Do you think is it possible?

There are other possible way?
In any case, I still don't understand how createPatch works... It seems, I have to create anyway a new set of cells and then define/create on that the new patch. Am I on the right way?!

Regards,
Claudio
Claudio87 is offline   Reply With Quote

Old   February 10, 2013, 07:15
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Claudio,

I took a quick look at your STL file and it looks very similar to the one on this thread (specially from your description): http://www.cfd-online.com/Forums/ope...omain-cht.html

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 10, 2013, 12:14
Default
  #6
Member
 
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14
Claudio87 is on a distinguished road
Hi Bruno.
Thak you for the answer!

I had read yet that thread you said, in the last days.
Is true that my geometry is similar, but just 3 things:

1- I have only one surface (STL file), for the solid, the pipe, with a thikness. Is it the same?! And about it, I solved yet the problem mentioned in the thread (I can see my mesh, without problems!)

2- About that thread, I don't think I should eliminate my background mesh, because I need it (my pipe is opened inside the "cube" created with blockMesh). Moreover, I don't thik I'd handle my problem as a multi region one... What do you think abuot these??

3- I found in other posts this way to proceed, using createPatch, and so also cellSet, setSet, subSetMesh and faceSet; that's all? I mean, is this the right way to proceed? (and anyway, I'm not sure I understood how to use all this command...Have you some suggestion?!)

Sorry, I know they are many questions, but it is a problem not so well explained in the tutorials, or maybe I didn't understand!

I'm really greatfull for your help!!

Best regards,
Claudio
Claudio87 is offline   Reply With Quote

Old   February 12, 2013, 06:02
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Claudio,

Ooops, sorry about that. I only read things very quickly and misinterpreted what you wanted to do.

In essence, you need to separate the patches directly in the STL file. Each patch has to be defined as it's own STL "solid". See the file "resources/geometry/flange.stl.gz" for a clearer idea of the contents. The simple/usual step is to export each "solid" individually into an ASCII STL file. I believe you can use Blender or Meshlab to do this, if your original CAD software doesn't do it.

Check more tutorials from here: http://openfoamwiki.net/index.php/Sn...als_and_Guides

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 12, 2013, 07:12
Default
  #8
Member
 
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14
Claudio87 is on a distinguished road
Hi Bruno.
Thanks again for your answer.

I have read yet about considering separated patches directly in my STL file, maybe I'm wrong, but I don't think my case can be considered as a multiregion one. I mean, I have only a pipe as surface, and what I need is to define something that isn't a solid part, but the inlet of the fluid inside the pipe. Should I define, in the STL file, also a surface for the fluid?! It seems something strange to do!
Moreover, I used Catia to create the surface, but I don't know in case how to define this patch I need!

I looked in the tutorials that illustrate the argument (I mean, createPatchDict, and topoSetDict, in particular). My problem is at the end how to define the sourceInfo... For the rest, it's almost all clear

PS: I looked into the STL file, so I understood what is "solid" you mentioned, and so how the STL file works.


Best regards,
Claudio
Claudio87 is offline   Reply With Quote

Old   February 12, 2013, 07:24
Default
  #9
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Claudio,

I forgot to emphasis that you do not need multi-region. I had wrongly understood that you wanted a patch in the inlet and outlet on the main axis of the pipe, i.e. where there was only a void space.

But since you only want to simulate the solid part of the tube, then you don't need multiple regions.

As for breaking up the STL file in parts: like I said, you can try using Blender or Meshlab.

The other possibility is to use autoPatch after generating the mesh, then renaming the patch names manually. You can examine the automatically assigned names, using paraFoam.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 12, 2013, 07:43
Default
  #10
Member
 
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14
Claudio87 is on a distinguished road
Thank you very much Bruno!
I will try both the ways, even if I must learn before how to use Blender or Meshlab.
I'll comunicate you the results at the end (I hope soon!). In the meantime, thank you again for your help!

Best regards,
Claudio
Claudio87 is offline   Reply With Quote

Old   February 12, 2013, 12:16
Default
  #11
Member
 
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14
Claudio87 is on a distinguished road
Hi Bruno.

I'm sorry to disturb you again, but maybe I didn't explain myself in a good way! This time I'll try to be as clear as I can!

Quote:
But since you only want to simulate the solid part of the tube, ...
No. I must simulate the fluid inside the pipe!

Quote:
I had wrongly understood that you wanted a patch in the inlet and outlet on the main axis of the pipe, i.e. where there was only a void space.
So yes, I want a patch in the inlet on the main axis of the pipe, where there is only a void space!
And I think my problem is right this one: how can I define a patch in a void space?! I think, I can't define it on the STL file, because there isn't a "solid" part to define! What can I do?

Sorry again for the misunderstanding!
And thank you in advance for your patience!


Best regards,
Claudio
Claudio87 is offline   Reply With Quote

Old   February 12, 2013, 16:32
Default
  #12
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Claudio,

Then why don't you create a new geometry that is only the interior of the pipe, including the inlet and outlet?

But if you do need both the interior and exterior walls of the pipe... does that mean that you need the solid part of the pipe as well?

Or in other words, do you need to:
  1. Mesh the interior (fluid part) of the pipe.
  2. Mesh the solid part of the pipe.
  3. Mesh the surrounding environment around the pipe.
  4. All of the above. <- This is multi-region.
  5. Only 1 + 2. <- this is... depends on what you need to simulate.
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 12, 2013, 17:19
Default
  #13
Member
 
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14
Claudio87 is on a distinguished road
Hi Bruno.

Thank you for the answer.

Quote:
Then why don't you create a new geometry that is only the interior of the pipe, including the inlet and outlet?
Can I do it?!
But in any case, I don't think it is so usefull for me. I explain. This case I'm doing is just an example to become familiar with OF, in particular with sHM. Indeed, my real problem is a non straight pipe, with a hole on, and with another sort of pipe inside. (and moreover, I'd modify this geometry...) Then, for this future case, it will not possible to create a geometry inside, I think!

Anyway, to answer to your question, I must do a fluidodynamic simulation, inside the pipe. But, using sHM (because my starting point is the surface, that is given), I need to mesh the fluid part and also the sourrounding environment, right?

I hope the problem is clear now!

Best regards,
Claudio
Claudio87 is offline   Reply With Quote

Old   February 13, 2013, 04:55
Default
  #14
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Claudio,

You could have indicated if you wanted 1, 2 or 3 or 5

OK, assuming you only want #1, i.e. only the interior, then you need to at least create the covers for the ends of the pipe, so that snappyHexMesh will know where to cut the mesh!
You can/should create these "cork" geometries separately and then reference them appropriately in "snappyHexMeshDict".

I say this because any other solution will only work in certain scenarios and might not work for your most advanced geometries.

Good luck!
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   February 18, 2013, 10:53
Default
  #15
Member
 
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14
Claudio87 is on a distinguished road
Hi Bruno.

Even if it has been several days, I haven't solved my problem...

Ok, probably, as you sayd, I want #1 (
Quote:
Mesh the interior (fluid part) of the pipe
), even if as you know I'll have also the #3 created by blockMesh, before sHM.

I tried to apply your suggestion, but it doesn't work!
I created the new "cork" surface separatly, and then I imported it like STL. I lunched sHM, and it can see the new surface, only that it doesn't create a new patch. In fact, I can see into polymesh --> boundary it has nFaces = 0! But I don't have any kind of error from OF!
Any idea?!

I attach my snappyHexMeshDict, boundary and the "new" STL file, so you can look them, if you want and if you have time of course!

Thank you again in advance for your help!

Best regards,
Claudio
Attached Files
File Type: gz sent.tar.gz (4.9 KB, 6 views)
Claudio87 is offline   Reply With Quote

Old   February 18, 2013, 15:14
Default
  #16
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Claudio,

Quickish answer:
  1. Edit the file "piple_inlet.stl".
  2. Replace the first line:
    Code:
    solid CATIA STL
    With:
    Code:
    solid piple_inlet
  3. Similarly do the same for the last line "endsolid".
  4. Also do the same for the other STL files, whenever possible.
  5. For any and all geometries that should be closed, place all STL files in a single one, preserving the "solid ... end solid". For example:
    Code:
    solid inlet
    ...
    endsolid inlet
    solid outlet
    ...
    endsolid outlet
    solid walls
    endsolid walls
Check the geometry on the following post as well: http://www.cfd-online.com/Forums/ope...tml#post408279 - if I remember correctly, the STL file you should look at for the example is "constant/triSurface/angledDuct.STL".
Also check the "system/snappyHexMeshDict" for ideas on how this particular geometry is used.
And do not use the details on the "cellZones" and porosities...


Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 91 December 21, 2022 04:50
[blockMesh] Merging edge patches Yosmcer OpenFOAM Meshing & Mesh Conversion 11 November 16, 2014 14:51
difference between patches and mergePatchPairs belkadi OpenFOAM Programming & Development 0 September 16, 2013 09:08
Cyclic boundaries in OF 21x morard OpenFOAM 25 May 13, 2013 22:35
radiation patches, viewfactors beams Siemens 1 March 12, 2009 07:39


All times are GMT -4. The time now is 09:19.