Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2010-03-05 15:46:49 +01:00
115 changed files with 2560 additions and 1143 deletions

View File

@ -38,7 +38,7 @@ solidWallHeatFluxTemperatureFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
fixedGradientFvPatchScalarField(p, iF),
q_(p.size(), 0.0),
KName_("undefined-K")
{}
@ -53,7 +53,7 @@ solidWallHeatFluxTemperatureFvPatchScalarField
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
q_(ptf.q_, mapper),
KName_(ptf.KName_)
{}
@ -67,7 +67,7 @@ solidWallHeatFluxTemperatureFvPatchScalarField
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
fixedGradientFvPatchScalarField(p, iF, dict),
q_("q", dict, p.size()),
KName_(dict.lookup("K"))
{}
@ -79,7 +79,7 @@ solidWallHeatFluxTemperatureFvPatchScalarField
const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf
)
:
fixedValueFvPatchScalarField(tppsf),
fixedGradientFvPatchScalarField(tppsf),
q_(tppsf.q_),
KName_(tppsf.KName_)
{}
@ -92,7 +92,7 @@ solidWallHeatFluxTemperatureFvPatchScalarField
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(tppsf, iF),
fixedGradientFvPatchScalarField(tppsf, iF),
q_(tppsf.q_),
KName_(tppsf.KName_)
{}
@ -105,7 +105,7 @@ void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::autoMap
const fvPatchFieldMapper& m
)
{
fixedValueFvPatchScalarField::autoMap(m);
fixedGradientFvPatchScalarField::autoMap(m);
q_.autoMap(m);
}
@ -116,7 +116,7 @@ void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::rmap
const labelList& addr
)
{
fixedValueFvPatchScalarField::rmap(ptf, addr);
fixedGradientFvPatchScalarField::rmap(ptf, addr);
const solidWallHeatFluxTemperatureFvPatchScalarField& hfptf =
refCast<const solidWallHeatFluxTemperatureFvPatchScalarField>(ptf);
@ -132,14 +132,14 @@ void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
return;
}
const scalarField& Kw =
patch().lookupPatchField<volScalarField, scalar>(KName_);
const scalarField& Kw = patch().lookupPatchField<volScalarField, scalar>
(
KName_
);
const fvPatchScalarField& Tw = *this;
gradient() = q_/Kw;
operator==(q_/(patch().deltaCoeffs()*Kw) + Tw.patchInternalField());
fixedValueFvPatchScalarField::updateCoeffs();
fixedGradientFvPatchScalarField::updateCoeffs();
}
@ -148,9 +148,10 @@ void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::write
Ostream& os
) const
{
fixedValueFvPatchScalarField::write(os);
fixedGradientFvPatchScalarField::write(os);
q_.writeEntry("q", os);
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
}

View File

