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 =
this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField
(
phiName_,
reinterpret_cast<const surfaceScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);
fvsPatchField<scalar> phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
phiName_
);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchScalarField& rhop = this->patch().lookupPatchField
(
rhoName_,
reinterpret_cast<const volScalarField*>(0),
reinterpret_cast<const scalar*>(0)
);
const fvPatchScalarField& rhop =
this->patch().template lookupPatchField<volScalarField, scalar>
(
rhoName_
);
return phip/(rhop*this->patch().magSf());
}

View File

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

View File

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

View File

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

View File

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

View File

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