-
Notifications
You must be signed in to change notification settings - Fork 55
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
Direct solver for non-symmetric matrices #48
Comments
Note that currently, we use a full Newton method with iterative solvers. However, this may be prohibitively expensive with a direct solver as you have to keep inverting the matrix for every Newton iteration. You may follow a simpler update strategy such as the BFGS method that saves you a lot of computational effort. According to Gerard Ateshian, who co-leads FEBio, BFGS method allows you to retain the inverse for several time steps (~25-30, but of course depends on the problem) before recomputing it. The BFGS method (along with other interesting update strategies) is described very elegantly in the Nonlinear FEM book by Peter Wriggers. |
Thanks for the overview @vvedula22! Quick update: I was able to compile |
Awesome @mrp089 You may follow some examples in the amesos source if it helps. A separate pull request is a great idea. However, note that MUMPS would be ideal for svFSI as it not only handles MPI but also computes Schur complement for mixed problems (fluid, stokes, ustruct, FSI). The Amesos interface allows switching to MUMPS in a straightforward fashion but not all parameters (IPAR, RPAR) in mumps can be controlled through Amesos - this would still be a good starting point. We will also have to add BFGS method for direct solvers instead of the current full Newton approach. |
I got the first version of this working. Here's a quick summary: The current stiffness matrix Unfortunately, after some debugging, it turned out that none of the linear solvers in I spent most of the time implementing the conversion from the current structure to |
I'm slightly confused about how we apply Dirichlet boundary conditions (DBCs). I see they are passed to What confuses me is that if I set zero DBCs, those DOFs are zeroed in @vvedula22 What is your take on this? Thank you!! |
@mrp089 That's great! Have you checked if changing the matrix structure impacts other linear solvers and preconditioners in Trilinos (AztecOO, Ifpack, ML?). Please also try different problems (fluid, FSI, with resistance bcs etc.) to make sure these changes don't break other implementations. Regarding Dirichlet BCs, we apply them strongly. As we are solving for the increments in the solution, we zero-out the entire row corresponding to a Dirichlet node of the matrix but reset the diagonal entry to be equal to 1. The right-hand side residual vector is also zeroed-out for the corresponding row. As a result, the increment in the solution will be 0. Before entering the Newton iteration and calling the linear solver, we set Dirichlet BCs on that node to make sure the value is retained throughout the time step and its effect is included in the residue. The matrix is not singular but zeroing-out a row might pose issues for some direct solvers that depend on pivoting. Usually, reordering is performed to make sure these issues are resolved and don't affect the pivoting process, but I am not sure how this is done for different direct solvers. You may have to go into their manual. E.g., MUMPS offers a variety of options in the preprocessing stage to analyze the matrix structure. Might be useful. Alternately, you may apply the Dirichlet boundary condition as a forcing term integrated on that particular face. I believe You could also try applying Dirichlet BCs weakly and see if it helps. This is done using Nitsche's method and we already have it implemented for the fluid problem. However, this involves computing Cauchy stress using virtual displacements which is doable for fluids problems but may not be straightforward for nonlinear solid mechanics problems. |
Thanks for the overview @vvedula22! I think there are two different places in It's hard for me to understand what is happening in Lines 90 to 94 in 9c30521
The DBCs are passed to svFSI/Code/Source/svFSI/trilinos_linear_solver.cpp Lines 405 to 408 in 9c30521
We then put the DBCs in svFSI/Code/Source/svFSI/trilinos_linear_solver.cpp Lines 840 to 843 in 9c30521
This
So zero DBCs -> zero rows/columns in stiffness matrix. I think this went unnoticed for a while because My solution would be to introduce the same DBC-handling in |
Why do you have to modify SETBC.f? The left-hand side matrix is not assembled entirely in SETBC.f. And this may have disastrous implications in the svFSILS code for other different types of problems. Note that the DBCs are not handled in svFSI but in svFSILS. I'd recommend you changing the diagonal element to 1 after pre-multiplying and post-multiplying the matrix with the diagonal scaling. That should avoid any error with the direct solver and the matrix is no longer singular. |
I don't want to touch I discovered that I'm just confused how |
@mrp089 haha :) sorry, I was slow on catching up with GitHub issues - should have warned you earlier. I should have given you more information about DBCs but my other post was already becoming long.
`! Accounting for Dirichlet BC and inversing W = W^{-1/2}
! Pre-multipling K with W: K = W*K ! Multipling R with W: R = WR ! Now post-multipling K by W: K = K*W This step doesn't pose an issue with iterative solvers because iterative solvers mostly perform matrix-vector products and norms and don't do any 'division by diagonal' on an already preconditioned matrix. We do see some issues due to this step while using ILU or ILUT, IC or ICT, preconditioners in Trilinos as these preconditioners perform pivoting in the LU decomposition step. It will be interesting to see how resetting the diagonal element to 1 affects iterative solvers because these elements now add some finite contribution to the matrix-vector products, although their RHS counterparts are zeroed out. One of the advantages of treating DBCs the way it is done now is that it will allow us to treat other types of problems without explicitly applying any Dirichlet BC. E.g., when solving the mesh equation in FSI simulations where the entire solid domain is assumed to be fixed while the fluid mesh is deformed. Likewise, the presence of immersed bodies, edge rings formed at the inflow or outflow faces for CMM equation, etc. are handled easily this way. |
Part of #32. I'm running into an issue with the linear solver. (using quasi-static "time integration" #47). There are two time steps in this simple pressurized tube example:
My linear solver settings are
Here is the output of the G&R simulation:
The problem takes many linear iterations to converge in
step 1
and doesn't converge at all instep 2
, causing the nonlinear solver to diverge. (Yes, I use "strict" solver tolerances. However,step 2
also doesn't converge for relaxed tolerances.)The biconjugate gradient method
BICG
should be able to handle non-symmetric matrices, so that shouldn't be the problem. And maybe I can get it to work by playing around with preconditioners. But to get G&R running, I think a robust direct solver (that can handle non-symmetric matrices) might be easier for now. (PARDISO
inFEBio
performs great for this example.)@vvedula22's help is again much appreciated :-)
svFSI
that I didn't see?Trilinos
interface) would be somewhat easily doable?The text was updated successfully, but these errors were encountered: