Description
Most of MPM python test use default tolerance. However I found these default tolerance are too big to be able to captures wrong results.
For example, in my mapping implementation, I forgot to add particle to grid mapping of the pressure. Despite this, all of the python test, especially dynamic UP test still passed. Considering how big of a mistake this was and that the test is unable to catch this is a huge problem.
Furthermore, changing the default tolerances to 1e-7 (from 1e-3 for abs tolerance and 1e-6 for relative) and running the python test gives 4 failed tests.
- These are done in my branch and the master branch (up to date with repo).
- These differences to the reference value is, in my opinion, quite significant (see below)
- 32 threads were used for the python tests.
- The values in each failed test shows consistent result across several run of the test. Meaning that numerical error is not the reason for these differences.
Scope
To Reproduce
Setting the mapped pressure values to zero everywhere and run the test.
Expected behavior
The test should fail
Environment
- OS: Ubuntu 24.04
- Branch: master & dev branch
- Python 3.12.23
Failed tests (master branch)
FAIL: test_execution (mpm_test_factory.CLLinearElastic3DQuadTest.test_execution)
Traceback (most recent call last):
File "/home/andimkatili/software/Kratos/KratosMaster/applications/MPMApplication/tests/mpm_test_factory.py", line 38, in test_execution
self.test.RunSolutionLoop()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 66, in RunSolutionLoop
self.FinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 159, in FinalizeSolutionStep
process.ExecuteFinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/MPMApplication/mpm_from_json_check_result_process.py", line 391, in ExecuteFinalizeSolutionStep
self.assertTrue(isclosethis, msg=(str(value[index]) + " != " + str(value_json) + ", rel_tol = " + str(reltol) + ", abs_tol = " + str(tol) + " : Error checking material point " + str(mp.Id) + " " + variable_name + " results."))
AssertionError: False is not true : -0.9981014857391192 != -0.9990986587131674, rel_tol = 1e-07, abs_tol = 1e-07 : Error checking material point 9 MP_CAUCHY_STRESS_VECTOR results.
======================================================================
FAIL: test_execution (mpm_test_factory.CLDispNewtonianFluidTest.test_execution)
Traceback (most recent call last):
File "/home/andimkatili/software/Kratos/KratosMaster/applications/MPMApplication/tests/mpm_test_factory.py", line 38, in test_execution
self.test.RunSolutionLoop()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 66, in RunSolutionLoop
self.FinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 159, in FinalizeSolutionStep
process.ExecuteFinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/MPMApplication/mpm_from_json_check_result_process.py", line 378, in ExecuteFinalizeSolutionStep
self.assertTrue(isclosethis, msg=(str(value[component_index]) + " != "+str(value_json) + ", rel_tol = " + str(reltol) + ", abs_tol = " + str(tol) + " : Error checking material point " + str(mp.Id) + " " + variable_name + " results."))
AssertionError: False is not true : 2.0804766896228717e-05 != 2.0679027566984323e-05, rel_tol = 1e-07, abs_tol = 1e-07 : Error checking material point 437 MP_DISPLACEMENT results.
======================================================================
FAIL: test_execution (mpm_test_factory.GravityApplicationTest.test_execution)
Traceback (most recent call last):
File "/home/andimkatili/software/Kratos/KratosMaster/applications/MPMApplication/tests/mpm_test_factory.py", line 38, in test_execution
self.test.RunSolutionLoop()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 66, in RunSolutionLoop
self.FinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 159, in FinalizeSolutionStep
process.ExecuteFinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/MPMApplication/mpm_from_json_check_result_process.py", line 378, in ExecuteFinalizeSolutionStep
self.assertTrue(isclosethis, msg=(str(value[component_index]) + " != "+str(value_json) + ", rel_tol = " + str(reltol) + ", abs_tol = " + str(tol) + " : Error checking material point " + str(mp.Id) + " " + variable_name + " results."))
AssertionError: False is not true : -1.0246735978938274e-07 != 5.829681202114759e-23, rel_tol = 1e-07, abs_tol = 1e-07 : Error checking material point 26 MP_ACCELERATION results.
======================================================================
FAIL: test_execution (mpm_test_factory.GravityTimeStepTableTest.test_execution)
Traceback (most recent call last):
File "/home/andimkatili/software/Kratos/KratosMaster/applications/MPMApplication/tests/mpm_test_factory.py", line 38, in test_execution
self.test.RunSolutionLoop()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 66, in RunSolutionLoop
self.FinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 159, in FinalizeSolutionStep
process.ExecuteFinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/MPMApplication/mpm_from_json_check_result_process.py", line 378, in ExecuteFinalizeSolutionStep
self.assertTrue(isclosethis, msg=(str(value[component_index]) + " != "+str(value_json) + ", rel_tol = " + str(reltol) + ", abs_tol = " + str(tol) + " : Error checking material point " + str(mp.Id) + " " + variable_name + " results."))
AssertionError: False is not true : -1.0246735978938274e-07 != 5.829681202114759e-23, rel_tol = 1e-07, abs_tol = 1e-07 : Error checking material point 26 MP_ACCELERATION results.
Ran 131 tests in 16.699s
FAILED (failures=4, skipped=1)
Description
Most of MPM python test use default tolerance. However I found these default tolerance are too big to be able to captures wrong results.
For example, in my mapping implementation, I forgot to add particle to grid mapping of the pressure. Despite this, all of the python test, especially dynamic UP test still passed. Considering how big of a mistake this was and that the test is unable to catch this is a huge problem.
Furthermore, changing the default tolerances to 1e-7 (from 1e-3 for abs tolerance and 1e-6 for relative) and running the python test gives 4 failed tests.
Scope
To Reproduce
Setting the mapped pressure values to zero everywhere and run the test.
Expected behavior
The test should fail
Environment
Failed tests (master branch)
FAIL: test_execution (mpm_test_factory.CLLinearElastic3DQuadTest.test_execution)
Traceback (most recent call last):
File "/home/andimkatili/software/Kratos/KratosMaster/applications/MPMApplication/tests/mpm_test_factory.py", line 38, in test_execution
self.test.RunSolutionLoop()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 66, in RunSolutionLoop
self.FinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 159, in FinalizeSolutionStep
process.ExecuteFinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/MPMApplication/mpm_from_json_check_result_process.py", line 391, in ExecuteFinalizeSolutionStep
self.assertTrue(isclosethis, msg=(str(value[index]) + " != " + str(value_json) + ", rel_tol = " + str(reltol) + ", abs_tol = " + str(tol) + " : Error checking material point " + str(mp.Id) + " " + variable_name + " results."))
AssertionError: False is not true : -0.9981014857391192 != -0.9990986587131674, rel_tol = 1e-07, abs_tol = 1e-07 : Error checking material point 9 MP_CAUCHY_STRESS_VECTOR results.
======================================================================
FAIL: test_execution (mpm_test_factory.CLDispNewtonianFluidTest.test_execution)
Traceback (most recent call last):
File "/home/andimkatili/software/Kratos/KratosMaster/applications/MPMApplication/tests/mpm_test_factory.py", line 38, in test_execution
self.test.RunSolutionLoop()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 66, in RunSolutionLoop
self.FinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 159, in FinalizeSolutionStep
process.ExecuteFinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/MPMApplication/mpm_from_json_check_result_process.py", line 378, in ExecuteFinalizeSolutionStep
self.assertTrue(isclosethis, msg=(str(value[component_index]) + " != "+str(value_json) + ", rel_tol = " + str(reltol) + ", abs_tol = " + str(tol) + " : Error checking material point " + str(mp.Id) + " " + variable_name + " results."))
AssertionError: False is not true : 2.0804766896228717e-05 != 2.0679027566984323e-05, rel_tol = 1e-07, abs_tol = 1e-07 : Error checking material point 437 MP_DISPLACEMENT results.
======================================================================
FAIL: test_execution (mpm_test_factory.GravityApplicationTest.test_execution)
Traceback (most recent call last):
File "/home/andimkatili/software/Kratos/KratosMaster/applications/MPMApplication/tests/mpm_test_factory.py", line 38, in test_execution
self.test.RunSolutionLoop()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 66, in RunSolutionLoop
self.FinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 159, in FinalizeSolutionStep
process.ExecuteFinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/MPMApplication/mpm_from_json_check_result_process.py", line 378, in ExecuteFinalizeSolutionStep
self.assertTrue(isclosethis, msg=(str(value[component_index]) + " != "+str(value_json) + ", rel_tol = " + str(reltol) + ", abs_tol = " + str(tol) + " : Error checking material point " + str(mp.Id) + " " + variable_name + " results."))
AssertionError: False is not true : -1.0246735978938274e-07 != 5.829681202114759e-23, rel_tol = 1e-07, abs_tol = 1e-07 : Error checking material point 26 MP_ACCELERATION results.
======================================================================
FAIL: test_execution (mpm_test_factory.GravityTimeStepTableTest.test_execution)
Traceback (most recent call last):
File "/home/andimkatili/software/Kratos/KratosMaster/applications/MPMApplication/tests/mpm_test_factory.py", line 38, in test_execution
self.test.RunSolutionLoop()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 66, in RunSolutionLoop
self.FinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/analysis_stage.py", line 159, in FinalizeSolutionStep
process.ExecuteFinalizeSolutionStep()
File "/home/andimkatili/software/python_venv/KratosMaster_gcc_Debug/lib/python3.12/site-packages/KratosMultiphysics/MPMApplication/mpm_from_json_check_result_process.py", line 378, in ExecuteFinalizeSolutionStep
self.assertTrue(isclosethis, msg=(str(value[component_index]) + " != "+str(value_json) + ", rel_tol = " + str(reltol) + ", abs_tol = " + str(tol) + " : Error checking material point " + str(mp.Id) + " " + variable_name + " results."))
AssertionError: False is not true : -1.0246735978938274e-07 != 5.829681202114759e-23, rel_tol = 1e-07, abs_tol = 1e-07 : Error checking material point 26 MP_ACCELERATION results.
Ran 131 tests in 16.699s
FAILED (failures=4, skipped=1)