tony256 |
June 27, 2020 07:04 |
Please help!!! Flow past circular cylinder - pisoFoam
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();
#};
}
}
// ************************************************************************* //
|