CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Closed loop pipe flow

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 17, 2010, 12:10
Default
  #21
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Hello,
finally I have my simulation running!
the mesh is not perfect: about 4000 non-orthogonal cells out of 600000. However, I want to keep the cell number "low" to understand how to set up everything properly. For the same reason, I switched the turbulence off and considered the flow as laminar. On a second step, I will apply what both suggested above for the mesh generation & the turbulence model.
What I have noticed so far is that my pressure residual flattens after about 100 iterations, and at the same time the GAMG solver makes hundreds of iterations. The latter is due to the solver residual, that are quite low indeed:
Code:
    p
    {
        solver          GAMG;
        tolerance       1e-09;
        relTol          1e-04;
        smoother        GaussSeidel;
        nPreSweeps      0;
        nPostSweeps     2;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels     1;
    }

    U
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance       1e-09;
        relTol          1e-04;
    }
However, increasing them, the pressure residual goes up and down and never reach convergence. this is my last simulated time output:
Code:
smoothSolver:  Solving for Ux, Initial residual = 0.00482599, Final residual = 4.45505e-07, No Iterations 8
smoothSolver:  Solving for Uy, Initial residual = 0.0339055, Final residual = 2.32396e-06, No Iterations 8
smoothSolver:  Solving for Uz, Initial residual = 0.0122788, Final residual = 1.10086e-06, No Iterations 8
GAMG:  Solving for p, Initial residual = 0.127016, Final residual = 1.26726e-05, No Iterations 151
GAMG:  Solving for p, Initial residual = 0.0437082, Final residual = 4.28262e-06, No Iterations 221
time step continuity errors : sum local = 2.32733e-05, global = -7.60473e-07, cumulative = -2.55991e-05
Can these convergence problems be due to my poor mesh quality? Or is there anything I can change to improve the convergence? I am using 2 non-orthogonal correctors, should I use more of them? I do not think this will be useful..
Suggestions?


mad
maddalena is offline   Reply With Quote

Old   September 18, 2010, 00:27
Default
  #22
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Usually it is convenient to keep the pressure residual lower than the others (say p: 10^-10, U: 10^-8), and to reduce the relTol to zero.

About the non-orthogonal correctors, use a number that allows the pressure equation to converge within the iteration.

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   September 20, 2010, 05:06
Default
  #23
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Hi Alberto,
just to understand what I am doing...
Quote:
Originally Posted by alberto View Post
Usually it is convenient to keep the pressure residual lower than the others (say p: 10^-10, U: 10^-8)
I am used to to that... I misread fvSolution...
Quote:
Originally Posted by alberto View Post
and to reduce the relTol to zero.
The pressure relTol or every relTol? What does this mean? That I will accept the iteration solution only if approaching the computing precision? In that way, the iteration time will be terribly high!
Quote:
Originally Posted by alberto View Post
About the non-orthogonal correctors, use a number that allows the pressure equation to converge within the iteration.
Thus if I want that the pressure has a simulation final convergence of say 10E-4, I should choose the number of nonOrthogonalCorrectors in such a way that the last time I solve the pressure equation whithin that step, I have an intial residual of 10E-4. Is that what you meant?
Thanks a lot for your suggestions.
Regards,

mad
maddalena is offline   Reply With Quote

Old   September 20, 2010, 06:20
Default
  #24
Senior Member
 
Nilesh Rane
Join Date: Apr 2010
Posts: 122
Rep Power: 16
nileshjrane is on a distinguished road
Quote:
Originally Posted by maddalena View Post
The pressure relTol or every relTol? What does this mean? That I will accept the iteration solution only if approaching the computing precision? In that way, the iteration time will be terribly high!
Hi,

The user guide says that relTol is the ratio of initial residual to final residual. Meaning when the residual gets below (relTol X inital residual) the solution is stopped. And if you set it to zero then the the absolute residual value u specify is used. So it doesnt take forever. I thinkit takes higher of the two numbers (i.e from relTol and the absolute value u specify) as stopping criteria.
__________________
Imagination is more important than knowledge..
nileshjrane is offline   Reply With Quote

Old   September 20, 2010, 06:31
Default
  #25
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
I should have checked par 4.5.1.1 of the user guide!

Summarizing:
  • tolerance: is the maximum admissible ratio between the last and the next to last value;
  • relTol: is the maximum admissible ratio between the last and the first residual. <-- Nilesh, you reported wrong!
Thus if relTol is zero, relTol == tolerance.
Quote:
Originally Posted by nileshjrane View Post
So it doesnt take forever.
This is always a good news...
Quote:
Originally Posted by nileshjrane View Post
I think it takes higher of the two numbers (i.e from relTol and the absolute value u specify) as stopping criteria.
Yes, in that case the computational time is always higher.
Thank you!

mad

Last edited by maddalena; September 20, 2010 at 07:11.
maddalena is offline   Reply With Quote

Old   September 20, 2010, 15:29
Default
  #26
Senior Member
 
Nilesh Rane
Join Date: Apr 2010
Posts: 122
Rep Power: 16
nileshjrane is on a distinguished road
Hi maddalena,

This is the exact text from the UG:

Quote:
USER GUIDE
Before solving an equation for a particular field, the initial residual is evaluated based on the current values of the field. After each solver iteration the residual is re-evaluated. The solver stops if either of the following conditions are reached:
  • the residual falls below the solver tolerance, tolerance;
  • the ratio of current to initial residuals falls below the solver relative tolerance, relTol;
Quote:
Originally Posted by maddalena View Post
Summarizing:
  • tolerance: is the maximum admissible ratio between the last and the next to last value;
Tolerance is not a ratio, its just a value below which if residual goes, the solution is considered converged.

Quote:
relTol: is the maximum admissible ratio between the last and the first residual. <-- Nilesh, you reported wrong!
I think i said the same think..

Quote:
Yes, in that case the computational time is always higher.
No, but its exactly opposite. By higher value i meant, say tolerance sets limit as 1e-07 and relTol as 1e-03 (if relTol = 0.1 and initial tolerance = 0.01 for example), the solver will take 1e-03 as the cut-off criteria..higher value of the two, you see..as the UG says solver stops when either of the two gets satisfied, n its but obvious that the one which has higher value will get satisfied first, so your iterations will terminate sooner and you will have lesser computational time.
__________________
Imagination is more important than knowledge..
nileshjrane is offline   Reply With Quote

Old   September 21, 2010, 03:57
Default
  #27
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Quote:
Originally Posted by maddalena View Post
That I will accept the iteration solution only if approaching the computing precision? In that way, the iteration time will be terribly high!
The single iteration might take longer, but its convergence will be better, which results in faster drop of residuals.

Quote:
Thus if I want that the pressure has a simulation final convergence of say 10E-4, I should choose the number of nonOrthogonalCorrectors in such a way that the last time I solve the pressure equation within that step, I have an intial residual of 10E-4. Is that what you meant?
Yes, or something close to that. If you run a steady-state case, it is not strictly necessary the residual goes very low, but it should not grow, and it should tend to become smaller.

Best,
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   September 21, 2010, 05:14
Default
  #28
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Thank you to both of you for the suggestions!
Now I have this fvSolution:
Code:
    p
    {
        solver          GAMG;
        tolerance       1e-05;
        relTol          0;
        smoother        GaussSeidel;
        nPreSweeps      0;
        nPostSweeps     2;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels     1;
    }

    U
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance       1e-03;
        relTol          0;
    }
The residual are not so low, but at the moment I think they are ok. Following the criterion suggested by Alberto, I have:
Code:
SIMPLE
{
    nNonOrthogonalCorrectors 6;
    pRefCell        0;
    pRefValue       0;
}
The simulation time is really high: about 2 minutes per iteration, using 2 processors (that are all the processors I can use... ). Find attached the initial pressure history: as you can see the residual drops on the first 50 iterations, but they increase and finally diverges from iteration 50 on. This is the log file at time 50:
Code:
Time = 50

smoothSolver:  Solving for Ux, Initial residual = 0.00866536, Final residual = 0.000815573, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 0.0404917, Final residual = 0.000930839, No Iterations 3
smoothSolver:  Solving for Uz, Initial residual = 0.0188665, Final residual = 0.000551953, No Iterations 3
GAMG:  Solving for p, Initial residual = 0.127684, Final residual = 9.3116e-06, No Iterations 458
GAMG:  Solving for p, Initial residual = 0.0403606, Final residual = 9.66437e-06, No Iterations 63
GAMG:  Solving for p, Initial residual = 0.0146646, Final residual = 9.23663e-06, No Iterations 20
GAMG:  Solving for p, Initial residual = 0.00838198, Final residual = 8.57141e-06, No Iterations 15
GAMG:  Solving for p, Initial residual = 0.00576653, Final residual = 8.45709e-06, No Iterations 13
GAMG:  Solving for p, Initial residual = 0.00450226, Final residual = 9.49696e-06, No Iterations 12
GAMG:  Solving for p, Initial residual = 0.00368982, Final residual = 8.7992e-06, No Iterations 9
time step continuity errors : sum local = 3.52275e-05, global = -6.45865e-07, cumulative = -5.60862e-05
ExecutionTime = 6313.95 s  ClockTime = 6771 s
Everything seems fine, uh?
Thus, I analyzed the velocity and pressure distribution on the domain. What I can see is that velocity increases locally on the small pipe, in a position where the flow is supposed to follow pipe theory strictly. What I think is that this is a consequence of the mesh, since its grading is not really nice there, see the attached picture. Am I right? I definitely should follow your advices on mesh generation...
Cheers

mad
Attached Images
File Type: jpg U_pipeMesh.jpg (28.6 KB, 161 views)
Attached Files
File Type: pdf p.pdf (28.3 KB, 41 views)
maddalena is offline   Reply With Quote

Old   September 21, 2010, 14:29
Default
  #29
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Well, yes, the mesh needs love :-)
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   September 30, 2010, 12:32
Default
  #30
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Hi everyone,
I finally got my simulations running (including turbulence), and everything went nice with the first case that I described in the previous posts.
Then I change geometry (refer to the new file attached)
  • reverse the flow direction (counterclockwise instead of clockwise)
  • add a second channel parallel to the small one; in that case the diameter is about 10x;
  • add a sort of deviator at the end of this new channel, which has the function to reduce the flow on this new channel in favor of the small one.
I did not changed anything on the fan pressure jump. As a consequence, velocities inside the system reduce, since the pressure losses due to the deviator are higher. The geometry does not change, but the velocities reduce => the flow mass is lower.

However, what I really want to test is to keep the mass flow fixed and calculate the pressure losses on the system. So, I am thinking to change the condition on the fan. Instead of using a standard fan BC, use the following:
  • On fan inlet, fix mass flow rate:
    • velocity: flowRateInletVelocity (with a negative sign);
    • pressure: zeroGradient;
    • epsilon, k: fixedValue;
  • On the fan outlet, fix pressure;
    • velocity: zeroGradient;
    • pressure: fixedValue, 0;
    • epsilon, k: zeroGradient.
I cannot use inletOutlet in place of zeroGradient since I do not know a velocity value that I can use for the inletValue condition.

What do you think about this approach? Is it logical? or are there any other solution I can use to mantain flow rate constant inside the closed loop system?

Regards

mad
Attached Images
File Type: png geom2.png (21.5 KB, 154 views)
ZKW likes this.
maddalena is offline   Reply With Quote

Old   September 30, 2010, 14:27
Default
  #31
Senior Member
 
Nilesh Rane
Join Date: Apr 2010
Posts: 122
Rep Power: 16
nileshjrane is on a distinguished road
Hi,

I don't have any experience of fan BC as such. But, when i think of such situation, when in real situation my mass flow is not enough, i would increase fan rpm. U know what i mean?? i will increase fan power and thus the pressure difference across the fan. So, how about doing this?? Increase the pressure across the fan till you get the right mass flow rate. I am sure you can estimate a rough value by simple hand calculations.

Just a suggestion..

Have fun..
Nilesh
__________________
Imagination is more important than knowledge..
nileshjrane is offline   Reply With Quote

Old   October 1, 2010, 03:19
Default
  #32
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Hello,
Quote:
Originally Posted by nileshjrane View Post
Increase the pressure across the fan till you get the right mass flow rate. I am sure you can estimate a rough value by simple hand calculations.
Well, this is a solution as well, but I think this is not "clever". If I would do that, every time I change the geometry I should calculate the new pressure jump to keep mass flow rate constant. If I could fix the flow mass, I will not have this problem.
In any case... I run the simulation as described yesterday during the night. Not checked results yet, however I guess there is something wrong with this approach:
Code:
Time = 500

