CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Steady vs. Unsteady solution (http://www.cfd-online.com/Forums/openfoam/109496-steady-vs-unsteady-solution.html)

samiam1000 November 19, 2012 09:42

Steady vs. Unsteady solution
 
Dear foamers,

I do have a case and I would like to study both the steady and the unstedy solution.

Something strange happens, since I perfectly get the steady solution, but the unsteady one suddenly diverges.

I think it is a problem in the `controlDict' file, am I right?

Do you have any suggestion for me? Do you need some files in order to help?

Thanks a lot,

Samuele

Lieven November 19, 2012 10:32

It's a bit difficult to tell from the information provided what the cause could be. Therefore:
Which solvers are you using?
How big is the courant number?

Kind regards,

L

samiam1000 November 19, 2012 11:11

I am using bouyantPimpleFoam for the unsteady solution and bouyantSimpleFoam for the steady one.

These are my 2 controlDicts files:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application    buoyantPimpleFoam;

startFrom      latestTime;

startTime      0;

stopAt          endTime;

endTime        5;

deltaT          .001;

writeControl    adjustableRunTime;

writeInterval  .01;

purgeWrite      0;

writeFormat    ascii;

writePrecision  8;

writeCompression off;

timeFormat      general;

timePrecision  8;

runTimeModifiable true;

adjustTimeStep  yes;

maxCo          .75;

functions
{
faceObj1
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");

enabled true;
//outputControl outputTime;
outputInterval 1;

// Output to log&file (true) or to file only
log false;

// Output field values as well
valueOutput false;

// Type of source: patch/faceZone/sampledSurface
source patch;

// if patch or faceZone: name of patch or faceZone
sourceName intake;

// Operation: areaAverage/sum/weightedAverage ...
operation areaAverage;

fields
(
T
);
}

// ************************************************************************* //

and

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application    buoyantSimpleFoam;

startFrom      latestTime;

startTime      0;

stopAt          endTime;

endTime        50000;

deltaT          1;

writeControl    adjustableRunTime;

writeInterval  500;

purgeWrite      0;

writeFormat    ascii;

writePrecision  8;

writeCompression off;

timeFormat      general;

timePrecision  8;


functions
{
faceObj1
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");

enabled true;
outputInterval 1;

log false;

valueOutput false;

source patch;

sourceName intake;

operation areaAverage;

fields
(
T
);
}
}


// ************************************************************************* //


Lieven November 19, 2012 11:52

The controlDict seems fine. Maybe you can lower the maxCo to 0.1 or even lower and see what happens, just to exclude this as possible cause although I doubt this will make a difference.

How do you make the difference between the steady and the unsteady case exactly? Do you use a RANS turbulence model for the former and a LES model for the latter? If you use the same RANS model for both, the transient simulation will in the end result in the same solution as the steady simulation so you can always try the steady solution as initial condition for the transient simulation and see what happens.

Can you should the output of the simulation where the solver starts to diverge?

Regards,

L

samiam1000 November 19, 2012 12:01

Both for the steady and the unsteady simulation, I use the RANSModel (below my turbulenceProperties and RASProperties files):

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "constant";
    object      turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

simulationType  RASModel;


// ************************************************************************* //

and

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "constant";
    object      RASProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

RASModel        realizableKE;

turbulence      on;

printCoeffs    on;


// ************************************************************************* //

I know that it should be the same, both for the steady and unsteady solution.

Just one detail to make the simulation faster (so that I can give more tries): which are good `numbers' for the outer and non-orthogonal correctors? I guess that mine are too big (see below).

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    pcorr
    {
        solver          GAMG;
        tolerance        1e-6;
        relTol          0.1;
        smoother        GaussSeidel;
        nPreSweeps      0;
        nPostSweeps      2;
        cacheAgglomeration on;
        agglomerator    faceAreaPair;
        nCellsInCoarsestLevel 10;
        mergeLevels      1;
    }

    p
    {
        $pcorr
        tolerance        1e-6;
        relTol          0.1;
    }

    pFinal
    {
        $p;
        tolerance        1e-8;
        relTol          0;
    }

    p_rgh
    {
        solver                        GAMG;
        preconditioner                FDIC;
        mergeLevels                1;
        smoother                GaussSeidel;
        agglomerator                faceAreaPair;
        nCellsInCoarsestLevel        100;
        tolerance                1e-06;
        relTol                        0.1;
    }

    p_rghFinal
    {
        solver                        GAMG;
        preconditioner                FDIC;
        mergeLevels                1;
        smoother                GaussSeidel;
        agglomerator                faceAreaPair;
        nCellsInCoarsestLevel        100;
        tolerance                1e-08;
        relTol                        0.01;
    }

    h
    {
        solver          GAMG;
        tolerance      1e-6;
        relTol          0.1;
        smoother        GaussSeidel;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels    1;
    }

    hFinal
    {
        solver          GAMG;
        tolerance      1e-8;
        relTol          0;
        smoother        GaussSeidel;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels    1;
    }

    rho
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance      1e-06;
        relTol          0.1;
    }

    rhoFinal
    {
        solver          PCG;
        preconditioner  DIC;
        tolerance      1e-08;
        relTol          0.1;
    }

    "(U|k|omega|epsilon)"
    {
        solver          PBiCG;
        preconditioner  DILU;
        tolerance      1e-06;
        relTol          0.1;
    }

    "(U|k|omega|epsilon)Final"
    {
        $U;
        tolerance      1e-08;
        relTol          0.01;
    }

    cellDisplacement
    {
        solver          GAMG;
        tolerance      1e-6;
        relTol          0.1;
        smoother        GaussSeidel;
        cacheAgglomeration true;
        nCellsInCoarsestLevel 10;
        agglomerator    faceAreaPair;
        mergeLevels    1;
    }
}

/*
PIMPLE
{
    correctPhi          yes;
    nOuterCorrectors    2;
    nCorrectors        1;
    nNonOrthogonalCorrectors 0;
}
*/

PIMPLE
{
    correctPhi          yes;
    nOuterCorrectors    15;
    nCorrectors        15;
    nNonOrthogonalCorrectors 15;
    pRefCell 0;
    pRefValue 0;
    turbOnFinalIterOnly off;
}

relaxationFactors
{
    fields
    {
        p              0.75;
    }
    equations
    {
        "(U|k|omega|epsilon)"  0.75;
        "(U|k|omega|epsilon)Final" 0.75;
    }
}

cache
{
    grad(U);
}

// ************************************************************************* //

Any idea?

Thanks a lot,

Samuele

Lieven November 19, 2012 12:27

15 is indeed really big. You should be able to see it from the solver output how many you need. 2 or 3 is often recommended but I don't have a lot of experience with this so you might want to check out other sources as well.

Since you're running a transient simulation, I would change the relaxation to 1.0 for all (although this will not help your problem, probably rather the opposite). Did you already try to run the case with the steady state solution as initial condition? Also post the solver output next time, this might tell us something as well...

samiam1000 November 20, 2012 03:57

Here is the error message:
Code:

GAMG:  Solving for p_rgh, Initial residual = 9.8126427e-07, Final residual = 9.8126427e-07, No Iterations 0
GAMG:  Solving for p_rgh, Initial residual = 9.8126427e-07, Final residual = 9.8126427e-07, No Iterations 0
GAMG:  Solving for p_rgh, Initial residual = 9.8126427e-07, Final residual = 9.8126427e-07, No Iterations 0
GAMG:  Solving for p_rgh, Initial residual = 9.8126427e-07, Final residual = 9.8126427e-07, No Iterations 0
GAMG:  Solving for p_rgh, Initial residual = 9.8126427e-07, Final residual = 9.8126427e-07, No Iterations 0
GAMG:  Solving for p_rgh, Initial residual = 9.8126427e-07, Final residual = 9.8126427e-07, No Iterations 0
GAMG:  Solving for p_rgh, Initial residual = 9.8126427e-07, Final residual = 9.8126427e-07, No Iterations 0
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
time step continuity errors : sum local = 8.8716961e-11, global = 5.3886202e-12, cumulative = 5.9161999e-10
DILUPBiCG:  Solving for epsilon, Initial residual = 4.9879372e-05, Final residual = 1.7624722e-07, No Iterations 1
DILUPBiCG:  Solving for k, Initial residual = 4.9399634e-09, Final residual = 4.9399634e-09, No Iterations 0
PIMPLE: iteration 13
DILUPBiCG:  Solving for Ux, Initial residual = 7.5649719e-05, Final residual = 7.8747859e-08, No Iterations 1
DILUPBiCG:  Solving for Uy, Initial residual = 0.00079296071, Final residual = 1.3734134e-06, No Iterations 1
DILUPBiCG:  Solving for Uz, Initial residual = 7.4834995e-05, Final residual = 1.8361278e-07, No Iterations 1
GAMG:  Solving for h, Initial residual = 1.8526266e-06, Final residual = 2.2511875e-08, No Iterations 1
[1] #0  Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
[1] #1  Foam::sigFpe::sigHandler(int) in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
[1] #2  in "/lib/x86_64-linux-gnu/libc.so.6"
[1] #3  Foam::GAMGSolver::scalingFactor(Foam::Field<double>&, Foam::Field<double> const&, Foam::Field<double> const&, Foam::Field<double> const&) const in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
[1] #4  Foam::GAMGSolver::scalingFactor(Foam::Field<double>&, Foam::lduMatrix const&, Foam::Field<double>&, Foam::FieldField<Foam::Field, double> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::Field<double> const&, unsigned char) const in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
[1] #5  Foam::GAMGSolver::Vcycle(Foam::PtrList<Foam::lduMatrix::smoother> const&, Foam::Field<double>&, Foam::Field<double> const&, Foam::Field<double>&, Foam::Field<double>&, Foam::Field<double>&, Foam::PtrList<Foam::Field<double> >&, Foam::PtrList<Foam::Field<double> >&, unsigned char) const in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
[1] #6  Foam::GAMGSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
[1] #7  Foam::fvMatrix<double>::solve(Foam::dictionary const&) in "/opt/openfoam210/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
[1] #8
[1]  in "/opt/openfoam210/platforms/linux64GccDPOpt/bin/buoyantPimpleFoam"
[1] #9  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
[1] #10
[1]  in "/opt/openfoam210/platforms/linux64GccDPOpt/bin/buoyantPimpleFoam"
[slnxepmi05:08113] *** Process received signal ***
[slnxepmi05:08113] Signal: Floating point exception (8)
[slnxepmi05:08113] Signal code:  (-6)

Also, you suggested to
Quote:

Did you already try to run the case with the steady state solution as initial condition?
, but I can't. In fact, my initial condition is the result of a different steady simulation. After changing the topology (a wall - i.e. the door - disappars) I need to study the transient solution.

Thanks a lot,

Samuele


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