diff --git a/src/postProcessing/functionObjects/field/Make/files b/src/postProcessing/functionObjects/field/Make/files index 56e02fe21d..dc9a22e209 100644 --- a/src/postProcessing/functionObjects/field/Make/files +++ b/src/postProcessing/functionObjects/field/Make/files @@ -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 diff --git a/src/postProcessing/functionObjects/field/flowType/flowType.C b/src/postProcessing/functionObjects/field/flowType/flowType.C new file mode 100644 index 0000000000..d282617778 --- /dev/null +++ b/src/postProcessing/functionObjects/field/flowType/flowType.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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(fieldName_)) + { + const volVectorField& U = lookupField(fieldName_); + const tmp 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; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/flowType/flowType.H b/src/postProcessing/functionObjects/field/flowType/flowType.H new file mode 100644 index 0000000000..f73e82b732 --- /dev/null +++ b/src/postProcessing/functionObjects/field/flowType/flowType.H @@ -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 . + +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 + +// ************************************************************************* //