Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second order issue with KNOWN and TRIAL values #2

Open
wd15 opened this issue Oct 15, 2012 · 0 comments
Open

Second order issue with KNOWN and TRIAL values #2

wd15 opened this issue Oct 15, 2012 · 0 comments
Assignees
Labels

Comments

@wd15
Copy link
Contributor

wd15 commented Oct 15, 2012

This seems to be an issue with both LSMLIB and Scikit-fmm. The following test fails with LSMLIB, but passes (by luck) in Scikit-fmm.

>>> from skfmm import distance
>>> phi = distance([[-1, -1, -1, -1],
                 [ 1,  1, -1, -1],
                 [ 1,  1, -1, -1],
                 [ 1,  1, -1, -1]], order=2)
>>> print distance(phi, order=2)
[[-0.5        -0.58578644 -1.08578644 -1.85136395]
 [ 0.5         0.29289322 -0.58578644 -1.54389939]
 [ 1.30473785  0.5        -0.5        -1.5       ]
 [ 1.49547948  0.5        -0.5        -1.5       ]]

One gets a different answer with LSMLIB

 >>> from pylsmlib import distance
 >>> phi = distance([[-1, -1, -1, -1],
 ...           [ 1,  1, -1, -1],
 ...           [ 1,  1, -1, -1],
 ...           [ 1,  1, -1, -1]], order=2)
 >>> print distance(phi, order=2)
[[-0.5        -0.58578644 -1.08578644 -1.85170563]
 [ 0.5         0.29289322 -0.58578644 -1.54468054]
 [ 1.30473785  0.5        -0.5        -1.5       ]
 [ 1.49547948  0.5        -0.5        -1.5       ]]

The issue is that newly created KNOWN values only update their closest neighbour's values. For second order schemes newly created KNOWN values need to update all values in the stencil. That is cells that are two steps away with a KNOWN value between.

Toy Problem

Take three cells lieing in a larger 2D array of cells. Say that 0.5 is the smallest value in the TRIAL cells

| TRIAL 0.5 | TRIAL 0.5 | TRIAL 0.51 |

One of the two values becomes updated to KNOWN, but that now information happens to lower the value of the left side cell.

| TRIAL 0.405 | KNOWN 0.5 | TRIAL 0.505 |

The left cell then becomes KNOWN

| KNOWN 0.405 | KNOWN 0.5 | TRIAL 0.505 |

TRIAL 0.51 is not reupdated when the left cell becomes KNOWN although the value is required for second order accuracy.

| KNOWN 0.405 | KNOWN 0.5 | KNOWN 0.505|

@ktchu ktchu added this to the 2.0.0 milestone Sep 5, 2021
@ktchu ktchu added bug and removed bug labels Sep 9, 2021
@ktchu ktchu self-assigned this Sep 9, 2021
@ktchu ktchu added the bug label Sep 9, 2021
@ktchu ktchu removed this from the 2.0.0 milestone Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants