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

[Element] Quadratic Bspline MPM #14

Merged
merged 51 commits into from
Jan 21, 2022
Merged

[Element] Quadratic Bspline MPM #14

merged 51 commits into from
Jan 21, 2022

Conversation

bodhinandach
Copy link
Member

@bodhinandach bodhinandach commented Oct 11, 2021

Describe the PR
This PR adds Quadratic BSpline element implementation for 2D and 3D MPM problems. Some changes are brought to the current code:

  1. Each cell will now have a pointer to a unique element. This element will store cell elemental-specific information such as the number of connectivities, node coordinates, knot vectors, and types associated with each node.
  2. Each element might have a different number of nodes, particularly close to edges or corners of the simulation domain.
  3. The BSpline element is initiated from a simple quadrilateral/hexahedral element, so we don't have to change the mesh input file.
  4. If the BSpline element is used, a structured equal-spacing quad/hex mesh is required. The simulation grid doesn't have to be a box though.
  5. There is no need to add an extra layer of element at the boundary though.
  6. It is necessary to declare the nodes located at the end boundaries and the nodes located at one node adjacent to the end boundaries in each direction. It is tricky but necessary to obtain a compatible BSpline shape function. I am trying to find a way to accommodate this, but no good idea other than declaring them at the beginning of the simulation.
  7. Additional information is needed to be added to the .json file:
"mesh": {
          "cell_type": "ED3H8P2B",
          "nonlocal_mesh_properties": {
			"type": "BSPLINE",
			"node_types": [
				{
					"nset_id": 0,
					"dir": 0,
					"type": 1
				},
                               {...}
                         ]
          }
}

In the above, node types are defined for each direction following this convention:

  //! Regular = 0 //Default
  //! LowerBoundary = 1
  //! LowerIntermediate = 2
  //! UpperIntermediate = 3
  //! UpperBoundary = 4

I have checked that this works currently for explicit and implicit single-phase and explicit and semi-implicit two-phase codes. In the upcoming days, I will check and implement the following:

  • Tests to confirm the accuracy
  • Parallel MPI implementation
  • Parallel performance measurement

Related Issues/PRs
#13

Additional context

  • The performance of BSpline is measured for comparative purpose as follow:
    • 3D explicit - serial: 1475s
    • 3D explicit - OpenMP p=4: 1354s
    • 3D explicit - MPI n=4: 843s
    • 3D explicit - MPI n=4 w/ dynamic load balancing: 442s
  • Reference can be found here:
    Steffen, M., Kirby, R. M., & Berzins, M. (2008). Analysis and reduction of quadrature errors in the material point method (MPM). International journal for numerical methods in engineering, 76(6), 922-948.

@bodhinandach bodhinandach added the enhancement New feature or request label Oct 11, 2021
@bodhinandach bodhinandach self-assigned this Oct 11, 2021
@bodhinandach bodhinandach marked this pull request as draft October 11, 2021 22:28
@bodhinandach bodhinandach linked an issue Oct 11, 2021 that may be closed by this pull request
@bodhinandach
Copy link
Member Author

@RyotaHashimoto @jgiven100 @yliang-sn This PR is ready to be reviewed. Let me know if there are any suggestions on your end.

@bodhinandach
Copy link
Member Author

Just want to write some additions to the header explanation. This PR also introduces the following:

  1. Change write_hdf5_twophase to write_hdf5 with an if statement of file type. Ping @yliang-sn
  2. We need to increase the resource class for codecov since otherwise, tests will keep failing. We added quite some tests after a few branches are merged, so the memory limit (which was 2GB) was reached and the simulation can't compile.
  3. I added the missing displacement-constraints.txt file missing in the implicit test so that the displacement constrain assignment is done properly. Ping @RyotaHashimoto.

Hopefully, these are not too much. Otherwise, I am happy to make separate PRs for each of them.

@bodhinandach
Copy link
Member Author

@migmolper I think we are ready to shift to LME-MPM. The node neighborhood can now be adjusted via a recursive algorithm. See below:

mpm/include/mesh/mesh.tcc

Lines 2217 to 2229 in 9f70987

//! Return node neighbours id set given a size of cell neighbourhood
template <unsigned Tdim>
std::set<mpm::Index> mpm::Mesh<Tdim>::cell_neighbourhood_nodes_id(
const std::shared_ptr<mpm::Cell<Tdim>>& cell, unsigned cell_neighbourhood) {
std::set<mpm::Index> neighbour_nodes_id = cell->nodes_id();
if (cell_neighbourhood == 0) return neighbour_nodes_id;
for (const auto& neighbour_cell_id : cell->neighbours()) {
const auto& node_id = cell_neighbourhood_nodes_id(
map_cells_[neighbour_cell_id], cell_neighbourhood - 1);
neighbour_nodes_id.insert(node_id.begin(), node_id.end());
}
return neighbour_nodes_id;
}

Copy link
Collaborator

@RyotaHashimoto RyotaHashimoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bodhinandach Thank you for the implementation. The code seems ok. I added some comments and questions. Please check them.

include/elements/2d/triangle_element.tcc Outdated Show resolved Hide resolved
include/elements/3d/hexahedron_bspline_element.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@RyotaHashimoto RyotaHashimoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the replies. Let's merge this.

@bodhinandach
Copy link
Member Author

@jgiven100 Any follow-up thoughts?

@jgiven100
Copy link
Member

No other comments from me. Didn't want to "approve" since a lot of this is out my depth

@bodhinandach bodhinandach merged commit b3ab0b6 into master Jan 21, 2022
@bodhinandach bodhinandach deleted the element/bspline branch January 21, 2022 02:22
@bodhinandach
Copy link
Member Author

Alright, merging in then!

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

Successfully merging this pull request may close these issues.

BSpline element 2D and 3D
4 participants