Hi Lukas,
the main issue is the fact that you are dealing with a time-dependent problem, such that the different steps (building the right-hand side, setting the boundary condition and homogenising the boundary condition) needs to be done in every time step and in the correct order:
First, the right hand side needs the solution from the last time-step, so the first thing is to compute the new right-hand side for that particular time-step:
Code:
res.data = m.mat * gfu.vec + dt * f.vec
Then you can modify the solution, i.e. set the in-homogeneous Dirichlet condition for the homogenisation:
Code:
gfu.Set(283.15, BND)
with this you can then homogenise the boundary condition with respect to the system you solve in that time-step (the system is mstar, rather than a) and solve the requires system
Code:
res.data += -mstar * gfu.vec
gfu.vec.data += invmstar * res
I hope this helps.
Best wishes,
Henry