Question to convergence and residuals

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

Sidemountyucatan
Posts: 114
Joined: Wed Apr 17, 2019 2:08 pm

Question to convergence and residuals

Post by Sidemountyucatan »

The plotted residuals (very last values in the diagram to the right) seem to be different from the plotted ones (see message below) when looking at the final residuals. Which one are plotted ? Or is it the inital ones ? Which info (solver message as shown below or residual plot) does more say about accuracy / convergence of the simulation ?

14:43:35 smoothSolver: Solving for Ux, Initial residual = 0.15714641, Final residual = 0.0033530228, No Iterations 2
14:44:06 smoothSolver: Solving for Uy, Initial residual = 0.16095142, Final residual = 0.015411274, No Iterations 1
14:44:08 smoothSolver: Solving for Uz, Initial residual = 0.16839021, Final residual = 0.003373176, No Iterations 2
14:44:10 GAMG: Solving for p, Initial residual = 0.46090263, Final residual = 0.013391295, No Iterations 20
14:44:10 GAMG: Solving for p, Initial residual = 0.46090263, Final residual = 0.013391295, No Iterations 20
14:45:30 GAMG: Solving for p, Initial residual = 0.056758019, Final residual = 0.00056274043, No Iterations 16
14:46:26 GAMG: Solving for p, Initial residual = 0.0097423587, Final residual = 9.6233411e-05, No Iterations 15
14:47:15 GAMG: Solving for p, Initial residual = 0.0027559387, Final residual = 2.4863369e-05, No Iterations 13
14:48:05 GAMG: Solving for p, Initial residual = 0.00090569477, Final residual = 8.5082785e-06, No Iterations 9
14:48:37 GAMG: Solving for p, Initial residual = 0.00034219079, Final residual = 3.1782826e-06, No Iterations 9
Attachments
residuals.jpg
residuals.jpg (81.95 KiB) Viewed 3589 times
thschrader
Veteran
Posts: 3129
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Question to convergence and residuals

Post by thschrader »

The residuals looks like the last seconds at the reanimation.
Short time to survive, only 180 iterations.

Sir, can you do this:
Post your FC-file. Please.
A description of the physics you want to solve is helpful.

Imagine, a first user looks at your post.
The impression is, that FC and cfdof does not work.
Wich is not true.

I use FC on a daily basis for steel construction and FEM.
And sometimes for cfd. The hardest stuff..

Would you be so kind to describe in detail what you do ?
FC is ready for industrial use.

So far my rant...no offense intended (sorry, my english)

Regards Thomas.

BTW:
Have you seen the new 2D-mesher?
Any comments?
Sidemountyucatan
Posts: 114
Joined: Wed Apr 17, 2019 2:08 pm

Re: Question to convergence and residuals

Post by Sidemountyucatan »

Hi thschrader,

thanks for your reply. I have the model attached. It is the simualtion of a water tank, with cylindrical inlet near the bottom and an outlet (overflow) at all sides on top. The very top face is the water surface (in this first approach I defined it as wall slip - maybe wrong; I dont know).
Attachments
cleaningfluidtest_01.FCStd
(72.44 KiB) Downloaded 62 times
Sidemountyucatan
Posts: 114
Joined: Wed Apr 17, 2019 2:08 pm

Re: Question to convergence and residuals

Post by Sidemountyucatan »

Interestingly a coarser grid (5mm instead of 2.5 mm) works more stable. No sim error. Could it be that certain basis grid element sizes causes instable sim behavior due to heavily deformed elements based on the geometry ?
KAKM
Posts: 109
Joined: Tue May 04, 2021 12:17 am

Re: Question to convergence and residuals

Post by KAKM »

That's possible, but I think it's more likely that the larger cell size was averaging out the "unstable" behavior, especially if this was a steady-state simulation. When you try to model an unsteady system using a steady state solver, it won't converge, which can look like stability issues. Weird turbulent behavior also takes a finer mesh to resolve properly, so if there's something funky going on, you might only see it at finer meshes.
Sidemountyucatan
Posts: 114
Joined: Wed Apr 17, 2019 2:08 pm

Re: Question to convergence and residuals

Post by Sidemountyucatan »

Thx for that comprehensive answer. To your statement about executing transient simulation with a steady-state solver: how can this happen ? When choosing the physics one have to declare whether to simulate a transient or stady state system. Does the selection of the solver in CFDOF not work properly ?
User avatar
oliveroxtoby
Posts: 810
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: Question to convergence and residuals

Post by oliveroxtoby »

Sidemountyucatan wrote: Fri Mar 04, 2022 1:59 pm The plotted residuals (very last values in the diagram to the right) seem to be different from the plotted ones (see message below) when looking at the final residuals. Which one are plotted ? Or is it the inital ones ?
Yes, the initial one. This gives a measure of the change in the quantities being solved, which is also a measure of how far from a steady-state solution you are. The subsequent residuals relate to the convergence of sub-correctors and are not a measure of the error in the equation as a whole.
Sidemountyucatan wrote: Mon Mar 07, 2022 4:51 pm Interestingly a coarser grid (5mm instead of 2.5 mm) works more stable. No sim error.
I wasn't able to reproduce the error you allude to using the file you uploaded. My residuals look fine so far (see below). This is with OpenFOAM v2112.
res.png
res.png (63.83 KiB) Viewed 3114 times
KAKM
Posts: 109
Joined: Tue May 04, 2021 12:17 am

Re: Question to convergence and residuals

Post by KAKM »

Sidemountyucatan wrote: Tue Mar 08, 2022 2:58 pm Does the selection of the solver in CFDOF not work properly ?
The CfdOF solver selection (as far as I know) works fine. It's really an issue of choosing solvers that aren't a good match for the system being modeled. For example, I was once modeling a wind turbine as a porous disc, but messed up the porosity/permeability, so instead of a moderate resistance to flow that had a pretty steady, laminar output I was essentially modeling a bluff body and had vortex shedding. The steady state solver I was using threw a number of "interesting" errors before I figured out what had gone wrong. In general, if you misjudge how your system is going to behave, one or another of your simulation parameters is probably going to cause problems.
Sidemountyucatan
Posts: 114
Joined: Wed Apr 17, 2019 2:08 pm

Re: Question to convergence and residuals

Post by Sidemountyucatan »

Ah, I see. You refer to the problem - solver pairing, right ? So for example; if try to simulate, let's say a vapor flow at higth pressure (near the sound barrier), using simplefoam (or translated to Cfdof user interface "an incompressible steady state system") the sim would mess up, right ?

But any flow of Newtonian fluids or gases much below a Mach number of 0.3 can be solved with either simplefoam or pimplefoam right ?

Let me ask you a basic question to steady state and transient sims aswell:

So, transient means that you try to sim how a flow develops over time in space for example, if you want to know how the flow (turbulences) of a jet develops in a bigger basin it is injected to, right ?

The steady state using just to get a picture of a constant process for example, the water flow in a bend at constant flow rates.
KAKM
Posts: 109
Joined: Tue May 04, 2021 12:17 am

Re: Question to convergence and residuals

Post by KAKM »

Sidemountyucatan wrote: Wed Mar 09, 2022 10:35 am Ah, I see. You refer to the problem - solver pairing, right ? So for example; if try to simulate, let's say a vapor flow at high pressure (near the sound barrier), using simplefoam (or translated to Cfdof user interface "an incompressible steady state system") the sim would mess up, right ?
Yes to both.
Sidemountyucatan wrote: Wed Mar 09, 2022 10:35 am But any flow of Newtonian fluids or gases much below a Mach number of 0.3 can be solved with either simplefoam or pimplefoam right ?
Pimplefoam should be able to handle anything like that (unless there's a big temperature gradient that makes constant density a bad assumption). Simplefoam is a steady-state solver, so if the flow is changing over time, even if it stays incompressible, it won't be able to solve the problem.

Yes, a transient simulation can observe changes in the flow over time and a steady state simulation will only be able to model conditions that stay (approximately) constant over time. Turning on a jet in a tank is indeed transient and water at a constant flow rate should be steady (it's technically possible to get unsteady/transient behavior due to turbulence, but if you're getting that, you probably screwed up your pipe design).
Post Reply