CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   polySpline violates convex hull property (http://www.cfd-online.com/Forums/openfoam-bugs/68862-polyspline-violates-convex-hull-property.html)

aunola October 4, 2009 11:17

polySpline violates convex hull property
 
4 Attachment(s)
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).

olesen November 10, 2009 07:21

Quote:

Originally Posted by aunola (Post 231417)
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

aunola November 12, 2009 02:56

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.

olesen December 8, 2009 08:28

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.

ivan_cozza January 19, 2010 07:32

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?

olesen January 19, 2010 07:38

Quote:

Originally Posted by ivan_cozza (Post 243063)
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.

ivan_cozza January 19, 2010 07:56

Quote:

Originally Posted by olesen (Post 243064)
I would guess that you might need to recompile the utility.

The utility was already recompiled.

olesen January 19, 2010 08:05

Quote:

Originally Posted by ivan_cozza (Post 243063)
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.

ivan_cozza January 20, 2010 10:32

Quote:

Originally Posted by olesen (Post 243067)
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

Motticelli February 3, 2010 04:30

Hi,
I got the exactly the same error that Ivan posted, does someone have an idea what the problem is?

Thanks,
Marek

olesen February 3, 2010 05:16

1 Attachment(s)
Quote:

Originally Posted by Motticelli (Post 244722)
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).

ivan_cozza February 3, 2010 11:13

1 Attachment(s)
Just runned your case, same error (see the log file)...
Have a nice day,
Ivan

olesen February 4, 2010 03:32

Quote:

Originally Posted by ivan_cozza (Post 244795)
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.


All times are GMT -4. The time now is 11:00.