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

polySpline violates convex hull property

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 4, 2009, 12:17
Default polySpline violates convex hull property
  #1
Member
 
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17
aunola is on a distinguished road
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).
Attached Images
File Type: jpg polySplineCR.jpg (90.8 KB, 418 views)
File Type: jpg polyLine.jpg (68.5 KB, 391 views)
Attached Files
File Type: txt blockMeshDictPolySplineCR.txt (4.9 KB, 397 views)
File Type: txt log.blockMesh.txt (27.4 KB, 106 views)
aunola is offline   Reply With Quote

Old   November 10, 2009, 07:21
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by aunola View Post
Executing blockMesh on this blockMeshDict produces strange results depicted in the first thumbnail (polySplineCR).
...
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).
Hi Martin,
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
olesen is offline   Reply With Quote

Old   November 12, 2009, 02:56
Default
  #3
Member
 
Martin Aunskjaer
Join Date: Mar 2009
Location: Denmark
Posts: 53
Rep Power: 17
aunola is on a distinguished road
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.
aunola is offline   Reply With Quote

Old   December 8, 2009, 08:28
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
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.
olesen is offline   Reply With Quote

Old   January 19, 2010, 07:32
Default
  #5
Senior Member
 
Ivan Flaminio Cozza
Join Date: Mar 2009
Location: Torino, Piemonte, Italia
Posts: 210
Rep Power: 18
ivan_cozza is on a distinguished road
Send a message via MSN to ivan_cozza
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)
    )
 );
But when I do blockMesh, it give me this error:

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 seems that my version of blockMesh does not have any spline command.
It could be a bug? Or in my version the spline commands have been suppressed?
ivan_cozza is offline   Reply With Quote

Old   January 19, 2010, 07:38
Default
  #6
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by ivan_cozza View Post
It seems that my version of blockMesh does not have any spline command.
It could be a bug? Or in my version the spline commands have been suppressed?
I would guess that you might need to recompile the utility.
olesen is offline   Reply With Quote

Old   January 19, 2010, 07:56
Default
  #7
Senior Member
 
Ivan Flaminio Cozza
Join Date: Mar 2009
Location: Torino, Piemonte, Italia
Posts: 210
Rep Power: 18
ivan_cozza is on a distinguished road
Send a message via MSN to ivan_cozza
Quote:
Originally Posted by olesen View Post
I would guess that you might need to recompile the utility.
The utility was already recompiled.
ivan_cozza is offline   Reply With Quote

Old   January 19, 2010, 08:05
Default
  #8
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by ivan_cozza View Post
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).
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.
olesen is offline   Reply With Quote

Old   January 20, 2010, 10:32
Default
  #9
Senior Member
 
Ivan Flaminio Cozza
Join Date: Mar 2009
Location: Torino, Piemonte, Italia
Posts: 210
Rep Power: 18
ivan_cozza is on a distinguished road
Send a message via MSN to ivan_cozza
Quote:
Originally Posted by olesen View Post
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.
I tried today with a new pulled and compiled version of 1.6.x, the error I posted before persists. Any idea on what's happening?
Thank you to everybody!
Ivan
ivan_cozza is offline   Reply With Quote

Old   February 3, 2010, 04:30
Default
  #10
New Member
 
Marek
Join Date: Dec 2009
Location: Berlin
Posts: 1
Rep Power: 0
Motticelli is on a distinguished road
Hi,
I got the exactly the same error that Ivan posted, does someone have an idea what the problem is?

Thanks,
Marek
Motticelli is offline   Reply With Quote

Old   February 3, 2010, 05:16
Default
  #11
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Motticelli View Post
Hi,
I got the exactly the same error that Ivan posted, does someone have an idea what the problem is?
No idea - the attached blockMeshDict works fine on my system (see log file).
Attached Files
File Type: gz blockMesh-test.tar.gz (2.6 KB, 117 views)
olesen is offline   Reply With Quote

Old   February 3, 2010, 11:13
Default
  #12
Senior Member
 
Ivan Flaminio Cozza
Join Date: Mar 2009
Location: Torino, Piemonte, Italia
Posts: 210
Rep Power: 18
ivan_cozza is on a distinguished road
Send a message via MSN to ivan_cozza
Just runned your case, same error (see the log file)...
Have a nice day,
Ivan
Attached Files
File Type: gz blockMeshIvan.tar.gz (2.7 KB, 34 views)
ivan_cozza is offline   Reply With Quote

Old   February 4, 2010, 03:32
Default
  #13
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by ivan_cozza View Post
Just runned your case, same error (see the log file)...
Have a nice day,
Ivan
It looks like you were right:
http://repo.or.cz/w/OpenFOAM-1.6.x.g...17616acf499689

Either update from the git repo, or just cherry-pick the commit.
olesen 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



All times are GMT -4. The time now is 16:56.