-- I suspect you used the label 'a' to define a Function, but then reused it to define your bilinear form. This would explain the error you allude to. On 19 March 2017 at 13:36, Andrew McRae <A.T.T.McRae@bath.ac.uk> wrote:
I'm not sure what error you're seeing (it would help if you'd posted a full stack trace).
However, I think the normal way to do this is to declare the expression separately:
a_expr = Expression(["0.5*F0*cos(omega*t)*x[1]", "-0.5*F0*cos(omega*t)*x[0]"], F0=F0, omega=omega, t=t) a.interpolate(a_expr)
Inside the time loop, you then update any quantities that you need, and reinterpolate:
a_expr.t = t (or maybe a_expr.t.assign(t), I've forgotten...) a.interpolate(a_expr)
This is better than creating a new Expression object each time you go around the loop, which is what it looks like you are doing at the moment.
On 19 March 2017 at 13:27, William Booker <scwb@leeds.ac.uk> wrote:
Dear Firedrakers,
I'm trying to update a vector function in my time loop
a.interpolate(Expression(["0.5*F0*cos(omega*t)*x[1]", "-0.5*F0*cos(omega*t)*x[0]"], F0=F0, omega=omega, t=t))
but if I use assign or interpolate, I get told the form does not have the respective property. How should I go about making this work, such that it'll change the value of a in my solver?
Thanks
will