OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

flowType.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------* \
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Application
00026     flowType
00027 
00028 Description
00029     Calculates and writes the flowType of velocity field U.
00030 
00031     The -noWrite option has no meaning.
00032 
00033     The flow type parameter is obtained according to the following equation:
00034     @verbatim
00035                  |D| - |Omega|
00036         lambda = -------------
00037                  |D| + |Omega|
00038 
00039         -1 = rotational flow
00040          0 = simple shear flow
00041          1 = planar extensional flow
00042     @endverbatim
00043 
00044 \*---------------------------------------------------------------------------*/
00045 
00046 #include "calc.H"
00047 #include "fvc.H"
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
00052 {
00053     IOobject Uheader
00054     (
00055         "U",
00056         runTime.timeName(),
00057         mesh,
00058         IOobject::MUST_READ
00059     );
00060 
00061     if (Uheader.headerOk())
00062     {
00063         Info<< "    Reading U" << endl;
00064         volVectorField U(Uheader, mesh);
00065 
00066         volTensorField gradU = fvc::grad(U);
00067         volScalarField magD = mag(symm(gradU));
00068         volScalarField magOmega = mag(skew(gradU));
00069         dimensionedScalar smallMagD("smallMagD", magD.dimensions(), SMALL);
00070 
00071         Info<< "    Calculating flowType" << endl;
00072 
00073         volScalarField flowType
00074         (
00075             IOobject
00076             (
00077                 "flowType",
00078                 runTime.timeName(),
00079                 mesh,
00080                 IOobject::NO_READ
00081             ),
00082             (magD - magOmega)/(magD + magOmega + smallMagD)
00083         );
00084 
00085         flowType.write();
00086     }
00087     else
00088     {
00089         Info<< "    No U" << endl;
00090     }
00091 
00092     Info<< "\nEnd\n" << endl;
00093 }
00094 
00095 
00096 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd