cb-geo / mpm

CB-Geo High-Performance Material Point Method
https://www.cb-geo.com/research/mpm
Other
238 stars 82 forks source link

Feature/contact/normal vector #655

Closed thiagordonho closed 4 years ago

thiagordonho commented 4 years ago

Describe the PR Implementation to compute the normal unit vector at every node with more than one materials. In order to do this, a function in Particle class to map the domain gradients (gradient of volumes) is implemented.

  for (unsigned i = 0; i < nodes_.size(); ++i) {
    const auto& gradient = volume_ * dn_dx_.row(i);
    nodes_[i]->update_property(true, "domain_gradients", gradient, material_id_,
                               Tdim);
  }

Then, the normal unit vector is calculated at every node by means of a function implemented in the Node class computing the unit vector as the domain gradient divided by its norm.

    const auto& normal_unit_vector =
        (1 / domain_gradient.norm()) * domain_gradient;

Related Issues/PRs This PR is related to the RFC #636 .

codecov[bot] commented 4 years ago

Codecov Report

Merging #655 into develop will decrease coverage by 0.00%. The diff coverage is 96.55%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #655      +/-   ##
===========================================
- Coverage    96.55%   96.55%   -0.00%     
===========================================
  Files          122      122              
  Lines        25337    25395      +58     
===========================================
+ Hits         24464    24520      +56     
- Misses         873      875       +2     
Impacted Files Coverage Δ
include/node.h 100.00% <ø> (ø)
include/node_base.h 100.00% <ø> (ø)
include/particles/particle.h 100.00% <ø> (ø)
include/particles/particle_base.h 100.00% <ø> (ø)
include/solvers/mpm_explicit.tcc 61.94% <0.00%> (-0.81%) :arrow_down:
include/mesh.tcc 84.13% <100.00%> (+0.07%) :arrow_up:
include/node.tcc 95.81% <100.00%> (+0.14%) :arrow_up:
include/particles/particle.tcc 94.36% <100.00%> (+0.09%) :arrow_up:
tests/interface_test.cc 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9ac85dd...57d5d46. Read the comment docs.