smoothSolver:  Solving for Ux, Initial residual = 0.00914707, Final residual = 8.10372e-05, No Iterations 4
smoothSolver:  Solving for Uy, Initial residual = 0.0282209, Final residual = 8.3451e-05, No Iterations 5
smoothSolver:  Solving for Uz, Initial residual = 0.00963077, Final residual = 8.75521e-05, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.0236841, Final residual = 9.83143e-07, No Iterations 236
GAMG:  Solving for p, Initial residual = 0.00560969, Final residual = 9.7794e-07, No Iterations 12
GAMG:  Solving for p, Initial residual = 0.00171942, Final residual = 9.14703e-07, No Iterations 13
GAMG:  Solving for p, Initial residual = 0.000945763, Final residual = 8.96619e-07, No Iterations 16
GAMG:  Solving for p, Initial residual = 0.000616439, Final residual = 8.78768e-07, No Iterations 15
time step continuity errors : sum local = 2.60889e+11, global = 4.1978e+10, cumulative = -2.13409e+12
smoothSolver:  Solving for epsilon, Initial residual = 1.13585e-07, Final residual = 1.13585e-07, No Iterations 0
smoothSolver:  Solving for k, Initial residual = 1.12936e-17, Final residual = 1.12936e-17, No Iterations 0
So... suggestions?

mad
maddalena is offline   Reply With Quote

Old   October 4, 2010, 06:21
Default
  #33
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Hi,
I opened a new thread on the subject: http://www.cfd-online.com/Forums/ope...flow-rate.html.
However, you are my two gurus on the closed loop pipe flow subject and your opinion is important... What do you think about the approach described there?

mad
maddalena is offline   Reply With Quote

Old   October 11, 2010, 04:08
Default
  #34
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Hello FOAMers,
I need one more suggestion on the turbulence model.
As I said before, for the case I am simulating:
Quote:
Originally Posted by maddalena View Post
low-Re with no wall function are suggested. However, I can use low-Re with wall function for k and epsilon -> nut set as nutLowReWallFunction, k as kqRWallFunction and epsilon as epsilonWallFunction
In order to crosscheck if this is correct, I calculated y+ at the last time step. Since I am using a low-Re + wallFunction, y+ can be y+>1. What I get is:
Code:
Patch 35 named xxx y+ : min: 0.636791 max: 4.52537 average: 1.14473
This is the smallest pipe, which is the one I am interested more. I think that these values can be ok, but not completely sure. May I have your opinion on that?
cheers,

mad
maddalena is offline   Reply With Quote

Old   August 16, 2011, 12:46
Default
  #35
Member
 
Sylvain Aguinaga
Join Date: Feb 2010
Posts: 41
Rep Power: 16
Sylvain is on a distinguished road
Hi everybody,

Nice thread again madalena. I'm currently working on modeling a closed loop circuit with both a fan and a porous zone (actually an heat exchanger).

To do that I used simpleFoam k-omega SST model, a fan BC, and the brand new porousBafflePressure BC. This is something I used to do in Fluent, and I try to do it on OpenFOAM now.

I succeeded in making the whole mesh with SHM and the createBaffle utility (and I'm quite proud of it).

I have ran the simulation with only the fan, worked well except that the wake of the fan didn't converge... but still the flow looks OK. When I added the porous baffle, then it became a mess. The case explodes at the tenth iteration.

From what I have read in your thread i think about many ways of improving my case:

1) maybe switch from simpleFoam to another solver, maybe a transient one like pimpleFoam (this is the solver used for the fan tutorial actually)

2) adjust schemes constants like you did, but i have to admit I'm not comfortable with that, so is it worth playing with it???

3) maybe splitting my case in such a way that my fan is no longer a baffle but a distinct inlet and an outlet with classical inlet/outlet BCs

What do you think about it? I'm wondering if those cases are naturally instables due to the closure of the circuit....

Thanks ahead for your remarks about this subject...

Sylvain
Sylvain is offline   Reply With Quote

Reply

Tags
fan, flowrateinletvelocity, low-re, pipe, simplefoam


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
flow in perforated pipe distributor pertupd ANSYS 0 August 12, 2009 09:36
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 16:57
Flow in a Closed Loop John Collins Main CFD Forum 2 February 27, 2003 11:26
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 10:11
Pulsatile blood flow in closed loops Michael F. Wolf Main CFD Forum 3 July 1, 1999 17:37


All times are GMT -4. The time now is 02:36.