Merge commit 'origin/master' into splitCyclic

Conflicts:
	applications/utilities/mesh/manipulation/createBaffles/createBaffles.C
	applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
	src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.C
	src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C
	src/dynamicMesh/motionSmoother/motionSmoother.C
	src/dynamicMesh/motionSmoother/motionSmoother.H
	src/dynamicMesh/motionSmoother/motionSmootherTemplates.C
This commit is contained in:
mattijs
2010-05-18 13:28:21 +01:00
480 changed files with 13145 additions and 5249 deletions

View File

@ -213,7 +213,7 @@ void Foam::primitiveEntry::write(Ostream& os) const
{
os.writeKeyword(keyword());
for (label i=0; i<size(); i++)
for (label i=0; i<size(); ++i)
{
os << operator[](i);

View File

@ -344,7 +344,7 @@ void Foam::argList::getRootCase()
else
{
// qualify relative path
fileName casePath = cwd()/rootPath_/globalCase_;
casePath = cwd()/rootPath_/globalCase_;
casePath.clean();
setEnv("FOAM_CASE", casePath, true);
@ -881,7 +881,12 @@ void Foam::argList::displayDoc(bool source) const
if (found)
{
string docBrowser(docDict.lookup("docBrowser"));
string docBrowser = getEnv("FOAM_DOC_BROWSER");
if (docBrowser.empty())
{
docDict.lookup("docBrowser") >> docBrowser;
}
// can use FOAM_DOC_BROWSER='application file://%f' if required
docBrowser.replaceAll("%f", docFile);
Info<< "Show documentation: " << docBrowser.c_str() << endl;

View File

@ -37,7 +37,7 @@ Description
@verbatim
( "file1.txt" "file2.txt" ... "fileN.txt" )
@endverbatim
The backslash-escaping has been used to avoid shell expansions.
The backslash-escaping is required to avoid interpretation by the shell.
@par Default command-line options
@param -case \<dir\> \n
@ -57,10 +57,14 @@ Description
global case.
Note
- Adjustment of the valid (mandatory) arguments
- The document browser used is defined by the @b FOAM_DOC_BROWSER
environment variable or the <tt>Documentation/docBrowser</tt> entry
in the <tt>~OpenFOAM/controlDict</tt> file.
The \%f token is used as a placeholder for the file name.
- The valid (mandatory) arguments can be adjusted
by directly manipulating the argList::validArgs static member.
- Adjustment of the valid options
via the addOption/removeOption static methods or by directly
- The valid options can be adjusted
via the addOption/removeOption static methods instead of directly
manipulating the argList::validOptions static member.
SourceFiles
@ -168,7 +172,7 @@ public:
initValidTables();
};
//! @endcond ignoreDocumentation
//! @endcond
// Constructors

View File

@ -63,7 +63,7 @@ public:
};
deleteControlDictPtr deleteControlDictPtr_;
//! @endcond ignoreDocumentation
//! @endcond
} // End namespace debug

View File

@ -0,0 +1,126 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 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 "interpolateSplineXY.H"
#include "primitiveFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Foam::Field<Type> Foam::interpolateSplineXY
(
const scalarField& xNew,
const scalarField& xOld,
const Field<Type>& yOld
)
{
Field<Type> yNew(xNew.size());
forAll(xNew, i)
{
yNew[i] = interpolateSmoothXY(xNew[i], xOld, yOld);
}
return yNew;
}
template<class Type>
Type Foam::interpolateSplineXY
(
const scalar x,
const scalarField& xOld,
const Field<Type>& yOld
)
{
label n = xOld.size();
// early exit if out of bounds or only one value
if (n == 1 || x < xOld[0])
{
return yOld[0];
}
if (x > xOld[n - 1])
{
return yOld[n - 1];
}
// linear interpolation if only two values
if (n == 2)
{
return (x - xOld[0])/(xOld[1] - xOld[0])*(yOld[1] - yOld[0]) + yOld[0];
}
// find bounding knots
label hi = 0;
while (hi < n && xOld[hi] < x)
{
hi++;
}
label lo = hi - 1;
const Type& y1 = yOld[lo];
const Type& y2 = yOld[hi];
Type y0;
if (lo == 0)
{
y0 = 2*y1 - y2;
}
else
{
y0 = yOld[lo - 1];
}
Type y3;
if (hi + 1 == n)
{
y3 = 2*y2 - y1;
}
else
{
y3 = yOld[hi + 1];
}
// weighting
scalar mu = (x - xOld[lo])/(xOld[hi] - xOld[lo]);
// interpolate
return
0.5
*(
2*y1
+ mu
*(
-y0 + y2
+ mu*((2*y0 - 5*y1 + 4*y2 - y3) + mu*(-y0 + 3*y1 - 3*y2 + y3))
)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,84 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 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
InNamespace
Foam
Description
Interpolates y values from one curve to another with a different x
distribution.
Uses Catmull-Rom spline interpolation between points.
SourceFiles
interpolateSplineXY.C
\*---------------------------------------------------------------------------*/
#ifndef interpolateSplineXY_H
#define interpolateSplineXY_H
#include "scalar.H"
#include "primitiveFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Field<Type> interpolateSplineXY
(
const scalarField& xNew,
const scalarField& xOld,
const Field<Type>& yOld
);
template<class Type>
Type interpolateSplineXY
(
const scalar x,
const scalarField& xOld,
const Field<Type>& yOld
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "interpolateSplineXY.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -41,7 +41,7 @@ Field<Type> interpolateXY
const Field<Type>& yOld
)
{
scalarField yNew(xNew.size());
Field<Type> yNew(xNew.size());
forAll(xNew, i)
{

View File

@ -125,7 +125,7 @@ void PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights() const
faceToEdgeWeightsPtr_ = new scalarList(patch_.nInternalEdges());
scalarList& weights = *faceToEdgeWeightsPtr_;
for (label edgei = 0; edgei < weights.size(); edgei++)
forAll(weights, edgei)
{
vector P = faces[edgeFaces[edgei][0]].centre(points);
vector N = faces[edgeFaces[edgei][1]].centre(points);

View File

@ -28,10 +28,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cyclicLduInterface, 0);
}
defineTypeNameAndDebug(Foam::cyclicLduInterface, 0);
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -25,23 +25,15 @@ License
#include "lduInterface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(lduInterface, 0);
defineTypeNameAndDebug(Foam::lduInterface, 0);
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
lduInterface::~lduInterface()
Foam::lduInterface::~lduInterface()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,10 +27,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(processorLduInterface, 0);
}
defineTypeNameAndDebug(Foam::processorLduInterface, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -28,10 +28,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cyclicLduInterfaceField, 0);
}
defineTypeNameAndDebug(Foam::cyclicLduInterfaceField, 0);
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -25,23 +25,14 @@ License
#include "lduInterfaceField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(lduInterfaceField, 0);
defineTypeNameAndDebug(Foam::lduInterfaceField, 0);
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
lduInterfaceField::~lduInterfaceField()
Foam::lduInterfaceField::~lduInterfaceField()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -28,10 +28,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(processorLduInterfaceField, 0);
}
defineTypeNameAndDebug(Foam::processorLduInterfaceField, 0);
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -28,10 +28,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(lduMatrix, 1);
}
defineTypeNameAndDebug(Foam::lduMatrix, 1);
const Foam::scalar Foam::lduMatrix::great_ = 1.0e+20;
const Foam::scalar Foam::lduMatrix::small_ = 1.0e-20;

View File

@ -27,10 +27,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(pairGAMGAgglomeration, 0);
}
defineTypeNameAndDebug(Foam::pairGAMGAgglomeration, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -27,10 +27,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(diagonalSolver, 0);
}
defineTypeNameAndDebug(Foam::diagonalSolver, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -363,7 +363,7 @@ Foam::SVD::SVD(const scalarRectangularMatrix& A, const scalar minCondition)
// zero singular values that are less than minCondition*maxS
const scalar minS = minCondition*S_[findMax(S_)];
for (label i = 0; i < S_.size(); i++)
forAll(S_, i)
{
if (S_[i] <= minS)
{

View File

@ -41,7 +41,7 @@ static const Foam::List<Foam::word> subDictNames
(
Foam::IStringStream("(preconditioner smoother)")()
);
//! @endcond localScope
//! @endcond
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -25,14 +25,9 @@ License
#include "tolerances.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
tolerances::tolerances(const Time& t, const fileName& dictName)
Foam::tolerances::tolerances(const Time& t, const fileName& dictName)
:
IOdictionary
(
@ -58,7 +53,7 @@ tolerances::tolerances(const Time& t, const fileName& dictName)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool tolerances::read()
bool Foam::tolerances::read()
{
if (regIOobject::read())
{
@ -90,34 +85,34 @@ bool tolerances::read()
}
bool tolerances::relax(const word& name) const
bool Foam::tolerances::relax(const word& name) const
{
return relaxationFactors_.found(name);
}
scalar tolerances::relaxationFactor(const word& name) const
Foam::scalar Foam::tolerances::relaxationFactor(const word& name) const
{
return readScalar(relaxationFactors_.lookup(name));
}
scalar tolerances::solverTolerance(const word& name) const
Foam::scalar Foam::tolerances::solverTolerance(const word& name) const
{
return readScalar(solverTolerances_.lookup(name));
}
bool tolerances::solverRelativeTolerances() const
bool Foam::tolerances::solverRelativeTolerances() const
{
return solverRelativeTolerances_.size();
}
scalar tolerances::solverRelativeTolerance(const word& name) const
Foam::scalar Foam::tolerances::solverRelativeTolerance(const word& name) const
{
return readScalar(solverRelativeTolerances_.lookup(name));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,26 +26,20 @@ License
#include "genericPointPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(genericPointPatch, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Add the patch constructor functions to the hash tables
addToRunTimeSelectionTable
(
facePointPatch,
genericPointPatch,
polyPatch
);
}
defineTypeNameAndDebug(genericPointPatch, 0);
// Add the patch constructor functions to the hash tables
addToRunTimeSelectionTable
(
facePointPatch,
genericPointPatch,
polyPatch
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -31,20 +31,18 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(cyclicPointPatch, 0);
addToRunTimeSelectionTable
(
facePointPatch,
cyclicPointPatch,
polyPatch
);
namespace Foam
{
defineTypeNameAndDebug(cyclicPointPatch, 0);
addToRunTimeSelectionTable
(
facePointPatch,
cyclicPointPatch,
polyPatch
);
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
@ -56,22 +54,22 @@ void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&)
{}
void cyclicPointPatch::initMovePoints(PstreamBuffers&, const pointField&)
void Foam::cyclicPointPatch::initMovePoints(PstreamBuffers&, const pointField&)
{}
void cyclicPointPatch::movePoints(PstreamBuffers&, const pointField&)
void Foam::cyclicPointPatch::movePoints(PstreamBuffers&, const pointField&)
{}
void cyclicPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
void Foam::cyclicPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
facePointPatch::initUpdateMesh(pBufs);
cyclicPointPatch::initGeometry(pBufs);
}
void cyclicPointPatch::updateMesh(PstreamBuffers& pBufs)
void Foam::cyclicPointPatch::updateMesh(PstreamBuffers& pBufs)
{
facePointPatch::updateMesh(pBufs);
cyclicPointPatch::calcGeometry(pBufs);
@ -80,7 +78,7 @@ void cyclicPointPatch::updateMesh(PstreamBuffers& pBufs)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
cyclicPointPatch::cyclicPointPatch
Foam::cyclicPointPatch::cyclicPointPatch
(
const polyPatch& patch,
const pointBoundaryMesh& bm
@ -93,20 +91,16 @@ cyclicPointPatch::cyclicPointPatch
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
cyclicPointPatch::~cyclicPointPatch()
Foam::cyclicPointPatch::~cyclicPointPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const edgeList& cyclicPointPatch::transformPairs() const
const Foam::edgeList& Foam::cyclicPointPatch::transformPairs() const
{
return cyclicPolyPatch_.coupledPoints();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -57,8 +57,6 @@ class cyclicPointPatch
//- Local reference cast into the cyclic patch
const cyclicPolyPatch& cyclicPolyPatch_;
// //- List of local points that are not collocated
// mutable labelList separatedPoints_;
// Private Member Functions

View File

@ -31,22 +31,19 @@ License
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(emptyPointPatch, 0);
addToRunTimeSelectionTable
(
facePointPatch,
emptyPointPatch,
polyPatch
);
defineTypeNameAndDebug(emptyPointPatch, 0);
addToRunTimeSelectionTable
(
facePointPatch,
emptyPointPatch,
polyPatch
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void emptyPointPatch::applyConstraint
void Foam::emptyPointPatch::applyConstraint
(
const label pointi,
pointConstraint& pc
@ -56,8 +53,4 @@ void emptyPointPatch::applyConstraint
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -31,21 +31,18 @@ License
#include "primitiveFacePatch.H"
#include "emptyPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(processorPointPatch, 0);
addToRunTimeSelectionTable
(
facePointPatch,
processorPointPatch,
polyPatch
);
defineTypeNameAndDebug(processorPointPatch, 0);
addToRunTimeSelectionTable
(
facePointPatch,
processorPointPatch,
polyPatch
);
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
@ -79,22 +76,26 @@ void Foam::processorPointPatch::calcGeometry(PstreamBuffers& pBufs)
{}
void processorPointPatch::initMovePoints(PstreamBuffers&, const pointField&)
void Foam::processorPointPatch::initMovePoints
(
PstreamBuffers&,
const pointField&
)
{}
void processorPointPatch::movePoints(PstreamBuffers&, const pointField&)
void Foam::processorPointPatch::movePoints(PstreamBuffers&, const pointField&)
{}
void processorPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
void Foam::processorPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
facePointPatch::initUpdateMesh(pBufs);
processorPointPatch::initGeometry(pBufs);
}
void processorPointPatch::updateMesh(PstreamBuffers& pBufs)
void Foam::processorPointPatch::updateMesh(PstreamBuffers& pBufs)
{
facePointPatch::updateMesh(pBufs);
processorPointPatch::calcGeometry(pBufs);
@ -103,7 +104,7 @@ void processorPointPatch::updateMesh(PstreamBuffers& pBufs)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
processorPointPatch::processorPointPatch
Foam::processorPointPatch::processorPointPatch
(
const polyPatch& patch,
const pointBoundaryMesh& bm
@ -116,20 +117,16 @@ processorPointPatch::processorPointPatch
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
processorPointPatch::~processorPointPatch()
Foam::processorPointPatch::~processorPointPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const labelList& processorPointPatch::reverseMeshPoints() const
const Foam::labelList& Foam::processorPointPatch::reverseMeshPoints() const
{
return reverseMeshPoints_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -29,25 +29,25 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(symmetryPointPatch, 0);
namespace Foam
{
defineTypeNameAndDebug(symmetryPointPatch, 0);
// Add the patch constructor functions to the hash tables
addToRunTimeSelectionTable
(
facePointPatch,
symmetryPointPatch,
polyPatch
);
// Add the patch constructor functions to the hash tables
addToRunTimeSelectionTable
(
facePointPatch,
symmetryPointPatch,
polyPatch
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void symmetryPointPatch::applyConstraint
void Foam::symmetryPointPatch::applyConstraint
(
const label pointi,
pointConstraint& pc
@ -57,8 +57,4 @@ void symmetryPointPatch::applyConstraint
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -34,23 +34,21 @@ Description
namespace Foam
{
defineTypeNameAndDebug(wedgePointPatch, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(wedgePointPatch, 0);
// Add the patch constructor functions to the hash tables
addToRunTimeSelectionTable
(
facePointPatch,
wedgePointPatch,
polyPatch
);
// Add the patch constructor functions to the hash tables
addToRunTimeSelectionTable
(
facePointPatch,
wedgePointPatch,
polyPatch
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void wedgePointPatch::applyConstraint
void Foam::wedgePointPatch::applyConstraint
(
const label pointi,
pointConstraint& pc
@ -60,8 +58,4 @@ void wedgePointPatch::applyConstraint
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,19 +26,14 @@ License
#include "coupledFacePointPatch.H"
#include "pointBoundaryMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(coupledFacePointPatch, 0);
defineTypeNameAndDebug(Foam::coupledFacePointPatch, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
coupledFacePointPatch::coupledFacePointPatch
Foam::coupledFacePointPatch::coupledFacePointPatch
(
const polyPatch& patch,
const pointBoundaryMesh& bm
@ -52,12 +47,8 @@ coupledFacePointPatch::coupledFacePointPatch
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
coupledFacePointPatch::~coupledFacePointPatch()
Foam::coupledFacePointPatch::~coupledFacePointPatch()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -120,9 +120,9 @@ Foam::polyBoundaryMesh::~polyBoundaryMesh()
void Foam::polyBoundaryMesh::clearGeom()
{
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).clearGeom();
operator[](patchI).clearGeom();
}
}
@ -132,9 +132,9 @@ void Foam::polyBoundaryMesh::clearAddressing()
neighbourEdgesPtr_.clear();
patchIDPtr_.clear();
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).clearAddressing();
operator[](patchI).clearAddressing();
}
}
@ -151,16 +151,16 @@ void Foam::polyBoundaryMesh::calcGeometry()
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).initGeometry(pBufs);
operator[](patchI).initGeometry(pBufs);
}
pBufs.finishedSends();
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).calcGeometry(pBufs);
operator[](patchI).calcGeometry(pBufs);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
@ -172,15 +172,15 @@ void Foam::polyBoundaryMesh::calcGeometry()
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
const label patchI = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initGeometry(pBufs);
operator[](patchI).initGeometry(pBufs);
}
else
{
operator[](patchi).calcGeometry(pBufs);
operator[](patchI).calcGeometry(pBufs);
}
}
}
@ -204,15 +204,15 @@ Foam::polyBoundaryMesh::neighbourEdges() const
// Initialize.
label nEdgePairs = 0;
forAll(*this, patchi)
forAll(*this, patchI)
{
const polyPatch& pp = operator[](patchi);
const polyPatch& pp = operator[](patchI);
neighbourEdges[patchi].setSize(pp.nEdges() - pp.nInternalEdges());
neighbourEdges[patchI].setSize(pp.nEdges() - pp.nInternalEdges());
forAll(neighbourEdges[patchi], i)
forAll(neighbourEdges[patchI], i)
{
labelPair& edgeInfo = neighbourEdges[patchi][i];
labelPair& edgeInfo = neighbourEdges[patchI][i];
edgeInfo[0] = -1;
edgeInfo[1] = -1;
@ -225,9 +225,9 @@ Foam::polyBoundaryMesh::neighbourEdges() const
// point addressing) to patch + relative edge index.
HashTable<labelPair, edge, Hash<edge> > pointsToEdge(nEdgePairs);
forAll(*this, patchi)
forAll(*this, patchI)
{
const polyPatch& pp = operator[](patchi);
const polyPatch& pp = operator[](patchI);
const edgeList& edges = pp.edges();
@ -256,7 +256,7 @@ Foam::polyBoundaryMesh::neighbourEdges() const
meshEdge,
labelPair
(
patchi,
patchI,
edgei - pp.nInternalEdges()
)
);
@ -266,11 +266,11 @@ Foam::polyBoundaryMesh::neighbourEdges() const
// Second occurrence. Store.
const labelPair& edgeInfo = fnd();
neighbourEdges[patchi][edgei - pp.nInternalEdges()] =
neighbourEdges[patchI][edgei - pp.nInternalEdges()] =
edgeInfo;
neighbourEdges[edgeInfo[0]][edgeInfo[1]]
= labelPair(patchi, edgei - pp.nInternalEdges());
= labelPair(patchI, edgei - pp.nInternalEdges());
// Found all two occurrences of this edge so remove from
// hash to save space. Note that this will give lots of
@ -288,11 +288,11 @@ Foam::polyBoundaryMesh::neighbourEdges() const
<< abort(FatalError);
}
forAll(*this, patchi)
forAll(*this, patchI)
{
const polyPatch& pp = operator[](patchi);
const polyPatch& pp = operator[](patchI);
const labelPairList& nbrEdges = neighbourEdges[patchi];
const labelPairList& nbrEdges = neighbourEdges[patchI];
forAll(nbrEdges, i)
{
@ -409,8 +409,7 @@ Foam::label Foam::polyBoundaryMesh::findPatchID(const word& patchName) const
// Patch not found
if (debug)
{
Pout<< "label polyBoundaryMesh::findPatchID(const word& "
<< "patchName) const"
Pout<< "label polyBoundaryMesh::findPatchID(const word&) const"
<< "Patch named " << patchName << " not found. "
<< "List of available patch names: " << names() << endl;
}
@ -641,16 +640,16 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p)
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).initMovePoints(pBufs, p);
operator[](patchI).initMovePoints(pBufs, p);
}
pBufs.finishedSends();
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).movePoints(pBufs, p);
operator[](patchI).movePoints(pBufs, p);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
@ -662,15 +661,15 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p)
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
const label patchI = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initMovePoints(pBufs, p);
operator[](patchI).initMovePoints(pBufs, p);
}
else
{
operator[](patchi).movePoints(pBufs, p);
operator[](patchI).movePoints(pBufs, p);
}
}
}
@ -690,16 +689,16 @@ void Foam::polyBoundaryMesh::updateMesh()
|| Pstream::defaultCommsType == Pstream::nonBlocking
)
{
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).initUpdateMesh(pBufs);
operator[](patchI).initUpdateMesh(pBufs);
}
pBufs.finishedSends();
forAll(*this, patchi)
forAll(*this, patchI)
{
operator[](patchi).updateMesh(pBufs);
operator[](patchI).updateMesh(pBufs);
}
}
else if (Pstream::defaultCommsType == Pstream::scheduled)
@ -711,15 +710,15 @@ void Foam::polyBoundaryMesh::updateMesh()
forAll(patchSchedule, patchEvali)
{
label patchi = patchSchedule[patchEvali].patch;
const label patchI = patchSchedule[patchEvali].patch;
if (patchSchedule[patchEvali].init)
{
operator[](patchi).initUpdateMesh(pBufs);
operator[](patchI).initUpdateMesh(pBufs);
}
else
{
operator[](patchi).updateMesh(pBufs);
operator[](patchI).updateMesh(pBufs);
}
}
}
@ -734,9 +733,9 @@ void Foam::polyBoundaryMesh::reorder(const UList<label>& oldToNew)
// Adapt indices
polyPatchList& patches = *this;
forAll(patches, patchi)
forAll(patches, patchI)
{
patches[patchi].index() = patchi;
patches[patchI].index() = patchI;
}
updateMesh();
@ -749,11 +748,11 @@ bool Foam::polyBoundaryMesh::writeData(Ostream& os) const
os << patches.size() << nl << token::BEGIN_LIST << incrIndent << nl;
forAll(patches, patchi)
forAll(patches, patchI)
{
os << indent << patches[patchi].name() << nl
os << indent << patches[patchI].name() << nl
<< indent << token::BEGIN_BLOCK << nl
<< incrIndent << patches[patchi] << decrIndent
<< incrIndent << patches[patchI] << decrIndent
<< indent << token::END_BLOCK << endl;
}
@ -776,6 +775,49 @@ bool Foam::polyBoundaryMesh::writeObject
return regIOobject::writeObject(fmt, ver, IOstream::UNCOMPRESSED);
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
const Foam::polyPatch& Foam::polyBoundaryMesh::operator[]
(
const word& patchName
) const
{
const label patchI = findPatchID(patchName);
if (patchI < 0)
{
FatalErrorIn
(
"polyBoundaryMesh::operator[](const word&) const"
) << "Patch named " << patchName << " not found." << nl
<< "Available patch names: " << names() << endl
<< abort(FatalError);
}
return operator[](patchI);
}
Foam::polyPatch& Foam::polyBoundaryMesh::operator[]
(
const word& patchName
)
{
const label patchI = findPatchID(patchName);
if (patchI < 0)
{
FatalErrorIn
(
"polyBoundaryMesh::operator[](const word&)"
) << "Patch named " << patchName << " not found." << nl
<< "Available patch names: " << names() << endl
<< abort(FatalError);
}
return operator[](patchI);
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //

View File

@ -126,7 +126,7 @@ public:
void clearAddressing();
// Member functions
// Member Functions
//- Return the mesh reference
const polyMesh& mesh() const
@ -194,6 +194,17 @@ public:
IOstream::compressionType cmp
) const;
// Member Operators
//- Return const and non-const reference to polyPatch by index.
using polyPatchList::operator[];
//- Return const reference to polyPatch by name.
const polyPatch& operator[](const word&) const;
//- Return reference to polyPatch by name.
polyPatch& operator[](const word&);
// Ostream operator

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,15 +27,10 @@ License
#include "entry.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
void Foam::ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
{
// It is an error to attempt to recalculate cellEdges
// if the pointer is already set
@ -77,7 +72,7 @@ void ZoneMesh<ZoneType, MeshType>::calcZoneMap() const
// Read constructor given IOobject and a MeshType reference
template<class ZoneType, class MeshType>
ZoneMesh<ZoneType, MeshType>::ZoneMesh
Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
(
const IOobject& io,
const MeshType& mesh
@ -136,7 +131,7 @@ ZoneMesh<ZoneType, MeshType>::ZoneMesh
// Construct given size. Zones will be set later
template<class ZoneType, class MeshType>
ZoneMesh<ZoneType, MeshType>::ZoneMesh
Foam::ZoneMesh<ZoneType, MeshType>::ZoneMesh
(
const IOobject& io,
const MeshType& mesh,
@ -153,7 +148,7 @@ ZoneMesh<ZoneType, MeshType>::ZoneMesh
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ZoneType, class MeshType>
ZoneMesh<ZoneType, MeshType>::~ZoneMesh()
Foam::ZoneMesh<ZoneType, MeshType>::~ZoneMesh()
{
clearAddressing();
}
@ -163,7 +158,8 @@ ZoneMesh<ZoneType, MeshType>::~ZoneMesh()
// Map of zones for quick zone lookup
template<class ZoneType, class MeshType>
const Map<label>& ZoneMesh<ZoneType, MeshType>::zoneMap() const
const Foam::Map<Foam::label>&
Foam::ZoneMesh<ZoneType, MeshType>::zoneMap() const
{
if (!zoneMapPtr_)
{
@ -177,7 +173,10 @@ const Map<label>& ZoneMesh<ZoneType, MeshType>::zoneMap() const
// Given a global object index, return the zone it is in.
// If object does not belong to any zones, return -1
template<class ZoneType, class MeshType>
label ZoneMesh<ZoneType, MeshType>::whichZone(const label objectIndex) const
Foam::label Foam::ZoneMesh<ZoneType, MeshType>::whichZone
(
const label objectIndex
) const
{
const Map<label>& zm = zoneMap();
Map<label>::const_iterator zmIter = zm.find(objectIndex);
@ -195,40 +194,43 @@ label ZoneMesh<ZoneType, MeshType>::whichZone(const label objectIndex) const
// Return a list of zone names
template<class ZoneType, class MeshType>
wordList ZoneMesh<ZoneType, MeshType>::types() const
Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::types() const
{
const PtrList<ZoneType>& zones = *this;
wordList t(zones.size());
wordList lst(zones.size());
forAll(zones, zoneI)
{
t[zoneI] = zones[zoneI].type();
lst[zoneI] = zones[zoneI].type();
}
return t;
return lst;
}
// Return a list of zone names
template<class ZoneType, class MeshType>
wordList ZoneMesh<ZoneType, MeshType>::names() const
Foam::wordList Foam::ZoneMesh<ZoneType, MeshType>::names() const
{
const PtrList<ZoneType>& zones = *this;
wordList t(zones.size());
wordList lst(zones.size());
forAll(zones, zoneI)
{
t[zoneI] = zones[zoneI].name();
lst[zoneI] = zones[zoneI].name();
}
return t;
return lst;
}
template<class ZoneType, class MeshType>
label ZoneMesh<ZoneType, MeshType>::findZoneID(const word& zoneName) const
Foam::label Foam::ZoneMesh<ZoneType, MeshType>::findZoneID
(
const word& zoneName
) const
{
const PtrList<ZoneType>& zones = *this;
@ -243,19 +245,18 @@ label ZoneMesh<ZoneType, MeshType>::findZoneID(const word& zoneName) const
// Zone not found
if (debug)
{
Info<< "label ZoneMesh<ZoneType>::findZoneID(const word& "
<< "zoneName) const : "
Info<< "label ZoneMesh<ZoneType>::findZoneID(const word&) const : "
<< "Zone named " << zoneName << " not found. "
<< "List of available zone names: " << names() << endl;
}
// A dummy return to kep the compiler happy
// A dummy return to keep the compiler happy
return -1;
}
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::clearAddressing()
void Foam::ZoneMesh<ZoneType, MeshType>::clearAddressing()
{
deleteDemandDrivenData(zoneMapPtr_);
@ -269,7 +270,7 @@ void ZoneMesh<ZoneType, MeshType>::clearAddressing()
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::clear()
void Foam::ZoneMesh<ZoneType, MeshType>::clear()
{
clearAddressing();
PtrList<ZoneType>::clear();
@ -278,7 +279,10 @@ void ZoneMesh<ZoneType, MeshType>::clear()
// Check zone definition
template<class ZoneType, class MeshType>
bool ZoneMesh<ZoneType, MeshType>::checkDefinition(const bool report) const
bool Foam::ZoneMesh<ZoneType, MeshType>::checkDefinition
(
const bool report
) const
{
bool inError = false;
@ -294,7 +298,7 @@ bool ZoneMesh<ZoneType, MeshType>::checkDefinition(const bool report) const
// Correct zone mesh after moving points
template<class ZoneType, class MeshType>
void ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p)
void Foam::ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p)
{
PtrList<ZoneType>& zones = *this;
@ -307,17 +311,66 @@ void ZoneMesh<ZoneType, MeshType>::movePoints(const pointField& p)
// writeData member function required by regIOobject
template<class ZoneType, class MeshType>
bool ZoneMesh<ZoneType, MeshType>::writeData(Ostream& os) const
bool Foam::ZoneMesh<ZoneType, MeshType>::writeData(Ostream& os) const
{
os << *this;
os << *this;
return os.good();
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
template<class ZoneType, class MeshType>
const ZoneType& Foam::ZoneMesh<ZoneType, MeshType>::operator[]
(
const word& zoneName
) const
{
const label zoneI = findZoneID(zoneName);
if (zoneI < 0)
{
FatalErrorIn
(
"ZoneMesh<ZoneType>::operator[](const word&) const"
) << "Zone named " << zoneName << " not found." << nl
<< "Available zone names: " << names() << endl
<< abort(FatalError);
}
return operator[](zoneI);
}
template<class ZoneType, class MeshType>
ZoneType& Foam::ZoneMesh<ZoneType, MeshType>::operator[]
(
const word& zoneName
)
{
const label zoneI = findZoneID(zoneName);
if (zoneI < 0)
{
FatalErrorIn
(
"ZoneMesh<ZoneType>::operator[](const word&)"
) << "Zone named " << zoneName << " not found." << nl
<< "Available zone names: " << names() << endl
<< abort(FatalError);
}
return operator[](zoneI);
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class ZoneType, class MeshType>
Ostream& operator<<(Ostream& os, const ZoneMesh<ZoneType, MeshType>& zones)
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const ZoneMesh<ZoneType, MeshType>& zones
)
{
os << zones.size() << nl << token::BEGIN_LIST;
@ -332,8 +385,4 @@ Ostream& operator<<(Ostream& os, const ZoneMesh<ZoneType, MeshType>& zones)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -109,7 +109,7 @@ public:
~ZoneMesh();
// Member functions
// Member Functions
//- Return the mesh reference
const MeshType& mesh() const
@ -149,6 +149,17 @@ public:
//- writeData member function required by regIOobject
bool writeData(Ostream&) const;
// Member Operators
//- Return const and non-const reference to ZoneType by index.
using PtrList<ZoneType>::operator[];
//- Return const reference to ZoneType by name.
const ZoneType& operator[](const word&) const;
//- Return reference to ZoneType by name.
ZoneType& operator[](const word&);
// Ostream operator

View File

@ -29,10 +29,8 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(zone, 0);
}
defineTypeNameAndDebug(Foam::zone, 0);
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //

View File

@ -153,7 +153,7 @@ void Foam::walkPatch::faceToFace
indexInFace_.append(fp);
// Visit neighbouring faces in order, starting at fp.
for (label i = 0; i < f.size(); i++)
forAll(f, i)
{
label fp1 = reverse_ ? f.rcIndex(fp) : f.fcIndex(fp);
label nbr = getNeighbour(faceI, fp, f[fp], f[fp1]);

View File

@ -49,7 +49,7 @@ Description
// The bytes used to pad buffer to the next 64-byte boundary.
// (RFC 1321, 3.1: Step 1)
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
//! @endcond fileScope
//! @endcond
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //

View File

@ -32,7 +32,7 @@ License
//! @cond fileScope
const char hexChars[] = "0123456789abcdef";
//! @endcond fileScope
//! @endcond
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -48,7 +48,7 @@ namespace Foam
// if necessary
//! @cond fileScope
labelList maxSendSize;
//! @endcond fileScope
//! @endcond
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -35,7 +35,7 @@ namespace Foam
// Outstanding non-blocking operations.
//! @cond fileScope
DynamicList<MPI_Request> PstreamGlobals::outstandingRequests_;
//! @endcond fileScope
//! @endcond
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,20 +28,23 @@ License
#include "motionSolver.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(dynamicMotionSolverFvMesh, 0);
addToRunTimeSelectionTable
(
dynamicFvMesh,
dynamicMotionSolverFvMesh,
IOobject
);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(dynamicMotionSolverFvMesh, 0);
addToRunTimeSelectionTable(dynamicFvMesh, dynamicMotionSolverFvMesh, IOobject);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh(const IOobject& io)
Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh(const IOobject& io)
:
dynamicFvMesh(io),
motionPtr_(motionSolver::New(*this))
@ -50,13 +53,13 @@ dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh(const IOobject& io)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
dynamicMotionSolverFvMesh::~dynamicMotionSolverFvMesh()
Foam::dynamicMotionSolverFvMesh::~dynamicMotionSolverFvMesh()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool dynamicMotionSolverFvMesh::update()
bool Foam::dynamicMotionSolverFvMesh::update()
{
fvMesh::movePoints(motionPtr_->newPoints());
@ -71,8 +74,4 @@ bool dynamicMotionSolverFvMesh::update()
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,7 +27,7 @@ License
#include "addToRunTimeSelectionTable.H"
#include "Tuple2.H"
#include "IFstream.H"
#include "interpolateXY.H"
#include "interpolateSplineXY.H"
#include "mathematicalConstants.H"
using namespace Foam::constant::mathematical;
@ -98,7 +98,7 @@ Foam::solidBodyMotionFunctions::tabulated6DoFMotion::transformation() const
<< exit(FatalError);
}
translationRotationVectors TRV = interpolateXY
translationRotationVectors TRV = interpolateSplineXY
(
t,
times_,

View File

@ -28,19 +28,18 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(staticFvMesh, 0);
namespace Foam
{
defineTypeNameAndDebug(staticFvMesh, 0);
addToRunTimeSelectionTable(dynamicFvMesh, staticFvMesh, IOobject);
}
addToRunTimeSelectionTable(dynamicFvMesh, staticFvMesh, IOobject);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct from objectRegistry, and read/write options
staticFvMesh::staticFvMesh(const IOobject& io)
Foam::staticFvMesh::staticFvMesh(const IOobject& io)
:
dynamicFvMesh(io)
{}
@ -48,20 +47,16 @@ staticFvMesh::staticFvMesh(const IOobject& io)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
staticFvMesh::~staticFvMesh()
Foam::staticFvMesh::~staticFvMesh()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool staticFvMesh::update()
bool Foam::staticFvMesh::update()
{
return false;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -88,7 +88,7 @@ void Foam::attachDetach::attachInterface
// Pout << "Points to be mapped: " << removedPoints << endl;
// Remove all faces from the slave patch
for (label i = 0; i < slavePatch.size(); i++)
forAll(slavePatch, i)
{
ref.setAction(polyRemoveFace(i + slavePatchStart));
// Pout << "Removing face " << i + slavePatchStart << endl;

View File

@ -1125,13 +1125,11 @@ void Foam::boundaryMesh::patchify
forAll(oldPatches, oldPatchI)
{
const polyPatch& patch = oldPatches[oldPatchI];
label newPatchI = findPatchID(patch.name());
const label newPatchI = findPatchID(patch.name());
if (newPatchI != -1)
{
nameToIndex.insert(patch.name(), newPatchI);
indexToName.insert(newPatchI, patch.name());
}
}
@ -1145,7 +1143,6 @@ void Foam::boundaryMesh::patchify
if (!nameToIndex.found(bp.name()))
{
nameToIndex.insert(bp.name(), bPatchI);
indexToName.insert(bPatchI, bp.name());
}
}
@ -1167,10 +1164,10 @@ void Foam::boundaryMesh::patchify
{
const boundaryPatch& bp = patches_[bPatchI];
label newPatchI = nameToIndex[bp.name()];
const label newPatchI = nameToIndex[bp.name()];
// Find corresponding patch in polyMesh
label oldPatchI = findPatchID(oldPatches, bp.name());
const label oldPatchI = findPatchID(oldPatches, bp.name());
if (oldPatchI == -1)
{
@ -1599,7 +1596,7 @@ void Foam::boundaryMesh::addPatch(const word& patchName)
void Foam::boundaryMesh::deletePatch(const word& patchName)
{
label delPatchI = findPatchID(patchName);
const label delPatchI = findPatchID(patchName);
if (delPatchI == -1)
{
@ -1658,7 +1655,7 @@ void Foam::boundaryMesh::changePatchType
const word& patchType
)
{
label changeI = findPatchID(patchName);
const label changeI = findPatchID(patchName);
if (changeI == -1)
{

View File

@ -343,7 +343,7 @@ Foam::directions::directions
const word patchName(patchDict.lookup("patch"));
label patchI = mesh.boundaryMesh().findPatchID(patchName);
const label patchI = mesh.boundaryMesh().findPatchID(patchName);
if (patchI == -1)
{

View File

@ -40,7 +40,11 @@ defineTypeNameAndDebug(Foam::motionSmoother, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::motionSmoother::testSyncPositions(const pointField& fld) const
void Foam::motionSmoother::testSyncPositions
(
const pointField& fld,
const scalar maxMag
) const
{
pointField syncedFld(fld);
@ -54,7 +58,7 @@ void Foam::motionSmoother::testSyncPositions(const pointField& fld) const
forAll(syncedFld, i)
{
if (syncedFld[i] != fld[i])
if (mag(syncedFld[i] - fld[i]) > maxMag)
{
FatalErrorIn
(
@ -835,7 +839,7 @@ Foam::tmp<Foam::scalarField> Foam::motionSmoother::movePoints
{
Pout<< "motionSmoother::movePoints : testing sync of newPoints."
<< endl;
testSyncPositions(newPoints);
testSyncPositions(newPoints, 1E-6*mesh_.bounds().mag());
}
tmp<scalarField> tsweptVol = mesh_.movePoints(newPoints);
@ -983,7 +987,8 @@ bool Foam::motionSmoother::scaleMesh
(
totalDisplacement,
maxMagEqOp(),
vector::zero // null value
vector::zero, // null value
1E-6*mesh_.bounds().mag()
);
}

View File

@ -214,11 +214,12 @@ class motionSmoother
(
const Field<Type>&,
const CombineOp& cop,
const Type& zero
const Type& zero,
const scalar maxMag
) const;
//- Test synchronisation of points
void testSyncPositions(const pointField&) const;
void testSyncPositions(const pointField&, const scalar maxMag) const;
//- Assemble tensors for multi-patch constraints
void makePatchPatchAddressing();

View File

@ -282,7 +282,8 @@ void Foam::motionSmoother::testSyncField
(
const Field<Type>& fld,
const CombineOp& cop,
const Type& zero
const Type& zero,
const scalar maxMag
) const
{
if (debug)
@ -303,7 +304,7 @@ void Foam::motionSmoother::testSyncField
forAll(syncedFld, i)
{
if (syncedFld[i] != fld[i])
if (mag(syncedFld[i] - fld[i]) > maxMag)
{
FatalErrorIn
(

View File

@ -265,7 +265,7 @@ Foam::List<Foam::polyPatch*> Foam::polyMeshAdder::combinePatches
// Copy patches0 with new sizes. First patches always come from
// mesh0 and will always be present.
for (label patchI = 0; patchI < patches0.size(); patchI++)
forAll(patches0, patchI)
{
// Originates from mesh0. Clone with new size & filter out empty
// patch.
@ -363,7 +363,7 @@ Foam::labelList Foam::polyMeshAdder::getFaceOrder
labelList oldToNew(owner.size(), -1);
// Leave boundary faces in order
for (label faceI = nInternalFaces; faceI < owner.size(); faceI++)
for (label faceI = nInternalFaces; faceI < owner.size(); ++faceI)
{
oldToNew[faceI] = faceI;
}

View File

@ -914,7 +914,7 @@ void Foam::addPatchCellLayer::setRefinement
vector disp = firstLayerDisp[patchPointI];
for (label i = 0; i < addedPoints_[patchPointI].size(); i++)
forAll(addedPoints_[patchPointI], i)
{
pt += disp;
@ -999,7 +999,7 @@ void Foam::addPatchCellLayer::setRefinement
face newFace(f.size());
for (label i = 0; i < addedCells[patchFaceI].size(); i++)
forAll(addedCells[patchFaceI], i)
{
forAll(f, fp)
{

View File

@ -262,7 +262,7 @@ void Foam::repatchPolyTopoChanger::changeAnchorPoint
label fVert = fp;
for (label i = 0; i < f.size(); i++)
forAll(f, i)
{
newFace[i] = f[fVert++];

View File

@ -29,15 +29,10 @@ License
#include "mapPolyMesh.H"
#include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void setUpdater::updateSets(const mapPolyMesh& morphMap) const
void Foam::setUpdater::updateSets(const mapPolyMesh& morphMap) const
{
//
// Update all sets in memory.
@ -106,8 +101,4 @@ void setUpdater::updateSets(const mapPolyMesh& morphMap) const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -200,7 +200,7 @@ void Foam::enrichedPatch::calcEnrichedFaces
// Go through the points and collect them based on
// weights from lower to higher. This gives the
// correct order of points along the edge.
for (label passI = 0; passI < edgePointWeights.size(); passI++)
forAll(edgePointWeights, passI)
{
// Max weight can only be one, so the sorting is
// done by elimination.
@ -351,7 +351,7 @@ void Foam::enrichedPatch::calcEnrichedFaces
// Go through the points and collect them based on
// weights from lower to higher. This gives the
// correct order of points along the edge.
for (label pass = 0; pass < edgePointWeights.size(); pass++)
forAll(edgePointWeights, passI)
{
// Max weight can only be one, so the sorting is
// done by elimination.

View File

@ -28,20 +28,18 @@ License
#include "fvcMeshPhi.H"
#include "surfaceInterpolate.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(fvMotionSolverEngineMesh, 0);
addToRunTimeSelectionTable(engineMesh, fvMotionSolverEngineMesh, IOobject);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(fvMotionSolverEngineMesh, 0);
addToRunTimeSelectionTable(engineMesh, fvMotionSolverEngineMesh, IOobject);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fvMotionSolverEngineMesh::fvMotionSolverEngineMesh(const IOobject& io)
Foam::fvMotionSolverEngineMesh::fvMotionSolverEngineMesh(const IOobject& io)
:
engineMesh(io),
pistonLayers_("pistonLayers", dimLength, 0.0),
@ -56,13 +54,13 @@ fvMotionSolverEngineMesh::fvMotionSolverEngineMesh(const IOobject& io)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
fvMotionSolverEngineMesh::~fvMotionSolverEngineMesh()
Foam::fvMotionSolverEngineMesh::~fvMotionSolverEngineMesh()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fvMotionSolverEngineMesh::move()
void Foam::fvMotionSolverEngineMesh::move()
{
scalar deltaZ = engineDB_.pistonDisplacement().value();
Info<< "deltaZ = " << deltaZ << endl;
@ -125,8 +123,4 @@ void fvMotionSolverEngineMesh::move()
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,21 +26,17 @@ License
#include "staticEngineMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(staticEngineMesh, 0);
addToRunTimeSelectionTable(engineMesh, staticEngineMesh, IOobject);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(staticEngineMesh, 0);
addToRunTimeSelectionTable(engineMesh, staticEngineMesh, IOobject);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct from objectRegistry, and read/write options
staticEngineMesh::staticEngineMesh(const IOobject& io)
Foam::staticEngineMesh::staticEngineMesh(const IOobject& io)
:
engineMesh(io)
{}
@ -48,18 +44,14 @@ staticEngineMesh::staticEngineMesh(const IOobject& io)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
staticEngineMesh::~staticEngineMesh()
Foam::staticEngineMesh::~staticEngineMesh()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void staticEngineMesh::move()
void Foam::staticEngineMesh::move()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,14 +26,10 @@ License
#include "ignition.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool ignition::igniting() const
bool Foam::ignition::igniting() const
{
if (!ignite())
{
@ -54,7 +50,7 @@ bool ignition::igniting() const
}
bool ignition::ignited() const
bool Foam::ignition::ignited() const
{
if (!ignite())
{
@ -75,8 +71,4 @@ bool ignition::ignited() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,14 +26,9 @@ License
#include "engineTime.H"
#include "ignition.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
ignition::ignition
Foam::ignition::ignition
(
const dictionary& combustionProperties,
const Time& db,
@ -59,7 +54,7 @@ ignition::ignition
}
ignition::ignition
Foam::ignition::ignition
(
const dictionary& combustionProperties,
const engineTime& edb,
@ -85,8 +80,4 @@ ignition::ignition
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -27,14 +27,9 @@ License
#include "Time.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void ignitionSite::findIgnitionCells(const fvMesh& mesh)
void Foam::ignitionSite::findIgnitionCells(const fvMesh& mesh)
{
// Bit tricky: generate C and V before shortcutting if cannot find
// cell locally. mesh.C generation uses parallel communication.
@ -90,7 +85,7 @@ void ignitionSite::findIgnitionCells(const fvMesh& mesh)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const labelList& ignitionSite::cells() const
const Foam::labelList& Foam::ignitionSite::cells() const
{
if (mesh_.changing() && timeIndex_ != db_.timeIndex())
{
@ -102,7 +97,7 @@ const labelList& ignitionSite::cells() const
}
bool ignitionSite::igniting() const
bool Foam::ignitionSite::igniting() const
{
scalar curTime = db_.value();
scalar deltaT = db_.deltaTValue();
@ -116,7 +111,7 @@ bool ignitionSite::igniting() const
}
bool ignitionSite::ignited() const
bool Foam::ignitionSite::ignited() const
{
scalar curTime = db_.value();
scalar deltaT = db_.deltaTValue();
@ -127,7 +122,7 @@ bool ignitionSite::ignited() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void ignitionSite::operator=(const ignitionSite& is)
void Foam::ignitionSite::operator=(const ignitionSite& is)
{
location_ = is.location_;
diameter_ = is.diameter_;
@ -139,8 +134,4 @@ void ignitionSite::operator=(const ignitionSite& is)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,14 +26,14 @@ License
#include "ignitionSite.H"
#include "engineTime.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
ignitionSite::ignitionSite(Istream& is, const Time& db, const fvMesh& mesh)
Foam::ignitionSite::ignitionSite
(
Istream& is,
const Time& db,
const fvMesh& mesh
)
:
db_(db),
mesh_(mesh),
@ -64,7 +64,7 @@ ignitionSite::ignitionSite(Istream& is, const Time& db, const fvMesh& mesh)
}
ignitionSite::ignitionSite
Foam::ignitionSite::ignitionSite
(
Istream& is,
const engineTime& edb,
@ -100,8 +100,4 @@ ignitionSite::ignitionSite
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -154,6 +154,7 @@ $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityK
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
$(derivedFvPatchFields)/swirlMassFlowRateInletVelocity/swirlMassFlowRateInletVelocityFvPatchVectorField.C
fvsPatchFields = fields/fvsPatchFields
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C

View File

@ -33,7 +33,7 @@ template<class Type>
const Foam::wordList Foam::TimeActivatedExplicitSource<Type>::
selectionModeTypeNames_
(
IStringStream("(points cellSet)")()
IStringStream("(points cellSet cellZone all)")()
);
@ -156,6 +156,15 @@ void Foam::TimeActivatedExplicitSource<Type>::setSelection
dict.lookup("cellSet") >> cellSetName_;
break;
}
case smCellZone:
{
dict.lookup("cellZone") >> cellSetName_;
break;
}
case smAll:
{
break;
}
default:
{
FatalErrorIn
@ -221,13 +230,14 @@ void Foam::TimeActivatedExplicitSource<Type>::setCellSet()
{
Info<< indent << "- selecting cells using points" << endl;
labelHashSet cellOwners;
labelHashSet selectedCells;
forAll(points_, i)
{
label cellI = mesh_.findCell(points_[i]);
if (cellI >= 0)
{
cellOwners.insert(cellI);
selectedCells.insert(cellI);
}
label globalCellI = returnReduce(cellI, maxOp<label>());
@ -239,7 +249,7 @@ void Foam::TimeActivatedExplicitSource<Type>::setCellSet()
}
}
cellsPtr_.reset(new cellSet(mesh_, "points", cellOwners));
cells_ = selectedCells.toc();
break;
}
@ -247,7 +257,32 @@ void Foam::TimeActivatedExplicitSource<Type>::setCellSet()
{
Info<< indent << "- selecting cells using cellSet "
<< cellSetName_ << endl;
cellsPtr_.reset(new cellSet(mesh_, cellSetName_));
cellSet selectedCells(mesh_, cellSetName_);
cells_ = selectedCells.toc();
break;
}
case smCellZone:
{
Info<< indent << "- selecting cells using cellZone "
<< cellSetName_ << endl;
label zoneID = mesh_.cellZones().findZoneID(cellSetName_);
if (zoneID == -1)
{
FatalErrorIn("TimeActivatedExplicitSource<Type>::setCellIds()")
<< "Cannot find cellZone " << cellSetName_ << endl
<< "Valid cellZones are " << mesh_.cellZones().names()
<< exit(FatalError);
}
cells_ = mesh_.cellZones()[zoneID];
break;
}
case smAll:
{
Info<< indent << "- selecting all cells" << endl;
cells_ = identity(mesh_.nCells());
break;
}
@ -261,21 +296,20 @@ void Foam::TimeActivatedExplicitSource<Type>::setCellSet()
}
}
const cellSet& cSet = cellsPtr_();
// Set volume normalisation
V_ = scalarField(cSet.size(), 1.0);
if (volumeMode_ == vmAbsolute)
{
label i = 0;
forAllConstIter(cellSet, cSet, iter)
V_ = 0.0;
forAll(cells_, i)
{
V_[i++] = mesh_.V()[iter.key()];
V_ += mesh_.V()[cells_[i]];
}
reduce(V_, sumOp<scalar>());
}
Info<< indent << "- selected " << returnReduce(cSet.size(), sumOp<label>())
<< " cell(s)" << nl << decrIndent << endl;
Info<< indent << "- selected "
<< returnReduce(cells_.size(), sumOp<label>())
<< " cell(s) with volume " << V_ << nl << decrIndent << endl;
}
@ -292,15 +326,14 @@ Foam::TimeActivatedExplicitSource<Type>::TimeActivatedExplicitSource
:
name_(name),
mesh_(mesh),
active_(dict.lookup("active")),
active_(readBool(dict.lookup("active"))),
timeStart_(readScalar(dict.lookup("timeStart"))),
duration_(readScalar(dict.lookup("duration"))),
volumeMode_(wordToVolumeModeType(dict.lookup("volumeMode"))),
selectionMode_(wordToSelectionModeType(dict.lookup("selectionMode"))),
points_(),
cellSetName_("none"),
V_(),
cellsPtr_(),
V_(1.0),
fieldData_(),
fieldIds_(fieldNames.size(), -1)
{
@ -345,12 +378,9 @@ void Foam::TimeActivatedExplicitSource<Type>::addToField
setCellSet();
}
const cellSet& cSet = cellsPtr_();
label i = 0;
forAllConstIter(cellSet, cSet, iter)
forAll(cells_, i)
{
Su[iter.key()] = fieldData_[fid].second()/V_[i++];
Su[cells_[i]] = fieldData_[fid].second()/V_;
}
}
}

View File

@ -33,7 +33,7 @@ Description
active true; // on/off switch
timeStart 0.2; // start time
duration 2.0; // duration
selectionMode points; // cellSet
selectionMode points; // cellSet/cellZone/all
volumeMode absolute; // specific
fieldData // field data - usage for multiple fields
@ -48,7 +48,8 @@ Description
(2.75 0.5 0)
);
cellSet c0; // cellSet name when selectionMode = cekllSet
cellSet c0; // cellSet name when selectionMode=cellSet
cellZone c0; // cellZone name when selectionMode=cellZone
}
SourceFiles
@ -100,7 +101,9 @@ public:
enum selectionModeType
{
smPoints,
smCellSet
smCellSet,
smCellZone,
smAll
};
//- Word list of selection mode type names
@ -147,14 +150,14 @@ protected:
//- List of points for "points" selectionMode
List<point> points_;
//- Name of cell set for "cellSet" selectionMode
//- Name of cell set for "cellSet" and "cellZone" selectionMode
word cellSetName_;
//- Field of cell volumes according to cell set cells
scalarList V_;
//- Set of cells to apply source to
labelList cells_;
//- Cell set
autoPtr<cellSet> cellsPtr_;
//- Sum of cell volumes
scalar V_;
//- List of source field name vs value pairs
List<fieldNameValuePair> fieldData_;
@ -288,12 +291,11 @@ public:
// selectionMode
inline const word& cellSetName() const;
//- Return const access to the field of cell volumes according to
// cell set cells
inline const scalarList& V() const;
//- Return const access to the total cell volume
inline scalar V() const;
//- Return const access to the cell set
inline const cellSet& cells() const;
inline const labelList& cells() const;
//- Return const access to the source field name vs value pairs
inline const List<fieldNameValuePair>& fieldData() const;
@ -330,12 +332,11 @@ public:
// selectionMode
inline word& cellSetName();
//- Return access to the field of cell volumes according to
// cell set cells
inline scalarList& V();
//- Return access to the total cell volume
inline scalar& V();
//- Return access to the cell set
inline cellSet& cells();
inline labelList& cells();
//- Return access to the source field name vs value pairs
inline List<fieldNameValuePair>& fieldData();

View File

@ -103,18 +103,17 @@ Foam::TimeActivatedExplicitSource<Type>::cellSetName() const
template<class Type>
inline const Foam::scalarList&
Foam::TimeActivatedExplicitSource<Type>::V() const
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::V() const
{
return V_;
}
template<class Type>
inline const Foam::cellSet&
inline const Foam::labelList&
Foam::TimeActivatedExplicitSource<Type>::cells() const
{
return cellsPtr_();
return cells_;
}
@ -195,16 +194,16 @@ inline Foam::word& Foam::TimeActivatedExplicitSource<Type>::cellSetName()
template<class Type>
inline Foam::scalarList& Foam::TimeActivatedExplicitSource<Type>::V()
inline Foam::scalar& Foam::TimeActivatedExplicitSource<Type>::V()
{
return V_;
}
template<class Type>
inline Foam::cellSet& Foam::TimeActivatedExplicitSource<Type>::cells()
inline Foam::labelList& Foam::TimeActivatedExplicitSource<Type>::cells()
{
return cellsPtr_();
return cells_;
}

View File

@ -76,7 +76,8 @@ public:
const dictionary&
);
//- Construct by mapping given basicSymmetryFvPatchField onto a new patch
//- Construct by mapping given basicSymmetryFvPatchField onto a new
// patch
basicSymmetryFvPatchField
(
const basicSymmetryFvPatchField<Type>&,

View File

@ -0,0 +1,200 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2006-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 "swirlMassFlowRateInletVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "surfaceFields.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(p, iF),
flowRate_(0),
phiName_("phi"),
rhoName_("rho"),
rpm_(0)
{}
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
flowRate_(ptf.flowRate_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{}
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict),
flowRate_(readScalar(dict.lookup("flowRate"))),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
rpm_(readScalar(dict.lookup("rpm")))
{}
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
flowRate_(ptf.flowRate_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_),
rpm_(ptf.rpm_)
{}
Foam::
swirlMassFlowRateInletVelocityFvPatchVectorField::
swirlMassFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(ptf, iF),
flowRate_(ptf.flowRate_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_),
rpm_(ptf.rpm_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
scalar totArea = gSum(patch().magSf());
// a simpler way of doing this would be nice
scalar avgU = -flowRate_/totArea;
vector center = gSum(patch().Cf()*patch().magSf())/totArea;
vector normal = gSum(patch().nf()*patch().magSf())/totArea;
vectorField tangVelo =
(rpm_*constant::mathematical::pi/30.0)
*(patch().Cf() - center) ^ normal;
vectorField n = patch().nf();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
if (phi.dimensions() == dimVelocity*dimArea)
{
// volumetric flow-rate
operator==(tangVelo + n*avgU);
}
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// mass flow-rate
operator==(tangVelo + n*avgU/rhop);
}
else
{
FatalErrorIn
(
"swirlMassFlowRateInletVelocityFvPatchVectorField::updateCoeffs()"
) << "dimensions of " << phiName_ << " are incorrect" << nl
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< nl << exit(FatalError);
}
fixedValueFvPatchField<vector>::updateCoeffs();
}
void Foam::swirlMassFlowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
swirlMassFlowRateInletVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,191 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 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::swirlMassFlowRateInletVelocityFvPatchVectorField
Description
Describes a volumetric/mass flow normal vector boundary condition by its
magnitude as an integral over its area with a swirl component determined
by the RPM
The basis of the patch (volumetric or mass) is determined by the
dimensions of the flux, phi.
The current density is used to correct the velocity when applying the
mass basis.
Example of the boundary condition specification:
@verbatim
inlet
{
type swirlMassFlowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
rpm 100;
}
@endverbatim
Note
- The value is positive inwards
SourceFiles
swirlMassFlowRateInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef swirlMassFlowRateInletVelocityFvPatchVectorField_H
#define swirlMassFlowRateInletVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class swirlMassFlowRateInletVelocityFvPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class swirlMassFlowRateInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Inlet integral flow rate
scalar flowRate_;
//- Name of the flux transporting the field
word phiName_;
//- Name of the density field used to normalize the mass flux
word rhoName_;
//- RPM
scalar rpm_;
public:
//- Runtime type information
TypeName("swirlMassFlowRateInletVelocity");
// Constructors
//- Construct from patch and internal field
swirlMassFlowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
swirlMassFlowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// flowRateInletVelocityFvPatchVectorField
// onto a new patch
swirlMassFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
swirlMassFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new swirlMassFlowRateInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
swirlMassFlowRateInletVelocityFvPatchVectorField
(
const swirlMassFlowRateInletVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new swirlMassFlowRateInletVelocityFvPatchVectorField(*this, iF)
);
}
// Member functions
// Access
//- Return the flux
scalar flowRate() const
{
return flowRate_;
}
//- Return reference to the flux to allow adjustment
scalar& flowRate()
{
return flowRate_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -31,10 +31,7 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(quadraticFitSnGradData, 0);
}
defineTypeNameAndDebug(Foam::quadraticFitSnGradData, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -205,7 +202,7 @@ Foam::label Foam::quadraticFitSnGradData::calcFit
// calculate the matrix of the polynomial components
scalarRectangularMatrix B(C.size(), minSize_, scalar(0));
for (label ip = 0; ip < C.size(); ip++)
forAll(C, ip)
{
const point& p = C[ip];

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,16 +70,33 @@ Foam::fvBoundaryMesh::fvBoundaryMesh
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fvBoundaryMesh::movePoints()
Foam::label Foam::fvBoundaryMesh::findPatchID(const word& patchName) const
{
forAll(*this, patchi)
const fvPatchList& patches = *this;
forAll(patches, patchI)
{
operator[](patchi).initMovePoints();
if (patches[patchI].name() == patchName)
{
return patchI;
}
}
forAll(*this, patchi)
// Not found, return -1
return -1;
}
void Foam::fvBoundaryMesh::movePoints()
{
forAll(*this, patchI)
{
operator[](patchi).movePoints();
operator[](patchI).initMovePoints();
}
forAll(*this, patchI)
{
operator[](patchI).movePoints();
}
}
@ -88,14 +105,14 @@ Foam::lduInterfacePtrsList Foam::fvBoundaryMesh::interfaces() const
{
lduInterfacePtrsList interfaces(size());
forAll(interfaces, patchi)
forAll(interfaces, patchI)
{
if (isA<lduInterface>(this->operator[](patchi)))
if (isA<lduInterface>(this->operator[](patchI)))
{
interfaces.set
(
patchi,
&refCast<const lduInterface>(this->operator[](patchi))
patchI,
&refCast<const lduInterface>(this->operator[](patchI))
);
}
}
@ -111,4 +128,46 @@ void Foam::fvBoundaryMesh::readUpdate(const polyBoundaryMesh& basicBdry)
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
const Foam::fvPatch& Foam::fvBoundaryMesh::operator[]
(
const word& patchName
) const
{
const label patchI = findPatchID(patchName);
if (patchI < 0)
{
FatalErrorIn
(
"fvBoundaryMesh::operator[](const word&) const"
) << "Patch named " << patchName << " not found." << nl
<< abort(FatalError);
}
return operator[](patchI);
}
Foam::fvPatch& Foam::fvBoundaryMesh::operator[]
(
const word& patchName
)
{
const label patchI = findPatchID(patchName);
if (patchI < 0)
{
FatalErrorIn
(
"fvBoundaryMesh::operator[](const word&)"
) << "Patch named " << patchName << " not found." << nl
<< abort(FatalError);
}
return operator[](patchI);
}
// ************************************************************************* //

View File

@ -54,8 +54,6 @@ class fvBoundaryMesh
:
public fvPatchList
{
private:
// Private data
//- Reference to mesh
@ -101,7 +99,7 @@ public:
);
// Member functions
// Member Functions
// Access
@ -115,9 +113,24 @@ public:
// with only those pointing to interfaces being set
lduInterfacePtrsList interfaces() const;
//- Find patch index given a name
label findPatchID(const word& patchName) const;
//- Correct patches after moving points
void movePoints();
// Member Operators
//- Return const and non-const reference to fvPatch by index.
using fvPatchList::operator[];
//- Return const reference to fvPatch by name.
const fvPatch& operator[](const word&) const;
//- Return reference to fvPatch by name.
fvPatch& operator[](const word&);
};

View File

@ -164,7 +164,7 @@ void Foam::FitData<FitDataType, ExtendedStencil, Polynomial>::calcFit
// Matrix of the polynomial components
scalarRectangularMatrix B(C.size(), minSize_, scalar(0));
for (label ip = 0; ip < C.size(); ip++)
forAll(C, ip)
{
const point& p = C[ip];

View File

@ -148,8 +148,7 @@ displacementInterpolationFvMotionSolver
forAll(faceZoneToTable, i)
{
const word& zoneName = faceZoneToTable[i][0];
label zoneI = fZones.findZoneID(zoneName);
const faceZone& fz = fZones[zoneI];
const faceZone& fz = fZones[zoneName];
scalar minCoord = VGREAT;
scalar maxCoord = -VGREAT;

View File

@ -353,8 +353,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::cellZoneSolve
const dictionary& faceZoneDict = patchIter().dict();
// Determine the points of the faceZone within the cellZone
label zoneI = mesh().faceZones().findZoneID(faceZoneName);
const faceZone& fz = mesh().faceZones()[zoneI];
const faceZone& fz = mesh().faceZones()[faceZoneName];
const labelList& fzMeshPoints = fz().meshPoints();
DynamicList<label> meshPoints(fzMeshPoints.size());
forAll(fzMeshPoints, i)

View File

@ -78,7 +78,7 @@ void Foam::inverseFaceDistanceDiffusivity::correct()
forAll(patchNames_, i)
{
label pID = bdry.findPatchID(patchNames_[i]);
const label pID = bdry.findPatchID(patchNames_[i]);
if (pID > -1)
{

View File

@ -78,7 +78,7 @@ void Foam::inversePointDistanceDiffusivity::correct()
forAll(patchNames_, i)
{
label pID = bdry.findPatchID(patchNames_[i]);
const label pID = bdry.findPatchID(patchNames_[i]);
if (pID > -1)
{

View File

@ -87,7 +87,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection
{
const pointZoneMesh& pZones = mesh.pointZones();
zonePtr = &pZones[pZones.findZoneID(frozenPointsZone_)];
zonePtr = &pZones[frozenPointsZone_];
Pout<< "surfaceDisplacementPointPatchVectorField : Fixing all "
<< zonePtr->size() << " points in pointZone " << zonePtr->name()

View File

@ -86,7 +86,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
{
const pointZoneMesh& pZones = mesh.pointZones();
zonePtr = &pZones[pZones.findZoneID(frozenPointsZone_)];
zonePtr = &pZones[frozenPointsZone_];
Pout<< "surfaceSlipDisplacementPointPatchVectorField : Fixing all "
<< zonePtr->size() << " points in pointZone " << zonePtr->name()

View File

@ -269,9 +269,9 @@ void Foam::globalIndexAndTransform::determineTransformPermutations()
// Invert the ternary index encoding using repeated division by
// three
for (label b = 0; b < transforms_.size(); b++)
forAll(transforms_, b)
{
label w = (transformIndex % 3) - 1;
const label w = (transformIndex % 3) - 1;
transformIndex /= 3;

View File

@ -49,7 +49,7 @@ Foam::label Foam::globalIndexAndTransform::encodeTransformIndex
label w = 1;
for (label b = 0; b < transforms_.size(); b++)
forAll(transforms_, b)
{
if (mag(permutationIndices[b]) > 1)
{

View File

@ -25,19 +25,14 @@ License
#include "indexedParticleCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineParticleTypeNameAndDebug(indexedParticle, 0);
defineTemplateTypeNameAndDebug(Cloud<indexedParticle>, 0);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineParticleTypeNameAndDebug(indexedParticle, 0);
defineTemplateTypeNameAndDebug(Cloud<indexedParticle>, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -123,7 +123,8 @@ Foam::scalar Foam::COxidationDiffusionLimitedRate<CloudType>::calculate
const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
// Change in C mass [kg]
scalar dmC = 4.0*constant::mathematical::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt;
scalar dmC =
4.0*constant::mathematical::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt;
// Limit mass transfer by availability of C
dmC = min(mass*fComb, dmC);

View File

@ -140,7 +140,7 @@ Foam::scalar Foam::COxidationKineticDiffusionLimitedRate<CloudType>::calculate
const scalar Ap = constant::mathematical::pi*sqr(d);
// Change in C mass [kg]
scalar dmC = Ap*rhoc*specie::RR*Tc*YO2/WO2_*D0*Rk/(D0 + Rk);
scalar dmC = Ap*rhoc*specie::RR*Tc*YO2/WO2_*D0*Rk/(D0 + Rk)*dt;
// Limit mass transfer by availability of C
dmC = min(mass*fComb, dmC);

View File

@ -26,14 +26,10 @@ License
#include "injector.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
injector::injector(const Time& t, Istream& is)
Foam::injector::injector(const Time& t, Istream& is)
:
injectorDict_(is),
properties_(injectorType::New(t, injectorDict_))
@ -46,7 +42,7 @@ injector::injector(const Time& t, Istream& is)
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Ostream& operator<<(Ostream& os, const injector& injector)
Foam::Ostream& Foam::operator<<(Ostream& os, const injector& injector)
{
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const injector&)");
@ -57,8 +53,4 @@ Ostream& operator<<(Ostream& os, const injector& injector)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,15 +26,10 @@ License
#include "parcel.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// The diameter based Reynolds number
scalar parcel::Re
Foam::scalar Foam::parcel::Re
(
const vector& U,
const scalar nu
@ -44,7 +39,7 @@ scalar parcel::Re
}
// The diameter based Reynolds number
scalar parcel::Re
Foam::scalar Foam::parcel::Re
(
const scalar rho,
const vector& U,
@ -56,7 +51,7 @@ scalar parcel::Re
}
// The diameter based Weber number
scalar parcel::We
Foam::scalar Foam::parcel::We
(
const vector& U,
const scalar rho,
@ -67,7 +62,7 @@ scalar parcel::We
}
scalar parcel::Sc
Foam::scalar Foam::parcel::Sc
(
const scalar mu,
const scalar rho,
@ -78,7 +73,7 @@ scalar parcel::Sc
}
scalar parcel::Sc
Foam::scalar Foam::parcel::Sc
(
const scalar nu,
const scalar massDiffusion
@ -88,7 +83,7 @@ scalar parcel::Sc
}
scalar parcel::Pr
Foam::scalar Foam::parcel::Pr
(
const scalar cp,
const scalar mu,
@ -99,26 +94,22 @@ scalar parcel::Pr
}
scalar parcel::N(const scalar rho) const
Foam::scalar Foam::parcel::N(const scalar rho) const
{
return 6.0*m_/(rho*pow3(d_)*constant::mathematical::pi);
}
scalar parcel::Vd() const
Foam::scalar Foam::parcel::Vd() const
{
return pow3(d_)*constant::mathematical::pi/6.0;
}
scalar parcel::V(const scalar rho) const
Foam::scalar Foam::parcel::V(const scalar rho) const
{
return m_/rho;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -31,14 +31,10 @@ License
#include "heatTransferModel.H"
#include "basicMultiComponentMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void parcel::setRelaxationTimes
void Foam::parcel::setRelaxationTimes
(
label celli,
scalar& tauMomentum,
@ -55,7 +51,6 @@ void parcel::setRelaxationTimes
const scalar dt
)
{
const liquidMixture& fuels = sDB.fuels();
scalar mCell = rho*sDB.mesh().V()[cell()];
@ -258,7 +253,7 @@ void parcel::setRelaxationTimes
scalar vapourSurfaceEnthalpy = 0.0;
scalar vapourFarEnthalpy = 0.0;
for (label k = 0; k < sDB.gasProperties().size(); k++)
forAll(sDB.gasProperties(), k)
{
vapourSurfaceEnthalpy += sDB.composition().Y()[k][celli]*sDB.gasProperties()[k].H(tBoilingSurface);
vapourFarEnthalpy += sDB.composition().Y()[k][celli]*sDB.gasProperties()[k].H(temperature);
@ -292,8 +287,4 @@ void parcel::setRelaxationTimes
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -26,14 +26,10 @@ License
#include "spray.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
scalar spray::injectedMass(const scalar t) const
Foam::scalar Foam::spray::injectedMass(const scalar t) const
{
scalar sum = 0.0;
@ -46,7 +42,7 @@ scalar spray::injectedMass(const scalar t) const
}
scalar spray::totalMassToInject() const
Foam::scalar Foam::spray::totalMassToInject() const
{
scalar sum = 0.0;
@ -59,7 +55,7 @@ scalar spray::totalMassToInject() const
}
scalar spray::injectedEnthalpy
Foam::scalar Foam::spray::injectedEnthalpy
(
const scalar time
) const
@ -89,7 +85,7 @@ scalar spray::injectedEnthalpy
}
scalar spray::liquidMass() const
Foam::scalar Foam::spray::liquidMass() const
{
scalar sum = 0.0;
@ -109,7 +105,7 @@ scalar spray::liquidMass() const
}
scalar spray::liquidEnthalpy() const
Foam::scalar Foam::spray::liquidEnthalpy() const
{
scalar sum = 0.0;
label Nf = fuels().components().size();
@ -146,7 +142,7 @@ scalar spray::liquidEnthalpy() const
}
scalar spray::liquidTotalEnthalpy() const
Foam::scalar Foam::spray::liquidTotalEnthalpy() const
{
scalar sum = 0.0;
label Nf = fuels().components().size();
@ -186,7 +182,7 @@ scalar spray::liquidTotalEnthalpy() const
}
scalar spray::liquidKineticEnergy() const
Foam::scalar Foam::spray::liquidKineticEnergy() const
{
scalar sum = 0.0;
@ -208,19 +204,19 @@ scalar spray::liquidKineticEnergy() const
}
scalar spray::injectedLiquidKineticEnergy() const
Foam::scalar Foam::spray::injectedLiquidKineticEnergy() const
{
return injectedLiquidKE_;
}
scalar spray::liquidPenetration(const scalar prc) const
Foam::scalar Foam::spray::liquidPenetration(const scalar prc) const
{
return liquidPenetration(0, prc);
}
scalar spray::liquidPenetration
Foam::scalar Foam::spray::liquidPenetration
(
const label nozzlei,
const scalar prc
@ -349,7 +345,7 @@ scalar spray::liquidPenetration
}
scalar spray::smd() const
Foam::scalar Foam::spray::smd() const
{
scalar numerator = 0.0, denominator = VSMALL;
@ -372,7 +368,7 @@ scalar spray::smd() const
}
scalar spray::maxD() const
Foam::scalar Foam::spray::maxD() const
{
scalar maxD = 0.0;
@ -387,20 +383,16 @@ scalar spray::maxD() const
}
void spray::calculateAmbientPressure()
void Foam::spray::calculateAmbientPressure()
{
ambientPressure_ = p_.average().value();
}
void spray::calculateAmbientTemperature()
void Foam::spray::calculateAmbientTemperature()
{
ambientTemperature_ = T_.average().value();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -31,12 +31,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void spray::inject()
void Foam::spray::inject()
{
scalar time = runTime_.value();
scalar time0 = time0_;
@ -172,8 +167,4 @@ void spray::inject()
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -346,7 +346,7 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
{
ParcelType& p = static_cast<ParcelType&>(*this);
// Invoke poost-processing mdoel
// Invoke post-processing model
td.cloud().postProcessing().postPatch(p, patchI);
// Invoke surface film model

View File

@ -212,7 +212,12 @@ Foam::scalar Foam::InjectionModel<CloudType>::setNumberOfParticles
}
case pbNumber:
{
nP = massTotal_/(rho*volumeTotal_*parcels);
nP = massTotal_/(rho*volumeTotal_);
break;
}
case pbFixed:
{
nP = nParticlesFixed_;
break;
}
default:
@ -285,6 +290,7 @@ Foam::InjectionModel<CloudType>::InjectionModel(CloudType& owner)
nInjections_(0),
parcelsAddedTotal_(0),
parcelBasis_(pbNumber),
nParticlesFixed_(0.0),
time0_(0.0),
timeStep0_(0.0)
{
@ -310,6 +316,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
nInjections_(0),
parcelsAddedTotal_(0),
parcelBasis_(pbNumber),
nParticlesFixed_(0.0),
time0_(owner.db().time().value()),
timeStep0_(0.0)
{
@ -320,6 +327,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
<< endl;
const word parcelBasisType = coeffDict_.lookup("parcelBasisType");
if (parcelBasisType == "mass")
{
parcelBasis_ = pbMass;
@ -328,6 +336,16 @@ Foam::InjectionModel<CloudType>::InjectionModel
{
parcelBasis_ = pbNumber;
}
else if (parcelBasisType == "fixed")
{
parcelBasis_ = pbFixed;
Info<< " Choosing nParticles to be a fixed value, massTotal "
<< "variable now does not determine anything."
<< endl;
nParticlesFixed_ = readScalar(coeffDict_.lookup("nParticles"));
}
else
{
FatalErrorIn
@ -338,7 +356,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
"CloudType&, "
"const word&"
")"
)<< "parcelBasisType must be either 'number' or 'mass'" << nl
)<< "parcelBasisType must be either 'number', 'mass' or 'fixed'" << nl
<< exit(FatalError);
}

View File

@ -73,7 +73,8 @@ public:
enum parcelBasis
{
pbNumber,
pbMass
pbMass,
pbFixed
};
@ -137,6 +138,10 @@ protected:
//- Parcel basis enumeration
parcelBasis parcelBasis_;
//- nParticles to assign to parcels when the 'fixed' basis
// is selected
scalar nParticlesFixed_;
//- Continuous phase time at start of injection time step [s]
scalar time0_;

View File

@ -76,9 +76,6 @@ class ManualInjection
//- Parcel size PDF model
const autoPtr<pdfs::pdf> parcelPDF_;
//- Number of particles represented by each parcel
scalar nParticlesPerParcel_;
protected:

View File

@ -101,7 +101,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
cellOwners_(),
fraction_(1.0)
{
label patchId = owner.mesh().boundaryMesh().findPatchID(patchName_);
const label patchId = owner.mesh().boundaryMesh().findPatchID(patchName_);
if (patchId < 0)
{

View File

@ -128,7 +128,7 @@ Foam::PatchPostProcessing<CloudType>::PatchPostProcessing
{
forAll(patchNames_, patchI)
{
label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]);
const label id = mesh_.boundaryMesh().findPatchID(patchNames_[patchI]);
if (id < 0)
{
FatalErrorIn

View File

@ -25,15 +25,14 @@ License
#include "energyScalingFunction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(energyScalingFunction, 0);
defineRunTimeSelectionTable(energyScalingFunction, dictionary);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(energyScalingFunction, 0);
defineRunTimeSelectionTable(energyScalingFunction, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -64,8 +63,4 @@ bool Foam::energyScalingFunction::read
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -70,9 +70,7 @@ Foam::Map<Foam::label> Foam::autoSnapDriver::getZoneBafflePatches
if (faceZoneNames[surfI].size())
{
// Get zone
label zoneI = fZones.findZoneID(faceZoneNames[surfI]);
const faceZone& fZone = fZones[zoneI];
const faceZone& fZone = fZones[faceZoneNames[surfI]];
//// Get patch allocated for zone
//label patchI = surfaceToCyclicPatch_[surfI];
@ -1287,11 +1285,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
forAll(zonedSurfaces, i)
{
label zoneSurfI = zonedSurfaces[i];
label zoneI = fZones.findZoneID(faceZoneNames[zoneSurfI]);
const faceZone& fZone = fZones[zoneI];
const label zoneSurfI = zonedSurfaces[i];
const faceZone& fZone = fZones[faceZoneNames[zoneSurfI]];
forAll(fZone, i)
{

View File

@ -258,6 +258,8 @@ void Foam::meshRefinement::checkData()
meshCutter_.checkRefinementLevels(1, labelList(0));
label nBnd = mesh_.nFaces()-mesh_.nInternalFaces();
Pout<< "meshRefinement::checkData() : Checking synchronization."
<< endl;
@ -267,7 +269,7 @@ void Foam::meshRefinement::checkData()
pointField::subList boundaryFc
(
mesh_.faceCentres(),
mesh_.nFaces()-mesh_.nInternalFaces(),
nBnd,
mesh_.nInternalFaces()
);
@ -292,8 +294,8 @@ void Foam::meshRefinement::checkData()
// Check meshRefinement
{
// Get boundary face centre and level. Coupled aware.
labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces());
pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces());
labelList neiLevel(nBnd);
pointField neiCc(nBnd);
calcNeighbourData(neiLevel, neiCc);
// Collect segments we want to test for
@ -327,11 +329,22 @@ void Foam::meshRefinement::checkData()
surfaceLevel
);
}
// Get the coupled hit
labelList neiHit
(
SubList<label>
(
surfaceHit,
nBnd,
mesh_.nInternalFaces()
)
);
syncTools::swapBoundaryFaceList(mesh_, neiHit);
// Check
forAll(surfaceHit, faceI)
{
if (surfaceHit[faceI] != surfaceIndex_[faceI])
if (surfaceIndex_[faceI] != surfaceHit[faceI])
{
if (mesh_.isInternalFace(faceI))
{
@ -346,7 +359,11 @@ void Foam::meshRefinement::checkData()
<< mesh_.cellCentres()[mesh_.faceNeighbour()[faceI]]
<< endl;
}
else
else if
(
surfaceIndex_[faceI]
!= neiHit[faceI-mesh_.nInternalFaces()]
)
{
WarningIn("meshRefinement::checkData()")
<< "Boundary face:" << faceI
@ -355,6 +372,7 @@ void Foam::meshRefinement::checkData()
<< " current:" << surfaceHit[faceI]
<< " ownCc:"
<< mesh_.cellCentres()[mesh_.faceOwner()[faceI]]
<< " end:" << end[faceI]
<< endl;
}
}
@ -1118,9 +1136,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
if (fzNames[surfI].size())
{
// Get zone
label zoneI = fZones.findZoneID(fzNames[surfI]);
const faceZone& fZone = fZones[zoneI];
const faceZone& fZone = fZones[fzNames[surfI]];
forAll(fZone, i)
{
@ -1538,7 +1554,7 @@ Foam::label Foam::meshRefinement::addPatch
polyBoundaryMesh& polyPatches =
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
label patchI = polyPatches.findPatchID(patchName);
const label patchI = polyPatches.findPatchID(patchName);
if (patchI != -1)
{
if (polyPatches[patchI].type() == patchType)

View File

@ -436,6 +436,16 @@ private:
labelList& cellToZone
) const;
//- Finds zone per cell for cells inside named surfaces that have
// an inside point specified.
void findCellZoneInsideWalk
(
const labelList& locationSurfaces,
const labelList& namedSurfaceIndex,
const labelList& surfaceToCellZone,
labelList& cellToZone
) const;
//- Determines cell zone from cell region information.
bool calcRegionToZone
(

View File

@ -1059,6 +1059,106 @@ void Foam::meshRefinement::findCellZoneGeometric
// Sync
syncTools::syncFaceList(mesh_, namedSurfaceIndex, maxEqOp<label>());
}
//XXXXXXXXX
void Foam::meshRefinement::findCellZoneInsideWalk
(
const labelList& locationSurfaces, // indices of surfaces with inside point
const labelList& namedSurfaceIndex, // per face index of named surface
const labelList& surfaceToCellZone, // cell zone index per surface
labelList& cellToZone
) const
{
// Analyse regions. Reuse regionsplit
boolList blockedFace(mesh_.nFaces());
forAll(namedSurfaceIndex, faceI)
{
if (namedSurfaceIndex[faceI] == -1)
{
blockedFace[faceI] = false;
}
else
{
blockedFace[faceI] = true;
}
}
// No need to sync since namedSurfaceIndex already is synced
// Set region per cell based on walking
regionSplit cellRegion(mesh_, blockedFace);
blockedFace.clear();
// For all locationSurface find the cell
forAll(locationSurfaces, i)
{
label surfI = locationSurfaces[i];
const point& insidePoint = surfaces_.zoneInsidePoints()[surfI];
Info<< "For surface " << surfaces_.names()[surfI]
<< " finding inside point " << insidePoint
<< endl;
// Find the region containing the insidePoint
label keepRegionI = -1;
label cellI = mesh_.findCell(insidePoint);
if (cellI != -1)
{
keepRegionI = cellRegion[cellI];
}
reduce(keepRegionI, maxOp<label>());
Info<< "For surface " << surfaces_.names()[surfI]
<< " found point " << insidePoint << " in cell " << cellI
<< " in global region " << keepRegionI
<< " out of " << cellRegion.nRegions() << " regions." << endl;
if (keepRegionI == -1)
{
FatalErrorIn
(
"meshRefinement::findCellZoneInsideWalk"
"(const labelList&, const labelList&"
", const labelList&, const labelList&)"
) << "Point " << insidePoint
<< " is not inside the mesh." << nl
<< "Bounding box of the mesh:" << mesh_.globalData().bb()
<< exit(FatalError);
}
// Set all cells with this region
forAll(cellRegion, cellI)
{
if (cellRegion[cellI] == keepRegionI)
{
if (cellToZone[cellI] == -2)
{
cellToZone[cellI] = surfaceToCellZone[surfI];
}
else if (cellToZone[cellI] != surfaceToCellZone[surfI])
{
WarningIn
(
"meshRefinement::findCellZoneInsideWalk"
"(const labelList&, const labelList&"
", const labelList&, const labelList&)"
) << "Cell " << cellI
<< " at " << mesh_.cellCentres()[cellI]
<< " is inside surface " << surfaces_.names()[surfI]
<< " but already marked as being in zone "
<< cellToZone[cellI] << endl
<< "This can happen if your surfaces are not"
<< " (sufficiently) closed."
<< endl;
}
}
}
}
}
//XXXXXXXXX
bool Foam::meshRefinement::calcRegionToZone
@ -1227,6 +1327,7 @@ void Foam::meshRefinement::findCellZoneTopo
{
label surfI = namedSurfaceIndex[faceI];
// Connected even if no cellZone defined for surface
if (surfI != -1)
{
// Calculate region to zone from cellRegions on either side
@ -1279,6 +1380,7 @@ void Foam::meshRefinement::findCellZoneTopo
label surfI = namedSurfaceIndex[faceI];
// Connected even if no cellZone defined for surface
if (surfI != -1)
{
bool changedCell = calcRegionToZone
@ -2286,9 +2388,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
// Put the cells into the correct zone
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Closed surfaces with cellZone specified.
labelList closedNamedSurfaces(surfaces_.getClosedNamedSurfaces());
// Zone per cell:
// -2 : unset
// -1 : not in any zone
@ -2299,6 +2398,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
// Set using geometric test
// ~~~~~~~~~~~~~~~~~~~~~~~~
// Closed surfaces with cellZone specified.
labelList closedNamedSurfaces(surfaces_.getClosedNamedSurfaces());
if (closedNamedSurfaces.size())
{
Info<< "Found " << closedNamedSurfaces.size()
@ -2308,17 +2410,41 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
findCellZoneGeometric
(
closedNamedSurfaces, // indices of closed surfaces
namedSurfaceIndex, // per face index of named surface
surfaceToCellZone, // cell zone index per surface
closedNamedSurfaces, // indices of closed surfaces
namedSurfaceIndex, // per face index of named surface
surfaceToCellZone, // cell zone index per surface
cellToZone
);
}
// Set using provided locations
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList locationSurfaces(surfaces_.getInsidePointNamedSurfaces());
if (locationSurfaces.size())
{
Info<< "Found " << locationSurfaces.size()
<< " named surfaces with a provided inside point."
<< " Assigning cells inside these surfaces"
<< " to the corresponding cellZone."
<< nl << endl;
findCellZoneInsideWalk
(
locationSurfaces, // indices of closed surfaces
namedSurfaceIndex, // per face index of named surface
surfaceToCellZone, // cell zone index per surface
cellToZone
);
}
// Set using walking
// ~~~~~~~~~~~~~~~~~
//if (!allowFreeStandingZoneFaces)
{
Info<< "Walking from location-in-mesh " << keepPoint
<< " to assign cellZones "
@ -2330,6 +2456,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
keepPoint,
namedSurfaceIndex,
surfaceToCellZone,
cellToZone
);
}

View File

@ -32,6 +32,21 @@ License
#include "searchableSurfacesQueries.H"
#include "UPtrList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char*
Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>::names[] =
{
"inside",
"outside",
"insidePoint",
"none"
};
const Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>
Foam::refinementSurfaces::areaSelectionAlgoNames;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -47,7 +62,8 @@ Foam::refinementSurfaces::refinementSurfaces
names_(surfaceDicts.size()),
faceZoneNames_(surfaceDicts.size()),
cellZoneNames_(surfaceDicts.size()),
zoneInside_(surfaceDicts.size()),
zoneInside_(surfaceDicts.size(), NONE),
zoneInsidePoints_(surfaceDicts.size()),
regionOffset_(surfaceDicts.size())
{
labelList globalMinLevel(surfaceDicts.size(), 0);
@ -74,19 +90,51 @@ Foam::refinementSurfaces::refinementSurfaces
globalMaxLevel[surfI] = readLabel(dict.lookup("maxRefinementLevel"));
// Global zone names per surface
if (dict.found("faceZone"))
if (dict.readIfPresent("faceZone", faceZoneNames_[surfI]))
{
dict.lookup("faceZone") >> faceZoneNames_[surfI];
bool hasSide = dict.readIfPresent("zoneInside", zoneInside_[surfI]);
// Read optional entry to determine inside of faceZone
word method;
bool hasSide = dict.readIfPresent("cellZoneInside", method);
if (hasSide)
{
zoneInside_[surfI] = areaSelectionAlgoNames[method];
if (zoneInside_[surfI] == INSIDEPOINT)
{
dict.lookup("insidePoint") >> zoneInsidePoints_[surfI];
}
}
else
{
// Check old syntax
bool inside;
if (dict.readIfPresent("zoneInside", inside))
{
hasSide = true;
zoneInside_[surfI] = (inside ? INSIDE : OUTSIDE);
}
}
// Read optional cellZone name
if (dict.readIfPresent("cellZone", cellZoneNames_[surfI]))
{
if (hasSide && !allGeometry_[surfaces_[surfI]].hasVolumeType())
if
(
(
zoneInside_[surfI] == INSIDE
|| zoneInside_[surfI] == OUTSIDE
)
&& !allGeometry_[surfaces_[surfI]].hasVolumeType()
)
{
IOWarningIn
(
"refinementSurfaces::refinementSurfaces(..)",
dict
) << "Unused entry zoneInside for faceZone "
) << "Illegal entry zoneInside "
<< areaSelectionAlgoNames[zoneInside_[surfI]]
<< " for faceZone "
<< faceZoneNames_[surfI]
<< " since surface " << names_[surfI]
<< " is not closed." << endl;
@ -282,7 +330,8 @@ Foam::refinementSurfaces::refinementSurfaces
names_(surfacesDict.size()),
faceZoneNames_(surfacesDict.size()),
cellZoneNames_(surfacesDict.size()),
zoneInside_(surfacesDict.size()),
zoneInside_(surfacesDict.size(), NONE),
zoneInsidePoints_(surfacesDict.size()),
regionOffset_(surfacesDict.size())
{
// Wilcard specification : loop over all surface, all regions
@ -305,7 +354,7 @@ Foam::refinementSurfaces::refinementSurfaces
names_.setSize(surfI);
faceZoneNames_.setSize(surfI);
cellZoneNames_.setSize(surfI);
zoneInside_.setSize(surfI);
zoneInside_.setSize(surfI, NONE);
regionOffset_.setSize(surfI);
labelList globalMinLevel(surfI, 0);
@ -332,19 +381,42 @@ Foam::refinementSurfaces::refinementSurfaces
globalMaxLevel[surfI] = refLevel[1];
// Global zone names per surface
if (dict.found("faceZone"))
if (dict.readIfPresent("faceZone", faceZoneNames_[surfI]))
{
dict.lookup("faceZone") >> faceZoneNames_[surfI];
bool hasSide = dict.readIfPresent
(
"zoneInside",
zoneInside_[surfI]
);
// Read optional entry to determine inside of faceZone
word method;
bool hasSide = dict.readIfPresent("cellZoneInside", method);
if (hasSide)
{
zoneInside_[surfI] = areaSelectionAlgoNames[method];
if (zoneInside_[surfI] == INSIDEPOINT)
{
dict.lookup("insidePoint") >> zoneInsidePoints_[surfI];
}
}
else
{
// Check old syntax
bool inside;
if (dict.readIfPresent("zoneInside", inside))
{
hasSide = true;
zoneInside_[surfI] = (inside ? INSIDE : OUTSIDE);
}
}
// Read optional cellZone name
if (dict.readIfPresent("cellZone", cellZoneNames_[surfI]))
{
if
(
hasSide
(
zoneInside_[surfI] == INSIDE
|| zoneInside_[surfI] == OUTSIDE
)
&& !allGeometry_[surfaces_[surfI]].hasVolumeType()
)
{
@ -352,7 +424,9 @@ Foam::refinementSurfaces::refinementSurfaces
(
"refinementSurfaces::refinementSurfaces(..)",
dict
) << "Unused entry zoneInside for faceZone "
) << "Illegal entry zoneInside "
<< areaSelectionAlgoNames[zoneInside_[surfI]]
<< " for faceZone "
<< faceZoneNames_[surfI]
<< " since surface " << names_[surfI]
<< " is not closed." << endl;
@ -533,12 +607,36 @@ Foam::labelList Foam::refinementSurfaces::getClosedNamedSurfaces() const
label closedI = 0;
forAll(cellZoneNames_, surfI)
{
if (cellZoneNames_[surfI].size())
if
(
cellZoneNames_[surfI].size()
&& (
zoneInside_[surfI] == INSIDE
|| zoneInside_[surfI] == OUTSIDE
)
&& allGeometry_[surfaces_[surfI]].hasVolumeType()
)
{
if (allGeometry_[surfaces_[surfI]].hasVolumeType())
{
closed[closedI++] = surfI;
}
closed[closedI++] = surfI;
}
}
closed.setSize(closedI);
return closed;
}
// Get indices of named surfaces with a
Foam::labelList Foam::refinementSurfaces::getInsidePointNamedSurfaces() const
{
labelList closed(cellZoneNames_.size());
label closedI = 0;
forAll(cellZoneNames_, surfI)
{
if (cellZoneNames_[surfI].size() && zoneInside_[surfI] == INSIDEPOINT)
{
closed[closedI++] = surfI;
}
}
closed.setSize(closedI);
@ -1199,6 +1297,16 @@ void Foam::refinementSurfaces::findInside
{
label surfI = testSurfaces[i];
if (zoneInside_[surfI] != INSIDE && zoneInside_[surfI] != OUTSIDE)
{
FatalErrorIn("refinementSurfaces::findInside(..)")
<< "Trying to use surface "
<< allGeometry_[surfaces_[surfI]].name()
<< " which has non-geometric inside selection method "
<< areaSelectionAlgoNames[zoneInside_[surfI]]
<< exit(FatalError);
}
if (allGeometry_[surfaces_[surfI]].hasVolumeType())
{
List<searchableSurface::volumeType> volType;
@ -1212,11 +1320,11 @@ void Foam::refinementSurfaces::findInside
(
(
volType[pointI] == triSurfaceMesh::INSIDE
&& zoneInside_[surfI]
&& zoneInside_[surfI] == INSIDE
)
|| (
volType[pointI] == triSurfaceMesh::OUTSIDE
&& !zoneInside_[surfI]
&& zoneInside_[surfI] == OUTSIDE
)
)
{

View File

@ -57,6 +57,21 @@ class triSurfaceMesh;
class refinementSurfaces
{
public:
//- Types of selection of area
enum areaSelectionAlgo
{
INSIDE,
OUTSIDE,
INSIDEPOINT,
NONE
};
static const NamedEnum<areaSelectionAlgo, 4> areaSelectionAlgoNames;
private:
// Private data
//- Reference to all geometry.
@ -75,9 +90,12 @@ class refinementSurfaces
wordList cellZoneNames_;
//- Per 'interface' surface : (only used if surface is closed)
// whether to zone cells inside or outside surface.
boolList zoneInside_;
// How to select zone cells : surface inside or outside or given
// inside location.
List<areaSelectionAlgo> zoneInside_;
//- If zoneInside=location gives the corresponding inside point
pointField zoneInsidePoints_;
//- From local region number to global region number
labelList regionOffset_;
@ -159,9 +177,20 @@ public:
//- Get indices of named surfaces (surfaces with faceZoneName)
labelList getNamedSurfaces() const;
//- Get indices of closed surfaces with a cellZone
//- Get indices of surfaces with a cellZone that are closed and
// have 'inside' or 'outside' selection.
labelList getClosedNamedSurfaces() const;
//- Get indices of surfaces with a cellZone that have 'insidePoint'
// section.
labelList getInsidePointNamedSurfaces() const;
//- Get specified inside locations for surfaces with a cellZone
const pointField& zoneInsidePoints() const
{
return zoneInsidePoints_;
}
//- From local region number to global region number
const labelList& regionOffset() const
{

View File

@ -177,7 +177,7 @@ void Foam::shellSurfaces::orient()
boundBox shellBb(points[0], points[0]);
// Assume surface is compact!
for (label i = 0; i < points.size(); i++)
forAll(points, i)
{
const point& pt = points[i];
shellBb.min() = min(shellBb.min(), pt);

View File

@ -39,7 +39,7 @@ namespace Foam
{
return dim > 1 ? pow(expRatio, 1.0/(dim - 1)) : 0.0;
}
//! @endcond fileScope
//! @endcond
} // End namespace Foam

Some files were not shown because too many files have changed in this diff Show More