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

Lambda2.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     Lambda2
00027 
00028 Description
00029     Calculates and writes the second largest eigenvalue of the sum of the
00030     square of the symmetrical and anti-symmetrical parts of the velocity
00031     gradient tensor.
00032 
00033     The -noWrite option has no meaning.
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #include "calc.H"
00038 #include "fvc.H"
00039 
00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00041 
00042 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
00043 {
00044     IOobject Uheader
00045     (
00046         "U",
00047         runTime.timeName(),
00048         mesh,
00049         IOobject::MUST_READ
00050     );
00051 
00052     if (Uheader.headerOk())
00053     {
00054         Info<< "    Reading U" << endl;
00055         volVectorField U(Uheader, mesh);
00056 
00057         const volTensorField gradU(fvc::grad(U));
00058 
00059         volTensorField SSplusWW =
00060             (symm(gradU) & symm(gradU)) + (skew(gradU) & skew(gradU));
00061 
00062         volScalarField Lambda2
00063         (
00064             IOobject
00065             (
00066                 "Lambda2",
00067                 runTime.timeName(),
00068                 mesh,
00069                 IOobject::NO_READ,
00070                 IOobject::NO_WRITE
00071             ),
00072             -eigenValues(SSplusWW)().component(vector::Y)
00073         );
00074 
00075         Info << "    Writing -Lambda2" << endl;
00076         Lambda2.write();
00077     }
00078     else
00079     {
00080         Info<< "    No U" << endl;
00081     }
00082 
00083     Info<< "\nEnd\n" << endl;
00084 }
00085 
00086 
00087 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd