mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
functionObjects::flowType: new functionObject which calculates and writes the flowType of velocity field
The flow type parameter is obtained according to the following equation:
\verbatim
|D| - |Omega|
lambda = -------------
|D| + |Omega|
-1 = rotational flow
0 = simple shear flow
1 = planar extensional flow
\endverbatim
This commit is contained in:
@ -39,6 +39,7 @@ mag/mag.C
|
||||
vorticity/vorticity.C
|
||||
Q/Q.C
|
||||
Lambda2/Lambda2.C
|
||||
flowType/flowType.C
|
||||
CourantNo/CourantNo.C
|
||||
PecletNo/PecletNo.C
|
||||
blendingFactor/blendingFactor.C
|
||||
|
||||
100
src/postProcessing/functionObjects/field/flowType/flowType.C
Normal file
100
src/postProcessing/functionObjects/field/flowType/flowType.C
Normal file
@ -0,0 +1,100 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "flowType.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(flowType, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
flowType,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::flowType::flowType
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fieldExpression(name, runTime, dict, "U", "flowType")
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::flowType::~flowType()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::flowType::execute(const bool postProcess)
|
||||
{
|
||||
if (foundField<volVectorField>(fieldName_))
|
||||
{
|
||||
const volVectorField& U = lookupField<volVectorField>(fieldName_);
|
||||
const tmp<volTensorField> tgradU(fvc::grad(U));
|
||||
const volTensorField& gradU = tgradU();
|
||||
|
||||
volScalarField magD(mag(symm(gradU)));
|
||||
volScalarField magOmega (mag(skew(gradU)));
|
||||
dimensionedScalar smallMagD("smallMagD", magD.dimensions(), SMALL);
|
||||
|
||||
const volTensorField SSplusWW
|
||||
(
|
||||
(symm(gradU) & symm(gradU))
|
||||
+ (skew(gradU) & skew(gradU))
|
||||
);
|
||||
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
(magD - magOmega)/(magD + magOmega + smallMagD)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
111
src/postProcessing/functionObjects/field/flowType/flowType.H
Normal file
111
src/postProcessing/functionObjects/field/flowType/flowType.H
Normal file
@ -0,0 +1,111 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::flowType
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates and writes the flowType of a velocity field.
|
||||
|
||||
The flow type parameter is obtained according to the following equation:
|
||||
\verbatim
|
||||
|D| - |Omega|
|
||||
lambda = -------------
|
||||
|D| + |Omega|
|
||||
|
||||
-1 = rotational flow
|
||||
0 = simple shear flow
|
||||
1 = planar extensional flow
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObjects::fieldExpression
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
flowType.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_flowType_H
|
||||
#define functionObjects_flowType_H
|
||||
|
||||
#include "fieldExpression.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class flowType Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class flowType
|
||||
:
|
||||
public fieldExpression
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("flowType");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from Time and dictionary
|
||||
flowType
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~flowType();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Calculate the flowType field
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user