Merge commit 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2009-10-08 12:07:04 +02:00
112 changed files with 4527 additions and 527 deletions

View File

@ -41,24 +41,6 @@
) )
); );
Info<< " Adding to KFluid\n" << endl;
KFluid.set
(
i,
new volScalarField
(
IOobject
(
"K",
runTime.timeName(),
fluidRegions[i],
IOobject::NO_READ,
IOobject::NO_WRITE
),
thermoFluid[i].Cp()*thermoFluid[i].alpha()
)
);
Info<< " Adding to UFluid\n" << endl; Info<< " Adding to UFluid\n" << endl;
UFluid.set UFluid.set
( (
@ -129,6 +111,24 @@
).ptr() ).ptr()
); );
Info<< " Adding to KFluid\n" << endl;
KFluid.set
(
i,
new volScalarField
(
IOobject
(
"K",
runTime.timeName(),
fluidRegions[i],
IOobject::NO_READ,
IOobject::NO_WRITE
),
thermoFluid[i].Cp()*turbulence[i].alphaEff()
)
);
Info<< " Adding to DpDtFluid\n" << endl; Info<< " Adding to DpDtFluid\n" << endl;
DpDtFluid.set DpDtFluid.set
( (

View File

@ -37,37 +37,6 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const topoSet& fromSet,
const word& toName
)
{
Info<< "Backing up " << fromName << " into " << toName << endl;
topoSet backupSet(mesh, toName, fromSet);
backupSet.write();
}
// Read and copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const word& toName
)
{
topoSet fromSet(mesh, fromName, IOobject::READ_IF_PRESENT);
backup(mesh, fromName, fromSet, toName);
}
// Main program: // Main program:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -114,8 +83,6 @@ int main(int argc, char *argv[])
{ {
r = IOobject::NO_READ; r = IOobject::NO_READ;
backup(mesh, setName, setName + "_old");
currentSetPtr.reset currentSetPtr.reset
( (
new cellSet new cellSet
@ -151,7 +118,7 @@ int main(int argc, char *argv[])
if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST)) if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST))
{ {
// currentSet has been read so can make copy. // currentSet has been read so can make copy.
backup(mesh, setName, currentSet, setName + "_old"); //backup(mesh, setName, currentSet, setName + "_old");
} }
if (action == topoSetSource::CLEAR) if (action == topoSetSource::CLEAR)
@ -173,7 +140,16 @@ int main(int argc, char *argv[])
forAll(topoSetSources, topoSetSourceI) forAll(topoSetSources, topoSetSourceI)
{ {
// Backup current set. // Backup current set.
topoSet oldSet(mesh, currentSet.name() + "_old2", currentSet); autoPtr<topoSet> oldSet
(
topoSet::New
(
currentSet.type(),
mesh,
currentSet.name() + "_old2",
currentSet
)
);
currentSet.clear(); currentSet.clear();

View File

@ -47,7 +47,7 @@ using namespace Foam;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions(false); // no constant timeSelector::addOptions();
# include "addRegionOption.H" # include "addRegionOption.H"
argList::validOptions.insert("noTopology", ""); argList::validOptions.insert("noTopology", "");
argList::validOptions.insert("allGeometry", ""); argList::validOptions.insert("allGeometry", "");

View File

@ -37,37 +37,6 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const topoSet& fromSet,
const word& toName
)
{
Info<< "Backing up " << fromName << " into " << toName << endl;
topoSet backupSet(mesh, toName, fromSet);
backupSet.write();
}
// Read and copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const word& toName
)
{
topoSet fromSet(mesh, fromName, IOobject::READ_IF_PRESENT);
backup(mesh, fromName, fromSet, toName);
}
// Main program: // Main program:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -114,8 +83,6 @@ int main(int argc, char *argv[])
{ {
r = IOobject::NO_READ; r = IOobject::NO_READ;
backup(mesh, setName, setName + "_old");
currentSetPtr.reset currentSetPtr.reset
( (
new faceSet new faceSet
@ -151,7 +118,7 @@ int main(int argc, char *argv[])
if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST)) if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST))
{ {
// currentSet has been read so can make copy. // currentSet has been read so can make copy.
backup(mesh, setName, currentSet, setName + "_old"); //backup(mesh, setName, currentSet, setName + "_old");
} }
if (action == topoSetSource::CLEAR) if (action == topoSetSource::CLEAR)
@ -173,7 +140,16 @@ int main(int argc, char *argv[])
forAll(topoSetSources, topoSetSourceI) forAll(topoSetSources, topoSetSourceI)
{ {
// Backup current set. // Backup current set.
topoSet oldSet(mesh, currentSet.name() + "_old2", currentSet); autoPtr<topoSet> oldSet
(
topoSet::New
(
currentSet.type(),
mesh,
currentSet.name() + "_old2",
currentSet
)
);
currentSet.clear(); currentSet.clear();

View File

@ -37,37 +37,6 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const topoSet& fromSet,
const word& toName
)
{
Info<< "Backing up " << fromName << " into " << toName << endl;
topoSet backupSet(mesh, toName, fromSet);
backupSet.write();
}
// Read and copy set
void backup
(
const polyMesh& mesh,
const word& fromName,
const word& toName
)
{
topoSet fromSet(mesh, fromName, IOobject::READ_IF_PRESENT);
backup(mesh, fromName, fromSet, toName);
}
// Main program: // Main program:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -114,8 +83,6 @@ int main(int argc, char *argv[])
{ {
r = IOobject::NO_READ; r = IOobject::NO_READ;
backup(mesh, setName, setName + "_old");
currentSetPtr.reset currentSetPtr.reset
( (
new pointSet new pointSet
@ -151,7 +118,7 @@ int main(int argc, char *argv[])
if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST)) if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST))
{ {
// currentSet has been read so can make copy. // currentSet has been read so can make copy.
backup(mesh, setName, currentSet, setName + "_old"); //backup(mesh, setName, currentSet, setName + "_old");
} }
if (action == topoSetSource::CLEAR) if (action == topoSetSource::CLEAR)
@ -173,7 +140,16 @@ int main(int argc, char *argv[])
forAll(topoSetSources, topoSetSourceI) forAll(topoSetSources, topoSetSourceI)
{ {
// Backup current set. // Backup current set.
topoSet oldSet(mesh, currentSet.name() + "_old2", currentSet); autoPtr<topoSet> oldSet
(
topoSet::New
(
currentSet.type(),
mesh,
currentSet.name() + "_old2",
currentSet
)
);
currentSet.clear(); currentSet.clear();

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description Description
Manipulate a cell/face/point set interactively. Manipulate a cell/face/point/ set or zone interactively.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -42,6 +42,9 @@ Description
#include "writePatch.H" #include "writePatch.H"
#include "writePointSet.H" #include "writePointSet.H"
#include "IOobjectList.H" #include "IOobjectList.H"
#include "cellZoneSet.H"
#include "faceZoneSet.H"
#include "pointZoneSet.H"
#include <stdio.h> #include <stdio.h>
@ -82,6 +85,7 @@ Istream& selectStream(Istream* is0Ptr, Istream* is1Ptr)
// Copy set // Copy set
void backup void backup
( (
const word& setType,
const polyMesh& mesh, const polyMesh& mesh,
const word& fromName, const word& fromName,
const topoSet& fromSet, const topoSet& fromSet,
@ -92,9 +96,7 @@ void backup
{ {
Pout<< " Backing up " << fromName << " into " << toName << endl; Pout<< " Backing up " << fromName << " into " << toName << endl;
topoSet backupSet(mesh, toName, fromSet); topoSet::New(setType, mesh, toName, fromSet)().write();
backupSet.write();
} }
} }
@ -102,14 +104,21 @@ void backup
// Read and copy set // Read and copy set
void backup void backup
( (
const word& setType,
const polyMesh& mesh, const polyMesh& mesh,
const word& fromName, const word& fromName,
const word& toName const word& toName
) )
{ {
topoSet fromSet(mesh, fromName, IOobject::READ_IF_PRESENT); autoPtr<topoSet> fromSet = topoSet::New
(
setType,
mesh,
fromName,
IOobject::READ_IF_PRESENT
);
backup(mesh, fromName, fromSet, toName); backup(setType, mesh, fromName, fromSet(), toName);
} }
@ -241,11 +250,13 @@ void printHelp(Ostream& os)
<< "A set command should be of the following form" << endl << "A set command should be of the following form" << endl
<< endl << endl
<< " cellSet|faceSet|pointSet <setName> <action> <source>" << " cellSet|faceSet|pointSet <setName> <action> <source>"
<< endl << endl << endl
<< endl
<< "The <action> is one of" << endl << "The <action> is one of" << endl
<< " list - prints the contents of the set" << endl << " list - prints the contents of the set" << endl
<< " clear - clears the set" << endl << " clear - clears the set" << endl
<< " invert - inverts the set" << endl << " invert - inverts the set" << endl
<< " remove - remove the set" << endl
<< " new <source> - sets to set to the source set" << endl << " new <source> - sets to set to the source set" << endl
<< " add <source> - adds all elements from the source set" << endl << " add <source> - adds all elements from the source set" << endl
<< " delete <source> - deletes ,," << endl << " delete <source> - deletes ,," << endl
@ -270,6 +281,20 @@ void printHelp(Ostream& os)
<< " cellSet c0 add pointToCell p0 any" << endl << " cellSet c0 add pointToCell p0 any" << endl
<< "List set:" << endl << "List set:" << endl
<< " cellSet c0 list" << endl << " cellSet c0 list" << endl
<< endl
<< "Zones can be set using zoneSets from corresponding sets:" << endl
<< " cellZoneSet c0Zone new setToZone c0" << endl
<< " faceZoneSet f0Zone new setToZone f0" << endl
<< endl
<< "or if orientation is important:" << endl
<< " faceZoneSet f0Zone new setsToZone f0 c0" << endl
<< endl
<< "ZoneSets can be manipulated using the general actions:" << endl
<< " list - prints the contents of the set" << endl
<< " clear - clears the set" << endl
<< " invert - inverts the set (undefined orientation)"
<< endl
<< " remove - remove the set" << endl
<< endl; << endl;
} }
@ -312,10 +337,126 @@ void printAllSets(const polyMesh& mesh, Ostream& os)
os << '\t' << set.name() << "\tsize:" << set.size() << endl; os << '\t' << set.name() << "\tsize:" << set.size() << endl;
} }
} }
const cellZoneMesh& cellZones = mesh.cellZones();
if (cellZones.size())
{
os << "cellZones:" << endl;
forAll(cellZones, i)
{
const cellZone& zone = cellZones[i];
os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
}
}
const faceZoneMesh& faceZones = mesh.faceZones();
if (faceZones.size())
{
os << "faceZones:" << endl;
forAll(faceZones, i)
{
const faceZone& zone = faceZones[i];
os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
}
}
const pointZoneMesh& pointZones = mesh.pointZones();
if (pointZones.size())
{
os << "pointZones:" << endl;
forAll(pointZones, i)
{
const pointZone& zone = pointZones[i];
os << '\t' << zone.name() << "\tsize:" << zone.size() << endl;
}
}
os << endl; os << endl;
} }
template<class ZoneType>
void removeZone
(
ZoneMesh<ZoneType, polyMesh>& zones,
const word& setName
)
{
label zoneID = zones.findZoneID(setName);
if (zoneID != -1)
{
Info<< "Removing zone " << setName << " at index " << zoneID << endl;
// Shuffle to last position
labelList oldToNew(zones.size());
label newI = 0;
forAll(oldToNew, i)
{
if (i != zoneID)
{
oldToNew[i] = newI++;
}
}
oldToNew[zoneID] = newI;
zones.reorder(oldToNew);
// Remove last element
zones.setSize(zones.size()-1);
zones.clearAddressing();
zones.write();
}
}
// Physically remove a set
void removeSet
(
const polyMesh& mesh,
const word& setType,
const word& setName
)
{
// Remove the file
IOobjectList objects
(
mesh,
mesh.pointsInstance(),
polyMesh::meshSubDir/"sets"
);
if (objects.found(setName))
{
// Remove file
fileName object = objects[setName]->objectPath();
Info<< "Removing file " << object << endl;
rm(object);
}
// See if zone
if (setType == cellZoneSet::typeName)
{
removeZone
(
const_cast<cellZoneMesh&>(mesh.cellZones()),
setName
);
}
else if (setType == faceZoneSet::typeName)
{
removeZone
(
const_cast<faceZoneMesh&>(mesh.faceZones()),
setName
);
}
else if (setType == pointZoneSet::typeName)
{
removeZone
(
const_cast<pointZoneMesh&>(mesh.pointZones()),
setName
);
}
}
// Read command and execute. Return true if ok, false otherwise. // Read command and execute. Return true if ok, false otherwise.
bool doCommand bool doCommand
( (
@ -358,38 +499,29 @@ bool doCommand
IOobject::readOption r; IOobject::readOption r;
if if (action == topoSetSource::REMOVE)
{
removeSet(mesh, setType, setName);
}
else if
( (
(action == topoSetSource::NEW) (action == topoSetSource::NEW)
|| (action == topoSetSource::CLEAR) || (action == topoSetSource::CLEAR)
) )
{ {
r = IOobject::NO_READ; r = IOobject::NO_READ;
//backup(mesh, setName, setName + "_old");
currentSetPtr = topoSet::New(setType, mesh, setName, typSize); currentSetPtr = topoSet::New(setType, mesh, setName, typSize);
} }
else else
{ {
r = IOobject::MUST_READ; r = IOobject::MUST_READ;
currentSetPtr = topoSet::New(setType, mesh, setName, r); currentSetPtr = topoSet::New(setType, mesh, setName, r);
topoSet& currentSet = currentSetPtr(); topoSet& currentSet = currentSetPtr();
// Presize it according to current mesh data. // Presize it according to current mesh data.
currentSet.resize(max(currentSet.size(), typSize)); currentSet.resize(max(currentSet.size(), typSize));
} }
if (currentSetPtr.empty()) if (currentSetPtr.valid())
{
Pout<< " Cannot construct/load set "
<< topoSet::localPath(mesh, setName) << endl;
ok = false;
}
else
{ {
topoSet& currentSet = currentSetPtr(); topoSet& currentSet = currentSetPtr();
@ -398,12 +530,6 @@ bool doCommand
<< " Action:" << actionName << " Action:" << actionName
<< endl; << endl;
//if ((r == IOobject::MUST_READ) && (action != topoSetSource::LIST))
//{
// // currentSet has been read so can make copy.
// backup(mesh, setName, currentSet, setName + "_old");
//}
switch (action) switch (action)
{ {
case topoSetSource::CLEAR: case topoSetSource::CLEAR:
@ -437,15 +563,18 @@ bool doCommand
); );
// Backup current set. // Backup current set.
topoSet oldSet autoPtr<topoSet> oldSet
( (
topoSet::New
(
setType,
mesh, mesh,
currentSet.name() + "_old2", currentSet.name() + "_old2",
currentSet currentSet
)
); );
currentSet.clear(); currentSet.clear();
currentSet.resize(oldSet.size());
setSource().applyToSet(topoSetSource::NEW, currentSet); setSource().applyToSet(topoSetSource::NEW, currentSet);
// Combine new value of currentSet with old one. // Combine new value of currentSet with old one.
@ -547,7 +676,8 @@ enum commandStatus
{ {
QUIT, // quit program QUIT, // quit program
INVALID, // token is not a valid set manipulation command INVALID, // token is not a valid set manipulation command
VALID // ,, is a valid ,, VALIDSETCMD, // ,, is a valid ,,
VALIDZONECMD // ,, is a valid zone ,,
}; };
@ -654,7 +784,16 @@ commandStatus parseType
|| setType == "pointSet" || setType == "pointSet"
) )
{ {
return VALID; return VALIDSETCMD;
}
else if
(
setType == "cellZoneSet"
|| setType == "faceZoneSet"
|| setType == "pointZoneSet"
)
{
return VALIDZONECMD;
} }
else else
{ {
@ -664,7 +803,7 @@ commandStatus parseType
", IStringStream&)" ", IStringStream&)"
) << "Illegal command " << setType << endl ) << "Illegal command " << setType << endl
<< "Should be one of 'help', 'list', 'time' or a set type :" << "Should be one of 'help', 'list', 'time' or a set type :"
<< " 'cellSet', 'faceSet', 'pointSet'" << " 'cellSet', 'faceSet', 'pointSet', 'faceZoneSet'"
<< endl; << endl;
return INVALID; return INVALID;
@ -682,7 +821,7 @@ commandStatus parseAction(const word& actionName)
{ {
(void)topoSetSource::toAction(actionName); (void)topoSetSource::toAction(actionName);
stat = VALID; stat = VALIDSETCMD;
} }
catch (Foam::IOerror& fIOErr) catch (Foam::IOerror& fIOErr)
{ {
@ -724,6 +863,10 @@ int main(int argc, char *argv[])
// Print some mesh info // Print some mesh info
printMesh(runTime, mesh); printMesh(runTime, mesh);
// Print current sets
printAllSets(mesh, Pout);
std::ifstream* fileStreamPtr(NULL); std::ifstream* fileStreamPtr(NULL);
@ -745,11 +888,10 @@ int main(int argc, char *argv[])
#if READLINE != 0 #if READLINE != 0
else if (!read_history(historyFile)) else if (!read_history(historyFile))
{ {
Info<< "Successfully read history from " << historyFile << endl; Pout<< "Successfully read history from " << historyFile << endl;
} }
#endif #endif
Pout<< "Please type 'help', 'quit' or a set command after prompt." << endl; Pout<< "Please type 'help', 'quit' or a set command after prompt." << endl;
bool ok = true; bool ok = true;
@ -816,12 +958,12 @@ int main(int argc, char *argv[])
IStringStream is(rawLine + ' '); IStringStream is(rawLine + ' ');
// Type: cellSet, faceSet, pointSet // Type: cellSet, faceSet, pointSet, faceZoneSet
is >> setType; is >> setType;
stat = parseType(runTime, mesh, setType, is); stat = parseType(runTime, mesh, setType, is);
if (stat == VALID) if (stat == VALIDSETCMD || stat == VALIDZONECMD)
{ {
if (is >> setName) if (is >> setName)
{ {
@ -831,14 +973,13 @@ int main(int argc, char *argv[])
} }
} }
} }
ok = true; ok = true;
if (stat == QUIT) if (stat == QUIT)
{ {
break; break;
} }
else if (stat == VALID) else if (stat == VALIDSETCMD || stat == VALIDZONECMD)
{ {
ok = doCommand(mesh, setType, setName, actionName, writeVTK, is); ok = doCommand(mesh, setType, setName, actionName, writeVTK, is);
} }

View File

@ -270,6 +270,10 @@ int main(int argc, char *argv[])
{ {
mesh.setInstance(oldInstance); mesh.setInstance(oldInstance);
} }
else
{
mesh.setInstance(runTime.timeName());
}
Info<< "Writing mesh to " << runTime.timeName() << endl; Info<< "Writing mesh to " << runTime.timeName() << endl;
if (!mesh.write()) if (!mesh.write())

View File

@ -334,7 +334,7 @@ int main(int argc, char *argv[])
} }
else else
{ {
mesh.setInstance(oldInstance); subsetter.subMesh().setInstance(oldInstance);
} }
Info<< "Writing subsetted mesh and fields to time " << runTime.timeName() Info<< "Writing subsetted mesh and fields to time " << runTime.timeName()

View File

@ -34,6 +34,7 @@ License
#include "Map.H" #include "Map.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "DynamicList.H" #include "DynamicList.H"
#include "fvFieldDecomposer.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -306,12 +307,29 @@ bool domainDecomposition::writeDecomposition()
forAll (curPatchSizes, patchi) forAll (curPatchSizes, patchi)
{ {
// Get the face labels consistent with the field mapping
// (reuse the patch field mappers)
const polyPatch& meshPatch =
meshPatches[curBoundaryAddressing[patchi]];
fvFieldDecomposer::patchFieldDecomposer patchMapper
(
SubList<label>
(
curFaceLabels,
curPatchSizes[patchi],
curPatchStarts[patchi]
),
meshPatch.start()
);
// Map existing patches
procPatches[nPatches] = procPatches[nPatches] =
meshPatches[curBoundaryAddressing[patchi]].clone meshPatches[curBoundaryAddressing[patchi]].clone
( (
procMesh.boundaryMesh(), procMesh.boundaryMesh(),
nPatches, nPatches,
curPatchSizes[patchi], patchMapper.directAddressing(),
curPatchStarts[patchi] curPatchStarts[patchi]
).ptr(); ).ptr();

View File

@ -35,6 +35,8 @@
alias _foamAddPath 'set path=(\!* $path)' alias _foamAddPath 'set path=(\!* $path)'
# prefix to LD_LIBRARY_PATH # prefix to LD_LIBRARY_PATH
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}' alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
# prefix to MANPATH
alias _foamAddManPath 'setenv MANPATH \!*\:${MANPATH}'
# location of the jobControl directory # location of the jobControl directory
setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl
@ -117,6 +119,7 @@ case OpenFOAM:
_foamAddPath ${WM_COMPILER_DIR}/bin _foamAddPath ${WM_COMPILER_DIR}/bin
_foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH} _foamAddLib ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH}
_foamAddLib ${WM_COMPILER_DIR}/lib _foamAddLib ${WM_COMPILER_DIR}/lib
_foamAddManPath ${WM_COMPILER_DIR}/man
breaksw breaksw
endsw endsw
@ -138,19 +141,20 @@ case OPENMPI:
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
_foamAddManPath $MPI_ARCH_PATH/man
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version unset mpi_version
breaksw breaksw
case MPICH: case MPICH:
set mpi_version=mpich-1.2.4 set mpi_version=mpich2-1.1.1p1
setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version
setenv MPI_ARCH_PATH $MPI_HOME/platforms/$WM_OPTIONS setenv MPI_ARCH_PATH $MPI_HOME/platforms/$WM_OPTIONS
setenv MPICH_ROOT $MPI_ARCH_PATH
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
_foamAddManPath $MPI_ARCH_PATH/share/man
setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
unset mpi_version unset mpi_version
@ -159,7 +163,6 @@ case MPICH:
case MPICH-GM: case MPICH-GM:
setenv MPI_ARCH_PATH /opt/mpi setenv MPI_ARCH_PATH /opt/mpi
setenv MPICH_PATH $MPI_ARCH_PATH setenv MPICH_PATH $MPI_ARCH_PATH
setenv MPICH_ROOT $MPI_ARCH_PATH
setenv GM_LIB_PATH /opt/gm/lib64 setenv GM_LIB_PATH /opt/gm/lib64
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
@ -172,7 +175,6 @@ case MPICH-GM:
case HPMPI: case HPMPI:
setenv MPI_HOME /opt/hpmpi setenv MPI_HOME /opt/hpmpi
setenv MPI_ARCH_PATH $MPI_HOME setenv MPI_ARCH_PATH $MPI_HOME
setenv MPICH_ROOT=$MPI_ARCH_PATH
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin

View File

@ -51,6 +51,16 @@ _foamAddLib()
done done
} }
# prefix to MANPATH
_foamAddManPath()
{
while [ $# -ge 1 ]
do
export MANPATH=$1:$MANPATH
shift
done
}
# location of the jobControl directory # location of the jobControl directory
export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
@ -90,7 +100,7 @@ _foamAddLib $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
# Compiler settings # Compiler settings
# ~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~
unset compilerBin compilerLib unset compilerBin compilerLib compilerMan
# Select compiler installation # Select compiler installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -133,6 +143,7 @@ OpenFOAM)
compilerBin=$WM_COMPILER_DIR/bin compilerBin=$WM_COMPILER_DIR/bin
compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
compilerMan=$WM_COMPILER_DIR/man
;; ;;
esac esac
@ -140,9 +151,10 @@ if [ -d "$compilerBin" ]
then then
_foamAddPath $compilerBin _foamAddPath $compilerBin
_foamAddLib $compilerLib _foamAddLib $compilerLib
_foamAddManPath $compilerMan
fi fi
unset compilerBin compilerLib compilerInstall unset compilerBin compilerLib compilerMan compilerInstall
# Communications library # Communications library
# ~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~
@ -160,19 +172,20 @@ OPENMPI)
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
_foamAddManPath $MPI_ARCH_PATH/man
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version unset mpi_version
;; ;;
MPICH) MPICH)
mpi_version=mpich-1.2.4 mpi_version=mpich2-1.1.1p1
export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version
export MPI_ARCH_PATH=$MPI_HOME/platforms/$WM_OPTIONS export MPI_ARCH_PATH=$MPI_HOME/platforms/$WM_OPTIONS
export MPICH_ROOT=$MPI_ARCH_PATH
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $MPI_ARCH_PATH/lib
_foamAddManPath $MPI_ARCH_PATH/share/man
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version unset mpi_version
@ -181,7 +194,6 @@ MPICH)
MPICH-GM) MPICH-GM)
export MPI_ARCH_PATH=/opt/mpi export MPI_ARCH_PATH=/opt/mpi
export MPICH_PATH=$MPI_ARCH_PATH export MPICH_PATH=$MPI_ARCH_PATH
export MPICH_ROOT=$MPI_ARCH_PATH
export GM_LIB_PATH=/opt/gm/lib64 export GM_LIB_PATH=/opt/gm/lib64
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin
@ -194,7 +206,6 @@ MPICH-GM)
HPMPI) HPMPI)
export MPI_HOME=/opt/hpmpi export MPI_HOME=/opt/hpmpi
export MPI_ARCH_PATH=$MPI_HOME export MPI_ARCH_PATH=$MPI_HOME
export MPICH_ROOT=$MPI_ARCH_PATH
_foamAddPath $MPI_ARCH_PATH/bin _foamAddPath $MPI_ARCH_PATH/bin

View File

@ -85,7 +85,6 @@ inline void Foam::OPstream::writeToBuffer
} }
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
Foam::OPstream::OPstream Foam::OPstream::OPstream

View File

@ -217,7 +217,7 @@ bool Foam::Pstream::parRun_(false);
Foam::List<int> Foam::Pstream::procIDs_(1, 0); Foam::List<int> Foam::Pstream::procIDs_(1, 0);
// Standard transfer message type // Standard transfer message type
const int Foam::Pstream::msgType_(1); int Foam::Pstream::msgType_(1);
// Linear communication schedule // Linear communication schedule
Foam::List<Foam::Pstream::commsStruct> Foam::Pstream::linearCommunication_(0); Foam::List<Foam::Pstream::commsStruct> Foam::Pstream::linearCommunication_(0);

View File

@ -163,7 +163,7 @@ private:
static bool parRun_; static bool parRun_;
static List<int> procIDs_; static List<int> procIDs_;
static const int msgType_; static int msgType_;
static List<commsStruct> linearCommunication_; static List<commsStruct> linearCommunication_;
static List<commsStruct> treeCommunication_; static List<commsStruct> treeCommunication_;
@ -337,11 +337,12 @@ public:
} }
//- Message tag of standard messages //- Message tag of standard messages
static int msgType() static int& msgType()
{ {
return msgType_; return msgType_;
} }
//- Get the communications type of the stream //- Get the communications type of the stream
commsTypes commsType() const commsTypes commsType() const
{ {

View File

@ -38,6 +38,7 @@ SourceFiles
#include "symmTransform.H" #include "symmTransform.H"
#include "symmTensorField.H" #include "symmTensorField.H"
#include "sphericalTensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -26,6 +26,7 @@ License
#include "basicSymmetryPointPatchField.H" #include "basicSymmetryPointPatchField.H"
#include "transformField.H" #include "transformField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -89,7 +90,12 @@ void basicSymmetryPointPatchField<Type>::evaluate(const Pstream::commsTypes)
const vectorField& nHat = this->patch().pointNormals(); const vectorField& nHat = this->patch().pointNormals();
tmp<Field<Type> > tvalues = tmp<Field<Type> > tvalues =
transform(I - nHat*nHat, this->patchInternalField()); (
(
this->patchInternalField()
+ transform(I - 2.0*sqr(nHat), this->patchInternalField())
)/2.0
);
// Get internal field to insert values into // Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField()); Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());

View File

@ -445,6 +445,19 @@ Foam::coupledPolyPatch::coupledPolyPatch
{} {}
Foam::coupledPolyPatch::coupledPolyPatch
(
const coupledPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::coupledPolyPatch::~coupledPolyPatch() Foam::coupledPolyPatch::~coupledPolyPatch()

View File

@ -221,6 +221,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
coupledPolyPatch
(
const coupledPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
// Destructor // Destructor

View File

@ -94,6 +94,21 @@ Foam::genericPolyPatch::genericPolyPatch
{} {}
Foam::genericPolyPatch::genericPolyPatch
(
const genericPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart),
actualTypeName_(pp.actualTypeName_),
dict_(pp.dict_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::genericPolyPatch::~genericPolyPatch() Foam::genericPolyPatch::~genericPolyPatch()

View File

@ -106,6 +106,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
genericPolyPatch
(
const genericPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh //- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{ {
@ -128,6 +138,22 @@ public:
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new genericPolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
// Destructor // Destructor

View File

@ -826,6 +826,26 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
{} {}
Foam::cyclicPolyPatch::cyclicPolyPatch
(
const cyclicPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
coupledPointsPtr_(NULL),
coupledEdgesPtr_(NULL),
featureCos_(pp.featureCos_),
transform_(pp.transform_),
rotationAxis_(pp.rotationAxis_),
rotationCentre_(pp.rotationCentre_),
separationVector_(pp.separationVector_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicPolyPatch::~cyclicPolyPatch() Foam::cyclicPolyPatch::~cyclicPolyPatch()

View File

@ -234,6 +234,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
cyclicPolyPatch
(
const cyclicPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh //- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{ {
@ -256,6 +266,22 @@ public:
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new cyclicPolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
// Destructor // Destructor

View File

@ -87,4 +87,17 @@ Foam::emptyPolyPatch::emptyPolyPatch
{} {}
Foam::emptyPolyPatch::emptyPolyPatch
(
const emptyPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -92,6 +92,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
emptyPolyPatch
(
const emptyPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh //- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{ {
@ -113,6 +123,22 @@ public:
new emptyPolyPatch(*this, bm, index, newSize, newStart) new emptyPolyPatch(*this, bm, index, newSize, newStart)
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new emptyPolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
}; };

View File

@ -124,6 +124,26 @@ Foam::processorPolyPatch::processorPolyPatch
{} {}
Foam::processorPolyPatch::processorPolyPatch
(
const processorPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
myProcNo_(pp.myProcNo_),
neighbProcNo_(pp.neighbProcNo_),
neighbFaceCentres_(),
neighbFaceAreas_(),
neighbFaceCellCentres_(),
neighbPointsPtr_(NULL),
neighbEdgesPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::processorPolyPatch::~processorPolyPatch() Foam::processorPolyPatch::~processorPolyPatch()

View File

@ -158,6 +158,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
processorPolyPatch
(
const processorPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh //- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{ {
@ -178,7 +188,7 @@ public:
( (
new processorPolyPatch new processorPolyPatch
( (
refCast<const processorPolyPatch>(*this), *this,
bm, bm,
index, index,
newSize, newSize,
@ -187,6 +197,29 @@ public:
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new processorPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
// Destructor // Destructor

View File

@ -87,4 +87,17 @@ Foam::symmetryPolyPatch::symmetryPolyPatch
{} {}
Foam::symmetryPolyPatch::symmetryPolyPatch
(
const symmetryPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -92,6 +92,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
symmetryPolyPatch
(
const symmetryPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh //- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{ {
@ -113,6 +123,22 @@ public:
new symmetryPolyPatch(*this, bm, index, newSize, newStart) new symmetryPolyPatch(*this, bm, index, newSize, newStart)
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new symmetryPolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
}; };

View File

@ -157,4 +157,19 @@ Foam::wedgePolyPatch::wedgePolyPatch
} }
Foam::wedgePolyPatch::wedgePolyPatch
(
const wedgePolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
{
initTransforms();
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -113,6 +113,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
wedgePolyPatch
(
const wedgePolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh //- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{ {
@ -135,6 +145,22 @@ public:
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new wedgePolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
// Member functions // Member functions

View File

@ -87,4 +87,17 @@ Foam::wallPolyPatch::wallPolyPatch
{} {}
Foam::wallPolyPatch::wallPolyPatch
(
const wallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -92,6 +92,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
wallPolyPatch
(
const wallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh //- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{ {
@ -113,6 +123,22 @@ public:
new wallPolyPatch(*this, bm, index, newSize, newStart) new wallPolyPatch(*this, bm, index, newSize, newStart)
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new wallPolyPatch(*this, bm, index, mapAddressing, newStart)
);
}
}; };

View File

@ -167,6 +167,33 @@ Foam::polyPatch::polyPatch
{} {}
Foam::polyPatch::polyPatch
(
const polyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
patchIdentifier(pp, index),
primitivePatch
(
faceSubList
(
bm.mesh().faces(),
mapAddressing.size(),
newStart
),
bm.mesh().points()
),
start_(newStart),
boundaryMesh_(bm),
faceCellsPtr_(NULL),
mePtr_(NULL)
{}
Foam::polyPatch::polyPatch(const polyPatch& p) Foam::polyPatch::polyPatch(const polyPatch& p)
: :
patchIdentifier(p), patchIdentifier(p),

View File

@ -199,6 +199,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
polyPatch
(
const polyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct as copy //- Construct as copy
polyPatch(const polyPatch&); polyPatch(const polyPatch&);
@ -224,6 +234,22 @@ public:
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new polyPatch(*this, bm, index, mapAddressing, newStart)
);
}
// Selectors // Selectors

View File

@ -136,16 +136,24 @@ void Foam::faceZone::calcCellLayers() const
forAll (mf, faceI) forAll (mf, faceI)
{ {
label ownCellI = own[mf[faceI]];
label neiCellI =
(
zoneMesh().mesh().isInternalFace(mf[faceI])
? nei[mf[faceI]]
: -1
);
if (!faceFlip[faceI]) if (!faceFlip[faceI])
{ {
// Face is oriented correctly, no flip needed // Face is oriented correctly, no flip needed
mc[faceI] = nei[mf[faceI]]; mc[faceI] = neiCellI;
sc[faceI] = own[mf[faceI]]; sc[faceI] = ownCellI;
} }
else else
{ {
mc[faceI] = own[mf[faceI]]; mc[faceI] = ownCellI;
sc[faceI] = nei[mf[faceI]]; sc[faceI] = neiCellI;
} }
} }
//Info << "masterCells: " << mc << endl; //Info << "masterCells: " << mc << endl;

View File

@ -95,11 +95,11 @@ basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// return gradient at boundary
template<class Type> template<class Type>
tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGrad() const tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGrad() const
{ {
vectorField nHat = this->patch().nf(); vectorField nHat = this->patch().nf();
return return
( (
transform(I - 2.0*sqr(nHat), this->patchInternalField()) transform(I - 2.0*sqr(nHat), this->patchInternalField())
@ -108,7 +108,6 @@ tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGrad() const
} }
// Evaluate the field on the patch
template<class Type> template<class Type>
void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes) void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
{ {
@ -118,6 +117,7 @@ void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
} }
vectorField nHat = this->patch().nf(); vectorField nHat = this->patch().nf();
Field<Type>::operator= Field<Type>::operator=
( (
( (
@ -130,11 +130,11 @@ void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
} }
// Return defining fields
template<class Type> template<class Type>
tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGradTransformDiag() const tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGradTransformDiag() const
{ {
vectorField nHat = this->patch().nf(); vectorField nHat = this->patch().nf();
vectorField diag(nHat.size()); vectorField diag(nHat.size());
diag.replace(vector::X, mag(nHat.component(vector::X))); diag.replace(vector::X, mag(nHat.component(vector::X)));

View File

@ -188,7 +188,7 @@ void Foam::totalTemperatureFvPatchScalarField::write(Ostream& os) const
{ {
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
} }
if (phiName_ != "psi") if (psiName_ != "psi")
{ {
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
} }

View File

@ -329,7 +329,7 @@ surfaceDisplacementPointPatchVectorField
surfacesDict_(dict.subDict("geometry")), surfacesDict_(dict.subDict("geometry")),
projectMode_(projectModeNames_.read(dict.lookup("projectMode"))), projectMode_(projectModeNames_.read(dict.lookup("projectMode"))),
projectDir_(dict.lookup("projectDirection")), projectDir_(dict.lookup("projectDirection")),
wedgePlane_(readLabel(dict.lookup("wedgePlane"))), wedgePlane_(dict.lookupOrDefault(dict.lookup("wedgePlane"), -1)),
frozenPointsZone_(dict.lookupOrDefault("frozenPointsZone", word::null)) frozenPointsZone_(dict.lookupOrDefault("frozenPointsZone", word::null))
{ {
if (velocity_.x() < 0 || velocity_.y() < 0 || velocity_.z() < 0) if (velocity_.x() < 0 || velocity_.y() < 0 || velocity_.z() < 0)

View File

@ -326,7 +326,7 @@ surfaceSlipDisplacementPointPatchVectorField
surfacesDict_(dict.subDict("geometry")), surfacesDict_(dict.subDict("geometry")),
projectMode_(projectModeNames_.read(dict.lookup("projectMode"))), projectMode_(projectModeNames_.read(dict.lookup("projectMode"))),
projectDir_(dict.lookup("projectDirection")), projectDir_(dict.lookup("projectDirection")),
wedgePlane_(readLabel(dict.lookup("wedgePlane"))), wedgePlane_(dict.lookupOrDefault("wedgePlane", -1)),
frozenPointsZone_(dict.lookupOrDefault("frozenPointsZone", word::null)) frozenPointsZone_(dict.lookupOrDefault("frozenPointsZone", word::null))
{} {}

View File

@ -2546,6 +2546,11 @@ void Foam::autoLayerDriver::addLayers
); );
// Undistorted edge length
const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
// Point-wise extrusion data // Point-wise extrusion data
// ~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~
@ -2559,7 +2564,7 @@ void Foam::autoLayerDriver::addLayers
// Whether to add edge for all pp.localPoints. // Whether to add edge for all pp.localPoints.
List<extrudeMode> extrudeStatus(pp().nPoints(), EXTRUDE); List<extrudeMode> extrudeStatus(pp().nPoints(), EXTRUDE);
{
// Get number of layer per point from number of layers per patch // Get number of layer per point from number of layers per patch
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -2607,10 +2612,6 @@ void Foam::autoLayerDriver::addLayers
// Disable extrusion on warped faces // Disable extrusion on warped faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Undistorted edge length
const scalar edge0Len = meshRefiner_.meshCutter().level0EdgeLength();
const labelList& cellLevel = meshRefiner_.meshCutter().cellLevel();
handleWarpedFaces handleWarpedFaces
( (
pp, pp,
@ -2647,6 +2648,7 @@ void Foam::autoLayerDriver::addLayers
extrudeStatus extrudeStatus
); );
} }
}
// Determine (wanted) point-wise layer thickness and expansion ratio // Determine (wanted) point-wise layer thickness and expansion ratio

View File

@ -1134,6 +1134,18 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
} }
} }
} }
// If the faceZones are not synchronised the blockedFace
// might not be synchronised. If you are sure the faceZones
// are synchronised remove below check.
syncTools::syncFaceList
(
mesh_,
blockedFace,
andEqOp<bool>(), // combine operator
false // separation
);
} }
reduce(nUnblocked, sumOp<label>()); reduce(nUnblocked, sumOp<label>());

View File

@ -37,7 +37,7 @@ License
#include "mapDistributePolyMesh.H" #include "mapDistributePolyMesh.H"
#include "featureEdgeMesh.H" #include "featureEdgeMesh.H"
#include "Cloud.H" #include "Cloud.H"
#include "globalIndex.H" //#include "globalIndex.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -71,6 +71,9 @@ $(topoSets)/cellSet.C
$(topoSets)/topoSet.C $(topoSets)/topoSet.C
$(topoSets)/faceSet.C $(topoSets)/faceSet.C
$(topoSets)/pointSet.C $(topoSets)/pointSet.C
$(topoSets)/cellZoneSet.C
$(topoSets)/faceZoneSet.C
$(topoSets)/pointZoneSet.C
sets/topoSetSource/topoSetSource.C sets/topoSetSource/topoSetSource.C
@ -113,6 +116,18 @@ $(pointSources)/surfaceToPoint/surfaceToPoint.C
$(pointSources)/zoneToPoint/zoneToPoint.C $(pointSources)/zoneToPoint/zoneToPoint.C
$(pointSources)/nearestToPoint/nearestToPoint.C $(pointSources)/nearestToPoint/nearestToPoint.C
faceZoneSources = sets/faceZoneSources
$(faceZoneSources)/faceZoneToFaceZone/faceZoneToFaceZone.C
$(faceZoneSources)/setsToFaceZone/setsToFaceZone.C
$(faceZoneSources)/setToFaceZone/setToFaceZone.C
cellZoneSources = sets/cellZoneSources
$(cellZoneSources)/setToCellZone/setToCellZone.C
pointZoneSources = sets/pointZoneSources
$(pointZoneSources)/setToPointZone/setToPointZone.C
surfaceSets/surfaceSets.C surfaceSets/surfaceSets.C
triSurface/orientedSurface/orientedSurface.C triSurface/orientedSurface/orientedSurface.C

View File

@ -50,6 +50,34 @@ namespace Foam
const NamedEnum<directMappedPatchBase::sampleMode, 3> const NamedEnum<directMappedPatchBase::sampleMode, 3>
directMappedPatchBase::sampleModeNames_; directMappedPatchBase::sampleModeNames_;
//- Private class for finding nearest
// - point+local index
// - sqr(distance)
// - processor
typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
class nearestEqOp
{
public:
void operator()(nearInfo& x, const nearInfo& y) const
{
if (y.first().hit())
{
if (!x.first().hit())
{
x = y;
}
else if (y.second().first() < x.second().first())
{
x = y;
}
}
}
};
} }
@ -70,7 +98,7 @@ void Foam::directMappedPatchBase::collectSamples
labelListList globalFaces(Pstream::nProcs()); labelListList globalFaces(Pstream::nProcs());
globalFc[Pstream::myProcNo()] = patch_.faceCentres(); globalFc[Pstream::myProcNo()] = patch_.faceCentres();
globalSamples[Pstream::myProcNo()] = globalFc[Pstream::myProcNo()]+offset_; globalSamples[Pstream::myProcNo()] = globalFc[Pstream::myProcNo()]+offsets_;
globalFaces[Pstream::myProcNo()] = identity(patch_.size()); globalFaces[Pstream::myProcNo()] = identity(patch_.size());
// Distribute to all processors // Distribute to all processors
@ -365,17 +393,17 @@ void Foam::directMappedPatchBase::calcMapping() const
if if
( (
offset_ == vector::zero gAverage(mag(offsets_)) <= ROOTVSMALL
&& mode_ == NEARESTPATCHFACE && mode_ == NEARESTPATCHFACE
&& sampleRegion_ == patch_.boundaryMesh().mesh().name() && sampleRegion_ == patch_.boundaryMesh().mesh().name()
&& samplePatch_ == patch_.name() && samplePatch_ == patch_.name()
) )
{ {
WarningIn("directMappedPatchBase::calcMapping() const") WarningIn("directMappedPatchBase::calcMapping() const")
<< "Invalid offset " << offset_ << endl << "Invalid offset " << offsets_ << endl
<< "Offset is the vector added to the patch face centres to" << "Offset is the vector added to the patch face centres to"
<< " find the patch face supplying the data." << endl << " find the patch face supplying the data." << endl
<< "Setting it to " << offset_ << "Setting it to " << offsets_
<< " on the same patch, on the same region" << " on the same patch, on the same region"
<< " will find the faces themselves which does not make sense" << " will find the faces themselves which does not make sense"
<< " for anything but testing." << endl << " for anything but testing." << endl
@ -383,7 +411,7 @@ void Foam::directMappedPatchBase::calcMapping() const
<< "sampleRegion_:" << sampleRegion_ << endl << "sampleRegion_:" << sampleRegion_ << endl
<< "mode_:" << sampleModeNames_[mode_] << endl << "mode_:" << sampleModeNames_[mode_] << endl
<< "samplePatch_:" << samplePatch_ << endl << "samplePatch_:" << samplePatch_ << endl
<< "offset_:" << offset_ << endl; << "offsets_:" << offsets_ << endl;
} }
@ -447,34 +475,38 @@ void Foam::directMappedPatchBase::calcMapping() const
} }
// Check that actual offset vector (sampleLocations - patchFc) is more or //// Check that actual offset vector (sampleLocations - patchFc) is more or
// less constant. //// less constant.
if (Pstream::master()) //if (Pstream::master())
{ //{
const scalarField magOffset(mag(sampleLocations - patchFc)); // const scalarField magOffset(mag(sampleLocations - patchFc));
const scalar avgOffset(average(magOffset)); // const scalar avgOffset(average(magOffset));
//
forAll(magOffset, sampleI) // forAll(magOffset, sampleI)
{ // {
if (mag(magOffset[sampleI]-avgOffset) > max(SMALL, 0.001*avgOffset)) // if
{ // (
WarningIn("directMappedPatchBase::calcMapping() const") // mag(magOffset[sampleI]-avgOffset)
<< "The actual cell/face centres picked up using offset " // > max(SMALL, 0.001*avgOffset)
<< offset_ << " are not" << endl // )
<< " on a single plane." // {
<< " This might give numerical problems." << endl // WarningIn("directMappedPatchBase::calcMapping() const")
<< " At patchface " << patchFc[sampleI] // << "The actual cell/face centres picked up using offset "
<< " the sampled cell/face " << sampleLocations[sampleI] // << offsets_ << " are not" << endl
<< endl // << " on a single plane."
<< " is not on a plane " << avgOffset // << " This might give numerical problems." << endl
<< " offset from the patch." << endl // << " At patchface " << patchFc[sampleI]
<< " You might want to shift your plane offset." // << " the sampled cell/face " << sampleLocations[sampleI]
<< " Set the debug flag to get a dump of sampled cells." // << endl
<< endl; // << " is not on a plane " << avgOffset
break; // << " offset from the patch." << endl
} // << " You might want to shift your plane offset."
} // << " Set the debug flag to get a dump of sampled cells."
} // << endl;
// break;
// }
// }
//}
// Determine schedule. // Determine schedule.
@ -563,7 +595,29 @@ Foam::directMappedPatchBase::directMappedPatchBase
sampleRegion_(patch_.boundaryMesh().mesh().name()), sampleRegion_(patch_.boundaryMesh().mesh().name()),
mode_(NEARESTPATCHFACE), mode_(NEARESTPATCHFACE),
samplePatch_("none"), samplePatch_("none"),
uniformOffset_(true),
offset_(vector::zero), offset_(vector::zero),
offsets_(pp.size(), offset_),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL)
{}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode mode,
const word& samplePatch,
const vectorField& offsets
)
:
patch_(pp),
sampleRegion_(sampleRegion),
mode_(mode),
samplePatch_(samplePatch),
uniformOffset_(false),
offsets_(offsets),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()), sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL) mapPtr_(NULL)
{} {}
@ -586,7 +640,19 @@ Foam::directMappedPatchBase::directMappedPatchBase
), ),
mode_(sampleModeNames_.read(dict.lookup("sampleMode"))), mode_(sampleModeNames_.read(dict.lookup("sampleMode"))),
samplePatch_(dict.lookup("samplePatch")), samplePatch_(dict.lookup("samplePatch")),
offset_(dict.lookup("offset")), uniformOffset_(dict.found("offset")),
offset_
(
uniformOffset_
? point(dict.lookup("offset"))
: vector::zero
),
offsets_
(
uniformOffset_
? pointField(patch_.size(), offset_)
: dict.lookup("offsets")
),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()), sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL) mapPtr_(NULL)
{} {}
@ -602,7 +668,28 @@ Foam::directMappedPatchBase::directMappedPatchBase
sampleRegion_(dmp.sampleRegion_), sampleRegion_(dmp.sampleRegion_),
mode_(dmp.mode_), mode_(dmp.mode_),
samplePatch_(dmp.samplePatch_), samplePatch_(dmp.samplePatch_),
uniformOffset_(dmp.uniformOffset_),
offset_(dmp.offset_), offset_(dmp.offset_),
offsets_(dmp.offsets_),
sameRegion_(dmp.sameRegion_),
mapPtr_(NULL)
{}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,
const directMappedPatchBase& dmp,
const unallocLabelList& mapAddressing
)
:
patch_(pp),
sampleRegion_(dmp.sampleRegion_),
mode_(dmp.mode_),
samplePatch_(dmp.samplePatch_),
uniformOffset_(dmp.uniformOffset_),
offset_(dmp.offset_),
offsets_(dmp.offsets_, mapAddressing),
sameRegion_(dmp.sameRegion_), sameRegion_(dmp.sameRegion_),
mapPtr_(NULL) mapPtr_(NULL)
{} {}
@ -660,7 +747,14 @@ void Foam::directMappedPatchBase::write(Ostream& os) const
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
os.writeKeyword("samplePatch") << samplePatch_ os.writeKeyword("samplePatch") << samplePatch_
<< token::END_STATEMENT << nl; << token::END_STATEMENT << nl;
if (uniformOffset_)
{
os.writeKeyword("offset") << offset_ << token::END_STATEMENT << nl; os.writeKeyword("offset") << offset_ << token::END_STATEMENT << nl;
}
else
{
os.writeKeyword("offsets") << offsets_ << token::END_STATEMENT << nl;
}
} }

View File

@ -87,12 +87,18 @@ private:
//- What to sample //- What to sample
const sampleMode mode_; const sampleMode mode_;
//- Patch (only if NEARESTBOUNDARY) //- Patch (only if NEARESTPATCHFACE)
const word samplePatch_; const word samplePatch_;
//- Offset vector //- For backwards compatibility : reading/writing of uniform offset.
const bool uniformOffset_;
//- Offset vector (uniform)
const vector offset_; const vector offset_;
//- Offset vector
const vectorField offsets_;
//- Same region //- Same region
const bool sameRegion_; const bool sameRegion_;
@ -130,36 +136,6 @@ private:
void calcMapping() const; void calcMapping() const;
// Private class
//- Private class for finding nearest
// - point+local index
// - sqr(distance)
// - processor
typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
class nearestEqOp
{
public:
void operator()(nearInfo& x, const nearInfo& y) const
{
if (y.first().hit())
{
if (!x.first().hit())
{
x = y;
}
else if (y.second().first() < x.second().first())
{
x = y;
}
}
}
};
public: public:
//- Runtime type information //- Runtime type information
@ -168,15 +144,33 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from patch
directMappedPatchBase(const polyPatch&); directMappedPatchBase(const polyPatch&);
//- Construct from components
directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const vectorField& offset
);
//- Construct from dictionary //- Construct from dictionary
directMappedPatchBase(const polyPatch&, const dictionary&); directMappedPatchBase(const polyPatch&, const dictionary&);
//- Construct as copy, resetting patch //- Construct as copy, resetting patch
directMappedPatchBase(const polyPatch&, const directMappedPatchBase&); directMappedPatchBase(const polyPatch&, const directMappedPatchBase&);
//- Construct as copy, resetting patch, map original data
directMappedPatchBase
(
const polyPatch&,
const directMappedPatchBase&,
const unallocLabelList& mapAddressing
);
//- Destructor //- Destructor
virtual ~directMappedPatchBase(); virtual ~directMappedPatchBase();
@ -210,6 +204,12 @@ public:
return offset_; return offset_;
} }
//- Offset vector (from patch faces to destination mesh objects)
const vectorField& offsets() const
{
return offsets_;
}
//- Return reference to the parallel distribution map //- Return reference to the parallel distribution map
const mapDistribute& map() const const mapDistribute& map() const
{ {

View File

@ -57,6 +57,31 @@ Foam::directMappedPolyPatch::directMappedPolyPatch
{} {}
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
)
:
polyPatch(name, size, start, index, bm),
directMappedPatchBase
(
static_cast<const polyPatch&>(*this),
sampleRegion,
mode,
samplePatch,
offset
)
{}
Foam::directMappedPolyPatch::directMappedPolyPatch Foam::directMappedPolyPatch::directMappedPolyPatch
( (
const word& name, const word& name,
@ -95,6 +120,20 @@ Foam::directMappedPolyPatch::directMappedPolyPatch
{} {}
Foam::directMappedPolyPatch::directMappedPolyPatch
(
const directMappedPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart),
directMappedPatchBase(*this, pp, mapAddressing)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::directMappedPolyPatch::~directMappedPolyPatch() Foam::directMappedPolyPatch::~directMappedPolyPatch()

View File

@ -101,6 +101,20 @@ public:
const polyBoundaryMesh& bm const polyBoundaryMesh& bm
); );
//- Construct from components
directMappedPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
);
//- Construct from dictionary //- Construct from dictionary
directMappedPolyPatch directMappedPolyPatch
( (
@ -128,6 +142,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
directMappedPolyPatch
(
const directMappedPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh //- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{ {
@ -150,6 +174,29 @@ public:
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new directMappedPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
//- Destructor //- Destructor
virtual ~directMappedPolyPatch(); virtual ~directMappedPolyPatch();

View File

@ -62,6 +62,31 @@ Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
{} {}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
)
:
wallPolyPatch(name, size, start, index, bm),
directMappedPatchBase
(
static_cast<const polyPatch&>(*this),
sampleRegion,
mode,
samplePatch,
offset
)
{}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
( (
const word& name, const word& name,
@ -100,6 +125,20 @@ Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
{} {}
Foam::directMappedWallPolyPatch::directMappedWallPolyPatch
(
const directMappedWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
)
:
wallPolyPatch(pp, bm, index, mapAddressing, newStart),
directMappedPatchBase(*this, pp, mapAddressing)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::directMappedWallPolyPatch::~directMappedWallPolyPatch() Foam::directMappedWallPolyPatch::~directMappedWallPolyPatch()

View File

@ -101,6 +101,20 @@ public:
const polyBoundaryMesh& bm const polyBoundaryMesh& bm
); );
//- Construct from components
directMappedWallPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const word& sampleRegion,
const directMappedPatchBase::sampleMode mode,
const word& samplePatch,
const vectorField& offset,
const polyBoundaryMesh& bm
);
//- Construct from dictionary //- Construct from dictionary
directMappedWallPolyPatch directMappedWallPolyPatch
( (
@ -128,6 +142,16 @@ public:
const label newStart const label newStart
); );
//- Construct given the original patch and a map
directMappedWallPolyPatch
(
const directMappedWallPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh //- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{ {
@ -157,6 +181,29 @@ public:
); );
} }
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const unallocLabelList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new directMappedWallPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
//- Destructor //- Destructor
virtual ~directMappedWallPolyPatch(); virtual ~directMappedWallPolyPatch();

View File

@ -125,6 +125,31 @@ public:
// Member Functions // Member Functions
//- scaling vector per subsurface
const vectorField& scale() const
{
return scale_;
}
//- scaling vector per subsurface
vectorField& scale()
{
return scale_;
}
//- coordinate system per subsurface
const PtrList<coordinateSystem>& transform() const
{
return transform_;
}
//- coordinate system per subsurface
PtrList<coordinateSystem>& transform()
{
return transform_;
}
virtual const wordList& regions() const; virtual const wordList& regions() const;
//- Whether supports volume type below //- Whether supports volume type below

View File

@ -106,7 +106,7 @@ void Foam::cellToCell::applyToSet
{ {
if ((action == topoSetSource::ADD) || (action == topoSetSource::NEW)) if ((action == topoSetSource::ADD) || (action == topoSetSource::NEW))
{ {
Pout<< " Adding all elements of cellSet " << setName_ << " ..." Info<< " Adding all elements of cellSet " << setName_ << " ..."
<< endl; << endl;
// Load the set // Load the set
@ -116,7 +116,7 @@ void Foam::cellToCell::applyToSet
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::DELETE)
{ {
Pout<< " Removing all elements of cellSet " << setName_ << " ..." Info<< " Removing all elements of cellSet " << setName_ << " ..."
<< endl; << endl;
// Load the set // Load the set

View File

@ -0,0 +1,168 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "setToCellZone.H"
#include "polyMesh.H"
#include "cellZoneSet.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(setToCellZone, 0);
addToRunTimeSelectionTable(topoSetSource, setToCellZone, word);
addToRunTimeSelectionTable(topoSetSource, setToCellZone, istream);
}
Foam::topoSetSource::addToUsageTable Foam::setToCellZone::usage_
(
setToCellZone::typeName,
"\n Usage: setToCellZone <cellSet>\n\n"
" Select all cells in the cellSet.\n\n"
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::setToCellZone::setToCellZone
(
const polyMesh& mesh,
const word& setName
)
:
topoSetSource(mesh),
setName_(setName)
{}
// Construct from dictionary
Foam::setToCellZone::setToCellZone
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
setName_(dict.lookup("set"))
{}
// Construct from Istream
Foam::setToCellZone::setToCellZone
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
setName_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::setToCellZone::~setToCellZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::setToCellZone::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if (!isA<cellZoneSet>(set))
{
WarningIn
(
"setToCellZone::applyToSet(const topoSetSource::setAction"
", topoSet"
) << "Operation only allowed on a cellZoneSet." << endl;
}
else
{
cellZoneSet& fzSet = refCast<cellZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding all cells from cellSet " << setName_
<< " ..." << endl;
// Load the sets
cellSet fSet(mesh_, setName_);
// Start off from copy
DynamicList<label> newAddressing(fzSet.addressing());
forAllConstIter(cellSet, fSet, iter)
{
label cellI = iter.key();
if (!fzSet.found(cellI))
{
newAddressing.append(cellI);
}
}
fzSet.addressing().transfer(newAddressing);
fzSet.updateSet();
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing all cells from cellSet " << setName_
<< " ..." << endl;
// Load the set
cellSet loadedSet(mesh_, setName_);
// Start off empty
DynamicList<label> newAddressing(fzSet.addressing().size());
forAll(fzSet.addressing(), i)
{
if (!loadedSet.found(fzSet.addressing()[i]))
{
newAddressing.append(fzSet.addressing()[i]);
}
}
fzSet.addressing().transfer(newAddressing);
fzSet.updateSet();
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,115 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::setToCellZone
Description
A topoSetSource to select cells based on usage in a cellSet.
SourceFiles
setToCellZone.C
\*---------------------------------------------------------------------------*/
#ifndef setToCellZone_H
#define setToCellZone_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class setToCellZone Declaration
\*---------------------------------------------------------------------------*/
class setToCellZone
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- Name of set to use
word setName_;
public:
//- Runtime type information
TypeName("setToCellZone");
// Constructors
//- Construct from components
setToCellZone
(
const polyMesh& mesh,
const word& setName
);
//- Construct from dictionary
setToCellZone
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
setToCellZone
(
const polyMesh& mesh,
Istream&
);
// Destructor
virtual ~setToCellZone();
// Member Functions
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -217,14 +217,14 @@ void Foam::cellToFace::applyToSet
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{ {
Pout<< " Adding faces according to cellSet " << setName_ Info<< " Adding faces according to cellSet " << setName_
<< " ..." << endl; << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::DELETE)
{ {
Pout<< " Removing faces according to cellSet " << setName_ Info<< " Removing faces according to cellSet " << setName_
<< " ..." << endl; << " ..." << endl;
combine(set, false); combine(set, false);

View File

@ -0,0 +1,169 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "faceZoneToFaceZone.H"
#include "polyMesh.H"
#include "faceZoneSet.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(faceZoneToFaceZone, 0);
addToRunTimeSelectionTable(topoSetSource, faceZoneToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, faceZoneToFaceZone, istream);
}
Foam::topoSetSource::addToUsageTable Foam::faceZoneToFaceZone::usage_
(
faceZoneToFaceZone::typeName,
"\n Usage: faceZoneToFaceZone <faceZone>\n\n"
" Select all faces in the faceZone\n\n"
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::faceZoneToFaceZone::faceZoneToFaceZone
(
const polyMesh& mesh,
const word& setName
)
:
topoSetSource(mesh),
setName_(setName)
{}
// Construct from dictionary
Foam::faceZoneToFaceZone::faceZoneToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
setName_(dict.lookup("zone"))
{}
// Construct from Istream
Foam::faceZoneToFaceZone::faceZoneToFaceZone
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
setName_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceZoneToFaceZone::~faceZoneToFaceZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::faceZoneToFaceZone::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if (!isA<faceZoneSet>(set))
{
WarningIn
(
"faceZoneToFaceZone::applyToSet(const topoSetSource::setAction"
", topoSet"
) << "Operation only allowed on a faceZoneSet." << endl;
}
else
{
faceZoneSet& fSet = refCast<faceZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding all faces from faceZone " << setName_ << " ..."
<< endl;
// Load the set
faceZoneSet loadedSet(mesh_, setName_);
DynamicList<label> newAddressing(fSet.addressing());
DynamicList<bool> newFlipMap(fSet.flipMap());
forAll(loadedSet.addressing(), i)
{
if (!fSet.found(loadedSet.addressing()[i]))
{
newAddressing.append(loadedSet.addressing()[i]);
newFlipMap.append(loadedSet.flipMap()[i]);
}
}
fSet.addressing().transfer(newAddressing);
fSet.flipMap().transfer(newFlipMap);
fSet.updateSet();
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing all faces from faceZone " << setName_ << " ..."
<< endl;
// Load the set
faceZoneSet loadedSet(mesh_, setName_);
DynamicList<label> newAddressing(fSet.addressing().size());
DynamicList<bool> newFlipMap(fSet.flipMap().size());
forAll(fSet.addressing(), i)
{
if (!loadedSet.found(fSet.addressing()[i]))
{
newAddressing.append(fSet.addressing()[i]);
newFlipMap.append(fSet.flipMap()[i]);
}
}
fSet.addressing().transfer(newAddressing);
fSet.flipMap().transfer(newFlipMap);
fSet.updateSet();
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,115 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::faceZoneToFaceZone
Description
A topoSetSource to select faces based on usage in another faceSet.
SourceFiles
faceZoneToFaceZone.C
\*---------------------------------------------------------------------------*/
#ifndef faceZoneToFaceZone_H
#define faceZoneToFaceZone_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class faceZoneToFaceZone Declaration
\*---------------------------------------------------------------------------*/
class faceZoneToFaceZone
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- Name of set to use
word setName_;
public:
//- Runtime type information
TypeName("faceZoneToFaceZone");
// Constructors
//- Construct from components
faceZoneToFaceZone
(
const polyMesh& mesh,
const word& setName
);
//- Construct from dictionary
faceZoneToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
faceZoneToFaceZone
(
const polyMesh& mesh,
Istream&
);
// Destructor
virtual ~faceZoneToFaceZone();
// Member Functions
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,175 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "setToFaceZone.H"
#include "polyMesh.H"
#include "faceZoneSet.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(setToFaceZone, 0);
addToRunTimeSelectionTable(topoSetSource, setToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, setToFaceZone, istream);
}
Foam::topoSetSource::addToUsageTable Foam::setToFaceZone::usage_
(
setToFaceZone::typeName,
"\n Usage: setToFaceZone <faceSet>\n\n"
" Select all faces in the faceSet."
" Sets flipMap.\n\n"
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::setToFaceZone::setToFaceZone
(
const polyMesh& mesh,
const word& setName
)
:
topoSetSource(mesh),
setName_(setName)
{}
// Construct from dictionary
Foam::setToFaceZone::setToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
setName_(dict.lookup("faceSet"))
{}
// Construct from Istream
Foam::setToFaceZone::setToFaceZone
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
setName_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::setToFaceZone::~setToFaceZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::setToFaceZone::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if (!isA<faceZoneSet>(set))
{
WarningIn
(
"setToFaceZone::applyToSet(const topoSetSource::setAction"
", topoSet"
) << "Operation only allowed on a faceZoneSet." << endl;
}
else
{
faceZoneSet& fzSet = refCast<faceZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding all faces from faceSet " << setName_
<< " ..." << endl;
// Load the sets
faceSet fSet(mesh_, setName_);
// Start off from copy
DynamicList<label> newAddressing(fzSet.addressing());
DynamicList<bool> newFlipMap(fzSet.flipMap());
forAllConstIter(faceSet, fSet, iter)
{
label faceI = iter.key();
if (!fzSet.found(faceI))
{
newAddressing.append(faceI);
newFlipMap.append(false);
}
}
fzSet.addressing().transfer(newAddressing);
fzSet.flipMap().transfer(newFlipMap);
fzSet.updateSet();
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing all faces from faceSet " << setName_
<< " ..." << endl;
// Load the set
faceSet loadedSet(mesh_, setName_);
// Start off empty
DynamicList<label> newAddressing(fzSet.addressing().size());
DynamicList<bool> newFlipMap(fzSet.flipMap().size());
forAll(fzSet.addressing(), i)
{
if (!loadedSet.found(fzSet.addressing()[i]))
{
newAddressing.append(fzSet.addressing()[i]);
newFlipMap.append(fzSet.flipMap()[i]);
}
}
fzSet.addressing().transfer(newAddressing);
fzSet.flipMap().transfer(newFlipMap);
fzSet.updateSet();
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::setToFaceZone
Description
A topoSetSource to select faces based on usage in a faceSet. Sets flipMap
to true.
SourceFiles
setToFaceZone.C
\*---------------------------------------------------------------------------*/
#ifndef setToFaceZone_H
#define setToFaceZone_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class setToFaceZone Declaration
\*---------------------------------------------------------------------------*/
class setToFaceZone
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- Name of set to use
word setName_;
public:
//- Runtime type information
TypeName("setToFaceZone");
// Constructors
//- Construct from components
setToFaceZone
(
const polyMesh& mesh,
const word& setName
);
//- Construct from dictionary
setToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
setToFaceZone
(
const polyMesh& mesh,
Istream&
);
// Destructor
virtual ~setToFaceZone();
// Member Functions
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,222 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "setsToFaceZone.H"
#include "polyMesh.H"
#include "faceZoneSet.H"
#include "cellSet.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(setsToFaceZone, 0);
addToRunTimeSelectionTable(topoSetSource, setsToFaceZone, word);
addToRunTimeSelectionTable(topoSetSource, setsToFaceZone, istream);
}
Foam::topoSetSource::addToUsageTable Foam::setsToFaceZone::usage_
(
setsToFaceZone::typeName,
"\n Usage: setsToFaceZone <faceSet> <slaveCellSet>\n\n"
" Select all faces in the faceSet."
" Orientated so slave side is in cellSet.\n\n"
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::setsToFaceZone::setsToFaceZone
(
const polyMesh& mesh,
const word& faceSetName,
const word& cellSetName
)
:
topoSetSource(mesh),
faceSetName_(faceSetName),
cellSetName_(cellSetName)
{}
// Construct from dictionary
Foam::setsToFaceZone::setsToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
faceSetName_(dict.lookup("faceSet")),
cellSetName_(dict.lookup("cellSet"))
{}
// Construct from Istream
Foam::setsToFaceZone::setsToFaceZone
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
faceSetName_(checkIs(is)),
cellSetName_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::setsToFaceZone::~setsToFaceZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::setsToFaceZone::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if (!isA<faceZoneSet>(set))
{
WarningIn
(
"setsToFaceZone::applyToSet(const topoSetSource::setAction"
", topoSet"
) << "Operation only allowed on a faceZoneSet." << endl;
}
else
{
faceZoneSet& fzSet = refCast<faceZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding all faces from faceSet " << faceSetName_
<< " ..." << endl;
// Load the sets
faceSet fSet(mesh_, faceSetName_);
cellSet cSet(mesh_, cellSetName_);
// Start off from copy
DynamicList<label> newAddressing(fzSet.addressing());
DynamicList<bool> newFlipMap(fzSet.flipMap());
forAllConstIter(faceSet, fSet, iter)
{
label faceI = iter.key();
if (!fzSet.found(faceI))
{
bool flip = false;
label own = mesh_.faceOwner()[faceI];
bool ownFound = cSet.found(own);
if (mesh_.isInternalFace(faceI))
{
label nei = mesh_.faceNeighbour()[faceI];
bool neiFound = cSet.found(nei);
if (ownFound && !neiFound)
{
flip = false;
}
else if(!ownFound && neiFound)
{
flip = true;
}
else
{
WarningIn
(
"setsToFaceZone::applyToSet"
"(const topoSetSource::setAction, topoSet)"
) << "One of owner or neighbour of internal face "
<< faceI << " should be in cellSet "
<< cSet.name()
<< " to be able to determine orientation."
<< endl
<< "Face:" << faceI << " own:" << own
<< " OwnInCellSet:" << ownFound
<< " nei:" << nei
<< " NeiInCellSet:" << neiFound
<< endl;
}
}
else
{
flip = !ownFound;
}
newAddressing.append(faceI);
newFlipMap.append(flip);
}
}
fzSet.addressing().transfer(newAddressing);
fzSet.flipMap().transfer(newFlipMap);
fzSet.updateSet();
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing all faces from faceSet " << faceSetName_
<< " ..." << endl;
// Load the set
faceZoneSet loadedSet(mesh_, faceSetName_);
// Start off empty
DynamicList<label> newAddressing(fzSet.addressing().size());
DynamicList<bool> newFlipMap(fzSet.flipMap().size());
forAll(fzSet.addressing(), i)
{
if (!loadedSet.found(fzSet.addressing()[i]))
{
newAddressing.append(fzSet.addressing()[i]);
newFlipMap.append(fzSet.flipMap()[i]);
}
}
fzSet.addressing().transfer(newAddressing);
fzSet.flipMap().transfer(newFlipMap);
fzSet.updateSet();
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,119 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::setsToFaceZone
Description
A topoSetSource to select faces based on usage in a faceSet and cellSet
SourceFiles
setsToFaceZone.C
\*---------------------------------------------------------------------------*/
#ifndef setsToFaceZone_H
#define setsToFaceZone_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class setsToFaceZone Declaration
\*---------------------------------------------------------------------------*/
class setsToFaceZone
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- Name of set to use
word faceSetName_;
//- Name of set to use
word cellSetName_;
public:
//- Runtime type information
TypeName("setsToFaceZone");
// Constructors
//- Construct from components
setsToFaceZone
(
const polyMesh& mesh,
const word& faceSetName,
const word& cellSetName
);
//- Construct from dictionary
setsToFaceZone
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
setsToFaceZone
(
const polyMesh& mesh,
Istream&
);
// Destructor
virtual ~setsToFaceZone();
// Member Functions
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -151,13 +151,13 @@ void Foam::cellToPoint::applyToSet
{ {
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{ {
Pout<< " Adding from " << setName_ << " ..." << endl; Info<< " Adding from " << setName_ << " ..." << endl;
combine(set, true); combine(set, true);
} }
else if (action == topoSetSource::DELETE) else if (action == topoSetSource::DELETE)
{ {
Pout<< " Removing from " << setName_ << " ..." << endl; Info<< " Removing from " << setName_ << " ..." << endl;
combine(set, false); combine(set, false);
} }

View File

@ -0,0 +1,168 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "setToPointZone.H"
#include "polyMesh.H"
#include "pointZoneSet.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(setToPointZone, 0);
addToRunTimeSelectionTable(topoSetSource, setToPointZone, word);
addToRunTimeSelectionTable(topoSetSource, setToPointZone, istream);
}
Foam::topoSetSource::addToUsageTable Foam::setToPointZone::usage_
(
setToPointZone::typeName,
"\n Usage: setToPointZone <pointSet>\n\n"
" Select all points in the pointSet.\n\n"
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::setToPointZone::setToPointZone
(
const polyMesh& mesh,
const word& setName
)
:
topoSetSource(mesh),
setName_(setName)
{}
// Construct from dictionary
Foam::setToPointZone::setToPointZone
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
setName_(dict.lookup("set"))
{}
// Construct from Istream
Foam::setToPointZone::setToPointZone
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
setName_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::setToPointZone::~setToPointZone()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::setToPointZone::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if (!isA<pointZoneSet>(set))
{
WarningIn
(
"setToPointZone::applyToSet(const topoSetSource::setAction"
", topoSet"
) << "Operation only allowed on a pointZoneSet." << endl;
}
else
{
pointZoneSet& fzSet = refCast<pointZoneSet>(set);
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding all points from pointSet " << setName_
<< " ..." << endl;
// Load the sets
pointSet fSet(mesh_, setName_);
// Start off from copy
DynamicList<label> newAddressing(fzSet.addressing());
forAllConstIter(pointSet, fSet, iter)
{
label pointI = iter.key();
if (!fzSet.found(pointI))
{
newAddressing.append(pointI);
}
}
fzSet.addressing().transfer(newAddressing);
fzSet.updateSet();
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing all points from pointSet " << setName_
<< " ..." << endl;
// Load the set
pointSet loadedSet(mesh_, setName_);
// Start off empty
DynamicList<label> newAddressing(fzSet.addressing().size());
forAll(fzSet.addressing(), i)
{
if (!loadedSet.found(fzSet.addressing()[i]))
{
newAddressing.append(fzSet.addressing()[i]);
}
}
fzSet.addressing().transfer(newAddressing);
fzSet.updateSet();
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,115 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::setToPointZone
Description
A topoSetSource to select points based on usage in a pointSet.
SourceFiles
setToPointZone.C
\*---------------------------------------------------------------------------*/
#ifndef setToPointZone_H
#define setToPointZone_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class setToPointZone Declaration
\*---------------------------------------------------------------------------*/
class setToPointZone
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- Name of set to use
word setName_;
public:
//- Runtime type information
TypeName("setToPointZone");
// Constructors
//- Construct from components
setToPointZone
(
const polyMesh& mesh,
const word& setName
);
//- Construct from dictionary
setToPointZone
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
setToPointZone
(
const polyMesh& mesh,
Istream&
);
// Destructor
virtual ~setToPointZone();
// Member Functions
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -101,7 +101,7 @@ autoPtr<topoSetSource> topoSetSource::New
Foam::HashTable<Foam::string>* Foam::topoSetSource::usageTablePtr_ = NULL; Foam::HashTable<Foam::string>* Foam::topoSetSource::usageTablePtr_ = NULL;
template<> template<>
const char* Foam::NamedEnum<Foam::topoSetSource::setAction, 7>::names[] = const char* Foam::NamedEnum<Foam::topoSetSource::setAction, 8>::names[] =
{ {
"clear", "clear",
"new", "new",
@ -109,11 +109,12 @@ const char* Foam::NamedEnum<Foam::topoSetSource::setAction, 7>::names[] =
"add", "add",
"delete", "delete",
"subset", "subset",
"list" "list",
"remove"
}; };
const Foam::NamedEnum<Foam::topoSetSource::setAction, 7> const Foam::NamedEnum<Foam::topoSetSource::setAction, 8>
Foam::topoSetSource::actionNames_; Foam::topoSetSource::actionNames_;

View File

@ -77,7 +77,8 @@ public:
ADD, ADD,
DELETE, DELETE,
SUBSET, SUBSET,
LIST LIST,
REMOVE
}; };
protected: protected:
@ -120,7 +121,7 @@ protected:
private: private:
static const NamedEnum<setAction, 7> actionNames_; static const NamedEnum<setAction, 8> actionNames_;
static const string illegalSource_; static const string illegalSource_;

View File

@ -41,6 +41,7 @@ defineTypeNameAndDebug(cellSet, 0);
addToRunTimeSelectionTable(topoSet, cellSet, word); addToRunTimeSelectionTable(topoSet, cellSet, word);
addToRunTimeSelectionTable(topoSet, cellSet, size); addToRunTimeSelectionTable(topoSet, cellSet, size);
addToRunTimeSelectionTable(topoSet, cellSet, set);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -78,6 +79,18 @@ cellSet::cellSet
{} {}
cellSet::cellSet
(
const polyMesh& mesh,
const word& name,
const topoSet& set,
writeOption w
)
:
topoSet(mesh, name, set, w)
{}
cellSet::cellSet cellSet::cellSet
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -88,6 +88,15 @@ public:
writeOption w=NO_WRITE writeOption w=NO_WRITE
); );
//- Construct from existing set
cellSet
(
const polyMesh& mesh,
const word& name,
const topoSet&,
writeOption w=NO_WRITE
);
//- Construct from labelHashSet //- Construct from labelHashSet
cellSet cellSet
( (

View File

@ -0,0 +1,314 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "cellZoneSet.H"
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(cellZoneSet, 0);
addToRunTimeSelectionTable(topoSet, cellZoneSet, word);
addToRunTimeSelectionTable(topoSet, cellZoneSet, size);
addToRunTimeSelectionTable(topoSet, cellZoneSet, set);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void cellZoneSet::updateSet()
{
labelList order;
sortedOrder(addressing_, order);
inplaceReorder(order, addressing_);
cellSet::clearStorage();
cellSet::resize(2*addressing_.size());
forAll(addressing_, i)
{
cellSet::insert(addressing_[i]);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
cellZoneSet::cellZoneSet
(
const polyMesh& mesh,
const word& name,
readOption r,
writeOption w
)
:
cellSet(mesh, name, 1000), // do not read cellSet
mesh_(mesh),
addressing_(0)
{
const cellZoneMesh& cellZones = mesh.cellZones();
label zoneID = cellZones.findZoneID(name);
if
(
(r == IOobject::MUST_READ)
|| (r == IOobject::READ_IF_PRESENT && zoneID != -1)
)
{
const cellZone& fz = cellZones[zoneID];
addressing_ = fz;
}
updateSet();
check(mesh.nCells());
}
cellZoneSet::cellZoneSet
(
const polyMesh& mesh,
const word& name,
const label size,
writeOption w
)
:
cellSet(mesh, name, size, w),
mesh_(mesh),
addressing_(0)
{
updateSet();
}
cellZoneSet::cellZoneSet
(
const polyMesh& mesh,
const word& name,
const topoSet& set,
writeOption w
)
:
cellSet(mesh, name, set.size(), w),
mesh_(mesh),
addressing_(refCast<const cellZoneSet>(set).addressing())
{
updateSet();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
cellZoneSet::~cellZoneSet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void cellZoneSet::invert(const label maxLen)
{
label n = 0;
for (label cellI = 0; cellI < maxLen; cellI++)
{
if (!found(cellI))
{
addressing_[n] = cellI;
n++;
}
}
addressing_.setSize(n);
updateSet();
}
void cellZoneSet::subset(const topoSet& set)
{
DynamicList<label> newAddressing(addressing_.size());
const cellZoneSet& fSet = refCast<const cellZoneSet>(set);
forAll(fSet.addressing(), i)
{
label cellI = fSet.addressing()[i];
if (found(cellI))
{
newAddressing.append(cellI);
}
}
addressing_.transfer(newAddressing);
updateSet();
}
void cellZoneSet::addSet(const topoSet& set)
{
DynamicList<label> newAddressing(addressing_);
const cellZoneSet& fSet = refCast<const cellZoneSet>(set);
forAll(fSet.addressing(), i)
{
label cellI = fSet.addressing()[i];
if (!found(cellI))
{
newAddressing.append(cellI);
}
}
addressing_.transfer(newAddressing);
updateSet();
}
void cellZoneSet::deleteSet(const topoSet& set)
{
DynamicList<label> newAddressing(addressing_.size());
const cellZoneSet& fSet = refCast<const cellZoneSet>(set);
forAll(addressing_, i)
{
label cellI = addressing_[i];
if (!fSet.found(cellI))
{
// Not found in fSet so add
newAddressing.append(cellI);
}
}
addressing_.transfer(newAddressing);
updateSet();
}
void cellZoneSet::sync(const polyMesh& mesh)
{}
label cellZoneSet::maxSize(const polyMesh& mesh) const
{
return mesh.nCells();
}
//- Write using given format, version and compression
bool cellZoneSet::writeObject
(
IOstream::streamFormat s,
IOstream::versionNumber v,
IOstream::compressionType c
) const
{
// Write shadow cellSet
word oldTypeName = typeName;
const_cast<word&>(type()) = cellSet::typeName;
bool ok = cellSet::writeObject(s, v, c);
const_cast<word&>(type()) = oldTypeName;
// Modify cellZone
cellZoneMesh& cellZones = const_cast<polyMesh&>(mesh_).cellZones();
label zoneID = cellZones.findZoneID(name());
if (zoneID == -1)
{
zoneID = cellZones.size();
cellZones.setSize(zoneID+1);
cellZones.set
(
zoneID,
new cellZone
(
name(),
addressing_,
zoneID,
cellZones
)
);
}
else
{
cellZones[zoneID] = addressing_;
}
cellZones.clearAddressing();
return ok && cellZones.write();
}
void cellZoneSet::updateMesh(const mapPolyMesh& morphMap)
{
// cellZone
labelList newAddressing(addressing_.size());
label n = 0;
forAll(addressing_, i)
{
label cellI = addressing_[i];
label newCellI = morphMap.reverseCellMap()[cellI];
if (newCellI >= 0)
{
newAddressing[n] = newCellI;
n++;
}
}
newAddressing.setSize(n);
addressing_.transfer(newAddressing);
updateSet();
}
void cellZoneSet::writeDebug
(
Ostream& os,
const primitiveMesh& mesh,
const label maxLen
) const
{
cellSet::writeDebug(os, mesh, maxLen);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,170 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::cellZoneSet
Description
Like cellSet but updates cellZone when writing.
SourceFiles
cellZone.C
\*---------------------------------------------------------------------------*/
#ifndef cellZoneSet_H
#define cellZoneSet_H
#include "cellSet.H"
#include "boolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cellZoneSet Declaration
\*---------------------------------------------------------------------------*/
class cellZoneSet
:
public cellSet
{
// Private data
const polyMesh& mesh_;
labelList addressing_;
public:
//- Runtime type information
TypeName("cellZoneSet");
// Constructors
//- Construct from objectRegistry and name
cellZoneSet
(
const polyMesh& mesh,
const word& name,
readOption r=MUST_READ,
writeOption w=NO_WRITE
);
//- Construct from additional size of labelHashSet
cellZoneSet
(
const polyMesh& mesh,
const word& name,
const label,
writeOption w=NO_WRITE
);
//- Construct from existing set
cellZoneSet
(
const polyMesh& mesh,
const word& name,
const topoSet&,
writeOption w=NO_WRITE
);
// Destructor
virtual ~cellZoneSet();
// Member functions
const labelList& addressing() const
{
return addressing_;
}
labelList& addressing()
{
return addressing_;
}
//- Sort addressing and make cellSet part consistent with addressing
void updateSet();
//- Invert contents. (insert all members 0..maxLen-1 which were not in
// set)
virtual void invert(const label maxLen);
//- Subset contents. Only elements present in both sets remain.
virtual void subset(const topoSet& set);
//- Add elements present in set.
virtual void addSet(const topoSet& set);
//- Delete elements present in set.
virtual void deleteSet(const topoSet& set);
//- Sync cellZoneSet across coupled patches.
virtual void sync(const polyMesh& mesh);
//- Write maxLen items with label and coordinates.
virtual void writeDebug
(
Ostream& os,
const primitiveMesh&,
const label maxLen
) const;
//- Write cellZone
virtual bool writeObject
(
IOstream::streamFormat,
IOstream::versionNumber,
IOstream::compressionType
) const;
//- Update any stored data for new labels
virtual void updateMesh(const mapPolyMesh& morphMap);
//- Return max index+1.
virtual label maxSize(const polyMesh& mesh) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -43,6 +43,7 @@ defineTypeNameAndDebug(faceSet, 0);
addToRunTimeSelectionTable(topoSet, faceSet, word); addToRunTimeSelectionTable(topoSet, faceSet, word);
addToRunTimeSelectionTable(topoSet, faceSet, size); addToRunTimeSelectionTable(topoSet, faceSet, size);
addToRunTimeSelectionTable(topoSet, faceSet, set);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -79,6 +80,18 @@ faceSet::faceSet
{} {}
faceSet::faceSet
(
const polyMesh& mesh,
const word& name,
const topoSet& set,
writeOption w
)
:
topoSet(mesh, name, set, w)
{}
faceSet::faceSet faceSet::faceSet
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -83,6 +83,15 @@ public:
writeOption w=NO_WRITE writeOption w=NO_WRITE
); );
//- Construct from existing set
faceSet
(
const polyMesh& mesh,
const word& name,
const topoSet&,
writeOption w=NO_WRITE
);
//- Construct from additional labelHashSet //- Construct from additional labelHashSet
faceSet faceSet
( (

View File

@ -0,0 +1,413 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "faceZoneSet.H"
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(faceZoneSet, 0);
addToRunTimeSelectionTable(topoSet, faceZoneSet, word);
addToRunTimeSelectionTable(topoSet, faceZoneSet, size);
addToRunTimeSelectionTable(topoSet, faceZoneSet, set);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void faceZoneSet::updateSet()
{
labelList order;
sortedOrder(addressing_, order);
inplaceReorder(order, addressing_);
inplaceReorder(order, flipMap_);
faceSet::clearStorage();
faceSet::resize(2*addressing_.size());
forAll(addressing_, i)
{
faceSet::insert(addressing_[i]);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
faceZoneSet::faceZoneSet
(
const polyMesh& mesh,
const word& name,
readOption r,
writeOption w
)
:
faceSet(mesh, name, 1000), // do not read faceSet
mesh_(mesh),
addressing_(0),
flipMap_(0)
{
const faceZoneMesh& faceZones = mesh.faceZones();
label zoneID = faceZones.findZoneID(name);
if
(
(r == IOobject::MUST_READ)
|| (r == IOobject::READ_IF_PRESENT && zoneID != -1)
)
{
const faceZone& fz = faceZones[zoneID];
addressing_ = fz;
flipMap_ = fz.flipMap();
}
updateSet();
check(mesh.nFaces());
}
faceZoneSet::faceZoneSet
(
const polyMesh& mesh,
const word& name,
const label size,
writeOption w
)
:
faceSet(mesh, name, size, w),
mesh_(mesh),
addressing_(0),
flipMap_(0)
{
updateSet();
}
faceZoneSet::faceZoneSet
(
const polyMesh& mesh,
const word& name,
const topoSet& set,
writeOption w
)
:
faceSet(mesh, name, set.size(), w),
mesh_(mesh),
addressing_(refCast<const faceZoneSet>(set).addressing()),
flipMap_(refCast<const faceZoneSet>(set).flipMap())
{
updateSet();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
faceZoneSet::~faceZoneSet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void faceZoneSet::invert(const label maxLen)
{
label n = 0;
for (label faceI = 0; faceI < maxLen; faceI++)
{
if (!found(faceI))
{
addressing_[n] = faceI;
flipMap_[n] = false; //? or true?
n++;
}
}
addressing_.setSize(n);
flipMap_.setSize(n);
updateSet();
}
void faceZoneSet::subset(const topoSet& set)
{
label nConflict = 0;
DynamicList<label> newAddressing(addressing_.size());
DynamicList<bool> newFlipMap(flipMap_.size());
Map<label> faceToIndex(addressing_.size());
forAll(addressing_, i)
{
faceToIndex.insert(addressing_[i], i);
}
const faceZoneSet& fSet = refCast<const faceZoneSet>(set);
forAll(fSet.addressing(), i)
{
label faceI = fSet.addressing()[i];
Map<label>::const_iterator iter = faceToIndex.find(faceI);
if (iter != faceToIndex.end())
{
label index = iter();
if (fSet.flipMap()[i] != flipMap_[index])
{
nConflict++;
}
newAddressing.append(faceI);
newFlipMap.append(flipMap_[index]);
}
}
if (nConflict > 0)
{
WarningIn(" faceZoneSet::subset(const topoSet&)")
<< "subset : there are " << nConflict
<< " faces with different orientation in faceZonesSets "
<< name() << " and " << set.name() << endl;
}
addressing_.transfer(newAddressing);
flipMap_.transfer(newFlipMap);
updateSet();
}
void faceZoneSet::addSet(const topoSet& set)
{
label nConflict = 0;
DynamicList<label> newAddressing(addressing_);
DynamicList<bool> newFlipMap(flipMap_);
Map<label> faceToIndex(addressing_.size());
forAll(addressing_, i)
{
faceToIndex.insert(addressing_[i], i);
}
const faceZoneSet& fSet = refCast<const faceZoneSet>(set);
forAll(fSet.addressing(), i)
{
label faceI = fSet.addressing()[i];
Map<label>::const_iterator iter = faceToIndex.find(faceI);
if (iter != faceToIndex.end())
{
label index = iter();
if (fSet.flipMap()[i] != flipMap_[index])
{
nConflict++;
}
}
else
{
newAddressing.append(faceI);
newFlipMap.append(fSet.flipMap()[i]);
}
}
if (nConflict > 0)
{
WarningIn("faceZoneSet::addSet(const topoSet&)")
<< "addSet : there are " << nConflict
<< " faces with different orientation in faceZonesSets "
<< name() << " and " << set.name() << endl;
}
addressing_.transfer(newAddressing);
flipMap_.transfer(newFlipMap);
updateSet();
}
void faceZoneSet::deleteSet(const topoSet& set)
{
label nConflict = 0;
DynamicList<label> newAddressing(addressing_.size());
DynamicList<bool> newFlipMap(flipMap_.size());
const faceZoneSet& fSet = refCast<const faceZoneSet>(set);
Map<label> faceToIndex(fSet.addressing().size());
forAll(fSet.addressing(), i)
{
faceToIndex.insert(fSet.addressing()[i], i);
}
forAll(addressing_, i)
{
label faceI = addressing_[i];
Map<label>::const_iterator iter = faceToIndex.find(faceI);
if (iter != faceToIndex.end())
{
label index = iter();
if (fSet.flipMap()[index] != flipMap_[i])
{
nConflict++;
}
}
else
{
// Not found in fSet so add
newAddressing.append(faceI);
newFlipMap.append(fSet.flipMap()[i]);
}
}
if (nConflict > 0)
{
WarningIn("faceZoneSet::deleteSet(const topoSet&)")
<< "deleteSet : there are " << nConflict
<< " faces with different orientation in faceZonesSets "
<< name() << " and " << set.name() << endl;
}
addressing_.transfer(newAddressing);
flipMap_.transfer(newFlipMap);
updateSet();
}
void faceZoneSet::sync(const polyMesh& mesh)
{}
label faceZoneSet::maxSize(const polyMesh& mesh) const
{
return mesh.nFaces();
}
//- Write using given format, version and compression
bool faceZoneSet::writeObject
(
IOstream::streamFormat s,
IOstream::versionNumber v,
IOstream::compressionType c
) const
{
// Write shadow faceSet
word oldTypeName = typeName;
const_cast<word&>(type()) = faceSet::typeName;
bool ok = faceSet::writeObject(s, v, c);
const_cast<word&>(type()) = oldTypeName;
// Modify faceZone
faceZoneMesh& faceZones = const_cast<polyMesh&>(mesh_).faceZones();
label zoneID = faceZones.findZoneID(name());
if (zoneID == -1)
{
zoneID = faceZones.size();
faceZones.setSize(zoneID+1);
faceZones.set
(
zoneID,
new faceZone
(
name(),
addressing_,
flipMap_,
zoneID,
faceZones
)
);
}
else
{
faceZones[zoneID].resetAddressing(addressing_, flipMap_);
}
faceZones.clearAddressing();
return ok && faceZones.write();
}
void faceZoneSet::updateMesh(const mapPolyMesh& morphMap)
{
// faceZone
labelList newAddressing(addressing_.size());
boolList newFlipMap(flipMap_.size());
label n = 0;
forAll(addressing_, i)
{
label faceI = addressing_[i];
label newFaceI = morphMap.reverseFaceMap()[faceI];
if (newFaceI >= 0)
{
newAddressing[n] = newFaceI;
newFlipMap[n] = flipMap_[i];
n++;
}
}
newAddressing.setSize(n);
newFlipMap.setSize(n);
addressing_.transfer(newAddressing);
flipMap_.transfer(newFlipMap);
updateSet();
}
void faceZoneSet::writeDebug
(
Ostream& os,
const primitiveMesh& mesh,
const label maxLen
) const
{
faceSet::writeDebug(os, mesh, maxLen);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,187 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::faceZoneSet
Description
Like faceSet but updates faceZone when writing.
SourceFiles
faceZone.C
\*---------------------------------------------------------------------------*/
#ifndef faceZoneSet_H
#define faceZoneSet_H
#include "faceSet.H"
#include "boolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class faceZoneSet Declaration
\*---------------------------------------------------------------------------*/
class faceZoneSet
:
public faceSet
{
// Private data
const polyMesh& mesh_;
labelList addressing_;
boolList flipMap_;
// Private Member Functions
public:
//- Runtime type information
TypeName("faceZoneSet");
// Constructors
//- Construct from objectRegistry and name
faceZoneSet
(
const polyMesh& mesh,
const word& name,
readOption r=MUST_READ,
writeOption w=NO_WRITE
);
//- Construct from additional size of labelHashSet
faceZoneSet
(
const polyMesh& mesh,
const word& name,
const label,
writeOption w=NO_WRITE
);
//- Construct from existing set
faceZoneSet
(
const polyMesh& mesh,
const word& name,
const topoSet&,
writeOption w=NO_WRITE
);
// Destructor
virtual ~faceZoneSet();
// Member functions
const labelList& addressing() const
{
return addressing_;
}
labelList& addressing()
{
return addressing_;
}
const boolList& flipMap() const
{
return flipMap_;
}
boolList& flipMap()
{
return flipMap_;
}
//- Sort addressing and make faceSet part consistent with addressing
void updateSet();
//- Invert contents. (insert all members 0..maxLen-1 which were not in
// set)
virtual void invert(const label maxLen);
//- Subset contents. Only elements present in both sets remain.
virtual void subset(const topoSet& set);
//- Add elements present in set.
virtual void addSet(const topoSet& set);
//- Delete elements present in set.
virtual void deleteSet(const topoSet& set);
//- Sync faceZoneSet across coupled patches.
virtual void sync(const polyMesh& mesh);
//- Write maxLen items with label and coordinates.
virtual void writeDebug
(
Ostream& os,
const primitiveMesh&,
const label maxLen
) const;
//- Write faceZone
virtual bool writeObject
(
IOstream::streamFormat,
IOstream::versionNumber,
IOstream::compressionType
) const;
//- Update any stored data for new labels
virtual void updateMesh(const mapPolyMesh& morphMap);
//- Return max index+1.
virtual label maxSize(const polyMesh& mesh) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -42,6 +42,7 @@ defineTypeNameAndDebug(pointSet, 0);
addToRunTimeSelectionTable(topoSet, pointSet, word); addToRunTimeSelectionTable(topoSet, pointSet, word);
addToRunTimeSelectionTable(topoSet, pointSet, size); addToRunTimeSelectionTable(topoSet, pointSet, size);
addToRunTimeSelectionTable(topoSet, pointSet, set);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -78,6 +79,18 @@ pointSet::pointSet
{} {}
pointSet::pointSet
(
const polyMesh& mesh,
const word& name,
const topoSet& set,
writeOption w
)
:
topoSet(mesh, name, set, w)
{}
pointSet::pointSet pointSet::pointSet
( (
const polyMesh& mesh, const polyMesh& mesh,

View File

@ -83,6 +83,15 @@ public:
writeOption w=NO_WRITE writeOption w=NO_WRITE
); );
//- Construct from additional labelHashSet
pointSet
(
const polyMesh& mesh,
const word& name,
const topoSet&,
writeOption w=NO_WRITE
);
//- Construct from additional labelHashSet //- Construct from additional labelHashSet
pointSet pointSet
( (

View File

@ -0,0 +1,314 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "pointZoneSet.H"
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(pointZoneSet, 0);
addToRunTimeSelectionTable(topoSet, pointZoneSet, word);
addToRunTimeSelectionTable(topoSet, pointZoneSet, size);
addToRunTimeSelectionTable(topoSet, pointZoneSet, set);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void pointZoneSet::updateSet()
{
labelList order;
sortedOrder(addressing_, order);
inplaceReorder(order, addressing_);
pointSet::clearStorage();
pointSet::resize(2*addressing_.size());
forAll(addressing_, i)
{
pointSet::insert(addressing_[i]);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
pointZoneSet::pointZoneSet
(
const polyMesh& mesh,
const word& name,
readOption r,
writeOption w
)
:
pointSet(mesh, name, 1000), // do not read pointSet
mesh_(mesh),
addressing_(0)
{
const pointZoneMesh& pointZones = mesh.pointZones();
label zoneID = pointZones.findZoneID(name);
if
(
(r == IOobject::MUST_READ)
|| (r == IOobject::READ_IF_PRESENT && zoneID != -1)
)
{
const pointZone& fz = pointZones[zoneID];
addressing_ = fz;
}
updateSet();
check(mesh.nPoints());
}
pointZoneSet::pointZoneSet
(
const polyMesh& mesh,
const word& name,
const label size,
writeOption w
)
:
pointSet(mesh, name, size, w),
mesh_(mesh),
addressing_(0)
{
updateSet();
}
pointZoneSet::pointZoneSet
(
const polyMesh& mesh,
const word& name,
const topoSet& set,
writeOption w
)
:
pointSet(mesh, name, set.size(), w),
mesh_(mesh),
addressing_(refCast<const pointZoneSet>(set).addressing())
{
updateSet();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
pointZoneSet::~pointZoneSet()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void pointZoneSet::invert(const label maxLen)
{
label n = 0;
for (label pointI = 0; pointI < maxLen; pointI++)
{
if (!found(pointI))
{
addressing_[n] = pointI;
n++;
}
}
addressing_.setSize(n);
updateSet();
}
void pointZoneSet::subset(const topoSet& set)
{
DynamicList<label> newAddressing(addressing_.size());
const pointZoneSet& fSet = refCast<const pointZoneSet>(set);
forAll(fSet.addressing(), i)
{
label pointI = fSet.addressing()[i];
if (found(pointI))
{
newAddressing.append(pointI);
}
}
addressing_.transfer(newAddressing);
updateSet();
}
void pointZoneSet::addSet(const topoSet& set)
{
DynamicList<label> newAddressing(addressing_);
const pointZoneSet& fSet = refCast<const pointZoneSet>(set);
forAll(fSet.addressing(), i)
{
label pointI = fSet.addressing()[i];
if (!found(pointI))
{
newAddressing.append(pointI);
}
}
addressing_.transfer(newAddressing);
updateSet();
}
void pointZoneSet::deleteSet(const topoSet& set)
{
DynamicList<label> newAddressing(addressing_.size());
const pointZoneSet& fSet = refCast<const pointZoneSet>(set);
forAll(addressing_, i)
{
label pointI = addressing_[i];
if (!fSet.found(pointI))
{
// Not found in fSet so add
newAddressing.append(pointI);
}
}
addressing_.transfer(newAddressing);
updateSet();
}
void pointZoneSet::sync(const polyMesh& mesh)
{}
label pointZoneSet::maxSize(const polyMesh& mesh) const
{
return mesh.nPoints();
}
//- Write using given format, version and compression
bool pointZoneSet::writeObject
(
IOstream::streamFormat s,
IOstream::versionNumber v,
IOstream::compressionType c
) const
{
// Write shadow pointSet
word oldTypeName = typeName;
const_cast<word&>(type()) = pointSet::typeName;
bool ok = pointSet::writeObject(s, v, c);
const_cast<word&>(type()) = oldTypeName;
// Modify pointZone
pointZoneMesh& pointZones = const_cast<polyMesh&>(mesh_).pointZones();
label zoneID = pointZones.findZoneID(name());
if (zoneID == -1)
{
zoneID = pointZones.size();
pointZones.setSize(zoneID+1);
pointZones.set
(
zoneID,
new pointZone
(
name(),
addressing_,
zoneID,
pointZones
)
);
}
else
{
pointZones[zoneID] = addressing_;
}
pointZones.clearAddressing();
return ok && pointZones.write();
}
void pointZoneSet::updateMesh(const mapPolyMesh& morphMap)
{
// pointZone
labelList newAddressing(addressing_.size());
label n = 0;
forAll(addressing_, i)
{
label pointI = addressing_[i];
label newPointI = morphMap.reversePointMap()[pointI];
if (newPointI >= 0)
{
newAddressing[n] = newPointI;
n++;
}
}
newAddressing.setSize(n);
addressing_.transfer(newAddressing);
updateSet();
}
void pointZoneSet::writeDebug
(
Ostream& os,
const primitiveMesh& mesh,
const label maxLen
) const
{
pointSet::writeDebug(os, mesh, maxLen);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,173 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::pointZoneSet
Description
Like pointSet but updates pointZone when writing.
SourceFiles
pointZone.C
\*---------------------------------------------------------------------------*/
#ifndef pointZoneSet_H
#define pointZoneSet_H
#include "pointSet.H"
#include "boolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pointZoneSet Declaration
\*---------------------------------------------------------------------------*/
class pointZoneSet
:
public pointSet
{
// Private data
const polyMesh& mesh_;
labelList addressing_;
// Private Member Functions
public:
//- Runtime type information
TypeName("pointZoneSet");
// Constructors
//- Construct from objectRegistry and name
pointZoneSet
(
const polyMesh& mesh,
const word& name,
readOption r=MUST_READ,
writeOption w=NO_WRITE
);
//- Construct from additional size of labelHashSet
pointZoneSet
(
const polyMesh& mesh,
const word& name,
const label,
writeOption w=NO_WRITE
);
//- Construct from existing set
pointZoneSet
(
const polyMesh& mesh,
const word& name,
const topoSet&,
writeOption w=NO_WRITE
);
// Destructor
virtual ~pointZoneSet();
// Member functions
const labelList& addressing() const
{
return addressing_;
}
labelList& addressing()
{
return addressing_;
}
//- Sort addressing and make pointSet part consistent with addressing
void updateSet();
//- Invert contents. (insert all members 0..maxLen-1 which were not in
// set)
virtual void invert(const label maxLen);
//- Subset contents. Only elements present in both sets remain.
virtual void subset(const topoSet& set);
//- Add elements present in set.
virtual void addSet(const topoSet& set);
//- Delete elements present in set.
virtual void deleteSet(const topoSet& set);
//- Sync pointZoneSet across coupled patches.
virtual void sync(const polyMesh& mesh);
//- Write maxLen items with label and coordinates.
virtual void writeDebug
(
Ostream& os,
const primitiveMesh&,
const label maxLen
) const;
//- Write pointZone
virtual bool writeObject
(
IOstream::streamFormat,
IOstream::versionNumber,
IOstream::compressionType
) const;
//- Update any stored data for new labels
virtual void updateMesh(const mapPolyMesh& morphMap);
//- Return max index+1.
virtual label maxSize(const polyMesh& mesh) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -39,6 +39,7 @@ namespace Foam
defineTypeNameAndDebug(topoSet, 0); defineTypeNameAndDebug(topoSet, 0);
defineRunTimeSelectionTable(topoSet, word); defineRunTimeSelectionTable(topoSet, word);
defineRunTimeSelectionTable(topoSet, size); defineRunTimeSelectionTable(topoSet, size);
defineRunTimeSelectionTable(topoSet, set);
// Construct named object from existing set. // Construct named object from existing set.
@ -103,6 +104,37 @@ autoPtr<topoSet> topoSet::New
} }
// Construct named object from existing set.
autoPtr<topoSet> topoSet::New
(
const word& setType,
const polyMesh& mesh,
const word& name,
const topoSet& set,
writeOption w
)
{
setConstructorTable::iterator cstrIter =
setConstructorTablePtr_
->find(setType);
if (cstrIter == setConstructorTablePtr_->end())
{
FatalErrorIn
(
"topoSet::New(const word&, "
"const polyMesh&, const word&, const topoSet&, writeOption)"
) << "Unknown set type " << setType
<< endl << endl
<< "Valid set types : " << endl
<< setConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<topoSet>(cstrIter()(mesh, name, set, w));
}
Foam::fileName topoSet::topoSet::localPath Foam::fileName topoSet::topoSet::localPath
( (
const polyMesh& mesh, const polyMesh& mesh,
@ -255,9 +287,9 @@ void topoSet::writeDebug
) const ) const
{ {
// Bounding box of contents. // Bounding box of contents.
boundBox bb(pointField(coords, toc())); boundBox bb(pointField(coords, toc()), true);
Pout<< "Set bounding box: min = " os << "Set bounding box: min = "
<< bb.min() << " max = " << bb.max() << " meters. " << endl << endl; << bb.min() << " max = " << bb.max() << " meters. " << endl << endl;
label n = 0; label n = 0;
@ -538,18 +570,18 @@ void topoSet::writeDebug(Ostream& os, const label maxLen) const
} }
void topoSet::writeDebug //void topoSet::writeDebug
( //(
Ostream&, // Ostream&,
const primitiveMesh&, // const primitiveMesh&,
const label // const label
) const //) const
{ //{
notImplemented // notImplemented
( // (
"topoSet::writeDebug(Ostream&, const primitiveMesh&, const label)" // "topoSet::writeDebug(Ostream&, const primitiveMesh&, const label)"
); // );
} //}
bool topoSet::writeData(Ostream& os) const bool topoSet::writeData(Ostream& os) const
@ -564,13 +596,13 @@ void topoSet::updateMesh(const mapPolyMesh&)
} }
//- Return max index+1. ////- Return max index+1.
label topoSet::maxSize(const polyMesh&) const //label topoSet::maxSize(const polyMesh&) const
{ //{
notImplemented("topoSet::maxSize(const polyMesh&)"); // notImplemented("topoSet::maxSize(const polyMesh&)");
//
return -1; // return -1;
} //}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //

View File

@ -55,7 +55,6 @@ namespace Foam
class mapPolyMesh; class mapPolyMesh;
class polyMesh; class polyMesh;
class primitiveMesh; class primitiveMesh;
//class directPolyTopoChange;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class topoSet Declaration Class topoSet Declaration
@ -154,6 +153,21 @@ public:
(mesh, name, size, w) (mesh, name, size, w)
); );
// For the constructor as copy
declareRunTimeSelectionTable
(
autoPtr,
topoSet,
set,
(
const polyMesh& mesh,
const word& name,
const topoSet& set,
writeOption w
),
(mesh, name, set, w)
);
// Constructors // Constructors
@ -208,7 +222,7 @@ public:
// Selectors // Selectors
//- Return a reference to the selected source //- Return a pointer to a toposet read from file
static autoPtr<topoSet> New static autoPtr<topoSet> New
( (
const word& setType, const word& setType,
@ -218,7 +232,7 @@ public:
writeOption w=NO_WRITE writeOption w=NO_WRITE
); );
//- Return a reference to the selected source //- Return a pointer to a new toposet of given size
static autoPtr<topoSet> New static autoPtr<topoSet> New
( (
const word& setType, const word& setType,
@ -228,6 +242,16 @@ public:
writeOption w=NO_WRITE writeOption w=NO_WRITE
); );
//- Return a pointer to a new toposet as copy of another toposet
static autoPtr<topoSet> New
(
const word& setType,
const polyMesh& mesh,
const word& name,
const topoSet& set,
writeOption w=NO_WRITE
);
// Destructor // Destructor
@ -256,13 +280,13 @@ public:
virtual void writeDebug(Ostream& os, const label maxLen) const; virtual void writeDebug(Ostream& os, const label maxLen) const;
//- Like above but also writes mesh related quantity //- Like above but also writes mesh related quantity
// (usually coordinate). Not implemented. // (usually coordinate).
virtual void writeDebug virtual void writeDebug
( (
Ostream& os, Ostream& os,
const primitiveMesh&, const primitiveMesh&,
const label maxLen const label maxLen
) const; ) const = 0;
//- Write contents. //- Write contents.
virtual bool writeData(Ostream&) const; virtual bool writeData(Ostream&) const;
@ -271,7 +295,7 @@ public:
virtual void updateMesh(const mapPolyMesh& morphMap); virtual void updateMesh(const mapPolyMesh& morphMap);
//- Return max allowable index (+1). Not implemented. //- Return max allowable index (+1). Not implemented.
virtual label maxSize(const polyMesh& mesh) const; virtual label maxSize(const polyMesh& mesh) const = 0;

View File

@ -99,7 +99,7 @@ void Foam::radiation::absorptionCoeffs::initialise(const dictionary& dict)
{ {
dict.lookup("Tcommon") >> Tcommon_; dict.lookup("Tcommon") >> Tcommon_;
dict.lookup("Tlow") >> Tlow_; dict.lookup("Tlow") >> Tlow_;
dict.lookup("Tlow") >> Thigh_; dict.lookup("Thigh") >> Thigh_;
dict.lookup("invTemp") >> invTemp_; dict.lookup("invTemp") >> invTemp_;
dict.lookup("loTcoeffs") >> lowACoeffs_; dict.lookup("loTcoeffs") >> lowACoeffs_;

View File

@ -26,7 +26,6 @@ License
#include "fvDOM.H" #include "fvDOM.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "fvm.H"
#include "absorptionEmissionModel.H" #include "absorptionEmissionModel.H"
#include "scatterModel.H" #include "scatterModel.H"
@ -65,7 +64,7 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T)
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::AUTO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("G", dimMass/pow3(dimTime), 0.0) dimensionedScalar("G", dimMass/pow3(dimTime), 0.0)
@ -347,7 +346,7 @@ Foam::radiation::fvDOM::Ru() const
const DimensionedField<scalar, volMesh> a = const DimensionedField<scalar, volMesh> a =
a_.dimensionedInternalField(); //absorptionEmission_->aCont()() a_.dimensionedInternalField(); //absorptionEmission_->aCont()()
return a*G - 4.0*E; return a*G - E;
} }

View File

@ -27,12 +27,9 @@ License
#include "radiativeIntensityRay.H" #include "radiativeIntensityRay.H"
#include "fvm.H" #include "fvm.H"
#include "fvDOM.H" #include "fvDOM.H"
#include "constants.H"
#include "absorptionEmissionModel.H" using namespace Foam::constant;
#include "scatterModel.H"
#include "mathConstants.H"
#include "radiationModel.H"
#include "Vector2D.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -202,9 +199,9 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct()
fvm::div(Ji, ILambda_[lambdaI], "div(Ji,Ii_h)") fvm::div(Ji, ILambda_[lambdaI], "div(Ji,Ii_h)")
+ fvm::Sp(k*omega_, ILambda_[lambdaI]) + fvm::Sp(k*omega_, ILambda_[lambdaI])
== ==
1.0/constant::math::pi 1.0/constant::math::pi*omega_
*( *(
k*omega_*blackBody_.bLambda(lambdaI) k*blackBody_.bLambda(lambdaI)
+ absorptionEmission_.ECont(lambdaI) + absorptionEmission_.ECont(lambdaI)
) )
); );

View File

@ -43,19 +43,19 @@ autoPtr<radiationModel> radiationModel::New
{ {
word radiationModelTypeName; word radiationModelTypeName;
// Enclose the creation of the radiationPropertiesDict to ensure it is // Note: no need to register/keep radiationProperties since models read
// deleted before the radiationModel is created otherwise the dictionary // it themselves.
// is entered in the database twice
{ {
IOdictionary radiationPropertiesDict IOdictionary radiationPropertiesDict
( (
IOobject IOobject
( (
"radiationProperties", "radiationProperties",
T.mesh().time().constant(), T.time().constant(),
T.mesh().objectRegistry::db(), T.mesh(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE,
false
) )
); );

View File

@ -259,10 +259,11 @@ Foam::radiation::greyMeanAbsorptionEmission::ECont(const label bandI) const
) )
); );
if (mesh_.foundObject<volScalarField>("hrr")) if (mesh_.foundObject<volScalarField>("dQ"))
{ {
const volScalarField& hrr = mesh_.lookupObject<volScalarField>("hrr"); const volScalarField& dQ =
E().internalField() = EhrrCoeff_*hrr.internalField(); mesh_.lookupObject<volScalarField>("dQ");
E().internalField() = EhrrCoeff_*dQ;
} }
return E; return E;

View File

@ -215,6 +215,8 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField
tmp<scalarField> tmp<scalarField>
turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const
{ {
const fvMesh& mesh = patch().boundaryMesh().mesh();
if (KName_ == "none") if (KName_ == "none")
{ {
const compressible::RASModel& model = const compressible::RASModel& model =
@ -227,12 +229,33 @@ turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const
return return
talpha().boundaryField()[patch().index()] talpha().boundaryField()[patch().index()]
*thermo.rho()().boundaryField()[patch().index()]
*thermo.Cp()().boundaryField()[patch().index()]; *thermo.Cp()().boundaryField()[patch().index()];
} }
else if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
{
return patch().lookupPatchField<volScalarField, scalar>(KName_);
}
else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_))
{
const symmTensorField& KWall =
patch().lookupPatchField<volSymmTensorField, scalar>(KName_);
vectorField n = patch().nf();
return n & KWall & n;
}
else else
{ {
return patch().lookupPatchField<volScalarField, scalar>(KName_); FatalErrorIn
(
"turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const"
) << "Did not find field " << KName_
<< " on mesh " << mesh.name() << " patch " << patch().name()
<< endl
<< "Please set 'K' to 'none', a valid volScalarField"
<< " or a valid volSymmTensorField." << exit(FatalError);
return scalarField(0);
} }
} }

View File

@ -77,7 +77,7 @@ tmp<scalarField> mutkRoughWallFunctionFvPatchScalarField::calcMut() const
const scalar Cmu25 = pow025(Cmu_); const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tmutw(new scalarField(patch().size(), 0.0)); tmp<scalarField> tmutw(new scalarField(*this));
scalarField& mutw = tmutw(); scalarField& mutw = tmutw();
forAll(mutw, faceI) forAll(mutw, faceI)

View File

@ -76,7 +76,7 @@ tmp<scalarField> nutkRoughWallFunctionFvPatchScalarField::calcNut() const
const scalar Cmu25 = pow025(Cmu_); const scalar Cmu25 = pow025(Cmu_);
tmp<scalarField> tnutw(new scalarField(patch().size(), 0.0)); tmp<scalarField> tnutw(new scalarField(*this));
scalarField& nutw = tnutw(); scalarField& nutw = tnutw();
forAll(nutw, faceI) forAll(nutw, faceI)

View File

@ -86,7 +86,7 @@ dictionaryReplacement
} }
bottomAir_to_leftSolid bottomAir_to_leftSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
@ -94,14 +94,14 @@ dictionaryReplacement
} }
bottomAir_to_heater bottomAir_to_heater
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
bottomAir_to_rightSolid bottomAir_to_rightSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;

View File

@ -71,7 +71,7 @@ dictionaryReplacement
heater_to_bottomAir heater_to_bottomAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
@ -79,21 +79,21 @@ dictionaryReplacement
} }
heater_to_leftSolid heater_to_leftSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
heater_to_rightSolid heater_to_rightSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
heater_to_topAir heater_to_topAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;

View File

@ -61,7 +61,7 @@ dictionaryReplacement
} }
leftSolid_to_bottomAir leftSolid_to_bottomAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
@ -69,14 +69,14 @@ dictionaryReplacement
} }
leftSolid_to_heater leftSolid_to_heater
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
leftSolid_to_topAir leftSolid_to_topAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;

View File

@ -61,21 +61,21 @@ dictionaryReplacement
} }
rightSolid_to_heater rightSolid_to_heater
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
rightSolid_to_bottomAir rightSolid_to_bottomAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
rightSolid_to_topAir rightSolid_to_topAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;

View File

@ -87,7 +87,7 @@ dictionaryReplacement
} }
topAir_to_leftSolid topAir_to_leftSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
@ -95,14 +95,14 @@ dictionaryReplacement
} }
topAir_to_heater topAir_to_heater
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
topAir_to_rightSolid topAir_to_rightSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;

View File

@ -120,21 +120,21 @@ dictionaryReplacement
} }
bottomAir_to_leftSolid bottomAir_to_leftSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
bottomAir_to_heater bottomAir_to_heater
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
bottomAir_to_rightSolid bottomAir_to_rightSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;

View File

@ -71,7 +71,7 @@ dictionaryReplacement
heater_to_bottomAir heater_to_bottomAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
@ -79,21 +79,21 @@ dictionaryReplacement
} }
heater_to_leftSolid heater_to_leftSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
heater_to_rightSolid heater_to_rightSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
heater_to_topAir heater_to_topAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;

View File

@ -61,7 +61,7 @@ dictionaryReplacement
} }
leftSolid_to_bottomAir leftSolid_to_bottomAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
@ -69,14 +69,14 @@ dictionaryReplacement
} }
leftSolid_to_heater leftSolid_to_heater
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
leftSolid_to_topAir leftSolid_to_topAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;

View File

@ -61,21 +61,21 @@ dictionaryReplacement
} }
rightSolid_to_heater rightSolid_to_heater
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
rightSolid_to_bottomAir rightSolid_to_bottomAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
rightSolid_to_topAir rightSolid_to_topAir
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;

View File

@ -126,7 +126,7 @@ dictionaryReplacement
} }
topAir_to_leftSolid topAir_to_leftSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
@ -134,14 +134,14 @@ dictionaryReplacement
} }
topAir_to_heater topAir_to_heater
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;
} }
topAir_to_rightSolid topAir_to_rightSolid
{ {
type turbulentTemperatureCoupledBaffle; type compressible::turbulentTemperatureCoupledBaffle;
neighbourFieldName T; neighbourFieldName T;
K K; K K;
value uniform 300; value uniform 300;

View File

@ -1,60 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object motionU;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
movingWall
{
type fixedValue;
value uniform 1;
}
farFieldMoving
{
type slip;
}
fixedWall
{
type fixedValue;
value uniform 0;
}
axis
{
type symmetryPlane;
}
left
{
type fixedValue;
value uniform 0;
}
farField
{
type slip;
}
back
{
type wedge;
}
front
{
type wedge;
}
}
// ************************************************************************* //

View File

@ -27,7 +27,33 @@ boundaryField
} }
farFieldMoving farFieldMoving
{ {
type slip; //type slip;
type surfaceSlipDisplacement;
geometry
{
top
{
type searchablePlane;
planeType pointAndNormal;
basePoint (0 0.0025 0);
normalVector (0 1 0);
}
};
// Find projection with surface:
// fixedNormal : intersections along prespecified direction
// pointNormal : intersections along current pointNormal of patch
// nearest : nearest point on surface
followMode fixedNormal;
// if fixedNormal : normal
projectDirection (0 1 0);
//- -1 or component to knock out before doing projection
//wedgePlane -1;
//- Points that should remain fixed
//frozenPointsZone fixedPointsZone;
} }
fixedWall fixedWall
{ {
@ -45,7 +71,28 @@ boundaryField
} }
farField farField
{ {
type slip; //type slip;
type surfaceSlipDisplacement;
geometry
{
top
{
type searchablePlane;
planeType pointAndNormal;
basePoint (0 0.0025 0);
normalVector (0 1 0);
}
};
followMode fixedNormal;
projectDirection (0 1 0);
//- -1 or component to knock out before doing projection
wedgePlane -1;
//- Points that should remain fixed
//frozenPointsZone fixedPointsZone;
} }
back back
{ {

View File

@ -17,6 +17,9 @@ FoamFile
application pimpleDyMFoam; application pimpleDyMFoam;
// For surfaceSlip boundary conditions
libs ("libfvMotionSolvers.so");
startFrom startTime; startFrom startTime;
startTime 0; startTime 0;

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