thegooglecodearchive / sfepy

Automatically exported from code.google.com/p/sfepy
0 stars 0 forks source link

Failure of test_matcoefs.py #123

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

Original issue reported on code.google.com by logan.so...@gmail.com on 23 Apr 2010 at 6:54

GoogleCodeExporter commented 9 years ago
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.

Original comment by robert.c...@gmail.com on 26 Apr 2010 at 6:51

GoogleCodeExporter commented 9 years ago
It should be fixed now at the github repo. Let me know if it's ok.

r.

Original comment by robert.c...@gmail.com on 26 Apr 2010 at 12:44

GoogleCodeExporter commented 9 years ago
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

Original comment by logan.so...@gmail.com on 26 Apr 2010 at 2:35

GoogleCodeExporter commented 9 years ago
Closing since correct relationships are now in sfepy/mechanics/matcoefs.py.

Original comment by logan.so...@gmail.com on 26 Apr 2010 at 2:54

GoogleCodeExporter commented 9 years ago
Migrated to http://github.com/sfepy/sfepy/issues/125

Original comment by robert.c...@gmail.com on 30 Jan 2012 at 10:26