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

Conflicts:
	applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C
This commit is contained in:
laurence
2012-03-27 12:41:27 +01:00
83 changed files with 3059 additions and 186 deletions

View File

@ -96,6 +96,20 @@ T returnReduce
}
// Reduce with sum of both value and count (for averaging)
template <class T>
void sumReduce
(
T& Value,
label& Count,
const int tag = Pstream::msgType()
)
{
reduce(Value, sumOp<T>(), tag);
reduce(Count, sumOp<label>(), tag);
}
// Non-blocking version of reduce. Sets request.
template <class T, class BinaryOp>
void reduce
@ -125,6 +139,13 @@ void reduce
const int tag = Pstream::msgType()
);
void sumReduce
(
scalar& Value,
label& Count,
const int tag = Pstream::msgType()
);
void reduce
(
scalar& Value,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -514,11 +514,12 @@ template<class Type>
Type gAverage(const UList<Type>& f)
{
label n = f.size();
reduce(n, sumOp<label>());
Type s = sum(f);
sumReduce(s, n);
if (n > 0)
{
Type avrg = gSum(f)/n;
Type avrg = s/n;
return avrg;
}

View File

@ -63,6 +63,15 @@ void Foam::reduce(vector2D&, const sumOp<vector2D>&, const int)
{}
void Foam::sumReduce
(
scalar& Value,
label& Count,
const int tag
)
{}
void Foam::reduce(scalar&, const sumOp<scalar>&, const int, label&)
{}

View File

@ -41,7 +41,38 @@ License
# define MPI_SCALAR MPI_DOUBLE
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
typedef struct
{
scalar value;
label count;
} CountAndValue;
void reduceSum
(
void *in,
void *inOut,
int *len,
MPI_Datatype *dptr
)
{
CountAndValue* inPtr =
reinterpret_cast<CountAndValue*>(in);
CountAndValue* inOutPtr =
reinterpret_cast<CountAndValue*>(inOut);
for (int i=0; i< *len; ++i)
{
inOutPtr->value += inPtr->value;
inOutPtr->count += inPtr->count;
inPtr++;
inOutPtr++;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -455,6 +486,111 @@ void Foam::reduce(vector2D& Value, const sumOp<vector2D>& bop, const int tag)
}
void Foam::sumReduce
(
scalar& Value,
label& Count,
const int tag
)
{
static bool hasDataType_ = false;
static MPI_Datatype mesg_mpi_strct_;
static MPI_Op myOp_;
if (Pstream::debug)
{
Pout<< "Foam::sumReduce : value:" << Value
<< " count:" << Count << endl;
}
if (!UPstream::parRun())
{
return;
}
if (UPstream::nProcs() <= UPstream::nProcsSimpleSum)
{
reduce(Value, sumOp<scalar>(), tag);
reduce(Count, sumOp<label>(), tag);
}
else
{
CountAndValue in,out;
if (!hasDataType_)
{
int lengths[2];
lengths[0] = 1;
lengths[1] = 1;
MPI_Datatype types[2];
types[0] = MPI_DOUBLE;
types[1] = MPI_INT;
MPI_Aint addresses[2];
MPI_Address(&in.value, &addresses[0]);
MPI_Address(&in.count, &addresses[1]);
MPI_Aint offsets[2];
offsets[0] = 0;
offsets[1] = addresses[1]-addresses[0];
if
(
MPI_Type_create_struct
(
2,
lengths,
offsets,
types,
&mesg_mpi_strct_
)
)
{
FatalErrorIn("Foam::sumReduce()")
<< "MPI_Type_create_struct" << abort(FatalError);
}
if (MPI_Type_commit(&mesg_mpi_strct_))
{
FatalErrorIn("Foam::sumReduce()")
<< "MPI_Type_commit" << abort(FatalError);
}
if (MPI_Op_create(reduceSum, true, &myOp_))
{
FatalErrorIn("Foam::sumReduce()")
<< "MPI_Op_create" << abort(FatalError);
}
hasDataType_ = true;
}
in.value = Value;
in.count = Count;
if
(
MPI_Allreduce
(
&in,
&out,
1,
mesg_mpi_strct_,
myOp_,
MPI_COMM_WORLD
)
)
{
FatalErrorIn("Foam::sumReduce(..)")
<< "Problem." << abort(FatalError);
}
Value = out.value;
Count = out.count;
}
if (Pstream::debug)
{
Pout<< "Foam::reduce : reduced value:" << Value
<< " reduced count:" << Count << endl;
}
}
void Foam::reduce
(
scalar& Value,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -763,13 +763,6 @@ bool Foam::slidingInterface::projectPoints() const
{
const edge& curEdge = slaveEdges[edgeI];
//HJ: check for all edges even if both ends have missed
// Experimental.
// if
// (
// slavePointFaceHits[curEdge.start()].hit()
// || slavePointFaceHits[curEdge.end()].hit()
// )
{
// Clear the maps
curFaceMap.clear();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -292,6 +292,31 @@ Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::MRFZone::addCoriolis
(
const volVectorField& U,
volVectorField& ddtU
) const
{
if (cellZoneID_ == -1)
{
return;
}
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const scalarField& V = mesh_.V();
vectorField& ddtUc = ddtU.internalField();
const vectorField& Uc = U.internalField();
const vector& Omega = Omega_.value();
forAll(cells, i)
{
label celli = cells[i];
ddtUc[celli] += V[celli]*(Omega ^ Uc[celli]);
}
}
void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
{
if (cellZoneID_ == -1)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -166,6 +166,9 @@ public:
setMRFFaces();
}
//- Add the Coriolis force contribution to the acceleration field
void addCoriolis(const volVectorField& U, volVectorField& ddtU) const;
//- Add the Coriolis force contribution to the momentum equation
void addCoriolis(fvVectorMatrix& UEqn) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,6 +55,19 @@ Foam::MRFZones::MRFZones(const fvMesh& mesh)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::MRFZones::addCoriolis
(
const volVectorField& U,
volVectorField& ddtU
) const
{
forAll(*this, i)
{
operator[](i).addCoriolis(U, ddtU);
}
}
void Foam::MRFZones::addCoriolis(fvVectorMatrix& UEqn) const
{
forAll(*this, i)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -72,6 +72,9 @@ public:
// Member Functions
//- Add the Coriolis force contribution to the acceleration field
void addCoriolis(const volVectorField& U, volVectorField& ddtU) const;
//- Add the Coriolis force contribution to the momentum equation
void addCoriolis(fvVectorMatrix& UEqn) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -76,6 +76,9 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
Foam::labelList Foam::refinementParameters::findCells(const polyMesh& mesh)
const
{
// Force calculation of tet-diag decomposition (for use in findCell)
(void)mesh.tetBasePtIs();
// Global calculation engine
globalIndex globalCells(mesh.nCells());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1819,6 +1819,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
const point& keepPoint
)
{
// Force calculation of face decomposition (used in findCell)
(void)mesh_.tetBasePtIs();
// Determine connected regions. regionSplit is the labelList with the
// region per cell.
regionSplit cellRegion(mesh_);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1235,6 +1235,9 @@ void Foam::meshRefinement::findCellZoneInsideWalk
blockedFace.clear();
// Force calculation of face decomposition (used in findCell)
(void)mesh_.tetBasePtIs();
// For all locationSurface find the cell
forAll(locationSurfaces, i)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,11 +49,11 @@ namespace Foam
Foam::structuredDecomp::structuredDecomp(const dictionary& decompositionDict)
:
decompositionMethod(decompositionDict),
methodDict_(decompositionDict_.subDict(typeName + "Coeffs"))
methodDict_(decompositionDict_.subDict(typeName + "Coeffs")),
patches_(methodDict_.lookup("patches"))
{
methodDict_.set("numberOfSubdomains", nDomains());
method_ = decompositionMethod::New(methodDict_);
patches_ = wordList(methodDict_.lookup("patches"));
}
@ -72,29 +72,20 @@ Foam::labelList Foam::structuredDecomp::decompose
const scalarField& cWeights
)
{
labelList patchIDs(patches_.size());
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const labelHashSet patchIDs(pbm.patchSet(patches_));
label nFaces = 0;
forAll(patches_, i)
forAllConstIter(labelHashSet, patchIDs, iter)
{
patchIDs[i] = pbm.findPatchID(patches_[i]);
if (patchIDs[i] == -1)
{
FatalErrorIn("structuredDecomp::decompose(..)")
<< "Cannot find patch " << patches_[i] << endl
<< "Valid patches are " << pbm.names()
<< exit(FatalError);
}
nFaces += pbm[patchIDs[i]].size();
nFaces += pbm[iter.key()].size();
}
// Extract a submesh.
labelHashSet patchCells(2*nFaces);
forAll(patchIDs, i)
forAllConstIter(labelHashSet, patchIDs, iter)
{
const labelUList& fc = pbm[patchIDs[i]].faceCells();
const labelUList& fc = pbm[iter.key()].faceCells();
forAll(fc, i)
{
patchCells.insert(fc[i]);
@ -127,9 +118,9 @@ Foam::labelList Foam::structuredDecomp::decompose
labelList patchFaces(nFaces);
List<topoDistanceData> patchData(nFaces);
nFaces = 0;
forAll(patchIDs, i)
forAllConstIter(labelHashSet, patchIDs, iter)
{
const polyPatch& pp = pbm[patchIDs[i]];
const polyPatch& pp = pbm[iter.key()];
const labelUList& fc = pp.faceCells();
forAll(fc, i)
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Class
Foam::structuredDecomp
Description
Decomposition given using consecutive application of decomposers.
Decomposition by walking out decomposition of patch cells mesh.
SourceFiles
structuredDecomp.C
@ -52,9 +52,9 @@ class structuredDecomp
dictionary methodDict_;
autoPtr<decompositionMethod> method_;
wordReList patches_;
wordList patches_;
autoPtr<decompositionMethod> method_;
// Private Member Functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -202,7 +202,7 @@ void Foam::meshToMesh::calcAddressing()
if (debug)
{
Info<< "meshToMesh::calculateAddressing() : "
<< "finished calculating mesh-to-mesh acell ddressing" << endl;
<< "finished calculating mesh-to-mesh cell addressing" << endl;
}
}

View File

@ -128,6 +128,18 @@ bool Foam::fileFormats::VTKsurfaceFormat<Face>::read
zones[i] = label(region[i]);
}
}
else if (reader.cellData().foundObject<scalarIOField>("STLSolidLabeling"))
{
const scalarIOField& region =
reader.cellData().lookupObject<scalarIOField>
(
"STLSolidLabeling"
);
forAll(region, i)
{
zones[i] = label(region[i]);
}
}
// Create zone names
const label nZones = max(zones)+1;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -132,7 +132,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField
void Foam::radiation::greyDiffusiveViewFactorFixedValueFvPatchScalarField::
updateCoeffs()
{
//Do nothing
// Do nothing
if (debug)
{
@ -141,7 +141,7 @@ updateCoeffs()
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " <- "
<< " heat[W]:" << Q
<< " heat transfer rate:" << Q
<< " wall radiative heat flux "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -590,9 +590,9 @@ void Foam::radiation::viewFactor::calculate()
const scalarField& Qrp = Qr_.boundaryField()[patchID];
const scalarField& magSf = mesh_.magSf().boundaryField()[patchID];
scalar heatFlux = gSum(Qrp*magSf);
Info<< "Total heat flux at patch: "
Info<< "Total heat transfer rate at patch: "
<< patchID << " "
<< heatFlux << " [W]" << endl;
<< heatFlux << endl;
}
}

View File

@ -244,7 +244,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " :"
<< " heatFlux:" << Q
<< " heat transfer rate:" << Q
<< " walltemperature "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -227,7 +227,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
<< nbrMesh.name() << ':'
<< nbrPatch.name() << ':'
<< this->dimensionedInternalField().name() << " :"
<< " heat[W]:" << Q
<< " heat transfer rate:" << Q
<< " walltemperature "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)

View File

@ -74,16 +74,20 @@ void Foam::IDDESDelta::calcDelta()
{
scalar deltaMaxTmp = 0.0;
const labelList& cFaces = cells[cellI];
const point& faceCentre = faceCentres[cFaces[0]];
const vector nCell = n[cellI];
forAll(cFaces, cFaceI)
{
label faceI = cFaces[cFaceI];
const point& faceCentreTwo = faceCentres[faceI];
scalar tmp = (faceCentre - faceCentreTwo) & nCell;
if (tmp > deltaMaxTmp)
const point& faceCentreI = faceCentres[faceI];
forAll(cFaces, cFaceJ)
{
deltaMaxTmp = tmp;
label faceJ = cFaces[cFaceJ];
const point& faceCentreJ = faceCentres[faceJ];
scalar tmp = (faceCentreJ - faceCentreI) & nCell;
if (tmp > deltaMaxTmp)
{
deltaMaxTmp = tmp;
}
}
}
faceToFacenMax[cellI] = deltaMaxTmp;