update: boundary traces, mayavi2 based visualization

Hi all,
let me introduce two new things that sfepy can do now:
- boundary traces (see input/subdomains.py for full example)
Example: we wish to solve a Poisson problem (LaTeX notation), where a domain is divided into two subdomains 1, 2, and a condition is specified on the interface:
\Delta p_1 = g_1 in Omega_1 \Delta p_2 = g_2 in Omega_2 p_1 = p_2 + c on \Gamma_{12}
For this we define two fields (note the short syntax, added by Vlada recently):
fields = { 'pressure1' : ((1,1), 'real', 'Omega1', {'Omega1' : '2_4_Q1'}), 'pressure2' : ((1,1), 'real', 'Omega2', {'Omega2' : '2_4_Q1'}), }
and two sets of variables (q1, p1), (q2, p2):
variables = { 'p1' : ('unknown field', 'pressure1', 0), 'q1' : ('test field', 'pressure1', 'p1'), 'p2' : ('unknown field', 'pressure2', 1), 'q2' : ('test field', 'pressure2', 'p2'), }
Then the syntax of equations was enriched by the 'tr' keyword to denote a trace:
equations = { 'eq_1' : """dw_laplace.ivol.Omega1( one1.one, q1, p1 ) + dw_jump.isurf.Gamma12_1( jump.val, q1, p1, tr(p2) ) = 0""", 'eq_2' : """dw_laplace.ivol.Omega2( one2.one, q2, p2 ) + dw_jump.isurf.Gamma12_2( jump.val, q2, tr(p1), p2 ) = 0""", } Gamma12_1 and Gamma12_2 are both the same interface region, but Gamma12_1 has Omega1 as its "inside", Gamma12_2 has Omega2.
- mayavi2 based visualization
A new top-level script 'postproc.py' can be used to quickly view the results. Run the tests, then call it with the test results as arguments (assuming the tests passed):
$ ./runTests.py $ ./postproc.py -h $ ./postproc.py output-tests/test_poisson.vtk $ ./postproc.py output-tests/test_navier_stokes.vtk $ ./postproc.py output-tests/test_lcbc_2d.vtk $ ./postproc.py output-tests/test_kostka.vtk --3d
To try it out, clone the sfepy git repository as described at [1]. You also need ETS (mayavi2) [2].
Bug reports welcome! r.
[1] http://code.google.com/p/sfepy/wiki/Downloads?tm=2 [2] http://code.enthought.com/projects/

On Tue, 2009-04-14 at 10:11 +0200, Robert Cimrman wrote:
Hi all,
To try it out, clone the sfepy git repository as described at [1]. You also need ETS (mayavi2) [2].
Bug reports welcome! r. Hi Robert, I just cloned a new copy. Looks like some of the mesh test files are missing (abaqus ones). Also cube.bdf is misspelled cude.bdf. After correcting for these, I am getting one failure from the tests:
tests/test_input_biot_npbc.py --- test_input: failed!
I have ubuntu 8.04 64 bit, and have installed mayavi and mayavi2. They both work, but ./postproc.py output-tests/test_poisson.vtk does not: ./postproc.py output-tests/test_poisson.vtk Traceback (most recent call last): File "./postproc.py", line 38, in <module> main() File "./postproc.py", line 35, in main view(is_3d=options.is_3d, rel_scaling=options.rel_scaling) File "/home/osman/SFE/sfepy/sfepy/postprocess/viewer.py", line 61, in __call__ mlab.options.offscreen = self.offscreen enthought.traits.trait_errors.TraitError: Cannot set the undefined 'offscreen' attribute of a 'MayaviConfig' object.
br -osman

