Yep that was it.
I feel silly now.
Thanks
Will
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.a.interpolate(a_expr)a_expr.t = t (or maybe a_expr.t.assign(t), I've forgotten...)a_expr = Expression(["0.5*F0*cos(omega*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:
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:
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