Lambda2.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------* \
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Application
25  Lambda2
26 
27 Description
28  Calculates and writes the second largest eigenvalue of the sum of the
29  square of the symmetrical and anti-symmetrical parts of the velocity
30  gradient tensor.
31 
32  The -noWrite option has no meaning.
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #include "calc.H"
37 #include "fvc.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
42 {
43  IOobject Uheader
44  (
45  "U",
46  runTime.timeName(),
47  mesh,
48  IOobject::MUST_READ
49  );
50 
51  if (Uheader.headerOk())
52  {
53  Info<< " Reading U" << endl;
54  volVectorField U(Uheader, mesh);
55 
56  const volTensorField gradU(fvc::grad(U));
57 
58  volTensorField SSplusWW
59  (
60  (symm(gradU) & symm(gradU)) + (skew(gradU) & skew(gradU))
61  );
62 
64  (
65  IOobject
66  (
67  "Lambda2",
68  runTime.timeName(),
69  mesh,
70  IOobject::NO_READ,
71  IOobject::NO_WRITE
72  ),
73  -eigenValues(SSplusWW)().component(vector::Y)
74  );
75 
76  Info<< " Writing -Lambda2" << endl;
77  Lambda2.write();
78  }
79  else
80  {
81  Info<< " No U" << endl;
82  }
83 
84  Info<< "\nEnd\n" << endl;
85 }
86 
87 
88 // ************************************************************************* //
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::symm
dimensionedSymmTensor symm(const dimensionedSymmTensor &dt)
Definition: dimensionedSymmTensor.C:82
Foam::component
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Definition: FieldFieldFunctions.C:41
Foam::fvc::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::skew
dimensionedTensor skew(const dimensionedTensor &dt)
Definition: dimensionedTensor.C:135
Foam::calc
void calc(const argList &args, const Time &runTime, const fvMesh &mesh)
Definition: Lambda2.C:38
Foam::argList
Extract command arguments and options from the supplied argc and argv parameters.
Definition: argList.H:97
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
U
U
Definition: pEqn.H:46
Foam::IOobject::headerOk
bool headerOk()
Read and check header info.
Definition: IOobject.C:439
Foam::eigenValues
dimensionedVector eigenValues(const dimensionedTensor &dt)
Definition: dimensionedTensor.C:146
Foam::Info
messageStream Info
calc.H
Function prototype for all simple post-processing functions e.g. calcDivPhi, calcMagU etc.
Foam::Lambda2::write
virtual void write()
Calculate the Lambda2 and write.
Definition: Lambda2.C:161
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam::Lambda2
This function object calculates and outputs the second largest eigenvalue of the sum of the square of...
Definition: Lambda2.H:107
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
fvc.H
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
args
Foam::argList args(argc, argv)
Y
PtrList< volScalarField > & Y
Definition: createFields.H:36