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.
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.
Any thoughts?
Thanks