MomentumTransportModels: Update of the TurbulenceModels library for all flow types

providing the shear-stress term in the momentum equation for incompressible and
compressible Newtonian, non-Newtonian and visco-elastic laminar flow as well as
Reynolds averaged and large-eddy simulation of turbulent flow.

The general deviatoric shear-stress term provided by the MomentumTransportModels
library is named divDevTau for compressible flow and divDevSigma (sigma =
tau/rho) for incompressible flow, the spherical part of the shear-stress is
assumed to be either included in the pressure or handled separately.  The
corresponding stress function sigma is also provided which in the case of
Reynolds stress closure returns the effective Reynolds stress (including the
laminar contribution) or for other Reynolds averaged or large-eddy turbulence
closures returns the modelled Reynolds stress or sub-grid stress respectively.
For visco-elastic flow the sigma function returns the effective total stress
including the visco-elastic and Newtonian contributions.

For thermal flow the heat-flux generated by thermal diffusion is now handled by
the separate ThermophysicalTransportModels library allowing independent run-time
selection of the heat-flux model.

During the development of the MomentumTransportModels library significant effort
has been put into rationalising the components and supporting libraries,
removing redundant code, updating names to provide a more logical, consistent
and extensible interface and aid further development and maintenance.  All
solvers and tutorials have been updated correspondingly and backward
compatibility of the input dictionaries provided.

Henry G. Weller
CFD Direct Ltd.
This commit is contained in:
Henry Weller
2020-04-14 20:44:22 +01:00
parent 08e686eb18
commit de66b1be68
833 changed files with 3717 additions and 4015 deletions

View File

@ -7,11 +7,10 @@ EXE_INC = \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude
LIB_LIBS = \
@ -19,10 +18,9 @@ LIB_LIBS = \
-lfluidThermophysicalModels \
-lsolidThermo \
-lincompressibleTransportModels \
-lturbulenceModels \
-lcompressibleTransportModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lmomentumTransportModels \
-lincompressibleMomentumTransportModels \
-lfluidThermoMomentumTransportModels \
-lthermophysicalTransportModels \
-lmeshTools \
-lsurfMesh \

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "PecletNo.H"
#include "turbulenceModel.H"
#include "momentumTransportModel.H"
#include "surfaceInterpolate.H"
#include "addToRunTimeSelectionTable.H"
@ -54,9 +54,9 @@ bool Foam::functionObjects::PecletNo::calc()
{
tmp<volScalarField> nuEff
(
mesh_.lookupObject<turbulenceModel>
mesh_.lookupObject<momentumTransportModel>
(
turbulenceModel::typeName
momentumTransportModel::typeName
).nuEff()
);

View File

@ -26,7 +26,7 @@ License
#include "age.H"
#include "fvmDiv.H"
#include "fvmLaplacian.H"
#include "turbulenceModel.H"
#include "momentumTransportModel.H"
#include "inletOutletFvPatchField.H"
#include "wallFvPatch.H"
#include "zeroGradientFvPatchField.H"
@ -173,9 +173,9 @@ bool Foam::functionObjects::age::execute()
if (diffusion_)
{
tmuEff =
mesh_.lookupObject<turbulenceModel>
mesh_.lookupObject<momentumTransportModel>
(
turbulenceModel::typeName
momentumTransportModel::typeName
).muEff();
laplacianScheme =
@ -210,9 +210,9 @@ bool Foam::functionObjects::age::execute()
if (diffusion_)
{
tnuEff =
mesh_.lookupObject<turbulenceModel>
mesh_.lookupObject<momentumTransportModel>
(
turbulenceModel::typeName
momentumTransportModel::typeName
).nuEff();
laplacianScheme =

View File

@ -26,8 +26,8 @@ License
#include "shearStress.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "kinematicMomentumTransportModel.H"
#include "fluidThermoMomentumTransportModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -86,33 +86,33 @@ bool Foam::functionObjects::shearStress::execute()
{
const word fieldName(IOobject::groupName(type(), phaseName_));
typedef compressibleTurbulenceModel cmpModel;
typedef incompressibleTurbulenceModel icoModel;
typedef compressibleMomentumTransportModel cmpModel;
typedef incompressibleMomentumTransportModel icoModel;
const word turbulenceModelName
const word momentumTransportModelName
(
IOobject::groupName(turbulenceModel::typeName, phaseName_)
IOobject::groupName(momentumTransportModel::typeName, phaseName_)
);
if (mesh_.foundObject<cmpModel>(turbulenceModelName))
if (mesh_.foundObject<cmpModel>(momentumTransportModelName))
{
const cmpModel& model =
mesh_.lookupObject<cmpModel>(turbulenceModelName);
mesh_.lookupObject<cmpModel>(momentumTransportModelName);
return store(fieldName, model.devRhoReff());
return store(fieldName, model.devTau());
}
else if (mesh_.foundObject<icoModel>(turbulenceModelName))
else if (mesh_.foundObject<icoModel>(momentumTransportModelName))
{
const icoModel& model =
mesh_.lookupObject<icoModel>(turbulenceModelName);
mesh_.lookupObject<icoModel>(momentumTransportModelName);
return store(fieldName, model.devReff());
return store(fieldName, model.devSigma());
}
else
{
FatalErrorInFunction
<< "Unable to find compressible turbulence model "
<< turbulenceModelName << " in the database"
<< momentumTransportModelName << " in the database"
<< exit(FatalError);
return false;

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "turbulenceFields.H"
#include "turbulentTransportModel.H"
#include "kinematicMomentumTransportModel.H"
#include "thermophysicalTransportModel.H"
#include "addToRunTimeSelectionTable.H"
@ -59,7 +59,7 @@ const char* Foam::NamedEnum
"muEff",
"alphaEff",
"R",
"devRhoReff"
"devTau"
};
const Foam::NamedEnum
@ -81,7 +81,7 @@ const char* Foam::NamedEnum
"nut",
"nuEff",
"R",
"devReff"
"devSigma"
};
const Foam::NamedEnum
@ -117,7 +117,7 @@ Foam::functionObjects::turbulenceFields::~turbulenceFields()
const Foam::word& Foam::functionObjects::turbulenceFields::modelName()
{
return Foam::turbulenceModel::typeName;
return Foam::momentumTransportModel::typeName;
}
@ -170,7 +170,8 @@ bool Foam::functionObjects::turbulenceFields::execute()
thermophysicalTransportModel::typeName
);
const compressibleTurbulenceModel& model = ttm.momentumTransport();
const compressibleMomentumTransportModel& model =
ttm.momentumTransport();
forAllConstIter(wordHashSet, fieldSet_, iter)
{
@ -209,12 +210,12 @@ bool Foam::functionObjects::turbulenceFields::execute()
}
case compressibleField::R:
{
processField<symmTensor>(f, model.R());
processField<symmTensor>(f, model.sigma());
break;
}
case compressibleField::devRhoReff:
case compressibleField::devTau:
{
processField<symmTensor>(f, model.devRhoReff());
processField<symmTensor>(f, model.devTau());
break;
}
default:
@ -225,10 +226,10 @@ bool Foam::functionObjects::turbulenceFields::execute()
}
}
}
else if (obr_.foundObject<compressibleTurbulenceModel>(modelName()))
else if (obr_.foundObject<compressibleMomentumTransportModel>(modelName()))
{
const compressibleTurbulenceModel& model =
obr_.lookupObject<compressibleTurbulenceModel>(modelName());
const compressibleMomentumTransportModel& model =
obr_.lookupObject<compressibleMomentumTransportModel>(modelName());
forAllConstIter(wordHashSet, fieldSet_, iter)
{
@ -262,12 +263,12 @@ bool Foam::functionObjects::turbulenceFields::execute()
}
case compressibleField::R:
{
processField<symmTensor>(f, model.R());
processField<symmTensor>(f, model.sigma());
break;
}
case compressibleField::devRhoReff:
case compressibleField::devTau:
{
processField<symmTensor>(f, model.devRhoReff());
processField<symmTensor>(f, model.devTau());
break;
}
default:
@ -278,10 +279,16 @@ bool Foam::functionObjects::turbulenceFields::execute()
}
}
}
else if (obr_.foundObject<incompressible::turbulenceModel>(modelName()))
else if
(
obr_.foundObject<incompressible::momentumTransportModel>(modelName())
)
{
const incompressible::turbulenceModel& model =
obr_.lookupObject<incompressible::turbulenceModel>(modelName());
const incompressible::momentumTransportModel& model =
obr_.lookupObject<incompressible::momentumTransportModel>
(
modelName()
);
forAllConstIter(wordHashSet, fieldSet_, iter)
{
@ -315,12 +322,12 @@ bool Foam::functionObjects::turbulenceFields::execute()
}
case incompressibleField::R:
{
processField<symmTensor>(f, model.R());
processField<symmTensor>(f, model.sigma());
break;
}
case incompressibleField::devReff:
case incompressibleField::devSigma:
{
processField<symmTensor>(f, model.devReff());
processField<symmTensor>(f, model.devSigma());
break;
}
default:

View File

@ -28,10 +28,10 @@ Description
Stores turbulence fields on the mesh database for further manipulation.
Fields are stored as copies of the original, with the prefix
"turbulenceModel:", e.g.:
"momentumTransportModel:", e.g.:
\verbatim
turbulenceModel:R
momentumTransportModel:R
\endverbatim
Example of function object specification:
@ -44,7 +44,7 @@ Description
fields
(
R
devRhoReff
devTau
);
}
\endverbatim
@ -69,8 +69,8 @@ Usage
alphat | turbulence thermal diffusivity (compressible)
alphaEff | effective turbulence thermal diffusivity (compressible)
R | Reynolds stress tensor
devReff | Deviatoric part of the effective Reynolds stress
devRhoReff | Divergence of the Reynolds stress
devSigma | Deviatoric part of the effective Reynolds stress
devTau | Divergence of the Reynolds stress
\endplaintable
See also
@ -116,7 +116,7 @@ public:
muEff,
alphaEff,
R,
devRhoReff
devTau
};
static const NamedEnum<compressibleField, 8> compressibleFieldNames_;
@ -128,7 +128,7 @@ public:
nut,
nuEff,
R,
devReff
devSigma
};
static const NamedEnum<incompressibleField, 7> incompressibleFieldNames_;

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "turbulenceIntensity.H"
#include "turbulenceModel.H"
#include "momentumTransportModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -96,12 +96,19 @@ bool Foam::functionObjects::turbulenceIntensity::read(const dictionary& dict)
bool Foam::functionObjects::turbulenceIntensity::execute()
{
if (mesh_.foundObject<turbulenceModel>(turbulenceModel::typeName))
{
const turbulenceModel& turbModel = mesh_.lookupObject<turbulenceModel>
if
(
mesh_.foundObject<momentumTransportModel>
(
turbulenceModel::typeName
);
momentumTransportModel::typeName
)
)
{
const momentumTransportModel& turbModel =
mesh_.lookupObject<momentumTransportModel>
(
momentumTransportModel::typeName
);
volScalarField uPrime(sqrt((2.0/3.0)*turbModel.k()));

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "wallHeatTransferCoeff.H"
#include "turbulentTransportModel.H"
#include "kinematicMomentumTransportModel.H"
#include "wallPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
@ -198,16 +198,16 @@ bool Foam::functionObjects::wallHeatTransferCoeff::execute()
if
(
foundObject<incompressible::turbulenceModel>
foundObject<incompressible::momentumTransportModel>
(
turbulenceModel::typeName
momentumTransportModel::typeName
)
)
{
const incompressible::turbulenceModel& turbModel =
lookupObject<incompressible::turbulenceModel>
const incompressible::momentumTransportModel& turbModel =
lookupObject<incompressible::momentumTransportModel>
(
turbulenceModel::typeName
momentumTransportModel::typeName
);
return store

View File

@ -26,8 +26,8 @@ License
#include "wallShearStress.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "kinematicMomentumTransportModel.H"
#include "fluidThermoMomentumTransportModel.H"
#include "wallPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
@ -60,7 +60,7 @@ void Foam::functionObjects::wallShearStress::writeFileHeader(const label i)
Foam::tmp<Foam::volVectorField>
Foam::functionObjects::wallShearStress::calcShearStress
(
const volSymmTensorField& Reff
const volSymmTensorField& tau
)
{
tmp<volVectorField> twallShearStress
@ -69,7 +69,7 @@ Foam::functionObjects::wallShearStress::calcShearStress
(
type(),
mesh_,
dimensionedVector(Reff.dimensions(), Zero)
dimensionedVector(tau.dimensions(), Zero)
)
);
@ -82,9 +82,9 @@ Foam::functionObjects::wallShearStress::calcShearStress
const vectorField& Sfp = mesh_.Sf().boundaryField()[patchi];
const scalarField& magSfp = mesh_.magSf().boundaryField()[patchi];
const symmTensorField& Reffp = Reff.boundaryField()[patchi];
const symmTensorField& taup = tau.boundaryField()[patchi];
wallShearStressBf[patchi] = (-Sfp/magSfp) & Reffp;
wallShearStressBf[patchi] = (-Sfp/magSfp) & taup;
}
return twallShearStress;
@ -177,23 +177,23 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
bool Foam::functionObjects::wallShearStress::execute()
{
typedef compressible::turbulenceModel cmpModel;
typedef incompressible::turbulenceModel icoModel;
typedef compressible::momentumTransportModel cmpModel;
typedef incompressible::momentumTransportModel icoModel;
tmp<volSymmTensorField> Reff;
if (mesh_.foundObject<cmpModel>(turbulenceModel::typeName))
tmp<volSymmTensorField> tau;
if (mesh_.foundObject<cmpModel>(momentumTransportModel::typeName))
{
const cmpModel& model =
mesh_.lookupObject<cmpModel>(turbulenceModel::typeName);
mesh_.lookupObject<cmpModel>(momentumTransportModel::typeName);
Reff = model.devRhoReff();
tau = model.devTau();
}
else if (mesh_.foundObject<icoModel>(turbulenceModel::typeName))
else if (mesh_.foundObject<icoModel>(momentumTransportModel::typeName))
{
const icoModel& model =
mesh_.lookupObject<icoModel>(turbulenceModel::typeName);
mesh_.lookupObject<icoModel>(momentumTransportModel::typeName);
Reff = model.devReff();
tau = model.devSigma();
}
else
{
@ -204,7 +204,7 @@ bool Foam::functionObjects::wallShearStress::execute()
word name(type());
return store(name, calcShearStress(Reff));
return store(name, calcShearStress(tau));
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -119,7 +119,7 @@ protected:
//- Calculate the shear-stress
tmp<volVectorField> calcShearStress
(
const volSymmTensorField& Reff
const volSymmTensorField& tau
);

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "yPlus.H"
#include "turbulenceModel.H"
#include "momentumTransportModel.H"
#include "nutWallFunctionFvPatchScalarField.H"
#include "wallFvPatch.H"
#include "addToRunTimeSelectionTable.H"
@ -64,7 +64,7 @@ void Foam::functionObjects::yPlus::writeFileHeader(const label i)
Foam::tmp<Foam::volScalarField> Foam::functionObjects::yPlus::calcYPlus
(
const turbulenceModel& turbModel
const momentumTransportModel& turbModel
)
{
tmp<volScalarField> tyPlus
@ -161,15 +161,20 @@ bool Foam::functionObjects::yPlus::read(const dictionary& dict)
bool Foam::functionObjects::yPlus::execute()
{
if (mesh_.foundObject<turbulenceModel>
if (mesh_.foundObject<momentumTransportModel>
(
IOobject::groupName(turbulenceModel::typeName, phaseName_))
IOobject::groupName(momentumTransportModel::typeName, phaseName_))
)
{
const turbulenceModel& model = mesh_.lookupObject<turbulenceModel>
(
IOobject::groupName(turbulenceModel::typeName, phaseName_)
);
const momentumTransportModel& model =
mesh_.lookupObject<momentumTransportModel>
(
IOobject::groupName
(
momentumTransportModel::typeName,
phaseName_
)
);
word name(IOobject::groupName(type(), phaseName_));

View File

@ -75,7 +75,7 @@ namespace Foam
{
// Forward declaration of classes
class turbulenceModel;
class momentumTransportModel;
namespace functionObjects
{
@ -108,7 +108,7 @@ private:
//- Calculate y+
tmp<volScalarField> calcYPlus
(
const turbulenceModel& turbModel
const momentumTransportModel& turbModel
);

View File

@ -1,21 +1,19 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-lfluidThermophysicalModels \
-lincompressibleTransportModels \
-lcompressibleTransportModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lmomentumTransportModels \
-lincompressibleMomentumTransportModels \
-lfluidThermoMomentumTransportModels \
-lspecie \
-lfileFormats \
-lfiniteVolume \

View File

@ -26,8 +26,8 @@ License
#include "forces.H"
#include "fvcGrad.H"
#include "porosityModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "kinematicMomentumTransportModel.H"
#include "fluidThermoMomentumTransportModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -216,24 +216,24 @@ void Foam::functionObjects::forces::initialise()
Foam::tmp<Foam::volSymmTensorField>
Foam::functionObjects::forces::devRhoReff() const
Foam::functionObjects::forces::devTau() const
{
typedef compressible::turbulenceModel cmpTurbModel;
typedef incompressible::turbulenceModel icoTurbModel;
typedef compressible::momentumTransportModel cmpTurbModel;
typedef incompressible::momentumTransportModel icoTurbModel;
if (obr_.foundObject<cmpTurbModel>(turbulenceModel::typeName))
if (obr_.foundObject<cmpTurbModel>(momentumTransportModel::typeName))
{
const cmpTurbModel& turb =
obr_.lookupObject<cmpTurbModel>(turbulenceModel::typeName);
obr_.lookupObject<cmpTurbModel>(momentumTransportModel::typeName);
return turb.devRhoReff();
return turb.devTau();
}
else if (obr_.foundObject<icoTurbModel>(turbulenceModel::typeName))
else if (obr_.foundObject<icoTurbModel>(momentumTransportModel::typeName))
{
const incompressible::turbulenceModel& turb =
obr_.lookupObject<icoTurbModel>(turbulenceModel::typeName);
const incompressible::momentumTransportModel& turb =
obr_.lookupObject<icoTurbModel>(momentumTransportModel::typeName);
return rho()*turb.devReff();
return rho()*turb.devSigma();
}
else if (obr_.foundObject<fluidThermo>(fluidThermo::dictName))
{
@ -795,9 +795,9 @@ void Foam::functionObjects::forces::calcForcesMoment()
const surfaceVectorField::Boundary& Sfb =
mesh_.Sf().boundaryField();
tmp<volSymmTensorField> tdevRhoReff = devRhoReff();
const volSymmTensorField::Boundary& devRhoReffb
= tdevRhoReff().boundaryField();
tmp<volSymmTensorField> tdevTau = devTau();
const volSymmTensorField::Boundary& devTaub
= tdevTau().boundaryField();
// Scale pRef by density for incompressible simulations
scalar pRef = pRef_/rho(p);
@ -816,7 +816,7 @@ void Foam::functionObjects::forces::calcForcesMoment()
rho(p)*Sfb[patchi]*(p.boundaryField()[patchi] - pRef)
);
vectorField fT(Sfb[patchi] & devRhoReffb[patchi]);
vectorField fT(Sfb[patchi] & devTaub[patchi]);
vectorField fP(Md.size(), Zero);

View File

@ -233,7 +233,7 @@ protected:
void initialise();
//- Return the effective viscous stress (laminar + turbulent).
tmp<volSymmTensorField> devRhoReff() const;
tmp<volSymmTensorField> devTau() const;
//- Dynamic viscosity field
tmp<volScalarField> mu() const;

View File

@ -1,5 +1,4 @@
cloudInfo/cloudInfo.C
icoUncoupledKinematicCloud/icoUncoupledKinematicCloud.C
dsmcFields/dsmcFields.C
LIB = $(FOAM_LIBBIN)/liblagrangianFunctionObjects

View File

@ -1,7 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/transportModels/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \

View File

@ -1,144 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2018 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 "icoUncoupledKinematicCloud.H"
#include "singlePhaseTransportModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(icoUncoupledKinematicCloud, 0);
addToRunTimeSelectionTable
(
functionObject,
icoUncoupledKinematicCloud,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::icoUncoupledKinematicCloud::icoUncoupledKinematicCloud
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
g_
(
IOobject
(
"g",
time_.constant(),
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
dimensionedVector(dimAcceleration, Zero)
),
laminarTransport_
(
mesh_.lookupObject<singlePhaseTransportModel>("transportProperties")
),
rhoValue_
(
"rho",
dimDensity,
laminarTransport_
),
rho_
(
IOobject
(
"rho",
time_.timeName(),
mesh_
),
mesh_,
rhoValue_
),
mu_("mu", rhoValue_*laminarTransport_.nu()),
U_
(
mesh_.lookupObject<volVectorField>(dict.lookupOrDefault<word>("U", "U"))
),
kinematicCloudName_
(
dict.lookupOrDefault<word>("kinematicCloud", "kinematicCloud")
),
kinematicCloud_
(
kinematicCloudName_,
rho_,
U_,
mu_,
g_
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::icoUncoupledKinematicCloud::~icoUncoupledKinematicCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::icoUncoupledKinematicCloud::read
(
const dictionary& dict
)
{
fvMeshFunctionObject::read(dict);
return true;
}
bool Foam::functionObjects::icoUncoupledKinematicCloud::execute()
{
mu_ = rhoValue_*laminarTransport_.nu();
kinematicCloud_.evolve();
return true;
}
bool Foam::functionObjects::icoUncoupledKinematicCloud::write()
{
return true;
}
// ************************************************************************* //

View File

@ -1,174 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2019 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::icoUncoupledKinematicCloud
Description
This functionObject tracks a uncoupled kinematic particle cloud in the
specified velocity field of an incompressible flow (laminar, RANS or LES).
It may be used in conjunction with any transient single-phase incompressible
flow solver such as pisoFoam or pimpleFoam and tracks the particles or
parcels without affecting the flow-field.
The kinematicCloud requires the density of the fluid which is looked-up
from constant/transportProperties dictionary and the acceleration due to
gravity which is read from the constant/g file if present or defaults to
zero.
The kinematicCloud properties are read from the
constant/kinematicCloudProperties dictionary in the usual manner.
Example of function object specification:
\verbatim
tracks
{
libs ("liblagrangianFunctionObjects.so");
type icoUncoupledKinematicCloud;
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | Type name: icoUncoupledKinematicCloud | yes |
U | Name of the velocity field | no | U
kinematicCloud | Name of the kinematicCloud | no | kinematicCloud
\endtable
See also
Foam::functionObjects::fvMeshFunctionObject
SourceFiles
icoUncoupledKinematicCloud.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_icoUncoupledKinematicCloud_H
#define functionObjects_icoUncoupledKinematicCloud_H
#include "fvMeshFunctionObject.H"
#include "basicKinematicCollidingCloud.H"
#include "volFields.H"
#include "uniformDimensionedFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class singlePhaseTransportModel;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class icoUncoupledKinematicCloud Declaration
\*---------------------------------------------------------------------------*/
class icoUncoupledKinematicCloud
:
public fvMeshFunctionObject
{
// Private member data
//- Optional acceleration due to gravity
uniformDimensionedVectorField g_;
//- Reference to the laminar transport model
const singlePhaseTransportModel& laminarTransport_;
//- Uniform density value
dimensionedScalar rhoValue_;
//- Density field needed to construct kinematicCloud
volScalarField rho_;
//- Dynamic viscosity field needed to construct kinematicCloud
volScalarField mu_;
//- Reference to the velocity field
const volVectorField& U_;
//- Name of the cloud
word kinematicCloudName_;
//- The kinematic cloud
basicKinematicCollidingCloud kinematicCloud_;
public:
//- Runtime type information
TypeName("icoUncoupledKinematicCloud");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
icoUncoupledKinematicCloud
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Disallow default bitwise copy construction
icoUncoupledKinematicCloud(const icoUncoupledKinematicCloud&) = delete;
//- Destructor
virtual ~icoUncoupledKinematicCloud();
// Member Functions
//- Read the controls
virtual bool read(const dictionary&);
//- Track the cloud
virtual bool execute();
//- Write the cloud
virtual bool write();
// Member Operators
//- Disallow default bitwise assignment
void operator==(const icoUncoupledKinematicCloud&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,10 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
@ -13,10 +11,9 @@ LIB_LIBS = \
-lfvOptions \
-lfluidThermophysicalModels \
-lincompressibleTransportModels \
-lcompressibleTransportModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lmomentumTransportModels \
-lincompressibleMomentumTransportModels \
-lfluidThermoMomentumTransportModels \
-lspecie \
-lfiniteVolume \
-lmeshTools

View File

@ -33,7 +33,7 @@ License
#include "nonOrthogonalSolutionControl.H"
#include "phaseScalarTransport.H"
#include "surfaceFields.H"
#include "turbulenceModel.H"
#include "momentumTransportModel.H"
#include "wallFvPatch.H"
#include "zeroGradientFvPatchField.H"
@ -247,13 +247,13 @@ Foam::functionObjects::phaseScalarTransport::D
);
}
const word& nameNoPhase = turbulenceModel::typeName;
const word& nameNoPhase = momentumTransportModel::typeName;
const word namePhase = IOobject::groupName(nameNoPhase, phaseName_);
const word& name =
mesh_.foundObject<turbulenceModel>(namePhase)
mesh_.foundObject<momentumTransportModel>(namePhase)
? namePhase
: mesh_.foundObject<turbulenceModel>(nameNoPhase)
: mesh_.foundObject<momentumTransportModel>(nameNoPhase)
? nameNoPhase
: word::null;
@ -267,8 +267,8 @@ Foam::functionObjects::phaseScalarTransport::D
);
}
const turbulenceModel& turbulence =
mesh_.lookupObject<turbulenceModel>(name);
const momentumTransportModel& turbulence =
mesh_.lookupObject<momentumTransportModel>(name);
if (alphaPhi.dimensions() == dimVolume/dimTime)
{

View File

@ -29,8 +29,8 @@ License
#include "fvmDiv.H"
#include "fvmLaplacian.H"
#include "fvmSup.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "kinematicMomentumTransportModel.H"
#include "fluidThermoMomentumTransportModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -58,8 +58,8 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
const surfaceScalarField& phi
) const
{
typedef incompressible::turbulenceModel icoModel;
typedef compressible::turbulenceModel cmpModel;
typedef incompressible::momentumTransportModel icoModel;
typedef compressible::momentumTransportModel cmpModel;
word Dname("D" + s_.name());
@ -72,20 +72,20 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
dimensionedScalar(Dname, phi.dimensions()/dimLength, D_)
);
}
else if (mesh_.foundObject<icoModel>(turbulenceModel::typeName))
else if (mesh_.foundObject<icoModel>(momentumTransportModel::typeName))
{
const icoModel& model = mesh_.lookupObject<icoModel>
(
turbulenceModel::typeName
momentumTransportModel::typeName
);
return alphaD_*model.nu() + alphaDt_*model.nut();
}
else if (mesh_.foundObject<cmpModel>(turbulenceModel::typeName))
else if (mesh_.foundObject<cmpModel>(momentumTransportModel::typeName))
{
const cmpModel& model = mesh_.lookupObject<cmpModel>
(
turbulenceModel::typeName
momentumTransportModel::typeName
);
return alphaD_*model.mu() + alphaDt_*model.mut();