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:
@ -75,29 +75,9 @@ Foam::functionObjects::CourantNo::CourantNo
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict)
|
||||
fieldExpression(name, runTime, dict, "phi", "Co")
|
||||
{
|
||||
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)
|
||||
{
|
||||
fieldExpression::read(dict);
|
||||
|
||||
phiName_ = dict.lookupOrDefault<word>("phi", "phi");
|
||||
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)
|
||||
{
|
||||
const surfaceScalarField& phi =
|
||||
mesh_.lookupObject<surfaceScalarField>(phiName_);
|
||||
if (foundField<surfaceScalarField>(phiName_))
|
||||
{
|
||||
const surfaceScalarField& phi =
|
||||
lookupField<surfaceScalarField>(phiName_);
|
||||
|
||||
volScalarField& Co = const_cast<volScalarField&>
|
||||
(
|
||||
mesh_.lookupObject<volScalarField>(type())
|
||||
);
|
||||
tmp<volScalarField::Internal> Coi
|
||||
(
|
||||
byRho
|
||||
(
|
||||
(0.5*mesh_.time().deltaT())
|
||||
*fvc::surfaceSum(mag(phi))()()
|
||||
/mesh_.V()
|
||||
)
|
||||
);
|
||||
|
||||
Co.ref() = byRho
|
||||
(
|
||||
(0.5*mesh_.time().deltaT())
|
||||
*fvc::surfaceSum(mag(phi))()()
|
||||
/mesh_.V()
|
||||
);
|
||||
Co.correctBoundaryConditions();
|
||||
if (foundField<volScalarField>(resultName_))
|
||||
{
|
||||
volScalarField& Co
|
||||
(
|
||||
const_cast<volScalarField&>
|
||||
(
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::CourantNo::write(const bool postProcess)
|
||||
{
|
||||
const volScalarField& CourantNo =
|
||||
obr_.lookupObject<volScalarField>(type());
|
||||
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << CourantNo.name() << nl
|
||||
<< endl;
|
||||
|
||||
CourantNo.write();
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ Description
|
||||
be retrieved and used for other applications.
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObjects::fieldExpression
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
@ -43,7 +44,7 @@ SourceFiles
|
||||
#ifndef functionObjects_CourantNo_H
|
||||
#define functionObjects_CourantNo_H
|
||||
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "fieldExpression.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -59,7 +60,7 @@ namespace functionObjects
|
||||
|
||||
class CourantNo
|
||||
:
|
||||
public fvMeshFunctionObject
|
||||
public fieldExpression
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -78,12 +79,6 @@ class CourantNo
|
||||
const tmp<volScalarField::Internal>& Co
|
||||
) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
CourantNo(const CourantNo&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const CourantNo&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -113,9 +108,6 @@ public:
|
||||
|
||||
//- Execute, currently does nothing
|
||||
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 "volFields.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
@ -56,29 +54,8 @@ Foam::functionObjects::Lambda2::Lambda2
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict)
|
||||
{
|
||||
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);
|
||||
}
|
||||
fieldExpression(name, runTime, dict, "U", "Lambda2")
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
@ -89,51 +66,30 @@ Foam::functionObjects::Lambda2::~Lambda2()
|
||||
|
||||
// * * * * * * * * * * * * * * * 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)
|
||||
{
|
||||
const volVectorField& U =
|
||||
mesh_.lookupObject<volVectorField>(UName_);
|
||||
if (foundField<volVectorField>(fieldName_))
|
||||
{
|
||||
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
|
||||
(
|
||||
(symm(gradU) & symm(gradU))
|
||||
+ (skew(gradU) & skew(gradU))
|
||||
);
|
||||
|
||||
volScalarField& Lambda2 =
|
||||
const_cast<volScalarField&>
|
||||
const volTensorField SSplusWW
|
||||
(
|
||||
mesh_.lookupObject<volScalarField>(type())
|
||||
(symm(gradU) & symm(gradU))
|
||||
+ (skew(gradU) & skew(gradU))
|
||||
);
|
||||
|
||||
Lambda2 = -eigenValues(SSplusWW)().component(vector::Y);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::Lambda2::write(const bool postProcess)
|
||||
{
|
||||
const volScalarField& Lambda2 =
|
||||
obr_.lookupObject<volScalarField>(type());
|
||||
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << Lambda2.name() << nl
|
||||
<< endl;
|
||||
|
||||
Lambda2.write();
|
||||
|
||||
return true;
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
-eigenValues(SSplusWW)().component(vector::Y)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ Description
|
||||
the velocity gradient tensor.
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObjects::fieldExpression
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
@ -43,8 +44,7 @@ SourceFiles
|
||||
#ifndef functionObjects_Lambda2_H
|
||||
#define functionObjects_Lambda2_H
|
||||
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "fieldExpression.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -59,22 +59,8 @@ namespace functionObjects
|
||||
|
||||
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:
|
||||
|
||||
@ -99,14 +85,8 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the Lambda2 data
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Calculate Lambda2
|
||||
//- Calculate the Lambda2 field
|
||||
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
|
||||
Lambda2/Lambda2.C
|
||||
CourantNo/CourantNo.C
|
||||
Peclet/Peclet.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
||||
|
||||
@ -4,7 +4,8 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
110
src/postProcessing/functionObjects/field/Peclet/Peclet.H
Normal file
110
src/postProcessing/functionObjects/field/Peclet/Peclet.H
Normal file
@ -0,0 +1,110 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjects::Peclet
|
||||
|
||||
Group
|
||||
grpUtilitiesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object calculates and outputs the Peclet number as a
|
||||
surfaceScalarField.
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObjects::fieldExpression
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
Peclet.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_Peclet_H
|
||||
#define functionObjects_Peclet_H
|
||||
|
||||
#include "fieldExpression.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Peclet Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Peclet
|
||||
:
|
||||
public fieldExpression
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of flux field, default is "phi"
|
||||
word phiName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Peclet");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
Peclet
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~Peclet();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the Peclet data
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Calculate the Peclet number field
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -88,7 +88,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Calculate the Q-field
|
||||
//- Calculate the Q field
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
@ -24,7 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "vorticity.H"
|
||||
#include "volFields.H"
|
||||
#include "fvcCurl.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
@ -55,30 +54,8 @@ Foam::functionObjects::vorticity::vorticity
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
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);
|
||||
}
|
||||
fieldExpression(name, runTime, dict, "U", "vorticity")
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
@ -89,46 +66,23 @@ Foam::functionObjects::vorticity::~vorticity()
|
||||
|
||||
// * * * * * * * * * * * * * * * 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 (UName_ != "U")
|
||||
if (foundField<volVectorField>(fieldName_))
|
||||
{
|
||||
outputName_ = typeName + "(" + UName_ + ")";
|
||||
return store
|
||||
(
|
||||
resultName_,
|
||||
fvc::curl(lookupField<volVectorField>(fieldName_))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
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.
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObjects::fieldExpression
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
@ -41,8 +42,7 @@ SourceFiles
|
||||
#ifndef functionObjects_vorticity_H
|
||||
#define functionObjects_vorticity_H
|
||||
|
||||
#include "fvMeshFunctionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "fieldExpression.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -57,25 +57,8 @@ namespace functionObjects
|
||||
|
||||
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:
|
||||
|
||||
@ -100,14 +83,8 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the vorticity data
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Calculate the vorticity and write
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user