@ -46,7 +46,7 @@ SourceFiles
#ifndef solidWallHeatFluxTemperatureFvPatchScalarField_H
#define solidWallHeatFluxTemperatureFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,7 +59,7 @@ namespace Foam
class solidWallHeatFluxTemperatureFvPatchScalarField
:
public fixedValueFvPatchScalarField
public fixedGradientFvPatchScalarField
{
// Private data

View File

@ -11,7 +11,7 @@ forAll(patches, patchi)
{
const fvPatch& currPatch = patches[patchi];
if (isType<wallFvPatch>(currPatch))
if (isA<wallFvPatch>(currPatch))
{
const vectorField nf = currPatch.nf();

View File

@ -358,9 +358,22 @@ int main(int argc, char *argv[])
timeSelector::addOptions(true, false);
argList::validArgs.append("feature angle[0-180]");
argList::addBoolOption("splitAllFaces");
argList::addBoolOption("concaveMultiCells");
argList::addBoolOption("doNotPreserveFaceZones");
argList::addBoolOption
(
"splitAllFaces",
"have multiple faces inbetween cells"
);
argList::addBoolOption
(
"concaveMultiCells",
"split cells on concave boundary edges into multiple cells"
);
argList::addBoolOption
(
"doNotPreserveFaceZones",
"disable the default behaviour of preserving faceZones by having"
" multiple faces inbetween cells"
);
# include "setRootCase.H"
# include "createTime.H"

View File

@ -884,7 +884,7 @@ void starMesh::createCoupleMatches()
<< "newSlaveEdges: " << newSlaveEdges << endl;
# endif
edge startEdge;
edge startEdge(-1, -1);
// Remember where the start edge was found:
// 0 for not found

View File

@ -71,7 +71,7 @@ Foam::label Foam::checkTopology
{
Info<< " ***FaceZone " << mesh.faceZones()[zoneI].name()
<< " is not correctly synchronised"
<< " acrosss coupled boundaries."
<< " across coupled boundaries."
<< " (coupled faces both"
<< " present in set but with opposite flipmap)" << endl;
noFailedChecks++;

View File

@ -8,5 +8,4 @@ EXE_LIBS = \
-lfiniteVolume \
-ldecompositionMethods \
-lmeshTools \
-ldynamicMesh \
-L$(FOAM_MPI_LIBBIN) -lparMetisDecompositionMethod
-ldynamicMesh

View File

@ -110,40 +110,30 @@ void writeAllData
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
ensightFile << key << nl;
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeData(map(vf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
scalarField data(fromSlaves[slave]);
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
writeData(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, prims, cmpt);
}
}
}
}
@ -160,40 +150,30 @@ void writeAllDataBinary
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
writeEnsDataBinary(key,ensightFile);
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeEnsDataBinary(map(vf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
scalarField data(fromSlaves[slave]);
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
writeEnsDataBinary(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, prims, cmpt);
}
}
}
}
@ -210,40 +190,31 @@ void writeAllFaceData
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(pf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
ensightFile << key << nl;
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeData(map(pf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
scalarField pf(fromSlaves[slave]);
IPstream fromSlave(Pstream::scheduled, slave);
scalarField pf(fromSlave);
writeData(pf, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(pf, prims, cmpt);
}
}
}
}
@ -260,40 +231,31 @@ void writeAllFaceDataBinary
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(pf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
writeEnsDataBinary(key,ensightFile);
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeEnsDataBinary(map(pf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
scalarField pf(fromSlaves[slave]);
IPstream fromSlave(Pstream::scheduled, slave);
scalarField pf(fromSlave);
writeEnsDataBinary(pf, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(pf, prims, cmpt);
}
}
}
}
@ -539,6 +501,10 @@ void ensightFieldAscii
const wordHashSet& patchNames = eMesh.patchNames();
const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims();
const List<faceSets>& faceZoneFaceSets = eMesh.faceZoneFaceSets();
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
const HashTable<ensightMesh::nFacePrimitives>&
nFaceZonePrims = eMesh.nFaceZonePrims();
const labelList& tets = meshCellSets.tets;
const labelList& pyrs = meshCellSets.pyrs;
@ -557,7 +523,7 @@ void ensightFieldAscii
postProcPath/ensightFileName,
runTime.writeFormat(),
runTime.writeVersion(),
runTime.writeCompression()
IOstream::UNCOMPRESSED
);
}
@ -567,6 +533,8 @@ void ensightFieldAscii
if (patchNames.empty())
{
eMesh.barrier();
if (Pstream::master())
{
if (timeIndex == 0)
@ -592,29 +560,10 @@ void ensightFieldAscii
if (meshCellSets.nHexesWedges)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
ensightFile << "hexa8" << nl;
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeData
@ -625,17 +574,57 @@ void ensightFieldAscii
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
scalarField data(fromSlaves[slave]);
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
writeData(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
}
writeAllData("penta6", vf, prisms, meshCellSets.nPrisms, ensightFile);
writeAllData("pyramid5", vf, pyrs, meshCellSets.nPyrs, ensightFile);
writeAllData("tetra4", vf, tets, meshCellSets.nTets, ensightFile);
writeAllData("nfaced", vf, polys, meshCellSets.nPolys, ensightFile);
writeAllData
(
"penta6",
vf,
prisms,
meshCellSets.nPrisms,
ensightFile
);
writeAllData
(
"pyramid5",
vf,
pyrs,
meshCellSets.nPyrs,
ensightFile
);
writeAllData
(
"tetra4",
vf,
tets,
meshCellSets.nTets,
ensightFile
);
writeAllData
(
"nfaced",
vf,
polys,
meshCellSets.nPolys,
ensightFile
);
}
label ensightPatchI = eMesh.patchPartOffset();
@ -644,6 +633,8 @@ void ensightFieldAscii
{
const word& patchName = allPatchNames[patchi];
eMesh.barrier();
if (patchNames.empty() || patchNames.found(patchName))
{
if
@ -664,6 +655,80 @@ void ensightFieldAscii
}
}
// write faceZones, if requested
if (faceZoneNames.size())
{
// Interpolates cell values to faces - needed only when exporting
// faceZones...
GeometricField<Type, fvsPatchField, surfaceMesh> sf
(
linearInterpolate(vf)
);
forAllConstIter(wordHashSet, faceZoneNames, iter)
{
const word& faceZoneName = iter.key();
eMesh.barrier();
label zoneID = mesh.faceZones().findZoneID(faceZoneName);
const faceZone& fz = mesh.faceZones()[zoneID];
// Prepare data to write
label nIncluded = 0;
forAll(fz, i)
{
if (eMesh.faceToBeIncluded(fz[i]))
{
++nIncluded;
}
}
Field<Type> values(nIncluded);
// Loop on the faceZone and store the needed field values
label j = 0;
forAll(fz, i)
{
label faceI = fz[i];
if (mesh.isInternalFace(faceI))
{
values[j] = sf[faceI];
++j;
}
else
{
if (eMesh.faceToBeIncluded(faceI))
{
label patchI = mesh.boundaryMesh().whichPatch(faceI);
const polyPatch& pp = mesh.boundaryMesh()[patchI];
label patchFaceI = pp.whichFace(faceI);
Type value = sf.boundaryField()[patchI][patchFaceI];
values[j] = value;
++j;
}
}
}
if
(
writePatchField
(
values,
zoneID,
ensightPatchI,
faceZoneFaceSets[zoneID],
nFaceZonePrims.find(faceZoneName)(),
ensightFile
)
)
{
ensightPatchI++;
}
}
}
if (Pstream::master())
{
delete ensightFilePtr;
@ -695,6 +760,10 @@ void ensightFieldBinary
const wordHashSet& patchNames = eMesh.patchNames();
const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims();
const List<faceSets>& faceZoneFaceSets = eMesh.faceZoneFaceSets();
const wordHashSet& faceZoneNames = eMesh.faceZoneNames();
const HashTable<ensightMesh::nFacePrimitives>&
nFaceZonePrims = eMesh.nFaceZonePrims();
const labelList& tets = meshCellSets.tets;
const labelList& pyrs = meshCellSets.pyrs;
@ -722,6 +791,8 @@ void ensightFieldBinary
if (patchNames.empty())
{
eMesh.barrier();
if (Pstream::master())
{
if (timeIndex == 0)
@ -743,29 +814,10 @@ void ensightFieldBinary
if (meshCellSets.nHexesWedges)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
writeEnsDataBinary("hexa8",ensightFile);
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeEnsDataBinary
@ -776,11 +828,20 @@ void ensightFieldBinary
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
scalarField data(fromSlaves[slave]);
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
writeEnsDataBinary(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
}
writeAllDataBinary
@ -826,6 +887,8 @@ void ensightFieldBinary
{
const word& patchName = allPatchNames[patchi];
eMesh.barrier();
if (patchNames.empty() || patchNames.found(patchName))
{
if
@ -844,6 +907,81 @@ void ensightFieldBinary
ensightPatchI++;
}
}
}
// write faceZones, if requested
if (faceZoneNames.size())
{
// Interpolates cell values to faces - needed only when exporting
// faceZones...
GeometricField<Type, fvsPatchField, surfaceMesh> sf
(
linearInterpolate(vf)
);
forAllConstIter(wordHashSet, faceZoneNames, iter)
{
const word& faceZoneName = iter.key();
eMesh.barrier();
label zoneID = mesh.faceZones().findZoneID(faceZoneName);
const faceZone& fz = mesh.faceZones()[zoneID];
// Prepare data to write
label nIncluded = 0;
forAll(fz, i)
{
if (eMesh.faceToBeIncluded(fz[i]))
{
++nIncluded;
}
}
Field<Type> values(nIncluded);
// Loop on the faceZone and store the needed field values
label j = 0;
forAll(fz, i)
{
label faceI = fz[i];
if (mesh.isInternalFace(faceI))
{
values[j] = sf[faceI];
++j;
}
else
{
if (eMesh.faceToBeIncluded(faceI))
{
label patchI = mesh.boundaryMesh().whichPatch(faceI);
const polyPatch& pp = mesh.boundaryMesh()[patchI];
label patchFaceI = pp.whichFace(faceI);
Type value = sf.boundaryField()[patchI][patchFaceI];
values[j] = value;
++j;
}
}
}
if
(
writePatchFieldBinary
(
values,
zoneID,
ensightPatchI,
faceZoneFaceSets[zoneID],
nFaceZonePrims.find(faceZoneName)(),
ensightFile
)
)
{
ensightPatchI++;
}
}
}
if (Pstream::master())

View File

@ -42,7 +42,7 @@ SourceFiles
#include "fvMesh.H"
#include "OFstream.H"
#include <fstream>
#include "globalIndex.H"
#include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,6 +51,7 @@ namespace Foam
class fvMesh;
class argList;
class globalIndex;
/*---------------------------------------------------------------------------*\
Class ensightMesh Declaration
@ -98,6 +99,16 @@ private:
HashTable<nFacePrimitives> nPatchPrims_;
// faceZone - related variables
List<faceSets> faceZoneFaceSets_;
wordHashSet faceZoneNames_;
HashTable<nFacePrimitives> nFaceZonePrims_;
//- Per boundary face whether to include or not
PackedBoolList boundaryFaceToBeIncluded_;
// Private Member Functions
@ -206,6 +217,38 @@ private:
OFstream& ensightGeometryFile
) const;
void writeAllInternalPoints
(
const pointField& uniquePoints,
const label nPoints,
OFstream& ensightGeometryFile
) const;
void writeAllPatchPoints
(
label ensightPatchI,
const word& patchName,
const pointField& uniquePoints,
const label nPoints,
OFstream& ensightGeometryFile
) const;
void writeAllInternalPointsBinary
(
const pointField& uniquePoints,
const label nPoints,
std::ofstream& ensightGeometryFile
) const;
void writeAllPatchPointsBinary
(
label ensightPatchI,
const word& patchName,
const pointField& uniquePoints,
const label nPoints,
std::ofstream& ensightGeometryFile
) const;
void writeAscii
(
const fileName& postProcPath,
@ -311,7 +354,12 @@ public:
// Constructors
//- Construct from fvMesh
ensightMesh(const fvMesh&, const argList& args, const bool binary);
ensightMesh
(
const fvMesh&,
const argList& args,
const bool binary
);
//- Destructor
@ -352,12 +400,36 @@ public:
return nPatchPrims_;
}
const List<faceSets>& faceZoneFaceSets() const
{
return faceZoneFaceSets_;
}
const wordHashSet& faceZoneNames() const
{
return faceZoneNames_;
}
const HashTable<nFacePrimitives>& nFaceZonePrims() const
{
return nFaceZonePrims_;
}
//- The ensight part id for the first patch
label patchPartOffset() const
{
return patchPartOffset_;
}
// Other
//- When exporting faceZones, check if a given face has to be included
// or not (i.e. faces on processor boundaries)
bool faceToBeIncluded(const label faceI) const;
//- Helper to cause barrier. Necessary on Quadrics.
static void barrier();
// I-O
@ -368,6 +440,7 @@ public:
const label timeIndex,
Ostream& ensightCaseFile
) const;
};

View File

@ -41,6 +41,9 @@ Usage
@param -noPatches \n
Suppress writing any patches.
@param -faceZones zoneList \n
Specify faceZones to write, with wildcards
Note
Parallel support for cloud data is not supported
- writes to @a EnSight directory to avoid collisions with foamToEnsightParts
@ -113,6 +116,12 @@ int main(int argc, char *argv[])
"specify particular patches to write - eg '(inlet outlet)'. "
"An empty list suppresses writing the internalMesh."
);
argList::addOption
(
"faceZones",
"wordList",
"specify faceZones to write, with wildcards - eg '(mfp-.*)'. "
);
# include "setRootCase.H"

View File

@ -59,8 +59,8 @@ printHeader() {
| ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: ${foamVersion} |
| \\\\ / A nd | |
| \\\\/ M anipulation | www.OpenFOAM.org |
| \\\\ / A nd | Web: www.OpenFOAM.org |
| \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/
FoamFile
{

View File

@ -147,6 +147,30 @@ case OPENMPI:
unset mpi_version
breaksw
case SYSTEMOPENMPI:
# This uses the installed openmpi. It needs mpicc installed!
set mpi_version=openmpi-system
# Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
setenv PINC `mpicc --showme:compile`
setenv PLIBS `mpicc --showme:link`
set libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using system installed MPI:"
echo " compile flags : $PINC"
echo " link flags : $PLIBS"
echo " libmpi dir : $libDir"
endif
_foamAddLib $libDir
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version libDir
breaksw
case MPICH:
set mpi_version=mpich2-1.1.1p1
setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version

View File

@ -183,6 +183,28 @@ OPENMPI)
unset mpi_version
;;
SYSTEMOPENMPI)
mpi_version=openmpi-system
# Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
export PINC=`mpicc --showme:compile`
export PLIBS=`mpicc --showme:link`
libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
if [ "$FOAM_VERBOSE" -a "$PS1" ]
then
echo "Using system installed MPI:"
echo " compile flags : $PINC"
echo " link flags : $PLIBS"
echo " libmpi dir : $libDir"
fi
_foamAddLib $libDir
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version libDir
;;
MPICH)
mpi_version=mpich2-1.1.1p1
export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version

View File

@ -27,14 +27,18 @@ wmake libso edgeMesh
wmake libso surfMesh
wmake libso triSurface
# Decomposition methods needed by meshTools
wmake libso parallel/decompositionMethods
wmake libso parallel/metisDecomp
# Decomposition methods needed by dummyThirdParty
parallel/AllwmakeLnInclude
# dummyThirdParty (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools
dummyThirdParty/Allwmake
wmake libso meshTools
wmake libso finiteVolume
wmake libso genericPatchFields
# Build the proper scotchDecomp, metisDecomp etc.
parallel/Allwmake
wmake libso sampling
wmake libso dynamicMesh

View File

@ -466,40 +466,6 @@ void Foam::FaceCellWave<Type>::transform
}
// Send face info to neighbour.
template <class Type>
void Foam::FaceCellWave<Type>::sendPatchInfo
(
const label neighbour,
const label nFaces,
const labelList& faceLabels,
const List<Type>& faceInfo
) const
{
OPstream toNeighbour(Pstream::blocking, neighbour);
writeFaces(nFaces, faceLabels, faceInfo, toNeighbour);
}
// Receive face info from neighbour
template <class Type>
Foam::label Foam::FaceCellWave<Type>::receivePatchInfo
(
const label neighbour,
labelList& faceLabels,
List<Type>& faceInfo
) const
{
IPstream fromNeighbour(Pstream::blocking, neighbour);
label nFaces = 0;
readFaces(nFaces, faceLabels, faceInfo, fromNeighbour);
return nFaces;
}
// Offset mesh face. Used for transferring from one cyclic half to the other.
template <class Type>
void Foam::FaceCellWave<Type>::offset
@ -523,6 +489,8 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
{
// Send all
PstreamBuffers pBufs(Pstream::nonBlocking);
forAll(mesh_.boundaryMesh(), patchI)
{
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
@ -564,16 +532,13 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
<< endl;
}
sendPatchInfo
(
procPatch.neighbProcNo(),
nSendFaces,
sendFaces,
sendFacesInfo
);
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour);
}
}
pBufs.finishedSends();
// Receive all
forAll(mesh_.boundaryMesh(), patchI)
@ -586,16 +551,20 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
refCast<const processorPolyPatch>(patch);
// Allocate buffers
label nReceiveFaces;
label nReceiveFaces = 0;
labelList receiveFaces(patch.size());
List<Type> receiveFacesInfo(patch.size());
nReceiveFaces = receivePatchInfo
(
procPatch.neighbProcNo(),
receiveFaces,
receiveFacesInfo
);
{
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
readFaces
(
nReceiveFaces,
receiveFaces,
receiveFacesInfo,
fromNeighbour
);
}
if (debug)
{

View File

@ -225,23 +225,6 @@ class FaceCellWave
List<Type>& faceInfo
) const;
//- Send info to neighbour
void sendPatchInfo
(
const label neighbour,
const label nFaces,
const labelList&,
const List<Type>&
) const;
//- Receive info from neighbour. Returns number of faces received.
label receivePatchInfo
(
const label neighbour,
labelList&,
List<Type>&
) const;
//- Offset face labels by constant value
static void offset
(

View File

@ -38,7 +38,8 @@ Foam::IPstream::IPstream
)
:
Pstream(commsType, bufSize),
UIPstream(commsType, fromProcNo, buf_)
UIPstream(commsType, fromProcNo, buf_, externalBufPosition_),
externalBufPosition_(0)
{}

View File

@ -55,6 +55,9 @@ class IPstream
public UIPstream
{
//- Receive index
label externalBufPosition_;
public:
// Constructors

View File

@ -51,10 +51,31 @@ Foam::PstreamBuffers::PstreamBuffers
version_(version),
sendBuf_(UPstream::nProcs()),
recvBuf_(UPstream::nProcs()),
recvBufPos_(UPstream::nProcs(), 0),
finishedSendsCalled_(false)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::PstreamBuffers::~PstreamBuffers()
{
// Check that all data has been consumed.
forAll(recvBufPos_, procI)
{
if (recvBufPos_[procI] < recvBuf_[procI].size())
{
FatalErrorIn("PstreamBuffers::~PstreamBuffers()")
<< "Message from processor " << procI
<< " not fully consumed. messageSize:" << recvBuf_[procI].size()
<< " bytes of which only " << recvBufPos_[procI]
<< " consumed."
<< Foam::abort(FatalError);
}
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::PstreamBuffers::finishedSends(const bool block)

View File

@ -106,6 +106,9 @@ class PstreamBuffers
//- receive buffer
List<DynamicList<char> > recvBuf_;
//- read position in recvBuf_
labelList recvBufPos_;
bool finishedSendsCalled_;
// Private member functions
@ -129,6 +132,10 @@ public:
IOstream::versionNumber version=IOstream::currentVersion
);
// Destructor
~PstreamBuffers();
// Member functions

View File

@ -77,20 +77,6 @@ inline void Foam::UIPstream::readFromBuffer
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::UIPstream::~UIPstream()
{
if (externalBufPosition_ < messageSize_)
{
FatalErrorIn("UIPstream::~UIPstream()")
<< "Message not fully consumed. messageSize:" << messageSize_
<< " bytes of which only " << externalBufPosition_
<< " consumed." << Foam::abort(FatalError);
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Istream& Foam::UIPstream::read(token& t)

View File

@ -63,7 +63,7 @@ class UIPstream
DynamicList<char>& externalBuf_;
label externalBufPosition_;
label& externalBufPosition_;
const int tag_;
@ -94,6 +94,7 @@ public:
const commsTypes commsType,
const int fromProcNo,
DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag = UPstream::msgType(),
streamFormat format=BINARY,
versionNumber version=currentVersion
@ -103,11 +104,6 @@ public:
UIPstream(const int fromProcNo, PstreamBuffers&);
// Destructor
~UIPstream();
// Member functions
// Inquiry

View File

@ -2,7 +2,7 @@
// addOverwriteOption.H
// ~~~~~~~~~~~~~~~~~~~~
Foam::argList::addOption
Foam::argList::addBoolOption
(
"overwrite",
"overwrite existing mesh/results files"

View File

@ -57,7 +57,6 @@ void Foam::cyclicPointPatch::calcGeometry(PstreamBuffers&)
{
const edgeList& cp = cyclicPolyPatch_.coupledPoints();
const labelList& mp = cyclicPolyPatch_.meshPoints();
const pointField& points = cyclicPolyPatch_.points();
DynamicList<label> separated;
forAll(cp, i)

View File

@ -36,6 +36,7 @@ Foam::UIPstream::UIPstream
const commsTypes commsType,
const int fromProcNo,
DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag,
streamFormat format,
versionNumber version
@ -45,7 +46,7 @@ Foam::UIPstream::UIPstream
Istream(format, version),
fromProcNo_(fromProcNo),
externalBuf_(externalBuf),
externalBufPosition_(0),
externalBufPosition_(externalBufPosition),
tag_(tag),
messageSize_(0)
{
@ -56,6 +57,7 @@ Foam::UIPstream::UIPstream
"const commsTypes,"
"const int fromProcNo,"
"DynamicList<char>&,"
"label&,"
"const int tag,"
"streamFormat, versionNumber"
")"

View File

@ -40,6 +40,7 @@ Foam::UIPstream::UIPstream
const commsTypes commsType,
const int fromProcNo,
DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag,
streamFormat format,
versionNumber version
@ -49,7 +50,7 @@ Foam::UIPstream::UIPstream
Istream(format, version),
fromProcNo_(fromProcNo),
externalBuf_(externalBuf),
externalBufPosition_(0),
externalBufPosition_(externalBufPosition),
tag_(tag),
messageSize_(0)
{
@ -122,7 +123,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
Istream(buffers.format_, buffers.version_),
fromProcNo_(fromProcNo),
externalBuf_(buffers.recvBuf_[fromProcNo]),
externalBufPosition_(0),
externalBufPosition_(buffers.recvBufPos_[fromProcNo]),
tag_(buffers.tag_),
messageSize_(0)
{

View File

@ -45,7 +45,7 @@ bool Foam::UOPstream::write
{
if (debug)
{
Pout<< "UIPstream::write : starting write to:" << toProcNo
Pout<< "UOPstream::write : starting write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
@ -67,7 +67,7 @@ bool Foam::UOPstream::write
if (debug)
{
Pout<< "UIPstream::write : finished write to:" << toProcNo
Pout<< "UOPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
@ -87,7 +87,7 @@ bool Foam::UOPstream::write
if (debug)
{
Pout<< "UIPstream::write : finished write to:" << toProcNo
Pout<< "UOPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
@ -110,7 +110,7 @@ bool Foam::UOPstream::write
if (debug)
{
Pout<< "UIPstream::write : started write to:" << toProcNo
Pout<< "UOPstream::write : started write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< " request:" << PstreamGlobals::outstandingRequests_.size()

11
src/dummyThirdParty/Allwmake vendored Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso scotchDecomp
wmake libso metisDecomp
wmake libso parMetisDecomp
wmake libso MGridGen
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,3 @@
dummyMGridGen.C
LIB = $(FOAM_LIBBIN)/dummy/libMGridGen

View File

@ -0,0 +1,3 @@
EXE_INC =
EXE_LIBS =

View File

@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
\*---------------------------------------------------------------------------*/
//extern "C"
//{
#include "mgridgen.h"
//}
#include "error.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
static const char* notImplementedMessage =
"You are trying to use MGridGen but do not have the MGridGen library loaded.\n"
"This message is from the dummy MGridGen stub library instead.\n"
"\n"
"Normally the MGridGen library will be loaded through the LD_LIBRARY_PATH\n"
"environment variable but you are picking up this dummy library from the\n"
"$FOAM_LIBBIN/dummy directory. Please install MGridGen and make sure the\n"
"libMGridGen.so is in your LD_LIBRARY_PATH.";
#ifdef __cplusplus
extern "C"
#endif
void MGridGen(int, idxtype *, realtype *, realtype *, idxtype *, realtype *,
int, int, int *, int *, int *, idxtype *)
{
FatalErrorIn("MGridGen(..)")
<< notImplementedMessage
<< Foam::exit(Foam::FatalError);
}
// ************************************************************************* //

64
src/dummyThirdParty/MGridGen/mgridgen.h vendored Normal file
View File

@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
C linkage
Description
Dummy stub for mgridgen library functions.
Only implements the absolute minimum we are using.
SourceFiles
dummyMGridGen.C
\*---------------------------------------------------------------------------*/
#ifndef mgridgen_H
#define mgridgen_H
#include "scalar.H"
#ifndef idxtype
#define idxtype int
#define realtype Foam::scalar
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
/*---------------------------------------------------------------------------*\
Class metis Declaration
\*---------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
#endif
void MGridGen(int, idxtype *, realtype *, realtype *, idxtype *, realtype *,
int, int, int *, int *, int *, idxtype *);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
dummyMetisDecomp.C
LIB = $(FOAM_LIBBIN)/dummy/libmetisDecomp

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(FOAM_SRC)/parallel/decompositionMethods/lnInclude \
-I$(FOAM_SRC)/parallel/metisDecomp/lnInclude
LIB_LIBS =

View File

@ -0,0 +1,156 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "metisDecomp.H"
#include "addToRunTimeSelectionTable.H"
#include "Time.H"
static const char* notImplementedMessage =
"You are trying to use metis but do not have the metisDecomp library loaded."
"\nThis message is from the dummy metisDecomp stub library instead.\n"
"\n"
"Please install metis and make sure that libmetis.so is in your "
"LD_LIBRARY_PATH.\n"
"The metisDecomp library can then be built in $FOAM_SRC/decompositionMethods/"
"metisDecomp\n";
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(metisDecomp, 0);
addToRunTimeSelectionTable
(
decompositionMethod,
metisDecomp,
dictionaryMesh
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::label Foam::metisDecomp::decompose
(
const List<int>& adjncy,
const List<int>& xadj,
const scalarField& cellWeights,
List<int>& finalDecomp
)
{
FatalErrorIn
(
"labelList metisDecomp::decompose"
"("
"const List<int>&, "
"const List<int>&, "
"const scalarField&, "
"List<int>&"
")"
) << notImplementedMessage << exit(FatalError);
return -1;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::metisDecomp::metisDecomp
(
const dictionary& decompositionDict,
const polyMesh& mesh
)
:
decompositionMethod(decompositionDict),
mesh_(mesh)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::labelList Foam::metisDecomp::decompose
(
const pointField& points,
const scalarField& pointWeights
)
{
FatalErrorIn
(
"labelList metisDecomp::decompose"
"("
"const pointField&, "
"const scalarField&"
")"
) << notImplementedMessage << exit(FatalError);
return labelList();
}
Foam::labelList Foam::metisDecomp::decompose
(
const labelList& agglom,
const pointField& agglomPoints,
const scalarField& agglomWeights
)
{
FatalErrorIn
(
"labelList metisDecomp::decompose"
"("
"const labelList&, "
"const pointField&, "
"const scalarField&"
")"
) << notImplementedMessage << exit(FatalError);
return labelList();
}
Foam::labelList Foam::metisDecomp::decompose
(
const labelListList& globalCellCells,
const pointField& cellCentres,
const scalarField& cellWeights
)
{
FatalErrorIn
(
"labelList metisDecomp::decompose"
"("
"const labelListList&, "
"const pointField&, "
"const scalarField&"
")"
) << notImplementedMessage << exit(FatalError);
return labelList();
}
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
dummyParMetisDecomp.C
LIB = $(FOAM_LIBBIN)/dummy/libparMetisDecomp

View File

@ -0,0 +1,5 @@
EXE_INC = \
-I$(FOAM_SRC)/parallel/decompositionMethods/lnInclude \
-I$(FOAM_SRC)/parallel/parMetisDecomp/lnInclude
LIB_LIBS =

View File

@ -0,0 +1,185 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "parMetisDecomp.H"
#include "addToRunTimeSelectionTable.H"
#include "polyMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(parMetisDecomp, 0);
addToRunTimeSelectionTable
(
decompositionMethod,
parMetisDecomp,
dictionaryMesh
);
}
static const char* notImplementedMessage =
"You are trying to use parMetis but do not have the parMetisDecomp library "
"loaded.\n"
"This message is from the dummy parMetisDecomp stub library instead.\n"
"\n"
"Please install parMetis and make sure that libparMetis.so is in your "
"LD_LIBRARY_PATH.\n"
"The parMetisDecomp library can then be built in $FOAM_SRC/decompositionMethods/"
"parMetisDecomp\n";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
//- Does prevention of 0 cell domains and calls parmetis.
Foam::label Foam::parMetisDecomp::decompose
(
Field<int>& xadj,
Field<int>& adjncy,
const pointField& cellCentres,
Field<int>& cellWeights,
Field<int>& faceWeights,
const List<int>& options,
List<int>& finalDecomp
)
{
FatalErrorIn
(
"label parMetisDecomp::decompose"
"("
"Field<int>&, "
"Field<int>&, "
"const pointField&, "
"Field<int>&, "
"Field<int>&, "
"const List<int>&, "
"List<int>&"
")"
)<< notImplementedMessage << exit(FatalError);
return -1;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::parMetisDecomp::parMetisDecomp
(
const dictionary& decompositionDict,
const polyMesh& mesh
)
:
decompositionMethod(decompositionDict),
mesh_(mesh)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::labelList Foam::parMetisDecomp::decompose
(
const pointField& cc,
const scalarField& cWeights
)
{
FatalErrorIn
(
"labelList parMetisDecomp::decompose"
"("
"const pointField&, "
"const scalarField&"
")"
) << notImplementedMessage << exit(FatalError);
return labelList();
}
Foam::labelList Foam::parMetisDecomp::decompose
(
const labelList& cellToRegion,
const pointField& regionPoints,
const scalarField& regionWeights
)
{
FatalErrorIn
(
"labelList parMetisDecomp::decompose"
"("
"const labelList&, "
"const pointField&, "
"const scalarField&"
")"
) << notImplementedMessage << exit(FatalError);
return labelList();
}
Foam::labelList Foam::parMetisDecomp::decompose
(
const labelListList& globalCellCells,
const pointField& cellCentres,
const scalarField& cWeights
)
{
FatalErrorIn
(
"labelList parMetisDecomp::decompose"
"("
"const labelListList&, "
"const pointField&, "
"const scalarField&"
")"
) << notImplementedMessage << exit(FatalError);
return labelList();
}
void Foam::parMetisDecomp::calcMetisDistributedCSR
(
const polyMesh& mesh,
List<int>& adjncy,
List<int>& xadj
)
{
FatalErrorIn
(
"void parMetisDecomp::calcMetisDistributedCSR"
"("
"const polyMesh&, "
"List<int>&, "
"List<int>&"
")"
) << notImplementedMessage << exit(FatalError);
}
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
dummyScotchDecomp.C
LIB = $(FOAM_LIBBIN)/dummy/libscotchDecomp

View File

@ -0,0 +1,6 @@
EXE_INC = \
-I$(FOAM_SRC)/parallel/decompositionMethods/lnInclude \
-I$(FOAM_SRC)/parallel/scotchDecomp/lnInclude
LIB_LIBS =

View File

@ -0,0 +1,280 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
From scotch forum:
By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ]
2008-08-22 10:09 Strategy handling in Scotch is a bit tricky. In order
not to be confused, you must have a clear view of how they are built.
Here are some rules:
1- Strategies are made up of "methods" which are combined by means of
"operators".
2- A method is of the form "m{param=value,param=value,...}", where "m"
is a single character (this is your first error: "f" is a method name,
not a parameter name).
3- There exist different sort of strategies : bipartitioning strategies,
mapping strategies, ordering strategies, which cannot be mixed. For
instance, you cannot build a bipartitioning strategy and feed it to a
mapping method (this is your second error).
To use the "mapCompute" routine, you must create a mapping strategy, not
a bipartitioning one, and so use stratGraphMap() and not
stratGraphBipart(). Your mapping strategy should however be based on the
"recursive bipartitioning" method ("b"). For instance, a simple (and
hence not very efficient) mapping strategy can be :
"b{sep=f}"
which computes mappings with the recursive bipartitioning method "b",
this latter using the Fiduccia-Mattheyses method "f" to compute its
separators.
If you want an exact partition (see your previous post), try
"b{sep=fx}".
However, these strategies are not the most efficient, as they do not
make use of the multi-level framework.
To use the multi-level framework, try for instance:
"b{sep=m{vert=100,low=h,asc=f}x}"
The current default mapping strategy in Scotch can be seen by using the
"-vs" option of program gmap. It is, to date:
b
{
job=t,
map=t,
poli=S,
sep=
(
m
{
asc=b
{
bnd=d{pass=40,dif=1,rem=1}f{move=80,pass=-1,bal=0.005},
org=f{move=80,pass=-1,bal=0.005},
width=3
},
low=h{pass=10}f{move=80,pass=-1,bal=0.0005},
type=h,
vert=80,
rat=0.8
}
| m
{
asc=b
{
bnd=d{pass=40,dif=1,rem=1}f{move=80,pass=-1,bal=0.005},
org=f{move=80,pass=-1,bal=0.005},
width=3
},
low=h{pass=10}f{move=80,pass=-1,bal=0.0005},
type=h,
vert=80,
rat=0.8
}
)
}
\*---------------------------------------------------------------------------*/
#include "scotchDecomp.H"
#include "addToRunTimeSelectionTable.H"
#include "Time.H"
static const char* notImplementedMessage =
"You are trying to use scotch but do not have the scotchDecomp library loaded."
"\nThis message is from the dummy scotchDecomp stub library instead.\n"
"\n"
"Please install scotch and make sure that libscotch.so is in your "
"LD_LIBRARY_PATH.\n"
"The scotchDecomp library can then be built in $FOAM_SRC/decompositionMethods/"
"scotchDecomp\n";
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(scotchDecomp, 0);
addToRunTimeSelectionTable
(
decompositionMethod,
scotchDecomp,
dictionaryMesh
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::scotchDecomp::check(const int retVal, const char* str)
{}
Foam::label Foam::scotchDecomp::decompose
(
const List<int>& adjncy,
const List<int>& xadj,
const scalarField& cWeights,
List<int>& finalDecomp
)
{
FatalErrorIn
(
"label scotchDecomp::decompose"
"("
"const List<int>&, "
"const List<int>&, "
"const scalarField&, "
"List<int>&"
")"
) << notImplementedMessage << exit(FatalError);
return -1;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::scotchDecomp::scotchDecomp
(
const dictionary& decompositionDict,
const polyMesh& mesh
)
:
decompositionMethod(decompositionDict),
mesh_(mesh)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::labelList Foam::scotchDecomp::decompose
(
const pointField& points,
const scalarField& pointWeights
)
{
FatalErrorIn
(
"labelList scotchDecomp::decompose"
"("
"const pointField&, "
"const scalarField&"
")"
) << notImplementedMessage << exit(FatalError);
return labelList::null();
}
Foam::labelList Foam::scotchDecomp::decompose
(
const labelList& agglom,
const pointField& agglomPoints,
const scalarField& pointWeights
)
{
FatalErrorIn
(
"labelList scotchDecomp::decompose"
"("
"const labelList&, "
"const pointField&, "
"const scalarField&"
")"
) << notImplementedMessage << exit(FatalError);
return labelList::null();
}
Foam::labelList Foam::scotchDecomp::decompose
(
const labelListList& globalCellCells,
const pointField& cellCentres,
const scalarField& cWeights
)
{
FatalErrorIn
(
"labelList scotchDecomp::decompose"
"("
"const labelListList&, "
"const pointField&, "
"const scalarField&"
")"
) << notImplementedMessage << exit(FatalError);
return labelList::null();
}
void Foam::scotchDecomp::calcCSR
(
const polyMesh& mesh,
List<int>& adjncy,
List<int>& xadj
)
{
FatalErrorIn
(
"labelList scotchDecomp::decompose"
"("
"const polyMesh&, "
"const List<int>&, "
"const List<int>&"
")"
) << notImplementedMessage << exit(FatalError);
}
void Foam::scotchDecomp::calcCSR
(
const labelListList& cellCells,
List<int>& adjncy,
List<int>& xadj
)
{
FatalErrorIn
(
"labelList scotchDecomp::decompose"
"("
"const labelListList&, "
"const List<int>&, "
"const List<int>&"
")"
) << notImplementedMessage << exit(FatalError);
}
// ************************************************************************* //

View File

@ -123,6 +123,32 @@ angularOscillatingDisplacementPointPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void angularOscillatingDisplacementPointPatchVectorField::autoMap
(
const pointPatchFieldMapper& m
)
{
fixedValuePointPatchField<vector>::autoMap(m);
p0_.autoMap(m);
}
void angularOscillatingDisplacementPointPatchVectorField::rmap
(
const pointPatchField<vector>& ptf,
const labelList& addr
)
{
const angularOscillatingDisplacementPointPatchVectorField& aODptf =
refCast<const angularOscillatingDisplacementPointPatchVectorField>(ptf);
fixedValuePointPatchField<vector>::rmap(aODptf, addr);
p0_.rmap(aODptf.p0_, addr);
}
void angularOscillatingDisplacementPointPatchVectorField::updateCoeffs()
{
if (this->updated())

View File

@ -132,6 +132,22 @@ public:
// Member functions
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const pointPatchFieldMapper&
);
//- Reverse map the given pointPatchField onto this pointPatchField
virtual void rmap
(
const pointPatchField<vector>&,
const labelList&
);
// Evaluation functions
//- Update the coefficients associated with the patch field

View File

@ -123,6 +123,32 @@ angularOscillatingVelocityPointPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void angularOscillatingVelocityPointPatchVectorField::autoMap
(
const pointPatchFieldMapper& m
)
{
fixedValuePointPatchField<vector>::autoMap(m);
p0_.autoMap(m);
}
void angularOscillatingVelocityPointPatchVectorField::rmap
(
const pointPatchField<vector>& ptf,
const labelList& addr
)
{
const angularOscillatingVelocityPointPatchVectorField& aOVptf =
refCast<const angularOscillatingVelocityPointPatchVectorField>(ptf);
fixedValuePointPatchField<vector>::rmap(aOVptf, addr);
p0_.rmap(aOVptf.p0_, addr);
}
void angularOscillatingVelocityPointPatchVectorField::updateCoeffs()
{
if (this->updated())

View File

@ -132,6 +132,22 @@ public:
// Member functions
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const pointPatchFieldMapper&
);
//- Reverse map the given pointPatchField onto this pointPatchField
virtual void rmap
(
const pointPatchField<vector>&,
const labelList&
);
// Evaluation functions
//- Update the coefficients associated with the patch field

View File

@ -111,6 +111,32 @@ oscillatingVelocityPointPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void oscillatingVelocityPointPatchVectorField::autoMap
(
const pointPatchFieldMapper& m
)
{
fixedValuePointPatchField<vector>::autoMap(m);
p0_.autoMap(m);
}
void oscillatingVelocityPointPatchVectorField::rmap
(
const pointPatchField<vector>& ptf,
const labelList& addr
)
{
const oscillatingVelocityPointPatchVectorField& oVptf =
refCast<const oscillatingVelocityPointPatchVectorField>(ptf);
fixedValuePointPatchField<vector>::rmap(oVptf, addr);
p0_.rmap(oVptf.p0_, addr);
}
void oscillatingVelocityPointPatchVectorField::updateCoeffs()
{
if (this->updated())

View File

@ -129,6 +129,22 @@ public:
// Member functions
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const pointPatchFieldMapper&
);
//- Reverse map the given pointPatchField onto this pointPatchField
virtual void rmap
(
const pointPatchField<vector>&,
const labelList&
);
// Evaluation functions
//- Update the coefficients associated with the patch field

View File

@ -39,11 +39,6 @@ SourceFiles
#ifndef ReactingParcel_H
#define ReactingParcel_H
#include "IOstream.H"
#include "autoPtr.H"
#include "interpolationCellPoint.H"
#include "contiguous.H"
#include "ThermoParcel.H"
#include "ReactingCloud.H"
#include "reactingParcel.H"

View File

@ -40,11 +40,6 @@ SourceFiles
#ifndef ThermoParcel_H
#define ThermoParcel_H
#include "IOstream.H"
#include "autoPtr.H"
#include "interpolationCellPoint.H"
#include "contiguous.H"
#include "KinematicParcel.H"
#include "ThermoCloud.H"

View File

@ -6,5 +6,4 @@ EXE_INC = \
LIB_LIBS = \
-ltriSurface \
-ldecompositionMethods \
-lmetisDecompositionMethod \
-llagrangian

View File

@ -2433,7 +2433,7 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLineAny
template <class Type>
Foam::labelList Foam::indexedOctree<Type>::findBox
(
const boundBox& searchBox
const treeBoundBox& searchBox
) const
{
// Storage for labels of shapes inside bb. Size estimate.

View File

@ -546,7 +546,7 @@ public:
//- Find (in no particular order) indices of all shapes inside or
// overlapping bounding box (i.e. all shapes not outside box)
labelList findBox(const boundBox& bb) const;
labelList findBox(const treeBoundBox& bb) const;
//- Find deepest node (as parent+octant) containing point. Starts
// off from starting index in nodes_ (use 0 to start from top)

View File

@ -2,7 +2,9 @@
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso decompositionMethods
wmakeLnInclude decompositionMethods
wmake libso scotchDecomp
wmake libso metisDecomp
wmake libso reconstruct
@ -11,4 +13,7 @@ then
( WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB; wmake libso parMetisDecomp )
fi
wmake libso decompositionMethods
# ----------------------------------------------------------------- end-of-file

8
src/parallel/AllwmakeLnInclude Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmakeLnInclude decompositionMethods
wmakeLnInclude metisDecomp
wmakeLnInclude parMetisDecomp
wmakeLnInclude scotchDecomp

View File

@ -4,6 +4,4 @@ simpleGeomDecomp/simpleGeomDecomp.C
hierarchGeomDecomp/hierarchGeomDecomp.C
manualDecomp/manualDecomp.C
scotchDecomp/scotchDecomp.C
LIB = $(FOAM_LIBBIN)/libdecompositionMethods

View File

@ -1,6 +1,9 @@
EXE_INC = \
-I$(WM_THIRD_PARTY_DIR)/scotch_5.1/include \
-I../metisDecomp/lnInclude
EXE_INC =
LIB_LIBS = \
-lscotch -lscotcherrexit
-L$(FOAM_LIBBIN)/dummy \
-L$(FOAM_MPI_LIBBIN) \
-lscotchDecomp \
-lmetisDecomp \
-lparMetisDecomp

View File

@ -1,3 +1,3 @@
metisDecomp.C
LIB = $(FOAM_LIBBIN)/libmetisDecompositionMethod
LIB = $(FOAM_LIBBIN)/libmetisDecomp

View File

@ -1,6 +1,7 @@
EXE_INC = \
-I$(WM_THIRD_PARTY_DIR)/metis-5.0pre2/include \
-I../decompositionMethods/lnInclude
-I../decompositionMethods/lnInclude \
-I../scotchDecomp/lnInclude
LIB_LIBS = \
-lmetis \

View File

@ -1,3 +1,3 @@
parMetisDecomp.C
LIB = $(FOAM_MPI_LIBBIN)/libparMetisDecompositionMethod
LIB = $(FOAM_MPI_LIBBIN)/libparMetisDecomp

View File

@ -5,7 +5,8 @@ EXE_INC = \
-I$(WM_THIRD_PARTY_DIR)/ParMetis-3.1/ParMETISLib \
-I$(WM_THIRD_PARTY_DIR)/ParMetis-3.1 \
-I../decompositionMethods/lnInclude \
-I../metisDecomp/lnInclude
-I../metisDecomp/lnInclude \
-I../scotchDecomp/lnInclude
LIB_LIBS = \
-L$(FOAM_MPI_LIBBIN) \

View File

@ -0,0 +1,3 @@
scotchDecomp.C
LIB = $(FOAM_LIBBIN)/libscotchDecomp

View File

@ -0,0 +1,7 @@
EXE_INC = \
-I$(WM_THIRD_PARTY_DIR)/scotch_5.1/include \
-I/usr/include/scotch \
-I../decompositionMethods/lnInclude
LIB_LIBS = \
-lscotch -lscotcherrexit

View File

@ -48,7 +48,7 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
:
fixedValuePointPatchField<vector>(p, iF),
motion_(),
p0_(p.localPoints()),
initialPoints_(p.localPoints()),
rhoInf_(1.0)
{}
@ -70,13 +70,13 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
updateCoeffs();
}
if (dict.found("p0"))
if (dict.found("initialPoints"))
{
p0_ = vectorField("p0", dict , p.size());
initialPoints_ = vectorField("initialPoints", dict , p.size());
}
else
{
p0_ = p.localPoints();
initialPoints_ = p.localPoints();
}
}
@ -92,7 +92,7 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
:
fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
motion_(ptf.motion_),
p0_(ptf.p0_, mapper),
initialPoints_(ptf.initialPoints_, mapper),
rhoInf_(ptf.rhoInf_)
{}
@ -106,13 +106,42 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
:
fixedValuePointPatchField<vector>(ptf, iF),
motion_(ptf.motion_),
p0_(ptf.p0_),
initialPoints_(ptf.initialPoints_),
rhoInf_(ptf.rhoInf_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::autoMap
(
const pointPatchFieldMapper& m
)
{
fixedValuePointPatchField<vector>::autoMap(m);
initialPoints_.autoMap(m);
}
void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::rmap
(
const pointPatchField<vector>& ptf,
const labelList& addr
)
{
const uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField& uSDoFptf =
refCast
<
const uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
>(ptf);
fixedValuePointPatchField<vector>::rmap(uSDoFptf, addr);
initialPoints_.rmap(uSDoFptf.initialPoints_, addr);
}
void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
{
if (this->updated())
@ -138,7 +167,10 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
// Do not modify the accelerations, except with gravity, where available
motion_.updateForce(gravity*motion_.mass(), vector::zero, t.deltaTValue());
Field<vector>::operator=(motion_.currentPosition(p0_) - p0_);
Field<vector>::operator=
(
motion_.currentPosition(initialPoints_) - initialPoints_
);
fixedValuePointPatchField<vector>::updateCoeffs();
}
@ -153,7 +185,7 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::write
motion_.write(os);
os.writeKeyword("rhoInf")
<< rhoInf_ << token::END_STATEMENT << nl;
p0_.writeEntry("p0", os);
initialPoints_.writeEntry("initialPoints", os);
writeEntry("value", os);
}

View File

@ -57,8 +57,8 @@ class uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
//- Six dof motion object
sixDoFRigidBodyMotion motion_;
//- Reference positions of points on the patch
pointField p0_;
//- Initial positions of points on the patch
pointField initialPoints_;
//- Reference density required by the forces object for
// incompressible calculations. Retained here to give
@ -136,6 +136,22 @@ public:
// Member functions
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const pointPatchFieldMapper&
);
//- Reverse map the given pointPatchField onto this pointPatchField
virtual void rmap
(
const pointPatchField<vector>&,
const labelList&
);
// Evaluation functions
//- Update the coefficients associated with the patch field

View File

@ -284,6 +284,7 @@ Foam::distanceSurface::distanceSurface
distance_(readScalar(dict.lookup("distance"))),
signed_(readBool(dict.lookup("signed"))),
regularise_(dict.lookupOrDefault("regularise", true)),
average_(dict.lookupOrDefault("average", false)),
zoneName_(word::null),
needsUpdate_(true),
isoSurfPtr_(NULL),

View File

@ -68,6 +68,9 @@ class distanceSurface
//- Whether to coarsen
const Switch regularise_;
//- Whether to recalculate cell values as average of point values
const Switch average_;
//- zone name (if restricted to zones)
word zoneName_;

View File

@ -62,7 +62,15 @@ Foam::distanceSurface::interpolateField
);
// Sample.
return surface().interpolate(volFld, pointFld());
return surface().interpolate
(
(
average_
? pointAverage(pointFld())()
: volFld
),
pointFld()
);
}

View File

@ -164,7 +164,10 @@ void Foam::sampledIsoSurface::getIsoFields() const
// point field.
if (average_)
{
storedVolFieldPtr_.reset(average(fvm, *pointFieldPtr_).ptr());
storedVolFieldPtr_.reset
(
pointAverage(*pointFieldPtr_).ptr()
);
volFieldPtr_ = storedVolFieldPtr_.operator->();
}
@ -265,7 +268,7 @@ void Foam::sampledIsoSurface::getIsoFields() const
{
storedVolSubFieldPtr_.reset
(
average(subFvm, *pointSubFieldPtr_).ptr()
pointAverage(*pointSubFieldPtr_).ptr()
);
volSubFieldPtr_ = storedVolSubFieldPtr_.operator->();
}
@ -286,99 +289,6 @@ void Foam::sampledIsoSurface::getIsoFields() const
}
Foam::tmp<Foam::volScalarField> Foam::sampledIsoSurface::average
(
const fvMesh& mesh,
const pointScalarField& pfld
) const
{
tmp<volScalarField> tcellAvg
(
new volScalarField
(
IOobject
(
"cellAvg",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh,
dimensionedScalar("zero", dimless, scalar(0.0))
)
);
volScalarField& cellAvg = tcellAvg();
labelField nPointCells(mesh.nCells(), 0);
{
for (label pointI = 0; pointI < mesh.nPoints(); pointI++)
{
const labelList& pCells = mesh.pointCells(pointI);
forAll(pCells, i)
{
label cellI = pCells[i];
cellAvg[cellI] += pfld[pointI];
nPointCells[cellI]++;
}
}
}
forAll(cellAvg, cellI)
{
cellAvg[cellI] /= nPointCells[cellI];
}
// Give value to calculatedFvPatchFields
cellAvg.correctBoundaryConditions();
return tcellAvg;
}
Foam::tmp<Foam::pointScalarField> Foam::sampledIsoSurface::average
(
const pointMesh& pMesh,
const volScalarField& fld
) const
{
tmp<pointScalarField> tpointAvg
(
new pointScalarField
(
IOobject
(
"pointAvg",
fld.time().timeName(),
fld.db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
pMesh,
dimensionedScalar("zero", dimless, scalar(0.0))
)
);
pointScalarField& pointAvg = tpointAvg();
for (label pointI = 0; pointI < fld.mesh().nPoints(); pointI++)
{
const labelList& pCells = fld.mesh().pointCells(pointI);
forAll(pCells, i)
{
pointAvg[pointI] += fld[pCells[i]];
}
pointAvg[pointI] /= pCells.size();
}
// Give value to calculatedFvPatchFields
pointAvg.correctBoundaryConditions();
return tpointAvg;
}
bool Foam::sampledIsoSurface::updateGeometry() const
{
const fvMesh& fvm = static_cast<const fvMesh&>(mesh());

View File

@ -118,18 +118,6 @@ class sampledIsoSurface
//- Get fields needed to recreate iso surface.
void getIsoFields() const;
tmp<volScalarField> average
(
const fvMesh&,
const pointScalarField&
) const;
tmp<pointScalarField> average
(
const pointMesh&,
const volScalarField& fld
) const;
//- Create iso surface (if time has changed)
// Do nothing (and return false) if no update was needed
bool updateGeometry() const;

View File

@ -71,7 +71,15 @@ Foam::sampledIsoSurface::interpolateField
volPointInterpolation::New(volSubFld.mesh()).interpolate(volSubFld);
// Sample.
return surface().interpolate(volSubFld, tpointSubFld());
return surface().interpolate
(
(
average_
? pointAverage(tpointSubFld())()
: volSubFld
),
tpointSubFld()
);
}
else
{
@ -79,7 +87,15 @@ Foam::sampledIsoSurface::interpolateField
volPointInterpolation::New(volFld.mesh()).interpolate(volFld);
// Sample.
return surface().interpolate(volFld, tpointFld());
return surface().interpolate
(
(
average_
? pointAverage(tpointFld())()
: volFld
),
tpointFld()
);
}
}

View File

@ -254,6 +254,7 @@ Foam::sampledCuttingPlane::sampledCuttingPlane
plane_(dict),
mergeTol_(dict.lookupOrDefault("mergeTol", 1E-6)),
regularise_(dict.lookupOrDefault("regularise", true)),
average_(dict.lookupOrDefault("average", false)),
zoneID_(dict.lookupOrDefault("zone", word::null), mesh.cellZones()),
exposedPatchName_(word::null),
needsUpdate_(true),

View File

@ -66,6 +66,9 @@ class sampledCuttingPlane
//- Whether to coarsen
const Switch regularise_;
//- Whether to recalculate cell values as average of point values
const Switch average_;
//- zone name/index (if restricted to zones)
mutable cellZoneID zoneID_;

View File

@ -67,7 +67,15 @@ Foam::sampledCuttingPlane::interpolateField
volPointInterpolation::New(volSubFld.mesh()).interpolate(volSubFld);
// Sample.
return surface().interpolate(volSubFld, tpointSubFld());
return surface().interpolate
(
(
average_
? pointAverage(tpointSubFld())()
: volSubFld
),
tpointSubFld()
);
}
else
{
@ -77,7 +85,15 @@ Foam::sampledCuttingPlane::interpolateField
);
// Sample.
return surface().interpolate(volFld, tpointFld());
return surface().interpolate
(
(
average_
? pointAverage(tpointFld())()
: volFld
),
tpointFld()
);
}
}

View File

@ -312,6 +312,13 @@ public:
//- Project field onto surface
tmp<Field<vector> > project(const Field<tensor>&) const;
//- Interpolate from points to cell centre
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> > pointAverage
(
const GeometricField<Type, pointPatchField, pointMesh>& pfld
) const;
//- Sample field on surface
virtual tmp<scalarField> sample
(

View File

@ -155,4 +155,59 @@ Foam::sampledSurface::project
}
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >
Foam::sampledSurface::pointAverage
(
const GeometricField<Type, pointPatchField, pointMesh>& pfld
) const
{
const fvMesh& mesh = dynamic_cast<const fvMesh&>(pfld.mesh()());
tmp<GeometricField<Type, fvPatchField, volMesh> > tcellAvg
(
new GeometricField<Type, fvPatchField, volMesh>
(
IOobject
(
"cellAvg",
mesh.time().timeName(),
pfld.db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh,
dimensioned<Type>("zero", dimless, pTraits<Type>::zero)
)
);
GeometricField<Type, fvPatchField, volMesh>& cellAvg = tcellAvg();
labelField nPointCells(mesh.nCells(), 0);
{
for (label pointI = 0; pointI < mesh.nPoints(); pointI++)
{
const labelList& pCells = mesh.pointCells(pointI);
forAll(pCells, i)
{
label cellI = pCells[i];
cellAvg[cellI] += pfld[pointI];
nPointCells[cellI]++;
}
}
}
forAll(cellAvg, cellI)
{
cellAvg[cellI] /= nPointCells[cellI];
}
// Give value to calculatedFvPatchFields
cellAvg.correctBoundaryConditions();
return tcellAvg;
}
// ************************************************************************* //

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) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -146,7 +146,7 @@ bool Foam::sampledTriSurfaceMesh::update()
// Find the cells the triangles of the surface are in.
// Does approximation by looking at the face centres only
const pointField fc = surface_.faceCentres();
const pointField& fc = surface_.faceCentres();
cellLabels_.setSize(fc.size());

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) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -246,8 +246,7 @@ Foam::tmp<Foam::volScalarField> Foam::ePsiThermo<MixtureType>::Cp() const
IOobject::NO_WRITE
),
mesh,
dimensionSet(0, 2, -2, -1, 0),
this->T_.boundaryField().types()
dimensionSet(0, 2, -2, -1, 0)
)
);

View File

@ -244,8 +244,7 @@ Foam::tmp<Foam::volScalarField> Foam::hPsiThermo<MixtureType>::Cp() const
IOobject::NO_WRITE
),
mesh,
dimensionSet(0, 2, -2, -1, 0),
this->T_.boundaryField().types()
dimensionSet(0, 2, -2, -1, 0)
)
);

View File

@ -244,8 +244,7 @@ Foam::tmp<Foam::volScalarField> Foam::hsPsiThermo<MixtureType>::Cp() const
IOobject::NO_WRITE
),
mesh,
dimensionSet(0, 2, -2, -1, 0),
this->T_.boundaryField().types()
dimensionSet(0, 2, -2, -1, 0)
)
);

View File

@ -243,8 +243,7 @@ Foam::tmp<Foam::volScalarField> Foam::hRhoThermo<MixtureType>::Cp() const
IOobject::NO_WRITE
),
mesh,
dimensionSet(0, 2, -2, -1, 0),
this->T_.boundaryField().types()
dimensionSet(0, 2, -2, -1, 0)
)
);

View File

@ -243,8 +243,7 @@ Foam::tmp<Foam::volScalarField> Foam::hsRhoThermo<MixtureType>::Cp() const
IOobject::NO_WRITE
),
mesh,
dimEnergy/dimMass/dimTemperature,
this->T_.boundaryField().types()
dimEnergy/dimMass/dimTemperature
)
);

View File

@ -32,7 +32,12 @@ Class
Foam::viscosityModel
Description
An abstract base class for incompressible viscosityModels
An abstract base class for incompressible viscosityModels.
The strain rate is defined by:
mag(symm(grad(U)))
SourceFiles
viscosityModel.C
@ -131,10 +136,9 @@ public:
);
// Destructor
virtual ~viscosityModel()
{}
//- Destructor
virtual ~viscosityModel()
{}
// Member Functions
@ -145,7 +149,7 @@ public:
return viscosityProperties_;
}
//- Return the strain rate mag(grad(U))
//- Return the strain rate
tmp<volScalarField> strainRate() const;
//- Return the laminar viscosity

View File

@ -42,71 +42,6 @@ namespace compressible
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::interfaceOwner
(
const polyMesh& nbrRegion,
const polyPatch& nbrPatch
) const
{
const fvMesh& myRegion = patch().boundaryMesh().mesh();
if (nbrRegion.name() == myRegion.name())
{
return patch().index() < nbrPatch.index();
}
else
{
const regionProperties& props =
myRegion.objectRegistry::parent().lookupObject<regionProperties>
(
"regionProperties"
);
label myIndex = findIndex(props.fluidRegionNames(), myRegion.name());
if (myIndex == -1)
{
label i = findIndex(props.solidRegionNames(), myRegion.name());
if (i == -1)
{
FatalErrorIn
(
"turbulentTemperatureCoupledBaffleMixedFvPatchScalarField"
"::interfaceOwner(const polyMesh&"
", const polyPatch&)const"
) << "Cannot find region " << myRegion.name()
<< " neither in fluids " << props.fluidRegionNames()
<< " nor in solids " << props.solidRegionNames()
<< exit(FatalError);
}
myIndex = props.fluidRegionNames().size() + i;
}
label nbrIndex = findIndex
(
props.fluidRegionNames(),
nbrRegion.name()
);
if (nbrIndex == -1)
{
label i = findIndex(props.solidRegionNames(), nbrRegion.name());
if (i == -1)
{
FatalErrorIn
(
"coupleManager::interfaceOwner"
"(const polyMesh&, const polyPatch&) const"
) << "Cannot find region " << nbrRegion.name()
<< " neither in fluids " << props.fluidRegionNames()
<< " nor in solids " << props.solidRegionNames()
<< exit(FatalError);
}
nbrIndex = props.fluidRegionNames().size() + i;
}
return myIndex < nbrIndex;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -124,7 +59,6 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 1.0;
this->fixesValue_ = true;
}
@ -139,8 +73,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
neighbourFieldName_(ptf.neighbourFieldName_),
KName_(ptf.KName_),
fixesValue_(ptf.fixesValue_)
KName_(ptf.KName_)
{}
@ -183,7 +116,6 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
fixesValue_ = readBool(dict.lookup("fixesValue"));
}
else
{
@ -191,7 +123,6 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
refValue() = *this;
refGrad() = 0.0;
valueFraction() = 1.0;
fixesValue_ = true;
}
}
@ -205,8 +136,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
:
mixedFvPatchScalarField(wtcsf, iF),
neighbourFieldName_(wtcsf.neighbourFieldName_),
KName_(wtcsf.KName_),
fixesValue_(wtcsf.fixesValue_)
KName_(wtcsf.KName_)
{}
@ -281,95 +211,80 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
(void)distMap.schedule();
tmp<scalarField> intFld = patchInternalField();
if (interfaceOwner(nbrMesh, nbrPatch.patch()))
{
// Note: other side information could be cached - it only needs
// to be updated the first time round the iteration (i.e. when
// switching regions) but unfortunately we don't have this information.
// Calculate the temperature by harmonic averaging
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Calculate the temperature by harmonic averaging
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField&
nbrField =
refCast
<
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
>
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField& nbrField =
refCast
<
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
>
(
nbrPatch.lookupPatchField<volScalarField, scalar>
(
nbrPatch.lookupPatchField<volScalarField, scalar>
(
neighbourFieldName_
)
);
neighbourFieldName_
)
);
// Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Swap to obtain full local values of neighbour K*delta
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrKDelta
);
// Swap to obtain full local values of neighbour K*delta
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrKDelta
);
tmp<scalarField> myKDelta = K()*patch().deltaCoeffs();
// Calculate common wall temperature. Reuse *this to store common value.
scalarField Twall
(
(myKDelta()*intFld() + nbrKDelta*nbrIntFld)
/ (myKDelta() + nbrKDelta)
);
// Assign to me
fvPatchScalarField::operator=(Twall);
// Distribute back and assign to neighbour
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
nbrField.size(),
distMap.constructMap(), // reverse : what to send
distMap.subMap(),
Twall
);
const_cast<turbulentTemperatureCoupledBaffleMixedFvPatchScalarField&>
(
nbrField
).fvPatchScalarField::operator=(Twall);
}
tmp<scalarField> myKDelta = K()*patch().deltaCoeffs();
// Switch between fixed value (of harmonic avg) or gradient
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Both sides agree on
// - temperature : (myKDelta*fld + nbrKDelta*nbrFld)/(myKDelta+nbrKDelta)
// - gradient : (temperature-fld)*delta
// We've got a degree of freedom in how to implement this in a mixed bc.
// (what gradient, what fixedValue and mixing coefficient)
// Two reasonable choices:
// 1. specify above temperature on one side (preferentially the high side)
// and above gradient on the other. So this will switch between pure
// fixedvalue and pure fixedgradient
// 2. specify gradient and temperature such that the equations are the
// same on both sides. This leads to the choice of
// - refGradient = zero gradient
// - refValue = neighbour value
// - mixFraction = nbrKDelta / (nbrKDelta + myKDelta())
label nFixed = 0;
// Like snGrad but bypass switching on refValue/refGrad.
tmp<scalarField> normalGradient = (*this-intFld())*patch().deltaCoeffs();
this->refValue() = nbrIntFld;
this->refGrad() = 0.0;
this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta());
mixedFvPatchScalarField::updateCoeffs();
if (debug)
{
scalar Q = gSum(K()*patch().magSf()*normalGradient());
scalar Q = gSum(K()*patch().magSf()*snGrad());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
@ -384,48 +299,6 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
<< " avg:" << gAverage(*this)
<< endl;
}
forAll(*this, i)
{
// if outgoing flux use fixed value.
if (normalGradient()[i] < 0.0)
{
this->refValue()[i] = operator[](i);
this->refGrad()[i] = 0.0; // not used by me
this->valueFraction()[i] = 1.0;
nFixed++;
}
else
{
// Fixed gradient. Make sure to have valid refValue (even though
// I am not using it - other boundary conditions might)
this->refValue()[i] = operator[](i);
this->refGrad()[i] = normalGradient()[i];
this->valueFraction()[i] = 0.0;
}
}
reduce(nFixed, sumOp<label>());
fixesValue_ = (nFixed > 0);
if (debug)
{
label nTotSize = returnReduce(this->size(), sumOp<label>());
Info<< patch().boundaryMesh().mesh().name() << ':'
<< patch().name() << ':'
<< this->dimensionedInternalField().name() << " -> "
<< nbrMesh.name() << ':'
<< nbrPatch.name() << ':'
<< this->dimensionedInternalField().name() << " :"
<< " patch:" << patch().name()
<< " out of:" << nTotSize
<< " fixedBC:" << nFixed
<< " gradient:" << nTotSize-nFixed << endl;
}
mixedFvPatchScalarField::updateCoeffs();
}
@ -438,7 +311,6 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
<< token::END_STATEMENT << nl;
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
os.writeKeyword("fixesValue") << fixesValue_ << token::END_STATEMENT << nl;
}

View File

@ -92,14 +92,6 @@ class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
//- Name of thermal conductivity field
const word KName_;
bool fixesValue_;
// Private Member Functions
//- Am I or neighbour owner of interface
bool interfaceOwner(const polyMesh&, const polyPatch&) const;
public:
@ -176,14 +168,6 @@ public:
//- Get corresponding K field
tmp<scalarField> K() const;
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return fixesValue_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();

View File

@ -0,0 +1,21 @@
#!/bin/sh
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf VTK
rm -rf constant/cellToRegion constant/polyMesh/sets
rm -rf 0/bottomAir
rm -rf 0/topAir
rm -rf 0/heater
rm -rf 0/leftSolid
rm -rf 0/rightSolid
rm -f 0/cellToRegion
rm -rf constant/bottomAir/polyMesh
rm -rf constant/topAir/polyMesh
rm -rf constant/heater/polyMesh
rm -rf constant/leftSolid/polyMesh
rm -rf constant/rightSolid/polyMesh
# -----------------------------------------------------------------------------

View File

@ -11,7 +11,7 @@ runApplication setSet -batch makeCellSets.setSet
rm -f constant/polyMesh/sets/*_old
runApplication setsToZones -noFlipMap
runApplication splitMeshRegions -cellZones
runApplication splitMeshRegions -cellZones -overwrite
# remove fluid fields from solid regions (important for post-processing)
for i in heater leftSolid rightSolid

View File

@ -11,6 +11,7 @@ rm -rf 0/topAir
rm -rf 0/heater
rm -rf 0/leftSolid
rm -rf 0/rightSolid
rm -f 0/cellToRegion
rm -rf constant/bottomAir/polyMesh
rm -rf constant/topAir/polyMesh
rm -rf constant/heater/polyMesh

View File

@ -0,0 +1 @@
PFLAGS = -DOMPI_SKIP_MPICXX

View File

@ -0,0 +1 @@
../General/mplibSYSTEMOPENMPI

View File

@ -0,0 +1 @@
../General/mplibSYSTEMOPENMPI

Binary file not shown.

View File

@ -0,0 +1 @@
../General/mplibSYSTEMOPENMPI

BIN
wmake/rules/linux64Gcc/wmkdep Executable file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
../General/mplibSYSTEMOPENMPI

BIN
wmake/rules/linux64Gcc42/wmkdep Executable file

Binary file not shown.

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