CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Simulations with large time steps (high CFL) (https://www.cfd-online.com/Forums/openfoam-solving/123586-simulations-large-time-steps-high-cfl.html)

Joachim September 16, 2013 16:31

Simulations with large time steps (high CFL)
 
Hi everyone!

I have been trying to run simple 2D RANS simulations over an incompressible airfoil, from 0deg to 15deg. I thing I need some help!

Everything works just fine when I use a steady solver. However, things do not work quite so well in time-accurate mode. They work, but the CFL constraint forces me to use a very low time step. Basically, it takes 32,000 time steps for a particle to go from leading edge to trailing edge. Slightly excessive I'd say.

If I use 5 outer correctors in pimpleFoam, the CFL remains more or less steady, around 80 (the value that I want). Still, I am afraid that sooner or later, it will keep on increasing and eventually explode...

Is there any way to run such simulations with larger time-steps, while maintaining spatial and time accuracy? Some colleagues use OverFlow and Fun3D and they have no problem with that.

Thank you very much for your help!

Joachim

Joachim September 17, 2013 13:52

no one?

I can't believe there is no way to run a 2D airfoil in time accurate mode with OpenFOAM... :(

wyldckat September 17, 2013 18:33

Greetings Joachim,

Have you checked OpenFOAM's tutorial "incompressible/pimpleDyMFoam/wingMotion"?

As for the "trick" to not having high CFL is to have a good mesh that doesn't have very small cells in high speed zones.

You can use the Co utility for generating the Courant Number field for your case, so that you can find where the CFL values are higher.
Another thing is to check the mesh statistics given by checkMesh, namely the minimal cell volume.

Best regards,
Bruno

Joachim September 17, 2013 19:54

Thanks wyldckat, :)

However, I do not have much choice in this case, for 2 reasons:

1. The airfoil has a blunt trailing edge. I need really fine cells to properly capture the flow there.

2. A colleague and I are running the same case on both OpenFOAM and Overflow. We are therefore using the same mesh. -> I cannot change it.

It is pretty frustrating! In Overflow and Fun3D, they don't have that issue with the CFL.

akidess September 18, 2013 03:20

Find out what makes Overflow and Fun3D faster. What algorithms do they implement? Are all other settings the same? It wouldn't surprise me if those codes implement algorithms that outperform OpenFOAM in specific cases, and if so you can either stick to using those codes, or if you really need OpenFOAM and the improved performance, implement the algorithms into OpenFOAM.

Joachim September 18, 2013 11:18

Hey!

I would like to check the solver implementation in Overflow and Fun3D, but I can't! I am an international student, and therefore I am not allowed to see the code...that's why I am using OpenFOAM. :D

akidess September 18, 2013 11:30

Even without access to the code you should be able to get everything you need from theory guides or white papers or such.

fredo490 September 18, 2013 11:36

You should be able to find the properties of the algorithm: SIMPLE or PISO, how many correctors, local-time stepping tricks, ... ?

Joachim September 19, 2013 21:00

Actually, I am pretty confused right now. Is the PISO algorithm implemented in OpenFOAM really a PISO algorithm? The solver is supposed to be coupled and not segregated. However, it clearly seems to solve first the momentum equations over the entire domain, and then apply the pressure equation.

If you google "Pressure Velocity Coupling - Hochschule Luzern", you'll find a powerpoint presentation (OF workshop 2010) where two people apparently implemented a "real" PISO algorithm. They were able to run simulations with Courant numbers above 500 without any problem. That is pretty strange. That was three years ago, but the algorithm is still not included in the official version of OF. I am going to contact them directly to see if there was anything wrong with their solver.

