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

Modify control point nudge for 1D elements #120

Open
dbrakenhoff opened this issue Nov 11, 2024 · 4 comments
Open

Modify control point nudge for 1D elements #120

dbrakenhoff opened this issue Nov 11, 2024 · 4 comments

Comments

@dbrakenhoff
Copy link
Collaborator

Currently, the control point locations inside and outside an element are computed by multiplying 1 plus a small number (1E-6) by the absolute value of the coordinate and adding/subtracting that to the location of the element.

self.xcin = self.xc + self.tiny * abs(self.xc) + self.tiny

For large values of the coordinate (which to be fair is probably rare for cross sectional models), this causes large distances between the element and its control points inside/outside, which isn't what we want.

Proposal is to replace the above by just adding/subtracting a small number. Optionally we can consider exposing the small number as a keyword argument in the elements.

self.xcin  = self.xc + self.tiny
@panibillo
Copy link

panibillo commented Nov 11, 2024 via email

@dbrakenhoff
Copy link
Collaborator Author

For a small number that is just large enough for Python to distinguish the distance, what about using numpy.spacing(n)? Where n is some small number that lets your tests pass.

Interesting, I didn't know about np.spacing. But machine precision is probably a little too small for this, I think.

@panibillo
Copy link

panibillo commented Nov 11, 2024 via email

@dbrakenhoff
Copy link
Collaborator Author

dbrakenhoff commented Nov 11, 2024

Hi Bill, thanks for the suggestion and worked example, I'll give it a try! The reason I wasn't sure initially is because so far we've used shifts on the order of ~1e-6, and I wasn't sure if in 2D we wouldn't be running into any floating point precision stuff with some of the methods to determine whether a point is inside or outside a polygon, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants