-
Notifications
You must be signed in to change notification settings - Fork 112
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
RodMeshSurfaceContact class init #294
RodMeshSurfaceContact class init #294
Conversation
Codecov ReportPatch coverage is ❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
📢 Thoughts on this report? Let us know!. |
@Rahul-JOON can you format the code and push again. We resolve one conflict on browser and did not run the formatting |
elastica/contact_forces.py
Outdated
self.face_idx_array, | ||
self.element_position, | ||
) = find_contact_faces_idx( | ||
self.facets_grid, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently your contact class has no facets_grid or grid_size attributes. Look at surface_import_and_grid.py
in dev_snake_contact to see how to create the grid and calculate the grid_size. Basically what the grid does is that it allows us to determine which surface faces are in contact with the rod without doing a search. This is done by making the grid_size small enough so that only one rod element at most can fit in the grid square, which means we can figure out which grid squares the rod element is in by knowing only the rod element position. Since the surface does not move we know exactly where the faces are in relation to the grid, hence we can figure which faces are in contact with each element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the insight! I'll add the attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments
lengths, | ||
): | ||
""" | ||
This function computes the plane force response on the element, in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I will update this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we update this doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate on what should we update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good one minor comment
lengths, | ||
): | ||
""" | ||
This function computes the plane force response on the element, in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we update this doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of changes.
return dict( | ||
surface_grid_numba( | ||
faces, grid_size, face_x_left, face_x_right, face_y_down, face_y_up | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better if you made this a function of both the mesh_surface and the rod instead of faces and grid_size. First, calculate the grid size based on the rod dimensions (calculation is in surface_import_and_grid.py, you can use it to write a function for that). Second, get the faces from the mesh_surface and use that with the grid_size in surface_grid_numba. Lastly, add the metadata for the grid from the mesh_surface before returning. Something like:
faces_grid["grid_size"] = grid_size
faces_grid["model_path"] = model_path
faces_grid["mesh_scale"] = mesh_scale
faces_grid["surface_orientation"] = surface_orientation
self.k = k | ||
self.nu = nu | ||
self.faces_grid = faces_grid | ||
self.grid_size = grid_size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of requesting grid_size as input for the class, include it in the faces_grid "metadata". I explain it later in a different comment on the faces_grid generation. This should be something like self.grid_size = faces_grid["grid_size"]
) | ||
) | ||
|
||
elif not faces_grid["grid_size"] == grid_size: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what I would do here is check if the faces_grid["grid_size"] == max(2*system_one.radius[0],system_one.rest_lengths[0]). Essentially, checking if the grid_size of faces_grid is appropriate for the given rod.
"Imported grid's model path does not match with the current mesh_surface model path. " | ||
) | ||
|
||
elif not faces_grid["surface_reorient"] == system_two.mesh_orientation: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change "surface_reorient" to "mesh_orientation"
|
||
elif not faces_grid["surface_reorient"] == system_two.mesh_orientation: | ||
raise TypeError( | ||
"Imported grid's surface orientation does not match with the current mesh_surface rientation. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Imported grid's surface orientation does not match with the current mesh_surface rientation. " | |
"Imported grid's surface orientation does not match with the current mesh_surface orientation. " |
This PR attempts to add the Rod - Mesh Surface contact class init function in elastica.
The approach for the class has been sourced from dev_snake_contact branch as mentioned in #290