wang yunbo | 9 Feb 22:56
Picon
Favicon

Curvature calculation revised

Hi,

I think I didn't make myself clear in the last email. Apologize. 

I have a circle in my model ( center at (50,50), radius=25) as attached which represents the zero level set.
Then I built a field with circular level sets which values vary smoothly from the center of the circle
representing the zero level set, outwards along the radius ( the field has a zero value on the surface of circle).

Then I calculated the curvature of the field everywhere in the mesh and output the values to a file called
'data', and also plot the contours of curvature. My expectation is the curvature should equal to (1/r) and
I will have many concentric circles in my plot. Meanwhile, every point on the circle representing zero
level set should have a curvature of around 0.04 ( since r = 25, 1/r=0.04)  

I have two problems now.

 1. when I look at the 'data' file and checked some point which suppose to be at the surface e.g (50, 25),  (62,
71), the results are like 0.0 or 0.7 (not 0.04 as expected).   That's where I get confused. How can I reach my expectation?

 2. The shape of my plot is quite wavy with many wiggles, not concentric rings as expected.

Thanks very much.

Regards,

Yunbo 

_______________________________________________
fipy mailing list
(Continue reading)

Daniel Wheeler | 10 Feb 17:18
Picon

Re: Curvature calculation revised

On Thu, Feb 9, 2012 at 4:56 PM, wang yunbo <wang1320-olO2ZdjDehc3uPMLIKxrzw@public.gmane.org> wrote:

Hi,

 1. when I look at the 'data' file and checked some point which suppose to be at the surface e.g (50, 25),  (62, 71), the results are like 0.0 or 0.7 (not 0.04 as expected).   That's where I get confused. How can I reach my expectation?

I don't think you can with the current implementation in FiPy. The calcDistanceFunction method is only first order accurate I believe and hence the difficulties calculating the curvature accurately. The applications in FiPy don't use higher derivatives so get away with first order accuracy. The curvature calculation is second order accurate, but the underlying calculation of the distance function is not. Hence the issues. Basically, FiPy as it stands is not accurate enough for this.
 
 2. The shape of my plot is quite wavy with many wiggles, not concentric rings as expected.

I'm moving towards using lsmlib <http://ktchu.serendipityresearch.org/software/lsmlib/index.html>, which I believe has second order accuracy for the distance function calculation and is also way faster than FiPy. At the moment I have cython wrappers for calcDistanceFunction2d, calcEikonalEquation2d and calcExtensionFields2d, which seem to work though I haven't tested extensively. My hope is to replace all the level set functionality in FiPy with the cython lsmlib calls. I'm happy to share the cython wrappers with you if you wish.

In short I recommend that you give lsmlib a shot and then use the my cython wrappers to integrate with python.

Cheers.

--
Daniel Wheeler
_______________________________________________
fipy mailing list
fipy@...
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
wang yunbo | 10 Feb 20:20
Picon
Favicon

Re: Curvature calculation revised

Thanks so much. That'll be great. I'm really looking forwards to trying lsmlib with your cython wrappers.

Regards,

Yunbo  
On Feb 10, 2012, at 11:18 AM, Daniel Wheeler wrote:

On Thu, Feb 9, 2012 at 4:56 PM, wang yunbo <wang1320-olO2ZdjDehc3uPMLIKxrzw@public.gmane.org> wrote:
Hi,

 1. when I look at the 'data' file and checked some point which suppose to be at the surface e.g (50, 25),  (62, 71), the results are like 0.0 or 0.7 (not 0.04 as expected).   That's where I get confused. How can I reach my expectation?

I don't think you can with the current implementation in FiPy. The calcDistanceFunction method is only first order accurate I believe and hence the difficulties calculating the curvature accurately. The applications in FiPy don't use higher derivatives so get away with first order accuracy. The curvature calculation is second order accurate, but the underlying calculation of the distance function is not. Hence the issues. Basically, FiPy as it stands is not accurate enough for this.
 
 2. The shape of my plot is quite wavy with many wiggles, not concentric rings as expected.

I'm moving towards using lsmlib <http://ktchu.serendipityresearch.org/software/lsmlib/index.html>, which I believe has second order accuracy for the distance function calculation and is also way faster than FiPy. At the moment I have cython wrappers for calcDistanceFunction2d, calcEikonalEquation2d and calcExtensionFields2d, which seem to work though I haven't tested extensively. My hope is to replace all the level set functionality in FiPy with the cython lsmlib calls. I'm happy to share the cython wrappers with you if you wish.

In short I recommend that you give lsmlib a shot and then use the my cython wrappers to integrate with python.

Cheers.

--
Daniel Wheeler
_______________________________________________
fipy mailing list
fipy-R3+/ord2DXQ@public.gmane.org
http://www.ctcms.nist.gov/fipy
 [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

_______________________________________________
fipy mailing list
fipy@...
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
Daniel Wheeler | 10 Feb 21:40
Picon

Re: Curvature calculation revised

Yunbo,

The entire lsmlib code in in my research repository

   <http://matforge.org/wd15/browser/trunk/lsmlib>

It's not been modified apart from for debug reasons. The pylsmlib section is in

  <http://matforge.org/wd15/browser/trunk/lsmlib/pylsmlib>

The three cython wrapper functions are here

  <http://matforge.org/wd15/browser/trunk/lsmlib/pylsmlib/lsmlib.pyx>

Good luck!

On Fri, Feb 10, 2012 at 2:20 PM, wang yunbo <wang1320-olO2ZdjDehc3uPMLIKxrzw@public.gmane.org> wrote:
Thanks so much. That'll be great. I'm really looking forwards to trying lsmlib with your cython wrappers.

Regards,

Yunbo  
On Feb 10, 2012, at 11:18 AM, Daniel Wheeler wrote:

On Thu, Feb 9, 2012 at 4:56 PM, wang yunbo <wang1320-olO2ZdjDehc3uPMLIKxrzw@public.gmane.org> wrote:
Hi,

 1. when I look at the 'data' file and checked some point which suppose to be at the surface e.g (50, 25),  (62, 71), the results are like 0.0 or 0.7 (not 0.04 as expected).   That's where I get confused. How can I reach my expectation?

I don't think you can with the current implementation in FiPy. The calcDistanceFunction method is only first order accurate I believe and hence the difficulties calculating the curvature accurately. The applications in FiPy don't use higher derivatives so get away with first order accuracy. The curvature calculation is second order accurate, but the underlying calculation of the distance function is not. Hence the issues. Basically, FiPy as it stands is not accurate enough for this.
 
 2. The shape of my plot is quite wavy with many wiggles, not concentric rings as expected.

I'm moving towards using lsmlib <http://ktchu.serendipityresearch.org/software/lsmlib/index.html>, which I believe has second order accuracy for the distance function calculation and is also way faster than FiPy. At the moment I have cython wrappers for calcDistanceFunction2d, calcEikonalEquation2d and calcExtensionFields2d, which seem to work though I haven't tested extensively. My hope is to replace all the level set functionality in FiPy with the cython lsmlib calls. I'm happy to share the cython wrappers with you if you wish.

In short I recommend that you give lsmlib a shot and then use the my cython wrappers to integrate with python.

Cheers.

--
Daniel Wheeler
_______________________________________________
fipy mailing list
fipy-R3+/ord2DXQ@public.gmane.org
http://www.ctcms.nist.gov/fipy
 [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


_______________________________________________
fipy mailing list
fipy-R3+/ord2DXQ@public.gmane.org
http://www.ctcms.nist.gov/fipy
 [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]




--
Daniel Wheeler
_______________________________________________
fipy mailing list
fipy@...
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Gmane