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

calc_volume_closed in analyse - negative surface volume contribution #77

Open
FionaSunderland opened this issue Nov 2, 2022 · 0 comments

Comments

@FionaSunderland
Copy link
Member

sVC = area * amp.vert[amp.faces, 2].mean(axis=1) * amp.norm[:, 2]
if return_closed is True:
    return sVC.sum(), amp
else:
    return sVC.sum()

amp.norm[:, 2] can have negative values, giving a negative volume contributions. The .sum() contribution does not take this into account.
suggest replacing sVC.sum() with (np.abs(sVc)).sum()

Smaller issue more likely caused by poor meshing but I belive there is possible issue if a triangle face has a very small angle the two adjacent edges, may have very similar values and with rounding their cross product will be zero/the norm will end up with nan which then results in .sum() giving nan. Can be fixed by using np.nansum((np.abs(sVC))) instead of .sum()

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

1 participant