-
Notifications
You must be signed in to change notification settings - Fork 9
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
Check validity of the polyhedra before computing gravity fields? #34
Comments
Good point. However, this check is intentionally not included in the An Improvement of the What I can do, however, is to improve the visibility of this check in the package. Hence, I've stated the Resolved by #31 [1] https://stackoverflow.com/questions/45603469/how-to-calculate-the-normals-of-a-box |
I understand your point. I agree with making the What if the mesh check is added to the forward modelling function but also provide an optional argument to disable it. Since I would recommend every user to run the check before computing the gravity field, I would turn it on by default. In some particular situations users might not want to run the check , so they could do so by setting the argument to Something like: potential, acceleration, tensor = polyhedral_gravity.evaluate(
polyhedral_source=(cube_vertices, cube_faces),
density=cube_density,
computation_points=computation_point,
parallel=True,
disable_check=True,
) What do you think? |
Agreed. I would even go a step further and enable the direct utilization with a "correct" mesh but reverse vertex ordering. The algorithm requires the plane unit normals to be outwards pointing. Hence, I would just specify an enum "OUTWARDS" or "INWARDS" for the following feature. ChangesCore Interface
Utility Methods
|
I will add these features in the next days, but in a new PR other than #31 |
I heavily support opening a new PR for this. Just a few minor thoughts:
I think setting it to
I wouldn't remove it. You already have it, and it's something useful to have. Specially while using the
That would be great! And I think you can only run the check once, no need to run it every time the user ask for the computation of the gravity fields. Maybe the check could be run on instantiation of the class. Or maybe check before the first time the gravity fields are computed, and store a private attribute that flags that the mesh has been checked and is valid. I really like your approach here! Thanks a lot for considering my idea. |
While reading some of the in #29, I noticed that the
evaluate()
function is not checking if the passed polyhedra is valid or not, and returning the gravity field values without any warning that they might not be right.For example, grabbing the cube I used as example in #28, the following code runs with a valid cube and returns these values:
But, if I flip the order of the vertices indices in the first row of
cube_faces
, then the results look like these:As you can see, the values of$g_z$ and $g_{zz}$ are significantly different between the two outputs.
I think it would be a good idea to include a validity check in the
evaluate()
function before computing the gravity fields. This would prevent users getting wrong results and therefore making wrong decisions or arriving at wrong conclusions because their results were wrong.This issue is unrelated to the JOSS review. Addressing it won't be required for the JOSS paper to be published, but I think making the
evaluate()
function less error prone would be a major feature for this package.The text was updated successfully, but these errors were encountered: