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/)
-   -   Simple 3D External Flow Around A Sphere (https://www.cfd-online.com/Forums/openfoam-solving/149323-simple-3d-external-flow-around-sphere.html)

azam13 March 2, 2015 09:55

Simple 3D External Flow Around A Sphere
 
Hi everyone,

I am currently working on a project which requires me to utilise openFOAM to study flow around object. I think I should mention here that my knowledge in CFD is limited. I have used ANSYS CFX before, and I had full instructions when I ran a specific case using CFX. But now I'm on my own.

I am using gmsh (I don't get to choose meshing software) to mesh the fluid domain and then import the mesh into openFOAM. The flow around the sphere is laminar at Re=500 and I am using the simpleFoam solver.

However, I have tried setting up a case, but encountered problems upon running it. For weeks, I have tried using various methods of set up I copied from other cases, either from openFOAM itself or from what I found online. None of those methods worked, and I decided it would be easier for me to post here. Below is the log of the error I have encountered.

Code:

Time = 2.1

smoothSolver:  Solving for Ux, Initial residual = 0.570575, Final residual = 0.0181165, No Iterations 16
smoothSolver:  Solving for Uy, Initial residual = 0.569282, Final residual = 0.0310181, No Iterations 20
smoothSolver:  Solving for Uz, Initial residual = 0.411578, Final residual = 0.0145823, No Iterations 20
GAMG:  Solving for p, Initial residual = 0.974154, Final residual = 0.0663001, No Iterations 4
GAMG:  Solving for p, Initial residual = 0.999972, Final residual = 1.69907e-10, No Iterations 1
time step continuity errors : sum local = 4.61607e+11, global = -2.80841e+08, cumulative = -2.80841e+08
ExecutionTime = 66.57 s  ClockTime = 79 s

Time = 2.2

smoothSolver:  Solving for Ux, Initial residual = 0.571405, Final residual = 0.0558804, No Iterations 4
smoothSolver:  Solving for Uy, Initial residual = 0.571405, Final residual = 0.0181964, No Iterations 6
smoothSolver:  Solving for Uz, Initial residual = 0.571405, Final residual = 0.0189882, No Iterations 6
GAMG:  Solving for p, Initial residual = 1, Final residual = 0.09372, No Iterations 4
GAMG:  Solving for p, Initial residual = 1, Final residual = 2.48991e-11, No Iterations 1
time step continuity errors : sum local = 1.88144e+30, global = 5.84363e+25, cumulative = 5.84363e+25
ExecutionTime = 69.18 s  ClockTime = 82 s

Time = 2.3

smoothSolver:  Solving for Ux, Initial residual = 0.410403, Final residual = 8.89009e+10, No Iterations 1000
smoothSolver:  Solving for Uy, Initial residual = 0.411742, Final residual = 1.17565e+12, No Iterations 1000
smoothSolver:  Solving for Uz, Initial residual = 0.410765, Final residual = 3.90412e+11, No Iterations 1000

#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::GAMGSolver::scale(Foam::Field<double>&, Foam::Field<double>&, Foam::lduMatrix const&, Foam::FieldField<Foam::Field, double> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, Foam::Field<double> const&, unsigned char) const at ??:?
#4  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::Field<double>&, Foam::Field<double>&, Foam::PtrList<Foam::Field<double> >&, Foam::PtrList<Foam::Field<double> >&, unsigned char) const at ??:?
#5  Foam::GAMGSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:?
#6  Foam::fvMatrix<double>::solveSegregated(Foam::dictionary const&) at ??:?
#7  Foam::fvMatrix<double>::solve(Foam::dictionary const&) at ??:?
#8 
 at ??:?
#9 
 at ??:?
#10  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#11 
 at ??:?
Floating point exception (core dumped)

https://www.dropbox.com/s/vkxs1ohwux2lly5/Forum?dl=0

Below is a plot of the residuals:

https://www.dropbox.com/s/tssy0g71h1...Forum.png?dl=0

As you can see, the residuals and time step continuity errors shot up abruptly.

If it helps, below is a visual of my mesh. The cut plane is parallel to the inlet and outlet surfaces.

https://www.dropbox.com/s/i5s9qgyeahied7z/mesh.png?dl=0

Below is the log of the checkMesh.

Code:

Mesh stats
    points:          112989
    faces:            1208580
    internal faces:  1144764
    cells:            588336
    faces per cell:  4
    boundary patches: 7
    point zones:      0
    face zones:      0
    cell zones:      1

Overall number of cells of each type:
    hexahedra:    0
    prisms:        0
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    588336
    polyhedra:    0

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces...
    Patch              Faces    Points  Surface topology                 
    sphere              36064    18034    ok (closed singly connected)     
    outlet              1800    953      ok (non-closed singly connected) 
    back                6000    3117    ok (non-closed singly connected) 
    inlet              1808    957      ok (non-closed singly connected) 
    front              6064    3149    ok (non-closed singly connected) 
    top                6072    3153    ok (non-closed singly connected) 
    bottom              6008    3121    ok (non-closed singly connected) 

Checking geometry...
    Overall domain bounding box (-5 -1 -1) (13 4 4)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-2.05954e-16 -1.55549e-15 9.59819e-17) OK.
    Max cell openness = 3.47786e-15 OK.
    Max aspect ratio = 239.478 OK.
    Minimum face area = 2.58373e-06. Maximum face area = 0.0908523.  Face area magnitudes OK.
    Min volume = 1.05397e-08. Max volume = 0.00525295.  Total volume = 449.477.  Cell volumes OK.
    Mesh non-orthogonality Max: 89.6467 average: 31.0267
  *Number of severely non-orthogonal (> 70 degrees) faces: 11391.
    Non-orthogonality check OK.
  <<Writing 11391 non-orthogonal faces to set nonOrthoFaces
    Face pyramids OK.
    Max skewness = 1.42164 OK.
    Coupled point location match (average 0) OK.

Mesh OK.

My boundaries set up is as following:

For p: everything (inlet, top, bottom, sides) zeroGradient, except outlet with fixedValue 0.

For U: inlet fixedValue uniform (0.0005 0 0), wall fixedValue uniform (0 0 0), on sides and top and bottom I used slip, outlet is zeroGradient.

My fvScheme is:

Code:

ddtSchemes
{
    default        steadyState;
}

gradSchemes
{
    default        Gauss linear;
}

divSchemes
{
    default        none;
    div(phi,U)      bounded Gauss linearUpwind grad(U);
    div(phi,nuTilda) bounded Gauss linearUpwind grad(nuTilda);
    div((nuEff*dev(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
    default        Gauss linear corrected;
}

interpolationSchemes
{
    default        linear;
}

snGradSchemes
{
    default        corrected;
}

fluxRequired
{
    default        no;
    p              ;
}

My fvSolutions is:

Code:


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

    U
    {
        solver          smoothSolver;
        smoother        GaussSeidel;
        nSweeps        2;
        tolerance      1e-05;
        relTol          0.1;
    }

}

SIMPLE
{
    nNonOrthogonalCorrectors 1;
    pRefCell        0;
    pRefValue      0;

    residualControl
    {
        p              1e-5;
        U              1e-5;
//      nuTilda        1e-5;
    }
}

relaxationFactors
{
    fields
    {
        p              0.3;
    }
    equations
    {
        U              0.7;
//        nuTilda        0.7;
    }
}

Are there any mistakes, especially in fvScheme and fvSolutions? Those are the two files on which I have the least knowledge. It could also be because of the non-orthogonality of the mesh too, though I have applied corrector of value 1. Also, it would be appreciated if fellow forumers can suggest how I can simulate the top, bottom and sides as far field instead of slip. Thank you for your time and help! Please let me know if you need more information. :)

Regards,
Azam

zahrarashidi March 2, 2015 11:39

hi dear Azam13,
i am new in openfoam like you and my kwnoledge is poor in that,but i am sure that the problem is about mesh,because check mesh writes you a set folder that completely diverge your case so try to improve your mesh setting.
and after checkMesh you should not have set folder in your poly mesh folder at all.


All times are GMT -4. The time now is 02:41.