CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Systems of Nonlinear Equations (http://www.cfd-online.com/Forums/main/80417-systems-nonlinear-equations.html)

Tanay September 24, 2010 21:04

Systems of Nonlinear Equations
 
Hello people,
I have a query regarding how to solve a system of nonlinear equations while writing a C++ code for an FVM algorithm. If we use QUICK differencing scheme and write the Navier-Stokes equations in the discretized form (assuming steady conditions) with convection, diffusion and pressure gradient terms, we finally end up with terms like u(P)^2 and v(P)^2. (u & v are velocities at the node P). How does one solve such a system of nonlinear equations for all the nodes?

Hamidzoka September 25, 2010 00:23

When you are to solve a nonlinear equation like this you should consider terms like u(p)^2 as u(p)*u(p).
one u(p) will be set as variable while another simply is a coefficient which is pre-determined from previous iteration or an initial guess.
as the iteration goes on one u(p) is calculated and another one which is just a coefficient will be updated.

regards

Tanay September 25, 2010 12:46

Right. Thanks a lot.

Tanay September 28, 2010 01:54

I have another query, now that I've got a linear system in my C++ program. I have two choices to solve the equations- the Gauss-Seidel scheme and the full Gaussian elimination matrix method (the coefficient matrix isn't tridiagonal, so TDMA is not an option). Gauss-Seidel is easier to implement but matrix elimination with scaling and partial pivoting will lead to convergence. So, which scheme do commercial softwares like OpenFOAM use to solve a system of linear equations?

david_e October 7, 2010 15:51

I don't know what OpenFOAM is using, but for general matrices I would recommend UMFPACK: it comes as an OSS C library (or bundled with Matlab), it's very easy to use and it's very efficient to solve large sparse linear systems (it uses a sparse LU factorization algorithm), as long as you are not looking for a parallel solver...

chegdan November 2, 2010 16:27

Linear System solvers
 
Quote:

Originally Posted by Tanay (Post 276866)
I have another query, now that I've got a linear system in my C++ program. I have two choices to solve the equations- the Gauss-Seidel scheme and the full Gaussian elimination matrix method (the coefficient matrix isn't tridiagonal, so TDMA is not an option). Gauss-Seidel is easier to implement but matrix elimination with scaling and partial pivoting will lead to convergence. So, which scheme do commercial softwares like OpenFOAM use to solve a system of linear equations?

OpenFoam uses several linear system solvers including:

1) Krylov Subspace solvers: preconditioned conjugate gradient (asymmetric systems), preconditioned Biconjugate gradient(symmetric systems).
2) Geometric Algebraic Multigrid solvers (works well for symmetric systems)
3) smooth solvers (works well for large asymmetric systems)

(I may have left out some)

several preconditioners including Diagonal incomplete cholesky, Diagonal LU factorization, GAMG, or just plain diagonal to name a few

A good brief source is (http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2008/TimBehrens/tibeh-report-fin.pdf)

if you are writing your own linear system solver then the krylov solvers aren't too bad. As long as you have programmed some operations (saxpy, mat-vec operations, dot product, etc.) then its pretty easy. A good book covering the basics is "iterative methods for sparse linear systems" by Yousef Saad. Good luck.

Dan


All times are GMT -4. The time now is 13:32.