[[Image:Doppelbogen-plastics-pressure.png|thumb|left|Velocity with advection]]

+

[[Image:Doppelbogen-plastics-pressure.png|thumb|left|Pressure with advection]]

-

[[Image:Doppelbogen-plastics-pressure-without-advection.png|thumb|left|Velocity without advection]]

+

[[Image:Doppelbogen-plastics-pressure-without-advection.png|thumb|left|Pressure without advection]]

The pressure difference inlet to outlet is about 24 (fluid domain dimension) without advection but 340 with advection. Unlike most other pictures of this geometry shown, the pressure scaling in -1 to 200 here.

The pressure difference inlet to outlet is about 24 (fluid domain dimension) without advection but 340 with advection. Unlike most other pictures of this geometry shown, the pressure scaling in -1 to 200 here.

Revision as of 10:57, 10 February 2008

Often, you're not particularly interested in how a flow or stream develops over time, but only how the constant flow behaves if it exists long enough to have all initial reactions and changes settled. While Gerris isn't optimised for such calculations, a few simplifications and speed-ups exist.

To give the removal of advection evidence, I've run the example from An engineer's pipe flow with the viscosity of water (Re = 2485) and up to time t = 1.0 (with advection it "explodes" at about t = 1.49) with and without advection:

Velocity with advection

Velocity without advection

At a Reynolds number of 2485, there are big differences, as expected. The calculation time drops from 4500 seconds to 80 seconds, but this speed-up is useless as results are plain wrong.

So I did again with a Reynolds number of 0.1 (by pipe diameter):

Velocity with advection

Velocity without advection

As you can easily spot looking at velocities, the difference is still very significant. Both pictures use the same scaling.

Pressure with advection

Pressure without advection

The pressure difference inlet to outlet is about 24 (fluid domain dimension) without advection but 340 with advection. Unlike most other pictures of this geometry shown, the pressure scaling in -1 to 200 here.

It pretty much looks like advection is needed for all but extreme cases.

End the simulation when the state is steady

In the same mailing list thread, Stéphane Popinet shows how to stop simulation as soon as a steady state is reached. This optimisation won't decrease computing time of the simulation, but will end it automatically without watching you how the flow develops.

In your calculation script, remove the end time and insert an GfsEventStop. The result could look like this:

to watch this variable and how the velocity changes get fewer and fewer from step to step.

With this optimisation the simulation stops at a fluid domain time of 7.8 or a CPU time of 540 seconds and the results should be within a 1% accuracy of what you can reach.

Nota Bene: It's a simulation after all and if a simulation would fit reality within a 1% accuracy, this would be stunning.

Pause

The above is wrong. GfsEventStop didn't stop the simulation at all. Because advection was turned off? The Couette flow script isn't a good measure as this simulation has a second stop condition (iend=100).

Using a different solver

The third point Stéphane made in this thread belongs to the type of solver. He writes:

Also for Stokes flows, you probably want to use the fully-implicit diffusion solver to avoid potential oscillations in time in the solution which can appear when using the default Crank-Nicholson diffusion solver. This decreases the time-accuracy from second-order to first-order but it doesn't matter since you are looking for a steady solution.

Lacking time accuracy should have no influence on steady-state flows of higher Reynolds numbers either. Again, it's a simple change. Add a beta = 1 term to your GfsSourceViscosity line, e.g.:

For comparison, I've run my favourite example with a Reynolds number of 2485 (water at 0.5 m/s) with both solvers:

Crank-Nicholsen solver

Fully-implicit solver

Wall clock time needed for the calculation is the same within few seconds (of about 4500 seconds). Results are the same within 2% accuracy. The time-accurate version appears to have a slightly lower Reynolds number.

It looks like the fully implicit solver doesn't change anything in normal situations. Nonetheless, it might help in some border cases.