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

This commit is contained in:
henry
2009-07-24 15:55:52 +01:00
23 changed files with 224 additions and 96 deletions

View File

@ -7,7 +7,7 @@ autoPtr<basicPsiThermo> pThermo
basicPsiThermo& thermo = pThermo();
volScalarField& p = thermo.p();
volScalarField& h = thermo.h();
volScalarField& e = thermo.e();
const volScalarField& T = thermo.T();
const volScalarField& psi = thermo.psi();
const volScalarField& mu = thermo.mu();
@ -70,7 +70,7 @@ volScalarField rhoE
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho*(h + 0.5*magSqr(U)) - p
rho*(e + 0.5*magSqr(U))
);
surfaceScalarField pos

View File

@ -76,10 +76,10 @@ int main(int argc, char *argv[])
surfaceScalarField rPsi_neg =
fvc::interpolate(rPsi, neg, "reconstruct(T)");
surfaceScalarField h_pos =
fvc::interpolate(h, pos, "reconstruct(T)");
surfaceScalarField h_neg =
fvc::interpolate(h, neg, "reconstruct(T)");
surfaceScalarField e_pos =
fvc::interpolate(e, pos, "reconstruct(T)");
surfaceScalarField e_neg =
fvc::interpolate(e, neg, "reconstruct(T)");
surfaceVectorField U_pos = rhoU_pos/rho_pos;
surfaceVectorField U_neg = rhoU_neg/rho_neg;
@ -132,8 +132,8 @@ int main(int argc, char *argv[])
+ (a_pos*p_pos + a_neg*p_neg)*mesh.Sf();
surfaceScalarField phiEp =
aphiv_pos*rho_pos*(h_pos + 0.5*magSqr(U_pos))
+ aphiv_neg*rho_neg*(h_neg + 0.5*magSqr(U_neg))
aphiv_pos*(rho_pos*(e_pos + 0.5*magSqr(U_pos)) + p_pos)
+ aphiv_neg*(rho_neg*(e_neg + 0.5*magSqr(U_neg)) + p_neg)
+ aSf*p_pos - aSf*p_neg;
volTensorField tauMC("tauMC", mu*dev2(fvc::grad(U)().T()));
@ -156,7 +156,7 @@ int main(int argc, char *argv[])
{
solve
(
fvm::ddt(rho, U) - fvc::ddt(rho,U)
fvm::ddt(rho, U) - fvc::ddt(rho, U)
- fvm::laplacian(mu, U)
- fvc::div(tauMC)
);
@ -180,28 +180,27 @@ int main(int argc, char *argv[])
- fvc::div(sigmaDotU)
);
h = (rhoE + p)/rho - 0.5*magSqr(U);
h.correctBoundaryConditions();
e = rhoE/rho - 0.5*magSqr(U);
e.correctBoundaryConditions();
thermo.correct();
rhoE.boundaryField() =
rho.boundaryField()*
(
h.boundaryField() + 0.5*magSqr(U.boundaryField())
)
- p.boundaryField();
e.boundaryField() + 0.5*magSqr(U.boundaryField())
);
if (!inviscid)
{
volScalarField k("k", thermo.Cp()*mu/Pr);
solve
(
fvm::ddt(rho, h) - fvc::ddt(rho, h)
- fvm::laplacian(thermo.alpha(), h)
+ fvc::laplacian(thermo.alpha(), h)
fvm::ddt(rho, e) - fvc::ddt(rho, e)
- fvm::laplacian(thermo.alpha(), e)
+ fvc::laplacian(thermo.alpha(), e)
- fvc::laplacian(k, T)
);
thermo.correct();
rhoE = rho*(h + 0.5*magSqr(U)) - p;
rhoE = rho*(e + 0.5*magSqr(U));
}
p.dimensionedInternalField() =

View File

