I am attaching the *.geo file. 

On Thursday, March 31, 2016 at 8:43:02 AM UTC-5, Robert Cimrman wrote:
I cannot run the script without the mesh .geo file, but anyway, a few remarks:

- the press_load Function instance is not used anywhere, do something like:

    functions = Functions([press_load])
    ...
    pb = Problem('elasticity', equations=eqs, nls=nls, ls=ls, functions=functions)

    - then the function will be available for equations etc.
(Problem.time_update() also can take 'functions' argument.)

- line 338: use get_mat instead of get_mat1

Could you send also the geometry file, so that I could run it?

r.

On 03/31/2016 03:15 PM, Adolfo Rodriguez wrote:
> Robert,
>
> My script goes attached. The function is specified in line 262, defined in
> line 41 and used in term t4 in line 302.
>
> Thanks!
>
>
>
> On Thursday, March 31, 2016 at 1:46:43 AM UTC-5, Robert Cimrman wrote:
>>
>> Hi Adolfo,
>>
>> On 03/31/2016 02:02 AM, Adolfo Rodriguez wrote:
>>> I am trying to use a "parameter" field variable in interactive mode.
>> What I
>>> am trying to do is very similar to the thermo-elaticity example, but for
>>> some reason I cannot make it work in interactive mode.
>>
>> Note that you can set data of a variable directly in the interactive mode,
>> using Variable.set_data().
>>
>>> In the thermo-elasticity example the parameter field variable is defined
>> as
>>> follows
>>>
>>> def get_temperature_load(ts, coors, region=None):
>>>       """    Temperature load depends on the `x` coordinate.    """
>>>       x = coors[:, 0]
>>>       return (x - x.min())**2 - T0
>>>
>>>
>>> fields = {
>>>       'displacement': ('real', 3, 'Omega', 1),
>>>       'temperature': ('real', 1, 'Omega', 1),}
>>>
>>>
>>> variables = {
>>>       'u' : ('unknown field', 'displacement', 0),
>>>       'v' : ('test field', 'displacement', 'u'),
>>>       'T' : ('parameter field', 'temperature',
>>>              {'setter' : 'get_temperature_load'}),}
>>>
>>>
>>> equations = {
>>>       'balance_of_forces' :
>>>       """dw_lin_elastic.2.Omega( solid.D, v, u )     - dw_biot.2.Omega(
>> solid.alpha, v, T )     = 0""",}
>>>
>>>
>>> In interactive mode this is what I am doing the following:
>>>
>>> field_p = Field.from_args('fp', nm.float64, 1, omega,
>>>
>>>                                  approx_order=order_p)
>>>
>>>
>>> press_load = Function('press_load',get_pressure_load)
>>>
>>> press = FieldVariable('pressure','parameter',field_p,special={'setter'
>>> :press_load},
>>>
>>>                             primary_var_name='(set-to-None)')
>>>
>>>
>>> And the corresponding term:
>>>
>>>
>>> t20 = Term.new('dw_laplace(matalpha.k, q, press)',
>>>
>>>                      integral, omega, matalpha=matalpha, q=q,
>> press=press)
>>>
>>>
>>> But this does not work.
>>
>> Could you send the code that does not work, that could be run and tried?
>> There
>> might be a bug because I have never used a setter function in the
>> interactive
>> mode - I use set_data() directly instead - see also
>> FieldVariable.time_update().
>>
>> r.
>>
>