Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
henry
2009-05-11 21:20:02 +01:00
21 changed files with 1014 additions and 26 deletions

View File

@ -62,7 +62,7 @@ directMappedVelocityFluxFixedValueFvPatchField
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
phiName_(ptf.phiName_)
{
if (!isType<directMappedPatchBase>(this->patch().patch()))
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
@ -95,7 +95,7 @@ directMappedVelocityFluxFixedValueFvPatchField
fixedValueFvPatchVectorField(p, iF, dict),
phiName_(dict.lookup("phi"))
{
if (!isType<directMappedPatchBase>(this->patch().patch()))
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
@ -207,7 +207,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
allUValues
);
newUValues = patch().patchSlice(newUValues);
mapDistribute::distribute
(
Pstream::defaultCommsType,

View File

@ -48,6 +48,9 @@ void DeardorffDiffStress::updateSubGridScaleFields(const volScalarField& K)
{
muSgs_ = ck_*rho()*sqrt(K)*delta();
muSgs_.correctBoundaryConditions();
alphaSgs_ = muSgs_/Prt();
alphaSgs_.correctBoundaryConditions();
}

View File

@ -84,6 +84,19 @@ GenEddyVisc::GenEddyVisc
IOobject::AUTO_WRITE
),
mesh_
),
alphaSgs_
(
IOobject
(
"alphaSgs",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
{}

View File

@ -72,6 +72,7 @@ protected:
volScalarField k_;
volScalarField muSgs_;
volScalarField alphaSgs_;
public:
@ -113,12 +114,18 @@ public:
return muSgs_;
}
//- Return thermal conductivity
//- Return thermal diffusivity
virtual tmp<volScalarField> alphaSgs() const
{
return alphaSgs_;
}
//- Return thermal diffusivity
virtual tmp<volScalarField> alphaEff() const
{
return tmp<volScalarField>
(
new volScalarField("alphaEff", muSgs_ + alpha())
new volScalarField("alphaEff", alphaSgs_ + alpha())
);
}

View File

@ -88,6 +88,19 @@ GenSGSStress::GenSGSStress
IOobject::AUTO_WRITE
),
mesh_
),
alphaSgs_
(
IOobject
(
"alphaSgs",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
{}

View File

@ -73,6 +73,7 @@ protected:
volSymmTensorField B_;
volScalarField muSgs_;
volScalarField alphaSgs_;
public:
@ -96,35 +97,41 @@ public:
// Member Functions
//- Return the SGS turbulent kinetic energy.
//- Return the SGS turbulent kinetic energy
virtual tmp<volScalarField> k() const
{
return 0.5*tr(B_);
}
//- Return the SGS turbulent dissipation.
//- Return the SGS turbulent dissipation
virtual tmp<volScalarField> epsilon() const
{
volScalarField K = k();
return ce_*K*sqrt(K)/delta();
}
//- Return the SGS viscosity.
//- Return the SGS viscosity
virtual tmp<volScalarField> muSgs() const
{
return muSgs_;
}
//- Return the SGS thermal diffusivity
virtual tmp<volScalarField> alphaSgs() const
{
return alphaSgs_;
}
//- Return thermal conductivity
virtual tmp<volScalarField> alphaEff() const
{
return tmp<volScalarField>
(
new volScalarField("alphaEff", muSgs_ + alpha())
new volScalarField("alphaEff", alphaSgs_ + alpha())
);
}
//- Return the sub-grid stress tensor.
//- Return the sub-grid stress tensor
virtual tmp<volSymmTensorField> B() const
{
return B_;
@ -135,7 +142,7 @@ public:
virtual tmp<volSymmTensorField> devRhoBeff() const;
//- Returns divergence of B : i.e. the additional term in the
// filtered NSE.
// filtered NSE
virtual tmp<fvVectorMatrix> divDevRhoBeff(volVectorField& U) const;
//- Correct Eddy-Viscosity and related properties

View File

@ -81,7 +81,45 @@ LESModel::LESModel
k0_("k0", dimVelocity*dimVelocity, SMALL),
delta_(LESdelta::New("delta", U.mesh(), *this))
delta_(LESdelta::New("delta", U.mesh(), *this)),
wallFunctionDict_(subDict("wallFunctionCoeffs")),
kappa_
(
dimensioned<scalar>::lookupOrAddToDict
(
"kappa",
wallFunctionDict_,
0.4187
)
),
E_
(
dimensioned<scalar>::lookupOrAddToDict
(
"E",
wallFunctionDict_,
9.0
)
),
Cmu_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Cmu",
wallFunctionDict_,
0.07
)
),
Prt_
(
dimensioned<scalar>::lookupOrAddToDict
(
"Prt",
wallFunctionDict_,
0.85
)
)
{
readIfPresent("k0", k0_);
}
@ -107,9 +145,15 @@ bool LESModel::read()
{
coeffDict_ = subDict(type() + "Coeffs");
readIfPresent("k0", k0_);
delta_().read(*this);
readIfPresent("k0", k0_);
wallFunctionDict_ = subDict("wallFunctionCoeffs");
kappa_.readIfPresent(wallFunctionDict_);
E_.readIfPresent(wallFunctionDict_);
Cmu_.readIfPresent(wallFunctionDict_);
Prt_.readIfPresent(wallFunctionDict_);
return true;
}

View File

@ -87,6 +87,19 @@ protected:
autoPtr<LESdelta> delta_;
// Wall function properties
//- Wall function dictionary
dictionary wallFunctionDict_;
dimensionedScalar kappa_;
dimensionedScalar E_;
dimensionedScalar Cmu_;
dimensionedScalar Prt_;
// Protected Member Functions
@ -167,12 +180,6 @@ public:
return coeffDict_;
}
//- Access function to filter width
inline const volScalarField& delta() const
{
return delta_();
}
//- Return the value of k0 which k is not allowed to be less than
const dimensionedScalar& k0() const
{
@ -185,6 +192,35 @@ public:
return k0_;
}
//- Access function to filter width
inline const volScalarField& delta() const
{
return delta_();
}
//- Return kappa for use in wall-functions
dimensionedScalar kappa() const
{
return kappa_;
}
//- Return E for use in wall-functions
dimensionedScalar E() const
{
return E_;
}
//- Return Cmu for use in wall-functions
dimensionedScalar Cmu() const
{
return Cmu_;
}
//- Return turbulent Prandtl number for use in wall-functions
dimensionedScalar Prt() const
{
return Prt_;
}
//- Return the SGS turbulent kinetic energy.
virtual tmp<volScalarField> k() const = 0;
@ -192,7 +228,7 @@ public:
//- Return the SGS turbulent dissipation.
virtual tmp<volScalarField> epsilon() const = 0;
//- Return the effective viscosity
//- Return the SGS turbulent viscosity
virtual tmp<volScalarField> muSgs() const = 0;
//- Return the effective viscosity
@ -204,6 +240,9 @@ public:
);
}
//- Return the SGS turbulent thermal diffusivity
virtual tmp<volScalarField> alphaSgs() const = 0;
//- Return the SGS thermal conductivity.
virtual tmp<volScalarField> alphaEff() const = 0;
@ -227,6 +266,12 @@ public:
return muSgs();
}
//- Return the turbulence thermal diffusivity
virtual tmp<volScalarField> alphat() const
{
return alphaSgs();
}
//- Return the Reynolds stress tensor
virtual tmp<volSymmTensorField> R() const
{
@ -254,7 +299,7 @@ public:
//- Correct Eddy-Viscosity and related properties
virtual void correct(const tmp<volTensorField>& gradU);
//- Read turbulenceProperties dictionary
//- Read LESProperties dictionary
virtual bool read() = 0;
};

View File

@ -16,4 +16,8 @@ wallFunctions=derivedFvPatchFields/wallFunctions
muSgsWallFunctions=$(wallFunctions)/muSgsWallFunctions
$(muSgsWallFunctions)/muSgsWallFunction/muSgsWallFunctionFvPatchScalarField.C
alphaSgsWallFunctions=$(wallFunctions)/alphaSgsWallFunctions
$(alphaSgsWallFunctions)/alphaSgsWallFunction/alphaSgsWallFunctionFvPatchScalarField.C
$(alphaSgsWallFunctions)/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libcompressibleLESModels

View File

@ -56,6 +56,9 @@ void Smagorinsky::updateSubGridScaleFields(const volTensorField& gradU)
muSgs_ = ck_*rho()*delta()*sqrt(k_);
muSgs_.correctBoundaryConditions();
alphaSgs_ = muSgs_/Prt();
alphaSgs_.correctBoundaryConditions();
}

View File

@ -49,6 +49,9 @@ void SpalartAllmaras::updateSubGridScaleFields()
{
muSgs_.internalField() = rho()*fv1()*nuTilda_.internalField();
muSgs_.correctBoundaryConditions();
alphaSgs_ = muSgs_/Prt();
alphaSgs_.correctBoundaryConditions();
}
@ -227,8 +230,20 @@ SpalartAllmaras::SpalartAllmaras
IOobject::AUTO_WRITE
),
mesh_
)
),
alphaSgs_
(
IOobject
(
"alphaSgs",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh_
)
{
updateSubGridScaleFields();

View File

@ -89,6 +89,7 @@ class SpalartAllmaras
volScalarField nuTilda_;
volScalarField dTilda_;
volScalarField muSgs_;
volScalarField alphaSgs_;
public:
@ -136,12 +137,18 @@ public:
return muSgs_;
}
//- Return SGS thermal diffusivity
virtual tmp<volScalarField> alphaSgs() const
{
return alphaSgs_;
}
//- Return thermal conductivity
virtual tmp<volScalarField> alphaEff() const
{
return tmp<volScalarField>
(
new volScalarField("alphaEff", muSgs_ + alpha())
new volScalarField("alphaEff", alphaSgs_ + alpha())
);
}

View File

@ -0,0 +1,317 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 "alphaSgsJayatillekeWallFunctionFvPatchScalarField.H"
#include "LESModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::maxExp_ = 50.0;
scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::tolerance_ = 0.01;
label alphaSgsJayatillekeWallFunctionFvPatchScalarField::maxIters_ = 10;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void alphaSgsJayatillekeWallFunctionFvPatchScalarField::checkType()
{
if (!isA<wallFvPatch>(patch()))
{
FatalErrorIn
(
"alphaSgsJayatillekeWallFunctionFvPatchScalarField::checkType()"
)
<< "Patch type for patch " << patch().name() << " must be wall\n"
<< "Current patch type is " << patch().type() << nl
<< exit(FatalError);
}
}
scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::Psmooth
(
const scalar Prat
) const
{
return 9.24*(pow(Prat, 0.75) - 1.0)*(1.0 + 0.28*exp(-0.007*Prat));
}
scalar alphaSgsJayatillekeWallFunctionFvPatchScalarField::yPlusTherm
(
const scalar P,
const scalar Prat,
const scalar E,
const scalar kappa
) const
{
scalar ypt = 11.0;
for (int i=0; i<maxIters_; i++)
{
scalar f = ypt - (log(E*ypt)/kappa + P)/Prat;
scalar df = 1.0 - 1.0/(ypt*kappa*Prat);
scalar yptNew = ypt - f/df;
if (yptNew < VSMALL)
{
return 0;
}
else if (mag(yptNew - ypt) < tolerance_)
{
return yptNew;
}
else
{
ypt = yptNew;
}
}
return ypt;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphaSgsJayatillekeWallFunctionFvPatchScalarField::
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF)
{
checkType();
}
alphaSgsJayatillekeWallFunctionFvPatchScalarField::
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
{}
alphaSgsJayatillekeWallFunctionFvPatchScalarField::
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict)
{
checkType();
}
alphaSgsJayatillekeWallFunctionFvPatchScalarField::
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{
checkType();
}
alphaSgsJayatillekeWallFunctionFvPatchScalarField::
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF)
{
checkType();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphaSgsJayatillekeWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
// Get info from the SGS model
const LESModel& sgs = db().lookupObject<LESModel>("LESProperties");
// Wall function constants
const scalar E = sgs.E().value();
const scalar kappa = sgs.kappa().value();
const scalar Prt = sgs.Prt().value();
// Field data
const label patchI = patch().index();
const scalarField& muw = sgs.mu().boundaryField()[patchI];
const scalarField& muSgsw = sgs.muSgs()().boundaryField()[patchI];
const scalarField& alphaw = sgs.alpha().boundaryField()[patchI];
scalarField& alphaSgsw = *this;
const fvPatchVectorField& Uw = sgs.U().boundaryField()[patchI];
const scalarField magUp = mag(Uw.patchInternalField() - Uw);
const scalarField magGradUw = mag(Uw.snGrad());
const scalarField& rhow = sgs.rho().boundaryField()[patchI];
const fvPatchScalarField& hw =
patch().lookupPatchField<volScalarField, scalar>("h");
const scalarField& ry = patch().deltaCoeffs();
// Heat flux [W/m2] - lagging alphaSgsw
const scalarField qDot = (alphaw + alphaSgsw)*hw.snGrad();
// Populate boundary values
forAll(alphaSgsw, faceI)
{
// Calculate uTau using Newton-Raphson iteration
scalar uTau =
sqrt((muSgsw[faceI] + muw[faceI])/rhow[faceI]*magGradUw[faceI]);
if (uTau > ROOTVSMALL)
{
label iter = 0;
scalar err = GREAT;
do
{
scalar kUu = min(kappa*magUp[faceI]/uTau, maxExp_);
scalar fkUu = exp(kUu) - 1.0 - kUu*(1.0 + 0.5*kUu);
scalar f =
- uTau/(ry[faceI]*muw[faceI]/rhow[faceI])
+ magUp[faceI]/uTau
+ 1.0/E*(fkUu - 1.0/6.0*kUu*sqr(kUu));
scalar df =
- 1.0/(ry[faceI]*muw[faceI]/rhow[faceI])
- magUp[faceI]/sqr(uTau)
- 1.0/E*kUu*fkUu/uTau;
scalar uTauNew = uTau - f/df;
err = mag((uTau - uTauNew)/uTau);
uTau = uTauNew;
} while (uTau>VSMALL && err>tolerance_ && ++iter<maxIters_);
scalar yPlus = uTau/ry[faceI]/(muw[faceI]/rhow[faceI]);
// Molecular Prandtl number
scalar Pr = muw[faceI]/alphaw[faceI];
// Molecular-to-turbulenbt Prandtl number ratio
scalar Prat = Pr/Prt;
// Thermal sublayer thickness
scalar P = Psmooth(Prat);
scalar yPlusTherm = this->yPlusTherm(P, Prat, E, kappa);
// Evaluate new effective thermal diffusivity
scalar alphaEff = 0.0;
if (yPlus < yPlusTherm)
{
scalar A = qDot[faceI]*rhow[faceI]*uTau/ry[faceI];
scalar B = qDot[faceI]*Pr*yPlus;
scalar C = Pr*0.5*rhow[faceI]*uTau*sqr(magUp[faceI]);
alphaEff = A/(B + C + VSMALL);
}
else
{
scalar A = qDot[faceI]*rhow[faceI]*uTau/ry[faceI];
scalar B = qDot[faceI]*Prt*(1.0/kappa*log(E*yPlus) + P);
scalar magUc = uTau/kappa*log(E*yPlusTherm) - mag(Uw[faceI]);
scalar C =
0.5*rhow[faceI]*uTau
*(Prt*sqr(magUp[faceI]) + (Pr - Prt)*sqr(magUc));
alphaEff = A/(B + C + VSMALL);
}
// Update turbulent thermal diffusivity
alphaSgsw[faceI] = max(0.0, alphaEff - alphaw[faceI]);
if (debug)
{
Info<< " uTau = " << uTau << nl
<< " Pr = " << Pr << nl
<< " Prt = " << Prt << nl
<< " qDot = " << qDot[faceI] << nl
<< " yPlus = " << yPlus << nl
<< " yPlusTherm = " << yPlusTherm << nl
<< " alphaEff = " << alphaEff << nl
<< " alphaw = " << alphaw[faceI] << nl
<< " alphaSgsw = " << alphaSgsw[faceI] << nl
<< endl;
}
}
else
{
alphaSgsw[faceI] = 0.0;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
alphaSgsJayatillekeWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,179 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
alphaSgsJayatillekeWallFunctionFvPatchScalarField
Description
Thermal wall function for turbulent thermal diffusivity based on the
Jayatilleke thermal wall function
SourceFiles
alphaSgsJayatillekeWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef alphaSgsJayatillekeWallFunctionFvPatchScalarField_H
#define alphaSgsJayatillekeWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class alphaSgsJayatillekeWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class alphaSgsJayatillekeWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
static scalar maxExp_;
static scalar tolerance_;
static label maxIters_;
// Private member functions
//- Check the type of the patch
void checkType();
//- `P' function
scalar Psmooth(const scalar Prat) const;
//- Calculate y+ at the edge of the thermal laminar sublayer
scalar yPlusTherm
(
const scalar P,
const scalar Prat,
const scalar E,
const scalar kappa
) const;
public:
//- Runtime type information
TypeName("alphaSgsJayatillekeWallFunction");
// Constructors
//- Construct from patch and internal field
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given an
// alphaSgsJayatillekeWallFunctionFvPatchScalarField
// onto a new patch
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new alphaSgsJayatillekeWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
const alphaSgsJayatillekeWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new alphaSgsJayatillekeWallFunctionFvPatchScalarField
(
*this,
iF
)
);
}
// Member functions
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,161 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 "alphaSgsWallFunctionFvPatchScalarField.H"
#include "LESModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void alphaSgsWallFunctionFvPatchScalarField::checkType()
{
if (!isA<wallFvPatch>(patch()))
{
FatalErrorIn
(
"alphaSgsWallFunctionFvPatchScalarField::checkType()"
)
<< "Patch type for patch " << patch().name() << " must be wall\n"
<< "Current patch type is " << patch().type() << nl
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphaSgsWallFunctionFvPatchScalarField::
alphaSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF)
{
checkType();
}
alphaSgsWallFunctionFvPatchScalarField::
alphaSgsWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
{}
alphaSgsWallFunctionFvPatchScalarField::
alphaSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict)
{
checkType();
}
alphaSgsWallFunctionFvPatchScalarField::
alphaSgsWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{
checkType();
}
alphaSgsWallFunctionFvPatchScalarField::
alphaSgsWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF)
{
checkType();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphaSgsWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
// Get reference to the SGS model
const LESModel& sgs = db().lookupObject<LESModel>("LESProperties");
// Turbulent Prandtl number
const scalar Prt = sgs.Prt().value();
// Get the turbulent viscosity at the wall
const scalarField& muSgsw = sgs.muSgs()().boundaryField()[patch().index()];
operator==(muSgsw/Prt);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
alphaSgsWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,155 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
alphaSgsWallFunctionFvPatchScalarField
Description
Boundary condition for thermal diffusivity when using wall functions
- replicates OpenFOAM v1.5 (and earlier) behaviour
SourceFiles
alphaSgsWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef alphaSgsWallFunctionFvPatchScalarField_H
#define alphaSgsWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class alphaSgsWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class alphaSgsWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private member functions
//- Check the type of the patch
void checkType();
public:
//- Runtime type information
TypeName("alphaSgsWallFunction");
// Constructors
//- Construct from patch and internal field
alphaSgsWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
alphaSgsWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given alphaSgsWallFunctionFvPatchScalarField
// onto a new patch
alphaSgsWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
alphaSgsWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new alphaSgsWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
alphaSgsWallFunctionFvPatchScalarField
(
const alphaSgsWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new alphaSgsWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::Pstream::blocking
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -47,6 +47,9 @@ void dynOneEqEddy::updateSubGridScaleFields(const volSymmTensorField& D)
{
muSgs_ = ck_(D)*rho()*sqrt(k_)*delta();
muSgs_.correctBoundaryConditions();
alphaSgs_ = muSgs_/Prt();
alphaSgs_.correctBoundaryConditions();
}

View File

@ -51,6 +51,9 @@ void lowReOneEqEddy::updateSubGridScaleFields()
// low Re no corrected eddy viscosity
muSgs_ -= (mu()/beta_)*(scalar(1) - exp(-beta_*muSgs_/mu()));
muSgs_.correctBoundaryConditions();
alphaSgs_ = muSgs_/Prt();
alphaSgs_.correctBoundaryConditions();
}

View File

@ -47,6 +47,9 @@ void oneEqEddy::updateSubGridScaleFields()
{
muSgs_ = ck_*rho()*sqrt(k_)*delta();
muSgs_.correctBoundaryConditions();
alphaSgs_ = muSgs_/Prt();
alphaSgs_.correctBoundaryConditions();
}

View File

@ -351,7 +351,7 @@ public:
//- Solve the turbulence equations and correct the turbulence viscosity
virtual void correct() = 0;
//- Read turbulenceProperties dictionary
//- Read RASProperties dictionary
virtual bool read() = 0;
};

View File

@ -35,7 +35,12 @@ divSchemes
div(phi,k) Gauss limitedLinear 1;
div(phi,epsilon) Gauss limitedLinear 1;
div(phi,Yi_h) Gauss upwind;
div(phi,fu_ft_h) Gauss multivariateSelection { fu limitedLinear 1 ; ft limitedLinear 1 ; h limitedLinear 1 ; };
div(phi,fu_ft_h) Gauss multivariateSelection
{
fu limitedLinear 1;
ft limitedLinear 1;
h limitedLinear 1;
};
div((muEff*dev2(grad(U).T()))) Gauss linear;
}
@ -64,7 +69,8 @@ snGradSchemes
fluxRequired
{
p ;
default no;
p;
}