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/)
-   -   Running rhoSimpleFoam for Pressure Driven Flow (https://www.cfd-online.com/Forums/openfoam-solving/205595-running-rhosimplefoam-pressure-driven-flow.html)

y_jiang August 21, 2018 14:53

Running rhoSimpleFoam for Pressure Driven Flow
 
Hello everyone,


I am running rhoSimpleFoam for a pressure driven flow model. The model is a tank with fixed wall temperature and cooler air with room temperature is blown into the tank. The inlet and outlet pressure are 9 and 6 bar. I use kEpsilon model and wallfunction for this model. The mesh was generated by snappyHexMesh.

But I got the following error in 11th iteration. Does anyone have idea on what this message refer to?


The BCs and fvScheme and fvSolution are shown below. Thank you in advance for your help!



Time = 11

GAMG: Solving for Ux, Initial residual = 0.04648656, Final residual = 7.246233e-05, No Iterations 1
GAMG: Solving for Uy, Initial residual = 0.04807173, Final residual = 5.169749e-05, No Iterations 1
GAMG: Solving for Uz, Initial residual = 0.02602888, Final residual = 1.604139e-05, No Iterations 1
GAMG: Solving for e, Initial residual = 0.02056888, Final residual = 0.0001085386, No Iterations 1
#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam::hePsiThermo<Foam::psiThermo, Foam::pureMixture<Foam::sutherlandTransport<Foam:: species::thermo<Foam::hConstThermo<Foam::perfectGa s<Foam::specie> >, Foam::sensibleInternalEnergy> > > >::calculate() at ??:?
#4 Foam::hePsiThermo<Foam::psiThermo, Foam::pureMixture<Foam::sutherlandTransport<Foam:: species::thermo<Foam::hConstThermo<Foam::perfectGa s<Foam::specie> >, Foam::sensibleInternalEnergy> > > >::correct() at ??:?
#5 ? in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/rhoSimpleFoam"
#6 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7 ? in "/opt/openfoam5/platforms/linux64GccDPInt32Opt/bin/rhoSimpleFoam"
~
Code:

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

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

internalField  uniform 0;

boundaryField
{
    defaultFaces
    {
        type            empty;
    }

    tankfull_inlet
    {
        type            calculated;
        value          uniform 0;
    }

    tankfull_outlet
    {
        type            calculated;
        value          uniform 0;
    }

    tankfull_needle
    {
        type          compressible::alphatWallFunction;
        Prt            0.85;
        value          uniform 0;
    }

    tankfull_tank
    {
        type            compressible::alphatWallFunction;
        Prt            0.85;
        value          uniform 0;
    }
}


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

Code:

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

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

internalField  uniform 65000;

boundaryField
{
    defaultFaces
    {
        type          empty;
    }

    tankfull_inlet
    {
      type            turbulentMixingLengthDissipationRateInlet;
      mixingLength    0.005;
      value            uniform 0.0028;
    }

    tankfull_outlet
    {
        type            zeroGradient;
    }

    tankfull_needle
    {
        type            epsilonWallFunction;
        Cmu            0.09;
        kappa          0.41;
        E              9.8;
        value          uniform 65000;
    }

    tankfull_tank
    {
        type            epsilonWallFunction;
        Cmu            0.09;
        kappa          0.41;
        E              9.8;
        value          uniform 65000;
    }

}

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

Code:

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

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

internalField  uniform 85;

boundaryField
{
    defaultFaces
    {
        type        empty;
    }

    tankfull_inlet
    {
        type            turbulentIntensityKineticEnergyInlet;
        intensity        0.05;
        value            uniform 0.0028;
    }

    tankfull_outlet
    {
        type            zeroGradient;
    }

    tankfull_needle
    {
        type            kqRWallFunction;
        value          uniform 85;
    }

    tankfull_tank
    {
        type            kqRWallFunction;
        value          uniform 2;
    }

}

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

Code:

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

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

internalField  uniform 0;

boundaryField
{
    defaultFaces
    {
        type            empty;
    }

    tankfull_inlet
    {
        type            calculated;
        value          uniform 0;
    }

    tankfull_outlet
    {
        type            calculated;
        value          uniform 0;
    }

    tankfull_needle
    {
        type            nutkWallFunction;
        Cmu            0.09;
        kappa          0.41;
        E              9.8;
        value          uniform 0;
    }

    tankfull_tank
    {
        type            nutkWallFunction;
        Cmu            0.09;
        kappa          0.41;
        E              9.8;
        value          uniform 0;
    }

}

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

Code:

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

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

internalField  uniform 800000;

boundaryField
{
    defaultFaces
    {
        type          empty;
    }

    tankfull_inlet
    {
        type            fixedValue;
        value          uniform 900000;
    }

    tankfull_outlet
    {
        type            fixedValue;
        value          uniform 600000;
    }

    tankfull_needle
    {
        type            zeroGradient;
    }

    tankfull_tank
    {
        type            zeroGradient;
    }

}

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

Code:

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

dimensions      [0 0 0 1 0 0 0];

internalField  uniform 383.0;

boundaryField
{
    defaultFaces
    {
        type          empty;
    }

    tankfull_inlet
    {
        type            fixedValue;
        value          uniform 293.0;
    }

    tankfull_outlet
    {
        type            inletOutlet;
        value          uniform 293.0;
        inletValue      uniform 293.0;
    }

    tankfull_needle
    {
        type            zeroGradient;
    }

    tankfull_tank
    {
        type            fixedValue;
        value          uniform 473.0;
    }
}

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

Code:

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

//Uinlet          (10 0 0);

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

internalField  uniform (0 0 0);

boundaryField
{
    defaultFaces
    {
        type          empty;
    }

    tankfull_inlet
    {
        type            pressureInletOutletVelocity;
        value          uniform (0 0 0);
    }

    tankfull_outlet
    {
        type            pressureInletOutletVelocity;
        value          uniform (0 0 0);
    }

    tankfull_needle
    {

        type          fixedValue;
        value          uniform (0 0 0);
    }

    tankfull_tank
    {
        type          fixedValue;
        value          uniform (0 0 0);
    }

}

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

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  5                                    |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
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 upwind;
    div(((rho*nuEff)*dev2(T(grad(U)))))      Gauss linear;
    div(phi,e)          bounded Gauss upwind;
    div(phi,epsilon)    bounded Gauss upwind;
    div(phi,k)          bounded Gauss upwind;

    div(phid,p)        Gauss upwind;
    div(phi,Ekp)        bounded Gauss upwind;
    div((phi|interpolate(rho)),p)  Gauss upwind;
}

laplacianSchemes
{
    default        Gauss linear corrected;
}

interpolationSchemes
{
    default        linear;
}

snGradSchemes
{
    default        corrected;
}


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

Code:

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

solvers
{
    p
    {
        solver          GAMG;
        tolerance      1e-08;
        relTol          0.1;
        smoother        GaussSeidel;
        nCellsInCoarsestLevel 20;
    }

    "(U|e|k|epsilon)"
    {
        solver          GAMG;
        tolerance      1e-08;
        relTol          0.1;
        smoother        GaussSeidel;
        nCellsInCoarsestLevel 20;
    }
}

SIMPLE
{
    nNonOrthogonalCorrectors 0;
    pMinFactor      0.1;
    pMaxFactor      2;
    transonic      yes;
    consistent      yes;

    residualControl
    {
        p              1e-3;
        U              1e-3;
        e              1e-3;

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

relaxationFactors
{
    fields
    {
        p              0.7;
    }
    equations
    {
        p              0.7;
        U              0.3;
        e              0.6;
        k              0.6;
        epsilon        0.6;

    }
}

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


kishpishar August 23, 2018 09:55

Hi,


I am not quite sure you can simulate a pressure driven flow in OF using fixedValue bc on both inlet and outlet. At least in incompressible cases, this will result in very unstable runs and you don't get the desired effect. Pl. try totalPressure for the inlet and fixedValue for the outlet and see how the calculation proceeds.


-kumar

y_jiang August 24, 2018 08:56

Hi Kumar,

Thanks for your iinput. rhoSimpleFoam is for compressible flow only. I tried replacing fixedValue by totalPressure but still got the same error.

piu58 August 24, 2018 10:56

From my experiences, using two pressure levels as b.c. is not a good idea. It sounds physical plausible but leads to numerical problems. The most stable b.c. are a flow inlet and a zero gradient pressure for outflow. You may try this and adjust the inflow until the indented pressure difference will be reached.

kishpishar August 27, 2018 02:42

Hi Uwe - you are right that the most stable inlet/outlet combination is a velocity inlet (or mass flow inlet in compressible flows) and a fixedValue pressure for outlet. The inflow can be adjusted till it matches the desired pressure drop.



Works perfectly fine for single inlet/outlet geometries. What if the configuration has, say, a single outlet and multiple inlets where only the pressure is known?

ano August 27, 2018 05:57

Dear Yijiu Jiang,

The error message is a floating point exception in your thermodynamic model, most probably at some location your temperature or density is zero or below zero. This could be due to a negative pressure at this location. And this should be due to incorrect boundary conditions (or divergence due to wrong solver settings).

For compressible flow it is possible to set a fixed or total pressure boundary conditions in rhoCentralFoam, however, rhoCentralFoam is not very suitable for turbulence. rhoSimpleFoam and rhoPimpleFoam are just extensions of the incompressible solver and normally not used with fixed inlet and oulet pressures at the same time. So the first questions would be whether you use the correct solver:
1. Which Mach number do you expect in your flow? Do you expect shocks? Do you expect transsonic flow?
2. Which Reynolds number do you expect?

From your pressure ratio I would expect Mach number below 1, but that depends also on the geometry. In that case it is better to use rhoSimpleFoam or rhoPimpleFoam and as the others already pointed out to have one zeroGradient pressure condition either at the inlet or outlet. The solvers are for compressible flow, but they are still based on the SIMPLE pressure-velocity coupling, which comes from incompressible flow and yields that not the value of the pressure, but the pressure gradient determines the flow field. One fixed pressure is ok, but if you have two fixed pressure values, it destroys the solution of your pressure gradient field.

It could also be that you have Mach numbers below 0.3, in which case it would be even better to try buoyantPimpleFoam.

y_jiang August 27, 2018 17:02

Quote:

Originally Posted by piu58 (Post 703817)
From my experiences, using two pressure levels as b.c. is not a good idea. It sounds physical plausible but leads to numerical problems. The most stable b.c. are a flow inlet and a zero gradient pressure for outflow. You may try this and adjust the inflow until the indented pressure difference will be reached.


Hello Uwe,


Thank you so much for your reply and idea. By following your advice, I changed the BCs to the combination of flowRateInletVelocity inlet and zeroGradient pressure for inlet and fixedValue for the outlet which is same as the BCs used in the sample case named 'squareBend'. But I still got the same error after 13 iterations. Is there any other thing you think I should check in oder to solve the problem?



Meanwhile, I went back to check my mesh again and found that 2 failures happened in checking geometry.
One is:
Max skewness = 6.588719, 6 highly skew faces detected which may impair the quality of the results
The other is:
Concave cells found, number of cells:65141

Based on my understanding, these failure will affect the stability of the model, but would not crash the simulation if appropriate ralaxationFactors are used in fvSolution. What do you think about the mesh issue?
I would like to share the case with you via the following link. Could you please take a look at it if you have time.


https://drive.google.com/file/d/15eZ...ew?usp=sharing


Just go
-blockMesh
-surfaceFeatureExtract
-snappyHexMesh
-transformPoints -scale '(0.001 0.001 0.001)'


Then, run rhoSimpleFoam



Thank you.

y_jiang August 27, 2018 18:01

1 Attachment(s)
Hi Ano,

I do not have much experience in modeling compressible flow. So, I do appreciate your explanations and response.

Actually, the purpose of this model is to predict the heat transfer coefficient distribution inside the tank during cooler air is blown under certain inlet and outlet pressure in order to evaluate the performance of the blow needle. Like to know how much heat would be take away at different locations insider the tank. That's why I would like run a steady state model for it.

Seeing from the picture I attached below. You have a simplified tank with a needle inserted, the air in room temperature is supposed to blow from the red surface into the tank through those small holes and flow out through the large hole out of the tank (green is the outlet).

The Mach number inside the tank should be much smaller than 1. I guess it is in the range of 0.01 ~ 0.1. But the air speed at those hole should be much greater. The diameter of the holes is about 4 mm. The diameter of the needle is about 55 mm. The estimated inlet flow rate is 0.5 m^3/s.

I tried to change the BCs to a flowRateInletVelocity with zeroGradient pressure for inlet and fixedValue for outlet, but the simulation still failed with the same error after a few iterations.

I shared my case via the link in my response to Uwe above. You can take a look at it if you do not mind. Thank you~

piu58 August 28, 2018 00:59

First I recommend to simplify the geometric model. Probably it is not necessary to reproduce the needle with all its details. You may simulate this as a detail, but I assume that the flow equalizes in a distance of one or two needle diameters. The details of the flow are unimportant to what happens at the walls. The only thing what counts may be the flow rate.
The case seems to be symmetric, so you may use only a half or a quarter of the region and set simply an inflow with the size of the permeable part of the needle. Therewith all problems with the Mach number are gone.

kishpishar August 28, 2018 03:12

Hi Yijiu Jiang,


Your checkMesh log indicates large numerical figures for the overall bounding box and cell volumes:


Overall domain bounding box (-218.2296 -157.6943 -173.1005) (181.7704 142.3057 126.9)
Minimum face area = 0.003092119. Maximum face area = 262.5519. Face area magnitudes OK.
Min volume = 0.002335076. Max volume = 3179.623. Total volume = 2.924592e+07. Cell volumes OK.


Now I would assume that, in your case, these are in mm. All other field quantities (p, U etc.) are in MKS units so the solver assumes the mesh dimensions are in m. May be that's the reason for your solver difficulty?

kishpishar August 28, 2018 09:44

Sorry, didn't see that you used transformPoints after snappy.

y_jiang September 14, 2018 14:30

2 Attachment(s)
Hello Uwe,


Thank you for your suggestions. I was working on a different things in the past days. Now I am back to this problem.
I created a very simple case to test my boundary conditions. Basically the case is cylinder container (L=D=500mm) with one inlet and one outlet on the two side (D_inlet=55 mm, D_outlet=30 mm). Mesh was still generated by snappyHexMesh. And I changed the boundary conditions to zeroGradient for pressure at inlet and fixedValue for the outlet, flowRate at the inlet for velocity. But unfortunately, it still failed in 128 iterations when solving the energy equation.

Here are my boundary conditions and the log files of checkMesh and calculation. Could you please take a look at them and let me know what you think?


Code:

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

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

internalField  uniform 600000;

boundaryField
{

    geofull_inlet1
    {
        type            zeroGradient;
        refValue        uniform 600000;
        refGradient    uniform 0;
    }

    geofull_outlet1
    {
        type            fixedValue;
        value          uniform 600000;
    }

    geofull_tank
    {
        type            zeroGradient;
    }

}

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

Code:

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

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

internalField  uniform (0 0 0);

boundaryField
{

    geofull_inlet1
    {
        type            flowRateInletVelocity;
//        volumetricFlowRate    constant 2;
//        rhoInlet        1.2;
        massFlowRate    0.5;
        rhoInlet        0.5;
    }

    geofull_outlet1
    {
        type            zeroGradient;
    }

    geofull_tank
    {
        type          noSlip;
    }

}

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



All times are GMT -4. The time now is 19:22.