Hi everyone, I am new to fenics and I wonder if you can kindly help me on the problem.

I am trying to solve a time-dependent PDE where in the rhs there are some time-dependent coefficients. For simplicity, lets say the equation is:

\frac{\partial u}{\partial t} = f(t)\frac{\partial u}{\partial x}

where f(t) is a time dependent scalar function. I start this project by using a constant first, f(t) = const and everything is fine. Now I am considering the actual time-dependent f(t), I wonder how to do this. In my opinion, I am thinking to change the expression at each iteration in solving the PDE (assuming f(t) = sin(\omega t)):

```
# here just ignore the actual variational formulation of the PDE, I just wonder how to update with t
f_t = Expression('sin(omega t) * x[0]' , omega=1, t=0))
...
for n in range(1, max_step):
t += dt
u_D.t = t
f_t.user_paremeters['t'] = t
# a and L are lhs and rhs of the PDE
solve(a == L, u)
```

I doubt whether this will update the f_t expression actually. I read from this link:

possibly I can use a self-defined UserExpression, but this is extremely slow on my machine. I wonder what is the simplest way to do this, since my expression is constant on the whole mesh but only dependent on time.

Thanks in advance for any help!