@ -71,10 +71,13 @@ void calcIncompressibleYPlus
const volScalarField::GeometricBoundaryField nutPatches =
RASModel->nut()().boundaryField();
bool foundNutPatch = false;
forAll(nutPatches, patchi)
{
if (isA<wallFunctionPatchField>(nutPatches[patchi]))
{
foundNutPatch = true;
const wallFunctionPatchField& nutPw =
dynamic_cast<const wallFunctionPatchField&>
(nutPatches[patchi]);
@ -88,6 +91,12 @@ void calcIncompressibleYPlus
<< " average: " << average(Yp) << nl << endl;
}
}
if (!foundNutPatch)
{
Info<< " no " << wallFunctionPatchField::typeName << " patches"
<< endl;
}
}
@ -142,10 +151,13 @@ void calcCompressibleYPlus
const volScalarField::GeometricBoundaryField mutPatches =
RASModel->mut()().boundaryField();
bool foundMutPatch = false;
forAll(mutPatches, patchi)
{
if (isA<wallFunctionPatchField>(mutPatches[patchi]))
{
foundMutPatch = true;
const wallFunctionPatchField& mutPw =
dynamic_cast<const wallFunctionPatchField&>
(mutPatches[patchi]);
@ -159,6 +171,12 @@ void calcCompressibleYPlus
<< " average: " << average(Yp) << nl << endl;
}
}
if (!foundMutPatch)
{
Info<< " no " << wallFunctionPatchField::typeName << " patches"
<< endl;
}
}

View File

@ -1,6 +1,13 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude
EXE_LIBS = \
-lincompressibleRASModels \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lfiniteVolume

View File

@ -26,14 +26,13 @@ Application
applyWallFunctionBounaryConditions
Description
Updates OpenFOAM RAS cases to use the new wall function framework
Updates OpenFOAM RAS cases to use the new (v1.6) wall function framework
Attempts to determine whether case is compressible or incompressible, or
can be supplied with -compressible command line argument
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "fvMesh.H"
#include "Time.H"
@ -42,6 +41,16 @@ Description
#include "wallPolyPatch.H"
#include "incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H"
#include "incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H"
#include "incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H"
#include "incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H"
#include "compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H"
#include "compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H"
#include "compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H"
#include "compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -105,25 +114,6 @@ bool caseIsCompressible(const fvMesh& mesh)
}
}
// Attempt hydrostatic pressure field
IOobject pdHeader
(
"pd",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (pdHeader.headerOk())
{
volScalarField pd(pdHeader, mesh);
if (pd.dimensions() == dimMass/sqr(dimTime)/dimLength)
{
return true;
}
}
// If none of the above are true, assume that the case is incompressible
return false;
}
@ -231,15 +221,125 @@ void replaceBoundaryType
}
void updateCompressibleCase(const fvMesh& mesh)
{
Info<< "Case treated as compressible" << nl << endl;
createVolScalarField
(
mesh,
"mut",
dimArea/dimTime*dimDensity
);
replaceBoundaryType
(
mesh,
"mut",
compressible::RASModels::mutWallFunctionFvPatchScalarField::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"epsilon",
compressible::RASModels::epsilonWallFunctionFvPatchScalarField::
typeName,
"0"
);
replaceBoundaryType
(
mesh,
"omega",
compressible::RASModels::omegaWallFunctionFvPatchScalarField::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"k",
compressible::RASModels::kqRWallFunctionFvPatchField<scalar>::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"q",
compressible::RASModels::kqRWallFunctionFvPatchField<scalar>::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"R",
compressible::RASModels::kqRWallFunctionFvPatchField<symmTensor>::
typeName,
"(0 0 0 0 0 0)"
);
}
void updateIncompressibleCase(const fvMesh& mesh)
{
Info<< "Case treated as incompressible" << nl << endl;
createVolScalarField(mesh, "nut", dimArea/dimTime);
replaceBoundaryType
(
mesh,
"nut",
incompressible::RASModels::nutWallFunctionFvPatchScalarField::typeName,
"0"
);
replaceBoundaryType
(
mesh,
"epsilon",
incompressible::RASModels::epsilonWallFunctionFvPatchScalarField::
typeName,
"0"
);
replaceBoundaryType
(
mesh,
"omega",
incompressible::RASModels::omegaWallFunctionFvPatchScalarField::
typeName,
"0"
);
replaceBoundaryType
(
mesh,
"k",
incompressible::RASModels::kqRWallFunctionFvPatchField<scalar>::
typeName,
"0"
);
replaceBoundaryType
(
mesh,
"q",
incompressible::RASModels::kqRWallFunctionFvPatchField<scalar>::
typeName,
"0"
);
replaceBoundaryType
(
mesh,
"R",
incompressible::RASModels::kqRWallFunctionFvPatchField<symmTensor>::
typeName,
"(0 0 0 0 0 0)"
);
}
int main(int argc, char *argv[])
{
# include "addTimeOptions.H"
#include "addTimeOptions.H"
argList::validOptions.insert("compressible", "");
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
bool compressible = args.optionFound("compressible");
@ -249,28 +349,13 @@ int main(int argc, char *argv[])
if (compressible || caseIsCompressible(mesh))
{
Info<< "Case treated as compressible" << nl << endl;
createVolScalarField
(
mesh,
"mut",
dimArea/dimTime*dimDensity
);
replaceBoundaryType(mesh, "mut", "mutWallFunction", "0");
updateCompressibleCase(mesh);
}
else
{
Info<< "Case treated as incompressible" << nl << endl;
createVolScalarField(mesh, "nut", dimArea/dimTime);
replaceBoundaryType(mesh, "nut", "nutWallFunction", "0");
updateIncompressibleCase(mesh);
}
replaceBoundaryType(mesh, "epsilon", "epsilonWallFunction", "0");
replaceBoundaryType(mesh, "omega", "omegaWallFunction", "0");
replaceBoundaryType(mesh, "k", "kqRWallFunction", "0");
replaceBoundaryType(mesh, "q", "kqRWallFunction", "0");
replaceBoundaryType(mesh, "R", "kqRWallFunction", "(0 0 0 0 0 0)");
Info<< "End\n" << endl;
return 0;

View File

@ -29,6 +29,7 @@ License
#include "perfectGas.H"
#include "eConstThermo.H"
#include "hConstThermo.H"
#include "janafThermo.H"
#include "specieThermo.H"
@ -63,6 +64,24 @@ makeBasicPsiThermo
perfectGas
);
makeBasicPsiThermo
(
ePsiThermo,
pureMixture,
constTransport,
hConstThermo,
perfectGas
);
makeBasicPsiThermo
(
ePsiThermo,
pureMixture,
sutherlandTransport,
hConstThermo,
perfectGas
);
makeBasicPsiThermo
(
ePsiThermo,

View File

@ -36,8 +36,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef alphatWallFunctionFvPatchScalarField_H
#define alphatWallFunctionFvPatchScalarField_H
#ifndef compressibleAlphatWallFunctionFvPatchScalarField_H
#define compressibleAlphatWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef epsilonWallFunctionFvPatchScalarField_H
#define epsilonWallFunctionFvPatchScalarField_H
#ifndef compressibleEpsilonWallFunctionFvPatchScalarField_H
#define compressibleEpsilonWallFunctionFvPatchScalarField_H
#include "fixedInternalValueFvPatchField.H"

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef kqRWallFunctionFvPatchField_H
#define kqRWallFunctionFvPatchField_H
#ifndef compressiblekqRWallFunctionFvPatchField_H
#define compressiblekqRWallFunctionFvPatchField_H
#include "zeroGradientFvPatchField.H"

View File

@ -40,8 +40,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef mutRoughWallFunctionFvPatchScalarField_H
#define mutRoughWallFunctionFvPatchScalarField_H
#ifndef compressibleMutRoughWallFunctionFvPatchScalarField_H
#define compressibleMutRoughWallFunctionFvPatchScalarField_H
#include "mutWallFunctionFvPatchScalarField.H"

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
#define mutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
#ifndef compressibleMutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
#define compressibleMutSpalartAllmarasStandardRoughWallFunctionFvPatchScalarField_H
#include "mutWallFunctionFvPatchScalarField.H"

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef mutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
#define mutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
#ifndef compressibleMutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
#define compressibleMutSpalartAllmarasStandardWallFunctionFvPatchScalarField_H
#include "mutWallFunctionFvPatchScalarField.H"

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef mutSpalartAllmarasWallFunctionFvPatchScalarField_H
#define mutSpalartAllmarasWallFunctionFvPatchScalarField_H
#ifndef compressibleMutSpalartAllmarasWallFunctionFvPatchScalarField_H
#define compressibleMutSpalartAllmarasWallFunctionFvPatchScalarField_H
#include "mutWallFunctionFvPatchScalarField.H"

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef mutWallFunctionFvPatchScalarField_H
#define mutWallFunctionFvPatchScalarField_H
#ifndef compressibleMutWallFunctionFvPatchScalarField_H
#define compressibleMutWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"

View File

@ -33,8 +33,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef omegaWallFunctionFvPatchScalarField_H
#define omegaWallFunctionFvPatchScalarField_H
#ifndef compressibleOmegaWallFunctionFvPatchScalarField_H
#define compressibleOmegaWallFunctionFvPatchScalarField_H
#include "fixedInternalValueFvPatchField.H"

View File

@ -155,13 +155,13 @@ SpalartAllmaras::SpalartAllmaras
:
LESModel(modelName, U, phi, transport),
alphaNut_
sigmaNut_
(
dimensioned<scalar>::lookupOrAddToDict
(
"alphaNut",
"sigmaNut",
coeffDict_,
1.5
0.66666
)
),
kappa_
@ -169,7 +169,7 @@ SpalartAllmaras::SpalartAllmaras
dimensioned<scalar>::lookupOrAddToDict
(
"kappa",
*this,
coeffDict_,
0.41
)
),
@ -227,7 +227,7 @@ SpalartAllmaras::SpalartAllmaras
0.07
)
),
Cw1_(Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_)),
Cw1_(Cb1_/sqr(kappa_) + (1.0 + Cb2_)/sigmaNut_),
Cw2_
(
dimensioned<scalar>::lookupOrAddToDict
@ -301,11 +301,11 @@ void SpalartAllmaras::correct(const tmp<volTensorField>& gradU)
+ fvm::div(phi(), nuTilda_)
- fvm::laplacian
(
alphaNut_*(nuTilda_ + nu()),
(nuTilda_ + nu())/sigmaNut_,
nuTilda_,
"laplacian(DnuTildaEff,nuTilda)"
)
- alphaNut_*Cb2_*magSqr(fvc::grad(nuTilda_))
- Cb2_/sigmaNut_*magSqr(fvc::grad(nuTilda_))
==
Cb1_*STilda*nuTilda_
- fvm::Sp(Cw1_*fw(STilda, dTilda)*nuTilda_/sqr(dTilda), nuTilda_)
@ -358,7 +358,7 @@ bool SpalartAllmaras::read()
{
if (LESModel::read())
{
alphaNut_.readIfPresent(coeffDict());
sigmaNut_.readIfPresent(coeffDict());
kappa_.readIfPresent(*this);
Cb1_.readIfPresent(coeffDict());
Cb2_.readIfPresent(coeffDict());
@ -366,7 +366,7 @@ bool SpalartAllmaras::read()
Cv2_.readIfPresent(coeffDict());
CDES_.readIfPresent(coeffDict());
ck_.readIfPresent(coeffDict());
Cw1_ = Cb1_/sqr(kappa_) + alphaNut_*(1.0 + Cb2_);
Cw1_ = Cb1_/sqr(kappa_) + (1.0 + Cb2_)/sigmaNut_;
Cw2_.readIfPresent(coeffDict());
Cw3_.readIfPresent(coeffDict());

View File

@ -71,7 +71,7 @@ protected:
// Protected data
dimensionedScalar alphaNut_;
dimensionedScalar sigmaNut_;
dimensionedScalar kappa_;

View File

@ -15,7 +15,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType hPsiThermo<pureMixture<sutherlandTransport<specieThermo<hConstThermo<perfectGas>>>>>;
thermoType ePsiThermo<pureMixture<sutherlandTransport<specieThermo<hConstThermo<perfectGas>>>>>;
mixture air 1 28.96 1004.5 0 1.458e-06 110.4;

View File

@ -17,7 +17,7 @@ FoamFile
Pr Pr [ 0 0 0 0 0 0 0 ] 0.72;
thermoType hPsiThermo<pureMixture<sutherlandTransport<specieThermo<janafThermo<perfectGas>>>>>;
thermoType ePsiThermo<pureMixture<sutherlandTransport<specieThermo<janafThermo<perfectGas>>>>>;
mixture N2 1 28.01348 100 10000 1000 2.9525407 0.0013968838 -4.9262577e-07 7.8600091e-11 -4.6074978e-15 -923.93753 5.8718221 3.5309628 -0.0001236595 -5.0299339e-07 2.4352768e-09 -1.4087954e-12 -1046.9637 2.9674391 1.458e-06 110;

View File

@ -15,7 +15,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
thermoType ePsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
mixture normalisedGas 1 11640.3 2.5 0 0 1;

View File

@ -15,7 +15,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
thermoType ePsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
mixture normalisedGas 1 11640.3 2.5 0 0 1;

View File

@ -15,7 +15,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
thermoType ePsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
mixture air 1 28.96 1004.5 2.544e+06 0 1;

View File

@ -15,7 +15,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
thermoType ePsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>;
mixture normalisedGas 1 11640.3 2.5 0 0 1;