moving old nut wall functions

This commit is contained in:
andy
2008-08-27 11:20:13 +01:00
parent 2b614594ed
commit 4e9ad300a7
6 changed files with 0 additions and 1144 deletions

View File

@ -1,300 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "nutStandardRoughWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutStandardRoughWallFunctionFvPatchScalarField::
nutStandardRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
roughnessHeight_(pTraits<scalar>::zero),
roughnessConstant_(pTraits<scalar>::zero),
roughnessFudgeFactor_(pTraits<scalar>::zero)
{}
nutStandardRoughWallFunctionFvPatchScalarField::
nutStandardRoughWallFunctionFvPatchScalarField
(
const nutStandardRoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
roughnessHeight_(ptf.roughnessHeight_),
roughnessConstant_(ptf.roughnessConstant_),
roughnessFudgeFactor_(ptf.roughnessFudgeFactor_)
{}
nutStandardRoughWallFunctionFvPatchScalarField::
nutStandardRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
roughnessFudgeFactor_(readScalar(dict.lookup("roughnessFudgeFactor")))
{}
nutStandardRoughWallFunctionFvPatchScalarField::
nutStandardRoughWallFunctionFvPatchScalarField
(
const nutStandardRoughWallFunctionFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf),
roughnessHeight_(tppsf.roughnessHeight_),
roughnessConstant_(tppsf.roughnessConstant_),
roughnessFudgeFactor_(tppsf.roughnessFudgeFactor_)
{}
nutStandardRoughWallFunctionFvPatchScalarField::
nutStandardRoughWallFunctionFvPatchScalarField
(
const nutStandardRoughWallFunctionFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF),
roughnessHeight_(tppsf.roughnessHeight_),
roughnessConstant_(tppsf.roughnessConstant_),
roughnessFudgeFactor_(tppsf.roughnessFudgeFactor_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nutStandardRoughWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
const RASModel& rasModel
= db().lookupObject<RASModel>("RASProperties");
const scalar kappa = rasModel.kappa().value();
const scalar E = rasModel.E().value();
const scalar yPlusLam = 11.225;
// The reciprical of the distance to the adjacent cell centre.
const scalarField& ry = patch().deltaCoeffs();
const fvPatchVectorField& U =
patch().lookupPatchField<volVectorField, vector>("U");
// The flow velocity at the adjacent cell centre.
scalarField magUp = mag(U.patchInternalField() - U);
const scalarField& nuw =
patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField& nutw = *this;
scalarField magFaceGradU = mag(U.snGrad());
if(roughnessHeight_ > 0.0)
{
// Rough Walls.
const scalar c_1 = 1/(90 - 2.25) + roughnessConstant_;
static const scalar c_2 = 2.25/(90 - 2.25);
static const scalar c_3 = 2.0*atan(1.0)/log(90/2.25);
static const scalar c_4 = c_3*log(2.25);
//if (KsPlusBasedOnYPlus_)
{
// If KsPlus is based on YPlus the extra term added to the law
// of the wall will depend on yPlus.
forAll(nutw, facei)
{
const scalar magUpara = magUp[facei];
const scalar Re = magUpara/(nuw[facei]*ry[facei]);
const scalar kappaRe = kappa*Re;
scalar yPlus = yPlusLam;
const scalar ryPlusLam = 1.0/yPlus;
int iter = 0;
scalar yPlusLast = 0.0;
scalar dKsPlusdYPlus = roughnessHeight_*ry[facei];
// Enforce the roughnessHeight to be less than the distance to
// the first cell centre.
if(dKsPlusdYPlus > 1)
{
dKsPlusdYPlus = 1;
}
// Fudge factor to get results to be similar to fluent
// (at least difference between rough and smooth).
dKsPlusdYPlus *= roughnessFudgeFactor_;
do
{
yPlusLast = yPlus;
// The non-dimensional roughness height.
scalar KsPlus = yPlus*dKsPlusdYPlus;
// The extra term in the law-of-the-wall.
scalar G = 0.0;
scalar yPlusGPrime = 0.0;
if (KsPlus >= 90)
{
const scalar t_1 = 1 + roughnessConstant_*KsPlus;
G = log(t_1);
yPlusGPrime = roughnessConstant_*KsPlus/t_1;
}
else if (KsPlus > 2.25)
{
const scalar t_1 = c_1*KsPlus - c_2;
const scalar t_2 = c_3*log(KsPlus) - c_4;
const scalar sint_2 = sin(t_2);
const scalar logt_1 = log(t_1);
G = logt_1*sint_2;
yPlusGPrime =
(c_1*sint_2*KsPlus/t_1) + (c_3*logt_1*cos(t_2));
}
scalar denom = 1.0 + log(E* yPlus) - G - yPlusGPrime;
if(mag(denom) > VSMALL)
{
yPlus = (kappaRe + yPlus*(1 - yPlusGPrime))/denom;
}
else
{
// Ensure immediate end and nutw = 0.
yPlus = 0;
}
} while
(
mag(ryPlusLam*(yPlus - yPlusLast)) > 0.0001
&& ++iter < 10
&& yPlus > VSMALL
);
if (yPlus > yPlusLam)
{
nutw[facei] = nuw[facei]*(yPlus*yPlus/Re - 1);
}
else
{
nutw[facei] = 0.0;
}
}
}
}
else
{
// Smooth Walls.
forAll(nutw, facei)
{
const scalar magUpara = magUp[facei];
const scalar Re = magUpara/(nuw[facei]*ry[facei]);
const scalar kappaRe = kappa*Re;
scalar yPlus = yPlusLam;
const scalar ryPlusLam = 1.0/yPlus;
int iter = 0;
scalar yPlusLast = 0.0;
do
{
yPlusLast = yPlus;
yPlus = (kappaRe + yPlus)/(1.0 + log(E*yPlus));
} while(mag(ryPlusLam*(yPlus - yPlusLast)) > 0.0001 && ++iter < 10);
if (yPlus > yPlusLam)
{
nutw[facei] = nuw[facei]*(yPlus*yPlus/Re - 1);
}
else
{
nutw[facei] = 0.0;
}
}
}
}
void nutStandardRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fixedValueFvPatchScalarField::write(os);
os.writeKeyword("roughnessHeight")
<< roughnessHeight_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessConstant")
<< roughnessConstant_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessFudgeFactor")
<< roughnessFudgeFactor_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutStandardRoughWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,200 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::RASModels::nutStandardRoughWallFunctionFvPatchScalarField
Description
Wall function boundary condition for rough walls
SourceFiles
nutStandardWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutStandardRoughWallFunctionFvPatchScalarField_H
#define nutStandardRoughWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class nutWallFunctionFvPatch Declaration
\*---------------------------------------------------------------------------*/
class nutStandardRoughWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
scalar roughnessHeight_;
scalar roughnessConstant_;
scalar roughnessFudgeFactor_;
public:
//- Runtime type information
TypeName("nutStandardRoughWallFunction");
// Constructors
//- Construct from patch and internal field
nutStandardRoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutStandardRoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nutStandardRoughWallFunctionFvPatchScalarField
// onto a new patch
nutStandardRoughWallFunctionFvPatchScalarField
(
const nutStandardRoughWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutStandardRoughWallFunctionFvPatchScalarField
(
const nutStandardRoughWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutStandardRoughWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutStandardRoughWallFunctionFvPatchScalarField
(
const nutStandardRoughWallFunctionFvPatchScalarField&,
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 nutStandardRoughWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Access
//- Return the fluctuation scale
const scalar& roughnessHeight() const
{
return roughnessHeight_;
}
//- Return reference to the fluctuation scale to allow adjustment
scalar& roughnessHeight()
{
return roughnessHeight_;
}
//- Return the fluctuation scale
const scalar& roughnessConstant() const
{
return roughnessConstant_;
}
//- Return reference to the fluctuation scale to allow adjustment
scalar& roughnessConstant()
{
return roughnessConstant_;
}
//- Return the fluctuation scale
const scalar& roughnessFudgeFactor() const
{
return roughnessFudgeFactor_;
}
//- Return reference to the fluctuation scale to allow adjustment
scalar& roughnessFudgeFactor()
{
return roughnessFudgeFactor_;
}
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,169 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "nutStandardWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutStandardWallFunctionFvPatchScalarField::
nutStandardWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF)
{}
nutStandardWallFunctionFvPatchScalarField::
nutStandardWallFunctionFvPatchScalarField
(
const nutStandardWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
{}
nutStandardWallFunctionFvPatchScalarField::
nutStandardWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict)
{}
nutStandardWallFunctionFvPatchScalarField::
nutStandardWallFunctionFvPatchScalarField
(
const nutStandardWallFunctionFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{}
nutStandardWallFunctionFvPatchScalarField::
nutStandardWallFunctionFvPatchScalarField
(
const nutStandardWallFunctionFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nutStandardWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
const RASModel& rasModel
= db().lookupObject<RASModel>("RASProperties");
scalar kappa = rasModel.kappa().value();
scalar E = rasModel.E().value();
scalar yPlusLam = rasModel.yPlusLam();
const scalarField& ry = patch().deltaCoeffs();
const fvPatchVectorField& U =
patch().lookupPatchField<volVectorField, vector>("U");
scalarField magUp = mag(U.patchInternalField() - U);
const scalarField& nuw =
patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField& nutw = *this;
scalarField magFaceGradU = mag(U.snGrad());
forAll(nutw, facei)
{
scalar magUpara = magUp[facei];
scalar kappaRe = kappa*magUpara/(nuw[facei]*ry[facei]);
scalar yPlus = yPlusLam;
scalar ryPlusLam = 1.0/yPlus;
int iter = 0;
scalar yPlusLast = 0.0;
do
{
yPlusLast = yPlus;
yPlus = (kappaRe + yPlus)/(1.0 + log(E*yPlus));
} while(mag(ryPlusLam*(yPlus - yPlusLast)) > 0.01 && ++iter < 10 );
if (yPlus > yPlusLam)
{
nutw[facei] = nuw[facei]*(yPlus*kappa/log(E*yPlus) - 1);
}
else
{
nutw[facei] = 0.0;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nutStandardWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,151 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::RASModels::nutStandardWallFunctionFvPatchScalarField
Description
Wall function boundary condition for walls
SourceFiles
nutStandardWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutStandardWallFunctionFvPatchScalarField_H
#define nutStandardWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class nutWallFunctionFvPatch Declaration
\*---------------------------------------------------------------------------*/
class nutStandardWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
public:
//- Runtime type information
TypeName("nutStandardWallFunction");
// Constructors
//- Construct from patch and internal field
nutStandardWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutStandardWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given nutStandardWallFunctionFvPatchScalarField
// onto a new patch
nutStandardWallFunctionFvPatchScalarField
(
const nutStandardWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutStandardWallFunctionFvPatchScalarField
(
const nutStandardWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutStandardWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutStandardWallFunctionFvPatchScalarField
(
const nutStandardWallFunctionFvPatchScalarField&,
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 nutStandardWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,173 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "nutWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF)
{}
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper)
{}
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict)
{}
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf)
{}
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nutWallFunctionFvPatchScalarField::evaluate(const Pstream::commsTypes)
{
const RASModel& rasModel
= db().lookupObject<RASModel>("RASProperties");
scalar kappa = rasModel.kappa().value();
scalar E = rasModel.E().value();
const scalarField& ry = patch().deltaCoeffs();
const fvPatchVectorField& U =
patch().lookupPatchField<volVectorField, vector>("U");
scalarField magUp = mag(U.patchInternalField() - U);
const scalarField& nuw =
patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField& nutw = *this;
scalarField magFaceGradU = mag(U.snGrad());
forAll(nutw, facei)
{
scalar magUpara = magUp[facei];
scalar utau = sqrt((nutw[facei] + nuw[facei])*magFaceGradU[facei]);
if (utau > VSMALL)
{
int iter = 0;
scalar err = GREAT;
do
{
scalar kUu = min(kappa*magUpara/utau, 50);
scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu);
scalar f =
- utau/(ry[facei]*nuw[facei])
+ magUpara/utau
+ 1/E*(fkUu - 1.0/6.0*kUu*sqr(kUu));
scalar df =
1.0/(ry[facei]*nuw[facei])
+ magUpara/sqr(utau)
+ 1/E*kUu*fkUu/utau;
scalar utauNew = utau + f/df;
err = mag((utau - utauNew)/utau);
utau = utauNew;
} while (utau > VSMALL && err > 0.01 && ++iter < 10);
nutw[facei] =
max(sqr(max(utau, 0))/magFaceGradU[facei] - nuw[facei], 0.0);
}
else
{
nutw[facei] = 0;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nutWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,151 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::RASModels::nutWallFunctionFvPatchScalarField
Description
Wall function boundary condition for walls
SourceFiles
nutWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutWallFunctionFvPatchScalarField_H
#define nutWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class nutWallFunctionFvPatch Declaration
\*---------------------------------------------------------------------------*/
class nutWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
public:
//- Runtime type information
TypeName("nutWallFunction");
// Constructors
//- Construct from patch and internal field
nutWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given nutWallFunctionFvPatchScalarField
// onto a new patch
nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField&,
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 nutWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //