aerofoilNACA0012 tutorial: added speed and angle of attack controls

and force coeffcients calculation
This commit is contained in:
Chris Greenshields
2020-04-17 19:01:46 +01:00
parent f7bcc19ad2
commit 17f11090e2
9 changed files with 80 additions and 27 deletions

View File

@ -14,7 +14,27 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Uinlet (250 0 0); speed 250;
angleOfAttack 0; // degs
angle #calc "degToRad($angleOfAttack)";
liftDir #codeStream
{
codeInclude #{ #include "vector.H" #};
code #{ os << vector(-::sin($angle), 0, ::cos($angle)); #};
};
dragDir #codeStream
{
codeInclude #{ #include "vector.H" #};
code #{ os << vector(::cos($angle), 0, ::sin($angle)); #};
};
Uinlet #codeStream
{
codeInclude #{ #include "vector.H" #};
code #{ os << $speed*vector(::cos($angle), 0, ::sin($angle)); #};
};
dimensions [0 1 -1 0 0 0 0]; dimensions [0 1 -1 0 0 0 0];

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
kInlet 0.01; kInlet 1e-3;
dimensions [0 2 -2 0 0 0 0]; dimensions [0 2 -2 0 0 0 0];

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
omegaInlet 10; omegaInlet 1;
dimensions [0 0 -1 0 0 0 0]; dimensions [0 0 -1 0 0 0 0];

View File

@ -9,6 +9,7 @@ rm -f constant/geometry/NACA0012.obj.gz > /dev/null 2>&1
cleanCase cleanCase
rm 0/Ma > /dev/null 2>&1
rm constant/geometry/boundaryLayer.obj > /dev/null 2>&1 rm constant/geometry/boundaryLayer.obj > /dev/null 2>&1
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -17,22 +17,23 @@ FoamFile
domain domain
{ {
xMin -4; xMax 100;
xMax 4; zMax 50;
zMin -2;
zMax 2; xMin #neg $xMax;
zMin #neg $zMax;
// Number of cells // Number of cells
zCells 80; // aerofoil to far field zCells 60; // aerofoil to far field
xUCells 30; // upstream xUCells 60; // upstream
xMCells 30; // middle xMCells 25; // middle
xDCells 40; // downstream xDCells 50; // downstream
// Mesh grading // Mesh grading
zGrading 40; // aerofoil to far field zGrading 30000; // aerofoil to far field
xUGrading 5; // towards centre upstream xUGrading 10; // towards centre upstream
leadGrading 0.2; // towards leading edge leadGrading 0.005; // towards leading edge
xDGrading 10; // downstream xDGrading 400; // downstream
} }
aerofoil aerofoil
@ -43,8 +44,9 @@ aerofoil
zTrail 0; zTrail 0;
xUpper 0.3; xUpper 0.3;
zUpper 0.06; zUpper 0.06;
xLower 0.3;
zLower -0.06; xLower $xUpper;
zLower #neg $zUpper;
} }
geometry geometry

View File

@ -22,7 +22,7 @@ startTime 0;
stopAt endTime; stopAt endTime;
endTime 1000; endTime 2000;
deltaT 1; deltaT 1;
@ -34,7 +34,7 @@ purgeWrite 0;
writeFormat ascii; writeFormat ascii;
writePrecision 8; writePrecision 10;
writeCompression off; writeCompression off;
@ -48,6 +48,7 @@ functions
{ {
#includeFunc MachNo #includeFunc MachNo
#includeFunc residuals #includeFunc residuals
#includeFunc forceCoeffsCompressible
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -21,7 +21,7 @@ sourcePatches (back);
exposedPatchName front; exposedPatchName front;
extrudeModel plane; extrudeModel plane;
thickness 0.1; thickness 1;
flipNormals false; flipNormals false;
mergeFaces false; mergeFaces false;

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Calculates lift, drag and moment coefficients by summing forces on
specified patches for a case where the solver is compressible (pressure is
in units M/(LT^2), e.g. Pa).
\*---------------------------------------------------------------------------*/
#include "$FOAM_CASE/0/U"
patches (aerofoil);
magUInf $speed;
lRef 1;
Aref 1; // span
rhoInf 1.2;
CofR (0.2 0 0);
pitchAxis (0 1 0);
#includeEtc "caseDicts/postProcessing/forces/forceCoeffs.cfg"
// ************************************************************************* //

View File

@ -20,7 +20,7 @@ solvers
{ {
solver GAMG; solver GAMG;
smoother GaussSeidel; smoother GaussSeidel;
tolerance 1e-6; tolerance 1e-8;
relTol 0.01; relTol 0.01;
} }
@ -28,7 +28,7 @@ solvers
{ {
solver PBiCGStab; solver PBiCGStab;
preconditioner DILU; preconditioner DILU;
tolerance 1e-6; tolerance 1e-10;
relTol 0.1; relTol 0.1;
} }
} }
@ -37,9 +37,9 @@ SIMPLE
{ {
residualControl residualControl
{ {
p 1e-4; p 1e-6;
U 1e-4; U 1e-5;
"(k|omega|e)" 1e-4; "(k|omega|e)" 1e-5;
} }
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
@ -51,12 +51,12 @@ relaxationFactors
{ {
fields fields
{ {
p 0.7; p 0.3;
rho 0.01; rho 0.01;
} }
equations equations
{ {
U 0.3; U 0.7;
e 0.7; e 0.7;
"(k|omega)" 0.7; "(k|omega)" 0.7;
} }