KratosMultiphysics / Kratos

Kratos Multiphysics (A.K.A Kratos) is a framework for building parallel multi-disciplinary simulation software. Modularity, extensibility and HPC are the main objectives. Kratos has BSD license and is written in C++ with extensive Python interface.
https://kratosmultiphysics.github.io/Kratos/
Other
1.01k stars 244 forks source link

QA Failure in structural mechanics application #5857

Closed jrubiogonzalez closed 4 years ago

jrubiogonzalez commented 4 years ago

When running QA, it is failing randomly specially in windows, but sometimes also in Liunux (Fedora). The failing test is

Ran 849 of 850 test cases in 2.45259s. 1 failed: TestConstitutiveLawIntegrateStressPlasticityFiniteStrainKinematic Failed with message: Error: Check failed because vector VMres with values [-1.80942e+07, -1.80942e+07, -1.80036e+07, 0, 0, 0] Is not near vector TestVM with values 6 Mismatch found in component 0: -1.80942e+07 not near -1.76859e+07 within relative tolerance 0.0001.

In fact both included in the same file fail alternatively

I went thorug valgrind adding unly this test and this is the output. valgrind_salida_kinematic_plasticity_constitutive_laws.txt

Looks like an uninitalised variable. @pooyan-dadvand @roigcarlo @RiccardoRossi @ipouplana @ddiezrod

ipouplana commented 4 years ago

I'll add @AlejandroCornejo just in case he knows something

jrubiogonzalez commented 4 years ago

It is stranger in Linux but if you run (at least in fedora) the test enough times it ends up failing

roigcarlo commented 4 years ago

Does it use openmp? it may be a race condition...

loumalouomega commented 4 years ago

Finite strain are my fault, many operations are involved, may be my fault

jrubiogonzalez commented 4 years ago

I thought the same, but OpenMP inside a constitutive law... Please check you can reproduce the issue

loumalouomega commented 4 years ago

My be a memory issue, finite strain makes mandatory backup intermediate values which are restores later in the values of the CL, as using pure references and raw pointers may be memory problematic

loumalouomega commented 4 years ago

We should use valgrind

jrubiogonzalez commented 4 years ago

I attached the file with the valgrind output, not very clear

loumalouomega commented 4 years ago

Valgrind is never clear :P

loumalouomega commented 4 years ago

Valgrind is never clear :P

Looks like a bug in the constitutive law utilities, I will check tonight

ddiezrod commented 4 years ago

Its complaining about this line it seems https://github.com/KratosMultiphysics/Kratos/blob/6bc6a85fc07acbd745a0ff721fe18ee7299e008f/applications/StructuralMechanicsApplication/custom_utilities/constitutive_law_utilities.cpp#L945

ddiezrod commented 4 years ago

I think I found the error, back stress vector is used unitialized in both finite_strains and small_strains kinematic plasticity CL.

AlejandroCornejo commented 4 years ago

Hi, I'm going to check what @ddiezrod says, one sec

ddiezrod commented 4 years ago

Here for example (its copied in many places) https://github.com/KratosMultiphysics/Kratos/blob/b6212cf7c7ce0c5f9c4b4a7514fb12615444e8e8/applications/StructuralMechanicsApplication/custom_advanced_constitutive/generic_finite_strain_kinematic_plasticity.cpp#L129

It is used later inside the integrator when you compute the plastic denominator

AlejandroCornejo commented 4 years ago

yes, I think It is smthg wrong with this CL, working on it

ddiezrod commented 4 years ago

yes, I think It is smthg wrong with this CL, working on it

Ok, if you do Vector back_stress_vector = ZeroVector(VoigtZise) tests pass

AlejandroCornejo commented 4 years ago

Sure but the algorithm should track the value of the BackStress historically... I forgot to create as member variable

AlejandroCornejo commented 4 years ago

I've done some changes in https://github.com/KratosMultiphysics/Kratos/pull/5871 I've run the tests and they run (maybe yo could run them just in case). As you were saying, the Back stress vector should be historical and I forgot to create the member variable.

ddiezrod commented 4 years ago

I think this can be closed with #5871 and #5878 . Just to mention it #5835