Merge branch 'master' into cvm

This commit is contained in:
graham
2010-07-27 12:35:21 +01:00
39 changed files with 18686 additions and 18265 deletions

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
@ -155,7 +155,7 @@ dimensionedScalar cbrt(const dimensionedScalar& ds)
return dimensionedScalar
(
"cbrt(" + ds.name() + ')',
pow(ds.dimensions(), dimensionedScalar("(1/3)", dimless, 1.0/3.0)),
pow(ds.dimensions(), dimensionedScalar("(1|3)", dimless, 1.0/3.0)),
::cbrt(ds.value())
);
}

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

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

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

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
@ -544,7 +544,8 @@ public:
(
const bool report = false,
labelHashSet* setPtr = NULL,
labelHashSet* highAspectSetPtr = NULL
labelHashSet* highAspectSetPtr = NULL,
const Vector<label>& solutionD = Vector<label>::one
) const;
//- Check for negative face areas
@ -645,7 +646,8 @@ public:
bool checkCellDeterminant
(
const bool report = false,
labelHashSet* setPtr = NULL
labelHashSet* setPtr = NULL,
const Vector<label>& solutionD = Vector<label>::one
) const;
//- Check for concave cells by the planes of faces

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
@ -98,13 +98,15 @@ bool Foam::primitiveMesh::checkClosedCells
(
const bool report,
labelHashSet* setPtr,
labelHashSet* aspectSetPtr
labelHashSet* aspectSetPtr,
const Vector<label>& meshD
) const
{
if (debug)
{
Info<< "bool primitiveMesh::checkClosedCells("
<< "const bool, labelHashSet*, labelHashSet*) const: "
<< "const bool, labelHashSet*, labelHashSet*"
<< ", const Vector<label>&) const: "
<< "checking whether cells are closed" << endl;
}
@ -171,6 +173,16 @@ bool Foam::primitiveMesh::checkClosedCells
const scalarField& vols = cellVolumes();
label nDims = 0;
for (direction dir = 0; dir < vector::nComponents; dir++)
{
if (meshD[dir] == 1)
{
nDims++;
}
}
// Check the sums
forAll(sumClosed, cellI)
{
@ -200,12 +212,26 @@ bool Foam::primitiveMesh::checkClosedCells
// Calculate the aspect ration as the maximum of Cartesian component
// aspect ratio to the total area hydraulic area aspect ratio
scalar aspectRatio = max
(
cmptMax(sumMagClosed[cellI])
/(cmptMin(sumMagClosed[cellI]) + VSMALL),
1.0/6.0*cmptSum(sumMagClosed[cellI])/pow(vols[cellI], 2.0/3.0)
);
scalar minCmpt = VGREAT;
scalar maxCmpt = -VGREAT;
for (direction dir = 0; dir < vector::nComponents; dir++)
{
if (meshD[dir] == 1)
{
minCmpt = min(minCmpt, sumMagClosed[cellI][dir]);
maxCmpt = max(maxCmpt, sumMagClosed[cellI][dir]);
}
}
scalar aspectRatio = maxCmpt/(minCmpt + VSMALL);
if (nDims == 3)
{
aspectRatio = max
(
aspectRatio,
1.0/6.0*cmptSum(sumMagClosed[cellI])/pow(vols[cellI], 2.0/3.0)
);
}
maxAspectRatio = max(maxAspectRatio, aspectRatio);
@ -1978,7 +2004,8 @@ bool Foam::primitiveMesh::checkFaceFaces
bool Foam::primitiveMesh::checkCellDeterminant
(
const bool report, // report,
labelHashSet* setPtr // setPtr
labelHashSet* setPtr, // setPtr
const Vector<label>& meshD
) const
{
if (debug)
@ -1988,6 +2015,22 @@ bool Foam::primitiveMesh::checkCellDeterminant
<< "checking for under-determined cells" << endl;
}
// Determine number of dimensions and (for 2D) missing dimension
label nDims = 0;
label twoD = -1;
for (direction dir = 0; dir < vector::nComponents; dir++)
{
if (meshD[dir] == 1)
{
nDims++;
}
else
{
twoD = dir;
}
}
const cellList& c = cells();
label nErrorCells = 0;
@ -1996,55 +2039,34 @@ bool Foam::primitiveMesh::checkCellDeterminant
scalar sumDet = 0;
label nSummed = 0;
forAll(c, cellI)
if (nDims == 1)
{
const labelList& curFaces = c[cellI];
// Calculate local normalization factor
scalar avgArea = 0;
label nInternalFaces = 0;
forAll(curFaces, i)
minDet = 1;
sumDet = c.size()*minDet;
nSummed = c.size();
}
else
{
forAll (c, cellI)
{
if (isInternalFace(curFaces[i]))
{
avgArea += mag(faceAreas()[curFaces[i]]);
const labelList& curFaces = c[cellI];
nInternalFaces++;
}
}
// Calculate local normalization factor
scalar avgArea = 0;
if (nInternalFaces == 0)
{
if (setPtr)
{
setPtr->insert(cellI);
}
nErrorCells++;
}
else
{
avgArea /= nInternalFaces;
symmTensor areaTensor(symmTensor::zero);
label nInternalFaces = 0;
forAll(curFaces, i)
{
if (isInternalFace(curFaces[i]))
{
areaTensor += sqr(faceAreas()[curFaces[i]]/avgArea);
avgArea += mag(faceAreas()[curFaces[i]]);
nInternalFaces++;
}
}
scalar determinant = mag(det(areaTensor));
minDet = min(determinant, minDet);
sumDet += determinant;
nSummed++;
if (determinant < 1e-3)
if (nInternalFaces == 0)
{
if (setPtr)
{
@ -2053,6 +2075,54 @@ bool Foam::primitiveMesh::checkCellDeterminant
nErrorCells++;
}
else
{
avgArea /= nInternalFaces;
symmTensor areaTensor(symmTensor::zero);
forAll(curFaces, i)
{
if (isInternalFace(curFaces[i]))
{
areaTensor += sqr(faceAreas()[curFaces[i]]/avgArea);
}
}
if (nDims == 2)
{
// Add the missing eigenvector (such that it does not
// affect the determinant)
if (twoD == 0)
{
areaTensor.xx() = 1;
}
else if (twoD == 1)
{
areaTensor.yy() = 1;
}
else
{
areaTensor.zz() = 1;
}
}
scalar determinant = mag(det(areaTensor));
minDet = min(determinant, minDet);
sumDet += determinant;
nSummed++;
if (determinant < 1e-3)
{
if (setPtr)
{
setPtr->insert(cellI);
}
nErrorCells++;
}
}
}
}

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
@ -30,13 +30,14 @@ License
void Foam::setRefCell
(
const volScalarField& field,
const volScalarField& fieldRef,
const dictionary& dict,
label& refCelli,
scalar& refValue,
const bool forceReference
)
{
if (field.needReference() || forceReference)
if (fieldRef.needReference() || forceReference)
{
word refCellName = field.name() + "RefCell";
word refPointName = field.name() + "RefPoint";
@ -56,6 +57,7 @@ void Foam::setRefCell
"void Foam::setRefCell\n"
"(\n"
" const volScalarField&,\n"
" const volScalarField&,\n"
" const dictionary&,\n"
" label& scalar&,\n"
" bool\n"
@ -76,7 +78,7 @@ void Foam::setRefCell
point refPointi(dict.lookup(refPointName));
refCelli = field.mesh().findCell(refPointi);
label hasRef = (refCelli >= 0 ? 1 : 0);
label sumHasRef = returnReduce(hasRef, sumOp<label>());
label sumHasRef = returnReduce<label>(hasRef, sumOp<label>());
if (sumHasRef != 1)
{
FatalIOErrorIn
@ -84,6 +86,7 @@ void Foam::setRefCell
"void Foam::setRefCell\n"
"(\n"
" const volScalarField&,\n"
" const volScalarField&,\n"
" const dictionary&,\n"
" label& scalar&,\n"
" bool\n"
@ -103,6 +106,7 @@ void Foam::setRefCell
"void Foam::setRefCell\n"
"(\n"
" const volScalarField&,\n"
" const volScalarField&,\n"
" const dictionary&,\n"
" label& scalar&,\n"
" bool\n"
@ -119,6 +123,19 @@ void Foam::setRefCell
}
void Foam::setRefCell
(
const volScalarField& field,
const dictionary& dict,
label& refCelli,
scalar& refValue,
const bool forceReference
)
{
setRefCell(field, field, dict, refCelli, refValue, forceReference);
}
Foam::scalar Foam::getRefCellValue
(
const volScalarField& field,

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
@ -44,8 +44,22 @@ SourceFiles
namespace Foam
{
//- Find the reference cell nearest (in index) to the given cell,
// but which is not on a cyclic, symmetry or processor patch.
//- If the field fieldRef needs referencing find the reference cell nearest
// (in index) to the given cell looked-up for field, but which is not on a
// cyclic, symmetry or processor patch.
void setRefCell
(
const volScalarField& field,
const volScalarField& fieldRef,
const dictionary& dict,
label& refCelli,
scalar& refValue,
const bool forceReference = false
);
//- If the field needs referencing find the reference cell nearest
// (in index) to the given cell looked-up for field, but which is not on a
// cyclic, symmetry or processor patch.
void setRefCell
(
const volScalarField& field,

View File

@ -334,11 +334,18 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
position_ = endPosition;
}
label origFacei = facei_;
label patchi = patch(facei_);
const polyPatch& patch = mesh.boundaryMesh()[patchi];
if (!p.hitPatch(patch, td, patchi))
if (!p.hitPatch(mesh.boundaryMesh()[patchi], td, patchi))
{
// Did patch interaction model switch patches?
if (facei_ != origFacei)
{
patchi = patch(facei_);
}
const polyPatch& patch = mesh.boundaryMesh()[patchi];
if (isA<wedgePolyPatch>(patch))
{
p.hitWedgePatch

View File

@ -378,6 +378,9 @@ public:
//- Return current cell particle is in
inline label cell() const;
//- Return current face particle is on otherwise -1
inline label& face();
//- Return current face particle is on otherwise -1
inline label face() const;

View File

@ -325,6 +325,13 @@ inline Foam::label Foam::Particle<ParticleType>::face() const
}
template<class ParticleType>
inline Foam::label& Foam::Particle<ParticleType>::face()
{
return facei_;
}
template<class ParticleType>
inline bool Foam::Particle<ParticleType>::onBoundary() const
{

View File

@ -31,5 +31,8 @@ LIB_LIBS = \
-lspecie \
-lbasicThermophysicalModels \
-lreactionThermophysicalModels \
-lchemistryModel \
-lradiation \
-lODE \
-lcompressibleRASModels \
-lcompressibleLESModels