mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merged all multiphase developments in OpenFOAM-1.7.x
This commit is contained in:
@ -4,6 +4,7 @@ set -x
|
||||
|
||||
wmake libso incompressible
|
||||
wmake libso interfaceProperties
|
||||
wmake libso twoPhaseInterfaceProperties
|
||||
# wmake libso compressible
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -1,11 +1,4 @@
|
||||
interfaceProperties.C
|
||||
interfaceCompression/interfaceCompression.C
|
||||
|
||||
alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
|
||||
alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C
|
||||
alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C
|
||||
alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C
|
||||
|
||||
alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libinterfaceProperties
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = -lfiniteVolume
|
||||
|
||||
@ -47,25 +47,31 @@ const Foam::scalar Foam::interfaceProperties::convertToRad =
|
||||
|
||||
void Foam::interfaceProperties::correctContactAngle
|
||||
(
|
||||
surfaceVectorField::GeometricBoundaryField& nHatb
|
||||
surfaceVectorField::GeometricBoundaryField& nHatb,
|
||||
surfaceVectorField::GeometricBoundaryField& gradAlphaf
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = alpha1_.mesh();
|
||||
const volScalarField::GeometricBoundaryField& gbf = alpha1_.boundaryField();
|
||||
const volScalarField::GeometricBoundaryField& abf = alpha1_.boundaryField();
|
||||
|
||||
const fvBoundaryMesh& boundary = mesh.boundary();
|
||||
|
||||
forAll(boundary, patchi)
|
||||
{
|
||||
if (isA<alphaContactAngleFvPatchScalarField>(gbf[patchi]))
|
||||
if (isA<alphaContactAngleFvPatchScalarField>(abf[patchi]))
|
||||
{
|
||||
const alphaContactAngleFvPatchScalarField& gcap =
|
||||
refCast<const alphaContactAngleFvPatchScalarField>
|
||||
(gbf[patchi]);
|
||||
alphaContactAngleFvPatchScalarField& acap =
|
||||
const_cast<alphaContactAngleFvPatchScalarField&>
|
||||
(
|
||||
refCast<const alphaContactAngleFvPatchScalarField>
|
||||
(
|
||||
abf[patchi]
|
||||
)
|
||||
);
|
||||
|
||||
fvsPatchVectorField& nHatp = nHatb[patchi];
|
||||
scalarField theta =
|
||||
convertToRad*gcap.theta(U_.boundaryField()[patchi], nHatp);
|
||||
convertToRad*acap.theta(U_.boundaryField()[patchi], nHatp);
|
||||
|
||||
vectorField nf = boundary[patchi].nf();
|
||||
|
||||
@ -90,6 +96,8 @@ void Foam::interfaceProperties::correctContactAngle
|
||||
nHatp = a*nf + b*nHatp;
|
||||
|
||||
nHatp /= (mag(nHatp) + deltaN_.value());
|
||||
|
||||
acap.gradient() = (nf & nHatp)*mag(gradAlphaf[patchi]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -111,7 +119,7 @@ void Foam::interfaceProperties::calculateK()
|
||||
|
||||
// Face unit interface normal
|
||||
surfaceVectorField nHatfv = gradAlphaf/(mag(gradAlphaf) + deltaN_);
|
||||
correctContactAngle(nHatfv.boundaryField());
|
||||
correctContactAngle(nHatfv.boundaryField(), gradAlphaf.boundaryField());
|
||||
|
||||
// Face unit interface normal flux
|
||||
nHatf_ = nHatfv & Sf;
|
||||
|
||||
@ -85,7 +85,8 @@ class interfaceProperties
|
||||
// calculated from the component of U parallel to the wall
|
||||
void correctContactAngle
|
||||
(
|
||||
surfaceVectorField::GeometricBoundaryField& nHat
|
||||
surfaceVectorField::GeometricBoundaryField& nHat,
|
||||
surfaceVectorField::GeometricBoundaryField& gradAlphaf
|
||||
) const;
|
||||
|
||||
//- Re-calculate the interface curvature
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
|
||||
alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C
|
||||
alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C
|
||||
alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C
|
||||
alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libtwoPhaseInterfaceProperties
|
||||
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-linterfaceProperties \
|
||||
-lfiniteVolume
|
||||
@ -35,6 +35,25 @@ namespace Foam
|
||||
defineTypeNameAndDebug(alphaContactAngleFvPatchScalarField, 0);
|
||||
}
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::alphaContactAngleFvPatchScalarField::limitControls,
|
||||
4
|
||||
>::names[] =
|
||||
{
|
||||
"none",
|
||||
"gradient",
|
||||
"zeroGradient",
|
||||
"alpha"
|
||||
};
|
||||
|
||||
const Foam::NamedEnum
|
||||
<
|
||||
Foam::alphaContactAngleFvPatchScalarField::limitControls,
|
||||
4
|
||||
> Foam::alphaContactAngleFvPatchScalarField::limitControlNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,19 +63,21 @@ Foam::alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchScalarField(p, iF)
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
limit_(lcZeroGradient)
|
||||
{}
|
||||
|
||||
|
||||
Foam::alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
|
||||
(
|
||||
const alphaContactAngleFvPatchScalarField& gcpsf,
|
||||
const alphaContactAngleFvPatchScalarField& acpsf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchScalarField(gcpsf, p, iF, mapper)
|
||||
fixedGradientFvPatchScalarField(acpsf, p, iF, mapper),
|
||||
limit_(acpsf.limit_)
|
||||
{}
|
||||
|
||||
|
||||
@ -67,29 +88,86 @@ Foam::alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchScalarField(p, iF)
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
limit_(limitControlNames_.read(dict.lookup("limit")))
|
||||
{
|
||||
evaluate();
|
||||
if (dict.found("gradient"))
|
||||
{
|
||||
gradient() = scalarField("gradient", dict, p.size());
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
fixedGradientFvPatchScalarField::evaluate();
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
gradient() = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
|
||||
(
|
||||
const alphaContactAngleFvPatchScalarField& gcpsf
|
||||
const alphaContactAngleFvPatchScalarField& acpsf
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchScalarField(gcpsf)
|
||||
fixedGradientFvPatchScalarField(acpsf),
|
||||
limit_(acpsf.limit_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
|
||||
(
|
||||
const alphaContactAngleFvPatchScalarField& gcpsf,
|
||||
const alphaContactAngleFvPatchScalarField& acpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
zeroGradientFvPatchScalarField(gcpsf, iF)
|
||||
fixedGradientFvPatchScalarField(acpsf, iF),
|
||||
limit_(acpsf.limit_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::alphaContactAngleFvPatchScalarField::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
{
|
||||
if (limit_ == lcGradient)
|
||||
{
|
||||
gradient() =
|
||||
patch().deltaCoeffs()
|
||||
*(
|
||||
max(min
|
||||
(
|
||||
*this + gradient()/patch().deltaCoeffs(),
|
||||
scalar(1)), scalar(0)
|
||||
) - *this
|
||||
);
|
||||
}
|
||||
else if (limit_ == lcZeroGradient)
|
||||
{
|
||||
gradient() = 0.0;
|
||||
}
|
||||
|
||||
fixedGradientFvPatchScalarField::evaluate();
|
||||
|
||||
if (limit_ == lcAlpha)
|
||||
{
|
||||
scalarField::operator=(max(min(*this, scalar(1)), scalar(0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::alphaContactAngleFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fixedGradientFvPatchScalarField::write(os);
|
||||
os.writeKeyword("limit")
|
||||
<< limitControlNames_[limit_] << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -30,6 +30,31 @@ Description
|
||||
Derived classes must implement the theta() fuction which returns the
|
||||
wall contact angle field.
|
||||
|
||||
The essential entry "limit" controls the gradient of alpha1 on the wall:
|
||||
|
||||
limit none; // Calculate the gradient from the contact-angle without
|
||||
// limiter
|
||||
|
||||
limit gradient; // Limit the wall-gradient such that alpha1 remains
|
||||
// bounded on the wall
|
||||
|
||||
limit alpha; // Bound the calculated alpha1 on the wall
|
||||
|
||||
limit zeroGradient; // Set the gradient of alpha1 to 0 on the wall
|
||||
// i.e. reproduce previous behaviour
|
||||
|
||||
Note that if any of the first three options are used the boundary condition
|
||||
on p_rgh must set to guarantee that the flux is corrected to be zero at the
|
||||
wall e.g.
|
||||
|
||||
walls
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
adjoint no;
|
||||
}
|
||||
|
||||
If "limit zeroGradient;" is used the pressure BCs can be left as before.
|
||||
|
||||
SourceFiles
|
||||
alphaContactAngleFvPatchScalarField.C
|
||||
|
||||
@ -38,7 +63,7 @@ SourceFiles
|
||||
#ifndef alphaContactAngleFvPatchScalarField_H
|
||||
#define alphaContactAngleFvPatchScalarField_H
|
||||
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "fvsPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -52,7 +77,7 @@ namespace Foam
|
||||
|
||||
class alphaContactAngleFvPatchScalarField
|
||||
:
|
||||
public zeroGradientFvPatchScalarField
|
||||
public fixedGradientFvPatchScalarField
|
||||
{
|
||||
|
||||
public:
|
||||
@ -60,6 +85,17 @@ public:
|
||||
//- Runtime type information
|
||||
TypeName("alphaContactAngle");
|
||||
|
||||
//- Alpha limit options
|
||||
enum limitControls
|
||||
{
|
||||
lcNone,
|
||||
lcGradient,
|
||||
lcZeroGradient,
|
||||
lcAlpha
|
||||
};
|
||||
|
||||
static const NamedEnum<limitControls, 4> limitControlNames_;
|
||||
limitControls limit_;
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -110,6 +146,15 @@ public:
|
||||
const fvPatchVectorField& Up,
|
||||
const fvsPatchVectorField& nHat
|
||||
) const = 0;
|
||||
|
||||
//- Evaluate the patch field
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType=Pstream::blocking
|
||||
);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ constantAlphaContactAngleFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
alphaContactAngleFvPatchScalarField(p, iF),
|
||||
alphaContactAngleFvPatchScalarField(p, iF, dict),
|
||||
theta0_(readScalar(dict.lookup("theta0")))
|
||||
{
|
||||
evaluate();
|
||||
@ -112,7 +112,7 @@ void Foam::constantAlphaContactAngleFvPatchScalarField::write
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
alphaContactAngleFvPatchScalarField::write(os);
|
||||
os.writeKeyword("theta0") << theta0_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
@ -70,7 +70,7 @@ dynamicAlphaContactAngleFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
alphaContactAngleFvPatchScalarField(p, iF),
|
||||
alphaContactAngleFvPatchScalarField(p, iF, dict),
|
||||
theta0_(readScalar(dict.lookup("theta0"))),
|
||||
uTheta_(readScalar(dict.lookup("uTheta"))),
|
||||
thetaA_(readScalar(dict.lookup("thetaA"))),
|
||||
@ -145,7 +145,7 @@ Foam::dynamicAlphaContactAngleFvPatchScalarField::theta
|
||||
|
||||
void Foam::dynamicAlphaContactAngleFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
alphaContactAngleFvPatchScalarField::write(os);
|
||||
os.writeKeyword("theta0") << theta0_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("uTheta") << uTheta_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("thetaA") << thetaA_ << token::END_STATEMENT << nl;
|
||||
@ -71,7 +71,7 @@ timeVaryingAlphaContactAngleFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
alphaContactAngleFvPatchScalarField(p, iF),
|
||||
alphaContactAngleFvPatchScalarField(p, iF, dict),
|
||||
t0_(readScalar(dict.lookup("t0"))),
|
||||
thetaT0_(readScalar(dict.lookup("thetaT0"))),
|
||||
te_(readScalar(dict.lookup("te"))),
|
||||
@ -130,7 +130,7 @@ void Foam::timeVaryingAlphaContactAngleFvPatchScalarField::write
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
alphaContactAngleFvPatchScalarField::write(os);
|
||||
os.writeKeyword("t0") << t0_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("thetaT0") << thetaT0_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("te") << te_ << token::END_STATEMENT << nl;
|
||||
@ -84,8 +84,7 @@ public:
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// timeVaryingAlphaContactAngleFvPatchScalarField onto a new
|
||||
// patch
|
||||
// timeVaryingAlphaContactAngleFvPatchScalarField onto a new patch
|
||||
timeVaryingAlphaContactAngleFvPatchScalarField
|
||||
(
|
||||
const timeVaryingAlphaContactAngleFvPatchScalarField&,
|
||||
@ -0,0 +1,422 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 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 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 "kOmegaSST.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
#include "backwardsCompatibilityWallFunctions.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace incompressible
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(kOmegaSST, 0);
|
||||
addToRunTimeSelectionTable(RASModel, kOmegaSST, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
tmp<volScalarField> kOmegaSST::F1(const volScalarField& CDkOmega) const
|
||||
{
|
||||
volScalarField CDkOmegaPlus = max
|
||||
(
|
||||
CDkOmega,
|
||||
dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10)
|
||||
);
|
||||
|
||||
volScalarField arg1 = min
|
||||
(
|
||||
min
|
||||
(
|
||||
max
|
||||
(
|
||||
(scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_),
|
||||
scalar(500)*nu()/(sqr(y_)*omega_)
|
||||
),
|
||||
(4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_))
|
||||
),
|
||||
scalar(10)
|
||||
);
|
||||
|
||||
return tanh(pow4(arg1));
|
||||
}
|
||||
|
||||
tmp<volScalarField> kOmegaSST::F2() const
|
||||
{
|
||||
volScalarField arg2 = min
|
||||
(
|
||||
max
|
||||
(
|
||||
(scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_),
|
||||
scalar(500)*nu()/(sqr(y_)*omega_)
|
||||
),
|
||||
scalar(100)
|
||||
);
|
||||
|
||||
return tanh(sqr(arg2));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
kOmegaSST::kOmegaSST
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
transportModel& lamTransportModel
|
||||
)
|
||||
:
|
||||
RASModel(typeName, U, phi, lamTransportModel),
|
||||
|
||||
alphaK1_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"alphaK1",
|
||||
coeffDict_,
|
||||
0.85034
|
||||
)
|
||||
),
|
||||
alphaK2_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"alphaK2",
|
||||
coeffDict_,
|
||||
1.0
|
||||
)
|
||||
),
|
||||
alphaOmega1_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"alphaOmega1",
|
||||
coeffDict_,
|
||||
0.5
|
||||
)
|
||||
),
|
||||
alphaOmega2_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"alphaOmega2",
|
||||
coeffDict_,
|
||||
0.85616
|
||||
)
|
||||
),
|
||||
gamma1_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"gamma1",
|
||||
coeffDict_,
|
||||
0.5532
|
||||
)
|
||||
),
|
||||
gamma2_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"gamma2",
|
||||
coeffDict_,
|
||||
0.4403
|
||||
)
|
||||
),
|
||||
beta1_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"beta1",
|
||||
coeffDict_,
|
||||
0.075
|
||||
)
|
||||
),
|
||||
beta2_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"beta2",
|
||||
coeffDict_,
|
||||
0.0828
|
||||
)
|
||||
),
|
||||
betaStar_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"betaStar",
|
||||
coeffDict_,
|
||||
0.09
|
||||
)
|
||||
),
|
||||
a1_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"a1",
|
||||
coeffDict_,
|
||||
0.31
|
||||
)
|
||||
),
|
||||
c1_
|
||||
(
|
||||
dimensioned<scalar>::lookupOrAddToDict
|
||||
(
|
||||
"c1",
|
||||
coeffDict_,
|
||||
10.0
|
||||
)
|
||||
),
|
||||
|
||||
y_(mesh_),
|
||||
|
||||
k_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"k",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
autoCreateK("k", mesh_)
|
||||
),
|
||||
omega_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"omega",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
autoCreateOmega("omega", mesh_)
|
||||
),
|
||||
nut_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"nut",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
autoCreateNut("nut", mesh_)
|
||||
)
|
||||
{
|
||||
nut_ =
|
||||
a1_*k_
|
||||
/max
|
||||
(
|
||||
a1_*(omega_ + omegaSmall_),
|
||||
F2()*mag(symm(fvc::grad(U_)))
|
||||
);
|
||||
nut_.correctBoundaryConditions();
|
||||
|
||||
printCoeffs();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
tmp<volSymmTensorField> kOmegaSST::R() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"R",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)),
|
||||
k_.boundaryField().types()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
tmp<volSymmTensorField> kOmegaSST::devReff() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
new volSymmTensorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"devRhoReff",
|
||||
runTime_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
-nuEff()*dev(twoSymm(fvc::grad(U_)))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
tmp<fvVectorMatrix> kOmegaSST::divDevReff(volVectorField& U) const
|
||||
{
|
||||
return
|
||||
(
|
||||
- fvm::laplacian(nuEff(), U)
|
||||
- fvc::div(nuEff()*dev(fvc::grad(U)().T()))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool kOmegaSST::read()
|
||||
{
|
||||
if (RASModel::read())
|
||||
{
|
||||
alphaK1_.readIfPresent(coeffDict());
|
||||
alphaK2_.readIfPresent(coeffDict());
|
||||
alphaOmega1_.readIfPresent(coeffDict());
|
||||
alphaOmega2_.readIfPresent(coeffDict());
|
||||
gamma1_.readIfPresent(coeffDict());
|
||||
gamma2_.readIfPresent(coeffDict());
|
||||
beta1_.readIfPresent(coeffDict());
|
||||
beta2_.readIfPresent(coeffDict());
|
||||
betaStar_.readIfPresent(coeffDict());
|
||||
a1_.readIfPresent(coeffDict());
|
||||
c1_.readIfPresent(coeffDict());
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void kOmegaSST::correct()
|
||||
{
|
||||
RASModel::correct();
|
||||
|
||||
if (!turbulence_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (mesh_.changing())
|
||||
{
|
||||
y_.correct();
|
||||
}
|
||||
|
||||
volScalarField S2 = magSqr(symm(fvc::grad(U_)));
|
||||
volScalarField G("RASModel::G", nut_*2*S2);
|
||||
|
||||
// Update omega and G at the wall
|
||||
omega_.boundaryField().updateCoeffs();
|
||||
|
||||
volScalarField F1 = this->F1
|
||||
(
|
||||
(2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_
|
||||
);
|
||||
|
||||
// Epsilon diffusion correction
|
||||
surfaceScalarField CDkPhiOmega
|
||||
(
|
||||
"CDkPhiOmega",
|
||||
(2*alphaOmega2_)
|
||||
*fvc::interpolate(F1 - scalar(1))
|
||||
/fvc::interpolate(omega_)
|
||||
*fvc::snGrad(k_)*mesh_.magSf()
|
||||
);
|
||||
|
||||
forAll (CDkPhiOmega.boundaryField(), patchi)
|
||||
{
|
||||
if (!CDkPhiOmega.boundaryField()[patchi].coupled())
|
||||
{
|
||||
CDkPhiOmega.boundaryField()[patchi] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
// Turbulent frequency equation
|
||||
tmp<fvScalarMatrix> omegaEqn
|
||||
(
|
||||
fvm::ddt(omega_)
|
||||
+ fvm::div(phi_, omega_)
|
||||
- fvm::Sp(fvc::div(phi_), omega_)
|
||||
- fvm::laplacian(DomegaEff(F1), omega_)
|
||||
+ fvm::div(CDkPhiOmega, omega_)
|
||||
- fvm::Sp(fvc::div(CDkPhiOmega), omega_)
|
||||
==
|
||||
gamma(F1)*2*S2
|
||||
- fvm::Sp(beta(F1)*omega_, omega_)
|
||||
);
|
||||
|
||||
omegaEqn().relax();
|
||||
|
||||
omegaEqn().boundaryManipulate(omega_.boundaryField());
|
||||
|
||||
solve(omegaEqn);
|
||||
bound(omega_, omega0_);
|
||||
|
||||
// Turbulent kinetic energy equation
|
||||
tmp<fvScalarMatrix> kEqn
|
||||
(
|
||||
fvm::ddt(k_)
|
||||
+ fvm::div(phi_, k_)
|
||||
- fvm::Sp(fvc::div(phi_), k_)
|
||||
- fvm::laplacian(DkEff(F1), k_)
|
||||
==
|
||||
min(G, c1_*betaStar_*k_*omega_)
|
||||
- fvm::Sp(betaStar_*omega_, k_)
|
||||
);
|
||||
|
||||
kEqn().relax();
|
||||
solve(kEqn);
|
||||
bound(k_, k0_);
|
||||
|
||||
|
||||
// Re-calculate viscosity
|
||||
nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(S2));
|
||||
nut_.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace incompressible
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user