CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Convergence problems in CVFEM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 17, 2012, 23:33
Default Convergence problems in CVFEM
  #1
Member
 
G. S.
Join Date: Nov 2010
Posts: 54
Rep Power: 15
gerardosrez is on a distinguished road
Hi guys
Im developing an unstructured CVFEM code for the NS equations using SIVA algorithm proposed by Baliga.

Im solving the induced flow in a square cavity for Re = 400, the mesh elements are triangular. For the first run my mesh had 100 nodes and I got convergence but when I refined the mesh I started to had divergence.

Im using MATLAB and I have tried with Gauss -Seidel, Bicgstab, Bicgstab with preconditioning without results, so what can you tell me about it

The code is using 1st order upwind and Im following the ideas of the following paper: Alexandre Lamoureux & B. Rabi Baliga (2011): Improved Formulations of the Discretized Pressure Equation and Boundary Treatments in Co-Located Equal-Order Control-Volume Finite-Element Methods for Incompressible Fluid Flow, Numerical Heat Transfer, Part B: Fundamentals: An International Journal of Computation and Methodology, 59:6, 442-472

Any help would be great, this is my master thesis and Im out of time so thanks in advance....
gerardosrez is offline   Reply With Quote

Old   May 17, 2012, 23:43
Default
  #2
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,285
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
use small under-relaxations thats the only tip I can give you.
arjun is offline   Reply With Quote

Old   May 18, 2012, 10:21
Default
  #3
Member
 
G. S.
Join Date: Nov 2010
Posts: 54
Rep Power: 15
gerardosrez is on a distinguished road
Quote:
Originally Posted by arjun View Post
use small under-relaxations thats the only tip I can give you.
hi arjun, do u have any literature to review I need a lot of help and Im really out of time, I´ve been stuck several months on this...

I´d appreciate the help and I apologize for the inconveniences...
gerardosrez is offline   Reply With Quote

Old   May 19, 2012, 00:37
Default
  #4
Senior Member
 
cdegroot's Avatar
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 18
cdegroot is on a distinguished road
Does the code work for other problems? Have you ruled out a coding problem?
cdegroot is offline   Reply With Quote

Old   May 19, 2012, 00:40
Default
  #5
Senior Member
 
cdegroot's Avatar
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 18
cdegroot is on a distinguished road
Also, is it your residual that is diverging or the linear solver that is diverging? I.e. is the residual just growing too large or is it having trouble solving your system of equations. The reason I ask is because you have listed the linear solvers you have tried, which doesn't really have to do with convergence/divergence of the simulations.
cdegroot is offline   Reply With Quote

Old   May 20, 2012, 08:51
Default
  #6
Member
 
G. S.
Join Date: Nov 2010
Posts: 54
Rep Power: 15
gerardosrez is on a distinguished road
Quote:
Originally Posted by cdegroot View Post
Also, is it your residual that is diverging or the linear solver that is diverging? I.e. is the residual just growing too large or is it having trouble solving your system of equations. The reason I ask is because you have listed the linear solvers you have tried, which doesn't really have to do with convergence/divergence of the simulations.
hi cderoo, the divergence of residual starts when I refine the mesh no matter the linear solver I use. But on the 100 node mesh every linear solver give me convergence of residuals...

thanks for taking time in this matter....
gerardosrez is offline   Reply With Quote

Old   May 20, 2012, 09:47
Default
  #7
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,285
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by gerardosrez View Post
hi cderoo, the divergence of residual starts when I refine the mesh no matter the linear solver I use. But on the 100 node mesh every linear solver give me convergence of residuals...

thanks for taking time in this matter....

Okey my second advise, as a student I believe you have to perform some calculations and present their results. So spend your time making the meshes as good as possible. Remove the skew etc problems and keep hexa type elements. With low under-relaxations and good mesh you could do calculations on a very fine mesh too.


Further in the linear solver try to achieve very high convergence. With fine meshes it is very much needed to keep stablity.

I have run calculations with 1billion cells and more without special treatment for stability and I can tell you convergence level of linear solver matters a lot in this case.
arjun is offline   Reply With Quote

Old   May 20, 2012, 10:13
Default
  #8
Senior Member
 
cdegroot's Avatar
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 18
cdegroot is on a distinguished road
I'm still not totally clear if the divergence is due to issues with the linear solver or issues with the discretization. I will make a suggestion because I feel like it could be a solver issue. First, can you confirm that the linear solver is converging and to what tolerance level? If the solver is not converging you have likely found your problem. I would also ask if you are storing your matrices as dense or sparse matrices, i.e. are you storing all of the zeroes? If you are storing the full matrix, then I would not be surprised if the solver will not converge on a larger system.
cdegroot is offline   Reply With Quote

Old   May 20, 2012, 10:42
Default
  #9
Member
 
G. S.
Join Date: Nov 2010
Posts: 54
Rep Power: 15
gerardosrez is on a distinguished road
Quote:
Originally Posted by cdegroot View Post
I'm still not totally clear if the divergence is due to issues with the linear solver or issues with the discretization. I will make a suggestion because I feel like it could be a solver issue. First, can you confirm that the linear solver is converging and to what tolerance level? If the solver is not converging you have likely found your problem. I would also ask if you are storing your matrices as dense or sparse matrices, i.e. are you storing all of the zeroes? If you are storing the full matrix, then I would not be surprised if the solver will not converge on a larger system.
hi cdegroot, Im actually using bicgstab with preconditioning from ILU getting a linear solver convergence below 1e-06, the problem is the divergence on residuals, again when I solve a 100 node mesh I have no convergence problems, when I use a 225 node mesh my residuals keeps bounded but no convergence is achieved, for finer meshes with about 900 nodes I get divergence...

Im only using trangular elements

I used several lineal solvers because like you I thought the problem was there, but using bicgstab with preconditioning I get rid of that issue.

Thanks cdegroot I really appreciate your help
gerardosrez is offline   Reply With Quote

Old   May 20, 2012, 10:48
Default
  #10
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,285
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by gerardosrez View Post
hi cdegroot, Im actually using bicgstab with preconditioning from ILU getting a linear solver convergence below 1e-06, the problem is the divergence on residuals, again when I solve a 100 node mesh I have no convergence problems, when I use a 225 node mesh my residuals keeps bounded but no convergence is achieved, for finer meshes with about 900 nodes I get divergence...

Im only using trangular elements

I used several lineal solvers because like you I thought the problem was there, but using bicgstab with preconditioning I get rid of that issue.

Thanks cdegroot I really appreciate your help

Okey by this information I think there is something that could be concluded.

First of all 900 nodes is pretty coarse mesh. It is not fine. In fact in my experience till 50000 cells is coarse mesh.

So the conclusion is your code has some problem, check your code. (thats what i think).
arjun is offline   Reply With Quote

Old   May 20, 2012, 11:01
Default
  #11
Senior Member
 
cdegroot's Avatar
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 18
cdegroot is on a distinguished road
I have to agree with arjun. In an absolute sense, the problem is not that large so convergence should not be difficult. Therefore it sounds like there is a problem with the code itself. How did the results look using 100 nodes? With 225 nodes, have you looked at the solution after a bunch of iterations to see if anything obvious is going wrong?

I always find a good way to isolate problems in a malfunctioning code is to turn off certain influences one at a time to see which one causes the problem. I'm not sure exactly how the method you are using works. I use cell-centered finite-volume. So if I have an error I will start by turning off higher order convection terms (making it first order upwind) to see if that is the issue. If not I will turn off the convection terms completely so I am essentially solving an unsteady Stokes equation instead of Navier-Stokes. Then you can proceed to lower the order of other interpolations (i.e. in diffusion or pressure terms) to try to locate the problem.

Also, do all equations diverge together or does either mass or momentum diverge first. It always helps to know which equation is the problem.
cdegroot is offline   Reply With Quote

Old   May 20, 2012, 14:04
Default
  #12
Member
 
G. S.
Join Date: Nov 2010
Posts: 54
Rep Power: 15
gerardosrez is on a distinguished road
Quote:
Originally Posted by cdegroot View Post
I have to agree with arjun. In an absolute sense, the problem is not that large so convergence should not be difficult. Therefore it sounds like there is a problem with the code itself. How did the results look using 100 nodes? With 225 nodes, have you looked at the solution after a bunch of iterations to see if anything obvious is going wrong?

I always find a good way to isolate problems in a malfunctioning code is to turn off certain influences one at a time to see which one causes the problem. I'm not sure exactly how the method you are using works. I use cell-centered finite-volume. So if I have an error I will start by turning off higher order convection terms (making it first order upwind) to see if that is the issue. If not I will turn off the convection terms completely so I am essentially solving an unsteady Stokes equation instead of Navier-Stokes. Then you can proceed to lower the order of other interpolations (i.e. in diffusion or pressure terms) to try to locate the problem.

Also, do all equations diverge together or does either mass or momentum diverge first. It always helps to know which equation is the problem.
Im just solving momentum and pressure equation like the paper I mentioned before using first order uwpind for convection scheme if you want to I can send u the paper so you can see what Im doing.

What I dont understand is why if I achieve convergence for a coarse problem I can't achieve for finer ones.

Thanks a lot...
gerardosrez is offline   Reply With Quote

Old   May 20, 2012, 18:51
Default
  #13
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,285
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by gerardosrez View Post

What I dont understand is why if I achieve convergence for a coarse problem I can't achieve for finer ones.

Thanks a lot...

Have you ever read this small sweet book A Multigrid Tutorial by William L. Briggs. If not then please do read it, specially the chapter where he says that it is very difficult to convince people that their code has a bug if it works for small problems and show good convergence for small and simple problems.
arjun is offline   Reply With Quote

Old   May 20, 2012, 19:18
Default
  #14
Member
 
G. S.
Join Date: Nov 2010
Posts: 54
Rep Power: 15
gerardosrez is on a distinguished road
Quote:
Originally Posted by arjun View Post
Have you ever read this small sweet book A Multigrid Tutorial by William L. Briggs. If not then please do read it, specially the chapter where he says that it is very difficult to convince people that their code has a bug if it works for small problems and show good convergence for small and simple problems.
Yes arjun I agree with you that I have a bug in my code, and I'm working hard to debug it. If you or cdegroot have any helping trick or advise during your career I'd be really thankful, also I have limited or no access to literature regarding this subject, just a few papers and ebooks like Numerical Heat Transfer and Fluid Flow by Patankar or Basic CVFEM for fluids and solids by Voller among other few including the paper I have been telling you about.

If you think you have some information that could be useful (books, papers, references, etc) please I beg both of you to share it with me. My email is gerardosrez@gmail.com.

Thank u guys, I appreciate the time you spent here...and it's time to work harder!!
gerardosrez is offline   Reply With Quote

Old   May 20, 2012, 19:42
Default
  #15
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,285
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by gerardosrez View Post
Yes arjun I agree with you that I have a bug in my code, and I'm working hard to debug it. If you or cdegroot have any helping trick or advise during your career I'd be really thankful, also I have limited or no access to literature regarding this subject, just a few papers and ebooks like Numerical Heat Transfer and Fluid Flow by Patankar or Basic CVFEM for fluids and solids by Voller among other few including the paper I have been telling you about.

If you think you have some information that could be useful (books, papers, references, etc) please I beg both of you to share it with me. My email is gerardosrez@gmail.com.

Thank u guys, I appreciate the time you spent here...and it's time to work harder!!

Tracking bug is not very easy sometimes. I can only share my experience. I have been in your position many many times. Even after writing more than 10 navier stokes solvers I often find myself in this position.

My last such experience was very interesting. I wrote a cartesian based solver for LES / DNS only to find that everything works fine except that the stagnation pressure it was predicting is somewhat smaller by factor of 1.7 or so. Spent 4 days trying to figure out whats wrong. I could not figure out what was wrong because solver is stable, i do see the vortex shredding that i hoped for etc etc.

Finally I wrote the whole damn thing again from scratch. I am still scratching my head about what was wrong with that.

So how about write it again. Too troublesome but you can try. This way if there was a bug it would come out.

It is difficult to help with bug. That only you can ferret out.
arjun is offline   Reply With Quote

Old   May 21, 2012, 00:43
Default
  #16
Senior Member
 
cdegroot's Avatar
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 414
Rep Power: 18
cdegroot is on a distinguished road
I can't think of any references necessarily that would help you debug.

Along the lines of what arjun said, but maybe a bit less extreme, you could start rewriting some of your functions/subroutines one at a time. It would be really nice though to have an idea of what physical influence is leading to the divergence before beginning something extreme. I would try verifying mass is conserved, verify boundary conditions are being imposed properly, check what happens with convection turned off, etc.

If the square cavity problem doesn't work, try a duct. Maybe the issue will become glaringly obvious in another problem. The duct problem may be simpler because since you don't have to worry about setting the pressure level in the interior of the domain since it will be set at the outlet boundary. Additionally, the pressure field is extremely simple (linear) and there is only one component of velocity with a gradient in only one direction (assuming fully developed inlet is specified). To debug I often use this case. If I am having real troubles I will just prescribe the pressure field and try solving only velocity.

I think a methodical analysis to determine which physical influence has the bug is the best place to start.
cdegroot is offline   Reply With Quote

Old   June 9, 2012, 10:13
Default
  #17
Member
 
G. S.
Join Date: Nov 2010
Posts: 54
Rep Power: 15
gerardosrez is on a distinguished road
Hi guys, I write to you to inform that my code is already getting convergence, when I used the underrelaxation method proposed by Patankar the outer iterations got convergence, I think the problems was that when I refined the mesh the neighbor coefficients got small due to the decreasing of volume of cells os it becomes harder to solve the linear system by the bicgstab code.

Thanks for your help friends, now I´m working to get the streamfunction from my velocity field. How can I do this for an unstructured grid?? (CVFEM).

Thanks in advance...
gerardosrez is offline   Reply With Quote

Reply

Tags
baliga, colocated, cvfem


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gas-liquid vertical separator, problems with convergence juliom Main CFD Forum 0 October 5, 2011 21:20
NACA0012 Convergence Problems StudentAndrew CFX 6 November 21, 2005 07:49
Convergence problems Simone Siemens 5 June 29, 2005 11:48
Convergence problems Chetan FLUENT 3 April 15, 2004 20:13
convergence problems jeremy FLUENT 7 May 30, 2002 07:41


All times are GMT -4. The time now is 23:56.