changed scalar kWallFunction to templated kQRWallFunction

This commit is contained in:
andy
2008-08-29 15:56:49 +01:00
parent f220dfc200
commit 4225041831
4 changed files with 180 additions and 66 deletions

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "kWallFunctionFvPatchScalarField.H"
#include "kQRWallFunctionFvPatchField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
@ -42,15 +42,16 @@ namespace RASModels
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void kWallFunctionFvPatchScalarField::checkType()
template<class Type>
void kQRWallFunctionFvPatchField<Type>::checkType()
{
if (!isA<wallFvPatch>(patch()))
if (!isA<wallFvPatch>(this->patch()))
{
FatalErrorIn("kWallFunctionFvPatchScalarField::checkType()")
FatalErrorIn("kQRWallFunctionFvPatchField::checkType()")
<< "Invalid wall function specification" << nl
<< " Patch type for patch " << patch().name()
<< " Patch type for patch " << this->patch().name()
<< " must be wall" << nl
<< " Current patch type is " << patch().type() << nl << endl
<< " Current patch type is " << this->patch().type() << nl << endl
<< abort(FatalError);
}
}
@ -58,63 +59,68 @@ void kWallFunctionFvPatchScalarField::checkType()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
template<class Type>
kQRWallFunctionFvPatchField<Type>::kQRWallFunctionFvPatchField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
const DimensionedField<Type, volMesh>& iF
)
:
zeroGradientFvPatchScalarField(p, iF)
zeroGradientFvPatchField<Type>(p, iF)
{
checkType();
}
kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
template<class Type>
kQRWallFunctionFvPatchField<Type>::kQRWallFunctionFvPatchField
(
const kWallFunctionFvPatchScalarField& ptf,
const kQRWallFunctionFvPatchField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
zeroGradientFvPatchScalarField(ptf, p, iF, mapper)
zeroGradientFvPatchField<Type>(ptf, p, iF, mapper)
{
checkType();
}
kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
template<class Type>
kQRWallFunctionFvPatchField<Type>::kQRWallFunctionFvPatchField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
zeroGradientFvPatchScalarField(p, iF, dict)
zeroGradientFvPatchField<Type>(p, iF, dict)
{
checkType();
}
kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
template<class Type>
kQRWallFunctionFvPatchField<Type>::kQRWallFunctionFvPatchField
(
const kWallFunctionFvPatchScalarField& tppsf
const kQRWallFunctionFvPatchField& tkqrwfpf
)
:
zeroGradientFvPatchScalarField(tppsf)
zeroGradientFvPatchField<Type>(tkqrwfpf)
{
checkType();
}
kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
template<class Type>
kQRWallFunctionFvPatchField<Type>::kQRWallFunctionFvPatchField
(
const kWallFunctionFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
const kQRWallFunctionFvPatchField& tkqrwfpf,
const DimensionedField<Type, volMesh>& iF
)
:
zeroGradientFvPatchScalarField(tppsf, iF)
zeroGradientFvPatchField<Type>(tkqrwfpf, iF)
{
checkType();
}
@ -122,30 +128,24 @@ kWallFunctionFvPatchScalarField::kWallFunctionFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void kWallFunctionFvPatchScalarField::evaluate
template<class Type>
void kQRWallFunctionFvPatchField<Type>::evaluate
(
const Pstream::commsTypes commsType
)
{
zeroGradientFvPatchScalarField::evaluate(commsType);
zeroGradientFvPatchField<Type>::evaluate(commsType);
}
void kWallFunctionFvPatchScalarField::write(Ostream& os) const
template<class Type>
void kQRWallFunctionFvPatchField<Type>::write(Ostream& os) const
{
zeroGradientFvPatchScalarField::write(os);
writeEntry("value", os);
zeroGradientFvPatchField<Type>::write(os);
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
kWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels

View File

@ -23,21 +23,21 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::kWallFunctionFvPatchScalarField
Foam::kQRWallFunctionFvPatchField
Description
Boundary condition for turbulence kinetic energy when using wall functions.
Boundary condition for turbulence k, Q, and R when using wall functions.
Simply acts as a zero gradient condition.
SourceFiles
kWallFunctionFvPatchScalarField.C
kQRWallFunctionFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef kWallFunctionFvPatchScalarField_H
#define kWallFunctionFvPatchScalarField_H
#ifndef kQRWallFunctionFvPatchField_H
#define kQRWallFunctionFvPatchField_H
#include "zeroGradientFvPatchFields.H"
#include "zeroGradientFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,12 +49,13 @@ namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class kWallFunctionFvPatchScalarField Declaration
Class kQRWallFunctionFvPatchField Declaration
\*---------------------------------------------------------------------------*/
class kWallFunctionFvPatchScalarField
template<class Type>
class kQRWallFunctionFvPatchField
:
public zeroGradientFvPatchScalarField
public zeroGradientFvPatchField<Type>
{
// Private member functions
@ -66,68 +67,68 @@ class kWallFunctionFvPatchScalarField
public:
//- Runtime type information
TypeName("kWallFunction");
TypeName("kQRWallFunction");
// Constructors
//- Construct from patch and internal field
kWallFunctionFvPatchScalarField
kQRWallFunctionFvPatchField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
kWallFunctionFvPatchScalarField
kQRWallFunctionFvPatchField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// kWallFunctionFvPatchScalarField
// kQRWallFunctionFvPatchField
// onto a new patch
kWallFunctionFvPatchScalarField
kQRWallFunctionFvPatchField
(
const kWallFunctionFvPatchScalarField&,
const kQRWallFunctionFvPatchField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
kWallFunctionFvPatchScalarField
kQRWallFunctionFvPatchField
(
const kWallFunctionFvPatchScalarField&
const kQRWallFunctionFvPatchField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchScalarField>
return tmp<fvPatchField<Type> >
(
new kWallFunctionFvPatchScalarField(*this)
new kQRWallFunctionFvPatchField(*this)
);
}
//- Construct as copy setting internal field reference
kWallFunctionFvPatchScalarField
kQRWallFunctionFvPatchField
(
const kWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
const kQRWallFunctionFvPatchField&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<scalar, volMesh>& iF
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
return tmp<fvPatchField<Type> >
(
new kWallFunctionFvPatchScalarField(*this, iF)
new kQRWallFunctionFvPatchField(*this, iF)
);
}
@ -158,6 +159,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "kQRWallFunctionFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "kQRWallFunctionFvPatchFields.H"
#include "fvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(kQRWallFunction);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,56 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
\*---------------------------------------------------------------------------*/
#ifndef kQRWallFunctionFvPatchFields_H
#define kQRWallFunctionFvPatchFields_H
#include "kQRWallFunctionFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(kQRWallFunction)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //