CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Flow past circular cylinder - pisoFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 27, 2020, 07:04
Default Please help!!! Flow past circular cylinder - pisoFoam
  #1
New Member
 
Mudit Mehta
Join Date: Jun 2020
Posts: 19
Rep Power: 2
tony256 is on a distinguished road
Please help!!!

I am trying to simulate flow past a circular cylinder at Re = 3900. But my drag and lift coefficient is not coming correctly. My all the related files are attached below. Please suggest where i am doing wrong? Please Help. Thanks in advance. I am quite new to OpenFOAM. and stuck on this problem.
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       volVectorField;
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform (1 0 0);

boundaryField
{
    inlet
    {
        type            freestreamVelocity;
        //referenceField  uniform (10 0 0);
        //fluctuationScale (0.02 0.01 0.01);
        freestreamValue           uniform (1 0 0);
    }

    outlet
    {
        type            zeroGradient;
        
    }

    top
    {
        type            noSlip;
    }

    bottom
    {
        type            noSlip;
    }

    cylinder
    {
        type            noSlip;
    }

    front
    {
        type            symmetryPlane;
    }

    Back
    {
        type            symmetryPlane;
    }
}
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform 0;

boundaryField
{
    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
        type            fixedValue;
        value           uniform 0;
    }

    top
    {
        type            zeroGradient;
    }

    bottom
    {
        type            zeroGradient;
    }

    cylinder
    {
        type            zeroGradient;
    }

    front
    {
        type            symmetryPlane;
    }

    Back
    {
        type            symmetryPlane;
    }
}
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform 0;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform 2e-05;
    }

    outlet
    {
        type            inletOutlet;
        inletValue      uniform 0;
        value           uniform 0;
    }

    top
    {
        type            fixedValue;
        value           uniform 0;
    }

    bottom
    {
        type            fixedValue;
        value           uniform 0;
    }

    cylinder
    {
        type            fixedValue;
        value           uniform 0;
    }

    front
    {
        type            symmetryPlane;
    }

    Back
    {
        type            symmetryPlane;
    }
}
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform 0;

boundaryField
{
    inlet
    {
        type            zeroGradient;
    }

    outlet
    {
        type            zeroGradient;
    }

    top
    {
        type            zeroGradient;
    }

    bottom
    {
        type            zeroGradient;
    }

    cylinder
    {
        type            zeroGradient;
    }

    Back
    {
        type            symmetryPlane;
    }

    front
    {
        type            symmetryPlane;
    }
}
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      nuTilda;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

internalField   uniform 0;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform 0;
    }

    outlet
    {
        type            inletOutlet;
        inletValue      uniform 0;
        value           uniform 0;
    }

    top
    {
        type            fixedValue;
        value           uniform 0;
    }

    bottom
    {
        type            fixedValue;
        value           uniform 0;
    }

    cylinder
    {
        type            fixedValue;
        value           uniform 0;
    }

    front
    {
        type            symmetryPlane;
    }

    Back
    {
        type            symmetryPlane;
    }
}
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       volScalarField;
    object      s;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions      [0 0 0 0 0 0 0];

internalField   uniform 0;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value           uniform 1;
    }

    outlet
    {
        type            inletOutlet;
        inletValue      uniform 0;
        value           uniform 0;
    }

    top
    {
        type            zeroGradient;
    }

    bottom
    {
        type            zeroGradient;
    }

    front
    {
        type            symmetryPlane;
    }

    Back
    {
        type            symmetryPlane;
    }


    cylinder
    {
        type            zeroGradient;
    }
}
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

transportModel  Newtonian;

nu              [0 2 -1 0 0 0 0] 0.00025641103;
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

simulationType  LES;

LES
{
    LESModel        dynamicKEqn;

    turbulence      on;

    printCoeffs     on;

    delta           cubeRootVol;

    dynamicKEqnCoeffs
    {
        filter simple;
    }

    cubeRootVolCoeffs
    {
        deltaCoeff      1;
    }

    PrandtlCoeffs
    {
        delta           cubeRootVol;
        cubeRootVolCoeffs
        {
            deltaCoeff      1;
        }

        smoothCoeffs
        {
            delta           cubeRootVol;
            cubeRootVolCoeffs
            {
                deltaCoeff      1;
            }

            maxDeltaRatio   1.1;
        }

        Cdelta          0.158;
    }

    vanDriestCoeffs
    {
        delta           cubeRootVol;
        cubeRootVolCoeffs
        {
            deltaCoeff      1;
        }

        smoothCoeffs
        {
            delta           cubeRootVol;
            cubeRootVolCoeffs
            {
                deltaCoeff      1;
            }

            maxDeltaRatio   1.1;
        }

        Aplus           26;
        Cdelta          0.158;
    }

    smoothCoeffs
    {
        delta           cubeRootVol;
        cubeRootVolCoeffs
        {
            deltaCoeff      1;
        }

        maxDeltaRatio   1.1;
    }
}
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     pisoFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         30;

deltaT          0.005;

writeControl    timeStep;

writeInterval   100;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

functions
{
    probes
    {
        type            probes;
        libs            ("libsampling.so");
        writeControl    timeStep;
        writeInterval   1;

        fields
        (
            p
        );

        probeLocations
        (
            (0.0254 0.0253 0)
            (0.0508 0.0253 0)
            (0.0762 0.0253 0)
            (0.1016 0.0253 0)
            (0.127 0.0253 0)
            (0.1524 0.0253 0)
            (0.1778 0.0253 0)
        );

    }

    fieldAverage1
    {
        type            fieldAverage;
        libs            ("libfieldFunctionObjects.so");
        writeControl    writeTime;

        fields
        (
            U
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }

            p
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }
        );
    }

    surfaceSampling
    {
        // Sample near-wall velocity

        type surfaces;

        // Where to load it from (if not already in solver)
        libs            ("libsampling.so");
        writeControl    writeTime;

        interpolationScheme cellPoint;

        surfaceFormat vtk;

        // Fields to be sampled
        fields
        (
            U
        );

        surfaces
        (
            nearWall
            {
                type            patchInternalField;
                patches         ( lowerWall );
                distance        1E-6;
                interpolate     true;
                triangulate     false;
            }
        );
    }

    #includeFunc scalarTransport
}

functions
{
vorticity
    {
        type            vorticity;
        libs            ("libfieldFunctionObjects.so");
        writeControl    writeTime;
    }

    forces
    {
        type            forceCoeffs;
        libs            ("libforces.so");
        log             yes;
        writeControl timeStep;
        writeInterval 40;

        patches
        (
            cylinder
        );

        rho rhoInf;
      p p;
      U U;
        rhoInf      1;

        CofR        (0 0 0);
        liftDir     (0 1 0);
        dragDir     (1 0 0);
        pitchAxis   (0 0 1);
        magUInf     1;
        lRef        3.14;
        Aref        3.14;
    }


  error
  {
      // Load the library containing the 'coded' functionObject
      libs            ("libutilityFunctionObjects.so");

      type coded;

      // Name of on-the-fly generated functionObject
      name error;

      codeEnd
      #{
          // Lookup U
          Info<< "Looking up field U\n" << endl;
          const volVectorField& U = mesh().lookupObject<volVectorField>("U");

          Info<< "Reading inlet velocity uInfX\n" << endl;

          scalar ULeft = 0.0;
          label leftI = mesh().boundaryMesh().findPatchID("left");
          const fvPatchVectorField& fvp = U.boundaryField()[leftI];
          if (fvp.size())
          {
              ULeft = fvp[0].x();
          }
          reduce(ULeft, maxOp<scalar>());

          dimensionedScalar uInfX
          (
              "uInfx",
              dimensionSet(0, 1, -1, 0, 0),
              ULeft
          );

          Info << "U at inlet = " << uInfX.value() << " m/s" << endl;


          scalar magCylinder = 0.0;
          label cylI = mesh().boundaryMesh().findPatchID("cylinder");
          const fvPatchVectorField& cylFvp = mesh().C().boundaryField()[cylI];
          if (cylFvp.size())
          {
              magCylinder = mag(cylFvp[0]);
          }
          reduce(magCylinder, maxOp<scalar>());

          dimensionedScalar radius
          (
              "radius",
              dimensionSet(0, 1, 0, 0, 0),
              magCylinder
          );

          Info << "Cylinder radius = " << radius.value() << " m" << endl;

          volVectorField UA
          (
              IOobject
              (
                  "UA",
                  mesh().time().timeName(),
                  U.mesh(),
                  IOobject::NO_READ,
                  IOobject::AUTO_WRITE
              ),
              U
          );

          Info<< "\nEvaluating analytical solution" << endl;

          const volVectorField& centres = UA.mesh().C();
          volScalarField magCentres(mag(centres));
          volScalarField theta(acos((centres & vector(1,0,0))/magCentres));

          volVectorField cs2theta
          (
              cos(2*theta)*vector(1,0,0)
            + sin(2*theta)*vector(0,1,0)
          );

          UA = uInfX*(dimensionedVector(vector(1,0,0))
            - pow((radius/magCentres),2)*cs2theta);

          // Force writing of UA (since time has not changed)
          UA.write();

          volScalarField error("error", mag(U-UA)/mag(UA));

          Info<<"Writing relative error in U to " << error.objectPath()
              << endl;

          error.write();
      #};
  }

}

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

Last edited by tony256; June 28, 2020 at 08:42.
tony256 is offline   Reply With Quote

Old   June 27, 2020, 19:29
Default
  #2
New Member
 
Mudit Mehta
Join Date: Jun 2020
Posts: 19
Rep Power: 2
tony256 is on a distinguished road
I am still stuck on this problem. Please have a look and help.
tony256 is offline   Reply With Quote

Old   March 18, 2021, 07:27
Default
  #3
New Member
 
Bushra Rasheed
Join Date: Dec 2020
Posts: 26
Rep Power: 2
B_R_Khan is on a distinguished road
Were you able to solve this ?
B_R_Khan is offline   Reply With Quote

Old   March 18, 2021, 14:33
Default
  #4
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 461
Rep Power: 9
mAlletto is on a distinguished road
2d LES is always wrong. With LES one tries to resolve the relevant turbulent motion. Turbulent Eddies are always 3d.

Is the drag and lift too high or too small
mAlletto is offline   Reply With Quote

Reply

Tags
openfoam, pisofoam, turbulence

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clinch when simulating flow past circular cylinder HectorRedal Main CFD Forum 3 April 10, 2016 16:40
Drag force coefficient too high for a flow past a cylinder using komega sst Scabbard OpenFOAM Running, Solving & CFD 37 March 21, 2016 16:16
Flow past a circular cylinder faycal2013 FLUENT 0 July 19, 2014 07:29
Tubulent flow past circular cylinder at Re=3900 Jinglei Main CFD Forum 1 September 11, 2007 06:05
Simulation of the Flow past a circular cylinder using STAR-CD M. S. GUEROUACHE Main CFD Forum 0 October 1, 1998 10:51


All times are GMT -4. The time now is 13:30.