1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Generates a swirling flow for engine calulations
31 \*---------------------------------------------------------------------------*/
34 #include "mathematicalConstants.H"
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 int main(int argc, char *argv[])
41 # include "setRootCase.H"
42 # include "createTime.H"
43 # include "createMesh.H"
44 # include "createFields.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 scalar Vphi = (mathematicalConstant::pi*swirlRPMRatio*rpm/30).value();
49 scalar b1 = j1(swirlProfile).value();
50 scalar b2 = 2.0*b1/swirlProfile.value() - j0(swirlProfile).value();
52 scalar omega = 0.125*(Vphi*bore*swirlProfile/b2).value();
54 scalar cylinderRadius = 0.5*bore.value();
57 forAll(mesh.C(), celli)
59 vector c = mesh.C()[celli] - swirlCenter;
60 scalar r = ::pow(sqr(c & xT) + sqr(c & yT), 0.5);
62 if (r <= cylinderRadius)
64 scalar b = j1(swirlProfile*r/cylinderRadius).value();
65 scalar vEff = omega*b;
67 U[celli] = ((vEff/r)*(c & yT))*xT + (-(vEff/r)*(c & xT))*yT;
68 Umax = max(Umax, mag(U[celli]));
72 Info << "Umax = " << Umax << endl;
82 // ************************************************************************* //