-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue in warm start. #1182
Fix issue in warm start. #1182
Conversation
It looks like our documentation of this "warm start" part of the code isn't documented very well in the sourcefiles or the theory reference, so I'll try to write down my understanding of what's going on here for future reference. We assume that at some point in the past, we were given Now, we want to solve for So, we need a better initial guess. This "warm start" generates a guess by linear extrapolation from the previous known solution: Move all the known terms to the rhs and solve for This assumed that the old residual was converged ( is almost certainly more stable, since there were small errors which were previously being accumulated over time (although for reasonable solver tolerances, this was likely not a noticeable issue at the timescales we've been considering). However, if the initial conditions were not close to equilibrium then the error would be significant. |
Yes, this looks correct. I'll add that an additional property of the warm start I'd like to see is: For linear problems, the warm start should solve the system exactly. In the case of a single static linear mechanics solve, there is no previous solution, so the initial residual will certainly be significant. |
For the case of dynamics, we also should probably be including the inertia/mass term. Similarly for contact, contact stiffness from the previously converged (stable) solution should be included in the warm start calculation, |
I don't think we are computing dr/dt * dt? So, this pr might be wrong still for time-varying body/Neumann loads. r(u^n, p^n, t+dt) instead of r(u^n, p^n, t) + dr/dt * dt. Similarly, we could change to |
That sounds like a reasonable expectation, although it potentially conflicts slightly with Kenny's "always do a nonlinear solve" request.
It's also worth noting that for the case of dynamics, there is already a natural choice of predictor from the time integrator itself.
We could try that too. The reason for linearizing at the previous step is twofold:
We're not right now, but we should be in general (I'm okay with omitting this term for now). |
The Jacobian for sure needs to always be evaluated at u^n, p^n, t^n (and I agree we should be using a previous one, if it exists). The residual has some more flexibility without strictly hurting the order of accuracy of the warm start, e.g., evaluating at u^n, p^{n+1}, t^{n+1}. |
|
A thought from yesterday: the correctness issue fixed in this PR was related to the assumption that the initial configuration was in equilibrium. This was a bad assumption because it puts the burden on the user to figure that out (and even worse, it wasn't even documented). There is a related assumption for the dynamics problem, that the initial velocity values should be consistent with the time rate of the prescribed essential displacements. Is there something similar we should do to handle that case as well (not necessarily in this PR)? Maybe that case is easier and the initial velocities are just overwritten by du/dt @ t == 0 |
25423c1
to
95f486e
Compare
I'm not sure how bad the velocity and displacements being out of sync is. I'm guessing the velocities are essentially ignored on the dirichlet nodes, but maybe not. I suppose a material model with viscosity might be looking at the wrong velocity in cases like that? Regarding what to do for dynamics, I think we need to sketch out the math a bit more. I think the warm start may still be appropriate to use there, as its really just a linear extrapolation, which may still be valid for dynamics. But I need to write it out. |
…ads, the warm start was solving the wrong linear system to start. Then we were solving another linear system again for no reason in the nonlinear solver after, greatly increasing costs in some cases.
95f486e
to
ef830f3
Compare
For linear problems with body or traction loads, the warm start was not including the initial residual contributions. Then we were solving the linear system again with the traction loads appropriately included in the nonlinear solver after. This was doubling the cost of some solves.
This PR also simplifies the warm start logic by assuming its only the displacement boundary conditions that may lead to element inversion. Parameter changes are simply directly included in the new residual evaluation. Always the previous stiffness is used.
An option to disable the warm start was added. This is recommended for linear problems, and perhaps even for problems with relatively small deformations.