moved compatibility functions from RASModel classes to within turbulence namespace

This commit is contained in:
andy
2008-09-24 17:03:31 +01:00
parent b2652f3cee
commit 0093a587c6
26 changed files with 746 additions and 438 deletions

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -155,8 +157,8 @@ LRR::LRR
) )
), ),
R_(autoCreateKQR<symmTensor>("R", mesh_)), R_(autoCreateR("R", mesh_)),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
mut_(autoCreateMut("mut", mesh_)) mut_(autoCreateMut("mut", mesh_))
{ {

View File

@ -30,6 +30,8 @@ License
#include "wallDist.H" #include "wallDist.H"
#include "wallDistReflection.H" #include "wallDistReflection.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -190,7 +192,7 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
mesh_ mesh_
), ),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
mut_(autoCreateMut("mut", mesh_)) mut_(autoCreateMut("mut", mesh_))
{ {

View File

@ -34,4 +34,6 @@ $(kQRWallFunctions)/kQRWallFunction/kQRWallFunctionFvPatchFields.C
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C
LIB = $(FOAM_LIBBIN)/libcompressibleRASModels LIB = $(FOAM_LIBBIN)/libcompressibleRASModels

View File

@ -29,12 +29,6 @@ License
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "fixedValueFvPatchFields.H" #include "fixedValueFvPatchFields.H"
// Headers reqd for back-porting wall function boundary conditions
#include "calculatedFvPatchField.H"
#include "mutWallFunctionFvPatchScalarField.H"
#include "epsilonWallFunctionFvPatchScalarField.H"
#include "omegaWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -58,128 +52,6 @@ void RASModel::printCoeffs()
} }
wordList RASModel::replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
) const
{
const fvBoundaryMesh& bm = mesh.boundary();
wordList boundaryTypes(bm.size());
forAll(bm, patchI)
{
if (isType<wallFvPatch>(bm[patchI]))
{
boundaryTypes[patchI] = newTypeNames[patchI];
}
else
{
boundaryTypes[patchI] = oldTypeNames[patchI];
}
}
return boundaryTypes;
}
tmp<volScalarField> RASModel::autoCreateMut
(
const word& fieldName,
const fvMesh& mesh
) const
{
IOobject mutHeader
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
if (mutHeader.headerOk())
{
return tmp<volScalarField>(new volScalarField(mutHeader, mesh));
}
else
{
Info<< "--> Upgrading " << fieldName << " to employ run-time "
<< "selectable wall functions" << endl;
wordList mutBoundaryTypes = replaceWallBoundaryTypes
(
mesh,
wordList
(
mesh.boundary().size(),
calculatedFvPatchField<scalar>::typeName
),
wordList
(
mesh.boundary().size(),
RASModels::mutWallFunctionFvPatchScalarField::typeName
)
);
tmp<volScalarField> mut
(
new volScalarField
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimDensity*dimArea/dimTime, 0.0),
mutBoundaryTypes
)
);
Info<< " Writing updated " << fieldName << endl;
mut().write();
return mut;
}
}
tmp<volScalarField> RASModel::autoCreateEpsilon
(
const word& fieldName,
const fvMesh& mesh
) const
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::epsilonWallFunctionFvPatchScalarField::typeName
);
}
tmp<volScalarField> RASModel::autoCreateOmega
(
const word& fieldName,
const fvMesh& mesh
) const
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::omegaWallFunctionFvPatchScalarField::typeName
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
RASModel::RASModel RASModel::RASModel

View File

@ -58,10 +58,6 @@ SourceFiles
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
// Headers reqd for back-porting wall function boundary conditions
#include "wallFvPatch.H"
#include "kQRWallFunctionFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -111,57 +107,6 @@ protected:
// Protected member functions // Protected member functions
// Auto creation of fields to provide backwards compatibility with
// runtime selectable wall functions
//- Replace old wall BCs with new wall function BCs
wordList replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
) const;
//- mut
tmp<volScalarField> autoCreateMut
(
const word& fieldName,
const fvMesh& mesh
) const;
//- epsilon
tmp<volScalarField> autoCreateEpsilon
(
const word& fieldName,
const fvMesh& mesh
) const;
//- omega
tmp<volScalarField> autoCreateOmega
(
const word& fieldName,
const fvMesh& mesh
) const;
//- kQR
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > autoCreateKQR
(
const word& fieldName,
const fvMesh& mesh
) const;
//- Helper function to create the new field
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> >
autoCreateWallFunctionField
(
const word& fieldName,
const fvMesh& mesh,
const word& wallFunctionName
) const;
//- Print model coefficients //- Print model coefficients
virtual void printCoeffs(); virtual void printCoeffs();
@ -382,12 +327,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "RASModelTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -137,7 +139,7 @@ RNGkEpsilon::RNGkEpsilon
) )
), ),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
mut_(autoCreateMut("mut", mesh_)) mut_(autoCreateMut("mut", mesh_))
{ {

View File

@ -0,0 +1,217 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "backwardsCompatibilityWallFunctions.H"
#include "calculatedFvPatchField.H"
#include "mutWallFunctionFvPatchScalarField.H"
#include "epsilonWallFunctionFvPatchScalarField.H"
#include "kQRWallFunctionFvPatchField.H"
#include "omegaWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
wordList replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
)
{
const fvBoundaryMesh& bm = mesh.boundary();
wordList boundaryTypes(bm.size());
forAll(bm, patchI)
{
if (isType<wallFvPatch>(bm[patchI]))
{
boundaryTypes[patchI] = newTypeNames[patchI];
}
else
{
boundaryTypes[patchI] = oldTypeNames[patchI];
}
}
return boundaryTypes;
}
tmp<volScalarField> autoCreateMut
(
const word& fieldName,
const fvMesh& mesh
)
{
IOobject mutHeader
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
if (mutHeader.headerOk())
{
return tmp<volScalarField>(new volScalarField(mutHeader, mesh));
}
else
{
Info<< "--> Upgrading " << fieldName << " to employ run-time "
<< "selectable wall functions" << endl;
wordList mutBoundaryTypes = replaceWallBoundaryTypes
(
mesh,
wordList
(
mesh.boundary().size(),
calculatedFvPatchField<scalar>::typeName
),
wordList
(
mesh.boundary().size(),
RASModels::mutWallFunctionFvPatchScalarField::typeName
)
);
tmp<volScalarField> mut
(
new volScalarField
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimDensity*dimArea/dimTime, 0.0),
mutBoundaryTypes
)
);
Info<< " Writing updated " << fieldName << endl;
mut().write();
return mut;
}
}
tmp<volScalarField> autoCreateEpsilon
(
const word& fieldName,
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::epsilonWallFunctionFvPatchScalarField::typeName
);
}
tmp<volScalarField> autoCreateOmega
(
const word& fieldName,
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::omegaWallFunctionFvPatchScalarField::typeName
);
}
tmp<volScalarField> autoCreateK
(
const word& fieldName,
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
);
}
tmp<volScalarField> autoCreateQ
(
const word& fieldName,
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
);
}
tmp<volSymmTensorField> autoCreateR
(
const word& fieldName,
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<symmTensor>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<symmTensor>::typeName
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::compressible
Description
Auto creation of fields to provide backwards compatibility with
runtime selectable wall functions
SourceFiles
backwardsCompatibilityWallFunctions.C
backwardsCompatibilityWallFunctionsTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef backwardsCompatibilityWallFunctions_H
#define backwardsCompatibilityWallFunctions_H
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
//- Replace old wall BCs with new wall function BCs
wordList replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
);
//- mut
tmp<volScalarField> autoCreateMut
(
const word& fieldName,
const fvMesh& mesh
);
//- epsilon
tmp<volScalarField> autoCreateEpsilon
(
const word& fieldName,
const fvMesh& mesh
);
//- omega
tmp<volScalarField> autoCreateOmega
(
const word& fieldName,
const fvMesh& mesh
);
//- k
tmp<volScalarField> autoCreateK
(
const word& fieldName,
const fvMesh& mesh
);
//- Q
tmp<volScalarField> autoCreateQ
(
const word& fieldName,
const fvMesh& mesh
);
//- R
tmp<volSymmTensorField> autoCreateR
(
const word& fieldName,
const fvMesh& mesh
);
//- Helper function to create the new field
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> >
autoCreateWallFunctionField
(
const word& fieldName,
const fvMesh& mesh,
const word& wallFunctionName
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "backwardsCompatibilityWallFunctionsTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,7 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "RASModel.H" #include "backwardsCompatibilityWallFunctions.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -37,12 +38,12 @@ namespace compressible
template<class Type> template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > tmp<GeometricField<Type, fvPatchField, volMesh> >
RASModel::autoCreateWallFunctionField autoCreateWallFunctionField
( (
const word& fieldName, const word& fieldName,
const fvMesh& mesh, const fvMesh& mesh,
const word& wallFunctionName const word& wallFunctionName
) const )
{ {
IOobject mutHeader IOobject mutHeader
( (
@ -145,22 +146,6 @@ RASModel::autoCreateWallFunctionField
} }
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > RASModel::autoCreateKQR
(
const word& fieldName,
const fvMesh& mesh
) const
{
return autoCreateWallFunctionField<Type>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<Type>::typeName
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible } // End namespace compressible

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -117,7 +119,7 @@ kEpsilon::kEpsilon
1.0 1.0
) )
), ),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
mut_(autoCreateMut("mut", mesh_)) mut_(autoCreateMut("mut", mesh_))
{ {

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -221,7 +223,7 @@ kOmegaSST::kOmegaSST
y_(mesh_), y_(mesh_),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
omega_(autoCreateOmega("omega", mesh_)), omega_(autoCreateOmega("omega", mesh_)),
mut_(autoCreateMut("mut", mesh_)) mut_(autoCreateMut("mut", mesh_))
{ {

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -150,7 +152,7 @@ realizableKE::realizableKE
) )
), ),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
mut_(autoCreateMut("mut", mesh_)) mut_(autoCreateMut("mut", mesh_))
{ {

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -136,8 +138,8 @@ LRR::LRR
) )
), ),
R_(autoCreateKQR<symmTensor>("R", mesh_)), R_(autoCreateR("R", mesh_)),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
nut_(autoCreateNut("nut", mesh_)) nut_(autoCreateNut("nut", mesh_))
{ {

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -165,8 +167,8 @@ LaunderGibsonRSTM::LaunderGibsonRSTM
yr_(mesh_), yr_(mesh_),
R_(autoCreateKQR<symmTensor>("R", mesh_)), R_(autoCreateR("R", mesh_)),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
nut_(autoCreateNut("nut", mesh_)) nut_(autoCreateNut("nut", mesh_))
{ {

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -145,7 +147,7 @@ LienCubicKE::LienCubicKE
) )
), ),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
gradU_(fvc::grad(U)), gradU_(fvc::grad(U)),

View File

@ -42,4 +42,6 @@ $(kQRWallFunctions)/kQRWallFunction/kQRWallFunctionFvPatchFields.C
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
backwardsCompatibilityWallFunctions/backwardsCompatibilityWallFunctions.C
LIB = $(FOAM_LIBBIN)/libincompressibleRASModels LIB = $(FOAM_LIBBIN)/libincompressibleRASModels

View File

@ -27,13 +27,6 @@ License
#include "RASModel.H" #include "RASModel.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
// Headers reqd for back-porting wall function boundary conditions
#include "calculatedFvPatchField.H"
#include "nutWallFunctionFvPatchScalarField.H"
#include "epsilonWallFunctionFvPatchScalarField.H"
#include "omegaWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -57,128 +50,6 @@ void RASModel::printCoeffs()
} }
wordList RASModel::replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
) const
{
const fvBoundaryMesh& bm = mesh.boundary();
wordList boundaryTypes(bm.size());
forAll(bm, patchI)
{
if (isType<wallFvPatch>(bm[patchI]))
{
boundaryTypes[patchI] = newTypeNames[patchI];
}
else
{
boundaryTypes[patchI] = oldTypeNames[patchI];
}
}
return boundaryTypes;
}
tmp<volScalarField> RASModel::autoCreateNut
(
const word& fieldName,
const fvMesh& mesh
) const
{
IOobject nutHeader
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
if (nutHeader.headerOk())
{
return tmp<volScalarField>(new volScalarField(nutHeader, mesh));
}
else
{
Info<< "--> Upgrading " << fieldName << " to employ run-time "
<< "selectable wall functions" << endl;
wordList nutBoundaryTypes = replaceWallBoundaryTypes
(
mesh,
wordList
(
mesh.boundary().size(),
calculatedFvPatchField<scalar>::typeName
),
wordList
(
mesh.boundary().size(),
RASModels::nutWallFunctionFvPatchScalarField::typeName
)
);
tmp<volScalarField> nut
(
new volScalarField
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimArea/dimTime, 0.0),
nutBoundaryTypes
)
);
Info<< " Writing updated " << fieldName << endl;
nut().write();
return nut;
}
}
tmp<volScalarField> RASModel::autoCreateEpsilon
(
const word& fieldName,
const fvMesh& mesh
) const
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::epsilonWallFunctionFvPatchScalarField::typeName
);
}
tmp<volScalarField> RASModel::autoCreateOmega
(
const word& fieldName,
const fvMesh& mesh
) const
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::omegaWallFunctionFvPatchScalarField::typeName
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
RASModel::RASModel RASModel::RASModel

View File

@ -56,11 +56,6 @@ SourceFiles
#include "autoPtr.H" #include "autoPtr.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
// Headers reqd for back-porting wall function boundary conditions
#include "wallFvPatch.H"
#include "kQRWallFunctionFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -109,57 +104,6 @@ protected:
// Protected member functions // Protected member functions
// Auto creation of fields to provide backwards compatibility with
// runtime selectable wall functions
//- Replace old wall BCs with new wall function BCs
wordList replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
) const;
//- mut
tmp<volScalarField> autoCreateNut
(
const word& fieldName,
const fvMesh& mesh
) const;
//- epsilon
tmp<volScalarField> autoCreateEpsilon
(
const word& fieldName,
const fvMesh& mesh
) const;
//- omega
tmp<volScalarField> autoCreateOmega
(
const word& fieldName,
const fvMesh& mesh
) const;
//- kQR
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > autoCreateKQR
(
const word& fieldName,
const fvMesh& mesh
) const;
//- Helper function to create the new field
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> >
autoCreateWallFunctionField
(
const word& fieldName,
const fvMesh& mesh,
const word& wallFunctionName
) const;
//- Print model coefficients //- Print model coefficients
virtual void printCoeffs(); virtual void printCoeffs();
@ -365,12 +309,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "RASModelTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -117,7 +119,7 @@ RNGkEpsilon::RNGkEpsilon
) )
), ),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
nut_(autoCreateNut("nut", mesh_)) nut_(autoCreateNut("nut", mesh_))
{ {

View File

@ -0,0 +1,217 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "backwardsCompatibilityWallFunctions.H"
#include "calculatedFvPatchField.H"
#include "nutWallFunctionFvPatchScalarField.H"
#include "epsilonWallFunctionFvPatchScalarField.H"
#include "kQRWallFunctionFvPatchField.H"
#include "omegaWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
wordList replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
)
{
const fvBoundaryMesh& bm = mesh.boundary();
wordList boundaryTypes(bm.size());
forAll(bm, patchI)
{
if (isType<wallFvPatch>(bm[patchI]))
{
boundaryTypes[patchI] = newTypeNames[patchI];
}
else
{
boundaryTypes[patchI] = oldTypeNames[patchI];
}
}
return boundaryTypes;
}
tmp<volScalarField> autoCreateNut
(
const word& fieldName,
const fvMesh& mesh
)
{
IOobject nutHeader
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
if (nutHeader.headerOk())
{
return tmp<volScalarField>(new volScalarField(nutHeader, mesh));
}
else
{
Info<< "--> Upgrading " << fieldName << " to employ run-time "
<< "selectable wall functions" << endl;
wordList nutBoundaryTypes = replaceWallBoundaryTypes
(
mesh,
wordList
(
mesh.boundary().size(),
calculatedFvPatchField<scalar>::typeName
),
wordList
(
mesh.boundary().size(),
RASModels::nutWallFunctionFvPatchScalarField::typeName
)
);
tmp<volScalarField> nut
(
new volScalarField
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimDensity*dimArea/dimTime, 0.0),
nutBoundaryTypes
)
);
Info<< " Writing updated " << fieldName << endl;
nut().write();
return nut;
}
}
tmp<volScalarField> autoCreateEpsilon
(
const word& fieldName,
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::epsilonWallFunctionFvPatchScalarField::typeName
);
}
tmp<volScalarField> autoCreateOmega
(
const word& fieldName,
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::omegaWallFunctionFvPatchScalarField::typeName
);
}
tmp<volScalarField> autoCreateK
(
const word& fieldName,
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
);
}
tmp<volScalarField> autoCreateQ
(
const word& fieldName,
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<scalar>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<scalar>::typeName
);
}
tmp<volSymmTensorField> autoCreateR
(
const word& fieldName,
const fvMesh& mesh
)
{
return autoCreateWallFunctionField<symmTensor>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<symmTensor>::typeName
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::incompressible
Description
Auto creation of fields to provide backwards compatibility with
runtime selectable wall functions
SourceFiles
backwardsCompatibilityWallFunctions.C
backwardsCompatibilityWallFunctionsTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef backwardsCompatibilityWallFunctions_H
#define backwardsCompatibilityWallFunctions_H
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
//- Replace old wall BCs with new wall function BCs
wordList replaceWallBoundaryTypes
(
const fvMesh& mesh,
const wordList& oldTypeNames,
const wordList& newTypeNames
);
//- nut
tmp<volScalarField> autoCreateNut
(
const word& fieldName,
const fvMesh& mesh
);
//- epsilon
tmp<volScalarField> autoCreateEpsilon
(
const word& fieldName,
const fvMesh& mesh
);
//- omega
tmp<volScalarField> autoCreateOmega
(
const word& fieldName,
const fvMesh& mesh
);
//- k
tmp<volScalarField> autoCreateK
(
const word& fieldName,
const fvMesh& mesh
);
//- Q
tmp<volScalarField> autoCreateQ
(
const word& fieldName,
const fvMesh& mesh
);
//- R
tmp<volSymmTensorField> autoCreateR
(
const word& fieldName,
const fvMesh& mesh
);
//- Helper function to create the new field
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> >
autoCreateWallFunctionField
(
const word& fieldName,
const fvMesh& mesh,
const word& wallFunctionName
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "backwardsCompatibilityWallFunctionsTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,7 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "RASModel.H" #include "backwardsCompatibilityWallFunctions.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -37,16 +38,16 @@ namespace incompressible
template<class Type> template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > tmp<GeometricField<Type, fvPatchField, volMesh> >
RASModel::autoCreateWallFunctionField autoCreateWallFunctionField
( (
const word& fieldName, const word& fieldName,
const fvMesh& mesh, const fvMesh& mesh,
const word& wallFunctionName const word& wallFunctionName
) const )
{ {
IOobject nutHeader IOobject mutHeader
( (
"nut", "mut",
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
@ -55,7 +56,7 @@ RASModel::autoCreateWallFunctionField
typedef GeometricField<Type, fvPatchField, volMesh> fieldType; typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (nutHeader.headerOk()) if (mutHeader.headerOk())
{ {
return tmp<fieldType> return tmp<fieldType>
( (
@ -145,22 +146,6 @@ RASModel::autoCreateWallFunctionField
} }
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > RASModel::autoCreateKQR
(
const word& fieldName,
const fvMesh& mesh
) const
{
return autoCreateWallFunctionField<Type>
(
fieldName,
mesh,
RASModels::kQRWallFunctionFvPatchField<Type>::typeName
);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible } // End namespace incompressible

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -91,7 +93,7 @@ kEpsilon::kEpsilon
) )
), ),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
nut_(autoCreateNut("nut", mesh_)) nut_(autoCreateNut("nut", mesh_))
{ {

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -102,7 +104,7 @@ kOmega::kOmega
omega0_("omega0", dimless/dimTime, SMALL), omega0_("omega0", dimless/dimTime, SMALL),
omegaSmall_("omegaSmall", dimless/dimTime, SMALL), omegaSmall_("omegaSmall", dimless/dimTime, SMALL),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
omega_(autoCreateOmega("omega", mesh_)), omega_(autoCreateOmega("omega", mesh_)),
nut_(autoCreateNut("nut", mesh_)) nut_(autoCreateNut("nut", mesh_))
{ {

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -211,7 +213,7 @@ kOmegaSST::kOmegaSST
y_(mesh_), y_(mesh_),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
omega_(autoCreateOmega("omega", mesh_)), omega_(autoCreateOmega("omega", mesh_)),
nut_(autoCreateNut("nut", mesh_)) nut_(autoCreateNut("nut", mesh_))
{ {

View File

@ -28,6 +28,8 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
#include "backwardsCompatibilityWallFunctions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -140,7 +142,7 @@ realizableKE::realizableKE
) )
), ),
k_(autoCreateKQR<scalar>("k", mesh_)), k_(autoCreateK("k", mesh_)),
epsilon_(autoCreateEpsilon("epsilon", mesh_)), epsilon_(autoCreateEpsilon("epsilon", mesh_)),
nut_(autoCreateNut("nut", mesh_)) nut_(autoCreateNut("nut", mesh_))
{ {