mimesis-inria / caribou

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

Bug in the assemble_stiffness of the HyperelasticForcefield_FEniCS #123

Closed Ziemnono closed 2 years ago

Ziemnono commented 2 years ago

In the function assemble_stiffness, the constants are hard-written. Hence when we modify it for taking the input values such as on this line, we observe that the K matrix will be different.

As an example, the test testing the K matrix difference between FEniCS and Caribou is passing from 9.023612998582589e-13 to 0.00014644344328609921.

Ziemnono commented 2 years ago

Ok, I think I corrected the bug. I replaced the float with Real (we probably lost some digits in the conversion from Real to float.

    Eigen::Array<Real, 1, 2>
    getConstants() override {
        Eigen::Array<Real, 1, 2> constants;
        constants(0, 0) = d_young_modulus.getValue();
        constants(0, 1) = d_poisson_ratio.getValue();
        return constants;
    }