diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C
new file mode 100644
index 0000000000..d896d4d08b
--- /dev/null
+++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C
@@ -0,0 +1,246 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 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 .
+
+\*---------------------------------------------------------------------------*/
+
+#include "v2WallFunctionFvPatchScalarField.H"
+#include "RASModel.H"
+#include "fvPatchFieldMapper.H"
+#include "volFields.H"
+#include "addToRunTimeSelectionTable.H"
+#include "wallFvPatch.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace incompressible
+{
+namespace RASModels
+{
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+void v2WallFunctionFvPatchScalarField::checkType()
+{
+ if (!isA(patch()))
+ {
+ FatalErrorIn("v2WallFunctionFvPatchScalarField::checkType()")
+ << "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);
+ }
+}
+
+
+scalar v2WallFunctionFvPatchScalarField::yPlusLam
+(
+ const scalar kappa,
+ const scalar E
+)
+{
+ scalar ypl = 11.0;
+
+ for (int i=0; i<10; i++)
+ {
+ ypl = log(max(E*ypl, 1))/kappa;
+ }
+
+ return ypl;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ fixedValueFvPatchField(p, iF),
+ Cmu_(0.09),
+ kappa_(0.41),
+ E_(9.8),
+ yPlusLam_(yPlusLam(kappa_, E_))
+{
+ checkType();
+}
+
+
+v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
+(
+ const v2WallFunctionFvPatchScalarField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ fixedValueFvPatchField(ptf, p, iF, mapper),
+ Cmu_(ptf.Cmu_),
+ kappa_(ptf.kappa_),
+ E_(ptf.E_),
+ yPlusLam_(ptf.yPlusLam_)
+{
+ checkType();
+}
+
+
+v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ fixedValueFvPatchField(p, iF, dict),
+ Cmu_(dict.lookupOrDefault("Cmu", 0.09)),
+ kappa_(dict.lookupOrDefault("kappa", 0.41)),
+ E_(dict.lookupOrDefault("E", 9.8)),
+ yPlusLam_(yPlusLam(kappa_, E_))
+{
+ checkType();
+}
+
+
+v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
+(
+ const v2WallFunctionFvPatchScalarField& v2wfpsf
+)
+:
+ fixedValueFvPatchField(v2wfpsf),
+ Cmu_(v2wfpsf.Cmu_),
+ kappa_(v2wfpsf.kappa_),
+ E_(v2wfpsf.E_),
+ yPlusLam_(v2wfpsf.yPlusLam_)
+{
+ checkType();
+}
+
+
+v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField
+(
+ const v2WallFunctionFvPatchScalarField& v2wfpsf,
+ const DimensionedField& iF
+)
+:
+ fixedValueFvPatchField(v2wfpsf, iF),
+ Cmu_(v2wfpsf.Cmu_),
+ kappa_(v2wfpsf.kappa_),
+ E_(v2wfpsf.E_),
+ yPlusLam_(v2wfpsf.yPlusLam_)
+{
+ checkType();
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void v2WallFunctionFvPatchScalarField::updateCoeffs()
+{
+ if (updated())
+ {
+ return;
+ }
+
+ const label patchI = patch().index();
+
+ const RASModel& rasModel = db().lookupObject("RASProperties");
+ const scalarField& y = rasModel.y()[patchI];
+
+ const tmp tk = rasModel.k();
+ const volScalarField& k = tk();
+
+ const tmp tnu = rasModel.nu();
+ const scalarField& nuw = tnu().boundaryField()[patchI];
+
+ const scalar Cmu25 = pow025(Cmu_);
+
+ scalarField& v2 = *this;
+
+ // Set v2 wall values
+ forAll(v2, faceI)
+ {
+ label faceCellI = patch().faceCells()[faceI];
+
+ scalar uTau = Cmu25*sqrt(k[faceCellI]);
+
+ scalar yPlus = uTau*y[faceI]/nuw[faceI];
+
+ if (yPlus > yPlusLam_)
+ {
+ scalar Cv2 = 0.193;
+ scalar Bv2 = -0.94;
+ v2[faceI] = Cv2/kappa_*log(yPlus) + Bv2;
+ }
+ else
+ {
+ scalar Cv2 = 0.193;
+ v2[faceI] = Cv2*pow4(yPlus);
+ }
+
+ v2[faceI] *= sqr(uTau);
+ }
+
+ fixedValueFvPatchField::updateCoeffs();
+
+ // TODO: perform averaging for cells sharing more than one boundary face
+}
+
+
+void v2WallFunctionFvPatchScalarField::evaluate
+(
+ const Pstream::commsTypes commsType
+)
+{
+ fixedValueFvPatchField::evaluate(commsType);
+}
+
+
+void v2WallFunctionFvPatchScalarField::write(Ostream& os) const
+{
+ fixedValueFvPatchField::write(os);
+ os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
+ os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
+ os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
+ writeEntry("value", os);
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+makePatchTypeField
+(
+ fvPatchScalarField,
+ v2WallFunctionFvPatchScalarField
+);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace RASModels
+} // End namespace incompressible
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H
new file mode 100644
index 0000000000..68bb2daaa0
--- /dev/null
+++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H
@@ -0,0 +1,208 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 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 .
+
+Class
+ Foam::incompressible::RASModels::v2WallFunctionFvPatchScalarField
+
+Group
+ grpIcoWallFunctions
+
+Description
+ This boundary condition provides a turbulence stress normal to streamlines
+ wall function condition for low- and high-Reynolds number, turbulent flow
+ cases.
+
+ The model operates in two modes, based on the computed laminar-to-turbulent
+ switch-over y+ value derived from kappa and E.
+
+
+ \heading Patch usage
+
+ \table
+ Property | Description | Required | Default value
+ Cmu | model coefficient | no | 0.09
+ kappa | Von Karman constant | no | 0.41
+ E | model coefficient | no | 9.8
+ \endtable
+
+ Example of the boundary condition specification:
+ \verbatim
+ myPatch
+ {
+ type v2WallFunction;
+ }
+ \endverbatim
+
+SeeAlso
+ Foam::fixedValueFvPatchField
+
+SourceFiles
+ v2WallFunctionFvPatchScalarField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef v2WallFunctionFvPatchScalarField_H
+#define v2WallFunctionFvPatchScalarField_H
+
+#include "fixedValueFvPatchField.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace incompressible
+{
+namespace RASModels
+{
+
+/*---------------------------------------------------------------------------*\
+ Class v2WallFunctionFvPatchScalarField Declaration
+\*---------------------------------------------------------------------------*/
+
+class v2WallFunctionFvPatchScalarField
+:
+ public fixedValueFvPatchField
+{
+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 Y+ at the edge of the laminar sublayer
+ scalar yPlusLam(const scalar kappa, const scalar E);
+
+
+public:
+
+ //- Runtime type information
+ TypeName("v2WallFunction");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ v2WallFunctionFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ v2WallFunctionFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given v2WallFunctionFvPatchScalarField
+ // onto a new patch
+ v2WallFunctionFvPatchScalarField
+ (
+ const v2WallFunctionFvPatchScalarField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Construct as copy
+ v2WallFunctionFvPatchScalarField
+ (
+ const v2WallFunctionFvPatchScalarField&
+ );
+
+ //- Construct and return a clone
+ virtual tmp clone() const
+ {
+ return tmp
+ (
+ new v2WallFunctionFvPatchScalarField(*this)
+ );
+ }
+
+ //- Construct as copy setting internal field reference
+ v2WallFunctionFvPatchScalarField
+ (
+ const v2WallFunctionFvPatchScalarField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp
+ (
+ new v2WallFunctionFvPatchScalarField(*this, iF)
+ );
+ }
+
+
+ // Member functions
+
+ // Evaluation functions
+
+ //- Update the coefficients associated with the patch field
+ virtual void updateCoeffs();
+
+ //- Evaluate the patchField
+ virtual void evaluate(const Pstream::commsTypes);
+
+
+ // I-O
+
+ //- Write
+ virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace RASModels
+} // End namespace incompressible
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //