Skip to content

calc_volume_closed in analyse - negative surface volume contribution  #77

Description

@FionaSunderland
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()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions