CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Residuals (https://www.cfd-online.com/Forums/fluent/28009-residuals.html)

 Rakib November 11, 2000 03:15

Residuals

What does convergence mean with reference to residual plotting of Velocity, Continuity and Pressure?

 Chetan Kadakia November 11, 2000 05:14

Re: Residuals

The residuals are the error magnitudes for equations as iterations progress. The equations include the governing equations; I.e. the Navier-Stokes momentum equations for each direction (x, y, and z if 3d, or just x and y if 2d), the continuity equation (conservation of mass), and if heat transfer is applicable, the energy equation. The equations may also include equations of the turbulence model defined under models-viscous. The residual is the difference between the previous result and the current result. As these errors are decreasing the equation results are reaching values that are changing less and less. This is what is known as convergence. That is the solutions are converging. If these errors begin to increase, the solution is then said to be diverging. Let me give a simplified example of convergence: Initial value = 2, 1st iteration value = 1.5 (residual value is equal to 2 - 1.5 = .5), 2nd iteration value = 1.2 (residual value = 1.5 - 1.2 = .3), 3rd iteration value = 1.05 (residual value = 1.2 - 1.05 = .15),... 1000th iteration value = 1.00001, and 1001th iteration value = 1.000005 (residual value = .00001 - .000005 = .000005). Perhaps the solution is converging to a value of 1. An opposite trend could be given as an example of divergence. A solution can converge and then diverge or vica versa. Does this help? Is my explanation clear and accurate?

 Rakib November 11, 2000 06:30

Re: Residuals

Thanks.

 Patchawat November 11, 2000 10:53

Re: Residuals

HELLO CHETAN, SO..IF THE RESIDUAL PLOT LINE IS CONSTANT(SLOPE=0,NOT DECREASING(CONVERGING),NOT INCREASING(DIVERGING)),WHAT DOES IT MEAN? SORRY THAT I AM NOT CLEAR ABOUT THIS STUFF. DOES IT MEAN THAT THE ITERATION ARE STILL ON THE WAY BUT NOT CLOSE YET TO THE SOLUTION?

THANK YOU,

PATCHAWAT

 Petr November 11, 2000 14:12

Re: Residuals

Hello Patchawat,

I think that the problem is in fact that you see summed "pointwise" residual for each equation you are solving. That means, that even low residual cannot quarantee small changes of solution everywhere. There could be regions with well settled solution, but also regions with quite considerable changes between iterations even with almost constant residual (the locations of such "problem" regions could change during the solution process). Moreover, when you solve sequentially more than one equation, you have changing coefficients which could also complicate the situation. It would be useful to see also the maximum "pointwise" residual for each equation beeing solved.

Petr

 Patchawat November 11, 2000 14:38

Thank you

 Chetan Kadakia November 11, 2000 19:13

Re: Residuals

If the solution is not converging and not diverging, you have to decide for your solution if it is good enough. That is also why we can set a convergence criterion. Instead of me giving you some examples, why don't you tell us what you are working on. It's hard to say what is the right convergence criterion, it varies for every problem. You can also monitor forces/surfaces. If you are considering a steady state airfoil problem, you may monitor coefficient of lift (you should also look at moment and drag in this case also), and when the lift force appears to be constant that is a sign of convergence. But note: convergence does not necessarily mean accuracy. If you are solving for a heat transfer problem, you may want to have a higher criterion for the energy equation, perhaps 1e-6 or 1e-9. If you are not satisfied with your solution, you should change your solution controls. If you gradually reduce your under-relaxation factors (try not to change all the relaxation factors at once, change only one or two at a time), or maybe even change the discretization schemes, then when you solve the problem your residuals could eventually minimize even further. Also don't be hasty, convergence may take several hundred or thousands of iterations (and the slope could appear flat when it is not completely flat). Tell us your exact problem if allowed, and whoever has experience with a similar situation should hopefully reply with some more help. Also see chapter 17 of the Fluent manual.

 Chetan Kadakia November 11, 2000 19:19

Re: Residuals

Petr,

Your idea of seeing the maximum pointwise residual makes sense if I understand it correctly. I'm guessing each equation solves for several values, each with its own residual. Instead of looking at the average residual for each equation, we should look a the maximum reisdual. Do I understand this correctly? The term "pointwise residual" is new to me. If I am incorrect please correct me. If I am correct, please tell me how to change my view to that of the maximum pointwise residual.

Thanks, Chetan K.

 Petr November 12, 2000 03:36

Re: Residuals

Chetan,

I used the term "pointwise residual" in order to distinguish the quantity that FLUENT produces from contributions of the individual computational cells (which are the "pointwise residuals" as I termed it). Both quantities are useful in my opinion, and the possibility to see also the maximum of the cell residuals (this is maybe a better term) could eliminate one possible source of user effects. In the present situation, when you have satisfactory low and slowly varying residuals, you nevertheless should check the places, where your solution still changes considerably. To find such place is not easy: you must select the variable you should check, judge which should be the right values at various places, etc. If you know beforehand that eg. turbulence energy still has high residual somewhere, you can concentrate yourself to this quantity. Of course, this only ensures that you have converged solution, but from this situation it is easier to check physical correctness of your solution.

Regards.

Petr

 Patchawat November 14, 2000 09:26

Re: Residuals

Thank Chetan, You and Petr seem to be helpful to me. Now I am facing the divergence problem when I try to do simulation of 2-phase(solid-water) stirred tank without baffle.....the divergence happen all the time eventhough I set the very small time step and quite low underrelaxation. I have to take time to check what's wrong with my model's parameters,etc...(i use mixsim and fluent4.5) During this time,soon, I will post my problem again in this discussion forum....please check it and take a look if you can suggest me anything or not.

Thanks

 Max November 17, 2000 02:46

Re: Residuals

i'm doing the simulation on 2 phase(water & air) flow in a horizontal pipe.if my residual graph is going up(diverge),is that means i'm wrong?why my residual graph finally become constant but not zero?doesn't it in steady state,the velocity & pressure should converge to a constant value(residual value=0)? an additional question is the k-epsilon model can be used for steady state?

Max

 Patchawat November 17, 2000 08:59

Re: Residuals

Hi Max, I also am having the same problem as you. I am simulating the system of "2D","one phase",no baffle, stirred tank. At first I though that the solution will converge easily but,in fact, I have the problem that all equation's residual plot have been narrowly oscillating forever(i mean very large number of iteration).....they oscillate in the range of about 1e-3 to 1e-4 except for pressure that oscillate in the range of 0 to 1e-1. I try to reduce underelaxation on pressure,increse its no. of sweep to 20,or turn on multigrid, but nothing improve. Regarding k-epsilon model....i am not sure about this but I think it can.....why not? So..let wait for the other to answer us for more accuate information.

 Max November 17, 2000 10:39

Re: Residuals

hi,Patchawat,my residual plot also shows narrowly oscillating forever during the very large number of iteration(500). my doubt is why the residual value is not converge to zero?(residual value=iteration 1- iteration 2,e.g. iteration 1-iteration 2=0.0001,iteration 2-iteration 3=0.00001, iteration 3-iteration 4=0.000001, iteration 4-iteration 5=0.0000001,.........iteration n-iteration n+1=0.000000........1=0(because the velocity value & pressure is converge to a constant value)). k-epsilon is only used for turbulent model.

 Dan Williams December 16, 2000 02:32

Re: Residuals

Hmm, funny how peoples understanding of residuals seem to be totally incorrect. Like many other CFD codes, Fluent uses a finite volume discretisation. For each finite volume a "control volume" or finite volume equation is assembled in the form:

App*PHI + SUM(Anb*PHInb) = Residual

So, when trying to converge to a steady state solution the residual is the amount by which the a local finite volume is out of balance. i.e., flow of stuff in - flow of stuff out = residual. When some of the people in this thread say look at the pointwise maximum residual they are simply asking "Which finite volume is most out of balance?".

There are two things that the various codes do differently:

1) Normalise the local residuals. 2) Use a global RMS or Maximum residual to determine convergence.

