Annex 1: Codi
Aquest annex conté les línees de codi que han estat necessàries programar i compilar de nou per
tal d'introduir les lleis de paret rugoses en el model LES.
Annex 1: Codi
1. NutWallFunction ...............................................................................................................- 1 1.1 NutWallFunctionFvPatchScalarField.C ......................................................................- 1 1.2 NutWallFunctionFvPatchScalarField.H ......................................................................- 5 2. NutkWallFunction .............................................................................................................- 9 2.1 NutkWallFunctionFvPatchScalarField.C ....................................................................- 9 2.2 nutkWallFunctionFvPatchScalarField.H...................................................................- 12 3.NuSgsWallFunction .........................................................................................................- 15 3.1 NuSgsWallFunctionFvPatchScalarField.C ...............................................................- 15 3.2 NuSgsWallFunctionFvPatchScalarField.H ...............................................................- 19 4. NutkRoughWallFunction ................................................................................................- 23 4.1 NutkRoughWallFunctionFvPatchScalarField.C .......................................................- 23 4.2 nutkRoughWallFunctionFvPatchScalarField.H ........................................................- 28 5. NutURoughWallFunction ...............................................................................................- 32 5.1 nutURoughWallFunctionFvPatchScalarField.C .......................................................- 32 5.2 NutURoughWallFunctionFvPatchScalarField.H ......................................................- 38 6. NutModifiedURoughWallFunction ................................................................................- 43 6.1 nutModifiedURoughWallFunctionFvPatchScalarField.C.........................................- 43 6.2 nutModifiedURoughWallFunctionFvPatchScalarField.H ........................................- 49 -
1. NutWallFunction
1.1 NutWallFunctionFvPatchScalarField.C
/*---------------------------------------------------------------------------* \
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "nutWallFunctionFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "wallFvPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(nutWallFunctionFvPatchScalarField, 0);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void nutWallFunctionFvPatchScalarField::checkType()
{
if (!isA<wallFvPatch>(patch()))
{
FatalErrorIn("nutWallFunctionFvPatchScalarField::checkType()")
-1-
<< "Invalid wall function specification" << nl
<< " Patch type for patch " << patch().name()
<< " must be wall" << nl
<< " Current patch type is " << patch().type() << nl << endl
<< abort(FatalError);
}
}
void nutWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
{
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
yPlusLam_(yPlusLam(kappa_, E_))
{
checkType();
}
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
yPlusLam_(ptf.yPlusLam_)
{
checkType();
}
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
(
-2-
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
yPlusLam_(yPlusLam(kappa_, E_))
{
checkType();
}
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField& wfpsf
)
:
fixedValueFvPatchScalarField(wfpsf),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{
checkType();
}
nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField& wfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(wfpsf, iF),
Cmu_(wfpsf.Cmu_),
kappa_(wfpsf.kappa_),
E_(wfpsf.E_),
yPlusLam_(wfpsf.yPlusLam_)
{
checkType();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
scalar nutWallFunctionFvPatchScalarField::yPlusLam
(
const scalar kappa,
const scalar E
)
{
scalar ypl = 11.0;
-3-
for (int i=0; i<10; i++)
{
ypl = log(max(E*ypl, 1))/kappa;
}
return ypl;
}
void nutWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
operator==(calcNut());
fixedValueFvPatchScalarField::updateCoeffs();
}
void nutWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //
-4-
1.2 NutWallFunctionFvPatchScalarField.H
/*---------------------------------------------------------------------------*\
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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/>.
Class
Foam::incompressible::nutWallFunctionFvPatchScalarField
Group
grpIcoWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions, based on turbulence kinetic energy.
- replicates OpenFOAM v1.5 (and earlier) behaviour
\heading Patch usage
Example of the boundary condition specification:
\verbatim
myPatch
{
type
nutWallFunction;
}
\endverbatim
SeeAlso
Foam::fixedValueFvPatchField
SourceFiles
nutWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
-5-
#ifndef nutWallFunctionFvPatchScalarField_H
#define nutWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
/*---------------------------------------------------------------------------*\
Class nutWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
protected:
// Protected data
//- Cmu coefficient
scalar Cmu_;
//- Von Karman constant
scalar kappa_;
//- E coefficient
scalar E_;
//- Y+ at the edge of the laminar sublayer
scalar yPlusLam_;
// Protected Member Functions
//- Check the type of the patch
virtual void checkType();
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const = 0;
//- Write local wall function variables
virtual void writeLocalEntries(Ostream&) const;
public:
//- Runtime type information
TypeName("nutWallFunction");
-6-
// 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 as copy setting internal field reference
nutWallFunctionFvPatchScalarField
(
const nutWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
// Member functions
//- Calculate the Y+ at the edge of the laminar sublayer
static scalar yPlusLam(const scalar kappa, const scalar E);
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const = 0;
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
-7-
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
-8-
2. NutkWallFunction
2.1 NutkWallFunctionFvPatchScalarField.C
/*---------------------------------------------------------------------------* \
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "nutkWallFunctionFvPatchScalarField.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "wallFvPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
{
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const tmp<volScalarField> tnu = turbModel.nu();
-9-
const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchi];
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
forAll(nutw, faceI)
{
label faceCellI = patch().faceCells()[faceI];
scalar yPlus = Cmu25*y[faceI]*sqrt(k[faceCellI])/nuw[faceI];
if (yPlus > yPlusLam_)
{
nutw[faceI] = nuw[faceI]*(yPlus*kappa_/log(E_*yPlus) - 1.0);
}
}
return tnutw;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(p, iF)
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
(
const nutkWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict)
- 10 -
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
(
const nutkWallFunctionFvPatchScalarField& wfpsf
)
:
nutWallFunctionFvPatchScalarField(wfpsf)
{}
nutkWallFunctionFvPatchScalarField::nutkWallFunctionFvPatchScalarField
(
const nutkWallFunctionFvPatchScalarField& wfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(wfpsf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
{
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
tmp<scalarField> kwc = k.boundaryField()[patchi].patchInternalField();
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchi];
return pow025(Cmu_)*y*sqrt(kwc)/nuw;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutkWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //
- 11 -
2.2 nutkWallFunctionFvPatchScalarField.H
/*---------------------------------------------------------------------------*\
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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/>.
Class
Foam::incompressible::nutkWallFunctionFvPatchScalarField
Group
grpIcoWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions, based on turbulence kinetic energy.
- replicates OpenFOAM v1.5 (and earlier) behaviour
\heading Patch usage
Example of the boundary condition specification:
\verbatim
myPatch
{
type
nutkWallFunction;
}
\endverbatim
SeeAlso
Foam::nutWallFunctionFvPatchScalarField
SourceFiles
nutkWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutkWallFunctionFvPatchScalarField_H
- 12 -
#define nutkWallFunctionFvPatchScalarField_H
#include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
/*---------------------------------------------------------------------------*\
Class nutkWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutkWallFunctionFvPatchScalarField
:
public nutWallFunctionFvPatchScalarField
{
protected:
// Protected Member Functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
public:
//- Runtime type information
TypeName("nutkWallFunction");
// Constructors
//- Construct from patch and internal field
nutkWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutkWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nutkWallFunctionFvPatchScalarField
// onto a new patch
nutkWallFunctionFvPatchScalarField
(
const nutkWallFunctionFvPatchScalarField&,
- 13 -
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutkWallFunctionFvPatchScalarField
(
const nutkWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutkWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutkWallFunctionFvPatchScalarField
(
const nutkWallFunctionFvPatchScalarField&,
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 nutkWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
- 14 -
3.NuSgsWallFunction
3.1 NuSgsWallFunctionFvPatchScalarField.C
/*---------------------------------------------------------------------------*\
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright held by original author
\\/ 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 "nuSgsWallFunctionFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace LESModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nuSgsWallFunctionFvPatchScalarField::
nuSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
UName_("U"),
- 15 -
nuName_("nu"),
kappa_(0.41),
E_(9.8)
{}
nuSgsWallFunctionFvPatchScalarField::
nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
nuName_(ptf.nuName_),
kappa_(ptf.kappa_),
E_(ptf.E_)
{}
nuSgsWallFunctionFvPatchScalarField::
nuSgsWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
UName_(dict.lookupOrDefault<word>("U", "U")),
nuName_(dict.lookupOrDefault<word>("nu", "nu")),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8))
{}
nuSgsWallFunctionFvPatchScalarField::
nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField& nwfpsf
)
:
fixedValueFvPatchScalarField(nwfpsf),
UName_(nwfpsf.UName_),
nuName_(nwfpsf.nuName_),
kappa_(nwfpsf.kappa_),
E_(nwfpsf.E_)
{}
nuSgsWallFunctionFvPatchScalarField::
nuSgsWallFunctionFvPatchScalarField
- 16 -
(
const nuSgsWallFunctionFvPatchScalarField& nwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(nwfpsf, iF),
UName_(nwfpsf.UName_),
nuName_(nwfpsf.nuName_),
kappa_(nwfpsf.kappa_),
E_(nwfpsf.E_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nuSgsWallFunctionFvPatchScalarField::evaluate
(
const Pstream::commsTypes
)
{
const scalarField& ry = patch().deltaCoeffs();
const fvPatchVectorField& U =
patch().lookupPatchField<volVectorField, vector>(UName_);
scalarField magUp = mag(U.patchInternalField() - U);
const scalarField& nuw =
patch().lookupPatchField<volScalarField, scalar>(nuName_);
scalarField& nuSgsw = *this;
scalarField magFaceGradU = mag(U.snGrad());
forAll(nuSgsw, facei)
{
scalar magUpara = magUp[facei];
scalar utau = sqrt((nuSgsw[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));
- 17 -
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);
nuSgsw[facei] =
max(sqr(max(utau, 0))/magFaceGradU[facei] - nuw[facei], 0.0);
}
else
{
nuSgsw[facei] = 0;
}
}
fixedValueFvPatchScalarField::evaluate();
}
void nuSgsWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "nu", "nu", nuName_);
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nuSgsWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //
- 18 -
3.2 NuSgsWallFunctionFvPatchScalarField.H
/*---------------------------------------------------------------------------*\
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright held by original author
\\/ 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::LESModels::
nuSgsWallFunctionFvPatchScalarField
Description
Spalart Allmaras wall function boundary condition for incompressible flows
SourceFiles
nuSgsWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nuSgsWallFunctionFvPatchScalarField_H
#define nuSgsWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace LESModels
{
/*---------------------------------------------------------------------------*\
Class nuSgsWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
- 19 -
class nuSgsWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
// Private data
//- Name of velocity field
word UName_;
//- Name of laminar viscosity field
word nuName_;
//- Von Karman constant
scalar kappa_;
//- E constant
scalar E_;
public:
//- Runtime type information
TypeName("nuSgsWallFunction");
// Constructors
//- Construct from patch and internal field
nuSgsWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nuSgsWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nuSgsWallFunctionFvPatchScalarField
// onto a new patch
nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
- 20 -
nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nuSgsWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nuSgsWallFunctionFvPatchScalarField
(
const nuSgsWallFunctionFvPatchScalarField&,
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 nuSgsWallFunctionFvPatchScalarField
(
*this,
iF
)
);
}
// Member functions
// Evaluation functions
//- Evaluate the patchField
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
// I-O
//- Write
void write(Ostream&) const;
};
- 21 -
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace LESModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
- 22 -
4. NutkRoughWallFunction
4.1 NutkRoughWallFunctionFvPatchScalarField.C
/*---------------------------------------------------------------------------*\
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "nutkRoughWallFunctionFvPatchScalarField.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
scalar nutkRoughWallFunctionFvPatchScalarField::fnRough
(
const scalar KsPlus,
const scalar Cs
) const
{
// Return fn based on non-dimensional roughness height
if (KsPlus < 90.0)
{
- 23 -
return pow
(
(KsPlus - 2.25)/87.75 + Cs*KsPlus,
sin(0.4258*(log(KsPlus) - 0.811))
);
}
else
{
return (1.0 + Cs*KsPlus);
}
}
tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
{
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchi];
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tnutw(new scalarField(*this));
scalarField& nutw = tnutw();
forAll(nutw, faceI)
{
label faceCellI = patch().faceCells()[faceI];
scalar uStar = Cmu25*sqrt(k[faceCellI]);
scalar yPlus = uStar*y[faceI]/nuw[faceI];
scalar KsPlus = uStar*Ks_[faceI]/nuw[faceI];
scalar Edash = E_;
if (KsPlus > 2.25)
{
Edash /= fnRough(KsPlus, Cs_[faceI]);
}
scalar limitingNutw = max(nutw[faceI], nuw[faceI]);
// To avoid oscillations limit the change in the wall viscosity
// which is particularly important if it temporarily becomes zero
nutw[faceI] =
max
(
min
(
nuw[faceI]
- 24 -
*(yPlus*kappa_/log(max(Edash*yPlus, 1+1e-4)) - 1),
2*limitingNutw
), 0.5*limitingNutw
);
if (debug)
{
Info<< "yPlus = " << yPlus
<< ", KsPlus = " << KsPlus
<< ", Edash = " << Edash
<< ", nutw = " << nutw[faceI]
<< endl;
}
}
return tnutw;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
nutkWallFunctionFvPatchScalarField(p, iF),
Ks_(p.size(), 0.0),
Cs_(p.size(), 0.0)
{}
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
(
const nutkRoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
Ks_(ptf.Ks_, mapper),
Cs_(ptf.Cs_, mapper)
{}
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
- 25 -
:
nutkWallFunctionFvPatchScalarField(p, iF, dict),
Ks_("Ks", dict, p.size()),
Cs_("Cs", dict, p.size())
{}
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
(
const nutkRoughWallFunctionFvPatchScalarField& rwfpsf
)
:
nutkWallFunctionFvPatchScalarField(rwfpsf),
Ks_(rwfpsf.Ks_),
Cs_(rwfpsf.Cs_)
{}
nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
(
const nutkRoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
nutkWallFunctionFvPatchScalarField(rwfpsf, iF),
Ks_(rwfpsf.Ks_),
Cs_(rwfpsf.Cs_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void nutkRoughWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
nutkWallFunctionFvPatchScalarField::autoMap(m);
Ks_.autoMap(m);
Cs_.autoMap(m);
}
void nutkRoughWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
)
{
nutkWallFunctionFvPatchScalarField::rmap(ptf, addr);
const nutkRoughWallFunctionFvPatchScalarField& nrwfpsf =
refCast<const nutkRoughWallFunctionFvPatchScalarField>(ptf);
Ks_.rmap(nrwfpsf.Ks_, addr);
- 26 -
Cs_.rmap(nrwfpsf.Cs_, addr);
}
void nutkRoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
Cs_.writeEntry("Cs", os);
Ks_.writeEntry("Ks", os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutkRoughWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //
- 27 -
4.2 nutkRoughWallFunctionFvPatchScalarField.H
/*---------------------------------------------------------------------------*\
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ 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/>.
Class
Foam::incompressible::nutkRoughWallFunctionFvPatchScalarField
Group
grpIcoWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions for rough walls, based on turbulence kinetic
energy. The condition manipulates the E parameter to account for roughness
effects.
Parameter ranges
- roughness height = sand-grain roughness (0 for smooth walls)
- roughness constant = 0.5-1.0
\heading Patch usage
\table
Property | Description
| Required | Default value
Ks
| sand-grain roughness height | yes |
Cs
| roughness constant | yes
|
\endtable
Example of the boundary condition specification:
\verbatim
myPatch
{
type
nutkRoughWallFunction;
Ks
uniform 0;
- 28 -
Cs
uniform 0.5;
}
\endverbatim
SeeAlso
Foam::nutkRoughWallFunctionFvPatchScalarField
SourceFiles
nutkRoughWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutkRoughWallFunctionFvPatchScalarField_H
#define nutkRoughWallFunctionFvPatchScalarField_H
#include "nutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
/*---------------------------------------------------------------------------*\
Class nutkRoughWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutkRoughWallFunctionFvPatchScalarField
:
public nutkWallFunctionFvPatchScalarField
{
protected:
// Protected data
//- Roughness height
scalarField Ks_;
//- Roughness constant
scalarField Cs_;
// Protected Member Functions
//- Compute the roughness function
virtual scalar fnRough(const scalar KsPlus, const scalar Cs) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
public:
- 29 -
//- Runtime type information
TypeName("nutkRoughWallFunction");
// Constructors
//- Construct from patch and internal field
nutkRoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutkRoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nutkRoughWallFunctionFvPatchScalarField
// onto a new patch
nutkRoughWallFunctionFvPatchScalarField
(
const nutkRoughWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutkRoughWallFunctionFvPatchScalarField
(
const nutkRoughWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutkRoughWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutkRoughWallFunctionFvPatchScalarField
(
const nutkRoughWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
- 30 -
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new nutkRoughWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Acces functions
// Return Ks
scalarField& Ks()
{
return Ks_;
}
// Return Cs
scalarField& Cs()
{
return Cs_;
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap(const fvPatchFieldMapper&);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap
(
const fvPatchScalarField&,
const labelList&
);
// I-O
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
- 31 -
5. NutURoughWallFunction
5.1 nutURoughWallFunctionFvPatchScalarField.C
/*---------------------------------------------------------------------------*\
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "nutURoughWallFunctionFvPatchScalarField.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcNut() const
{
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchi];
- 32 -
// The flow velocity at the adjacent cell centre
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus();
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
forAll(yPlus, facei)
{
if (yPlus[facei] > yPlusLam_)
{
const scalar Re = magUp[facei]*y[facei]/nuw[facei] + ROOTVSMALL;
nutw[facei] = nuw[facei]*(sqr(yPlus[facei])/Re - 1);
}
}
return tnutw;
}
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::calcYPlus
(
const scalarField& magUp
) const
{
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchi];
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus();
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(yPlus, facei)
{
const scalar magUpara = magUp[facei];
- 33 -
const scalar Re = magUpara*y[facei]/nuw[facei];
const scalar kappaRe = kappa_*Re;
scalar yp = yPlusLam_;
const scalar ryPlusLam = 1.0/yp;
int iter = 0;
scalar yPlusLast = 0.0;
scalar dKsPlusdYPlus = roughnessHeight_/y[facei];
// Additional tuning parameter - nominally = 1
dKsPlusdYPlus *= roughnessFactor_;
do
{
yPlusLast = yp;
// The non-dimensional roughness height
scalar KsPlus = yp*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_*yp) - G - yPlusGPrime;
if (mag(denom) > VSMALL)
{
yp = (kappaRe + yp*(1 - yPlusGPrime))/denom;
}
} while
(
mag(ryPlusLam*(yp - yPlusLast)) > 0.0001
&& ++iter < 10
&& yp > VSMALL
);
yPlus[facei] = max(0.0, yp);
- 34 -
}
}
}
else
{
// Smooth Walls
forAll(yPlus, facei)
{
const scalar magUpara = magUp[facei];
const scalar Re = magUpara*y[facei]/nuw[facei];
const scalar kappaRe = kappa_*Re;
scalar yp = yPlusLam_;
const scalar ryPlusLam = 1.0/yp;
int iter = 0;
scalar yPlusLast = 0.0;
do
{
yPlusLast = yp;
yp = (kappaRe + yp)/(1.0 + log(E_*yp));
} while (mag(ryPlusLam*(yp - yPlusLast)) > 0.0001 && ++iter < 10);
yPlus[facei] = max(0.0, yp);
}
}
return tyPlus;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(p, iF),
roughnessHeight_(pTraits<scalar>::zero),
roughnessConstant_(pTraits<scalar>::zero),
roughnessFactor_(pTraits<scalar>::zero)
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
- 35 -
:
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
roughnessHeight_(ptf.roughnessHeight_),
roughnessConstant_(ptf.roughnessConstant_),
roughnessFactor_(ptf.roughnessFactor_)
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict),
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
roughnessFactor_(readScalar(dict.lookup("roughnessFactor")))
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField& rwfpsf
)
:
nutWallFunctionFvPatchScalarField(rwfpsf),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_)
{}
nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(rwfpsf, iF),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutURoughWallFunctionFvPatchScalarField::yPlus() const
{
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
- 36 -
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
tmp<scalarField> magUp = mag(Uw.patchInternalField() - Uw);
return calcYPlus(magUp());
}
void nutURoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
os.writeKeyword("roughnessHeight")
<< roughnessHeight_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessConstant")
<< roughnessConstant_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessFactor")
<< roughnessFactor_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutURoughWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //
- 37 -
5.2 NutURoughWallFunctionFvPatchScalarField.H
/*---------------------------------------------------------------------------*\
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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/>.
Class
Foam::incompressible::nutURoughWallFunctionFvPatchScalarField
Group
grpIcoWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions for rough walls, based on velocity.
\heading Patch usage
\table
Property | Description
| Required | Default value
roughnessHeight | roughness height | yes
|
roughnessConstant | roughness constanr | yes
|
roughnessFactor | scaling factor
| yes
|
\endtable
Example of the boundary condition specification:
\verbatim
myPatch
{
type
nutURoughWallFunction;
roughnessHeight 1e-5;
roughnessConstant 0.5;
roughnessFactor 1;
}
\endverbatim
- 38 -
SeeAlso
Foam::nutWallFunctionFvPatchScalarField
SourceFiles
nutURoughWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutURoughWallFunctionFvPatchScalarField_H
#define nutURoughWallFunctionFvPatchScalarField_H
#include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
/*---------------------------------------------------------------------------*\
Class nutURoughWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutURoughWallFunctionFvPatchScalarField
:
public nutWallFunctionFvPatchScalarField
{
// Private data
// Roughness model parameters
//- Height
scalar roughnessHeight_;
//- Constant
scalar roughnessConstant_;
//- Scale factor
scalar roughnessFactor_;
// Protected Member Functions
//- Calculate yPLus
virtual tmp<scalarField> calcYPlus(const scalarField& magUp) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
public:
//- Runtime type information
TypeName("nutURoughWallFunction");
- 39 -
// Constructors
//- Construct from patch and internal field
nutURoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutURoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nutURoughWallFunctionFvPatchScalarField
// onto a new patch
nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutURoughWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutURoughWallFunctionFvPatchScalarField
(
const nutURoughWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
- 40 -
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new nutURoughWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Access
//- Return the roughness height
scalar roughnessHeight() const
{
return roughnessHeight_;
}
//- Return reference to the roughness height to allow adjustment
scalar& roughnessHeight()
{
return roughnessHeight_;
}
//- Return the roughness constant scale
scalar roughnessConstant() const
{
return roughnessConstant_;
}
//- Return reference to the roughness constant to allow adjustment
scalar& roughnessConstant()
{
return roughnessConstant_;
}
//- Return the roughness scale factor
scalar roughnessFactor() const
{
return roughnessFactor_;
}
//- Return reference to the roughness scale factor to allow
// adjustment
scalar& roughnessFactor()
{
return roughnessFactor_;
}
// I-O
- 41 -
// Evaluation functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
// I-O
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
- 42 -
6. NutModifiedURoughWallFunction
6.1 nutModifiedURoughWallFunctionFvPatchScalarField.C
/*---------------------------------------------------------------------------*\
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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 "nutModifiedURoughWallFunctionFvPatchScalarField.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutModifiedURoughWallFunctionFvPatchScalarField::calcNut() const
{
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchi];
- 43 -
// The flow velocity at the adjacent cell centre
const scalarField magUp(mag(Uw.patchInternalField() - Uw));
tmp<scalarField> tyPlus = calcYPlus(magUp);
scalarField& yPlus = tyPlus();
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
forAll(yPlus, facei)
{
if (yPlus[facei] > yPlusLam_)
{
const scalar uStar = yPlus[facei] * nuw[facei] / y[facei];
{
Info<< "uStar = " << uStar
<< "yPlus = " << yPlus[facei]
<< nl << endl;
}
nutw[facei] = max(0.0, kappa_ * uStar * y[facei] - nuw[facei]);
Info<< ", nutw = " << nutw[facei]
<< nl << endl;
}
}
return tnutw;
}
tmp<scalarField> nutModifiedURoughWallFunctionFvPatchScalarField::calcYPlus
(
const scalarField& magUp
) const
{
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const scalarField& y = turbModel.y()[patchi];
const tmp<volScalarField> tnu = turbModel.nu();
const volScalarField& nu = tnu();
const scalarField& nuw = nu.boundaryField()[patchi];
tmp<scalarField> tyPlus(new scalarField(patch().size(), 0.0));
scalarField& yPlus = tyPlus();
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);
- 44 -
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(yPlus, facei)
{
const scalar magUpara = magUp[facei];
const scalar Re = magUpara*y[facei]/nuw[facei];
const scalar kappaRe = kappa_*Re;
scalar yp = 20;
const scalar ryPlusLam = 1.0/yp;
int iter = 0;
scalar yPlusLast = 0.0;
scalar dKsPlusdYPlus = roughnessHeight_/y[facei];
// Additional tuning pcnessFactor_;
do
{
yPlusLast = yp;
// The non-dimensional roughness height
scalar KsPlus = yp*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.5)
{
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_*yp) - G - yPlusGPrime;
if (mag(denom) > VSMALL)
{
yp = (kappaRe + yp*(1 - yPlusGPrime))/denom;
- 45 -
}
} while
(
mag(ryPlusLam*(yp - yPlusLast)) > 0.0001
&& ++iter < 10
&& yp > VSMALL
);
yPlus[facei] = max(0.0, yp);
}
}
}
else
{
// Smooth Walls
forAll(yPlus, facei)
{
const scalar magUpara = magUp[facei];
const scalar Re = magUpara*y[facei]/nuw[facei];
const scalar kappaRe = kappa_*Re;
scalar yp = yPlusLam_;
const scalar ryPlusLam = 1.0/yp;
int iter = 0;
scalar yPlusLast = 0.0;
do
{
yPlusLast = yp;
yp = (kappaRe + yp)/(1.0 + log(E_*yp));
} while (mag(ryPlusLam*(yp - yPlusLast)) > 0.0001 && ++iter < 10);
yPlus[facei] = max(0.0, yp);
}
}
return tyPlus;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutModifiedURoughWallFunctionFvPatchScalarField::nutModifiedURoughWallFunctionFvPat
chScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
nutWallFunctionFvPatchScalarField(p, iF),
- 46 -
roughnessHeight_(pTraits<scalar>::zero),
roughnessConstant_(pTraits<scalar>::zero),
roughnessFactor_(pTraits<scalar>::zero)
{}
nutModifiedURoughWallFunctionFvPatchScalarField::nutModifiedURoughWallFunctionFvPat
chScalarField
(
const nutModifiedURoughWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
nutWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
roughnessHeight_(ptf.roughnessHeight_),
roughnessConstant_(ptf.roughnessConstant_),
roughnessFactor_(ptf.roughnessFactor_)
{}
nutModifiedURoughWallFunctionFvPatchScalarField::nutModifiedURoughWallFunctionFvPat
chScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
nutWallFunctionFvPatchScalarField(p, iF, dict),
roughnessHeight_(readScalar(dict.lookup("roughnessHeight"))),
roughnessConstant_(readScalar(dict.lookup("roughnessConstant"))),
roughnessFactor_(readScalar(dict.lookup("roughnessFactor")))
{}
nutModifiedURoughWallFunctionFvPatchScalarField::nutModifiedURoughWallFunctionFvPat
chScalarField
(
const nutModifiedURoughWallFunctionFvPatchScalarField& rwfpsf
)
:
nutWallFunctionFvPatchScalarField(rwfpsf),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_)
{}
nutModifiedURoughWallFunctionFvPatchScalarField::nutModifiedURoughWallFunctionFvPat
chScalarField
(
const nutModifiedURoughWallFunctionFvPatchScalarField& rwfpsf,
const DimensionedField<scalar, volMesh>& iF
- 47 -
)
:
nutWallFunctionFvPatchScalarField(rwfpsf, iF),
roughnessHeight_(rwfpsf.roughnessHeight_),
roughnessConstant_(rwfpsf.roughnessConstant_),
roughnessFactor_(rwfpsf.roughnessFactor_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> nutModifiedURoughWallFunctionFvPatchScalarField::yPlus() const
{
const label patchi = patch().index();
const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel>("turbulenceModel");
const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi];
tmp<scalarField> magUp = mag(Uw.patchInternalField() - Uw);
return calcYPlus(magUp());
}
void nutModifiedURoughWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
os.writeKeyword("roughnessHeight")
<< roughnessHeight_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessConstant")
<< roughnessConstant_ << token::END_STATEMENT << nl;
os.writeKeyword("roughnessFactor")
<< roughnessFactor_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
nutModifiedURoughWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //
- 48 -
6.2 nutModifiedURoughWallFunctionFvPatchScalarField.H
/*---------------------------------------------------------------------------*\
=========
|
\\ / F ield
| OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd
| Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ 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/>.
Class
Foam::incompressible::nutURoughWallFunctionFvPatchScalarField
Group
grpIcoWallFunctions
Description
This boundary condition provides a turbulent kinematic viscosity condition
when using wall functions for rough walls, based on velocity.
\heading Patch usage
\table
Property | Description
| Required | Default value
roughnessHeight | roughness height | yes
|
roughnessConstant | roughness constanr | yes
|
roughnessFactor | scaling factor
| yes
|
\endtable
Example of the boundary condition specification:
\verbatim
myPatch
{
type
nutURoughWallFunction;
roughnessHeight 1e-5;
roughnessConstant 0.5;
roughnessFactor 1;
}
\endverbatim
- 49 -
SeeAlso
Foam::nutWallFunctionFvPatchScalarField
SourceFiles
nutURoughWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutModifiedURoughWallFunctionFvPatchScalarField_H
#define nutModifiedURoughWallFunctionFvPatchScalarField_H
#include "nutWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
/*---------------------------------------------------------------------------*\
Class nutURoughWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutModifiedURoughWallFunctionFvPatchScalarField
:
public nutWallFunctionFvPatchScalarField
{
// Private data
// Roughness model parameters
//- Height
scalar roughnessHeight_;
//- Constant
scalar roughnessConstant_;
//- Scale factor
scalar roughnessFactor_;
// Protected Member Functions
//- Calculate yPLus
virtual tmp<scalarField> calcYPlus(const scalarField& magUp) const;
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
public:
//- Runtime type information
TypeName("nutModifiedURoughWallFunction");
- 50 -
// Constructors
//- Construct from patch and internal field
nutModifiedURoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutModifiedURoughWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nutURoughWallFunctionFvPatchScalarField
// onto a new patch
nutModifiedURoughWallFunctionFvPatchScalarField
(
const nutModifiedURoughWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutModifiedURoughWallFunctionFvPatchScalarField
(
const nutModifiedURoughWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutModifiedURoughWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutModifiedURoughWallFunctionFvPatchScalarField
(
const nutModifiedURoughWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
- 51 -
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new nutModifiedURoughWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Access
//- Return the roughness height
scalar roughnessHeight() const
{
return roughnessHeight_;
}
//- Return reference to the roughness height to allow adjustment
scalar& roughnessHeight()
{
return roughnessHeight_;
}
//- Return the roughness constant scale
scalar roughnessConstant() const
{
return roughnessConstant_;
}
//- Return reference to the roughness constant to allow adjustment
scalar& roughnessConstant()
{
return roughnessConstant_;
}
//- Return the roughness scale factor
scalar roughnessFactor() const
{
return roughnessFactor_;
}
//- Return reference to the roughness scale factor to allow
// adjustment
scalar& roughnessFactor()
{
return roughnessFactor_;
}
// I-O
- 52 -
// Evaluation functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
// I-O
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
- 53 -
© Copyright 2026 Paperzz