Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2010-12-15 15:38:19 +00:00
8 changed files with 83 additions and 351 deletions

View File

@ -163,21 +163,19 @@ tmp<scalarField> advectiveFvPatchField<Type>::advectionSpeed() const
const surfaceScalarField& phi = const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_); this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField fvsPatchField<scalar> phip =
( this->patch().template lookupPatchField<surfaceScalarField, scalar>
phiName_, (
reinterpret_cast<const surfaceScalarField*>(0), phiName_
reinterpret_cast<const scalar*>(0) );
);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea) if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{ {
const fvPatchScalarField& rhop = this->patch().lookupPatchField const fvPatchScalarField& rhop =
( this->patch().template lookupPatchField<volScalarField, scalar>
rhoName_, (
reinterpret_cast<const volScalarField*>(0), rhoName_
reinterpret_cast<const scalar*>(0) );
);
return phip/(rhop*this->patch().magSf()); return phip/(rhop*this->patch().magSf());
} }

View File

@ -25,15 +25,10 @@ License
#include "inletOutletFvPatchField.H" #include "inletOutletFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
@ -49,7 +44,7 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
template<class Type> template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
( (
const inletOutletFvPatchField<Type>& ptf, const inletOutletFvPatchField<Type>& ptf,
const fvPatch& p, const fvPatch& p,
@ -63,7 +58,7 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
template<class Type> template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
@ -93,7 +88,7 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
template<class Type> template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
( (
const inletOutletFvPatchField<Type>& ptf const inletOutletFvPatchField<Type>& ptf
) )
@ -104,7 +99,7 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
template<class Type> template<class Type>
inletOutletFvPatchField<Type>::inletOutletFvPatchField Foam::inletOutletFvPatchField<Type>::inletOutletFvPatchField
( (
const inletOutletFvPatchField<Type>& ptf, const inletOutletFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
@ -118,19 +113,18 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
void inletOutletFvPatchField<Type>::updateCoeffs() void Foam::inletOutletFvPatchField<Type>::updateCoeffs()
{ {
if (this->updated()) if (this->updated())
{ {
return; return;
} }
const Field<scalar>& phip = this->patch().lookupPatchField const Field<scalar>& phip =
( this->patch().template lookupPatchField<surfaceScalarField, scalar>
phiName_, (
reinterpret_cast<const surfaceScalarField*>(0), phiName_
reinterpret_cast<const scalar*>(0) );
);
this->valueFraction() = 1.0 - pos(phip); this->valueFraction() = 1.0 - pos(phip);
@ -139,7 +133,7 @@ void inletOutletFvPatchField<Type>::updateCoeffs()
template<class Type> template<class Type>
void inletOutletFvPatchField<Type>::write(Ostream& os) const void Foam::inletOutletFvPatchField<Type>::write(Ostream& os) const
{ {
fvPatchField<Type>::write(os); fvPatchField<Type>::write(os);
if (phiName_ != "phi") if (phiName_ != "phi")
@ -154,7 +148,7 @@ void inletOutletFvPatchField<Type>::write(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type> template<class Type>
void inletOutletFvPatchField<Type>::operator= void Foam::inletOutletFvPatchField<Type>::operator=
( (
const fvPatchField<Type>& ptf const fvPatchField<Type>& ptf
) )
@ -167,8 +161,4 @@ void inletOutletFvPatchField<Type>::operator=
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -56,6 +56,7 @@ protected:
// Protected data // Protected data
//- Name of flux field
word phiName_; word phiName_;

View File

@ -25,21 +25,17 @@ License
#include "outletInletFvPatchField.H" #include "outletInletFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
outletInletFvPatchField<Type>::outletInletFvPatchField Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
) )
: :
mixedFvPatchField<Type>(p, iF) mixedFvPatchField<Type>(p, iF),
phiName_("phi")
{ {
this->refValue() = *this; this->refValue() = *this;
this->refGrad() = pTraits<Type>::zero; this->refGrad() = pTraits<Type>::zero;
@ -48,7 +44,7 @@ outletInletFvPatchField<Type>::outletInletFvPatchField
template<class Type> template<class Type>
outletInletFvPatchField<Type>::outletInletFvPatchField Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
( (
const outletInletFvPatchField<Type>& ptf, const outletInletFvPatchField<Type>& ptf,
const fvPatch& p, const fvPatch& p,
@ -56,19 +52,21 @@ outletInletFvPatchField<Type>::outletInletFvPatchField
const fvPatchFieldMapper& mapper const fvPatchFieldMapper& mapper
) )
: :
mixedFvPatchField<Type>(ptf, p, iF, mapper) mixedFvPatchField<Type>(ptf, p, iF, mapper),
phiName_(ptf.phiName_)
{} {}
template<class Type> template<class Type>
outletInletFvPatchField<Type>::outletInletFvPatchField Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
const dictionary& dict const dictionary& dict
) )
: :
mixedFvPatchField<Type>(p, iF) mixedFvPatchField<Type>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{ {
this->refValue() = Field<Type>("outletValue", dict, p.size()); this->refValue() = Field<Type>("outletValue", dict, p.size());
@ -90,42 +88,43 @@ outletInletFvPatchField<Type>::outletInletFvPatchField
template<class Type> template<class Type>
outletInletFvPatchField<Type>::outletInletFvPatchField Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
( (
const outletInletFvPatchField<Type>& ptf const outletInletFvPatchField<Type>& ptf
) )
: :
mixedFvPatchField<Type>(ptf) mixedFvPatchField<Type>(ptf),
phiName_(ptf.phiName_)
{} {}
template<class Type> template<class Type>
outletInletFvPatchField<Type>::outletInletFvPatchField Foam::outletInletFvPatchField<Type>::outletInletFvPatchField
( (
const outletInletFvPatchField<Type>& ptf, const outletInletFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
) )
: :
mixedFvPatchField<Type>(ptf, iF) mixedFvPatchField<Type>(ptf, iF),
phiName_(ptf.phiName_)
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
void outletInletFvPatchField<Type>::updateCoeffs() void Foam::outletInletFvPatchField<Type>::updateCoeffs()
{ {
if (this->updated()) if (this->updated())
{ {
return; return;
} }
const fvsPatchField<scalar>& phip = this->patch().lookupPatchField const fvsPatchField<scalar>& phip =
( this->patch().template lookupPatchField<surfaceScalarField, scalar>
"phi", (
reinterpret_cast<const surfaceScalarField*>(0), phiName_
reinterpret_cast<const scalar*>(0) );
);
this->valueFraction() = pos(phip); this->valueFraction() = pos(phip);
@ -134,16 +133,16 @@ void outletInletFvPatchField<Type>::updateCoeffs()
template<class Type> template<class Type>
void outletInletFvPatchField<Type>::write(Ostream& os) const void Foam::outletInletFvPatchField<Type>::write(Ostream& os) const
{ {
fvPatchField<Type>::write(os); fvPatchField<Type>::write(os);
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
this->refValue().writeEntry("outletValue", os); this->refValue().writeEntry("outletValue", os);
this->writeEntry("value", os); this->writeEntry("value", os);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -52,6 +52,14 @@ class outletInletFvPatchField
public mixedFvPatchField<Type> public mixedFvPatchField<Type>
{ {
protected:
// Protected data
//- Name of flux field
word phiName_;
public: public:
//- Runtime type information //- Runtime type information

View File

@ -31,15 +31,10 @@ License
#include "CrankNicholsonDdtScheme.H" #include "CrankNicholsonDdtScheme.H"
#include "backwardDdtScheme.H" #include "backwardDdtScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
@ -52,7 +47,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
template<class Type> template<class Type>
waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
( (
const waveTransmissiveFvPatchField& ptf, const waveTransmissiveFvPatchField& ptf,
const fvPatch& p, const fvPatch& p,
@ -67,7 +62,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
template<class Type> template<class Type>
waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
( (
const fvPatch& p, const fvPatch& p,
const DimensionedField<Type, volMesh>& iF, const DimensionedField<Type, volMesh>& iF,
@ -81,7 +76,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
template<class Type> template<class Type>
waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
( (
const waveTransmissiveFvPatchField& ptpsf const waveTransmissiveFvPatchField& ptpsf
) )
@ -93,7 +88,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
template<class Type> template<class Type>
waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
( (
const waveTransmissiveFvPatchField& ptpsf, const waveTransmissiveFvPatchField& ptpsf,
const DimensionedField<Type, volMesh>& iF const DimensionedField<Type, volMesh>& iF
@ -108,35 +103,32 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
tmp<scalarField> waveTransmissiveFvPatchField<Type>::advectionSpeed() const Foam::tmp<Foam::scalarField>
Foam::waveTransmissiveFvPatchField<Type>::advectionSpeed() const
{ {
// Lookup the velocity and compressibility of the patch // Lookup the velocity and compressibility of the patch
const fvPatchField<scalar>& psip = this->patch().lookupPatchField const fvPatchField<scalar>& psip =
( this->patch().template lookupPatchField<volScalarField, scalar>
psiName_, (
reinterpret_cast<const volScalarField*>(0), psiName_
reinterpret_cast<const scalar*>(0) );
);
const surfaceScalarField& phi = const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField> this->db().template lookupObject<surfaceScalarField>(this->phiName_);
(this->phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField fvsPatchField<scalar> phip =
( this->patch().template lookupPatchField<surfaceScalarField, scalar>
this->phiName_, (
reinterpret_cast<const surfaceScalarField*>(0), this->phiName_
reinterpret_cast<const scalar*>(0) );
);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea) if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{ {
const fvPatchScalarField& rhop = this->patch().lookupPatchField const fvPatchScalarField& rhop =
( this->patch().template lookupPatchField<volScalarField, scalar>
this->rhoName_, (
reinterpret_cast<const volScalarField*>(0), this->rhoName_
reinterpret_cast<const scalar*>(0) );
);
phip /= rhop; phip /= rhop;
} }
@ -149,7 +141,7 @@ tmp<scalarField> waveTransmissiveFvPatchField<Type>::advectionSpeed() const
template<class Type> template<class Type>
void waveTransmissiveFvPatchField<Type>::write(Ostream& os) const void Foam::waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
{ {
fvPatchField<Type>::write(os); fvPatchField<Type>::write(os);
@ -165,6 +157,7 @@ void waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
{ {
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
} }
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
if (this->lInf_ > SMALL) if (this->lInf_ > SMALL)
@ -179,8 +172,4 @@ void waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,142 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 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 "maxhxhyhzDelta.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(maxhxhyhzDelta, 0);
addToRunTimeSelectionTable(LESdelta, maxhxhyhzDelta, dictionary);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void maxhxhyhzDelta::calcDelta()
{
label nD = mesh().nGeometricD();
tmp<volScalarField> hmax
(
new volScalarField
(
IOobject
(
"hmax",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh(),
dimensionedScalar("zrero", dimLength, 0.0)
)
);
const cellList& cells = mesh().cells();
forAll(cells,cellI)
{
scalar deltaMaxTmp = 0.0;
const labelList& cFaces = mesh().cells()[cellI];
const point& centrevector = mesh().cellCentres()[cellI];
forAll(cFaces, cFaceI)
{
label faceI = cFaces[cFaceI];
const point& facevector = mesh().faceCentres()[faceI];
scalar tmp = mag(facevector - centrevector);
if (tmp > deltaMaxTmp)
{
deltaMaxTmp = tmp;
}
}
hmax()[cellI] = deltaCoeff_*deltaMaxTmp;
}
if (nD == 3)
{
delta_.internalField() = hmax();
}
else if (nD == 2)
{
WarningIn("maxhxhyhzDelta::calcDelta()")
<< "Case is 2D, LES is not strictly applicable\n"
<< endl;
delta_.internalField() = hmax();
}
else
{
FatalErrorIn("maxhxhyhzDelta::calcDelta()")
<< "Case is not 3D or 2D, LES is not applicable"
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
maxhxhyhzDelta::maxhxhyhzDelta
(
const word& name,
const fvMesh& mesh,
const dictionary& dd
)
:
LESdelta(name, mesh),
deltaCoeff_(readScalar(dd.subDict(type() + "Coeffs").lookup("deltaCoeff")))
{
calcDelta();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void maxhxhyhzDelta::read(const dictionary& dd)
{
dd.subDict(type() + "Coeffs").lookup("deltaCoeff") >> deltaCoeff_;
calcDelta();
}
void maxhxhyhzDelta::correct()
{
if (mesh_.changing())
{
calcDelta();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,111 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 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::maxhxhyhzDelta
Description
maxhxhyhzDelta takes the maximum of the three dimensions per cell:
max(hx, hy, hz). Valid for structures hexahedral cells only.
SourceFiles
maxhxhyhzDelta.C
\*---------------------------------------------------------------------------*/
#ifndef maxhxhyhzDeltaDelta_H
#define maxhxhyhzDeltaDelta_H
#include "LESdelta.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class maxhxhyhzDelta Declaration
\*---------------------------------------------------------------------------*/
class maxhxhyhzDelta
:
public LESdelta
{
// Private data
scalar deltaCoeff_; //
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
maxhxhyhzDelta(const maxhxhyhzDelta&);
void operator=(const maxhxhyhzDelta&);
// Calculate the delta values
void calcDelta();
public:
//- Runtime type information
TypeName("maxhxhyhzDelta");
// Constructors
//- Construct from name, mesh and IOdictionary
maxhxhyhzDelta
(
const word& name,
const fvMesh& mesh,
const dictionary&
);
//- Destructor
virtual ~maxhxhyhzDelta()
{}
// Member Functions
//- Read the LESdelta dictionary
virtual void read(const dictionary&);
// Correct values
virtual void correct();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //