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/)
-   -   About interFoam (https://www.cfd-online.com/Forums/openfoam-solving/187667-about-interfoam.html)

Lookid May 12, 2017 04:55

About interFoam
 
Hi,

I'm using interFoam to observe the filling of an injection-molded piece.
I ran the simulation to my case and changed boundary conditions.
Case is still laminar due to high viscosity, 0.1 Pa.s
I let fvSolution the same as the damBreak tutorial, and just changed Co to 2 in controlDict.

Ran the simulation for 12h and got this :
https://drive.google.com/file/d/0B3B...ZsZWNxbzg/view

I also used an inlet velocity of 0.5m/s instead of 2m/s to have an higher timestep (for a first try).

So my goal is to reduce computational time.

First, what's the point of momentumPredictor in fvSolution ? It's set to 'no' in every interFoam tutorials.

Then, I think the idea to reduce computational is to use PIMPLE like it's clearly explained here :
https://www.researchgate.net/profile...-OpenFOAMR.pdf p.111 to 134

So fix a dt = 1e-4 for example, and run the simulation.

Here's fvSolution :

Code:

PIMPLE
{
    momentumPredictor  no;
    nOuterCorrectors    100;
    nCorrectors        2;
    nNonOrthogonalCorrectors 0;

    residualControl
    {
        p
        {
            tolerance 1e-4;
            relTol 0;
        }
    }
}

relaxationFactors
{
    fields
    {
        p                  0.4;
        pFinal                1;
    }
    equations
    {
        ".*" 1;
    }
}

Actually I don't really know what I'm doing here, and the solver is acting weird :
Code:

PIMPLE: iteration 5
DICPCG:  Solving for p_rgh, Initial residual = 0.00035798, Final residual = 1.49185e-05, No Iterations 8
smoothSolver:  Solving for alpha.water, Initial residual = 0.0572634, Final residual = 8.69432e-11, No Iterations 3
Phase-1 volume fraction = 2.78028e-05  Min(alpha.water) = 0  Max(alpha.water) = 1
time step continuity errors : sum local = 1.71275e-06, global = 2.04751e-07, cumulative = 2.84596e-06
MULES: Correcting alpha.water
DICPCG:  Solving for p_rgh, Initial residual = 9.61138e-05, Final residual = 4.77129e-06, No Iterations 23
MULES: Correcting alpha.water
time step continuity errors : sum local = 5.67374e-07, global = 1.66609e-07, cumulative = 3.01257e-06
PIMPLE: iteration 5
DICPCG:  Solving for p_rgh, Initial residual = 0.00035798, Final residual = 1.49185e-05, No Iterations 8
Phase-1 volume fraction = 2.78028e-05  Min(alpha.water) = 0  Max(alpha.water) = 1
smoothSolver:  Solving for alpha.water, Initial residual = 0.0572634, Final residual = 8.69432e-11, No Iterations 3
Phase-1 volume fraction = 2.78028e-05  Min(alpha.water) = 0  Max(alpha.water) = 1
DICPCG:  Solving for p_rgh, Initial residual = 9.61138e-05, Final residual = 4.77129e-06, No Iterations 23
time step continuity errors : sum local = 1.71275e-06, global = 2.04751e-07, cumulative = 2.84596e-06
MULES: Correcting alpha.water
time step continuity errors : sum local = 5.67374e-07, global = 1.66609e-07, cumulative = 3.01257e-06
PIMPLE: iteration 5
smoothSolver:  Solving for alpha.water, Initial residual = 0.0572634, Final residual = 8.69432e-11, No Iterations 3
Phase-1 volume fraction = 2.78028e-05  Min(alpha.water) = 0  Max(alpha.water) = 1
MULES: Correcting alpha.water
Phase-1 volume fraction = 2.78028e-05  Min(alpha.water) = 0  Max(alpha.water) = 1
MULES: Correcting alpha.water
DICPCG:  Solving for p_rgh, Initial residual = 9.61138e-05, Final residual = 4.77129e-06, No Iterations 23
time step continuity errors : sum local = 5.67374e-07, global = 1.66609e-07, cumulative = 3.01257e-06
PIMPLE: iteration 5
MULES: Correcting alpha.water
DICPCG:  Solving for p_rgh, Initial residual = 0.000169515, Final residual = 7.36703e-06, No Iterations 10
smoothSolver:  Solving for alpha.water, Initial residual = 0.0572634, Final residual = 8.69432e-11, No Iterations 3
Phase-1 volume fraction = 2.78028e-05  Min(alpha.water) = 0  Max(alpha.water) = 1
Phase-1 volume fraction = 2.78028e-05  Min(alpha.water) = 0  Max(alpha.water) = 1
time step continuity errors : sum local = 8.71585e-07, global = 1.58682e-07, cumulative = 3.17125e-06
MULES: Correcting alpha.water
MULES: Correcting alpha.water
Phase-1 volume fraction = 2.78028e-05  Min(alpha.water) = 0  Max(alpha.water) = 1
DICPCG:  Solving for p_rgh, Initial residual = 6.56967e-05, Final residual = 3.25154e-06, No Iterations 15
DICPCG:  Solving for p_rgh, Initial residual = 0.000169515, Final residual = 7.36703e-06, No Iterations 10
time step continuity errors : sum local = 3.88283e-07, global = 1.43527e-07, cumulative = 3.31478e-06

EDIT : Ow this is because 4 processor that there's 4 PIMPLE iteration, so it's not wierd

If there's a way to optimize computational time I'd be glad to know how to

alexeym May 12, 2017 09:58

As you can see in output, you do not solve for p, you solve for p_rgh. So

Code:

    residualControl
    {
        p
        {
            tolerance 1e-4;
            relTol 0;
        }
    }

is not used (and you PIMPLE loop goes till 100 iterations, or at least should go).

relaxationFactors are also a little bit strange.

Lookid May 12, 2017 10:35

Hello again alexeym :p,

Yes right.

About relaxationFactors, how are you supposed to chose them ? I just put random values actually

alexeym May 12, 2017 14:05

Hi,

In general, people agree on the following:

- There should be no relaxation on final iteration. This can be achieved by setting relaxation factor to 1 or just removing relaxation factor from dictionary (faster variant).

- There are several mentions in presentations, that for optimal performance sum of relaxation factor for U equation and for p field should be 1.

- For PISO (or PIMPLE), in general, there is no need in relaxation.

So you start from no relaxation, if your solution diverges, you add relaxation for diverging equations. BUT relaxation is not a solution for incorrectly posed BCs.

Momentum predictor can be useful in certain problems. Though it introduces solution of additional equation, and seems to increase computation time, this step can improve convergence in pressure, so finally simulation with momentum predictor could run faster, than one without it.

And finally not only PIMPLE settings affect computation speed (in fact, PIMPLE dictionary is the last place to go, to improve speed). Mesh and linear solver settings have greater influence.

Lookid May 13, 2017 06:00

Quote:

Originally Posted by alexeym (Post 648680)
- For PISO (or PIMPLE), in general, there is no need in relaxation.

Ah ? quoting this book, p.128 :
https://www.researchgate.net/profile...-OpenFOAMR.pdf

Quote:

To make the PIMPLE algorithm work fine, stable and more robust, we
have to think about the SIMPLE method (outer correction loop). As we already
mentioned in section 11.1, the method is not consistent and hence, we are forced to
use the under-relaxation technique; note that under-relaxation is not always necessary
especially for Co < 1 and non-stiff problems.
And the goal here is to have higher timestep, so higher Co.

My mesh is already quite coarse, I can't reduce its size.

I don't know if I'll mange to improve the calculation time, but I'd like to understand better how things work.

alexeym May 13, 2017 09:51

OK. Let's wait for Herr Holzmann (aka Tobi), at least he can comment on his PDF.

Here are little comments on mesh and Courant number.

1. I used mesh in terms of mesh quality, not resolution. You can have two meshes with the same resolution and same shape, one perfectly orthogonal and another with high degree of non-orthogonality. Calculation on the highly non-orthogonal mesh will be rather slow and unpleasant thing.

2. Your aims are not quite clear. You need to reduce computation time or you need to get meaningful results? In the first case go with upwind schemes, use high Courant number, increase value of tolerances for linear solvers, increase value for convergence residuals. You will obtain certain results. Can we trust them? I doubt.

Lookid May 13, 2017 11:18

Quote:

Originally Posted by alexeym (Post 648749)
1. I used mesh in terms of mesh quality, not resolution. You can have two meshes with the same resolution and same shape, one perfectly orthogonal and another with high degree of non-orthogonality. Calculation on the highly non-orthogonal mesh will be rather slow and unpleasant thing.

2. Your aims are not quite clear. You need to reduce computation time or you need to get meaningful results?

1. Yes, I tried my best with sHM to have the least non-orthogonality possible and homogeneous mesh to avoid a very small cell that would explode the Co.
Question about this, let's imagine you have a perfect orthogonal mesh with one cell that is 100 times smaller than the others, Co will be based on the small one, right ? So using a high Co in this case may lead to good results.

2. Both :p. For the purpose I have now, the goal is just to have an idea of how the flow is propagating, so I'll try with your tips next week to reduce computation time and see if I obtain different results


All times are GMT -4. The time now is 10:28.