CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Good Starting Guesses for Faster Iterative Solution of Unsteady Simulations (http://www.cfd-online.com/Forums/main/121400-good-starting-guesses-faster-iterative-solution-unsteady-simulations.html)

lordvon July 27, 2013 14:28

Good Starting Guesses for Faster Iterative Solution of Unsteady Simulations
 
Hello,

I am writing an unsteady solver for the incompressible Navier-Stokes equations using the exact fractional step method (EFS) (by J.B. Perot).

I am currently using Conjugate Gradients (CG) to solve for the linear system at each time step. I would like to discuss how the starting guess used for solving the linear system could be manipulated for efficiency. Can we somehow use information from previous time steps to formulate our starting guesses for solving the current time step that result in faster convergence (lower required iterations)?

Thanks for your time and input.

P.S. In case you were curious, I am using CG because in my implementation because the contents of the system matrix is determinable from the grid, and constant throughout the whole simulation. So, this allows for a matrix-free implementation. I think CG also lends itself to effective GPU implementation. Comments on these thoughts are welcome as well! Note that I am trying to make an unsteady (time-accurate) solver for High-Reynolds-Number flow, so small time steps (compared to implicit methods) will probably be desired. So, more expensive solution methods that allow for larger time steps may not necessarily be more desirable (depending on the trade-off, of course).

FMDenaro July 27, 2013 15:38

For an iterative algorithm in unsteady solvers is quite common to use the solution of the previous time step as starting value

lordvon July 27, 2013 16:17

Yes, I forgot to mention I am doing that but I dont get any difference compared to when I start with a zero vector for a lid-driven cavity flow. I was wondering if there are any more sophisticated techniques.

FMDenaro July 27, 2013 17:02

Quote:

Originally Posted by lordvon (Post 442369)
Yes, I forgot to mention I am doing that but I dont get any difference compared to when I start with a zero vector for a lid-driven cavity flow. I was wondering if there are any more sophisticated techniques.


the CG method is somehow much more independent from the starting solution than methods like Jacobi, S.O.R., ... see the paragraph in the book of Peric & Ferziger :)

rmh26 July 29, 2013 19:46

Are you using a preconditioner? That will improve your performance much more than the initial guess. I am using a multigrid preconditioner and having a good initial guess helps a little but is nothing compared to the effect of the preconditioner.

lordvon July 29, 2013 21:12

Can you tell me how it affects the memory requirements and regularity of the system matrix?

Even if a really successful preconditioner reduces iterations by a factor of lets say 2, it may not be faster in implementation for GPUs due to memory bandwidth, coalescing, latency, etc. considerations, which have order-of-magnitude effects on speed.

rmh26 July 30, 2013 11:58

A multigrid preconditioner will reduce the number of iterations by at least an order of magnitude. Not familiar with the exact fractional step method, but I am using a fraction step method and it involves the solution of an elliptic equation for the pressure which is the time limiting step. I run everything on the CPU but multigrid methods can be ported to GPU's. The are highly parallel algorithms so I don't think that will be an issue. The extra memory required would likely be close to half of what you are using for the CG part of the solution. You could try doing a simple version of multigrid like a two level method to get an idea of how it will work without investing too much time on it

lordvon July 31, 2013 01:36

I thought MG would be too much of a time investment, but at your suggestion and explanation of the magnitude of the rewards, I will put it on my list of things to try to implement. I have read that MG-preconditioned CG works better than MG -- what do you think?

What kind of matrix storage do you use (CSR, etc.)? Is the matrix still symmetric?

rmh26 July 31, 2013 15:53

I would try using a MGCG over just a plain MG method. If you have discontinous coefficients or sharp forcing terms then plain MG can sometimes fail to converge.

I'm not sure if the resulting matrix is still symmetric, however I know people have used MG as a CG preconditioner. I use it with BiCGstab so I don't have to worry about symmetry or positive definitness. As for the storage scheme I'm using a regular cartesian grid so I can get away with storing everything in 2-d arrays.



Mudpack is an open source multigrid package but it is only for CPUs.
http://www2.cisl.ucar.edu/resources/legacy/mudpack

A quick search turned up this open source code for MG on a GPU (CUDA).
https://developer.nvidia.com/cusp

arjun July 31, 2013 16:26

Quote:

Originally Posted by rmh26 (Post 442872)
A multigrid preconditioner will reduce the number of iterations by at least an order of magnitude. Not familiar with the exact fractional step method, but I am using a fraction step method and it involves the solution of an elliptic equation for the pressure which is the time limiting step. I run everything on the CPU but multigrid methods can be ported to GPU's. The are highly parallel algorithms so I don't think that will be an issue. The extra memory required would likely be close to half of what you are using for the CG part of the solution. You could try doing a simple version of multigrid like a two level method to get an idea of how it will work without investing too much time on it

I am really confused, the elliptic equation for pressure is typically solved with the help of multigrid so why multigrid at one place is very efficient and at another place is the reason for inefficiency?

rmh26 July 31, 2013 16:41

I meant that the most time consuming part of the problem is the Poisson equation for the pressure. Because multgrid methods were design for elliptic problems it is often worth the effort to apply a multigrid preconditioner for the pressure equation because it will speed it up so much and because the pressure equation typically takes up most of the computation time.

FMDenaro July 31, 2013 16:55

just to say something about my experience... if the elliptic equation for pressure is the standard one coming from the second order FD discretization of the Poisson equation, try the simple SOR method with the correct relaxation value for the grid. If the system is of O(10^6), SOR can be the fastest method in terms of CPU time and can be simply parallelized (for example b/w procedure). Further, SOR does not require to store all the matrix coefficients.
I tried multigrid (with Jacobi iteration), CG, GMRES and I always obtained that the work-unit of the SOR is so fast to be convenient even for a number of iterations ten times greater than others...
Of course, for systems of huge number of equations, the situation becomes different.

arjun August 1, 2013 11:51

Quote:

Originally Posted by rmh26 (Post 443152)
I meant that the most time consuming part of the problem is the Poisson equation for the pressure. Because multgrid methods were design for elliptic problems it is often worth the effort to apply a multigrid preconditioner for the pressure equation because it will speed it up so much and because the pressure equation typically takes up most of the computation time.

I think by multigrid you mean Full or Geometric multigrid. That could be slightly faster than algebraic multigrid, but on the other hand it is really difficult to design full multigrids for general polyhderals. Creating valid coarse level meshes is challenge in itself.


All times are GMT -4. The time now is 06:59.