Fixing conflict.

This commit is contained in:
graham 2009-09-15 15:24:33 +01:00
commit c1925b36e8
72 changed files with 1110 additions and 424 deletions

View File

@ -68,10 +68,10 @@ int main(int argc, char *argv[])
#include "chemistry.H"
#include "rhoEqn.H"
#include "UEqn.H"
for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
{
#include "UEqn.H"
#include "YEqn.H"
#define Db turbulence->alphaEff()

View File

@ -1,5 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermalPorousZone/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
-I$(LIB_SRC)/finiteVolume/cfdTools \
@ -8,6 +9,7 @@ EXE_INC = \
EXE_LIBS = \
-lbasicThermophysicalModels \
-lthermalPorousZone \
-lspecie \
-lcompressibleRASModels \
-lfiniteVolume \

View File

@ -64,7 +64,7 @@
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
porousZones pZones(mesh);
thermalPorousZones pZones(mesh);
Switch pressureImplicitPorosity(false);
int nUCorr = 0;
@ -84,4 +84,3 @@
pressureImplicitPorosity = true;
}
}

View File

@ -9,6 +9,8 @@
- p*fvc::div(phi/fvc::interpolate(rho))
);
pZones.addEnthalpySource(thermo, rho, hEqn);
hEqn.relax();
eqnResidual = hEqn.solve().initialResidual();

View File

@ -34,7 +34,7 @@ Description
#include "fvCFD.H"
#include "basicPsiThermo.H"
#include "RASModel.H"
#include "porousZones.H"
#include "thermalPorousZones.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -231,6 +231,13 @@ int main(int argc, char *argv[])
if (mode == PATCH || mode == MESH)
{
if (flipNormals)
{
FatalErrorIn(args.executable())
<< "Flipping normals not supported for extrusions from patch."
<< exit(FatalError);
}
fileName sourceCasePath(dict.lookup("sourceCase"));
sourceCasePath.expand();
fileName sourceRootDir = sourceCasePath.path();

View File

@ -167,6 +167,16 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
forAll (oldPatches, patchI)
{
const polyPatch& curPatch = oldPatches[patchI];
if (curPatch.coupled())
{
WarningIn("mirrorFvMesh::mirrorFvMesh(const IOobject&)")
<< "Found coupled patch " << curPatch.name() << endl
<< " Mirroring faces on coupled patches destroys"
<< " the ordering. This might be fixed by running a dummy"
<< " createPatch afterwards." << endl;
}
boolList& curInsBouFace = insertedBouFace[patchI];
curInsBouFace.setSize(curPatch.size());

View File

@ -237,23 +237,28 @@ int main(int argc, char *argv[])
if (writeCellDist)
{
const labelList& procIds = mesh.cellToProc();
// Write the decomposition as labelList for use with 'manual'
// decomposition method.
// FIXME: may attempt to write to a non-existent "region0/"
OFstream os
labelIOList cellDecomposition
(
runTime.path()
/ mesh.facesInstance()
/ regionName
/ "cellDecomposition"
IOobject
(
"cellDecomposition",
mesh.facesInstance(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
procIds
);
os << mesh.cellToProc();
cellDecomposition.write();
Info<< nl << "Wrote decomposition to "
<< os.name() << " for use in manual decomposition."
<< endl;
<< cellDecomposition.objectPath()
<< " for use in manual decomposition." << endl;
// Write as volScalarField for postprocessing.
volScalarField cellDist
@ -271,7 +276,6 @@ int main(int argc, char *argv[])
zeroGradientFvPatchScalarField::typeName
);
const labelList& procIds = mesh.cellToProc();
forAll(procIds, celli)
{
cellDist[celli] = procIds[celli];

View File

@ -191,7 +191,7 @@ void Foam::vtkPV3Foam::convertPointField
pointData->SetNumberOfTuples(nPoints + addPointCellLabels.size());
pointData->SetNumberOfComponents(nComp);
pointData->Allocate(nComp*(nPoints + addPointCellLabels.size()));
pointData->SetName(tf.name().c_str());
pointData->SetName(ptf.name().c_str());
if (debug)
{

View File

@ -110,6 +110,7 @@ Foam::scalar Foam::dimensionSet::operator[](const dimensionType type) const
return exponents_[type];
}
Foam::scalar& Foam::dimensionSet::operator[](const dimensionType type)
{
return exponents_[type];
@ -130,6 +131,7 @@ bool Foam::dimensionSet::operator==(const dimensionSet& ds) const
return equall;
}
bool Foam::dimensionSet::operator!=(const dimensionSet& ds) const
{
return !(operator==(ds));
@ -163,6 +165,7 @@ bool Foam::dimensionSet::operator+=(const dimensionSet& ds) const
return true;
}
bool Foam::dimensionSet::operator-=(const dimensionSet& ds) const
{
if (dimensionSet::debug && *this != ds)
@ -176,6 +179,7 @@ bool Foam::dimensionSet::operator-=(const dimensionSet& ds) const
return true;
}
bool Foam::dimensionSet::operator*=(const dimensionSet& ds)
{
reset((*this)*ds);
@ -183,6 +187,7 @@ bool Foam::dimensionSet::operator*=(const dimensionSet& ds)
return true;
}
bool Foam::dimensionSet::operator/=(const dimensionSet& ds)
{
reset((*this)/ds);
@ -206,6 +211,7 @@ Foam::dimensionSet Foam::max(const dimensionSet& ds1, const dimensionSet& ds2)
return ds1;
}
Foam::dimensionSet Foam::min(const dimensionSet& ds1, const dimensionSet& ds2)
{
if (dimensionSet::debug && ds1 != ds2)
@ -256,6 +262,7 @@ Foam::dimensionSet Foam::pow(const dimensionSet& ds, const scalar p)
return dimPow;
}
Foam::dimensionSet Foam::pow
(
const dimensionSet& ds,
@ -283,6 +290,7 @@ Foam::dimensionSet Foam::pow
return dimPow;
}
Foam::dimensionSet Foam::pow
(
const dimensionedScalar& dS,
@ -309,61 +317,79 @@ Foam::dimensionSet Foam::sqr(const dimensionSet& ds)
return pow(ds, 2);
}
Foam::dimensionSet Foam::pow3(const dimensionSet& ds)
{
return pow(ds, 3);
}
Foam::dimensionSet Foam::pow4(const dimensionSet& ds)
{
return pow(ds, 4);
}
Foam::dimensionSet Foam::pow5(const dimensionSet& ds)
{
return pow(ds, 5);
}
Foam::dimensionSet Foam::pow6(const dimensionSet& ds)
{
return pow(ds, 6);
}
Foam::dimensionSet Foam::pow025(const dimensionSet& ds)
{
return sqrt(sqrt(ds));
}
Foam::dimensionSet Foam::sqrt(const dimensionSet& ds)
{
return pow(ds, 0.5);
}
Foam::dimensionSet Foam::magSqr(const dimensionSet& ds)
{
return pow(ds, 2);
}
Foam::dimensionSet Foam::mag(const dimensionSet& ds)
{
return ds;
}
Foam::dimensionSet Foam::sign(const dimensionSet&)
{
return dimless;
}
Foam::dimensionSet Foam::pos(const dimensionSet&)
{
return dimless;
}
Foam::dimensionSet Foam::neg(const dimensionSet&)
{
return dimless;
}
Foam::dimensionSet Foam::inv(const dimensionSet& ds)
{
return dimless/ds;
}
Foam::dimensionSet Foam::trans(const dimensionSet& ds)
{
if (dimensionSet::debug && !ds.dimensionless())
@ -376,6 +402,7 @@ Foam::dimensionSet Foam::trans(const dimensionSet& ds)
return ds;
}
Foam::dimensionSet Foam::transform(const dimensionSet& ds)
{
return ds;
@ -389,6 +416,7 @@ Foam::dimensionSet Foam::operator-(const dimensionSet& ds)
return ds;
}
Foam::dimensionSet Foam::operator+
(
const dimensionSet& ds1,
@ -409,6 +437,7 @@ Foam::dimensionSet Foam::operator+
return dimSum;
}
Foam::dimensionSet Foam::operator-
(
const dimensionSet& ds1,
@ -429,6 +458,7 @@ Foam::dimensionSet Foam::operator-
return dimDifference;
}
Foam::dimensionSet Foam::operator*
(
const dimensionSet& ds1,
@ -445,6 +475,7 @@ Foam::dimensionSet Foam::operator*
return dimProduct;
}
Foam::dimensionSet Foam::operator/
(
const dimensionSet& ds1,
@ -471,6 +502,7 @@ Foam::dimensionSet Foam::operator&
return ds1*ds2;
}
Foam::dimensionSet Foam::operator^
(
const dimensionSet& ds1,
@ -480,6 +512,7 @@ Foam::dimensionSet Foam::operator^
return ds1*ds2;
}
Foam::dimensionSet Foam::operator&&
(
const dimensionSet& ds1,

View File

@ -70,6 +70,7 @@ dimensionSet pow3(const dimensionSet&);
dimensionSet pow4(const dimensionSet&);
dimensionSet pow5(const dimensionSet&);
dimensionSet pow6(const dimensionSet&);
dimensionSet pow025(const dimensionSet&);
dimensionSet sqrt(const dimensionSet&);
dimensionSet magSqr(const dimensionSet&);
@ -226,6 +227,7 @@ public:
friend dimensionSet pow4(const dimensionSet&);
friend dimensionSet pow5(const dimensionSet&);
friend dimensionSet pow6(const dimensionSet&);
friend dimensionSet pow025(const dimensionSet&);
friend dimensionSet sqrt(const dimensionSet&);
friend dimensionSet magSqr(const dimensionSet&);

View File

@ -38,32 +38,38 @@ dimensionedScalar operator+(const dimensionedScalar& ds1, const scalar s2)
return ds1 + dimensionedScalar(s2);
}
dimensionedScalar operator+(const scalar s1, const dimensionedScalar& ds2)
{
return dimensionedScalar(s1) + ds2;
}
dimensionedScalar operator-(const dimensionedScalar& ds1, const scalar s2)
{
return ds1 - dimensionedScalar(s2);
}
dimensionedScalar operator-(const scalar s1, const dimensionedScalar& ds2)
{
return dimensionedScalar(s1) - ds2;
}
dimensionedScalar operator*(const dimensionedScalar& ds1, const scalar s2)
{
return ds1 * dimensionedScalar(s2);
}
dimensionedScalar operator/(const scalar s1, const dimensionedScalar& ds2)
{
return dimensionedScalar(s1)/ds2;
}
dimensionedScalar pow
(
const dimensionedScalar& ds,
@ -78,6 +84,7 @@ dimensionedScalar pow
);
}
dimensionedScalar pow3(const dimensionedScalar& ds)
{
return dimensionedScalar
@ -88,6 +95,7 @@ dimensionedScalar pow3(const dimensionedScalar& ds)
);
}
dimensionedScalar pow4(const dimensionedScalar& ds)
{
return dimensionedScalar
@ -98,6 +106,7 @@ dimensionedScalar pow4(const dimensionedScalar& ds)
);
}
dimensionedScalar pow5(const dimensionedScalar& ds)
{
return dimensionedScalar
@ -108,6 +117,7 @@ dimensionedScalar pow5(const dimensionedScalar& ds)
);
}
dimensionedScalar pow6(const dimensionedScalar& ds)
{
return dimensionedScalar
@ -118,6 +128,18 @@ dimensionedScalar pow6(const dimensionedScalar& ds)
);
}
dimensionedScalar pow025(const dimensionedScalar& ds)
{
return dimensionedScalar
(
"pow025(" + ds.name() + ')',
pow025(ds.dimensions()),
pow025(ds.value())
);
}
dimensionedScalar sqrt(const dimensionedScalar& ds)
{
return dimensionedScalar
@ -128,6 +150,7 @@ dimensionedScalar sqrt(const dimensionedScalar& ds)
);
}
dimensionedScalar cbrt(const dimensionedScalar& ds)
{
return dimensionedScalar
@ -138,6 +161,7 @@ dimensionedScalar cbrt(const dimensionedScalar& ds)
);
}
dimensionedScalar hypot
(
const dimensionedScalar& x,
@ -152,6 +176,7 @@ dimensionedScalar hypot
);
}
dimensionedScalar sign(const dimensionedScalar& ds)
{
return dimensionedScalar
@ -162,6 +187,7 @@ dimensionedScalar sign(const dimensionedScalar& ds)
);
}
dimensionedScalar pos(const dimensionedScalar& ds)
{
return dimensionedScalar
@ -172,6 +198,7 @@ dimensionedScalar pos(const dimensionedScalar& ds)
);
}
dimensionedScalar neg(const dimensionedScalar& ds)
{
return dimensionedScalar

View File

@ -61,6 +61,7 @@ dimensionedScalar pow3(const dimensionedScalar&);
dimensionedScalar pow4(const dimensionedScalar&);
dimensionedScalar pow5(const dimensionedScalar&);
dimensionedScalar pow6(const dimensionedScalar&);
dimensionedScalar pow025(const dimensionedScalar&);
dimensionedScalar sqrt(const dimensionedScalar&);
dimensionedScalar cbrt(const dimensionedScalar&);

View File

@ -376,6 +376,7 @@ UNARY_FUNCTION(scalar, scalar, pow3, pow3)
UNARY_FUNCTION(scalar, scalar, pow4, pow4)
UNARY_FUNCTION(scalar, scalar, pow5, pow5)
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
UNARY_FUNCTION(scalar, scalar, sign, sign)
UNARY_FUNCTION(scalar, scalar, pos, pos)

View File

@ -84,6 +84,7 @@ UNARY_FUNCTION(scalar, scalar, pow3, pow3)
UNARY_FUNCTION(scalar, scalar, pow4, pow4)
UNARY_FUNCTION(scalar, scalar, pow5, pow5)
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
UNARY_FUNCTION(scalar, scalar, sign, sign)
UNARY_FUNCTION(scalar, scalar, pos, pos)

View File

@ -104,6 +104,7 @@ UNARY_FUNCTION(scalar, scalar, pow3)
UNARY_FUNCTION(scalar, scalar, pow4)
UNARY_FUNCTION(scalar, scalar, pow5)
UNARY_FUNCTION(scalar, scalar, pow6)
UNARY_FUNCTION(scalar, scalar, pow025)
UNARY_FUNCTION(scalar, scalar, sqrt)
UNARY_FUNCTION(scalar, scalar, sign)
UNARY_FUNCTION(scalar, scalar, pos)

View File

@ -57,6 +57,7 @@ void stabilise
const scalar s
);
template<template<class> class Field>
tmp<FieldField<Field, scalar> > stabilise
(
@ -64,6 +65,7 @@ tmp<FieldField<Field, scalar> > stabilise
const scalar s
);
template<template<class> class Field>
tmp<FieldField<Field, scalar> > stabilise
(
@ -95,6 +97,7 @@ UNARY_FUNCTION(scalar, scalar, pow3)
UNARY_FUNCTION(scalar, scalar, pow4)
UNARY_FUNCTION(scalar, scalar, pow5)
UNARY_FUNCTION(scalar, scalar, pow6)
UNARY_FUNCTION(scalar, scalar, pow025)
UNARY_FUNCTION(scalar, scalar, sqrt)
UNARY_FUNCTION(scalar, scalar, sign)
UNARY_FUNCTION(scalar, scalar, pos)

View File

@ -109,6 +109,7 @@ UNARY_FUNCTION(scalar, scalar, pow3)
UNARY_FUNCTION(scalar, scalar, pow4)
UNARY_FUNCTION(scalar, scalar, pow5)
UNARY_FUNCTION(scalar, scalar, pow6)
UNARY_FUNCTION(scalar, scalar, pow025)
UNARY_FUNCTION(scalar, scalar, sqrt)
UNARY_FUNCTION(scalar, scalar, sign)
UNARY_FUNCTION(scalar, scalar, pos)

View File

@ -96,6 +96,7 @@ UNARY_FUNCTION(scalar, scalar, pow3)
UNARY_FUNCTION(scalar, scalar, pow4)
UNARY_FUNCTION(scalar, scalar, pow5)
UNARY_FUNCTION(scalar, scalar, pow6)
UNARY_FUNCTION(scalar, scalar, pow025)
UNARY_FUNCTION(scalar, scalar, sqrt)
UNARY_FUNCTION(scalar, scalar, sign)
UNARY_FUNCTION(scalar, scalar, pos)

View File

@ -447,6 +447,7 @@ UNARY_FUNCTION(scalar, scalar, pow3, pow3)
UNARY_FUNCTION(scalar, scalar, pow4, pow4)
UNARY_FUNCTION(scalar, scalar, pow5, pow5)
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
UNARY_FUNCTION(scalar, scalar, sign, sign)
UNARY_FUNCTION(scalar, scalar, pos, pos)

View File

@ -92,6 +92,7 @@ UNARY_FUNCTION(scalar, scalar, pow3, pow3)
UNARY_FUNCTION(scalar, scalar, pow4, pow4)
UNARY_FUNCTION(scalar, scalar, pow5, pow5)
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
UNARY_FUNCTION(scalar, scalar, sign, sign)
UNARY_FUNCTION(scalar, scalar, pos, pos)

View File

@ -90,56 +90,67 @@ inline Scalar& setComponent(Scalar& s, const direction)
return s;
}
inline Scalar component(const Scalar s, const direction)
{
return s;
}
inline Scalar sign(const Scalar s)
{
return (s >= 0)? 1: -1;
}
inline Scalar pos(const Scalar s)
{
return (s >= 0)? 1: 0;
}
inline Scalar neg(const Scalar s)
{
return (s < 0)? 1: 0;
}
inline bool equal(const Scalar& s1, const Scalar& s2)
{
return mag(s1 - s2) <= ScalarVSMALL;
}
inline bool notEqual(const Scalar s1, const Scalar s2)
{
return mag(s1 - s2) > ScalarVSMALL;
}
inline Scalar limit(const Scalar s1, const Scalar s2)
{
return (mag(s1) < mag(s2)) ? s1: 0.0;
}
inline Scalar minMod(const Scalar s1, const Scalar s2)
{
return (mag(s1) < mag(s2)) ? s1: s2;
}
inline Scalar magSqr(const Scalar s)
{
return s*s;
}
inline Scalar sqr(const Scalar s)
{
return s*s;
}
inline Scalar sqrtSumSqr(const Scalar a, const Scalar b)
{
Scalar maga = mag(a);
@ -155,61 +166,79 @@ inline Scalar sqrtSumSqr(const Scalar a, const Scalar b)
}
}
inline Scalar pow3(const Scalar s)
{
return s*sqr(s);
}
inline Scalar pow4(const Scalar s)
{
return sqr(sqr(s));
}
inline Scalar pow5(const Scalar s)
{
return s*pow4(s);
}
inline Scalar pow6(const Scalar s)
{
return pow3(sqr(s));
}
inline Scalar pow025(const Scalar s)
{
return sqrt(sqrt(s));
}
inline Scalar inv(const Scalar s)
{
return 1.0/s;
}
inline Scalar dot(const Scalar s1, const Scalar s2)
{
return s1*s2;
}
inline Scalar cmptMultiply(const Scalar s1, const Scalar s2)
{
return s1*s2;
}
inline Scalar cmptDivide(const Scalar s1, const Scalar s2)
{
return s1/s2;
}
inline Scalar cmptMax(const Scalar s)
{
return s;
}
inline Scalar cmptMin(const Scalar s)
{
return s;
}
inline Scalar cmptAv(const Scalar s)
{
return s;
}
inline Scalar cmptMag(const Scalar s)
{
return mag(s);

View File

@ -0,0 +1,209 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 "PorousZones.H"
#include "Time.H"
#include "volFields.H"
#include "fvm.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ZoneType>
template<class Type>
void Foam::PorousZones<ZoneType>::modifyDdt(fvMatrix<Type>& m) const
{
forAll(*this, i)
{
this->operator[](i).modifyDdt(m);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ZoneType>
Foam::PorousZones<ZoneType>::PorousZones
(
const fvMesh& mesh
)
:
IOPtrList<ZoneType>
(
IOobject
(
"porousZones",
mesh.time().constant(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
typename ZoneType::iNew(mesh)
),
mesh_(mesh)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ZoneType>
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::PorousZones<ZoneType>::ddt
(
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(vf);
modifyDdt(tres());
return tres;
}
template<class ZoneType>
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::PorousZones<ZoneType>::ddt
(
const oneField&,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(vf);
modifyDdt(tres());
return tres;
}
template<class ZoneType>
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::PorousZones<ZoneType>::ddt
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(rho,vf);
modifyDdt(tres());
return tres;
}
template<class ZoneType>
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::PorousZones<ZoneType>::ddt
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(rho,vf);
modifyDdt(tres());
return tres;
}
template<class ZoneType>
void Foam::PorousZones<ZoneType>::addResistance(fvVectorMatrix& UEqn) const
{
forAll(*this, i)
{
this->operator[](i).addResistance(UEqn);
}
}
template<class ZoneType>
void Foam::PorousZones<ZoneType>::addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const
{
// addResistance for each zone, delaying the correction of the
// precessor BCs of AU
forAll(*this, i)
{
this->operator[](i).addResistance(UEqn, AU, false);
}
// Correct the boundary conditions of the tensorial diagonal to ensure
// processor bounaries are correctly handled when AU^-1 is interpolated
// for the pressure equation.
AU.correctBoundaryConditions();
}
template<class ZoneType>
bool Foam::PorousZones<ZoneType>::readData(Istream& is)
{
this->clear();
IOPtrList<ZoneType> newLst
(
IOobject
(
"porousZones",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false // Don't re-register new zones with objectRegistry
),
typename ZoneType::iNew(mesh_)
);
transfer(newLst);
return is.good();
}
template<class ZoneType>
bool Foam::PorousZones<ZoneType>::writeData(Ostream& os, bool subDict) const
{
// Write size of list
os << nl << this->size();
// Write beginning of contents
os << nl << token::BEGIN_LIST;
// Write list contents
forAll(*this, i)
{
os << nl;
this->operator[](i).writeDict(os, subDict);
}
// Write end of contents
os << token::END_LIST << nl;
// Check state of IOstream
return os.good();
}
// ************************************************************************* //

View File

@ -0,0 +1,162 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Class
Foam::PorousZones<ZoneType>
Description
A centralized ZoneType collection.
Container class for a set of ZoneType with the ZoneType member
functions implemented to loop over the functions for each ZoneType.
SourceFiles
PorousZones.C
\*---------------------------------------------------------------------------*/
#ifndef PorousZones_H
#define PorousZones_H
#include "IOPtrList.H"
#include "volFieldsFwd.H"
#include "fvMatricesFwd.H"
#include "dimensionedScalarFwd.H"
#include "oneField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
class fvMesh;
/*---------------------------------------------------------------------------*\
Class PorousZones Declaration
\*---------------------------------------------------------------------------*/
template<class ZoneType>
class PorousZones
:
public IOPtrList<ZoneType>
{
// Private data
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
// Private Member Functions
//- Disallow default bitwise copy construct
PorousZones(const PorousZones<ZoneType>&);
//- Disallow default bitwise assignment
void operator=(const PorousZones<ZoneType>&);
//- modify time derivative elements
template<class Type>
void modifyDdt(fvMatrix<Type>&) const;
public:
// Constructors
//- Construct from fvMesh
// with automatically constructed coordinate systems list
PorousZones(const fvMesh&);
// Member Functions
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
GeometricField<Type, fvPatchField, volMesh>&
);
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const oneField&,
GeometricField<Type, fvPatchField, volMesh>&
);
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
);
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
);
//- Add the viscous and inertial resistance force contribution
// to the momentum equation
void addResistance(fvVectorMatrix& UEqn) const;
//- Add the viscous and inertial resistance force contribution
// to the tensorial diagonal
void addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const;
//- read modified data
virtual bool readData(Istream&);
//- write data
bool writeData(Ostream&, bool subDict = true) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "PorousZones.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -198,7 +198,6 @@ public:
return autoPtr<porousZone>(NULL);
}
//- Return pointer to new porousZone created on freestore from Istream
class iNew
{
@ -222,6 +221,11 @@ public:
};
//- Destructor
virtual ~porousZone()
{}
// Member Functions
// Access
@ -232,6 +236,12 @@ public:
return name_;
}
//- Return mesh
const fvMesh& mesh() const
{
return mesh_;
}
//- cellZone number
label zoneId() const
{
@ -275,7 +285,7 @@ public:
}
//- modify time derivative elements according to porosity
//- Modify time derivative elements according to porosity
template<class Type>
void modifyDdt(fvMatrix<Type>&) const;
@ -294,7 +304,7 @@ public:
) const;
//- Write the porousZone dictionary
void writeDict(Ostream&, bool subDict = true) const;
virtual void writeDict(Ostream&, bool subDict = true) const;
// Ostream Operator

View File

@ -25,8 +25,6 @@ License
\*---------------------------------------------------------------------------*/
#include "porousZones.H"
#include "Time.H"
#include "volFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -35,105 +33,4 @@ namespace Foam
defineTemplateTypeNameAndDebug(IOPtrList<porousZone>, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porousZones::porousZones
(
const fvMesh& mesh
)
:
IOPtrList<porousZone>
(
IOobject
(
"porousZones",
mesh.time().constant(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
porousZone::iNew(mesh)
),
mesh_(mesh)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::porousZones::addResistance(fvVectorMatrix& UEqn) const
{
forAll(*this, i)
{
operator[](i).addResistance(UEqn);
}
}
void Foam::porousZones::addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const
{
// addResistance for each zone, delaying the correction of the
// precessor BCs of AU
forAll(*this, i)
{
operator[](i).addResistance(UEqn, AU, false);
}
// Correct the boundary conditions of the tensorial diagonal to ensure
// processor bounaries are correctly handled when AU^-1 is interpolated
// for the pressure equation.
AU.correctBoundaryConditions();
}
bool Foam::porousZones::readData(Istream& is)
{
clear();
IOPtrList<porousZone> newLst
(
IOobject
(
"porousZones",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false // Don't re-register new zones with objectRegistry
),
porousZone::iNew(mesh_)
);
transfer(newLst);
return is.good();
}
bool Foam::porousZones::writeData(Ostream& os, bool subDict) const
{
// Write size of list
os << nl << size();
// Write beginning of contents
os << nl << token::BEGIN_LIST;
// Write list contents
forAll(*this, i)
{
os << nl;
operator[](i).writeDict(os, subDict);
}
// Write end of contents
os << token::END_LIST << nl;
// Check state of IOstream
return os.good();
}
// ************************************************************************* //

View File

@ -22,152 +22,23 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Typedef
Foam::porousZones
Description
A centralized porousZone collection.
Container class for a set of porousZones with the porousZone member
functions implemented to loop over the functions for each porousZone.
The input file @c constant/porousZone is implemented as
IOPtrList\<porousZone\> and contains the following type of data:
@verbatim
1
(
cat1
{
coordinateSystem system_10;
porosity 0.781;
Darcy
{
d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
f f [0 -1 0 0 0] (-1000 -1000 12.83);
}
}
)
@endverbatim
SourceFiles
porousZones.C
\*---------------------------------------------------------------------------*/
#ifndef porousZones_H
#define porousZones_H
#include "PorousZones.H"
#include "porousZone.H"
#include "IOPtrList.H"
#include "volFieldsFwd.H"
#include "fvMatrix.H"
#include "oneField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class porousZones Declaration
\*---------------------------------------------------------------------------*/
class porousZones
:
public IOPtrList<porousZone>
{
// Private data
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
// Private Member Functions
//- Disallow default bitwise copy construct
porousZones(const porousZones&);
//- Disallow default bitwise assignment
void operator=(const porousZones&);
//- modify time derivative elements
template<class Type>
void modifyDdt(fvMatrix<Type>&) const;
public:
// Constructors
//- Construct from fvMesh
// with automatically constructed coordinate systems list
porousZones(const fvMesh&);
// Member Functions
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
GeometricField<Type, fvPatchField, volMesh>&
);
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const oneField&,
GeometricField<Type, fvPatchField, volMesh>&
);
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
);
//- mirror fvm::ddt with porosity
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
);
//- Add the viscous and inertial resistance force contribution
// to the momentum equation
void addResistance(fvVectorMatrix& UEqn) const;
//- Add the viscous and inertial resistance force contribution
// to the tensorial diagonal
void addResistance
(
const fvVectorMatrix& UEqn,
volTensorField& AU
) const;
//- read modified data
virtual bool readData(Istream&);
//- write data
bool writeData(Ostream&, bool subDict = true) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "porousZonesTemplates.C"
#endif
typedef PorousZones<porousZone> porousZones;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,19 +29,18 @@ License
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField(fvPatchScalarField, fanFvPatchScalarField);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, fanFvPatchScalarField);
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Specialisation of the jump-condition for the pressure
template<>
void fanFvPatchField<scalar>::updateCoeffs()
void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
{
if (updated())
{
@ -58,27 +57,33 @@ void fanFvPatchField<scalar>::updateCoeffs()
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
scalarField Un =
scalarField Un = max
(
scalarField::subField(phip, size()/2)
/scalarField::subField(patch().magSf(), size()/2);
/scalarField::subField(patch().magSf(), size()/2),
0.0
);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
Un /= patch().lookupPatchField<volScalarField, scalar>("rho");
Un /=
scalarField::subField
(
patch().lookupPatchField<volScalarField, scalar>("rho"),
size()/2
);
}
for(label i=1; i<f_.size(); i++)
{
jump_ += f_[i]*pow(Un, i);
}
jump_ = max(jump_, 0.0);
}
jumpCyclicFvPatchField<scalar>::updateCoeffs();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -36,7 +36,7 @@ SourceFiles
#ifndef directMappedWallFvPatch_H
#define directMappedWallFvPatch_H
#include "fvPatch.H"
#include "wallFvPatch.H"
#include "directMappedWallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,12 +45,12 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedWallFvPatch Declaration
Class directMappedWallFvPatch Declaration
\*---------------------------------------------------------------------------*/
class directMappedWallFvPatch
:
public fvPatch
public wallFvPatch
{
public:
@ -68,7 +68,7 @@ public:
const fvBoundaryMesh& bm
)
:
fvPatch(patch, bm)
wallFvPatch(patch, bm)
{}
};

View File

@ -25,6 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "polyMesh.H"
#include "wallPolyPatch.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -46,21 +47,25 @@ inline Foam::scalar Foam::Particle<ParticleType>::lambda
Sf /= mag(Sf);
vector Cf = mesh.faceCentres()[facei];
// move reference point for wall
// patch interaction
if (!cloud_.internalFace(facei))
{
const vector& C = mesh.cellCentres()[celli_];
scalar CCf = mag((C - Cf) & Sf);
// check if distance between cell centre and face centre
// is larger than wallImpactDistance
if
(
CCf
> static_cast<const ParticleType&>(*this).wallImpactDistance(Sf)
)
label patchi = patch(facei);
const polyPatch& patch = mesh.boundaryMesh()[patchi];
// move reference point for wall
if (isA<wallPolyPatch>(patch))
{
Cf -= static_cast<const ParticleType&>(*this)
.wallImpactDistance(Sf)*Sf;
const vector& C = mesh.cellCentres()[celli_];
scalar CCf = mag((C - Cf) & Sf);
// check if distance between cell centre and face centre
// is larger than wallImpactDistance
const ParticleType& p =
static_cast<const ParticleType&>(*this);
if (CCf > p.wallImpactDistance(Sf))
{
Cf -=p.wallImpactDistance(Sf)*Sf;
}
}
}
@ -190,26 +195,24 @@ inline Foam::scalar Foam::Particle<ParticleType>::lambda
Sf /= mag(Sf);
vector Cf = mesh.faceCentres()[facei];
// move reference point for wall
// patch interaction
if (!cloud_.internalFace(facei))
{
label patchi = mesh.boundaryMesh().whichPatch(facei);
label patchi = patch(facei);
const polyPatch& patch = mesh.boundaryMesh()[patchi];
// move reference point for wall
if (isA<wallPolyPatch>(patch))
{
const vector& C = mesh.cellCentres()[celli_];
scalar CCf = mag((C - Cf) & Sf);
// check if distance between cell centre and face centre
// is larger than wallImpactDistance
if
(
CCf
> static_cast<const ParticleType&>(*this).wallImpactDistance(Sf)
)
const ParticleType& p = static_cast<const ParticleType&>(*this);
if (CCf > p.wallImpactDistance(Sf))
{
Cf -= static_cast<const ParticleType&>(*this)
.wallImpactDistance(Sf)*Sf;
Cf -= p.wallImpactDistance(Sf)*Sf;
}
}
}

View File

@ -26,7 +26,8 @@ Class
Foam::particleForces
Description
Particle forces
Provides a mechanism to calculate particle forces
Note: forces are force per unit mass (accelerations)
SourceFiles
particleForces.C

View File

@ -36,7 +36,7 @@ SourceFiles
#ifndef directMappedWallPointPatch_H
#define directMappedWallPointPatch_H
#include "facePointPatch.H"
#include "wallPointPatch.H"
#include "directMappedWallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,7 +50,7 @@ namespace Foam
class directMappedWallPointPatch
:
public facePointPatch
public wallPointPatch
{
public:
@ -68,7 +68,7 @@ public:
const pointBoundaryMesh& bm
)
:
facePointPatch(patch, bm)
wallPointPatch(patch, bm)
{}
};

View File

@ -16,5 +16,6 @@ wmake libso chemistryModel
wmake libso pdfs
wmake libso radiation
wmake libso barotropicCompressibilityModel
wmake libso thermalPorousZone
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,4 @@
thermalPorousZone/thermalPorousZone.C
thermalPorousZone/thermalPorousZones.C
LIB = $(FOAM_LIBBIN)/libthermalPorousZone

View File

@ -0,0 +1,9 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
LIB_LIBS = \
-lbasicThermophysicalModels \
-lmeshTools \
-lfiniteVolume

View File

@ -0,0 +1,101 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 "thermalPorousZone.H"
#include "fvMesh.H"
#include "fvMatrices.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::thermalPorousZone::thermalPorousZone
(
const word& name,
const fvMesh& mesh,
const dictionary& dict
)
:
porousZone(name, mesh, dict),
T_("T", dimTemperature, -GREAT)
{
if (const dictionary* dictPtr = dict.subDictPtr("thermalModel"))
{
word thermalModel(dictPtr->lookup("type"));
if (thermalModel == "fixedTemperature")
{
dictPtr->lookup("T") >> T_;
}
else
{
FatalIOErrorIn
(
"thermalPorousZone::thermalPorousZone"
"("
"const word& name, "
"const fvMesh& mesh, "
"const dictionary& dict"
")",
*dictPtr
) << "thermalModel " << thermalModel << " is not supported" << nl
<< " Supported thermalModels are: fixedTemperature"
<< exit(FatalIOError);
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::thermalPorousZone::addEnthalpySource
(
const basicThermo& thermo,
const volScalarField& rho,
fvScalarMatrix& hEqn
) const
{
if (zoneId() == -1 || T_.value() < 0.0)
{
return;
}
const labelList& cells = mesh().cellZones()[zoneId()];
const scalarField& V = mesh().V();
scalarField& hDiag = hEqn.diag();
scalarField& hSource = hEqn.source();
scalarField hZone = thermo.h(scalarField(cells.size(), T_.value()), cells);
scalar rate = 1e6;
forAll (cells, i)
{
hDiag[cells[i]] += rate*V[cells[i]]*rho[cells[i]];
hSource[cells[i]] += rate*V[cells[i]]*rho[cells[i]]*hZone[i];
}
}
// ************************************************************************* //

View File

@ -0,0 +1,161 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Class
Foam::thermalPorousZone
Description
Porous zone definition based on cell zones including terms for energy
equations.
See Also
porousZone, thermalPorousZones and coordinateSystems
SourceFiles
thermalPorousZone.C
thermalPorousZoneTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef thermalPorousZone_H
#define thermalPorousZone_H
#include "porousZone.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class fvMesh;
class basicThermo;
/*---------------------------------------------------------------------------*\
Class thermalPorousZone Declaration
\*---------------------------------------------------------------------------*/
class thermalPorousZone
:
public porousZone
{
// Private data
//- Temperature in the porous-zone
dimensionedScalar T_;
//- Disallow default bitwise copy construct
thermalPorousZone(const thermalPorousZone&);
//- Disallow default bitwise assignment
void operator=(const thermalPorousZone&);
public:
// Constructors
//- Construct from components
thermalPorousZone(const word& name, const fvMesh&, const dictionary&);
//- Return clone
autoPtr<thermalPorousZone> clone() const
{
notImplemented("autoPtr<thermalPorousZone> clone() const");
return autoPtr<thermalPorousZone>(NULL);
}
//- Return pointer to new thermalPorousZone
// created on freestore from Istream
class iNew
{
//- Reference to the finite volume mesh this zone is part of
const fvMesh& mesh_;
public:
iNew(const fvMesh& mesh)
:
mesh_(mesh)
{}
autoPtr<thermalPorousZone> operator()(Istream& is) const
{
word name(is);
dictionary dict(is);
return autoPtr<thermalPorousZone>
(
new thermalPorousZone(name, mesh_, dict)
);
}
};
//- Destructor
virtual ~thermalPorousZone()
{}
// Member Functions
// Access
//- Return the temperature in the porous-zone
const dimensionedScalar& T() const
{
return T_;
}
//- Edit access to the temperature in the porous-zone
dimensionedScalar& T()
{
return T_;
}
//- Add the thermal source to the enthalpy equation
void addEnthalpySource
(
const basicThermo& thermo,
const volScalarField& rho,
fvScalarMatrix& hEqn
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
//# include "thermalPorousZoneTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 "porousZone.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class RhoFieldType>
void Foam::porousZone::addPowerLawResistance
(
scalarField& Udiag,
const labelList& cells,
const scalarField& V,
const RhoFieldType& rho,
const vectorField& U
) const
{
const scalar C0 = C0_;
const scalar C1m1b2 = (C1_ - 1.0)/2.0;
forAll (cells, i)
{
Udiag[cells[i]] +=
V[cells[i]]*rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2);
}
}
template<class RhoFieldType>
void Foam::porousZone::addViscousInertialResistance
(
scalarField& Udiag,
vectorField& Usource,
const labelList& cells,
const scalarField& V,
const RhoFieldType& rho,
const scalarField& mu,
const vectorField& U
) const
{
const tensor& D = D_.value();
const tensor& F = F_.value();
forAll (cells, i)
{
tensor dragCoeff = mu[cells[i]]*D + (rho[cells[i]]*mag(U[cells[i]]))*F;
scalar isoDragCoeff = tr(dragCoeff);
Udiag[cells[i]] += V[cells[i]]*isoDragCoeff;
Usource[cells[i]] -=
V[cells[i]]*((dragCoeff - I*isoDragCoeff) & U[cells[i]]);
}
}
// ************************************************************************* //

View File

@ -22,79 +22,43 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*----------------------------------------------------------------------------*/
\*---------------------------------------------------------------------------*/
#include "porousZones.H"
#include "thermalPorousZones.H"
#include "volFields.H"
#include "fvMatrix.H"
#include "fvm.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class Type>
void Foam::porousZones::modifyDdt(fvMatrix<Type>& m) const
namespace Foam
{
defineTemplateTypeNameAndDebug(IOPtrList<thermalPorousZone>, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::thermalPorousZones::thermalPorousZones
(
const fvMesh& mesh
)
:
PorousZones<thermalPorousZone>(mesh)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::thermalPorousZones::addEnthalpySource
(
const basicThermo& thermo,
const volScalarField& rho,
fvScalarMatrix& hEqn
) const
{
forAll(*this, i)
{
operator[](i).modifyDdt(m);
operator[](i).addEnthalpySource(thermo, rho, hEqn);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::porousZones::ddt
(
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(vf);
modifyDdt(tres());
return tres;
}
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::porousZones::ddt
(
const oneField&,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(vf);
modifyDdt(tres());
return tres;
}
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::porousZones::ddt
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(rho,vf);
modifyDdt(tres());
return tres;
}
template<class Type>
Foam::tmp<Foam::fvMatrix<Type> >
Foam::porousZones::ddt
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tres = fvm::ddt(rho,vf);
modifyDdt(tres());
return tres;
}
// ************************************************************************* //

View File

@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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
Class
Foam::thermalPorousZones
Description
A centralized thermalPorousZone collection.
Container class for a set of thermalPorousZones with the thermalPorousZone
member functions implemented to loop over the functions for each
thermalPorousZone.
The input file @c constant/thermalPorousZone is implemented as
IOPtrList\<thermalPorousZone\> and contains the following type of data:
@verbatim
1
(
cat1
{
coordinateSystem system_10;
porosity 0.781;
Darcy
{
d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
f f [0 -1 0 0 0] (-1000 -1000 12.83);
}
Temperature [0 0 1 0 0] 600;
}
)
@endverbatim
SourceFiles
thermalPorousZones.C
\*---------------------------------------------------------------------------*/
#ifndef thermalPorousZones_H
#define thermalPorousZones_H
#include "PorousZones.H"
#include "thermalPorousZone.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class thermalPorousZones Declaration
\*---------------------------------------------------------------------------*/
class thermalPorousZones
:
public PorousZones<thermalPorousZone>
{
public:
// Constructors
//- Construct from fvMesh
thermalPorousZones(const fvMesh&);
// Member Functions
//- Add the thermal source to the enthalpy equation
void addEnthalpySource
(
const basicThermo& thermo,
const volScalarField& rho,
fvScalarMatrix& hEqn
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -176,7 +176,7 @@ tmp<scalarField> RASModel::yPlus(const label patchNo, const scalar Cmu) const
if (isType<wallFvPatch>(curPatch))
{
Yp = pow(Cmu, 0.25)
Yp = pow025(Cmu)
*y_[patchNo]
*sqrt(k()().boundaryField()[patchNo].patchInternalField())
/(

View File

@ -118,7 +118,7 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
const scalar Cmu =
rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
const scalar Cmu25 = pow(Cmu, 0.25);
const scalar Cmu25 = pow025(Cmu);
const fvPatchField<scalar>& kp =
patch().lookupPatchField<volScalarField, scalar>(kName_);

View File

@ -204,7 +204,7 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalar Cmu25 = pow025(Cmu_);
const scalarField& y = rasModel.y()[patchI];

View File

@ -188,7 +188,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalar Cmu25 = pow025(Cmu_);
const scalar Cmu75 = pow(Cmu_, 0.75);
const scalarField& y = rasModel.y()[patchI];

View File

@ -75,7 +75,7 @@ tmp<scalarField> mutkRoughWallFunctionFvPatchScalarField::calcMut() const
const volScalarField& k = tk();
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
scalarField& mutw = tmutw();

View File

@ -83,7 +83,7 @@ tmp<scalarField> mutkWallFunctionFvPatchScalarField::calcMut() const
const volScalarField& k = tk();
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0));
scalarField& mutw = tmutw();
@ -215,7 +215,7 @@ tmp<scalarField> mutkWallFunctionFvPatchScalarField::yPlus() const
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
return pow(Cmu_, 0.25)*y*sqrt(kwc)/(muw/rhow);
return pow025(Cmu_)*y*sqrt(kwc)/(muw/rhow);
}

View File

@ -187,7 +187,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patch().index()];
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalar Cmu25 = pow025(Cmu_);
volScalarField& G = const_cast<volScalarField&>
(db().lookupObject<volScalarField>(GName_));

View File

@ -346,7 +346,7 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU)
volVectorField gradK = fvc::grad(k_);
volVectorField gradOmega = fvc::grad(omega_);
volScalarField L = sqrt(k_)/(pow(Cmu_, 0.25)*(omega_ + omegaSmall_));
volScalarField L = sqrt(k_)/(pow025(Cmu_)*(omega_ + omegaSmall_));
volScalarField CDkOmega =
(2.0*alphaOmega2_)*(gradK & gradOmega)/(omega_ + omegaSmall_);
volScalarField F1 = this->F1(CDkOmega);

View File

@ -171,7 +171,7 @@ tmp<scalarField> RASModel::yPlus(const label patchNo, const scalar Cmu) const
if (isType<wallFvPatch>(curPatch))
{
Yp = pow(Cmu, 0.25)
Yp = pow025(Cmu)
*y_[patchNo]
*sqrt(k()().boundaryField()[patchNo].patchInternalField())
/nu().boundaryField()[patchNo];

View File

@ -118,7 +118,7 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
const scalar Cmu =
rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09);
const scalar Cmu25 = pow(Cmu, 0.25);
const scalar Cmu25 = pow025(Cmu);
const fvPatchField<scalar>& kp =
patch().lookupPatchField<volScalarField, scalar>(kName_);

View File

@ -185,7 +185,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalar Cmu25 = pow025(Cmu_);
const scalar Cmu75 = pow(Cmu_, 0.75);
volScalarField& G =

View File

@ -74,7 +74,7 @@ tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
const volScalarField& k = tk();
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();

View File

@ -83,7 +83,7 @@ tmp<scalarField> nutkWallFunctionFvPatchScalarField::calcNut() const
const volScalarField& k = tk();
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0));
scalarField& nutw = tnutw();
@ -223,7 +223,7 @@ tmp<scalarField> nutkWallFunctionFvPatchScalarField::yPlus() const
const scalarField kwc = k.boundaryField()[patchI].patchInternalField();
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
return pow(Cmu_, 0.25)*y*sqrt(kwc)/nuw;
return pow025(Cmu_)*y*sqrt(kwc)/nuw;
}

View File

@ -186,7 +186,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const scalar Cmu25 = pow(Cmu_, 0.25);
const scalar Cmu25 = pow025(Cmu_);
volScalarField& G =
const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_));

View File

@ -75,7 +75,7 @@ Description
label faceCelli = curPatch.faceCells()[facei];
//- using local Cmu !
scalar Cmu25 = pow(Cmu_[faceCelli], 0.25);
scalar Cmu25 = pow025(Cmu_[faceCelli]);
scalar Cmu75 = pow(Cmu_[faceCelli], 0.75);
scalar yPlus =

View File

@ -49,7 +49,7 @@ Description
label faceCelli = curPatch.faceCells()[facei];
//- Using local Cmu
scalar Cmu25 = pow(Cmu_[faceCelli], 0.25);
scalar Cmu25 = pow025(Cmu_[faceCelli]);
scalar yPlus =
Cmu25*y_[patchi][facei]*sqrt(k_[faceCelli])/nuw[facei];

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -1,14 +1,14 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;

View File

@ -30,6 +30,13 @@ FoamFile
d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
f f [0 -1 0 0 0 0 0] (0 0 0);
}
thermalModel
{
type fixedTemperature;
T T [0 0 0 1 0] 350;
}
}
)

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/

View File

@ -1,24 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format binary;
class dictionary;
location "system";
object tetFemSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
motionU ICCG 1e-06 0;
}
// ************************************************************************* //

View File

@ -23,11 +23,13 @@ boundaryField
movingWall
{
type kqRWallFunction;
value uniform ( 0 0 0 0 0 0 );
}
fixedWalls
{
type kqRWallFunction;
value uniform ( 0 0 0 0 0 0 );
}
frontAndBack

View File

@ -34,11 +34,13 @@ boundaryField
upperWall
{
type kqRWallFunction;
value uniform ( 0 0 0 0 0 0 );
}
lowerWall
{
type kqRWallFunction;
value uniform ( 0 0 0 0 0 0 );
}
frontAndBack

View File

@ -34,11 +34,13 @@ boundaryField
upperWall
{
type kqRWallFunction;
value uniform ( 0 0 0 0 0 0 );
}
lowerWall
{
type kqRWallFunction;
value uniform ( 0 0 0 0 0 0 );
}
frontAndBack

View File

@ -23,8 +23,6 @@ ddtSchemes
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(alpha) Gauss linear;
}
divSchemes

View File

@ -23,8 +23,6 @@ ddtSchemes
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(alpha1) Gauss linear;
}
divSchemes

View File

@ -23,8 +23,6 @@ ddtSchemes
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(alpha) Gauss linear;
}
divSchemes

View File

@ -23,8 +23,6 @@ ddtSchemes
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(alpha) Gauss linear;
}
divSchemes

View File

@ -23,8 +23,6 @@ ddtSchemes
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(alpha) Gauss linear;
}
divSchemes

View File

@ -23,8 +23,6 @@ ddtSchemes
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(alpha) Gauss linear;
}
divSchemes

View File

@ -23,8 +23,6 @@ ddtSchemes
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(alpha1) Gauss linear;
}
divSchemes

View File

@ -23,8 +23,6 @@ ddtSchemes
gradSchemes
{
default Gauss linear;
grad(U) Gauss linear;
grad(alpha1) Gauss linear;
}
divSchemes