Hi osman,
thanks for the report!
osman wrote:
On Tue, 2009-04-14 at 10:11 +0200, Robert Cimrman wrote:
Hi all,
To try it out, clone the sfepy git repository as described at [1]. You also need ETS (mayavi2) [2].
Bug reports welcome! r. Hi Robert, I just cloned a new copy. Looks like some of the mesh test files are missing (abaqus ones). Also cube.bdf is misspelled cude.bdf. After correcting for these, I am getting one failure from the tests:
Yes, this is known, but I am waiting for new (smaller) abaqus meshes to include into the repository. It should be ok for the next release (to be soon).
tests/test_input_biot_npbc.py --- test_input: failed!
This is imho related to your scipy version. I have used .find() sparse matrix method, which had been apparently added only recently. To verify this, try
./runTests.py tests/test_input_biot_npbc.py --debug
I have ubuntu 8.04 64 bit, and have installed mayavi and mayavi2. They both work, but ./postproc.py output-tests/test_poisson.vtk does not: ./postproc.py output-tests/test_poisson.vtk Traceback (most recent call last): File "./postproc.py", line 38, in <module> main() File "./postproc.py", line 35, in main view(is_3d=options.is_3d, rel_scaling=options.rel_scaling) File "/home/osman/SFE/sfepy/sfepy/postprocess/viewer.py", line 61, in __call__ mlab.options.offscreen = self.offscreen enthought.traits.trait_errors.TraitError: Cannot set the undefined 'offscreen' attribute of a 'MayaviConfig' object.
Does it work when you comment that line (61) out? It is a feature that is in ets-3.1.0 (mayavi2 3.1.0).
Thanks! r.

On Wed, 2009-04-15 at 09:36 +0200, Robert Cimrman wrote:
Hi osman,
thanks for the report!
osman wrote:
On Tue, 2009-04-14 at 10:11 +0200, Robert Cimrman wrote:
Hi all,
To try it out, clone the sfepy git repository as described at [1]. You also need ETS (mayavi2) [2].
Bug reports welcome! r. Hi Robert, I just cloned a new copy. Looks like some of the mesh test files are missing (abaqus ones). Also cube.bdf is misspelled cude.bdf. After correcting for these, I am getting one failure from the tests:
Yes, this is known, but I am waiting for new (smaller) abaqus meshes to include into the repository. It should be ok for the next release (to be soon).
tests/test_input_biot_npbc.py --- test_input: failed!
This is imho related to your scipy version. I have used .find() sparse matrix method, which had been apparently added only recently. To verify this, try
./runTests.py tests/test_input_biot_npbc.py --debug
stargate:/home/osman/SFE/sfepy-bash-> ./runTests.py tests/test_input_biot_npbc.py --debug <<< tests/test_input_biot_npbc.py sfepy: left over: ['__builtins__', '_filename', '__file__', 'TestInput', 'input_name', '__name__', 'output_name', '__doc__'] sfepy: left over: ['dim', '_filename', 'filename', 'geom', 'output_dir']
test instance prepared (1 test(s)) ... solving input/biot_npbc.py... sfepy: reading mesh (database/simple.mesh)... sfepy: ...done in 0.01 s sfepy: setting up domain edges... sfepy: ...done in 0.02 s sfepy: setting up domain faces... sfepy: ...done in 0.01 s sfepy: creating regions... sfepy: leaf Omega region_Omega__2 sfepy: leaf Rigid region_Rigid__0 sfepy: leaf Inlet region_Inlet__3 sfepy: leaf Outlet region_Outlet__4 sfepy: op Walls region_Walls__1 sfepy: ...done in 0.10 s sfepy: equation "eq_2": sfepy: dw_biot.i1.Omega( m.alpha, u, q ) + dw_diffusion.i1.Omega( m.K, q, p ) = 0 sfepy: equation "eq_1": sfepy: dw_lin_elastic.i1.Omega( m.D, v, u ) - dw_biot.i1.Omega( m.alpha, v, p ) = 0 sfepy: setting up dof connectivities... sfepy: ...done in 0.00 s sfepy: describing geometries... sfepy: ...done in 0.01 s sfepy: using solvers: nls: newton ls: ls u no_penetration Walls (196,) <type 'exceptions.TypeError'> Traceback (most recent call last): File "./runTests.py", line 219, in <module> main() File "./runTests.py", line 207, in main stats = run_test( test_filename, options ) File "./runTests.py", line 111, in run_test ok, n_fail, n_total = test.run( options.debug ) File "/home/osman/SFE/sfepy/sfepy/base/testing.py", line 38, in run ret = test_method() File "tests/testsBasic.py", line 37, in test_input dpb, vec_dp, data = solve_stationary( self.test_conf, nls_status = status ) File "/home/osman/SFE/sfepy/sfepy/solvers/generic.py", line 57, in solve_stationary problem.time_update( None ) File "/home/osman/SFE/sfepy/sfepy/fem/problemDef.py", line 279, in time_update create_matrix ) File "/home/osman/SFE/sfepy/sfepy/fem/problemDef.py", line 230, in update_bc self.variables.setup_lcbc_operators( conf_lcbc, self.domain.regions ) File "/home/osman/SFE/sfepy/sfepy/fem/variables.py", line 443, in setup_lcbc_operators lcbc_op = var.create_lcbc_operators( bcs, regions, offset ) File "/home/osman/SFE/sfepy/sfepy/fem/variables.py", line 1390, in create_lcbc_operators n_dof, op_lc = create_lcbc_no_penetration( normals ) File "/home/osman/SFE/sfepy/sfepy/fem/variables.py", line 187, in create_lcbc_no_penetration op = sp.coo_matrix( (data, (rows, cols)), shape = (n_nod * dim, n_np_dof) ) TypeError: __init__() got an unexpected keyword argument 'shape' stargate:/home/osman/SFE/sfepy-bash->
I have ubuntu 8.04 64 bit, and have installed mayavi and mayavi2. They both work, but ./postproc.py output-tests/test_poisson.vtk does not: ./postproc.py output-tests/test_poisson.vtk Traceback (most recent call last): File "./postproc.py", line 38, in <module> main() File "./postproc.py", line 35, in main view(is_3d=options.is_3d, rel_scaling=options.rel_scaling) File "/home/osman/SFE/sfepy/sfepy/postprocess/viewer.py", line 61, in __call__ mlab.options.offscreen = self.offscreen enthought.traits.trait_errors.TraitError: Cannot set the undefined 'offscreen' attribute of a 'MayaviConfig' object.
Does it work when you comment that line (61) out? It is a feature that is in ets-3.1.0 (mayavi2 3.1.0).
No I had to comment out the next line then it failed again this time:
AttributeError: 'module' object has no attribute 'open' Now cannot even open the file!! So I quit.

osman wrote:
On Wed, 2009-04-15 at 09:36 +0200, Robert Cimrman wrote:
Hi osman,
thanks for the report!
osman wrote:
On Tue, 2009-04-14 at 10:11 +0200, Robert Cimrman wrote:
Hi all,
To try it out, clone the sfepy git repository as described at [1]. You also need ETS (mayavi2) [2].
Bug reports welcome! r. Hi Robert, I just cloned a new copy. Looks like some of the mesh test files are missing (abaqus ones). Also cube.bdf is misspelled cude.bdf. After correcting for these, I am getting one failure from the tests: Yes, this is known, but I am waiting for new (smaller) abaqus meshes to include into the repository. It should be ok for the next release (to be soon).
tests/test_input_biot_npbc.py --- test_input: failed! This is imho related to your scipy version. I have used .find() sparse matrix method, which had been apparently added only recently. To verify this, try
./runTests.py tests/test_input_biot_npbc.py --debug
stargate:/home/osman/SFE/sfepy-bash-> ./runTests.py tests/test_input_biot_npbc.py --debug <<< tests/test_input_biot_npbc.py sfepy: left over: ['__builtins__', '_filename', '__file__', 'TestInput', 'input_name', '__name__', 'output_name', '__doc__'] sfepy: left over: ['dim', '_filename', 'filename', 'geom', 'output_dir']
test instance prepared (1 test(s)) ... solving input/biot_npbc.py... sfepy: reading mesh (database/simple.mesh)... sfepy: ...done in 0.01 s sfepy: setting up domain edges... sfepy: ...done in 0.02 s sfepy: setting up domain faces... sfepy: ...done in 0.01 s sfepy: creating regions... sfepy: leaf Omega region_Omega__2 sfepy: leaf Rigid region_Rigid__0 sfepy: leaf Inlet region_Inlet__3 sfepy: leaf Outlet region_Outlet__4 sfepy: op Walls region_Walls__1 sfepy: ...done in 0.10 s sfepy: equation "eq_2": sfepy: dw_biot.i1.Omega( m.alpha, u, q ) + dw_diffusion.i1.Omega( m.K, q, p ) = 0 sfepy: equation "eq_1": sfepy: dw_lin_elastic.i1.Omega( m.D, v, u ) - dw_biot.i1.Omega( m.alpha, v, p ) = 0 sfepy: setting up dof connectivities... sfepy: ...done in 0.00 s sfepy: describing geometries... sfepy: ...done in 0.01 s sfepy: using solvers: nls: newton ls: ls u no_penetration Walls (196,) <type 'exceptions.TypeError'> Traceback (most recent call last): File "./runTests.py", line 219, in <module> main() File "./runTests.py", line 207, in main stats = run_test( test_filename, options ) File "./runTests.py", line 111, in run_test ok, n_fail, n_total = test.run( options.debug ) File "/home/osman/SFE/sfepy/sfepy/base/testing.py", line 38, in run ret = test_method() File "tests/testsBasic.py", line 37, in test_input dpb, vec_dp, data = solve_stationary( self.test_conf, nls_status = status ) File "/home/osman/SFE/sfepy/sfepy/solvers/generic.py", line 57, in solve_stationary problem.time_update( None ) File "/home/osman/SFE/sfepy/sfepy/fem/problemDef.py", line 279, in time_update create_matrix ) File "/home/osman/SFE/sfepy/sfepy/fem/problemDef.py", line 230, in update_bc self.variables.setup_lcbc_operators( conf_lcbc, self.domain.regions ) File "/home/osman/SFE/sfepy/sfepy/fem/variables.py", line 443, in setup_lcbc_operators lcbc_op = var.create_lcbc_operators( bcs, regions, offset ) File "/home/osman/SFE/sfepy/sfepy/fem/variables.py", line 1390, in create_lcbc_operators n_dof, op_lc = create_lcbc_no_penetration( normals ) File "/home/osman/SFE/sfepy/sfepy/fem/variables.py", line 187, in create_lcbc_no_penetration op = sp.coo_matrix( (data, (rows, cols)), shape = (n_nod * dim, n_np_dof) ) TypeError: __init__() got an unexpected keyword argument 'shape' stargate:/home/osman/SFE/sfepy-bash->
I see, according to [1] the 'shape' argument was 'dims' (scipy 0.6.0), but in recent (SVN) scipy, it was changed so that it is compatible with numpy arrays (dense matrices), where the keyword shape is used consistently. I suggest you to try scipy 0.7.0, which is the last official release, but only if you need the special no-prenetration or rigid body conditions. Otherwise you can just ignore the test :)
[1] http://www.scipy.org/doc/api_docs/SciPy.sparse.sparse.coo_matrix.html
I have ubuntu 8.04 64 bit, and have installed mayavi and mayavi2. They both work, but ./postproc.py output-tests/test_poisson.vtk does not: ./postproc.py output-tests/test_poisson.vtk Traceback (most recent call last): File "./postproc.py", line 38, in <module> main() File "./postproc.py", line 35, in main view(is_3d=options.is_3d, rel_scaling=options.rel_scaling) File "/home/osman/SFE/sfepy/sfepy/postprocess/viewer.py", line 61, in __call__ mlab.options.offscreen = self.offscreen enthought.traits.trait_errors.TraitError: Cannot set the undefined 'offscreen' attribute of a 'MayaviConfig' object. Does it work when you comment that line (61) out? It is a feature that is in ets-3.1.0 (mayavi2 3.1.0).
No I had to comment out the next line then it failed again this time:
AttributeError: 'module' object has no attribute 'open' Now cannot even open the file!! So I quit.
Well, then I cannot really help, because mayavi2 3.1.0 is the first (and only) working version I can install. Can you try the version 0.3.1?
Or, you said you have both mayavi and mayavi2 - could it be that there are some conflicts in what is being imported?
sorry for the troubles, thanks for the testing! r.
participants (2)
-
osman
-
Robert Cimrman