Hello Everyone,

I have an issue I have been struggling with for some time and I am unable to find a solution for it and I hope someone can help me with this.

The issue is that I have a time dependent problem that results in the following weak form (already discretised in time):

Find u^{n+1} \in V such that
a_1(u^{n+1}, nu) + a_2(u^{n+1}, nu; w^{n+1/2)) = b(u^{n}),    for all nu \in V

- a_1 is a time-constant bilinear form, meaning that I can assemble it once for all time steps
- a_2 is a time-dependent billinear form since it depends on w and this changes with the time step.

My first approach was to assemble a_1 (using trial and test functions) in order to obtain a matrix. I could do this once, before the time stepping loop. Then, inside the time loop, I assembled a_2. As I tried to add the two resulting matrices I got an error stating addition is not possible for matrices.

I then looked into LinearVariationalProblem and LinearVariationalSolver. My problem with this is that I am unable to understand if by defining the LinearVariational as the sum of a_1 and a_2, both will be kept constant or if only the a_2 part will be updated at each time step.

So my question is: is there a standard way of solving this problem? Or do I need to recompute the whole system matrix for every time step (which is what I am doing now)?

Thank you for your help.

Kind regards,

-artur palha