I calculate a solution to two different (sets of coupled) equations. I know that the solution to the second equation is close to the solution of the first equation plus some given, analytical function. What I do is I first compute the solution to the first equation, i.e.:
solution = Function(solutionspace)
solve(F0 == 0, solution, [bc1,bc2,...])
After this, I solve the second equation. Since the solution to the first equation is now stored in the solution variable, using it as an initial guess can be done by just solving the second equation to the same solution variable, i.e.:
solve(F == 0, solution, [bc1,bc2,...])
What I would like to do is to add a constant function to the solution between these two steps. I tried:
solution.sub(0).assign(solution.sub(0) + f)
where f is a given function defined with Expression(...). Similarly for other three subcomponents of the solution. This did not work. What is the correct way to do this?