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/)
-   -   residual = nan on iteration 1 with rhoSimpleFoam (https://www.cfd-online.com/Forums/openfoam-solving/159820-residual-nan-iteration-1-rhosimplefoam.html)

me3840 September 23, 2015 23:46

residual = nan on iteration 1 with rhoSimpleFoam
 
Hello folks,

First try using rhoSimpleFoam here. Haven't really done much compressible flow in OpenFOAM before. I have a very simple case of a sphere in a tube. The mesh is about 500k cells and passes all meshCheck just fine.

My BCs are all very simple (trying to keep it that way the first time). I have:
Inlet (U fixed value, T fixed value, zero grad else)
Outlet (p fixed value, zero grad else)
and the walls (walls and sphere) which are all set to 0/zeroGradient.

However, it seems on my first iteration, all of the residuals are nan's and it crashes very quickly:


Time = 1

GAMG: Solving for Ux, Initial residual = nan, Final residual = nan, No Iterations 1000
GAMG: Solving for Uy, Initial residual = nan, Final residual = nan, No Iterations 1000
GAMG: Solving for Uz, Initial residual = nan, Final residual = nan, No Iterations 1000
smoothSolver: Solving for e, Initial residual = nan, Final residual = nan, No Iterations 1000
GAMG: Solving for p, Initial residual = nan, Final residual = nan, No Iterations 1000
time step continuity errors : sum local = nan, global = nan, cumulative = nan
rho max/min : 0.025 0.025
GAMG: Solving for omega, Initial residual = nan, Final residual = nan, No Iterations 1000
GAMG: Solving for k, Initial residual = nan, Final residual = nan, No Iterations 1000
ExecutionTime = 389.481 s ClockTime = 389 s


I can't seem to figure out why. Did I miss something in my BCs?
I set pRefValue manually to be 101325 Pa, so my other BCs and initial condition pressure should be gauge to that.

It says that the rho max/min is 0.025 - but the min and max limiter is 0.5 and 1.5, how did it get that low? This is almost STP...

There is a defaultFaces patch, but this is just left over from blockMesh and has zero faces, so I shouldn't need to worry about it, right?

Here's some of my files:
Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 1 -1 0 0 0 0];

internalField  uniform (20 0 0);

boundaryField
{
    defaultFaces
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }
        inlet
    {
        type            fixedValue;
        value          uniform (20 0 0);
    }
        outlet
    {
        type            zeroGradient;
    }
        wall
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }
        sphere
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }
 
}

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [1 -1 -2 0 0 0 0];

internalField  uniform 0;

boundaryField
{
    defaultFaces
    {
        type            zeroGradient;
    }
        inlet
    {
        type            zeroGradient;
    }
        outlet
    {
        type            fixedValue;
                value                        uniform 0;
    }
        wall
    {
        type            zeroGradient;
    }
        sphere
    {
        type            zeroGradient;
    }

}

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      volScalarField;
    object      T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 1 0 0 0];

internalField  uniform 300;

boundaryField
{

    defaultFaces
    {
        type            zeroGradient;
    }
        inlet
    {
        type            fixedValue;
        value          uniform 300;
    }
        outlet
    {
        type            zeroGradient;
    }
        wall
    {
        type            zeroGradient;
    }
        sphere
    {
        type            zeroGradient;
    }

}

Code:

dimensions      [ 0 2 -2 0 0 0 0 ];

internalField  uniform 22.815;

boundaryField
{
    defaultFaces
    {
        type            compressible::kqRWallFunction;
        value          uniform 0;
    }
        inlet
    {
        type            fixedValue;
        value          uniform 22.815;
    }
        outlet
    {
        type            fixedValue;
        value          uniform 22.815;
    }
        wall
    {
        type            compressible::kqRWallFunction;
        value          uniform 0;
    }
        sphere
    {
        type            compressible::kqRWallFunction;
        value          uniform 0;
    }


}

Code:

dimensions      [ 0 0 -1 0 0 0 0 ];

internalField  uniform 477.26;

boundaryField
{
    defaultFaces
    {
        type            compressible::omegaWallFunction;
        value          uniform 0;
    }
        inlet
    {
        type            fixedValue;
        value          uniform 477.76;
    }
        outlet
    {
        type            fixedValue;
        value          uniform 477.76;
    }
        wall
    {
        type            compressible::omegaWallFunction;
        value          uniform 0;
    }
        sphere
    {
        type            compressible::omegaWallFunction;
        value          uniform 0;
    }


}

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
    default        steadyState;
}

gradSchemes
{
    default        Gauss linear;
}

divSchemes
{
    default        none;
    div(phi,U)      bounded Gauss linearUpwindV Gauss linear;
    div((muEff*dev2(T(grad(U))))) Gauss linear Gauss linear;
    div(phi,omega) bounded Gauss linearUpwind Gauss linear;
    div(phi,k)      bounded Gauss linearUpwind Gauss linear;
    div(phi,Ekp)    bounded Gauss linearUpwind Gauss linear;
        div(phi,e)    bounded Gauss linearUpwind Gauss linear;
}

laplacianSchemes
{
    default        Gauss linear corrected;
}

interpolationSchemes
{
    default        linear;
}

snGradSchemes
{
    default        corrected;
}

fluxRequired
{
    default        no;
    p              ;
}

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    p
    {
        solver          GAMG;
        tolerance      1e-08;
        relTol          0.05;
        smoother        GaussSeidel;
        cacheAgglomeration on;
        nCellsInCoarsestLevel 20;
        agglomerator    faceAreaPair;
        mergeLevels    1;
    }

    U
    {
        solver          GAMG;
        tolerance      1e-08;
        relTol          0.05;
        smoother        GaussSeidel;
        cacheAgglomeration on;
        nCellsInCoarsestLevel 20;
        agglomerator    faceAreaPair;
        mergeLevels    1;
    }

    e
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        tolerance      1e-06;
        relTol          0.1;
    }

    "(k|omega)"
    {
        $U;
        tolerance      1e-07;
        relTol          0.1;
    }
}

SIMPLE
{
    nNonOrthogonalCorrectors 0;
    rhoMin          rhoMin [ 1 -3 0 0 0 ] 0.5;
    rhoMax          rhoMax [ 1 -3 0 0 0 ] 1.5;
        pRefPoint (-4.9 0 0);
        pRefValue 101325;
    residualControl
    {
        p              1e-2;
        U              1e-4;
        e              1e-3;

        // possibly check turbulence fields
        "(k|epsilon|omega)" 1e-3;
    }
}

relaxationFactors
{
    fields
    {
        p              0.3;
        rho            0.05;
    }
    equations
    {
        U              0.7;
        "(k|omega)"  0.7;
        e              0.5;
    }
}


me3840 September 25, 2015 10:55

Nobody with any clues? Hm. I was going to try and see if I can get it to run in just a pipe.

jurich September 27, 2015 21:25

Hello,

I've always run rhoSimpleFoam using absolute pressures.

I don't think pRefValue works the way you describe using it. See this thread http://www.cfd-online.com/Forums/ope...prefvalue.html, section 4.5.3.1 of the user guide, and src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C; it seems to set the pressure level in one cell only.


All times are GMT -4. The time now is 23:24.