|
[Sponsors] |
April 24, 2017, 10:10 |
FlattenPatch application
|
#1 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Dear FOAM'er,
for some reason I build a new application that can flatten individual patches. The application is not too powerful and can only handle to flatten patches normal to the following planes:
Code:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Overriding DebugSwitches according to controlDict SolverPerformance 0; Create polyMesh for time = 0 Read flattenPatchDict Average patch normal of patch 'sym1' is (-2.10044e-13 -6.77083e-08 7.59531e-25) Normalized average patch normal of patch 'sym1' is (-3.10219e-06 -1 1.12177e-17) Modifing the points on the patch Average patch normal of patch 'sym2' is (1.42693e-13 -6.58748e-08 2.53275e-13) Normalized average patch normal of patch 'sym2' is (2.16613e-06 -1 3.84479e-06) Modifing the points on the patch Average patch normal of patch 'sym3' is (-2.0357e-25 -6.4221e-08 -7.58311e-17) Normalized average patch normal of patch 'sym3' is (-3.16983e-18 -1 -1.18078e-09) Modifing the points on the patch Patch 'sym1' was modified Patch 'sym2' was modified Patch 'sym3' was modified Writing points into directory "/calc/foamCases/Rhodos/hexMesh_zones/constant/polyMesh" Code:
Normalized average patch normal of patch 'sym1' is (0 -1 0) Normalized average patch normal of patch 'sym2' is (0 -1 0) Normalized average patch normal of patch 'sym3' is (0 -1 0) For what is it good?
https://bitbucket.org/shor-ty/flattenpatch
__________________
Keep foaming, Tobias Holzmann Last edited by Tobi; October 8, 2018 at 10:00. |
|
October 2, 2018, 04:32 |
|
#2 |
Senior Member
Peter Baskovich
Join Date: Jul 2014
Posts: 127
Rep Power: 11 |
Thanks for this cool tool, I've used it to fix up the boundaries from cfMesh channel cases.
I had an error compiling on 1712 though. Line 134 needed to be cast to type token. I don't know enough C++ to do this properly but this seemed to work: Code:
134: const token tmp = token ( boundaryPatches[patchi].name() ); |
|
October 2, 2018, 07:16 |
|
#3 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi Peter,
thanks for your hint. This circumstance is related to having different OpenFOAM distributions. E.g., I am using the Foundation version since I started using OpenFOAM. Thus, I got more familiar with the structure and class names. Additionally, I like the release notes done by the Foundation based on the linkage between the bug-tracking system and other code related changes. ESI is doing a good job here too but does not provide as much information as I would like to have. However, the reason for that problem is related to my wrong programming The object boundaryPatches is related to the class polyBoundaryMesh. The operator operator[] is returning an object of the class polyPatch to which we apply the function name(). Right now I cannot see the function definition of name() inside the class polyPatch So, as the result of a fast search, I don´t know why it works at all. The function name() should be defined in a included class such as primitivePatch etc. At least we have the proof that I don´t have C++ skills too.
__________________
Keep foaming, Tobias Holzmann |
|
June 26, 2020, 14:29 |
|
#4 |
New Member
Daniel Duque
Join Date: Jan 2011
Location: ETSIN, Madrid
Posts: 28
Rep Power: 15 |
Dear Tobi.
Your code just made my day! I was finally making progress in adding layers to a 2D geometry with a couple of straight angles. I finally had some success by using empty patches for back and front, but they were a bit distorted. That is likely to cause trouble when running the solver. (I am not sure since I am using that 2D for an axysimmetric simulation, with an intermediate extrudeMesh -- that's when I got non-planarity issues.) Anyway, your code works like a charm. Only I also had to change line 134 as Peter, and line 73 to: Code:
const word vecDir = word(flattenPatchDict.lookup("direction") ); |
|
June 26, 2020, 15:06 |
|
#5 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi, thank you for your feedback. Would be interesting to know, if you problem still occurs if you change the write format from »ASCII« to »BINARY« in the controlDict file.
__________________
Keep foaming, Tobias Holzmann |
|
June 29, 2020, 04:56 |
|
#6 |
New Member
Daniel Duque
Join Date: Jan 2011
Location: ETSIN, Madrid
Posts: 28
Rep Power: 15 |
Hi Toby.
I can see where you are aiming for. However, in my case this is not a matter of truncation errors (I did check with binary output anyway, just in case -- nothing changes). In a nutshell, I was trying to mesh a 2D domain with many right angles. If my front and back covers were set as empty, the meshing is fast and produces an acceptable mesh. In the figures, shots of one of the corners: 1, after castallation, 2. after the snap step, which introduces non-planarity, 3. after the add layers step, non-planarity increased. corner1.png corner2.png corner3.png Next, another view of 3. from the side. Finally, after your flattenPatch step: the side is now planar, and may be used for a 2D simulation, by an extrudeMesh from this side. corner3_side.pngcorner3_side_flat.png I know this seems convoluted, but it's the only way I have managed to satisfactorily add layers to this geometry. |
|
Tags |
flattenpatch |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CFD Post Application Error: 'wbload' action requires parameter: 'id'. | gusymtz | ANSYS | 5 | October 10, 2022 16:29 |
Error in compute process - No Active Application | yetlyg | FLUENT | 8 | October 27, 2018 22:30 |
Ansys Licence Serve on Ubuntu 16.04 LTS | david.pasquale | ANSYS | 2 | January 20, 2017 11:52 |
Is Playstation 3 cluster suitable for CFD work | hsieh | OpenFOAM | 9 | August 16, 2015 14:53 |
what should we do for the application of CUDA in CFD? | aerosjc | Main CFD Forum | 6 | February 25, 2013 11:01 |