Hi!
On 05/15/2013 04:46 PM, dj.a...@gmx.de wrote:
Dear sfepy group,
I defined a parameter field S and tried to use a function to assign certain values to the parameter depending of the coordinates. Like this (simplified):
variable_7 = { 'name' : 'S', 'kind' : 'parameter field', 'field' : 'pressure', 'like' : None, 'special' : {'setter' : 'Def_Sigma'}, }
def Def_Sigma(ts,coors,region=None): x = coors[:,0] y = coors[:,1] val = x*y*10 return val
The field is:
field_1 = { 'name' : 'pressure', 'dtype' : nm.float64, 'shape' : (1,), 'region' : 'Omega', 'approx_order' : '1', }
When I try to calculate the gradient of the parameter S field in a post-process-hook I always get an error:
def post_process(out, pb, state, extend=False): from sfepy.base.base import Struct
div = pb.evaluate('ev_grad.i2.Omega(S)',mode='el_avg') out['Grad_S'] = Struct(name='output_data', mode='cell', data=div,
dofs=None)
return out
The error is: Argument S not found.
Is the variable S used in the equations (like, e.g. in [1])? If not, it is not created/set by the solver at all. In that case, you would have to create it manually in the post_process() function.
Anyway, it would help if you send a complete file (preferably using one of the sfepy meshes), so that I could run it.
r.
[1] http://sfepy.org/doc-devel/examples/thermo_elasticity/thermo_elasticity.html