|
[Sponsors] |
October 4, 2009, 12:17 |
polySpline violates convex hull property
|
#1 |
Member
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17 |
A blockMeshDict defining a rotationally symmetric body was setup. The body is constructed as for hex blocks each with two polySpline edges for the longitudinal generating curve of the surface and a collapsed face at the center of rotation. The tangents of the polySplines are set to the zero-vector thus forcing finite-difference calculation of them. The control points of the polySplines are taken from a Gmsh *.geo file. Gmsh uses Catmull-Rom splines.
The blockMeshDict is attached as blockMeshDictPolySplineCR. Executing blockMesh on this blockMeshDict produces strange results depicted in the first thumbnail (polySplineCR). Two things were noted from the blockMesh printout attached as log.blockMesh.txt: Firstly, the splines specified in the blockMeshDict are identical in the sense that control points are just rotated in steps of 90 degrees. Therefore, the constructed spline curves should also be rotated version of one and the same curve. This is not the case. The two first spline curves are not the same, whereas the last two appear to be. Secondly, I have the impressions that OF uses clamped cubic B-Splines. If this is so, then it violates the strong convex hull property, i.e. that a B-Spline curve is contained in the convex hull of its control points. This can be seen in the log for the first two spline curves. If the polySpline edges are converted to polyLine edges, the correct result is obtained, as shown in second thumbnail (polyLine.jpg). This was tested on OF-1.6.x pulled 2009-09-14 10:13 and build from sources (64-bit). |
|
November 10, 2009, 07:21 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
I took a look at your case (with a more recent pull). The splines now all look very similar (that problem is solved), but a closer examination shows that you are quite right about the splines themselves. At first glance, they look fairly reasonable. However, they have severely ugly wrinkles in them. I added a simple printf() style debugging into the corresponding classes to dump out the x/y/z coordinates of the calculated splines and they are indeed incorrect. As far as I can gather, the spline implementation adds in a number of intermediate control points (20) and then weights the matrix to have the final spline go through the original points ... but I honestly don't really understand how it is all supposed to work. I suspect that in your example the control points are sufficiently close together that it triggers the buggy behaviour and causes the calculated spline to fold on itself near its ends. Using polyLine is probably safer but not exactly something that you haven't figured out already. BTW: do the ends of Catmull-Rom splines coincide with the end points? Have you tried implementing them in OpenFOAM? /mark |
||
November 12, 2009, 02:56 |
|
#3 |
Member
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17 |
Thanks for your reply. Yes, a Catmul-Rom spline passes through all control points, including the end-points. I have not made a stab at implementing them in OF, since the polyLine workaround was an acceptable workaround for that flow simulation. However, since this is not the first time I have problems with polySpline maybe it should put it on my to-do list. I can tell from other posts that polySpline is poorly understood and does not always yield expected results. It is not at the very top of my list, though, I have to say.
|
|
December 8, 2009, 08:28 |
|
#4 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
You might want to take another look at it in 1.6.x, there is now a 'spline' command (instead of simpleSpline and polySpline) that uses Catmull-Rom under the hood.
|
|
January 19, 2010, 07:32 |
|
#5 |
Senior Member
|
Hi Foamers,
I'm trying to use spline commands (simpleSpline or polySpline or spline) in OF 1.6.x, pushed in late December 09 (I can't remember the date). My edges subdictionary in blockMeshDict sounds like: Code:
edges ( spline 0 1 ( (-0.005 -0.005 -0.01) (-0.002 0.005 -0.01) ) spline 4 5 ( (-0.005 -0.005 0.01) (-0.002 0.005 0.01) ) ); Code:
Creating curved edges --> FOAM FATAL ERROR: Unknown curvedEdge type simpleSpline Valid curvedEdge types are 3 ( line arc polyLine ) From function curvedEdge::New(const pointField&, Istream&) in file curvedEdges/curvedEdge.C at line 98. FOAM aborting It could be a bug? Or in my version the spline commands have been suppressed? |
|
January 19, 2010, 07:38 |
|
#6 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
||
January 19, 2010, 07:56 |
|
#7 |
Senior Member
|
||
January 19, 2010, 08:05 |
|
#8 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Check with 'git blame' on the files themselves and 'git log' to see which version you merged and compiled. The build information echoed from the application might be useful too, to determine if you have merged in the commit 50ef9fa47 or what else might have gone wrong.
|
|
January 20, 2010, 10:32 |
|
#9 | |
Senior Member
|
Quote:
Thank you to everybody! Ivan |
||
February 3, 2010, 04:30 |
|
#10 |
New Member
Marek
Join Date: Dec 2009
Location: Berlin
Posts: 1
Rep Power: 0 |
Hi,
I got the exactly the same error that Ivan posted, does someone have an idea what the problem is? Thanks, Marek |
|
February 3, 2010, 05:16 |
|
#11 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
No idea - the attached blockMeshDict works fine on my system (see log file).
|
|
February 3, 2010, 11:13 |
|
#12 |
Senior Member
|
Just runned your case, same error (see the log file)...
Have a nice day, Ivan |
|
February 4, 2010, 03:32 |
|
#13 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
http://repo.or.cz/w/OpenFOAM-1.6.x.g...17616acf499689 Either update from the git repo, or just cherry-pick the commit. |
||
|
|