GIT: conflict resolution

This commit is contained in:
andy
2012-09-26 12:13:44 +01:00
636 changed files with 20768 additions and 5580 deletions

View File

@ -23,25 +23,28 @@ License
\*---------------------------------------------------------------------------*/
#include "pressureCoefficient.H"
#include "CourantNo.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "dictionary.H"
#include "zeroGradientFvPatchFields.H"
#include "fvcSurfaceIntegrate.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::pressureCoefficient, 0);
defineTypeNameAndDebug(Foam::CourantNo, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::pressureCoefficient::rho
Foam::tmp<Foam::volScalarField> Foam::CourantNo::rho
(
const volScalarField& p
const surfaceScalarField& phi
) const
{
if (p.dimensions() == dimPressure)
if (phi.dimensions() == dimMass/dimTime)
{
return(obr_.lookupObject<volScalarField>(rhoName_));
return (obr_.lookupObject<volScalarField>(rhoName_));
}
else
{
@ -67,7 +70,7 @@ Foam::tmp<Foam::volScalarField> Foam::pressureCoefficient::rho
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pressureCoefficient::pressureCoefficient
Foam::CourantNo::CourantNo
(
const word& name,
const objectRegistry& obr,
@ -78,9 +81,8 @@ Foam::pressureCoefficient::pressureCoefficient
name_(name),
obr_(obr),
active_(true),
pName_("p"),
rhoName_("rho"),
magUinf_(0.0)
phiName_("phi"),
rhoName_("rho")
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
@ -88,7 +90,7 @@ Foam::pressureCoefficient::pressureCoefficient
active_ = false;
WarningIn
(
"pressureCoefficient::pressureCoefficient"
"CourantNo::CourantNo"
"("
"const word&, "
"const objectRegistry&, "
@ -100,60 +102,94 @@ Foam::pressureCoefficient::pressureCoefficient
}
read(dict);
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField* CourantNoPtr
(
new volScalarField
(
IOobject
(
type(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ
),
mesh,
dimensionedScalar("0", dimless, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
mesh.objectRegistry::store(CourantNoPtr);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pressureCoefficient::~pressureCoefficient()
Foam::CourantNo::~CourantNo()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::pressureCoefficient::read(const dictionary& dict)
void Foam::CourantNo::read(const dictionary& dict)
{
if (active_)
{
pName_ = dict.lookupOrDefault<word>("pName", "p");
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
dict.lookup("magUinf") >> magUinf_;
}
}
void Foam::pressureCoefficient::execute()
void Foam::CourantNo::execute()
{
// Do nothing - only valid on write
}
void Foam::pressureCoefficient::end()
void Foam::CourantNo::end()
{
// Do nothing - only valid on write
}
void Foam::pressureCoefficient::write()
void Foam::CourantNo::write()
{
if (active_)
{
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volScalarField pressureCoefficient
(
IOobject
const surfaceScalarField& phi =
mesh.lookupObject<surfaceScalarField>(phiName_);
volScalarField& CourantNo =
const_cast<volScalarField&>
(
"pressureCoefficient",
obr_.time().timeName(),
obr_,
IOobject::NO_READ
),
p/(0.5*rho(p)*sqr(magUinf_))
mesh.lookupObject<volScalarField>(type())
);
scalarField& iField = CourantNo.internalField();
const scalarField sumPhi
(
fvc::surfaceSum(mag(phi))().internalField()
/rho(phi)().internalField()
);
pressureCoefficient.write();
iField = 0.5*sumPhi/mesh.V().field()*mesh.time().deltaTValue();
CourantNo.correctBoundaryConditions();
CourantNo.write();
Info<< type() << " output:" << nl
<< " writing " << CourantNo.name() << "field" << nl << endl;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,27 +22,27 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::staticPressure
Group
grpUtilitiesFunctionObjects
Foam::CourantNo
Description
Converts kinematic pressure to static pressure, from the name of the
pressure field, and density, i.e.
p_static = density*p_kinematic
This function object calculates and outputs the Courant number as a
volScalarField. The field is stored on the mesh database so that it can
be retrieved and used for other applications.
SourceFiles
staticPressure.C
IOstaticPressure.H
CourantNo.C
IOCourantNo.H
\*---------------------------------------------------------------------------*/
#ifndef staticPressure_H
#define staticPressure_H
#ifndef CourantNo_H
#define CourantNo_H
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.H"
#include "OFstream.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -55,51 +55,53 @@ class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class staticPressure Declaration
Class CourantNo Declaration
\*---------------------------------------------------------------------------*/
class staticPressure
class CourantNo
{
// Private data
//- Name of this set of staticPressure objects
//- Name of this set of CourantNo objects
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- on/off switch
//- On/off switch
bool active_;
//- Name of pressure field, default is "p"
word pName_;
//- Name of flux field, default is "phi"
word phiName_;
//- Density value
scalar rho_;
//- Name of density field (optional)
word rhoName_;
// Private Member Functions
//- Return true if the pressure field corresponds to kinematic pressure
bool isKinematicPressure();
//- Return 1 if the flux field is volumetric, otherwise return rho
// from the database
tmp<volScalarField> rho(const surfaceScalarField& p) const;
//- Disallow default bitwise copy construct
staticPressure(const staticPressure&);
CourantNo(const CourantNo&);
//- Disallow default bitwise assignment
void operator=(const staticPressure&);
void operator=(const CourantNo&);
public:
//- Runtime type information
TypeName("staticPressure");
TypeName("CourantNo");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
staticPressure
CourantNo
(
const word& name,
const objectRegistry&,
@ -109,18 +111,18 @@ public:
//- Destructor
virtual ~staticPressure();
virtual ~CourantNo();
// Member Functions
//- Return name of the set of staticPressure
//- Return name of the set of CourantNo
virtual const word& name() const
{
return name_;
}
//- Read the staticPressure data
//- Read the CourantNo data
virtual void read(const dictionary&);
//- Execute, currently does nothing
@ -129,7 +131,7 @@ public:
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the staticPressure and write
//- Calculate the CourantNo and write
virtual void write();
//- Update for changes of mesh

View File

@ -23,18 +23,18 @@ License
\*---------------------------------------------------------------------------*/
#include "pressureCoefficientFunctionObject.H"
#include "CourantNoFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(pressureCoefficientFunctionObject, 0);
defineNamedTemplateTypeNameAndDebug(CourantNoFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
pressureCoefficientFunctionObject,
CourantNoFunctionObject,
dictionary
);
}

View File

@ -22,29 +22,28 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::pressureCoefficientFunctionObject
Foam::CourantNoFunctionObject
Description
FunctionObject wrapper around pressureCoefficient to allow it to be created
FunctionObject wrapper around CourantNo to allow it to be created
via the functions entry within controlDict.
SourceFiles
pressureCoefficientFunctionObject.C
CourantNoFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef pressureCoefficientFunctionObject_H
#define pressureCoefficientFunctionObject_H
#ifndef CourantNoFunctionObject_H
#define CourantNoFunctionObject_H
#include "pressureCoefficient.H"
#include "CourantNo.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<pressureCoefficient>
pressureCoefficientFunctionObject;
typedef OutputFilterFunctionObject<CourantNo> CourantNoFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -22,24 +22,24 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::IOpressureCoefficient
Foam::IOCourantNo
Description
Instance of the generic IOOutputFilter for pressureCoefficient.
Instance of the generic IOOutputFilter for CourantNo.
\*---------------------------------------------------------------------------*/
#ifndef IOpressureCoefficient_H
#define IOpressureCoefficient_H
#ifndef IOCourantNo_H
#define IOCourantNo_H
#include "pressureCoefficient.H"
#include "CourantNo.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<pressureCoefficient> IOpressureCoefficient;
typedef IOOutputFilter<CourantNo> IOCourantNo;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,17 +1,23 @@
codedFunctionObject/codedFunctionObject.C
CourantNo/CourantNo.C
CourantNo/CourantNoFunctionObject.C
dsmcFields/dsmcFields.C
dsmcFields/dsmcFieldsFunctionObject.C
pressureCoefficient/pressureCoefficient.C
pressureCoefficient/pressureCoefficientFunctionObject.C
pressureTools/pressureTools.C
pressureTools/pressureToolsFunctionObject.C
staticPressure/staticPressure.C
staticPressure/staticPressureFunctionObject.C
scalarTransport/scalarTransport.C
scalarTransport/scalarTransportFunctionObject.C
timeActivatedFileUpdate/timeActivatedFileUpdate.C
timeActivatedFileUpdate/timeActivatedFileUpdateFunctionObject.C
wallShearStress/wallShearStress.C
wallShearStress/wallShearStressFunctionObject.C
yPlusLES/yPlusLES.C
yPlusLES/yPlusLESFunctionObject.C

View File

@ -1,5 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fieldSources/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/dsmc/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
@ -13,6 +14,7 @@ EXE_INC = \
LIB_LIBS = \
-lfiniteVolume \
-lfieldSources \
-lmeshTools \
-lsampling \
-llagrangian \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,24 +22,24 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::IOstaticPressure
Foam::IOpressureTools
Description
Instance of the generic IOOutputFilter for staticPressure.
Instance of the generic IOOutputFilter for pressureTools.
\*---------------------------------------------------------------------------*/
#ifndef IOstaticPressure_H
#define IOstaticPressure_H
#ifndef IOpressureTools_H
#define IOpressureTools_H
#include "staticPressure.H"
#include "pressureTools.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<staticPressure> IOstaticPressure;
typedef IOOutputFilter<pressureTools> IOpressureTools;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,28 +23,119 @@ License
\*---------------------------------------------------------------------------*/
#include "staticPressure.H"
#include "pressureTools.H"
#include "volFields.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::staticPressure, 0);
defineTypeNameAndDebug(Foam::pressureTools, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::staticPressure::isKinematicPressure()
Foam::word Foam::pressureTools::pName() const
{
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
word fieldName = "p";
return p.dimensions() == sqr(dimLength)/sqr(dimTime);
if (calcTotal_)
{
fieldName = "total(" + fieldName + ")";
}
else
{
fieldName = "static(" + fieldName + ")";
}
if (calcCoeff_)
{
fieldName = fieldName + "_coeff";
}
return fieldName;
}
Foam::dimensionedScalar Foam::pressureTools::rho
(
const volScalarField& p
) const
{
if (p.dimensions() == dimPressure)
{
return dimensionedScalar("1", dimless, 1.0);
}
else
{
return dimensionedScalar("rhoRef", dimDensity, rhoRef_);
}
}
Foam::dimensionedScalar Foam::pressureTools::pRef() const
{
dimensionedScalar value("pRef", dimPressure, 0.0);
if (calcTotal_)
{
value.value() += pRef_;
}
return pRef();
}
Foam::tmp<Foam::volScalarField> Foam::pressureTools::pDyn() const
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
tmp<volScalarField> tpDyn
(
new volScalarField
(
IOobject
(
"pDyn",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimPressure, 0.0)
)
);
if (calcTotal_)
{
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
tpDyn() == 0.5*magSqr(U);
}
return tpDyn;
}
Foam::tmp<Foam::volScalarField> Foam::pressureTools::convertToCoeff
(
const volScalarField& p
) const
{
tmp<volScalarField> tCoeff(p);
if (calcCoeff_)
{
tCoeff() /= pDyn();
}
return tCoeff;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::staticPressure::staticPressure
Foam::pressureTools::pressureTools
(
const word& name,
const objectRegistry& obr,
@ -55,8 +146,12 @@ Foam::staticPressure::staticPressure
name_(name),
obr_(obr),
active_(true),
pName_(dict.lookupOrDefault<word>("p", "p")),
rho_(readScalar(dict.lookup("rho")))
calcTotal_(false),
calcCoeff_(false),
pName_("p"),
UName_("U"),
pRef_(0.0),
rhoRef_(1.0)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
@ -64,7 +159,7 @@ Foam::staticPressure::staticPressure
active_ = false;
WarningIn
(
"staticPressure::staticPressure"
"pressureTools::pressureTools"
"("
"const word&, "
"const objectRegistry&, "
@ -74,25 +169,6 @@ Foam::staticPressure::staticPressure
) << "No fvMesh available, deactivating." << nl
<< endl;
}
else
{
// Check if the pressure is kinematic pressure, otherwise deactivate
if (!isKinematicPressure())
{
active_ = false;
WarningIn
(
"staticPressure::staticPressure"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "Pressure is not kinematic pressure, deactivating." << nl
<< endl;
}
}
read(dict);
}
@ -100,53 +176,68 @@ Foam::staticPressure::staticPressure
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::staticPressure::~staticPressure()
Foam::pressureTools::~pressureTools()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::staticPressure::read(const dictionary& dict)
void Foam::pressureTools::read(const dictionary& dict)
{
if (active_)
{
dict.readIfPresent("p", pName_);
dict.lookup("rho") >> rho_;
dict.readIfPresent("pName", pName_);
dict.readIfPresent("UName", UName_);
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
if (p.dimensions() != p.dimensions())
{
dict.lookup("rhoRef") >> rhoRef_;
}
dict.lookup("calcTotal") >> calcTotal_;
if (calcTotal_)
{
dict.lookup("pRef") >> pRef_;
}
dict.lookup("calcCoeff") >> calcCoeff_;
}
}
void Foam::staticPressure::execute()
void Foam::pressureTools::execute()
{
// Do nothing - only valid on write
}
void Foam::staticPressure::end()
void Foam::pressureTools::end()
{
// Do nothing - only valid on write
}
void Foam::staticPressure::write()
void Foam::pressureTools::write()
{
if (active_)
{
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
volScalarField pStatic
volScalarField pResult
(
IOobject
(
"pStatic",
pName(),
obr_.time().timeName(),
obr_,
IOobject::NO_READ
),
dimensionedScalar("rho", dimDensity, rho_)*p
convertToCoeff(rho(p)*(p + pDyn()) + pRef())
);
pStatic.write();
pResult.write();
}
}

View File

@ -0,0 +1,194 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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::pressureTools
Description
This function object includes tools to manipulate the pressure into
different forms. These currently include:
- static pressure
p_s = rho*p_k
- total pressure
p_T = pRef + p_s + 0.5 rho |U|^2
- static pressure coefficient
Cp_s = p_s / (0.5 rho |U|^2)
- total pressure coefficient
Cp_T = p_T / (0.5 rho |U|^2)
The function object will operate on both kinematic (p_k) and static
pressure (p_s) fields, and the result is written as a volScalarField.
SourceFiles
pressureTools.C
IOpressureTools.H
\*---------------------------------------------------------------------------*/
#ifndef pressureTools_H
#define pressureTools_H
#include "volFieldsFwd.H"
#include "pointFieldFwd.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class pressureTools Declaration
\*---------------------------------------------------------------------------*/
class pressureTools
{
// Private data
//- Name of this set of pressureTools objects
word name_;
//- Reference to the database
const objectRegistry& obr_;
//- On/off switch
bool active_;
//- Flag to calculate total pressure
bool calcTotal_;
//- Flag to calculate pressure coefficient
bool calcCoeff_;
//- Name of pressure field, default is "p"
word pName_;
//- Name of velocity field, default is "U"
word UName_;
//- Reference pressure level (used for total pressure)
scalar pRef_;
//- Reference density value
scalar rhoRef_;
// Private Member Functions
//- Return the name of the derived pressure field
word pName() const;
//- Return the density scaling if supplied with kinematic pressure
dimensionedScalar rho(const volScalarField& p) const;
//- Return the reference pressure
dimensionedScalar pRef() const;
//- Calculate and return the (kinematic) dynamic pressure
tmp<volScalarField> pDyn() const;
//- Convert to coeff data by applying the pDyn scaling
tmp<volScalarField> convertToCoeff(const volScalarField& p) const;
//- Disallow default bitwise copy construct
pressureTools(const pressureTools&);
//- Disallow default bitwise assignment
void operator=(const pressureTools&);
public:
//- Runtime type information
TypeName("pressureTools");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
pressureTools
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~pressureTools();
// Member Functions
//- Return name of the set of pressureTools
virtual const word& name() const
{
return name_;
}
//- Read the pressureTools data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the pressureTools and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,18 +23,18 @@ License
\*---------------------------------------------------------------------------*/
#include "staticPressureFunctionObject.H"
#include "pressureToolsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(staticPressureFunctionObject, 0);
defineNamedTemplateTypeNameAndDebug(pressureToolsFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
staticPressureFunctionObject,
pressureToolsFunctionObject,
dictionary
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,29 +22,29 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::staticPressureFunctionObject
Foam::pressureToolsFunctionObject
Description
FunctionObject wrapper around staticPressure to allow it to be created via
FunctionObject wrapper around pressureTools to allow it to be created via
the functions entry within controlDict.
SourceFiles
staticPressureFunctionObject.C
pressureToolsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef staticPressureFunctionObject_H
#define staticPressureFunctionObject_H
#ifndef pressureToolsFunctionObject_H
#define pressureToolsFunctionObject_H
#include "staticPressure.H"
#include "pressureTools.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<staticPressure>
staticPressureFunctionObject;
typedef OutputFilterFunctionObject<pressureTools>
pressureToolsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::IOscalarTransport
Description
Instance of the generic IOOutputFilter for scalarTransport.
\*---------------------------------------------------------------------------*/
#ifndef IOscalarTransport_H
#define IOscalarTransport_H
#include "scalarTransport.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<scalarTransport> IOscalarTransport;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,271 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "scalarTransport.H"
#include "surfaceFields.H"
#include "dictionary.H"
#include "fixedValueFvPatchFields.H"
#include "zeroGradientFvPatchFields.H"
#include "fvScalarMatrix.H"
#include "fvmDdt.H"
#include "fvmDiv.H"
#include "fvcDiv.H"
#include "fvmLaplacian.H"
#include "fvmSup.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::scalarTransport, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::wordList Foam::scalarTransport::boundaryTypes() const
{
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
wordList bTypes(U.boundaryField().size());
forAll(bTypes, patchI)
{
const fvPatchField<vector>& pf = U.boundaryField()[patchI];
if (isA<fixedValueFvPatchVectorField>(pf))
{
bTypes[patchI] = fixedValueFvPatchScalarField::typeName;
}
else
{
bTypes[patchI] = zeroGradientFvPatchScalarField::typeName;
}
}
return bTypes;
}
Foam::tmp<Foam::volScalarField> Foam::scalarTransport::DT
(
const surfaceScalarField& phi
) const
{
typedef incompressible::turbulenceModel icoModel;
typedef compressible::turbulenceModel cmpModel;
if (userDT_)
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"DT",
mesh_.time().timeName(),
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("DT", phi.dimensions()/dimLength, DT_)
)
);
}
else if (mesh_.foundObject<icoModel>("turbulenceModel"))
{
const icoModel& model = mesh_.lookupObject<icoModel>("turbulenceModel");
return model.nuEff();
}
else if (mesh_.foundObject<cmpModel>("turbulenceModel"))
{
const cmpModel& model = mesh_.lookupObject<cmpModel>("turbulenceModel");
return model.muEff();
}
else
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"DT",
mesh_.time().timeName(),
mesh_.time(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("DT", phi.dimensions()/dimLength, 0.0)
)
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::scalarTransport::scalarTransport
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
mesh_(refCast<const fvMesh>(obr)),
active_(true),
phiName_("phi"),
UName_("U"),
DT_(0.0),
userDT_(false),
resetOnStartUp_(false),
nCorr_(0),
autoSchemes_(false),
sources_(mesh_),
T_
(
IOobject
(
name,
mesh_.time().timeName(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("zero", dimless, 0.0),
boundaryTypes()
)
{
read(dict);
if (resetOnStartUp_)
{
T_ == dimensionedScalar("zero", dimless, 0.0);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::scalarTransport::~scalarTransport()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::scalarTransport::read(const dictionary& dict)
{
if (active_)
{
Info<< type() << ":" << nl;
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
UName_ = dict.lookupOrDefault<word>("UName", "U");
userDT_ = false;
if (dict.readIfPresent("DT", DT_))
{
userDT_ = true;
}
dict.lookup("resetOnStartUp") >> resetOnStartUp_;
dict.readIfPresent("nCorr", nCorr_);
dict.lookup("autoSchemes") >> autoSchemes_;
sources_.reset(dict.subDict("sources"));
}
}
void Foam::scalarTransport::execute()
{
Info<< type() << " output:" << endl;
const surfaceScalarField& phi =
mesh_.lookupObject<surfaceScalarField>(phiName_);
// calculate the diffusivity
volScalarField DT(this->DT(phi));
// set schemes
word schemeVar = T_.name();
if (autoSchemes_)
{
schemeVar = UName_;
}
word divScheme("div(phi," + schemeVar + ")");
word laplacianScheme("laplacian(" + DT.name() + "," + schemeVar + ")");
// set under-relaxation coeff
scalar relaxCoeff = 0.0;
if (mesh_.relaxEquation(schemeVar))
{
relaxCoeff = mesh_.equationRelaxationFactor(schemeVar);
}
// solve
for (label i = 0; i <= nCorr_; i++)
{
fvScalarMatrix TEqn
(
fvm::ddt(T_)
+ fvm::div(phi, T_, divScheme)
- fvm::laplacian(DT, T_, laplacianScheme)
==
sources_(T_)
);
TEqn.relax(relaxCoeff);
sources_.constrain(TEqn);
TEqn.solve(mesh_.solverDict(UName_));
}
Info<< endl;
}
void Foam::scalarTransport::end()
{
// Do nothing
}
void Foam::scalarTransport::write()
{
// Do nothing
}
// ************************************************************************* //

View File

@ -0,0 +1,188 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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::scalarTransport
Description
This function object evolves a passive scalar transport equation. The
field in ininitially zero, to which sources are added. The field name
is assigned the name of the function object. Boundary conditions are
automatically applied, based on the velocity boundary conditions.
- the field can be zeroed on start-up using the resetOnStartUp flag
- to employ the same numerical schemes as the flow velocity, use the
autoSchemes flag
- the diffusivity can be set manually using the DT entry, or retrieved
from the turbulence model (if applicable)
SourceFiles
scalarTransport.C
IOscalarTransport.H
SeeAlso
Foam::basicSourceList
\*---------------------------------------------------------------------------*/
#ifndef scalarTransport_H
#define scalarTransport_H
#include "volFields.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.H"
#include "fvMatricesFwd.H"
#include "basicSourceList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class scalarTransport Declaration
\*---------------------------------------------------------------------------*/
class scalarTransport
{
// Private data
//- Name of this set of scalarTransport objects
word name_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- On/off switch
bool active_;
//- Name of flux field (optional)
word phiName_;
//- Name of velocity field (optional)
word UName_;
//- Diffusion coefficient (optional)
scalar DT_;
//- Flag to indicate whether user DT_ is used
bool userDT_;
//- Flag to reset scalar field on start-up
bool resetOnStartUp_;
//- Number of corrector iterations (optional)
label nCorr_;
//- Flag to employ schemes for velocity for scalar transport
bool autoSchemes_;
//- Run-time selectable sources
basicSourceList sources_;
//- The scalar field
volScalarField T_;
// Private Member Functions
//- Return the boundary types for the scalar field
wordList boundaryTypes() const;
//- Return the diffusivity field
tmp<volScalarField> DT(const surfaceScalarField& phi) const;
//- Disallow default bitwise copy construct
scalarTransport(const scalarTransport&);
//- Disallow default bitwise assignment
void operator=(const scalarTransport&);
public:
//- Runtime type information
TypeName("scalarTransport");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
scalarTransport
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~scalarTransport();
// Member Functions
//- Return name of the set of scalarTransport
virtual const word& name() const
{
return name_;
}
//- Read the scalarTransport data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the scalarTransport and write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "scalarTransportFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(scalarTransportFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
scalarTransportFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::scalarTransportFunctionObject
Description
FunctionObject wrapper around scalarTransport to allow it to be
created via the functions entry within controlDict.
SourceFiles
scalarTransportFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef scalarTransportFunctionObject_H
#define scalarTransportFunctionObject_H
#include "scalarTransport.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<scalarTransport>
scalarTransportFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::IOwallShearStress
Description
Instance of the generic IOOutputFilter for wallShearStress.
\*---------------------------------------------------------------------------*/
#ifndef IOwallShearStress_H
#define IOwallShearStress_H
#include "wallShearStress.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<wallShearStress> IOwallShearStress;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,251 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "wallShearStress.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::wallShearStress, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::wallShearStress::makeFile()
{
// Create the output file if not already created
if (outputFilePtr_.empty())
{
if (debug)
{
Info<< "Creating output file." << endl;
}
// File update
if (Pstream::master())
{
fileName outputDir;
word startTimeName =
obr_.time().timeName(obr_.time().startTime().value());
if (Pstream::parRun())
{
// Put in undecomposed case (Note: gives problems for
// distributed data running)
outputDir =
obr_.time().path()/".."/name_/startTimeName;
}
else
{
outputDir = obr_.time().path()/name_/startTimeName;
}
// Create directory if does not exist
mkDir(outputDir);
// Open new file at start up
outputFilePtr_.reset(new OFstream(outputDir/(type() + ".dat")));
// Add headers to output data
outputFilePtr_() << "# Wall shear stress" << nl
<< "# time " << token::TAB << "patch" << token::TAB
<< "min" << token::TAB << "max" << endl;
}
}
}
void Foam::wallShearStress::calcShearStress
(
const fvMesh& mesh,
const volSymmTensorField& Reff,
volVectorField& shearStress
)
{
forAll(shearStress.boundaryField(), patchI)
{
const polyPatch& pp = mesh.boundaryMesh()[patchI];
if (isA<wallPolyPatch>(pp))
{
vectorField& ssp = shearStress.boundaryField()[patchI];
const vectorField& Sfp = mesh.Sf().boundaryField()[patchI];
const scalarField& magSfp = mesh.magSf().boundaryField()[patchI];
const symmTensorField& Reffp = Reff.boundaryField()[patchI];
ssp = (-Sfp/magSfp) & Reffp;
vector minSsp = min(ssp);
vector maxSsp = max(ssp);
outputFilePtr_() << mesh.time().timeName() << token::TAB
<< pp.name() << token::TAB << minSsp
<< token::TAB << maxSsp << endl;
if (log_)
{
Info<< " min/max(" << pp.name() << ") = "
<< minSsp << ", " << maxSsp << endl;
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::wallShearStress::wallShearStress
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
log_(false),
phiName_("phi"),
outputFilePtr_(NULL)
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"wallShearStress::wallShearStress"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
<< endl;
}
makeFile();
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallShearStress::~wallShearStress()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::wallShearStress::read(const dictionary& dict)
{
if (active_)
{
log_ = dict.lookupOrDefault<Switch>("log", false);
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
}
}
void Foam::wallShearStress::execute()
{
// Do nothing - only valid on write
}
void Foam::wallShearStress::end()
{
// Do nothing - only valid on write
}
void Foam::wallShearStress::write()
{
typedef compressible::turbulenceModel cmpModel;
typedef incompressible::turbulenceModel icoModel;
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
volVectorField wallShearStress
(
IOobject
(
"wallShearStress",
mesh.time().timeName(),
mesh,
IOobject::NO_READ
),
mesh,
dimensionedVector("0", sqr(dimLength)/sqr(dimTime), vector::zero)
);
if (log_)
{
Info<< type() << " output:" << nl;
}
const surfaceScalarField& phi =
obr_.lookupObject<surfaceScalarField>(phiName_);
tmp<volSymmTensorField> Reff;
if (phi.dimensions() == dimMass/dimTime)
{
const cmpModel& model =
mesh.lookupObject<cmpModel>("turbulenceModel");
Reff = model.devRhoReff();
}
else
{
const icoModel& model =
mesh.lookupObject<icoModel>("turbulenceModel");
Reff = model.devReff();
}
calcShearStress(mesh, Reff(), wallShearStress);
if (log_)
{
Info<< endl;
}
wallShearStress.write();
}
}
// ************************************************************************* //

View File

@ -22,42 +22,42 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::pressureCoefficient
Foam::wallShearStress
Group
grpUtilitiesFunctionObjects
Description
Calculates pressure coefficient, \f$c_p\f$
This function object evaluates and outputs the shear stress at wall
patches. The result is written as a volVectorField to time folders as
field 'wallShearStress'
\f[
c_p = \frac{p}{p_{dyn,\infty}}
\f]
where:
\f[
p_{dyn,\infty} = 0.5 \rho |U_{\infty}|^2
Stress = R \dot n
\f]
The shear stress (symmetrical) tensor field is retrieved from the
turbulence model.
where
\vartable
c_p | pressure coefficient
p | pressure [bar]
\rho | density [kg/m3]
U | velocity [m/s]
R | stress tensor
n | patch normal vector (into the domain)
\endvartable
SourceFiles
pressureCoefficient.C
IOpressureCoefficient.H
wallShearStress.C
IOwallShearStress.H
\*---------------------------------------------------------------------------*/
#ifndef pressureCoefficient_H
#define pressureCoefficient_H
#ifndef wallShearStress_H
#define wallShearStress_H
#include "volFieldsFwd.H"
#include "pointFieldFwd.H"
#include "Switch.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,16 +68,17 @@ namespace Foam
class objectRegistry;
class dictionary;
class mapPolyMesh;
class fvMesh;
/*---------------------------------------------------------------------------*\
Class pressureCoefficient Declaration
Class wallShearStress Declaration
\*---------------------------------------------------------------------------*/
class pressureCoefficient
class wallShearStress
{
// Private data
//- Name of this set of pressureCoefficient objects
//- Name of this set of wallShearStress object
word name_;
const objectRegistry& obr_;
@ -85,40 +86,47 @@ class pressureCoefficient
//- on/off switch
bool active_;
//- Name of pressure field, default is "p"
word pName_;
//- Switch to send output to Info as well as to file
Switch log_;
//- Name of density field (optional)
word rhoName_;
//- Name of mass/volume flux field (optional, default = phi)
word phiName_;
//- Free stream velocity magnitude [m/s]
scalar magUinf_;
//- Output file pointer
autoPtr<OFstream> outputFilePtr_;
// Private Member Functions
//- Return 1 if the pressure field is kinematic, i.e. p/rho
// otherwise return rho from database
tmp<volScalarField> rho(const volScalarField& p) const;
//- Make the output file
virtual void makeFile();
//- Calculate the shear stress
void calcShearStress
(
const fvMesh& mesh,
const volSymmTensorField& Reff,
volVectorField& shearStress
);
//- Disallow default bitwise copy construct
pressureCoefficient(const pressureCoefficient&);
wallShearStress(const wallShearStress&);
//- Disallow default bitwise assignment
void operator=(const pressureCoefficient&);
void operator=(const wallShearStress&);
public:
//- Runtime type information
TypeName("pressureCoefficient");
TypeName("wallShearStress");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
pressureCoefficient
wallShearStress
(
const word& name,
const objectRegistry&,
@ -128,18 +136,18 @@ public:
//- Destructor
virtual ~pressureCoefficient();
virtual ~wallShearStress();
// Member Functions
//- Return name of the set of pressureCoefficient
//- Return name of the set of wallShearStress
virtual const word& name() const
{
return name_;
}
//- Read the pressureCoefficient data
//- Read the wallShearStress data
virtual void read(const dictionary&);
//- Execute, currently does nothing
@ -148,7 +156,7 @@ public:
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Calculate the pressureCoefficient and write
//- Calculate the wallShearStress and write
virtual void write();
//- Update for changes of mesh

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "wallShearStressFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(wallShearStressFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
wallShearStressFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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/>.
Typedef
Foam::wallShearStressFunctionObject
Description
FunctionObject wrapper around wallShearStress to allow it to be created
via the functions entry within controlDict.
SourceFiles
wallShearStressFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef wallShearStressFunctionObject_H
#define wallShearStressFunctionObject_H
#include "wallShearStress.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<wallShearStress>
wallShearStressFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //