Sounds good - I'll update the Primer accordingly.

a

On Wed, Jul 27, 2011 at 4:46 AM, Robert Cimrman <cimr...@ntc.zcu.cz> wrote:
Yes, it is.

Now you need to explicitly write the term evaluation mode other than 'eval' which is the default. So the fix is:

   strain = ev('de_cauchy_strain.2.Omega(u)', mode='el_avg')
   stress = ev('de_cauchy_stress.2.Omega(Asphalt.D, u)', mode='el_avg')

You can also add verbose=False to suppress output, if you wish.

The term evaluation modes are:

'eval' : evaluate the integral over a region, result has dimension like the quantity integrated

'el_avg' : element average - result is array of the quantity is averaged in each element of a region - this is the mode for postprocessing

'qp' : quantity interpolated into quadrature points of each element in a region

'weak' : assemble either the vector or matrix according to dw_mode argument.

Look at ProblemDefinition.evaluate() doc to see description of all the arguments.

Currently, not all terms support all the modes, one needs to look at the sources =:) But all dw_* terms support 'weak' mode, all 'dq_*' term support 'eval' mode, 'de_*' term support 'el_avg' mode etc. Actually most 'dq_*', 'de_*', 'di_*', 'd_' terms support 'eval', 'el_avg' and 'qp' modes.

The prefixes are due to history when the mode argument was not available, so now they are mostly redundant, but at least one as a notion what is the evaluation purpose of each term. They may disappear after some more term unification. easier_terms branch already resulted in a number of terms disappearing.

So, that's how things are now :)

r.


On 07/26/11 21:15, freevryheid wrote:
I'm guessing this is related:

Running https://github.com/sfepy/sfepy/wiki/py/its2D_2.py on the Primer
gives the following error:

[grassy@localhost sfepy]$ ./simple.py ~/Dropbox/TRB/SCB/its2D_1.py
sfepy: left over: ['verbose', '__builtins__', '__doc__', '__name__',
'filename', '_filename', 'youngpoisson_to_lame', 'young', '__package__',
'output_dir', 'poisson', '__file__']
sfepy: reading mesh (/home/grassy/Dropbox/TRB/SCB/its2D.mesh)...
sfepy: ...done in 0.00 s
sfepy: setting up domain edges...
sfepy: ...done in 0.01 s
sfepy: creating regions...
sfepy:     Top
sfepy:     Bottom
sfepy:     Omega
sfepy:     Left
sfepy: ...done in 0.01 s
sfepy: equation "balance_of_forces":
sfepy: dw_lin_elastic_iso.2.Omega(Asphalt.lam, Asphalt.mu, v, u ) = 0
sfepy: setting up dof connectivities...
sfepy: ...done in 0.00 s
sfepy: using solvers:
               nls: newton
                ls: ls
sfepy: updating variables...
sfepy: ...done
sfepy: matrix shape: (93, 93)
sfepy: assembling matrix graph...
sfepy: ...done in 0.00 s
sfepy: matrix structural nonzeros: 1063 (1.23e-01% fill)
sfepy: updating materials...
sfepy:     Asphalt
sfepy: ...done in 0.00 s
sfepy: nls: iter: 0, residual: 2.570602e+03 (rel: 1.000000e+00)
sfepy:   rezidual:    0.00 [s]
sfepy:      solve:    0.01 [s]
sfepy:     matrix:    0.00 [s]
sfepy: nls: iter: 1, residual: 2.083213e-12 (rel: 8.103989e-16)
[grassy@localhost sfepy]$ ./simple.py ~/Dropbox/TRB/SCB/its2D_2.py
sfepy: left over: ['verbose', 'asphalt', '__builtins__', '__file__',
'__name__', 'filename', '_filename', 'young', '__package__',
'stress_strain', 'stiffness_tensor_youngpoisson', 'output_dir', 'poisson',
'youngpoisson_to_lame', '__doc__']
sfepy: reading mesh (/home/grassy/Dropbox/TRB/SCB/its2D.mesh)...
sfepy: ...done in 0.01 s
sfepy: setting up domain edges...
sfepy: ...done in 0.00 s
sfepy: creating regions...
sfepy:     Top
sfepy:     Bottom
sfepy:     Omega
sfepy:     Left
sfepy: ...done in 0.00 s
sfepy: equation "balance_of_forces":
sfepy: dw_lin_elastic_iso.2.Omega(Asphalt.lam, Asphalt.mu, v, u ) = 0
sfepy: setting up dof connectivities...
sfepy: ...done in 0.00 s
sfepy: using solvers:
               nls: newton
                ls: ls
sfepy: updating variables...
sfepy: ...done
sfepy: matrix shape: (93, 93)
sfepy: assembling matrix graph...
sfepy: ...done in 0.00 s
sfepy: matrix structural nonzeros: 1063 (1.23e-01% fill)
sfepy: updating materials...
sfepy:     Asphalt
sfepy: ...done in 0.00 s
sfepy: nls: iter: 0, residual: 2.570602e+03 (rel: 1.000000e+00)
sfepy:   rezidual:    0.00 [s]
sfepy:      solve:    0.00 [s]
sfepy:     matrix:    0.00 [s]
sfepy: nls: iter: 1, residual: 2.083213e-12 (rel: 8.103989e-16)
sfepy: equation "tmp":
sfepy: de_cauchy_strain.2.Omega(u)
sfepy: updating materials...
sfepy: ...done in 0.00 s
sfepy: equation "tmp":
sfepy: de_cauchy_stress.2.Omega(Asphalt.D, u)
sfepy: updating materials...
sfepy:     Asphalt
sfepy: ...done in 0.00 s
Traceback (most recent call last):
  File "./simple.py", line 125, in<module>
    main()
  File "./simple.py", line 122, in main
    app()
  File "/home/grassy/sfepy/sfepy/applications/application.py", line 29, in
call_basic
    return self.call( **kwargs )
  File "/home/grassy/sfepy/sfepy/applications/simple_app.py", line 112, in
call
    pre_process_hook=self.pre_process_hook)
  File "/home/grassy/sfepy/sfepy/solvers/generic.py", line 224, in
solve_direct
    nls_status=nls_status)
  File "/home/grassy/sfepy/sfepy/solvers/generic.py", line 169, in
solve_stationary_op
    file_per_var=None)
  File "/home/grassy/sfepy/sfepy/fem/problemDef.py", line 661, in save_state
    float_format=self.float_format, **kwargs)
  File "/home/grassy/sfepy/sfepy/fem/mesh.py", line 642, in write
    io.write( filename, aux_mesh, out, **kwargs )
  File "/home/grassy/sfepy/sfepy/fem/meshio.py", line 786, in write
    ne, aux, nr, nc = val.data.shape
ValueError: need more than 1 value to unpack



--
You received this message because you are subscribed to the Google Groups "sfepy-devel" group.
To post to this group, send email to sfepy...@googlegroups.com.
To unsubscribe from this group, send email to sfepy-devel+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sfepy-devel?hl=en.




--
Andre