functionObjects: Added shearStress
This function will output the volumetric shear stress as a symmetric tensor field
This commit is contained in:
@ -47,6 +47,7 @@ PecletNo/PecletNo.C
|
||||
blendingFactor/blendingFactor.C
|
||||
pressure/pressure.C
|
||||
MachNo/MachNo.C
|
||||
shearStress/shearStress.C
|
||||
|
||||
turbulenceFields/turbulenceFields.C
|
||||
yPlus/yPlus.C
|
||||
|
||||
123
src/functionObjects/field/shearStress/shearStress.C
Normal file
123
src/functionObjects/field/shearStress/shearStress.C
Normal file
@ -0,0 +1,123 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2020 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 "shearStress.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(shearStress, 0);
|
||||
addToRunTimeSelectionTable(functionObject, shearStress, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::shearStress::shearStress
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
writeLocalObjects(obr_, false),
|
||||
phaseName_(word::null)
|
||||
{
|
||||
read(dict);
|
||||
resetLocalObjectName(IOobject::groupName(type(), phaseName_));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::shearStress::~shearStress()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::shearStress::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
fvMeshFunctionObject::read(dict);
|
||||
writeLocalObjects::read(dict);
|
||||
|
||||
phaseName_ = dict.lookupOrDefault<word>("phase", word::null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::shearStress::execute()
|
||||
{
|
||||
const word fieldName(IOobject::groupName(type(), phaseName_));
|
||||
|
||||
typedef compressible::turbulenceModel cmpModel;
|
||||
typedef incompressible::turbulenceModel icoModel;
|
||||
|
||||
if (mesh_.foundObject<cmpModel>(turbulenceModel::propertiesName))
|
||||
{
|
||||
const cmpModel& model =
|
||||
mesh_.lookupObject<cmpModel>(turbulenceModel::propertiesName);
|
||||
|
||||
return store(fieldName, model.devRhoReff());
|
||||
}
|
||||
else if (mesh_.foundObject<icoModel>(turbulenceModel::propertiesName))
|
||||
{
|
||||
const icoModel& model =
|
||||
mesh_.lookupObject<icoModel>(turbulenceModel::propertiesName);
|
||||
|
||||
return store(fieldName, model.devReff());
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unable to find turbulence model in the "
|
||||
<< "database" << exit(FatalError);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::shearStress::write()
|
||||
{
|
||||
return writeLocalObjects::write();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
111
src/functionObjects/field/shearStress/shearStress.H
Normal file
111
src/functionObjects/field/shearStress/shearStress.H
Normal file
@ -0,0 +1,111 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2020 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::shearStress
|
||||
|
||||
Description
|
||||
Calculates and writes the shear-stress as the volSymmTensorField field
|
||||
'shearStress'.
|
||||
|
||||
See also
|
||||
Foam::functionObjects::fieldExpression
|
||||
Foam::functionObjects::fvMeshFunctionObject
|
||||
|
||||
SourceFiles
|
||||
shearStress.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjects_shearStress_H
|
||||
#define functionObjects_shearStress_H
|
||||
|
||||
#include "fieldExpression.H"
|
||||
#include "writeLocalObjects.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class shearStress Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class shearStress
|
||||
:
|
||||
public fvMeshFunctionObject,
|
||||
public writeLocalObjects
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The name of the phase
|
||||
word phaseName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("shearStress");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from Time and dictionary
|
||||
shearStress
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~shearStress();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read the data
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Calculate the shearStress field
|
||||
virtual bool execute();
|
||||
|
||||
//- Do nothing
|
||||
virtual bool write();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user