sfepy/sfepy — Issue #125: Failure of test_matcoefs.py
Author: rc
Created: 2012-01-30 10:26:49+00:00
State: open

I'm seeing a failure in the test_matcoefs.py with a recent git pull. Here
is the debug output:

logan@phoenix:~/projects/sfepy$ ./runTests.py --debug tests/test_matcoefs.py
<<< directory: tests, test files: 1
<<< tests/test_matcoefs.py
sfepy: left over: ['__builtins__', '_filename', '__file__', '__doc__',
'debug', '__name__', 'assert_', 'TestCommon']
>>> test instance prepared (1 test(s))
... using values: [2.0, 1.0, 1.5, 3.6000000000000001, 0.20000000000000001, 4.0]
... bulk lam -> True
... bulk mu -> True
... bulk young -> True
... bulk poisson -> True
... bulk p_wave -> True
... lam mu -> True
... lam young -> False
... correct: [2.0, 1.0, 1.5, 3.6000000000000001, 0.20000000000000001, 4.0]
... got: [0.20000000000000001, 1.0, -1.2, 3.6000000000000001,
0.19999999999999998, -1.3999999999999999]
... lam poisson -> True
... lam p_wave -> True
... mu young -> True
... mu poisson -> True
... mu p_wave -> True
... young poisson -> True
... young p_wave -> False
... correct: [2.0, 1.0, 1.5, 3.6000000000000001, 0.20000000000000001, 4.0]
... got: [0.80000000000000004, 0.99999999999999989, 1.5,
3.6000000000000001, 0.19999999999999998, 4.0]
... poisson p_wave -> True
--- test_tensors: failed!
!!! 1 test failed
1 test file(s) executed in 3.91 s, 1 failure(s) of 1 test(s)

It looks like the automatic modulus calculation is failing for a few cases.
I looked through the _construct_relations method of the ElasticConstants
class in sfepy/mechanics/matcoefs.py and the equations seem correct
according to [1]. Could this be an issue in sympy? I have sympy version
0.6.7-1.

[1] http://en.wikipedia.org/wiki/Elastic_moduli

Migrated from http://code.google.com/p/sfepy/issues/detail?id=123

earlier comments

robert.cimrman said, at 2010-04-26T06:51:17.000Z:

Yes, it's sympy version issue, but also fragile code. It uses sympy.solve(), which
seems to return the roots of a quadratic equation in an order which depends on version.

We should really just use a pre-generated table of all the expressions - I used this
approach as 1. I was lazy, so typing just one third of the relations seemed like a
clever idea, 2. the tables I found on the net were incomplete.

robert.cimrman said, at 2010-04-26T12:44:25.000Z:

It should be fixed now at the github repo. Let me know if it's ok.

r.

logan.sorenson said, at 2010-04-26T14:35:08.000Z:

It works for me. I see the problem now in using sympy, that it can return different
roots depending on the equation. Otherwise, I think it was a great idea!

Logan

logan.sorenson said, at 2010-04-26T14:54:29.000Z:

Closing since correct relationships are now in sfepy/mechanics/matcoefs.py.