Else, it seems that a vector coupled solver was added in the release OF 2.2.0 (http://www.openfoam.org/version2.2.0/matrix-solvers.php). However, I tried to run the cavity case given as an example, while refining the mesh (-> increasing the CFL), and the simulation still diverged for CFL > 1.

fredo490 September 20, 2013 08:35

Be careful when you see presentations like this...

Most of the time, people make those beautiful tries on OF 1.6 ext which is not an official OpenFoam release ! The "extend" project is independent from OpenFoam (2.2 now). The extend version implement whatever they want and even sometimes code that is under copyrights (see the problem OF Ext vs Ansys few months ago). They can do it because it is an opensource project without any "leader" to blame (or to judge).

What you saw in the power point is really attractive but it requires lots of code that was not natively in OF. It requires extra work, extra maintenance and extra files. Moreover, as far as I remember, the way OF works doesn't allow a straight forward coupled algorithm.


To be clear: PISO, SIMPLE and COUPLED are 3 different algorithms. Sometimes you can also see SIMPLEC which is an "consistent" version of SIMPLE.
Basically, SIMPLE solve the equation one by one and use a corrector. PISO is an "improvement" of SIMPLE since it adds a second corrector stage that helps coupling pressure and velocity. COUPLED is another algorithm where pressure and velocity are solved at the same time.

PISO and SIMPLE solves two systems (pressure and velocity) while COUPLED solve a unique system. The biggest problem is that COUPLED uses much more memory and it can be in some cases as slow as PISO if you have a very turbulent flow.

Joachim September 20, 2013 09:07

Oh thank you, I did not know that.

But basically, it means that right now, OpenFOAM does not have any coupled solver and therefore cannot run simulations with arbitrarily large time steps?

fredo490 September 20, 2013 09:13

Yes, that's right ;)

And be careful, some "researchers" would call you crazy if you use a coupled solver with low speed. Indeed, the coupled algorithm was originally designed for high mach problems (Mach > 0.4). It turns out that the algorithm is actually quite efficient for other purposes (low turbulent flow) but people often want to stick to the original use.

Joachim September 20, 2013 09:18

But then, is it actually possible to run subsonic external aerodynamics simulations in OpenFOAM?

I mean, if you have a mesh with roughly y+ = 1 and a free-stream velocity corresponding to M = 0.2 for example. You will immediately get very high CFL, if you use time steps that would be short enough to capture all the unsteadyness of the flow. Still, the calculation will blow up...

Is there any way around this? Is the compressible solver more stable than its incompressible counterpart?

Thanks!

fredo490 September 20, 2013 09:36

Haha, that is a main problem of CFD...

First, you can improve your mesh. On airfoils, you can have area of high velocity but low pressure gradient. Therefore you don't need small cells in this area (wide rectangles should be good, aspect ratio of 40). You can also try to reduce as much as possible the number of cell in your domain.

Second, you can try to play with the number of corrector loops.

Third, you can use some implicit algorithms that allow larger time steps. But be very careful ! An implicit solver with large dt that works (no crash) doesn't mean that your solution is right... In some cases, the solver doesn't crash but still give you inaccurate solution.

Fourth, you can use a steady state solution to initialize your problem.

Fifth, no matter what, you cannot use time steps larger that the frequency of your flow. You can refer to the "Strouhal" number to get an idea of the vortex frequency and then you apply the Nyquist–Shannon sampling theorem.

Joachim September 20, 2013 09:49

Actually, this is my big problem! If I want to have a CFL of 1, the time steps are so small that it takes 32,000 iterations for a particle to go from leading edge to trailing edge. I really need this accuracy in time, but it seems that I don't really have the choice.

I'll get rid of my blunt trailing edge and coarsen the grid then!
Thank you for the recommendations.

fredo490 September 20, 2013 09:53

What is your number of cell ? What is you current time step ?

If you want to get accuracy, you don't really have choice. Any drastic improvement will be made at a cost...

RodriguezFatz October 1, 2014 01:28

Quote:

Originally Posted by fredo490 (Post 452763)
Yes, that's right ;)

And be careful, some "researchers" would call you crazy if you use a coupled solver with low speed. Indeed, the coupled algorithm was originally designed for high mach problems (Mach > 0.4). It turns out that the algorithm is actually quite efficient for other purposes (low turbulent flow) but people often want to stick to the original use.

Fredo and Joachim, I have a question about what you were discussing here.
If this is true, why can Fluent handle arbitrarily large time steps with their "transient simple", which is pretty much the same as pimpleFoam? This is a segregated solver as well. I can run really large time steps (and thus co numbers) in Fluent and with the very same mesh I need to have like 10-20 times smaller time steps in pimpleFoam.

akidess October 1, 2014 03:39

Transient SIMPLE is not like Pimple (Pimple is still basically PISO). The trade-off between SIMPLE and PISO is that you need to apply under-relaxation (yet another tuneable parameter!) and a lot more iterations per time step for convergence using SIMPLE to get the large time steps.

RodriguezFatz October 1, 2014 03:55

I don't really get what you say, sorry. I run Fluent "transient SIMPLE" with 15 Iterations per time step and it is stable. pimpleFoam with 15 it/dt isn't. Both use the same under-relaxation (pressure 0.3, momentum 0.7 and turbulence 0.8) and I tryed to set Openfoam numerics as "Fluentish" as possible.
1) I know PISO isn't SIMPLE, but the two solvers (Fluent and OpenFoam) in my case both use inner iterations with under-relaxation each time step to account for coupling of pressure and velocity.
2) How does the argument hold, that the reason is the segregated solver if both programms use them?

akidess October 1, 2014 05:16

Just because you apply underrelaxation and more iterations does not make your PISO loop (which pimple still is) SIMPLE. You are still comparing two different algorithms which both have their pros and cons.

I couldn't understand the point you were trying to make in 2).

RodriguezFatz October 1, 2014 05:19

My original question was about a discussion in this thread where fredo490 said that OpenFOAM doesn't have a coupled solver and thus can't handle arbitrarily large time steps. But Fluent can handle these time steps without using a coupled solver, so my question was why. Also why isn't there a solver like that in OpenFoam, or is there any way I can tune pimpleFoam for larger time steps?

Also, what I am wondering: PISO, Simple, Simplec, Simpler... they are all more or less the same as I understand them. Just different approximations or some extra loops. But how can that lead to such different behaviour?

olivierG October 1, 2014 05:28

Hello,

Just a bad trick, if you solution don't change to much over time

- try a "compressible" solver instead of incompressible,, even if you don't have much compressible effect => may run faster
- and try with Local Time Stepping (LTS), ex: rhoLTSPimpleFoam instead of pimpleFoam.

in fvSolution
- use "nOuterCorrectors 10" <- 10 or more
with residualControl to the wanted tolerance.

... And always check if the solution is correct ...

But you still can't get as high dT as in Fluent.

regards,
olivier

akidess October 1, 2014 05:39

Phillip, read Jasak's comments on transient SIMPLE here:
http://www.cfd-online.com/OpenFOAM_D...es/1/1807.html

Then have a look at:
http://openfoamwiki.net/index.php/Ma...ransientSimple

Also read more theory on PISO and SIMPLE. It is not as simple as just adding or removing extra loops.

RodriguezFatz October 1, 2014 07:04

Quote:

Originally Posted by akidess (Post 512546)
Also read more theory on PISO and SIMPLE. It is not as simple as just adding or removing extra loops.

Of course, I did. I read in Ferziger, Peric:
"Still another method of this general type is derived by neglecting ui' in the first correction step as in the SIMPLE method but following... it is known as the PISO algorithm"
And in Versteeg, Malalasekera:
"PISO involves one predictor step and two corrector steps and may be seen as an extension of SIMPLE, with a further corrector step to enhance it."

That's why I was stating that all these methods base on more or less the same principle. I am curious why you think they are essentially different (or not "just you", but why they actually are).

akidess October 1, 2014 08:07

Yes, I agree the methods are related, but I don't think that's a strong argument to assume very similar numerical behavior (side-note: similarly, you could argue first and second order time discretization should have the same properties because they only differ by a factor theta).

PISO involves explicit correction steps, which is why your time step ends up being limited. These explicit correction steps are not part of the SIMPLE method.

Another side note - the differences between PISO and SIMPLE grow when looking at compressible flows, as now also the density is updated in a different manner. Issa brings this up in his 1986 paper on the development of PISO.

RodriguezFatz October 1, 2014 09:00

1 Attachment(s)
I still got more questions, I really appreciate your help here!
I am wondering why I get this behaviour in pimpleFoam:
Attachment 34145
You can see that after 24 iterations pimple residuals jump at the last iteration to pretty much the initial value. Why? I thought this must be from under relaxation, which isn't done in the last iteration. But I then set relaxation factors to
Code:

relaxationFactors
{
    fields
    {
        p                0.8;
    }
    equations
    {
        "(U)"            0.7;
        "(k)"            0.8;
        "(epsilon)"      0.8;
        "(omega)"        0.8;
    }
}

So there is nearly no under relaxation. Why are the iterations 24 and 25 so different? Do you think it will still come from this? And why is it so high?
This is the log output:
Code:

