|
[Sponsors] |
July 8, 2022, 11:42 |
How to create a new patch in an STL file ?
|
#1 |
New Member
Join Date: May 2022
Posts: 29
Rep Power: 3 |
Hi foamers,
I have been struggling to extract a surface as a patch in an STL file in snappyHexMesh. I explain myself, I am studying a breakwater and I want to compute the force in specific locations in the crownwall which I import as an STL file (crownwall.stl). I am using the following code to compute the forces and I need to indicate a patch for the pressure integration : Code:
force1 { type forces ; functionObjectLibs ( "libforces.so" ); patches (SurfaceOfInterest); rho rhoInf; rhoInf 1; CofR (523.5 15 30.693); writeControl timeStep; writeInterval 1; pName p; UName U; log true; Iif so I don't know how to use TopoSet, is there a template/model I can use as a basis ? I have attached the picture of the crownwall with the pink surfaces I want to create to use as a patch for the forces. It's just two squares. Thanks! Last edited by cfd_saad; July 8, 2022 at 14:56. |
|
July 11, 2022, 09:25 |
|
#2 |
New Member
Join Date: May 2022
Posts: 29
Rep Power: 3 |
any ideas ?
|
|
July 12, 2022, 03:30 |
|
#3 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,066
Rep Power: 26 |
Hi Saad,
There are 2 ways to achieve this:
With the first method, you will get patches in your mesh with the extact same size as the squares your defined. With the second method, topoSet can only select faces already existing in the mesh, but it does not cut or create new faces/cells. Depending on your mesh refinement, it might lead to creating patches which are not exactly the size of the squares you defined. Up to you to decide what is the best choice for your case depending on your goal and constraints. There is an example of topoSet+createPatch to create new patches in the heatTransfer/buoyantSimpleFoam/comfortHotRoom tutorial. This is not the only way to achieve it, but it could be a good starting point. Regards, Yann |
|
July 12, 2022, 11:29 |
|
#4 |
Senior Member
Join Date: Sep 2013
Posts: 353
Rep Power: 20 |
This is what an stl file looks like:
Code:
solid patch0 facet normal -0.694597 -0.144938 -0.704647 outer loop vertex -87.5526 -320.229 -68.3269 vertex -87.688 -321.843 -67.8616 vertex -87.688 -320.203 -68.1988 endloop endfacet ... endsolid patch0 To create different patches from one stl file in snappyHexMesh simply save two stls and combine them into one. Just copy the entire content of one stl file at the end of another one. Like this: Code:
solid patch0 facet normal -0.694597 -0.144938 -0.704647 outer loop vertex -87.5526 -320.229 -68.3269 vertex -87.688 -321.843 -67.8616 vertex -87.688 -320.203 -68.1988 endloop endfacet ... endsolid patch0 solid patch1 facet normal -0.694597 -0.144938 -0.704647 outer loop vertex -87.5526 -320.229 -68.3269 vertex -87.688 -321.843 -67.8616 vertex -87.688 -320.203 -68.1988 endloop endfacet ... endsolid patch1 Code:
cat file1.stl file2.stl > new_file.stl You must however note, that this can create leaks. If you are saving multiple surfaces as stl files separately in your application of choice, they may not align at their shared border. And if these holes are big enough it may lead to snappy failing. The easiest way is to use a preprocessor like ansa to create those regions and export them to stl. Or use the export features of your CAD programm. You can also load your stl file in paraview and use for example a clip (with crinkle clip selected) to save one part of stl and afterwards inverse it to save the other half. If you do not use crinkle clip you might have to use a triangulate or extract surface filter to save the result as an stl again. |
|
July 20, 2022, 22:53 |
|
#5 |
New Member
Anis Hanani
Join Date: May 2022
Posts: 6
Rep Power: 3 |
Hi Yann,
Can you explain what do you mean by inversing the clip from stl file in paraview? I am trying to create a new patch from my stl file too, to set for a different boundary conditions. Thank you! |
|
July 21, 2022, 06:00 |
|
#6 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,066
Rep Power: 26 |
Hi Anis,
I think you are referring to Bloerb's post. He was talking about the "Invert" option in ParaView's clip filter. This parameter allows to invert which side of the geometry is clipped. Cheers, Yann |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom Thermophysical Properties | wsmith02 | OpenFOAM | 4 | June 1, 2023 14:30 |
Using PengRobinsonGas EoS with sprayFoam | Jabo | OpenFOAM Running, Solving & CFD | 35 | April 29, 2022 15:35 |
steadyUniversalMRFFoam Tutorial fails in MixingPlane | HenrikJohansson | OpenFOAM Bugs | 0 | February 14, 2019 04:48 |
Trouble compiling utilities using source-built OpenFOAM | Artur | OpenFOAM Programming & Development | 14 | October 29, 2013 10:59 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 05:18 |