mimesis-inria / caribou

Multi-physics computation library
GNU Lesser General Public License v3.0
29 stars 17 forks source link

Caribou mass #60

Closed jnbrunet closed 3 years ago

jnbrunet commented 3 years ago

What a nice surprise to see a review from you @hugtalbot , thanks !!

Btw, I have a suspecious error in Caribou's CI. The following test:

EXPECT_DOUBLE_EQ(f_caribou.norm(), f_sofa.norm());

where f_caribou is Caribou's mass component, and f_sofa is a sofa::component::mass::MeshMatrixMass, fails with master, but not with previous verions of SOFA:

Caribou vs SOFA v20.06

[ RUN      ] CaribouMass.LinearTetrahedron
[        OK ] CaribouMass.LinearTetrahedron (2 ms)

Caribou vs SOFA v20.12

[ RUN      ] CaribouMass.LinearTetrahedron
[        OK ] CaribouMass.LinearTetrahedron (2 ms)

Caribou vs SOFA master

[ RUN      ] CaribouMass.LinearTetrahedron
Mass/test_cariboumass.cpp:142: Failure
Expected equality of these values:
  f_caribou.norm()
    Which is: 45447.826003853719
  f_sofa.norm()
    Which is: 18179.13040154149
[  FAILED  ] CaribouMass.LinearTetrahedron (4 ms)
[ RUN      ] CaribouMass.LinearHexahedron

It looks like the MeshMatrixMass isn't producing the same mass matrix as before... Did something change there? Maybe @epernod knows something?

hugtalbot commented 3 years ago

I would definitely ping @epernod on this since he recently worked on the mass and their initialization. What is exactly f_sofa.norm() ? Cause here there is clearly a 2.5 factor acting (typical from mass lumping in tets) ?

jnbrunet commented 3 years ago

I would definitely ping @epernod on this since he recently worked on the mass and their initialization. What is exactly f_sofa.norm() ? Cause here there is clearly a 2.5 factor acting (typical from mass lumping in tets) ?

It's the force vector:

caribou_mass->addForce(&mechanical_parameters, d_f_caribou, mo->x, mo->v);
sofa_mass->addForce(&mechanical_parameters, d_f_sofa, mo->x, mo->v);

Which should be the integral over the domain of G*density.

jnbrunet commented 3 years ago

@hugtalbot I'm sorry I don't have time to dig this up more but, I'm fairly sure the MeshMatrixMass::addForce of SOFA isn't giving the same result either your are using a lumped scheme or not, and I'm not talking about a small difference. You can test it against SOFA v20.12, which works correctly.

hugtalbot commented 3 years ago

thanks @jnbrunet I created an issue on our end so that we investigate this, it sounds like a critical problem. Thanks again!