I'm not sure what exactly Fluent does, but on many problems, with a proper residual normalisation you should be able to obtain near round-off convergence given enough iterations (1.0E-7 RMS in single precision). The RMS value is simply the RMS average of all the residuals on the right hand side of your equations.

Dan.

 Petr December 18, 2000 10:09

Re: Residuals

Hi Dan,

you are of course right that I ask "which CV is most out of balance" in situation, when the residuals produced by FLUENT (which are sums, either unscaled or scaled or normalized, of residuals of the individual CVs over all control volumes) demonstrate a problem. Even when these "global" residuals are quite low, there could be regions with out-of-balance control volumes and I would like to know, where they are. The developers of FLUENT are aware of such difficulties, judging from the number of pages in User's Guide devoted to monitoring and judging convergence.

Best regards

Petr

 Dan Williams December 19, 2000 00:35

Re: Residuals

Seems to me that you just output the residuals and plot them in the post-processor? Can you do this with Fluent?

Dan.

 Petr December 19, 2000 05:31

Re: Residuals

Dan,

I can see the summed ("global") residuals during calculation or plot them in post-processing. When using coupled solver, the residuals are in fact changes in the variables between the current and previous iterations. When using the segregated solver, the residuals are the summed imbalances of the individual control volumes, as we have discussed. As to the value for an individual control volume, I can see in post-processing only mass imbalance as a histogram plot. I would like to have something similar to the tool for check of grid available in the GAMBIT (a preprocessor for FLUENT)where I can go through the solution domain eg. with a moving plane and see some parameters of the individual cells displayed in colours according to the ranges of their values.

Petr

 Dan Williams December 20, 2000 01:37

Re: Residuals

What you mention about the residuals for the coupled solver seems odd. I'd be suprised if that were the case. A finite volume discretisation is what it is and a residual for a control volume is how much that control volume is out of balance, that's it. If Fluent is defining the residuals as the change in solution variables between iterations then this has nothing to do with the conservation balance, and in fact is a poor technique for defining a residual.

This does not instill confidence, for me, in their coupled solver if they are using this approach. Another good example, mentioned elsewhere on this discussion group, is that they have to put all these damn Multigrid controls into their GUI because they can't figure out how to use the thing properly. Who cares how many smoother sweeps a you need on the coarse grid levels and so on.

What exactly do you mean by a histogram plot of mass imbalance. What does this tell you. Surely the only numbers that matter are 1) The global conservation balance (which is what you mention you can get) and 2) Localised imbalances, or maximum residuals, that are large. If you can deal with a small localised regions of imbalance, then your solution is likely going to be fine if you've met a decent global conservation target. This is problem dependent of course. I'm very suprised that you cannot write the residuals out for post-processing. This can be very useful for diagnosing convergence problems.

Later, Dan.

 Petr December 20, 2000 04:33

Re: Residuals

Dan,

as to the definition of residuals for the coupled solver, I only cited the User's Guide, but it is possible that I misundersood it (I do not thnk so). I have used only the segregated solver so far.

The plot of mass imbalance gives me information how much cells from the total number of cells have mass imbalance in a defined range.

I wrote, that I can plot the (global)residuals in post-processing. That means, that they are written in the data file. Sorry that I did not mention it explicitly.

Petr

 cfd January 19, 2001 16:57

Re: Residuals

All times are GMT -4. The time now is 14:24.