mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
functionObjects: Cleanup, reorganize and simplify
This commit is contained in:
@ -88,7 +88,7 @@ protected:
|
|||||||
bool store
|
bool store
|
||||||
(
|
(
|
||||||
word& fieldName,
|
word& fieldName,
|
||||||
tmp<FieldType> tfield,
|
const tmp<FieldType>& tfield,
|
||||||
bool cacheable = false
|
bool cacheable = false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@ template<class FieldType>
|
|||||||
bool Foam::functionObjects::fvMeshFunctionObject::store
|
bool Foam::functionObjects::fvMeshFunctionObject::store
|
||||||
(
|
(
|
||||||
word& fieldName,
|
word& fieldName,
|
||||||
tmp<FieldType> tfield,
|
const tmp<FieldType>& tfield,
|
||||||
bool cacheable
|
bool cacheable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -75,29 +75,9 @@ Foam::functionObjects::CourantNo::CourantNo
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict)
|
fieldExpression(name, runTime, dict, "phi", "Co")
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
volScalarField* CourantNoPtr
|
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
type(),
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("0", dimless, 0.0),
|
|
||||||
zeroGradientFvPatchScalarField::typeName
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
mesh_.objectRegistry::store(CourantNoPtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -111,6 +91,8 @@ Foam::functionObjects::CourantNo::~CourantNo()
|
|||||||
|
|
||||||
bool Foam::functionObjects::CourantNo::read(const dictionary& dict)
|
bool Foam::functionObjects::CourantNo::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
|
fieldExpression::read(dict);
|
||||||
|
|
||||||
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
|
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
|
||||||
rhoName_ = dict.lookupOrDefault<word>("rho", "rho");
|
rhoName_ = dict.lookupOrDefault<word>("rho", "rho");
|
||||||
|
|
||||||
@ -120,38 +102,64 @@ bool Foam::functionObjects::CourantNo::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::CourantNo::execute(const bool postProcess)
|
bool Foam::functionObjects::CourantNo::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
const surfaceScalarField& phi =
|
if (foundField<surfaceScalarField>(phiName_))
|
||||||
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
{
|
||||||
|
const surfaceScalarField& phi =
|
||||||
|
lookupField<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
volScalarField& Co = const_cast<volScalarField&>
|
tmp<volScalarField::Internal> Coi
|
||||||
(
|
(
|
||||||
mesh_.lookupObject<volScalarField>(type())
|
byRho
|
||||||
);
|
(
|
||||||
|
(0.5*mesh_.time().deltaT())
|
||||||
|
*fvc::surfaceSum(mag(phi))()()
|
||||||
|
/mesh_.V()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
Co.ref() = byRho
|
if (foundField<volScalarField>(resultName_))
|
||||||
(
|
{
|
||||||
(0.5*mesh_.time().deltaT())
|
volScalarField& Co
|
||||||
*fvc::surfaceSum(mag(phi))()()
|
(
|
||||||
/mesh_.V()
|
const_cast<volScalarField&>
|
||||||
);
|
(
|
||||||
Co.correctBoundaryConditions();
|
lookupField<volScalarField>(resultName_)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return true;
|
Co.ref() = Coi();
|
||||||
}
|
Co.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tCo
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
resultName_,
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("0", dimless, 0.0),
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
tCo.ref().ref() = Coi();
|
||||||
|
tCo.ref().correctBoundaryConditions();
|
||||||
|
mesh_.objectRegistry::store(tCo.ptr());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
bool Foam::functionObjects::CourantNo::write(const bool postProcess)
|
}
|
||||||
{
|
else
|
||||||
const volScalarField& CourantNo =
|
{
|
||||||
obr_.lookupObject<volScalarField>(type());
|
return false;
|
||||||
|
}
|
||||||
Info<< type() << " " << name() << " output:" << nl
|
|
||||||
<< " writing field " << CourantNo.name() << nl
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
CourantNo.write();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,7 @@ Description
|
|||||||
be retrieved and used for other applications.
|
be retrieved and used for other applications.
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
|
Foam::functionObjects::fieldExpression
|
||||||
Foam::functionObjects::fvMeshFunctionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -43,7 +44,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_CourantNo_H
|
#ifndef functionObjects_CourantNo_H
|
||||||
#define functionObjects_CourantNo_H
|
#define functionObjects_CourantNo_H
|
||||||
|
|
||||||
#include "fvMeshFunctionObject.H"
|
#include "fieldExpression.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -59,7 +60,7 @@ namespace functionObjects
|
|||||||
|
|
||||||
class CourantNo
|
class CourantNo
|
||||||
:
|
:
|
||||||
public fvMeshFunctionObject
|
public fieldExpression
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
@ -78,12 +79,6 @@ class CourantNo
|
|||||||
const tmp<volScalarField::Internal>& Co
|
const tmp<volScalarField::Internal>& Co
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
CourantNo(const CourantNo&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const CourantNo&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -113,9 +108,6 @@ public:
|
|||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Execute, currently does nothing
|
||||||
virtual bool execute(const bool postProcess = false);
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Calculate the CourantNo and write
|
|
||||||
virtual bool write(const bool postProcess = false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -24,8 +24,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "Lambda2.H"
|
#include "Lambda2.H"
|
||||||
#include "volFields.H"
|
|
||||||
#include "zeroGradientFvPatchFields.H"
|
|
||||||
#include "fvcGrad.H"
|
#include "fvcGrad.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
@ -56,29 +54,8 @@ Foam::functionObjects::Lambda2::Lambda2
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict)
|
fieldExpression(name, runTime, dict, "U", "Lambda2")
|
||||||
{
|
{}
|
||||||
read(dict);
|
|
||||||
|
|
||||||
volScalarField* Lambda2Ptr
|
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
type(),
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("0", dimless/sqr(dimTime), 0.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
mesh_.objectRegistry::store(Lambda2Ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -89,51 +66,30 @@ Foam::functionObjects::Lambda2::~Lambda2()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::functionObjects::Lambda2::read(const dictionary& dict)
|
|
||||||
{
|
|
||||||
UName_ = dict.lookupOrDefault<word>("U", "U");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::Lambda2::execute(const bool postProcess)
|
bool Foam::functionObjects::Lambda2::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
const volVectorField& U =
|
if (foundField<volVectorField>(fieldName_))
|
||||||
mesh_.lookupObject<volVectorField>(UName_);
|
{
|
||||||
|
const volVectorField& U = lookupField<volVectorField>(fieldName_);
|
||||||
|
const tmp<volTensorField> tgradU(fvc::grad(U));
|
||||||
|
const volTensorField& gradU = tgradU();
|
||||||
|
|
||||||
const volTensorField gradU(fvc::grad(U));
|
const volTensorField SSplusWW
|
||||||
|
|
||||||
const volTensorField SSplusWW
|
|
||||||
(
|
|
||||||
(symm(gradU) & symm(gradU))
|
|
||||||
+ (skew(gradU) & skew(gradU))
|
|
||||||
);
|
|
||||||
|
|
||||||
volScalarField& Lambda2 =
|
|
||||||
const_cast<volScalarField&>
|
|
||||||
(
|
(
|
||||||
mesh_.lookupObject<volScalarField>(type())
|
(symm(gradU) & symm(gradU))
|
||||||
|
+ (skew(gradU) & skew(gradU))
|
||||||
);
|
);
|
||||||
|
|
||||||
Lambda2 = -eigenValues(SSplusWW)().component(vector::Y);
|
return store
|
||||||
|
(
|
||||||
return true;
|
resultName_,
|
||||||
}
|
-eigenValues(SSplusWW)().component(vector::Y)
|
||||||
|
);
|
||||||
|
}
|
||||||
bool Foam::functionObjects::Lambda2::write(const bool postProcess)
|
else
|
||||||
{
|
{
|
||||||
const volScalarField& Lambda2 =
|
return false;
|
||||||
obr_.lookupObject<volScalarField>(type());
|
}
|
||||||
|
|
||||||
Info<< type() << " " << name() << " output:" << nl
|
|
||||||
<< " writing field " << Lambda2.name() << nl
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
Lambda2.write();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,7 @@ Description
|
|||||||
the velocity gradient tensor.
|
the velocity gradient tensor.
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
|
Foam::functionObjects::fieldExpression
|
||||||
Foam::functionObjects::fvMeshFunctionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -43,8 +44,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_Lambda2_H
|
#ifndef functionObjects_Lambda2_H
|
||||||
#define functionObjects_Lambda2_H
|
#define functionObjects_Lambda2_H
|
||||||
|
|
||||||
#include "fvMeshFunctionObject.H"
|
#include "fieldExpression.H"
|
||||||
#include "volFieldsFwd.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -59,22 +59,8 @@ namespace functionObjects
|
|||||||
|
|
||||||
class Lambda2
|
class Lambda2
|
||||||
:
|
:
|
||||||
public fvMeshFunctionObject
|
public fieldExpression
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Name of velocity field, default is "U"
|
|
||||||
word UName_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
Lambda2(const Lambda2&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const Lambda2&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -99,14 +85,8 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Read the Lambda2 data
|
//- Calculate the Lambda2 field
|
||||||
virtual bool read(const dictionary&);
|
|
||||||
|
|
||||||
//- Calculate Lambda2
|
|
||||||
virtual bool execute(const bool postProcess = false);
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Write Lambda2
|
|
||||||
virtual bool write(const bool postProcess = false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -40,5 +40,6 @@ vorticity/vorticity.C
|
|||||||
Q/Q.C
|
Q/Q.C
|
||||||
Lambda2/Lambda2.C
|
Lambda2/Lambda2.C
|
||||||
CourantNo/CourantNo.C
|
CourantNo/CourantNo.C
|
||||||
|
Peclet/Peclet.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
||||||
|
|||||||
@ -4,7 +4,8 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude \
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
|||||||
115
src/postProcessing/functionObjects/field/Peclet/Peclet.C
Normal file
115
src/postProcessing/functionObjects/field/Peclet/Peclet.C
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013-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 "Peclet.H"
|
||||||
|
#include "turbulenceModel.H"
|
||||||
|
#include "surfaceInterpolate.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(Peclet, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
Peclet,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::Peclet::Peclet
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time& runTime,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fieldExpression(name, runTime, dict, "phi", "Pe")
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::Peclet::~Peclet()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::functionObjects::Peclet::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
fieldExpression::read(dict);
|
||||||
|
|
||||||
|
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::Peclet::execute(const bool postProcess)
|
||||||
|
{
|
||||||
|
if (foundField<surfaceScalarField>(phiName_))
|
||||||
|
{
|
||||||
|
tmp<volScalarField> nuEff
|
||||||
|
(
|
||||||
|
mesh_.lookupObject<turbulenceModel>
|
||||||
|
(
|
||||||
|
turbulenceModel::propertiesName
|
||||||
|
).nuEff()
|
||||||
|
);
|
||||||
|
|
||||||
|
const surfaceScalarField& phi =
|
||||||
|
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
|
return store
|
||||||
|
(
|
||||||
|
resultName_,
|
||||||
|
mag(phi)
|
||||||
|
/(
|
||||||
|
mesh_.magSf()
|
||||||
|
*mesh_.surfaceInterpolation::deltaCoeffs()
|
||||||
|
*fvc::interpolate(nuEff)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -32,6 +32,7 @@ Description
|
|||||||
surfaceScalarField.
|
surfaceScalarField.
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
|
Foam::functionObjects::fieldExpression
|
||||||
Foam::functionObjects::fvMeshFunctionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -42,8 +43,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_Peclet_H
|
#ifndef functionObjects_Peclet_H
|
||||||
#define functionObjects_Peclet_H
|
#define functionObjects_Peclet_H
|
||||||
|
|
||||||
#include "fvMeshFunctionObject.H"
|
#include "fieldExpression.H"
|
||||||
#include "volFieldsFwd.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -58,25 +58,13 @@ namespace functionObjects
|
|||||||
|
|
||||||
class Peclet
|
class Peclet
|
||||||
:
|
:
|
||||||
public fvMeshFunctionObject
|
public fieldExpression
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of flux field, default is "phi"
|
//- Name of flux field, default is "phi"
|
||||||
word phiName_;
|
word phiName_;
|
||||||
|
|
||||||
//- Name of density field (compressible cases only), default is "rho"
|
|
||||||
word rhoName_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
Peclet(const Peclet&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const Peclet&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -107,9 +95,6 @@ public:
|
|||||||
|
|
||||||
//- Calculate the Peclet number field
|
//- Calculate the Peclet number field
|
||||||
virtual bool execute(const bool postProcess = false);
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Write the Peclet number field
|
|
||||||
virtual bool write(const bool postProcess = false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Calculate the Q-field
|
//- Calculate the Q field
|
||||||
virtual bool execute(const bool postProcess = false);
|
virtual bool execute(const bool postProcess = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "vorticity.H"
|
#include "vorticity.H"
|
||||||
#include "volFields.H"
|
|
||||||
#include "fvcCurl.H"
|
#include "fvcCurl.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
@ -55,30 +54,8 @@ Foam::functionObjects::vorticity::vorticity
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict),
|
fieldExpression(name, runTime, dict, "U", "vorticity")
|
||||||
outputName_(typeName)
|
{}
|
||||||
{
|
|
||||||
read(dict);
|
|
||||||
|
|
||||||
volVectorField* vorticityPtr
|
|
||||||
(
|
|
||||||
new volVectorField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
outputName_,
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedVector("0", dimless/dimTime, Zero)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
mesh_.objectRegistry::store(vorticityPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -89,46 +66,23 @@ Foam::functionObjects::vorticity::~vorticity()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::functionObjects::vorticity::read(const dictionary& dict)
|
bool Foam::functionObjects::vorticity::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
UName_ = dict.lookupOrDefault<word>("U", "U");
|
if (foundField<volVectorField>(fieldName_))
|
||||||
if (UName_ != "U")
|
|
||||||
{
|
{
|
||||||
outputName_ = typeName + "(" + UName_ + ")";
|
return store
|
||||||
|
(
|
||||||
|
resultName_,
|
||||||
|
fvc::curl(lookupField<volVectorField>(fieldName_))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::vorticity::execute(const bool postProcess)
|
|
||||||
{
|
|
||||||
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
|
|
||||||
|
|
||||||
volVectorField& vorticity = const_cast<volVectorField&>
|
|
||||||
(
|
|
||||||
mesh_.lookupObject<volVectorField>(outputName_)
|
|
||||||
);
|
|
||||||
|
|
||||||
vorticity = fvc::curl(U);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::vorticity::write(const bool postProcess)
|
|
||||||
{
|
|
||||||
const volVectorField& vorticity =
|
|
||||||
mesh_.lookupObject<volVectorField>(outputName_);
|
|
||||||
|
|
||||||
Info<< type() << " " << name() << " output:" << nl
|
|
||||||
<< " writing field " << vorticity.name() << nl
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
vorticity.write();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -31,6 +31,7 @@ Description
|
|||||||
This function object calculates the vorticity, the curl of the velocity.
|
This function object calculates the vorticity, the curl of the velocity.
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
|
Foam::functionObjects::fieldExpression
|
||||||
Foam::functionObjects::fvMeshFunctionObject
|
Foam::functionObjects::fvMeshFunctionObject
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -41,8 +42,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_vorticity_H
|
#ifndef functionObjects_vorticity_H
|
||||||
#define functionObjects_vorticity_H
|
#define functionObjects_vorticity_H
|
||||||
|
|
||||||
#include "fvMeshFunctionObject.H"
|
#include "fieldExpression.H"
|
||||||
#include "volFieldsFwd.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -57,25 +57,8 @@ namespace functionObjects
|
|||||||
|
|
||||||
class vorticity
|
class vorticity
|
||||||
:
|
:
|
||||||
public fvMeshFunctionObject
|
public fieldExpression
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Name of velocity field, default is "U"
|
|
||||||
word UName_;
|
|
||||||
|
|
||||||
//- Name of vorticity field
|
|
||||||
word outputName_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
vorticity(const vorticity&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const vorticity&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -100,14 +83,8 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Read the vorticity data
|
|
||||||
virtual bool read(const dictionary&);
|
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Execute, currently does nothing
|
||||||
virtual bool execute(const bool postProcess = false);
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Calculate the vorticity and write
|
|
||||||
virtual bool write(const bool postProcess = false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,6 @@ blendingFactor/blendingFactor.C
|
|||||||
dsmcFields/dsmcFields.C
|
dsmcFields/dsmcFields.C
|
||||||
|
|
||||||
turbulenceFields/turbulenceFields.C
|
turbulenceFields/turbulenceFields.C
|
||||||
Peclet/Peclet.C
|
|
||||||
yPlus/yPlus.C
|
yPlus/yPlus.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
|
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
|
||||||
|
|||||||
@ -1,202 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2013-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 "Peclet.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "dictionary.H"
|
|
||||||
#include "surfaceFields.H"
|
|
||||||
#include "turbulentTransportModel.H"
|
|
||||||
#include "turbulentFluidThermoModel.H"
|
|
||||||
#include "surfaceInterpolate.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
namespace functionObjects
|
|
||||||
{
|
|
||||||
defineTypeNameAndDebug(Peclet, 0);
|
|
||||||
|
|
||||||
addToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
functionObject,
|
|
||||||
Peclet,
|
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::functionObjects::Peclet::Peclet
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Time& runTime,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
fvMeshFunctionObject(name, runTime, dict)
|
|
||||||
{
|
|
||||||
read(dict);
|
|
||||||
|
|
||||||
surfaceScalarField* PecletPtr
|
|
||||||
(
|
|
||||||
new surfaceScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
type(),
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("0", dimless, 0.0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
mesh_.objectRegistry::store(PecletPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::functionObjects::Peclet::~Peclet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::functionObjects::Peclet::read(const dictionary& dict)
|
|
||||||
{
|
|
||||||
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
|
|
||||||
rhoName_ = dict.lookupOrDefault<word>("rho", "rho");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::Peclet::execute(const bool postProcess)
|
|
||||||
{
|
|
||||||
typedef compressible::turbulenceModel cmpTurbModel;
|
|
||||||
typedef incompressible::turbulenceModel icoTurbModel;
|
|
||||||
|
|
||||||
tmp<volScalarField> nuEff;
|
|
||||||
if (mesh_.foundObject<cmpTurbModel>(turbulenceModel::propertiesName))
|
|
||||||
{
|
|
||||||
const cmpTurbModel& model =
|
|
||||||
mesh_.lookupObject<cmpTurbModel>
|
|
||||||
(
|
|
||||||
turbulenceModel::propertiesName
|
|
||||||
);
|
|
||||||
|
|
||||||
const volScalarField& rho =
|
|
||||||
mesh_.lookupObject<volScalarField>(rhoName_);
|
|
||||||
|
|
||||||
nuEff = model.muEff()/rho;
|
|
||||||
}
|
|
||||||
else if
|
|
||||||
(
|
|
||||||
mesh_.foundObject<icoTurbModel>(turbulenceModel::propertiesName)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const icoTurbModel& model =
|
|
||||||
mesh_.lookupObject<icoTurbModel>
|
|
||||||
(
|
|
||||||
turbulenceModel::propertiesName
|
|
||||||
);
|
|
||||||
|
|
||||||
nuEff = model.nuEff();
|
|
||||||
}
|
|
||||||
else if (mesh_.foundObject<dictionary>("transportProperties"))
|
|
||||||
{
|
|
||||||
const dictionary& model =
|
|
||||||
mesh_.lookupObject<dictionary>("transportProperties");
|
|
||||||
|
|
||||||
nuEff =
|
|
||||||
tmp<volScalarField>
|
|
||||||
(
|
|
||||||
new volScalarField
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"nuEff",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar(model.lookup("nu"))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Unable to determine the viscosity"
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
const surfaceScalarField& phi =
|
|
||||||
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
|
||||||
|
|
||||||
surfaceScalarField& Peclet =
|
|
||||||
const_cast<surfaceScalarField&>
|
|
||||||
(
|
|
||||||
mesh_.lookupObject<surfaceScalarField>(type())
|
|
||||||
);
|
|
||||||
|
|
||||||
Peclet =
|
|
||||||
mag(phi)
|
|
||||||
/(
|
|
||||||
mesh_.magSf()
|
|
||||||
*mesh_.surfaceInterpolation::deltaCoeffs()
|
|
||||||
*fvc::interpolate(nuEff)
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::Peclet::write(const bool postProcess)
|
|
||||||
{
|
|
||||||
const surfaceScalarField& Peclet =
|
|
||||||
mesh_.lookupObject<surfaceScalarField>(type());
|
|
||||||
|
|
||||||
Info<< type() << " " << name() << " output:" << nl
|
|
||||||
<< " writing field " << Peclet.name() << nl
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
Peclet.write();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
Reference in New Issue
Block a user