PIMPLE: iteration 23
DILUPBiCG:  Solving for Ux, Initial residual = 1.679199e-06, Final residual = 5.2347394e-09, No Iterations 2
DILUPBiCG:  Solving for Uy, Initial residual = 2.1944388e-05, Final residual = 1.8097067e-07, No Iterations 2
DILUPBiCG:  Solving for Uz, Initial residual = 4.1885199e-05, Final residual = 1.8273755e-07, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.0034921225, Final residual = 0.00032813228, No Iterations 1
time step continuity errors : sum local = 1.3572061e-08, global = 1.4769898e-11, cumulative = 2.9324676e-09
GAMG:  Solving for p, Initial residual = 0.0012103037, Final residual = 0.00011895051, No Iterations 3
time step continuity errors : sum local = 4.9195925e-09, global = 7.4839779e-11, cumulative = 3.0073074e-09
DILUPBiCG:  Solving for epsilon, Initial residual = 1.0191608e-05, Final residual = 8.6961352e-08, No Iterations 2
DILUPBiCG:  Solving for k, Initial residual = 1.9168529e-06, Final residual = 9.0455142e-09, No Iterations 5
PIMPLE: iteration 24
DILUPBiCG:  Solving for Ux, Initial residual = 1.6236176e-06, Final residual = 5.5279907e-09, No Iterations 2
DILUPBiCG:  Solving for Uy, Initial residual = 2.1084076e-05, Final residual = 1.7394592e-07, No Iterations 2
DILUPBiCG:  Solving for Uz, Initial residual = 4.0269511e-05, Final residual = 1.4442665e-07, No Iterations 2
GAMG:  Solving for p, Initial residual = 0.0033965334, Final residual = 0.00033571154, No Iterations 1
time step continuity errors : sum local = 1.3884555e-08, global = 4.8871526e-12, cumulative = 3.0121945e-09
GAMG:  Solving for p, Initial residual = 0.0012140916, Final residual = 0.00010521305, No Iterations 4
time step continuity errors : sum local = 4.3514973e-09, global = 8.6495586e-11, cumulative = 3.0986901e-09
DILUPBiCG:  Solving for epsilon, Initial residual = 9.9529664e-06, Final residual = 8.4810541e-08, No Iterations 2
DILUPBiCG:  Solving for k, Initial residual = 1.8475951e-06, Final residual = 5.5701423e-09, No Iterations 4
PIMPLE: iteration 25
DILUPBiCG:  Solving for Ux, Initial residual = 2.7349049e-06, Final residual = 2.3595166e-08, No Iterations 7
DILUPBiCG:  Solving for Uy, Initial residual = 4.7743527e-05, Final residual = 3.7953704e-07, No Iterations 7
DILUPBiCG:  Solving for Uz, Initial residual = 9.2807878e-05, Final residual = 6.4070125e-07, No Iterations 9
GAMG:  Solving for p, Initial residual = 0.2261028, Final residual = 0.020367173, No Iterations 3
time step continuity errors : sum local = 1.0216869e-06, global = -2.317465e-08, cumulative = -2.007596e-08
GAMG:  Solving for p, Initial residual = 0.065461729, Final residual = 0.0063586886, No Iterations 4
time step continuity errors : sum local = 2.6827385e-07, global = -4.9828708e-08, cumulative = -6.9904668e-08
DILUPBiCG:  Solving for epsilon, Initial residual = 3.4064378e-05, Final residual = 3.3123049e-07, No Iterations 5
DILUPBiCG:  Solving for k, Initial residual = 5.9163051e-06, Final residual = 3.2299708e-08, No Iterations 8
PIMPLE: not converged within 25 iterations


akidess October 1, 2014 10:03

I don't really use the pimple solver, so I can only guess. To me it looks like while your solution seems to be ok with the relaxation, the final result in iteration 24 is still not a great initial guess for a solution without underrelaxation. Thus in iteration 25, where no relaxation is applied, things break down. Hope someone with more experience with pimple chimes in too.

be_inspired March 20, 2015 08:53

Would it be possible to use OF3.1-ext for pimpleDyMFoam to achieve higher CFL? That is, an overal implicit approach.
I am trying to simulate a wind turbine with 3 blades. The mesh just at trailing edge is really small so the time step should be really low to match a CFL=1.
For perfom 1 iteration per 1 degree of rotation, the max CFL is around 700 while the average is around 0.007.
For CFL=1, the simulation time maybe could last 2 months...

be_inspired March 23, 2015 10:02

transientSimpleDyMFoam
 
What about transientSimpleDyMFoam solver?
What are the diferences wrt pimpleDyMFoam?

wyldckat March 28, 2015 15:59

Greetings be_inspired,

For some details about "transientSimpleFoam": http://openfoamwiki.net/index.php/Ma...ransientSimple

As for using a CFL higher than 0.5 or 1:
Best regards,
Bruno


All times are GMT -4. The time now is 17:43.