replacing isType with isA to enable directMappedWall to work

This commit is contained in:
mattijs
2009-09-15 17:51:59 +01:00
parent 2cee56ee01
commit 791b5aaeaa
87 changed files with 990 additions and 231 deletions

View File

@ -38,7 +38,7 @@
for (label i=0; i<Ua.boundaryField().size(); i++) for (label i=0; i<Ua.boundaryField().size(); i++)
{ {
if (isType<fixedValueFvPatchVectorField>(Ua.boundaryField()[i])) if (isA<fixedValueFvPatchVectorField>(Ua.boundaryField()[i]))
{ {
phiTypes[i] = fixedValueFvPatchScalarField::typeName; phiTypes[i] = fixedValueFvPatchScalarField::typeName;
} }

View File

@ -38,7 +38,7 @@
for (label i=0; i<Ub.boundaryField().size(); i++) for (label i=0; i<Ub.boundaryField().size(); i++)
{ {
if (isType<fixedValueFvPatchVectorField>(Ub.boundaryField()[i])) if (isA<fixedValueFvPatchVectorField>(Ub.boundaryField()[i]))
{ {
phiTypes[i] = fixedValueFvPatchScalarField::typeName; phiTypes[i] = fixedValueFvPatchScalarField::typeName;
} }

View File

@ -37,7 +37,7 @@ Description
{ {
const fvPatch& p = patches[patchi]; const fvPatch& p = patches[patchi];
if (isType<wallFvPatch>(p)) if (isA<wallFvPatch>(p))
{ {
epsEqn.setValues epsEqn.setValues
( (

View File

@ -12,7 +12,7 @@
{ {
const fvPatch& currPatch = patches[patchi]; const fvPatch& currPatch = patches[patchi];
if (isType<wallFvPatch>(currPatch)) if (isA<wallFvPatch>(currPatch))
{ {
forAll(currPatch, facei) forAll(currPatch, facei)
{ {
@ -30,7 +30,7 @@
{ {
const fvPatch& currPatch = patches[patchi]; const fvPatch& currPatch = patches[patchi];
if (isType<wallFvPatch>(currPatch)) if (isA<wallFvPatch>(currPatch))
{ {
const scalarField& nuw = nutb.boundaryField()[patchi]; const scalarField& nuw = nutb.boundaryField()[patchi];
@ -74,7 +74,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {

View File

@ -10,7 +10,7 @@
{ {
const fvPatch& currPatch = patches[patchi]; const fvPatch& currPatch = patches[patchi];
if (isType<wallFvPatch>(currPatch)) if (isA<wallFvPatch>(currPatch))
{ {
scalarField& nutw = nutb.boundaryField()[patchi]; scalarField& nutw = nutb.boundaryField()[patchi];

View File

@ -352,7 +352,7 @@ void Foam::multiphaseMixture::correctContactAngle
forAll(boundary, patchi) forAll(boundary, patchi)
{ {
if (typeid(gbf[patchi]) == typeid(alphaContactAngleFvPatchScalarField)) if (isA<alphaContactAngleFvPatchScalarField>(gbf[patchi]))
{ {
const alphaContactAngleFvPatchScalarField& acap = const alphaContactAngleFvPatchScalarField& acap =
refCast<const alphaContactAngleFvPatchScalarField>(gbf[patchi]); refCast<const alphaContactAngleFvPatchScalarField>(gbf[patchi]);

View File

@ -37,7 +37,7 @@ Description
{ {
const fvPatch& p = patches[patchi]; const fvPatch& p = patches[patchi];
if (isType<wallFvPatch>(p)) if (isA<wallFvPatch>(p))
{ {
epsEqn.setValues epsEqn.setValues
( (

View File

@ -12,7 +12,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
@ -30,7 +30,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
const scalarField& rhow = rho.boundaryField()[patchi]; const scalarField& rhow = rho.boundaryField()[patchi];
@ -76,7 +76,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {

View File

@ -9,7 +9,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
const scalarField& rhow = rho.boundaryField()[patchi]; const scalarField& rhow = rho.boundaryField()[patchi];

View File

@ -109,7 +109,7 @@ Foam::phaseModel::phaseModel
for (label i=0; i<U_.boundaryField().size(); i++) for (label i=0; i<U_.boundaryField().size(); i++)
{ {
if (isType<fixedValueFvPatchVectorField>(U_.boundaryField()[i])) if (isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i]))
{ {
phiTypes[i] = fixedValueFvPatchScalarField::typeName; phiTypes[i] = fixedValueFvPatchScalarField::typeName;
} }

View File

@ -77,7 +77,7 @@ int main(int argc, char *argv[])
{ {
const fvPatch& patch = mesh.boundary()[patchI]; const fvPatch& patch = mesh.boundary()[patchI];
if (typeid(patch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(patch))
{ {
nWalls += patch.size(); nWalls += patch.size();
} }
@ -91,7 +91,7 @@ int main(int argc, char *argv[])
{ {
const fvPatch& patch = mesh.boundary()[patchI]; const fvPatch& patch = mesh.boundary()[patchI];
if (typeid(patch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(patch))
{ {
forAll (patch.Cf(), patchFaceI) forAll (patch.Cf(), patchFaceI)
{ {

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
{ {
const fvPatch& patch = mesh.boundary()[patchI]; const fvPatch& patch = mesh.boundary()[patchI];
if (typeid(patch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(patch))
{ {
fvPatchVectorField& wallData = n.boundaryField()[patchI]; fvPatchVectorField& wallData = n.boundaryField()[patchI];

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
{ {
const fvPatch& patch = mesh.boundary()[patchI]; const fvPatch& patch = mesh.boundary()[patchI];
if (typeid(patch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(patch))
{ {
fvPatchScalarField& wallData = yStar.boundaryField()[patchI]; fvPatchScalarField& wallData = yStar.boundaryField()[patchI];

View File

@ -55,7 +55,7 @@ labelList procNeighbours(const polyMesh& mesh)
forAll (mesh.boundaryMesh(), patchI) forAll (mesh.boundaryMesh(), patchI)
{ {
if (typeid(mesh.boundaryMesh()[patchI]) == typeid(processorPolyPatch)) if (isA<processorPolyPatch>(mesh.boundaryMesh()[patchI]))
{ {
nNeighbours++; nNeighbours++;
} }
@ -67,7 +67,7 @@ labelList procNeighbours(const polyMesh& mesh)
forAll (mesh.boundaryMesh(), patchI) forAll (mesh.boundaryMesh(), patchI)
{ {
if (typeid(mesh.boundaryMesh()[patchI]) == typeid(processorPolyPatch)) if (isA<processorPolyPatch>(mesh.boundaryMesh()[patchI]))
{ {
const polyPatch& patch = mesh.boundaryMesh()[patchI]; const polyPatch& patch = mesh.boundaryMesh()[patchI];

View File

@ -174,17 +174,11 @@ void Foam::fluentFvMesh::writeFluentMesh() const
nWrittenFaces += patchFaces.size(); nWrittenFaces += patchFaces.size();
// Write patch type // Write patch type
if if (isA<wallFvPatch>(boundary()[patchI]))
(
typeid(boundary()[patchI]) == typeid(wallFvPatch)
)
{ {
fluentMeshFile << 3; fluentMeshFile << 3;
} }
else if else if (isA<symmetryFvPatch>(boundary()[patchI]))
(
typeid(boundary()[patchI]) == typeid(symmetryFvPatch)
)
{ {
fluentMeshFile << 7; fluentMeshFile << 7;
} }
@ -282,17 +276,11 @@ void Foam::fluentFvMesh::writeFluentMesh() const
<< "(39 (" << patchI + 10 << " "; << "(39 (" << patchI + 10 << " ";
// Write patch type // Write patch type
if if (isA<wallFvPatch>(boundary()[patchI]))
(
typeid(boundary()[patchI]) == typeid(wallFvPatch)
)
{ {
fluentMeshFile << "wall "; fluentMeshFile << "wall ";
} }
else if else if (isA<symmetryFvPatch>(boundary()[patchI]))
(
typeid(boundary()[patchI]) == typeid(symmetryFvPatch)
)
{ {
fluentMeshFile << "symmetry "; fluentMeshFile << "symmetry ";
} }

View File

@ -268,10 +268,7 @@ label twoDNess(const polyMesh& mesh)
{ {
const polyPatch& patch = patches[patchI]; const polyPatch& patch = patches[patchI];
if if (!isA<wedgePolyPatch>(patch))
(
typeid(patch) != typeid(wedgePolyPatch)
)
{ {
const vectorField& n = patch.faceAreas(); const vectorField& n = patch.faceAreas();

View File

@ -121,7 +121,7 @@ void writeVTK
const fileName& vtkName const fileName& vtkName
) )
{ {
if (typeid(currentSet) == typeid(faceSet)) if (isA<faceSet>(currentSet))
{ {
// Faces of set with OpenFOAM faceID as value // Faces of set with OpenFOAM faceID as value
@ -148,7 +148,7 @@ void writeVTK
mesh.time().path()/vtkName mesh.time().path()/vtkName
); );
} }
else if (typeid(currentSet) == typeid(cellSet)) else if (isA<cellSet>(currentSet))
{ {
// External faces of cellset with OpenFOAM cellID as value // External faces of cellset with OpenFOAM cellID as value
@ -208,7 +208,7 @@ void writeVTK
mesh.time().path()/vtkName mesh.time().path()/vtkName
); );
} }
else if (typeid(currentSet) == typeid(pointSet)) else if (isA<pointSet>(currentSet))
{ {
writePointSet writePointSet
( (

View File

@ -160,12 +160,8 @@ void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew)
// Adds patch if not yet there. Returns patchID. // Adds patch if not yet there. Returns patchID.
label addPatch template<class PatchType>
( label addPatch(fvMesh& mesh, const word& patchName)
fvMesh& mesh,
const word& patchName,
const word& patchType
)
{ {
polyBoundaryMesh& polyPatches = polyBoundaryMesh& polyPatches =
const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); const_cast<polyBoundaryMesh&>(mesh.boundaryMesh());
@ -173,11 +169,18 @@ label addPatch
label patchI = polyPatches.findPatchID(patchName); label patchI = polyPatches.findPatchID(patchName);
if (patchI != -1) if (patchI != -1)
{ {
if (polyPatches[patchI].type() == patchType) if (isA<PatchType>(polyPatches[patchI]))
{ {
// Already there // Already there
return patchI; return patchI;
} }
else
{
FatalErrorIn("addPatch<PatchType>(fvMesh&, const word&)")
<< "Already have patch " << patchName
<< " but of type " << PatchType::typeName
<< exit(FatalError);
}
} }
@ -214,7 +217,7 @@ label addPatch
sz, sz,
polyPatch::New polyPatch::New
( (
patchType, PatchType::typeName,
patchName, patchName,
0, // size 0, // size
startFaceI, startFaceI,
@ -1021,17 +1024,15 @@ EdgeMap<label> addRegionPatches
if (interfaceSizes[e] > 0) if (interfaceSizes[e] > 0)
{ {
label patchI = addPatch label patchI = addPatch<directMappedWallPolyPatch>
( (
mesh, mesh,
regionNames[e[0]] + "_to_" + regionNames[e[1]], regionNames[e[0]] + "_to_" + regionNames[e[1]]
directMappedWallPolyPatch::typeName
); );
addPatch addPatch<directMappedWallPolyPatch>
( (
mesh, mesh,
regionNames[e[1]] + "_to_" + regionNames[e[0]], regionNames[e[1]] + "_to_" + regionNames[e[0]]
directMappedWallPolyPatch::typeName
); );
Info<< "For interface between region " << e[0] Info<< "For interface between region " << e[0]
@ -1405,7 +1406,7 @@ int main(int argc, char *argv[])
IOobject IOobject
( (
"cellToRegion", "cellToRegion",
mesh.facesInstance(), runTime.timeName(),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,

View File

@ -243,7 +243,7 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
const label patchStart = patches[patchi].start(); const label patchStart = patches[patchi].start();
if (typeid(patches[patchi]) != typeid(cyclicPolyPatch)) if (!isA<cyclicPolyPatch>(patches[patchi]))
{ {
// Normal patch. Add faces to processor where the cell // Normal patch. Add faces to processor where the cell
// next to the face lives // next to the face lives

View File

@ -191,7 +191,7 @@ Foam::fvFieldReconstructor::reconstructFvVolumeField
// add empty patches // add empty patches
if if
( (
typeid(mesh_.boundary()[patchI]) == typeid(emptyFvPatch) isType<emptyFvPatch>(mesh_.boundary()[patchI])
&& !patchFields(patchI) && !patchFields(patchI)
) )
{ {
@ -411,7 +411,7 @@ Foam::fvFieldReconstructor::reconstructFvSurfaceField
// add empty patches // add empty patches
if if
( (
typeid(mesh_.boundary()[patchI]) == typeid(emptyFvPatch) isType<emptyFvPatch>(mesh_.boundary()[patchI])
&& !patchFields(patchI) && !patchFields(patchI)
) )
{ {

View File

@ -127,8 +127,8 @@ Foam::fieldviewTopology::fieldviewTopology
const polyPatch& currPatch = mesh.boundaryMesh()[patchI]; const polyPatch& currPatch = mesh.boundaryMesh()[patchI];
if if
( (
isType<wallPolyPatch>(currPatch) isA<wallPolyPatch>(currPatch)
|| isType<symmetryPolyPatch>(currPatch) || isA<symmetryPolyPatch>(currPatch)
) )
{ {
forAll(currPatch, patchFaceI) forAll(currPatch, patchFaceI)

View File

@ -205,8 +205,8 @@ labelList getSelectedPatches
if if
( (
isType<emptyPolyPatch>(pp) isA<emptyPolyPatch>(pp)
|| (Pstream::parRun() && isType<processorPolyPatch>(pp)) || (Pstream::parRun() && isA<processorPolyPatch>(pp))
) )
{ {
Info<< " discarding empty/processor patch " << patchI Info<< " discarding empty/processor patch " << patchI
@ -805,7 +805,7 @@ int main(int argc, char *argv[])
labelList(1, patchI) labelList(1, patchI)
); );
if (!isType<emptyPolyPatch>(pp)) if (!isA<emptyPolyPatch>(pp))
{ {
// VolFields + patchID // VolFields + patchID
writeFuns::writeCellDataHeader writeFuns::writeCellDataHeader

View File

@ -152,7 +152,7 @@ void Foam::patchWriter::writePatchIDs()
const polyPatch& pp = mesh.boundaryMesh()[patchI]; const polyPatch& pp = mesh.boundaryMesh()[patchI];
if (!isType<emptyPolyPatch>(pp)) if (!isA<emptyPolyPatch>(pp))
{ {
writeFuns::insert(scalarField(pp.size(), patchI), fField); writeFuns::insert(scalarField(pp.size(), patchI), fField);
} }

View File

@ -609,7 +609,7 @@ void user_query_file_function
strcpy(face_type_names[patchI], patch.name().c_str()); strcpy(face_type_names[patchI], patch.name().c_str());
if (isType<wallPolyPatch>(patch)) if (isA<wallPolyPatch>(patch))
{ {
wall_flags[patchI] = 1; wall_flags[patchI] = 1;
} }

View File

@ -76,7 +76,7 @@ int main(int argc, char *argv[])
} }
// Give patch area // Give patch area
if (isType<cyclicPolyPatch>(mesh.boundaryMesh()[patchi])) if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchi]))
{ {
Info<< " Cyclic patch vector area: " << nl; Info<< " Cyclic patch vector area: " << nl;
label nFaces = mesh.boundaryMesh()[patchi].size(); label nFaces = mesh.boundaryMesh()[patchi].size();

View File

@ -64,7 +64,7 @@ int main(int argc, char *argv[])
Info<< "\nWall heat fluxes [W]" << endl; Info<< "\nWall heat fluxes [W]" << endl;
forAll(patchHeatFlux, patchi) forAll(patchHeatFlux, patchi)
{ {
if (typeid(mesh.boundary()[patchi]) == typeid(wallFvPatch)) if (isA<wallFvPatch>(mesh.boundary()[patchi]))
{ {
Info<< mesh.boundary()[patchi].name() Info<< mesh.boundary()[patchi].name()
<< " " << " "

View File

@ -109,7 +109,7 @@ int main(int argc, char *argv[])
{ {
const fvPatch& currPatch = patches[patchi]; const fvPatch& currPatch = patches[patchi];
if (typeid(currPatch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(currPatch))
{ {
yPlus.boundaryField()[patchi] = yPlus.boundaryField()[patchi] =
d[patchi] d[patchi]

View File

@ -202,7 +202,7 @@ void replaceBoundaryType
dictionary& boundaryDict = dict.subDict("boundaryField"); dictionary& boundaryDict = dict.subDict("boundaryField");
forAll(bMesh, patchI) forAll(bMesh, patchI)
{ {
if (isType<wallPolyPatch>(bMesh[patchI])) if (isA<wallPolyPatch>(bMesh[patchI]))
{ {
word patchName = bMesh[patchI].name(); word patchName = bMesh[patchI].name();
dictionary& oldPatch = boundaryDict.subDict(patchName); dictionary& oldPatch = boundaryDict.subDict(patchName);

View File

@ -164,7 +164,7 @@ void mapConsistentSubMesh
forAll(meshTarget.boundary(), patchi) forAll(meshTarget.boundary(), patchi)
{ {
if (typeid(meshTarget.boundary()[patchi]) != typeid(processorFvPatch)) if (!isA<processorFvPatch>(meshTarget.boundary()[patchi]))
{ {
patchMap.insert patchMap.insert
( (
@ -201,7 +201,7 @@ wordList addProcessorPatches
forAll (meshTarget.boundary(), patchi) forAll (meshTarget.boundary(), patchi)
{ {
if (typeid(meshTarget.boundary()[patchi]) == typeid(processorFvPatch)) if (isA<processorFvPatch>(meshTarget.boundary()[patchi]))
{ {
if if
( (

View File

@ -108,11 +108,7 @@ int main(int argc, char *argv[])
{ {
const polyPatch& patch = bMesh[patchI]; const polyPatch& patch = bMesh[patchI];
if if (includeProcPatches || !isA<processorPolyPatch>(patch))
(
includeProcPatches
|| (patch.type() != processorPolyPatch::typeName)
)
{ {
includePatches.insert(patchI); includePatches.insert(patchI);
} }

View File

@ -282,13 +282,13 @@ void Foam::FaceCellWave<Type>::checkCyclic(const polyPatch& patch) const
} }
// Check if patches of given type name are present // Check if has cyclic patches
template <class Type> template <class Type>
bool Foam::FaceCellWave<Type>::hasPatchType(const word& nameOfType) bool Foam::FaceCellWave<Type>::hasCyclicPatch() const
{ {
forAll(mesh_.boundaryMesh(), patchI) forAll(mesh_.boundaryMesh(), patchI)
{ {
if (mesh_.boundaryMesh()[patchI].type() == nameOfType) if (isA<cyclicPolyPatch>(mesh_.boundaryMesh()[patchI]))
{ {
return true; return true;
} }
@ -811,7 +811,7 @@ Foam::FaceCellWave<Type>::FaceCellWave
changedCell_(mesh_.nCells(), false), changedCell_(mesh_.nCells(), false),
changedCells_(mesh_.nCells()), changedCells_(mesh_.nCells()),
nChangedCells_(0), nChangedCells_(0),
hasCyclicPatches_(hasPatchType(cyclicPolyPatch::typeName)), hasCyclicPatches_(hasCyclicPatch()),
nEvals_(0), nEvals_(0),
nUnvisitedCells_(mesh_.nCells()), nUnvisitedCells_(mesh_.nCells()),
nUnvisitedFaces_(mesh_.nFaces()), nUnvisitedFaces_(mesh_.nFaces()),
@ -841,7 +841,7 @@ Foam::FaceCellWave<Type>::FaceCellWave
changedCell_(mesh_.nCells(), false), changedCell_(mesh_.nCells(), false),
changedCells_(mesh_.nCells()), changedCells_(mesh_.nCells()),
nChangedCells_(0), nChangedCells_(0),
hasCyclicPatches_(hasPatchType(cyclicPolyPatch::typeName)), hasCyclicPatches_(hasCyclicPatch()),
nEvals_(0), nEvals_(0),
nUnvisitedCells_(mesh_.nCells()), nUnvisitedCells_(mesh_.nCells()),
nUnvisitedFaces_(mesh_.nFaces()), nUnvisitedFaces_(mesh_.nFaces()),

View File

@ -184,8 +184,8 @@ class FaceCellWave
//- Debugging: check info on both sides of cyclic //- Debugging: check info on both sides of cyclic
void checkCyclic(const polyPatch& pPatch) const; void checkCyclic(const polyPatch& pPatch) const;
//- Has patches of certain type? //- Has cyclic patch?
bool hasPatchType(const word& nameOfType); bool hasCyclicPatch() const;
//- Merge received patch data into global data //- Merge received patch data into global data
void mergeFaceInfo void mergeFaceInfo

View File

@ -47,7 +47,7 @@ Foam::labelList Foam::ProcessorTopology<Patch, ProcPatch>::procNeighbours
{ {
const Patch& patch = patches[patchi]; const Patch& patch = patches[patchi];
if (isType<ProcPatch>(patch)) if (isA<ProcPatch>(patch))
{ {
const ProcPatch& procPatch = const ProcPatch& procPatch =
refCast<const ProcPatch>(patch); refCast<const ProcPatch>(patch);
@ -69,7 +69,7 @@ Foam::labelList Foam::ProcessorTopology<Patch, ProcPatch>::procNeighbours
{ {
const Patch& patch = patches[patchi]; const Patch& patch = patches[patchi];
if (isType<ProcPatch>(patch)) if (isA<ProcPatch>(patch))
{ {
const ProcPatch& procPatch = const ProcPatch& procPatch =
refCast<const ProcPatch>(patch); refCast<const ProcPatch>(patch);
@ -116,7 +116,7 @@ Foam::ProcessorTopology<Patch, ProcPatch>::ProcessorTopology
forAll(patches, patchi) forAll(patches, patchi)
{ {
if (!isType<ProcPatch>(patches[patchi])) if (!isA<ProcPatch>(patches[patchi]))
{ {
patchSchedule_[patchEvali].patch = patchi; patchSchedule_[patchEvali].patch = patchi;
patchSchedule_[patchEvali++].init = true; patchSchedule_[patchEvali++].init = true;
@ -204,7 +204,7 @@ Foam::ProcessorTopology<Patch, ProcPatch>::ProcessorTopology
forAll(patches, patchi) forAll(patches, patchi)
{ {
if (!isType<ProcPatch>(patches[patchi])) if (!isA<ProcPatch>(patches[patchi]))
{ {
patchSchedule_[patchEvali].patch = patchi; patchSchedule_[patchEvali].patch = patchi;
patchSchedule_[patchEvali++].init = true; patchSchedule_[patchEvali++].init = true;
@ -219,7 +219,7 @@ Foam::ProcessorTopology<Patch, ProcPatch>::ProcessorTopology
// 2a. initEvaluate // 2a. initEvaluate
forAll(patches, patchi) forAll(patches, patchi)
{ {
if (isType<ProcPatch>(patches[patchi])) if (isA<ProcPatch>(patches[patchi]))
{ {
patchSchedule_[patchEvali].patch = patchi; patchSchedule_[patchEvali].patch = patchi;
patchSchedule_[patchEvali++].init = true; patchSchedule_[patchEvali++].init = true;
@ -229,7 +229,7 @@ Foam::ProcessorTopology<Patch, ProcPatch>::ProcessorTopology
// 2b. evaluate // 2b. evaluate
forAll(patches, patchi) forAll(patches, patchi)
{ {
if (isType<ProcPatch>(patches[patchi])) if (isA<ProcPatch>(patches[patchi]))
{ {
patchSchedule_[patchEvali].patch = patchi; patchSchedule_[patchEvali].patch = patchi;
patchSchedule_[patchEvali++].init = false; patchSchedule_[patchEvali++].init = false;

View File

@ -158,11 +158,7 @@ void Foam::ensightParts::recalculate(const polyMesh& pMesh)
forAll(pMesh.boundaryMesh(), patchI) forAll(pMesh.boundaryMesh(), patchI)
{ {
const polyPatch& pPatch = pMesh.boundaryMesh()[patchI]; const polyPatch& pPatch = pMesh.boundaryMesh()[patchI];
if if (pPatch.size() && !isA<processorPolyPatch>(pPatch))
(
pPatch.size()
&& typeid(pPatch) != typeid(processorPolyPatch)
)
{ {
partsList_.set partsList_.set
( (

View File

@ -31,6 +31,7 @@ License
#include "fvMeshAdder.H" #include "fvMeshAdder.H"
#include "faceCoupleInfo.H" #include "faceCoupleInfo.H"
#include "processorFvPatchField.H" #include "processorFvPatchField.H"
#include "processorFvsPatchField.H"
#include "polyTopoChange.H" #include "polyTopoChange.H"
#include "removeCells.H" #include "removeCells.H"
#include "polyModifyFace.H" #include "polyModifyFace.H"
@ -2124,54 +2125,56 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
// Bit of hack: processorFvPatchField does not get reset since created // Bit of hack: processorFvPatchField does not get reset since created
// from nothing so explicitly reset. // from nothing so explicitly reset.
initPatchFields<volScalarField> initPatchFields<volScalarField, processorFvPatchField<scalar> >
( (
processorFvPatchField<scalar>::typeName,
pTraits<scalar>::zero pTraits<scalar>::zero
); );
initPatchFields<volVectorField> initPatchFields<volVectorField, processorFvPatchField<vector> >
( (
processorFvPatchField<vector>::typeName,
pTraits<vector>::zero pTraits<vector>::zero
); );
initPatchFields<volSphericalTensorField> initPatchFields
<
volSphericalTensorField,
processorFvPatchField<sphericalTensor>
>
( (
processorFvPatchField<sphericalTensor>::typeName,
pTraits<sphericalTensor>::zero pTraits<sphericalTensor>::zero
); );
initPatchFields<volSymmTensorField> initPatchFields<volSymmTensorField, processorFvPatchField<symmTensor> >
( (
processorFvPatchField<symmTensor>::typeName,
pTraits<symmTensor>::zero pTraits<symmTensor>::zero
); );
initPatchFields<volTensorField> initPatchFields<volTensorField, processorFvPatchField<tensor> >
( (
processorFvPatchField<tensor>::typeName,
pTraits<tensor>::zero pTraits<tensor>::zero
); );
initPatchFields<surfaceScalarField> initPatchFields<surfaceScalarField, processorFvsPatchField<scalar> >
( (
processorFvPatchField<scalar>::typeName,
pTraits<scalar>::zero pTraits<scalar>::zero
); );
initPatchFields<surfaceVectorField> initPatchFields<surfaceVectorField, processorFvsPatchField<vector> >
( (
processorFvPatchField<vector>::typeName,
pTraits<vector>::zero pTraits<vector>::zero
); );
initPatchFields<surfaceSphericalTensorField> initPatchFields
<
surfaceSphericalTensorField,
processorFvsPatchField<sphericalTensor>
>
( (
processorFvPatchField<sphericalTensor>::typeName,
pTraits<sphericalTensor>::zero pTraits<sphericalTensor>::zero
); );
initPatchFields<surfaceSymmTensorField> initPatchFields
<
surfaceSymmTensorField,
processorFvsPatchField<symmTensor>
>
( (
processorFvPatchField<symmTensor>::typeName,
pTraits<symmTensor>::zero pTraits<symmTensor>::zero
); );
initPatchFields<surfaceTensorField> initPatchFields<surfaceTensorField, processorFvsPatchField<tensor> >
( (
processorFvPatchField<tensor>::typeName,
pTraits<tensor>::zero pTraits<tensor>::zero
); );

View File

@ -164,10 +164,9 @@ class fvMeshDistribute
); );
//- Init patch fields of certain type //- Init patch fields of certain type
template<class GeoField> template<class GeoField, class PatchFieldType>
void initPatchFields void initPatchFields
( (
const word& patchFieldType,
const typename GeoField::value_type& initVal const typename GeoField::value_type& initVal
); );

View File

@ -235,10 +235,9 @@ void Foam::fvMeshDistribute::mapBoundaryFields
// Init patch fields of certain type // Init patch fields of certain type
template<class GeoField> template<class GeoField, class PatchFieldType>
void Foam::fvMeshDistribute::initPatchFields void Foam::fvMeshDistribute::initPatchFields
( (
const word& patchFieldType,
const typename GeoField::value_type& initVal const typename GeoField::value_type& initVal
) )
{ {
@ -264,7 +263,7 @@ void Foam::fvMeshDistribute::initPatchFields
forAll(bfld, patchI) forAll(bfld, patchI)
{ {
if (bfld[patchI].type() == patchFieldType) if (isA<PatchFieldType>(bfld[patchI]))
{ {
bfld[patchI] == initVal; bfld[patchI] == initVal;
} }

View File

@ -52,7 +52,7 @@ bool Foam::adjustPhi
const fvPatchVectorField& Up = U.boundaryField()[patchi]; const fvPatchVectorField& Up = U.boundaryField()[patchi];
const fvsPatchScalarField& phip = phi.boundaryField()[patchi]; const fvsPatchScalarField& phip = phi.boundaryField()[patchi];
if (!isType<processorFvsPatchScalarField>(phip)) if (!isA<processorFvsPatchScalarField>(phip))
{ {
if if
( (
@ -128,7 +128,7 @@ bool Foam::adjustPhi
const fvPatchVectorField& Up = U.boundaryField()[patchi]; const fvPatchVectorField& Up = U.boundaryField()[patchi];
fvsPatchScalarField& phip = phi.boundaryField()[patchi]; fvsPatchScalarField& phip = phi.boundaryField()[patchi];
if (!isType<processorFvsPatchScalarField>(phip)) if (!isA<processorFvsPatchScalarField>(phip))
{ {
if if
( (

View File

@ -1,4 +1,4 @@
if (!isType<zeroGradientFvPatchScalarField>(k_.boundaryField()[patchi])) if (!isA<zeroGradientFvPatchScalarField>(k_.boundaryField()[patchi]))
{ {
FatalErrorIn("wall-function evaluation") FatalErrorIn("wall-function evaluation")
<< k_.boundaryField()[patchi].type() << k_.boundaryField()[patchi].type()
@ -8,7 +8,7 @@ if (!isType<zeroGradientFvPatchScalarField>(k_.boundaryField()[patchi]))
<< exit(FatalError); << exit(FatalError);
} }
if (!isType<zeroGradientFvPatchScalarField>(epsilon_.boundaryField()[patchi])) if (!isA<zeroGradientFvPatchScalarField>(epsilon_.boundaryField()[patchi]))
{ {
FatalErrorIn("wall-function evaluation") FatalErrorIn("wall-function evaluation")
<< epsilon_.boundaryField()[patchi].type() << epsilon_.boundaryField()[patchi].type()

View File

@ -111,7 +111,7 @@ void Foam::fvMeshSubset::doCoupledPatches
{ {
const polyPatch& pp = oldPatches[oldPatchI]; const polyPatch& pp = oldPatches[oldPatchI];
if (typeid(pp) == typeid(processorPolyPatch)) if (isA<processorPolyPatch>(pp))
{ {
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp); refCast<const processorPolyPatch>(pp);
@ -133,7 +133,7 @@ void Foam::fvMeshSubset::doCoupledPatches
{ {
const polyPatch& pp = oldPatches[oldPatchI]; const polyPatch& pp = oldPatches[oldPatchI];
if (typeid(pp) == typeid(processorPolyPatch)) if (isA<processorPolyPatch>(pp))
{ {
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp); refCast<const processorPolyPatch>(pp);
@ -171,7 +171,7 @@ void Foam::fvMeshSubset::doCoupledPatches
{ {
const polyPatch& pp = oldPatches[oldPatchI]; const polyPatch& pp = oldPatches[oldPatchI];
if (typeid(pp) == typeid(cyclicPolyPatch)) if (isA<cyclicPolyPatch>(pp))
{ {
const cyclicPolyPatch& cycPatch = const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(pp); refCast<const cyclicPolyPatch>(pp);

View File

@ -37,13 +37,7 @@ void Foam::nearWallDist::doAll()
cellDistFuncs wallUtils(mesh_); cellDistFuncs wallUtils(mesh_);
// Get patch ids of walls // Get patch ids of walls
labelHashSet wallPatchIDs labelHashSet wallPatchIDs(wallUtils.getPatchIDs<wallPolyPatch>());
(
wallUtils.getPatchIDs
(
wallPolyPatch::typeName
)
);
// Size neighbours array for maximum possible // Size neighbours array for maximum possible
@ -60,7 +54,7 @@ void Foam::nearWallDist::doAll()
const fvPatch& patch = mesh_.boundary()[patchI]; const fvPatch& patch = mesh_.boundary()[patchI];
if (patch.type() == wallFvPatch::typeName) if (isA<wallFvPatch>(patch))
{ {
const polyPatch& pPatch = patch.patch(); const polyPatch& pPatch = patch.patch();

View File

@ -41,7 +41,7 @@ void Foam::nearWallDistNoSearch::doAll()
{ {
fvPatchScalarField& ypatch = operator[](patchI); fvPatchScalarField& ypatch = operator[](patchI);
if (patches[patchI].type() == wallFvPatch::typeName) if (isA<wallFvPatch>(patches[patchI]))
{ {
const unallocLabelList& faceCells = patches[patchI].faceCells(); const unallocLabelList& faceCells = patches[patchI].faceCells();

View File

@ -60,7 +60,7 @@ void Foam::reflectionVectors::correct()
forAll(patches, patchi) forAll(patches, patchi)
{ {
// find the nearest face for every cell // find the nearest face for every cell
if (patches[patchi].type() == wallFvPatch::typeName) if (isA<wallFvPatch>(patches[patchi]))
{ {
n_.boundaryField()[patchi] = n_.boundaryField()[patchi] =
mesh.Sf().boundaryField()[patchi] mesh.Sf().boundaryField()[patchi]

View File

@ -68,7 +68,7 @@ Foam::wallDist::~wallDist()
void Foam::wallDist::correct() void Foam::wallDist::correct()
{ {
// Get patchids of walls // Get patchids of walls
labelHashSet wallPatchIDs(getPatchIDs(wallPolyPatch::typeName)); labelHashSet wallPatchIDs(getPatchIDs<wallPolyPatch>());
// Calculate distance starting from wallPatch faces. // Calculate distance starting from wallPatch faces.
patchWave wave(cellDistFuncs::mesh(), wallPatchIDs, correctWalls_); patchWave wave(cellDistFuncs::mesh(), wallPatchIDs, correctWalls_);
@ -79,7 +79,7 @@ void Foam::wallDist::correct()
// Transfer values on patches into boundaryField of *this // Transfer values on patches into boundaryField of *this
forAll(boundaryField(), patchI) forAll(boundaryField(), patchI)
{ {
if (boundaryField()[patchI].type() != emptyFvPatchScalarField::typeName) if (!isA<emptyFvPatchScalarField>(boundaryField()[patchI]))
{ {
scalarField& waveFld = wave.patchDistance()[patchI]; scalarField& waveFld = wave.patchDistance()[patchI];

View File

@ -80,7 +80,7 @@ void Foam::wallDistData<TransferType>::correct()
// //
// Get patchids of walls // Get patchids of walls
labelHashSet wallPatchIDs(getPatchIDs(wallPolyPatch::typeName)); labelHashSet wallPatchIDs(getPatchIDs<wallPolyPatch>());
// Collect pointers to data on patches // Collect pointers to data on patches
UPtrList<Field<Type> > patchData(mesh.boundaryMesh().size()); UPtrList<Field<Type> > patchData(mesh.boundaryMesh().size());
@ -109,7 +109,7 @@ void Foam::wallDistData<TransferType>::correct()
{ {
scalarField& waveFld = wave.patchDistance()[patchI]; scalarField& waveFld = wave.patchDistance()[patchI];
if (boundaryField()[patchI].type() != emptyFvPatchScalarField::typeName) if (!isA<emptyFvPatchScalarField>(boundaryField()[patchI]))
{ {
boundaryField()[patchI].transfer(waveFld); boundaryField()[patchI].transfer(waveFld);

View File

@ -1,4 +1,4 @@
if (isType<wallPolyPatch>(pbMesh[patch(face())])) if (isA<wallPolyPatch>(pbMesh[patch(face())]))
{ {
keepParcel = sDB.wall().wallTreatment(*this, face()); keepParcel = sDB.wall().wallTreatment(*this, face());
@ -12,7 +12,7 @@ if (isType<wallPolyPatch>(pbMesh[patch(face())]))
U() = (magUs/magV1)*v1*n() + vs*sDB.axisOfSymmetry(); U() = (magUs/magV1)*v1*n() + vs*sDB.axisOfSymmetry();
} }
} }
else if (isType<wedgePolyPatch>(pbMesh[patch(face())])) else if (isA<wedgePolyPatch>(pbMesh[patch(face())]))
{ {
// check if parcel is trying to move out of the domain // check if parcel is trying to move out of the domain
label patchi = patch(face()); label patchi = patch(face());
@ -27,7 +27,7 @@ else if (isType<wedgePolyPatch>(pbMesh[patch(face())]))
U() -= 2.0*Un2*n(); U() -= 2.0*Un2*n();
} }
} }
else if (isType<symmetryPolyPatch>(pbMesh[patch(face())])) else if (isA<symmetryPolyPatch>(pbMesh[patch(face())]))
{ {
// check if parcel is trying to move out of the domain // check if parcel is trying to move out of the domain
label patchi = patch(face()); label patchi = patch(face());

View File

@ -314,7 +314,7 @@ bool Foam::parcel::move(spray& sDB)
{ {
if (face() > -1) if (face() > -1)
{ {
if (isType<processorPolyPatch>(pbMesh[patch(face())])) if (isA<processorPolyPatch>(pbMesh[patch(face())]))
{ {
switchProcessor = true; switchProcessor = true;
} }

View File

@ -242,11 +242,11 @@ Foam::spray::spray
// check for the type of boundary condition // check for the type of boundary condition
forAll(bMesh, patchi) forAll(bMesh, patchi)
{ {
if (isType<symmetryPolyPatch>(bMesh[patchi])) if (isA<symmetryPolyPatch>(bMesh[patchi]))
{ {
symPlaneExist = true; symPlaneExist = true;
} }
else if (isType<wedgePolyPatch>(bMesh[patchi])) else if (isA<wedgePolyPatch>(bMesh[patchi]))
{ {
wedgeExist = true; wedgeExist = true;
patches[n++] = patchi; patches[n++] = patchi;

View File

@ -82,7 +82,7 @@ bool reflectParcel::wallTreatment
const polyMesh& mesh = spray_.mesh(); const polyMesh& mesh = spray_.mesh();
if (isType<wallPolyPatch>(mesh_.boundaryMesh()[patchi])) if (isA<wallPolyPatch>(mesh_.boundaryMesh()[patchi]))
{ {
// wallNormal defined to point outwards of domain // wallNormal defined to point outwards of domain
vector Sf = mesh_.Sf().boundaryField()[patchi][facei]; vector Sf = mesh_.Sf().boundaryField()[patchi][facei];

View File

@ -60,7 +60,7 @@ bool Foam::DsmcParcel<ParcelType>::move
if (p.onBoundary() && td.keepParticle) if (p.onBoundary() && td.keepParticle)
{ {
if (isType<processorPolyPatch>(pbMesh[p.patch(p.face())])) if (isA<processorPolyPatch>(pbMesh[p.patch(p.face())]))
{ {
td.switchProcessor = true; td.switchProcessor = true;
} }

View File

@ -52,7 +52,7 @@ Foam::FreeStream<CloudType>::FreeStream
{ {
const polyPatch& patch = cloud.mesh().boundaryMesh()[p]; const polyPatch& patch = cloud.mesh().boundaryMesh()[p];
if (patch.type() == polyPatch::typeName) if (isType<polyPatch>(patch))
{ {
patches.append(p); patches.append(p);
} }

View File

@ -263,7 +263,7 @@ bool Foam::KinematicParcel<ParcelType>::move(TrackData& td)
if (p.onBoundary() && td.keepParticle) if (p.onBoundary() && td.keepParticle)
{ {
if (isType<processorPolyPatch>(pbMesh[p.patch(p.face())])) if (isA<processorPolyPatch>(pbMesh[p.patch(p.face())]))
{ {
td.switchProcessor = true; td.switchProcessor = true;
} }

View File

@ -367,7 +367,7 @@ void Foam::referredCellList::buildReferredCellList
// boundaries. Separate treatment allows the serial version to run // boundaries. Separate treatment allows the serial version to run
// transparently. // transparently.
if (mesh.boundaryMesh()[patchI].type() == "cyclic") if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchI]))
{ {
const cyclicPolyPatch& patch = refCast<const cyclicPolyPatch> const cyclicPolyPatch& patch = refCast<const cyclicPolyPatch>
( (

View File

@ -84,7 +84,7 @@ bool Foam::solidParticle::move(solidParticle::trackData& td)
if (onBoundary() && td.keepParticle) if (onBoundary() && td.keepParticle)
{ {
if (isType<processorPolyPatch>(pbMesh[patch(face())])) if (isA<processorPolyPatch>(pbMesh[patch(face())]))
{ {
td.switchProcessor = true; td.switchProcessor = true;
} }

View File

@ -104,27 +104,6 @@ Foam::labelHashSet Foam::cellDistFuncs::getPatchIDs
} }
// Get patch ids of patches of certain type (e.g. 'polyProcessorPatch')
Foam::labelHashSet Foam::cellDistFuncs::getPatchIDs(const word& wantedType)
const
{
const polyBoundaryMesh& bMesh = mesh().boundaryMesh();
labelHashSet patchIDs(bMesh.size());
forAll(bMesh, patchI)
{
const polyPatch& patch = bMesh[patchI];
if (patch.type() == wantedType)
{
patchIDs.insert(patchI);
}
}
return patchIDs;
}
// Return smallest true distance from p to any of wallFaces. // Return smallest true distance from p to any of wallFaces.
// Note that even if normal hits face we still check other faces. // Note that even if normal hits face we still check other faces.
// Note that wallFaces is untruncated and we explicitly pass in size. // Note that wallFaces is untruncated and we explicitly pass in size.

View File

@ -30,6 +30,7 @@ Description
SourceFiles SourceFiles
cellDistFuncs.C cellDistFuncs.C
cellDistFuncsTemplates.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -101,8 +102,10 @@ public:
//- Get patchIDs of named patches //- Get patchIDs of named patches
labelHashSet getPatchIDs(const wordList&) const; labelHashSet getPatchIDs(const wordList&) const;
//- Get patchIDs of certain type (e.g. 'processorPolyPatch') //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch')
labelHashSet getPatchIDs(const word&) const; // Uses isA, not isType
template<class Type>
labelHashSet getPatchIDs() const;
//- Calculate smallest true distance (and face index) //- Calculate smallest true distance (and face index)
// from pt to faces wallFaces. // from pt to faces wallFaces.
@ -159,6 +162,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "cellDistFuncsTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -366,14 +366,24 @@ void Foam::directMappedPatchBase::calcMapping() const
if if
( (
offset_ == vector::zero offset_ == vector::zero
&& mode_ == NEARESTPATCHFACE
&& sampleRegion_ == patch_.boundaryMesh().mesh().name() && sampleRegion_ == patch_.boundaryMesh().mesh().name()
&& samplePatch_ == patch_.name()
) )
{ {
FatalErrorIn("directMappedPatchBase::calcMapping() const") WarningIn("directMappedPatchBase::calcMapping() const")
<< "Invalid offset " << offset_ << endl << "Invalid offset " << offset_ << 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 cell supplying the data." << " find the patch face supplying the data." << endl
<< exit(FatalError); << "Setting it to " << offset_
<< " on the same patch, on the same region"
<< " will find the faces themselves which does not make sense"
<< " for anything but testing." << endl
<< "patch_:" << patch_.name() << endl
<< "sampleRegion_:" << sampleRegion_ << endl
<< "mode_:" << sampleModeNames_[mode_] << endl
<< "samplePatch_:" << samplePatch_ << endl
<< "offset_:" << offset_ << endl;
} }

View File

@ -113,7 +113,7 @@ void faceSet::sync(const polyMesh& mesh)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
if (isType<processorPolyPatch>(pp)) if (isA<processorPolyPatch>(pp))
{ {
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp); refCast<const processorPolyPatch>(pp);
@ -145,7 +145,7 @@ void faceSet::sync(const polyMesh& mesh)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
if (isType<processorPolyPatch>(pp)) if (isA<processorPolyPatch>(pp))
{ {
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp); refCast<const processorPolyPatch>(pp);
@ -174,7 +174,7 @@ void faceSet::sync(const polyMesh& mesh)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
if (typeid(pp) == typeid(cyclicPolyPatch)) if (isA<cyclicPolyPatch>(pp))
{ {
const cyclicPolyPatch& cycPatch = const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(pp); refCast<const cyclicPolyPatch>(pp);

View File

@ -100,7 +100,7 @@ meshToMesh::meshToMesh
forAll (toMesh_.boundaryMesh(), patchi) forAll (toMesh_.boundaryMesh(), patchi)
{ {
// Add the processor patches in the toMesh to the cuttingPatches list // Add the processor patches in the toMesh to the cuttingPatches list
if (toMesh_.boundaryMesh()[patchi].type() == processorFvPatch::typeName) if (isA<processorPolyPatch>(toMesh_.boundaryMesh()[patchi]))
{ {
cuttingPatches_.insert cuttingPatches_.insert
( (

View File

@ -179,8 +179,8 @@ void Foam::thresholdCellFaces::calculate
if if
( (
isType<emptyPolyPatch>(p) isA<emptyPolyPatch>(p)
|| (Pstream::parRun() && isType<processorPolyPatch>(p)) || (Pstream::parRun() && isA<processorPolyPatch>(p))
) )
{ {
continue; continue;

View File

@ -175,7 +175,7 @@ void Foam::linearValveFvMesh::makeSlidersDead()
// Enable layering // Enable layering
forAll (topoChanges, modI) forAll (topoChanges, modI)
{ {
if (typeid(topoChanges[modI]) == typeid(slidingInterface)) if (isA<slidingInterface>(topoChanges[modI]))
{ {
topoChanges[modI].disable(); topoChanges[modI].disable();
} }
@ -197,7 +197,7 @@ void Foam::linearValveFvMesh::makeSlidersLive()
// Enable sliding interface // Enable sliding interface
forAll (topoChanges, modI) forAll (topoChanges, modI)
{ {
if (typeid(topoChanges[modI]) == typeid(slidingInterface)) if (isA<slidingInterface>(topoChanges[modI]))
{ {
topoChanges[modI].enable(); topoChanges[modI].enable();
} }
@ -220,7 +220,7 @@ bool Foam::linearValveFvMesh::attached() const
forAll (topoChanges, modI) forAll (topoChanges, modI)
{ {
if (typeid(topoChanges[modI]) == typeid(slidingInterface)) if (isA<slidingInterface>(topoChanges[modI]))
{ {
result = result =
result result
@ -231,7 +231,7 @@ bool Foam::linearValveFvMesh::attached() const
// Check thal all sliders are in sync (debug only) // Check thal all sliders are in sync (debug only)
forAll (topoChanges, modI) forAll (topoChanges, modI)
{ {
if (typeid(topoChanges[modI]) == typeid(slidingInterface)) if (isA<slidingInterface>(topoChanges[modI]))
{ {
if if
( (

View File

@ -219,11 +219,11 @@ void Foam::linearValveLayersFvMesh::makeLayersLive()
// Enable layering // Enable layering
forAll (topoChanges, modI) forAll (topoChanges, modI)
{ {
if (typeid(topoChanges[modI]) == typeid(layerAdditionRemoval)) if (isA<layerAdditionRemoval>(topoChanges[modI]))
{ {
topoChanges[modI].enable(); topoChanges[modI].enable();
} }
else if (typeid(topoChanges[modI]) == typeid(slidingInterface)) else if (isA<slidingInterface>(topoChanges[modI]))
{ {
topoChanges[modI].disable(); topoChanges[modI].disable();
} }
@ -245,11 +245,11 @@ void Foam::linearValveLayersFvMesh::makeSlidersLive()
// Enable sliding interface // Enable sliding interface
forAll (topoChanges, modI) forAll (topoChanges, modI)
{ {
if (typeid(topoChanges[modI]) == typeid(layerAdditionRemoval)) if (isA<layerAdditionRemoval>(topoChanges[modI]))
{ {
topoChanges[modI].disable(); topoChanges[modI].disable();
} }
else if (typeid(topoChanges[modI]) == typeid(slidingInterface)) else if (isA<slidingInterface>(topoChanges[modI]))
{ {
topoChanges[modI].enable(); topoChanges[modI].enable();
} }
@ -272,7 +272,7 @@ bool Foam::linearValveLayersFvMesh::attached() const
forAll (topoChanges, modI) forAll (topoChanges, modI)
{ {
if (typeid(topoChanges[modI]) == typeid(slidingInterface)) if (isA<slidingInterface>(topoChanges[modI]))
{ {
result = result =
result result
@ -283,7 +283,7 @@ bool Foam::linearValveLayersFvMesh::attached() const
// Check thal all sliders are in sync (debug only) // Check thal all sliders are in sync (debug only)
forAll (topoChanges, modI) forAll (topoChanges, modI)
{ {
if (typeid(topoChanges[modI]) == typeid(slidingInterface)) if (isA<slidingInterface>(topoChanges[modI]))
{ {
if if
( (

View File

@ -71,7 +71,7 @@ void vanDriestDelta::calcDelta()
const fvPatchList& patches = mesh_.boundary(); const fvPatchList& patches = mesh_.boundary();
forAll(patches, patchi) forAll(patches, patchi)
{ {
if (isType<wallFvPatch>(patches[patchi])) if (isA<wallFvPatch>(patches[patchi]))
{ {
const fvPatchVectorField& Uw = U.boundaryField()[patchi]; const fvPatchVectorField& Uw = U.boundaryField()[patchi];
const scalarField& rhow = rho.boundaryField()[patchi]; const scalarField& rhow = rho.boundaryField()[patchi];

View File

@ -370,7 +370,7 @@ void LRR::correct()
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (typeid(curPatch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
@ -432,7 +432,7 @@ void LRR::correct()
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (typeid(curPatch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(curPatch))
{ {
symmTensorField& Rw = R_.boundaryField()[patchi]; symmTensorField& Rw = R_.boundaryField()[patchi];

View File

@ -408,7 +408,7 @@ void LaunderGibsonRSTM::correct()
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (typeid(curPatch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
@ -478,7 +478,7 @@ void LaunderGibsonRSTM::correct()
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (typeid(curPatch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(curPatch))
{ {
symmTensorField& Rw = R_.boundaryField()[patchi]; symmTensorField& Rw = R_.boundaryField()[patchi];

View File

@ -37,6 +37,8 @@ $(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C
derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C
derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C
derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C
derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C
backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C

View File

@ -7,4 +7,6 @@ EXE_INC = \
LIB_LIBS = \ LIB_LIBS = \
-lcompressibleTurbulenceModel \ -lcompressibleTurbulenceModel \
-lfiniteVolume \ -lfiniteVolume \
-lbasicThermophysicalModels \
-lspecie \
-lmeshTools -lmeshTools

View File

@ -174,7 +174,7 @@ tmp<scalarField> RASModel::yPlus(const label patchNo, const scalar Cmu) const
tmp<scalarField> tYp(new scalarField(curPatch.size())); tmp<scalarField> tYp(new scalarField(curPatch.size()));
scalarField& Yp = tYp(); scalarField& Yp = tYp();
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
Yp = pow025(Cmu) Yp = pow025(Cmu)
*y_[patchNo] *y_[patchNo]

View File

@ -73,7 +73,7 @@ tmp<volScalarField> autoCreateAlphat
forAll(bm, patchI) forAll(bm, patchI)
{ {
if (isType<wallFvPatch>(bm[patchI])) if (isA<wallFvPatch>(bm[patchI]))
{ {
alphatBoundaryTypes[patchI] = alphatBoundaryTypes[patchI] =
RASModels::alphatWallFunctionFvPatchScalarField::typeName; RASModels::alphatWallFunctionFvPatchScalarField::typeName;
@ -143,7 +143,7 @@ tmp<volScalarField> autoCreateMut
forAll(bm, patchI) forAll(bm, patchI)
{ {
if (isType<wallFvPatch>(bm[patchI])) if (isA<wallFvPatch>(bm[patchI]))
{ {
mutBoundaryTypes[patchI] = mutBoundaryTypes[patchI] =
RASModels::mutkWallFunctionFvPatchScalarField::typeName; RASModels::mutkWallFunctionFvPatchScalarField::typeName;

View File

@ -28,7 +28,7 @@ License
#include "Time.H" #include "Time.H"
#include "OSspecific.H" #include "OSspecific.H"
#include "wallPolyPatch.H" #include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -111,7 +111,7 @@ autoCreateWallFunctionField
forAll(newPatchFields, patchI) forAll(newPatchFields, patchI)
{ {
if (isType<wallPolyPatch>(mesh.boundaryMesh()[patchI])) if (isA<wallFvPatch>(mesh.boundary()[patchI]))
{ {
newPatchFields.set newPatchFields.set
( (

View File

@ -0,0 +1,69 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "regionProperties.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::regionProperties::regionProperties(const Time& runTime)
:
IOdictionary
(
IOobject
(
"regionProperties",
runTime.time().constant(),
runTime.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
fluidRegionNames_(lookup("fluidRegionNames")),
solidRegionNames_(lookup("solidRegionNames"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionProperties::~regionProperties()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::List<Foam::word>& Foam::regionProperties::fluidRegionNames() const
{
return fluidRegionNames_;
}
const Foam::List<Foam::word>& Foam::regionProperties::solidRegionNames() const
{
return solidRegionNames_;
}
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
regionProperties
Description
Simple class to hold region information for coupled region simulations
SourceFiles
regionProperties.C
\*---------------------------------------------------------------------------*/
#ifndef regionProperties_H
#define regionProperties_H
#include "IOdictionary.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class regionProperties Declaration
\*---------------------------------------------------------------------------*/
class regionProperties
:
public IOdictionary
{
// Private data
//- List of the fluid region names
List<word> fluidRegionNames_;
//- List of the solid region names
List<word> solidRegionNames_;
// Private Member Functions
//- Disallow default bitwise copy construct
regionProperties(const regionProperties&);
//- Disallow default bitwise assignment
void operator=(const regionProperties&);
public:
// Constructors
//- Construct from components
regionProperties(const Time& runTime);
// Destructor
~regionProperties();
// Member Functions
// Access
//- Return const reference to the list of fluid region names
const List<word>& fluidRegionNames() const;
//- Return const reference to the list of solid region names
const List<word>& solidRegionNames() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,414 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "turbulentTemperatureCoupledBaffleFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "directMappedPatchBase.H"
#include "regionProperties.H"
#include "basicThermo.H"
#include "RASModel.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
bool Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner
(
const polyMesh& nbrRegion,
const polyPatch& nbrPatch
) const
{
const fvMesh& myRegion = patch().boundaryMesh().mesh();
if (nbrRegion.name() == myRegion.name())
{
return patch().index() < nbrPatch.index();
}
else
{
const regionProperties& props =
myRegion.objectRegistry::parent().lookupObject<regionProperties>
(
"regionProperties"
);
label myIndex = findIndex(props.fluidRegionNames(), myRegion.name());
if (myIndex == -1)
{
label i = findIndex(props.solidRegionNames(), myRegion.name());
if (i == -1)
{
FatalErrorIn
(
"turbulentTemperatureCoupledBaffleFvPatchScalarField"
"::interfaceOwner(const polyMesh&"
", const polyPatch&)const"
) << "Cannot find region " << myRegion.name()
<< " neither in fluids " << props.fluidRegionNames()
<< " nor in solids " << props.solidRegionNames()
<< exit(FatalError);
}
myIndex = props.fluidRegionNames().size() + i;
}
label nbrIndex = findIndex
(
props.fluidRegionNames(),
nbrRegion.name()
);
if (nbrIndex == -1)
{
label i = findIndex(props.solidRegionNames(), nbrRegion.name());
if (i == -1)
{
FatalErrorIn
(
"coupleManager::interfaceOwner"
"(const polyMesh&, const polyPatch&) const"
) << "Cannot find region " << nbrRegion.name()
<< " neither in fluids " << props.fluidRegionNames()
<< " nor in solids " << props.solidRegionNames()
<< exit(FatalError);
}
nbrIndex = props.fluidRegionNames().size() + i;
}
return myIndex < nbrIndex;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
turbulentTemperatureCoupledBaffleFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(p, iF),
neighbourFieldName_("undefined-neighbourFieldName"),
KName_("undefined-K")
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 1.0;
this->fixesValue_ = true;
}
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
turbulentTemperatureCoupledBaffleFvPatchScalarField
(
const turbulentTemperatureCoupledBaffleFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
neighbourFieldName_(ptf.neighbourFieldName_),
KName_(ptf.KName_),
fixesValue_(ptf.fixesValue_)
{}
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
turbulentTemperatureCoupledBaffleFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF),
neighbourFieldName_(dict.lookup("neighbourFieldName")),
KName_(dict.lookup("K"))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"turbulentTemperatureCoupledBaffleFvPatchScalarField::"
"turbulentTemperatureCoupledBaffleFvPatchScalarField\n"
"(\n"
" const fvPatch& p,\n"
" const DimensionedField<scalar, volMesh>& iF,\n"
" const dictionary& dict\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << dimensionedInternalField().name()
<< " in file " << dimensionedInternalField().objectPath()
<< exit(FatalError);
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
if (dict.found("refValue"))
{
// Full restart
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
fixesValue_ = readBool(dict.lookup("fixesValue"));
}
else
{
// Start from user entered data. Assume fixedValue.
refValue() = *this;
refGrad() = 0.0;
valueFraction() = 1.0;
fixesValue_ = true;
}
}
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::
turbulentTemperatureCoupledBaffleFvPatchScalarField
(
const turbulentTemperatureCoupledBaffleFvPatchScalarField& wtcsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(wtcsf, iF),
neighbourFieldName_(wtcsf.neighbourFieldName_),
KName_(wtcsf.KName_),
fixesValue_(wtcsf.fixesValue_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField>
Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::K() const
{
if (KName_ == "none")
{
const compressible::RASModel& model =
db().lookupObject<compressible::RASModel>("RASProperties");
tmp<volScalarField> talpha = model.alphaEff();
const basicThermo& thermo =
db().lookupObject<basicThermo>("thermophysicalProperties");
return
talpha().boundaryField()[patch().index()]
*thermo.rho()().boundaryField()[patch().index()]
*thermo.Cp()().boundaryField()[patch().index()];
}
else
{
return patch().lookupPatchField<volScalarField, scalar>(KName_);
}
}
void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
patch().patch()
);
const polyMesh& nbrMesh = mpp.sampleMesh();
const fvPatch& nbrPatch = refCast<const fvMesh>
(
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
(void)distMap.schedule();
tmp<scalarField> intFld = patchInternalField();
if (interfaceOwner(nbrMesh, nbrPatch.patch()))
{
// Note: other side information could be cached - it only needs
// to be updated the first time round the iteration (i.e. when
// switching regions) but unfortunately we don't have this information.
// Calculate the temperature by harmonic averaging
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
const turbulentTemperatureCoupledBaffleFvPatchScalarField& nbrField =
refCast<const turbulentTemperatureCoupledBaffleFvPatchScalarField>
(
nbrPatch.lookupPatchField<volScalarField, scalar>
(
neighbourFieldName_
)
);
// Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Swap to obtain full local values of neighbour K*delta
scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrKDelta
);
tmp<scalarField> myKDelta = K()*patch().deltaCoeffs();
// Calculate common wall temperature. Reuse *this to store common value.
scalarField Twall
(
(myKDelta()*intFld() + nbrKDelta*nbrIntFld)
/ (myKDelta() + nbrKDelta)
);
// Assign to me
fvPatchScalarField::operator=(Twall);
// Distribute back and assign to neighbour
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
nbrField.size(),
distMap.constructMap(), // reverse : what to send
distMap.subMap(),
Twall
);
const_cast<turbulentTemperatureCoupledBaffleFvPatchScalarField&>
(
nbrField
).fvPatchScalarField::operator=(Twall);
}
// Switch between fixed value (of harmonic avg) or gradient
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
label nFixed = 0;
// Like snGrad but bypass switching on refValue/refGrad.
tmp<scalarField> normalGradient = (*this-intFld())*patch().deltaCoeffs();
if (debug)
{
scalar Q = gSum(K()*patch().magSf()*normalGradient());
Info<< "turbulentTemperatureCoupledBaffleFvPatchScalarField::"
<< "updateCoeffs() :"
<< " patch:" << patch().name()
<< " heatFlux:" << Q
<< " walltemperature "
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< " avg:" << gAverage(*this)
<< endl;
}
forAll(*this, i)
{
// if outgoing flux use fixed value.
if (normalGradient()[i] < 0.0)
{
this->refValue()[i] = operator[](i);
this->refGrad()[i] = 0.0; // not used
this->valueFraction()[i] = 1.0;
nFixed++;
}
else
{
this->refValue()[i] = 0.0; // not used
this->refGrad()[i] = normalGradient()[i];
this->valueFraction()[i] = 0.0;
}
}
reduce(nFixed, sumOp<label>());
fixesValue_ = (nFixed > 0);
if (debug)
{
label nTotSize = returnReduce(this->size(), sumOp<label>());
Info<< "turbulentTemperatureCoupledBaffleFvPatchScalarField::"
<< "updateCoeffs() :"
<< " patch:" << patch().name()
<< " out of:" << nTotSize
<< " fixedBC:" << nFixed
<< " gradient:" << nTotSize-nFixed << endl;
}
mixedFvPatchScalarField::updateCoeffs();
}
void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::write
(
Ostream& os
) const
{
mixedFvPatchScalarField::write(os);
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
<< token::END_STATEMENT << nl;
os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
os.writeKeyword("fixesValue") << fixesValue_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
turbulentTemperatureCoupledBaffleFvPatchScalarField
);
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,197 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
turbulentTemperatureCoupledBaffleFvPatchScalarField
Description
Mixed boundary condition for temperature, to be used for heat-transfer
on back-to-back baffles.
If my temperature is T1, neighbour is T2:
T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient.
Example usage:
myInterfacePatchName
{
type turbulentTemperatureCoupledBaffle;
neighbourFieldName T;
K K; // or none
value uniform 300;
}
Needs to be on underlying directMapped(Wall)FvPatch.
Note: if K is "none" looks up RASModel and basicThermo, otherwise expects
the solver to calculate a 'K' field.
Note: runs in parallel with arbitrary decomposition. Uses directMapped
functionality to calculate exchange.
Note: lags interface data so both sides use same data.
- problem: schedule to calculate average would interfere
with standard processor swaps.
- so: updateCoeffs sets both to same Twall. Only need to do
this for last outer iteration but don't have access to this.
SourceFiles
turbulentTemperatureCoupledBaffleFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef turbulentTemperatureCoupledBaffleFvPatchScalarField_H
#define turbulentTemperatureCoupledBaffleFvPatchScalarField_H
#include "fvPatchFields.H"
#include "mixedFvPatchFields.H"
#include "fvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class turbulentTemperatureCoupledBaffleFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class turbulentTemperatureCoupledBaffleFvPatchScalarField
:
public mixedFvPatchScalarField
{
// Private data
//- Name of field on the neighbour region
const word neighbourFieldName_;
//- Name of thermal conductivity field
const word KName_;
bool fixesValue_;
// Private Member Functions
//- Am I or neighbour owner of interface
bool interfaceOwner(const polyMesh&, const polyPatch&) const;
public:
//- Runtime type information
TypeName("turbulentTemperatureCoupledBaffle");
// Constructors
//- Construct from patch and internal field
turbulentTemperatureCoupledBaffleFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
turbulentTemperatureCoupledBaffleFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// turbulentTemperatureCoupledBaffleFvPatchScalarField onto a new patch
turbulentTemperatureCoupledBaffleFvPatchScalarField
(
const turbulentTemperatureCoupledBaffleFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new turbulentTemperatureCoupledBaffleFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
turbulentTemperatureCoupledBaffleFvPatchScalarField
(
const turbulentTemperatureCoupledBaffleFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new turbulentTemperatureCoupledBaffleFvPatchScalarField
(
*this,
iF
)
);
}
// Member functions
//- Get corresponding K field
tmp<scalarField> K() const;
//- Return true if this patch field fixes a value.
// Needed to check if a level has to be specified while solving
// Poissons equations.
virtual bool fixesValue() const
{
return fixesValue_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -70,7 +70,7 @@ void vanDriestDelta::calcDelta()
const fvPatchList& patches = mesh_.boundary(); const fvPatchList& patches = mesh_.boundary();
forAll(patches, patchi) forAll(patches, patchi)
{ {
if (isType<wallFvPatch>(patches[patchi])) if (isA<wallFvPatch>(patches[patchi]))
{ {
const fvPatchVectorField& Uw = U.boundaryField()[patchi]; const fvPatchVectorField& Uw = U.boundaryField()[patchi];
const scalarField& nuw = nu.boundaryField()[patchi]; const scalarField& nuw = nu.boundaryField()[patchi];

View File

@ -331,7 +331,7 @@ void LRR::correct()
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (typeid(curPatch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
@ -390,7 +390,7 @@ void LRR::correct()
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (typeid(curPatch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(curPatch))
{ {
symmTensorField& Rw = R_.boundaryField()[patchi]; symmTensorField& Rw = R_.boundaryField()[patchi];

View File

@ -373,7 +373,7 @@ void LaunderGibsonRSTM::correct()
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (typeid(curPatch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
@ -441,7 +441,7 @@ void LaunderGibsonRSTM::correct()
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (typeid(curPatch) == typeid(wallFvPatch)) if (isA<wallFvPatch>(curPatch))
{ {
symmTensorField& Rw = R_.boundaryField()[patchi]; symmTensorField& Rw = R_.boundaryField()[patchi];

View File

@ -14,7 +14,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
@ -29,7 +29,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
@ -58,7 +58,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {

View File

@ -14,7 +14,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
@ -29,7 +29,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
@ -58,7 +58,7 @@
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {

View File

@ -169,7 +169,7 @@ tmp<scalarField> RASModel::yPlus(const label patchNo, const scalar Cmu) const
tmp<scalarField> tYp(new scalarField(curPatch.size())); tmp<scalarField> tYp(new scalarField(curPatch.size()));
scalarField& Yp = tYp(); scalarField& Yp = tYp();
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
Yp = pow025(Cmu) Yp = pow025(Cmu)
*y_[patchNo] *y_[patchNo]

View File

@ -26,7 +26,6 @@ License
#include "SpalartAllmaras.H" #include "SpalartAllmaras.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "wallDist.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -72,7 +72,7 @@ tmp<volScalarField> autoCreateNut
forAll(bm, patchI) forAll(bm, patchI)
{ {
if (isType<wallFvPatch>(bm[patchI])) if (isA<wallFvPatch>(bm[patchI]))
{ {
nutBoundaryTypes[patchI] = nutBoundaryTypes[patchI] =
RASModels::nutkWallFunctionFvPatchScalarField::typeName; RASModels::nutkWallFunctionFvPatchScalarField::typeName;

View File

@ -28,7 +28,7 @@ License
#include "Time.H" #include "Time.H"
#include "OSspecific.H" #include "OSspecific.H"
#include "wallPolyPatch.H" #include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -111,7 +111,7 @@ autoCreateWallFunctionField
forAll(newPatchFields, patchI) forAll(newPatchFields, patchI)
{ {
if (isType<wallPolyPatch>(mesh.boundaryMesh()[patchI])) if (isA<wallFvPatch>(mesh.boundary()[patchI]))
{ {
newPatchFields.set newPatchFields.set
( (

View File

@ -43,7 +43,7 @@ Description
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {
@ -61,7 +61,7 @@ Description
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
#include "checkPatchFieldTypes.H" #include "checkPatchFieldTypes.H"
@ -112,7 +112,7 @@ Description
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
forAll(curPatch, facei) forAll(curPatch, facei)
{ {

View File

@ -37,7 +37,7 @@ Description
{ {
const fvPatch& p = patches[patchi]; const fvPatch& p = patches[patchi];
if (isType<wallFvPatch>(p)) if (isA<wallFvPatch>(p))
{ {
epsEqn().setValues epsEqn().setValues
( (

View File

@ -39,7 +39,7 @@ Description
{ {
const fvPatch& curPatch = patches[patchi]; const fvPatch& curPatch = patches[patchi];
if (isType<wallFvPatch>(curPatch)) if (isA<wallFvPatch>(curPatch))
{ {
const scalarField& nuw = nu().boundaryField()[patchi]; const scalarField& nuw = nu().boundaryField()[patchi];
scalarField& nutw = nut_.boundaryField()[patchi]; scalarField& nutw = nut_.boundaryField()[patchi];

View File

@ -53,9 +53,8 @@ forAll(Tpatches, patchI)
{ {
if if
( (
(typeid(Tpatches[patchI]) == typeid(fixedValueFvPatchScalarField)) isA<fixedValueFvPatchScalarField>(Tpatches[patchI])
&& && mesh.boundaryMesh()[patchI].name() == "floor"
(mesh.boundaryMesh()[patchI].name() == "floor")
) )
{ {
fixedValueFvPatchScalarField& Tpatch = fixedValueFvPatchScalarField& Tpatch =