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

Feature/contact/normal vector #655

Merged
merged 8 commits into from
Jul 3, 2020
Merged

Conversation

thiagordonho
Copy link
Contributor

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
Copy link

codecov bot commented Jun 29, 2020

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%) ⬇️
include/mesh.tcc 84.13% <100.00%> (+0.07%) ⬆️
include/node.tcc 95.81% <100.00%> (+0.14%) ⬆️
include/particles/particle.tcc 94.36% <100.00%> (+0.09%) ⬆️
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.

include/node.tcc Outdated Show resolved Hide resolved
include/node.tcc Outdated Show resolved Hide resolved
Copy link
Contributor

@kks32 kks32 left a comment

Choose a reason for hiding this comment

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

Please complete the requested changes.

Copy link
Contributor

@ezrayst ezrayst left a comment

Choose a reason for hiding this comment

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

Thanks @thiagordonho, not sure whether we should use .normalized() or .normalize() - but I think the different is that it returns a copy for the former and modify the current variable for the latter. So I think you are right in using the former!

// Map domain gradients to nodal property. The domain gradients is defined as
// the gradient of the particle volume
for (unsigned i = 0; i < nodes_.size(); ++i) {
const auto& gradient = volume_ * dn_dx_.row(i);
Copy link
Contributor

@kks32 kks32 Jul 2, 2020

Choose a reason for hiding this comment

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

Suggested change
const auto& gradient = volume_ * dn_dx_.row(i);
Eigen::Matrix<double, Tdim, 1> gradient;
for (unsigned j = 0; j < Tdim; ++j)
gradient[j] += dn_dx_[i, j] * volume;

@thiagordonho thiagordonho merged commit 337aaf8 into develop Jul 3, 2020
@thiagordonho thiagordonho deleted the feature/contact/normal_vector branch July 3, 2020 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants