recompute pressure scaling for every Stokes solve #5117
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the pressure scaling factor is only computed once per timestep. We have seen in a model that this can lead to convergence problems, if the viscosity depends strongly on the solution and our initial guess for viscosity is bad. Recomputing for every nonlinear iteration makes more sense (it is not very expensive and on average improves convergence of the linear solver).
This is more accurate for two reasons:
I have moved the computation into the assembly of the Stokes system. There was a comment claiming that this is not possible, because constraints may depend on the pressure scaling, but after looking through the code I think this comment was outdated. The pressure scaling does not seem to be used for any constraints (it is only used in assembly functions, even for the melt solver).
Please do not merge this yet, this change will affect a lot of tests and I want to take a look at the changes first.