mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -54,6 +54,57 @@ using namespace Foam;
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
label addPatch
|
||||||
|
(
|
||||||
|
fvMesh& mesh,
|
||||||
|
const word& patchName,
|
||||||
|
const word& groupName,
|
||||||
|
const dictionary& patchDict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
if (pbm.findPatchID(patchName) == -1)
|
||||||
|
{
|
||||||
|
autoPtr<polyPatch> ppPtr
|
||||||
|
(
|
||||||
|
polyPatch::New
|
||||||
|
(
|
||||||
|
patchName,
|
||||||
|
patchDict,
|
||||||
|
0,
|
||||||
|
pbm
|
||||||
|
)
|
||||||
|
);
|
||||||
|
polyPatch& pp = ppPtr();
|
||||||
|
|
||||||
|
if (!groupName.empty() && !pp.inGroup(groupName))
|
||||||
|
{
|
||||||
|
pp.inGroups().append(groupName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add patch, create calculated everywhere
|
||||||
|
fvMeshTools::addPatch
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
pp,
|
||||||
|
dictionary(), // do not set specialised patchFields
|
||||||
|
calculatedFvPatchField<scalar>::typeName,
|
||||||
|
true // parallel sync'ed addition
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Patch '" << patchName
|
||||||
|
<< "' already exists. Only "
|
||||||
|
<< "moving patch faces - type will remain the same"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pbm.findPatchID(patchName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void modifyOrAddFace
|
void modifyOrAddFace
|
||||||
(
|
(
|
||||||
polyTopoChange& meshMod,
|
polyTopoChange& meshMod,
|
||||||
@ -111,6 +162,185 @@ void modifyOrAddFace
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Create faces for fZone faces. Usually newMasterPatches, newSlavePatches
|
||||||
|
// only size one but can be more for duplicate baffle sets
|
||||||
|
void createFaces
|
||||||
|
(
|
||||||
|
const bool internalFacesOnly,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const faceZone& fZone,
|
||||||
|
const labelList& newMasterPatches,
|
||||||
|
const labelList& newSlavePatches,
|
||||||
|
polyTopoChange& meshMod,
|
||||||
|
PackedBoolList& modifiedFace,
|
||||||
|
label& nModified
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
forAll(newMasterPatches, i)
|
||||||
|
{
|
||||||
|
// Pass 1. Do selected side of zone
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||||
|
{
|
||||||
|
label zoneFaceI = fZone.whichFace(faceI);
|
||||||
|
|
||||||
|
if (zoneFaceI != -1)
|
||||||
|
{
|
||||||
|
if (!fZone.flipMap()[zoneFaceI])
|
||||||
|
{
|
||||||
|
// Use owner side of face
|
||||||
|
modifyOrAddFace
|
||||||
|
(
|
||||||
|
meshMod,
|
||||||
|
mesh.faces()[faceI], // modified face
|
||||||
|
faceI, // label of face
|
||||||
|
mesh.faceOwner()[faceI],// owner
|
||||||
|
false, // face flip
|
||||||
|
newMasterPatches[i], // patch for face
|
||||||
|
fZone.index(), // zone for face
|
||||||
|
false, // face flip in zone
|
||||||
|
modifiedFace // modify or add status
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use neighbour side of face
|
||||||
|
modifyOrAddFace
|
||||||
|
(
|
||||||
|
meshMod,
|
||||||
|
mesh.faces()[faceI].reverseFace(), // modified face
|
||||||
|
faceI, // label of face
|
||||||
|
mesh.faceNeighbour()[faceI],// owner
|
||||||
|
true, // face flip
|
||||||
|
newMasterPatches[i], // patch for face
|
||||||
|
fZone.index(), // zone for face
|
||||||
|
true, // face flip in zone
|
||||||
|
modifiedFace // modify or add status
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
nModified++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Pass 2. Do other side of zone
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||||
|
{
|
||||||
|
label zoneFaceI = fZone.whichFace(faceI);
|
||||||
|
|
||||||
|
if (zoneFaceI != -1)
|
||||||
|
{
|
||||||
|
if (!fZone.flipMap()[zoneFaceI])
|
||||||
|
{
|
||||||
|
// Use neighbour side of face
|
||||||
|
modifyOrAddFace
|
||||||
|
(
|
||||||
|
meshMod,
|
||||||
|
mesh.faces()[faceI].reverseFace(), // modified face
|
||||||
|
faceI, // label of face
|
||||||
|
mesh.faceNeighbour()[faceI], // owner
|
||||||
|
true, // face flip
|
||||||
|
newSlavePatches[i], // patch for face
|
||||||
|
fZone.index(), // zone for face
|
||||||
|
true, // face flip in zone
|
||||||
|
modifiedFace // modify or add
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use owner side of face
|
||||||
|
modifyOrAddFace
|
||||||
|
(
|
||||||
|
meshMod,
|
||||||
|
mesh.faces()[faceI], // modified face
|
||||||
|
faceI, // label of face
|
||||||
|
mesh.faceOwner()[faceI],// owner
|
||||||
|
false, // face flip
|
||||||
|
newSlavePatches[i], // patch for face
|
||||||
|
fZone.index(), // zone for face
|
||||||
|
false, // face flip in zone
|
||||||
|
modifiedFace // modify or add status
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Modify any boundary faces
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
// Normal boundary:
|
||||||
|
// - move to new patch. Might already be back-to-back baffle
|
||||||
|
// you want to add cyclic to. Do warn though.
|
||||||
|
//
|
||||||
|
// Processor boundary:
|
||||||
|
// - do not move to cyclic
|
||||||
|
// - add normal patches though.
|
||||||
|
|
||||||
|
// For warning once per patch.
|
||||||
|
labelHashSet patchWarned;
|
||||||
|
|
||||||
|
forAll(pbm, patchI)
|
||||||
|
{
|
||||||
|
const polyPatch& pp = pbm[patchI];
|
||||||
|
|
||||||
|
label newPatchI = newMasterPatches[i];
|
||||||
|
|
||||||
|
if (pp.coupled() && pbm[newPatchI].coupled())
|
||||||
|
{
|
||||||
|
// Do not allow coupled faces to be moved to different
|
||||||
|
// coupled patches.
|
||||||
|
}
|
||||||
|
else if (pp.coupled() || !internalFacesOnly)
|
||||||
|
{
|
||||||
|
forAll(pp, i)
|
||||||
|
{
|
||||||
|
label faceI = pp.start()+i;
|
||||||
|
|
||||||
|
label zoneFaceI = fZone.whichFace(faceI);
|
||||||
|
|
||||||
|
if (zoneFaceI != -1)
|
||||||
|
{
|
||||||
|
if (patchWarned.insert(patchI))
|
||||||
|
{
|
||||||
|
WarningIn("createFaces(..)")
|
||||||
|
<< "Found boundary face (in patch "
|
||||||
|
<< pp.name()
|
||||||
|
<< ") in faceZone " << fZone.name()
|
||||||
|
<< " to convert to baffle patch "
|
||||||
|
<< pbm[newPatchI].name()
|
||||||
|
<< endl
|
||||||
|
<< " Run with -internalFacesOnly option"
|
||||||
|
<< " if you don't wish to convert"
|
||||||
|
<< " boundary faces." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
modifyOrAddFace
|
||||||
|
(
|
||||||
|
meshMod,
|
||||||
|
mesh.faces()[faceI], // modified face
|
||||||
|
faceI, // label of face
|
||||||
|
mesh.faceOwner()[faceI], // owner
|
||||||
|
false, // face flip
|
||||||
|
newPatchI, // patch for face
|
||||||
|
fZone.index(), // zone for face
|
||||||
|
fZone.flipMap()[zoneFaceI], // face flip in zone
|
||||||
|
modifiedFace // modify or add
|
||||||
|
);
|
||||||
|
nModified++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -220,8 +450,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Creating (if necessary) baffles
|
// Creating (if necessary) faceZones
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
forAll(selectors, selectorI)
|
forAll(selectors, selectorI)
|
||||||
{
|
{
|
||||||
@ -308,21 +538,28 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
forAll(selectors, selectorI)
|
forAll(selectors, selectorI)
|
||||||
{
|
{
|
||||||
const dictionary& patchSources
|
const dictionary& dict = selectors[selectorI].dict();
|
||||||
(
|
|
||||||
selectors[selectorI].dict().subDict("patches")
|
if (dict.found("patches"))
|
||||||
);
|
|
||||||
forAllConstIter(dictionary, patchSources, iter)
|
|
||||||
{
|
{
|
||||||
//const word& patchName = iter().keyword();
|
const dictionary& patchSources = dict.subDict("patches");
|
||||||
const word patchName(iter().dict()["name"]);
|
forAllConstIter(dictionary, patchSources, iter)
|
||||||
bafflePatches.insert(patchName);
|
{
|
||||||
|
const word patchName(iter().dict()["name"]);
|
||||||
|
bafflePatches.insert(patchName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const word masterName = selectors[selectorI].name() + "_master";
|
||||||
|
bafflePatches.insert(masterName);
|
||||||
|
const word slaveName = selectors[selectorI].name() + "_slave";
|
||||||
|
bafflePatches.insert(slaveName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create baffles
|
// Create baffles
|
||||||
// ~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~
|
||||||
// Is done in multiple steps
|
// Is done in multiple steps
|
||||||
@ -344,56 +581,52 @@ int main(int argc, char *argv[])
|
|||||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
forAll(selectors, selectorI)
|
forAll(selectors, selectorI)
|
||||||
{
|
{
|
||||||
const dictionary& patchSources
|
const dictionary& dict = selectors[selectorI].dict();
|
||||||
(
|
const word& groupName = selectors[selectorI].name();
|
||||||
selectors[selectorI].dict().subDict("patches")
|
|
||||||
);
|
if (dict.found("patches"))
|
||||||
forAllConstIter(dictionary, patchSources, iter)
|
|
||||||
{
|
{
|
||||||
//const word& patchName = iter().keyword();
|
const dictionary& patchSources = dict.subDict("patches");
|
||||||
const word patchName(iter().dict()["name"]);
|
forAllConstIter(dictionary, patchSources, iter)
|
||||||
|
|
||||||
label destPatchI = pbm.findPatchID(patchName);
|
|
||||||
|
|
||||||
if (destPatchI == -1)
|
|
||||||
{
|
{
|
||||||
dictionary patchDict = iter().dict();
|
const word patchName(iter().dict()["name"]);
|
||||||
patchDict.set("nFaces", 0);
|
|
||||||
patchDict.set("startFace", 0);
|
|
||||||
|
|
||||||
Info<< "Adding new patch " << patchName
|
if (pbm.findPatchID(patchName) == -1)
|
||||||
<< " from " << patchDict << endl;
|
{
|
||||||
|
dictionary patchDict = iter().dict();
|
||||||
|
patchDict.set("nFaces", 0);
|
||||||
|
patchDict.set("startFace", 0);
|
||||||
|
|
||||||
autoPtr<polyPatch> ppPtr
|
// Note: do not set coupleGroup if constructed from
|
||||||
(
|
// baffles so you have freedom specifying it
|
||||||
polyPatch::New
|
// yourself.
|
||||||
(
|
//patchDict.set("coupleGroup", groupName);
|
||||||
patchName,
|
|
||||||
patchDict,
|
|
||||||
0,
|
|
||||||
pbm
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add patch, create calculated everywhere
|
addPatch(mesh, patchName, groupName, patchDict);
|
||||||
fvMeshTools::addPatch
|
}
|
||||||
(
|
else
|
||||||
mesh,
|
{
|
||||||
ppPtr(),
|
Info<< "Patch '" << patchName
|
||||||
dictionary(), // do not set specialised patchFields
|
<< "' already exists. Only "
|
||||||
calculatedFvPatchField<scalar>::typeName,
|
<< "moving patch faces - type will remain the same"
|
||||||
true // parallel sync'ed addition
|
<< endl;
|
||||||
);
|
}
|
||||||
|
|
||||||
//addedPatches.insert(patchName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< "Patch '" << patchName << "' already exists. Only "
|
|
||||||
<< "moving patch faces - type will remain the same"
|
|
||||||
<< endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const dictionary& patchSource = dict.subDict("patchPairs");
|
||||||
|
const word masterName = groupName + "_master";
|
||||||
|
const word slaveName = groupName + "_slave";
|
||||||
|
|
||||||
|
dictionary patchDict = patchSource;
|
||||||
|
patchDict.set("nFaces", 0);
|
||||||
|
patchDict.set("startFace", 0);
|
||||||
|
patchDict.set("coupleGroup", groupName);
|
||||||
|
|
||||||
|
addPatch(mesh, masterName, groupName, patchDict);
|
||||||
|
addPatch(mesh, slaveName, groupName, patchDict);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,195 +661,53 @@ int main(int argc, char *argv[])
|
|||||||
label zoneID = mesh.faceZones().findZoneID(name);
|
label zoneID = mesh.faceZones().findZoneID(name);
|
||||||
const faceZone& fZone = mesh.faceZones()[zoneID];
|
const faceZone& fZone = mesh.faceZones()[zoneID];
|
||||||
|
|
||||||
const dictionary& patchSources
|
const dictionary& dict = selectors[selectorI].dict();
|
||||||
|
|
||||||
|
DynamicList<label> newMasterPatches;
|
||||||
|
DynamicList<label> newSlavePatches;
|
||||||
|
|
||||||
|
if (dict.found("patches"))
|
||||||
|
{
|
||||||
|
const dictionary& patchSources = dict.subDict("patches");
|
||||||
|
|
||||||
|
bool master = true;
|
||||||
|
forAllConstIter(dictionary, patchSources, iter)
|
||||||
|
{
|
||||||
|
const word patchName(iter().dict()["name"]);
|
||||||
|
label patchI = pbm.findPatchID(patchName);
|
||||||
|
if (master)
|
||||||
|
{
|
||||||
|
newMasterPatches.append(patchI);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newSlavePatches.append(patchI);
|
||||||
|
}
|
||||||
|
master = !master;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const word masterName = selectors[selectorI].name() + "_master";
|
||||||
|
newMasterPatches.append(pbm.findPatchID(masterName));
|
||||||
|
|
||||||
|
const word slaveName = selectors[selectorI].name() + "_slave";
|
||||||
|
newSlavePatches.append(pbm.findPatchID(slaveName));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
createFaces
|
||||||
(
|
(
|
||||||
selectors[selectorI].dict().subDict("patches")
|
internalFacesOnly,
|
||||||
|
mesh,
|
||||||
|
fZone,
|
||||||
|
newMasterPatches,
|
||||||
|
newSlavePatches,
|
||||||
|
meshMod,
|
||||||
|
modifiedFace,
|
||||||
|
nModified
|
||||||
);
|
);
|
||||||
|
|
||||||
DynamicList<label> newMasterPatches(patchSources.size());
|
|
||||||
DynamicList<label> newSlavePatches(patchSources.size());
|
|
||||||
|
|
||||||
bool master = true;
|
|
||||||
|
|
||||||
forAllConstIter(dictionary, patchSources, iter)
|
|
||||||
{
|
|
||||||
//const word& patchName = iter().keyword();
|
|
||||||
const word patchName(iter().dict()["name"]);
|
|
||||||
label patchI = pbm.findPatchID(patchName);
|
|
||||||
if (master)
|
|
||||||
{
|
|
||||||
newMasterPatches.append(patchI);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newSlavePatches.append(patchI);
|
|
||||||
}
|
|
||||||
master = !master;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
forAll(newMasterPatches, i)
|
|
||||||
{
|
|
||||||
// Pass 1. Do selected side of zone
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
|
||||||
{
|
|
||||||
label zoneFaceI = fZone.whichFace(faceI);
|
|
||||||
|
|
||||||
if (zoneFaceI != -1)
|
|
||||||
{
|
|
||||||
if (!fZone.flipMap()[zoneFaceI])
|
|
||||||
{
|
|
||||||
// Use owner side of face
|
|
||||||
modifyOrAddFace
|
|
||||||
(
|
|
||||||
meshMod,
|
|
||||||
mesh.faces()[faceI], // modified face
|
|
||||||
faceI, // label of face
|
|
||||||
mesh.faceOwner()[faceI],// owner
|
|
||||||
false, // face flip
|
|
||||||
newMasterPatches[i], // patch for face
|
|
||||||
fZone.index(), // zone for face
|
|
||||||
false, // face flip in zone
|
|
||||||
modifiedFace // modify or add status
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Use neighbour side of face
|
|
||||||
modifyOrAddFace
|
|
||||||
(
|
|
||||||
meshMod,
|
|
||||||
mesh.faces()[faceI].reverseFace(), // modified face
|
|
||||||
faceI, // label of face
|
|
||||||
mesh.faceNeighbour()[faceI],// owner
|
|
||||||
true, // face flip
|
|
||||||
newMasterPatches[i], // patch for face
|
|
||||||
fZone.index(), // zone for face
|
|
||||||
true, // face flip in zone
|
|
||||||
modifiedFace // modify or add status
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
nModified++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Pass 2. Do other side of zone
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
|
||||||
{
|
|
||||||
label zoneFaceI = fZone.whichFace(faceI);
|
|
||||||
|
|
||||||
if (zoneFaceI != -1)
|
|
||||||
{
|
|
||||||
if (!fZone.flipMap()[zoneFaceI])
|
|
||||||
{
|
|
||||||
// Use neighbour side of face
|
|
||||||
modifyOrAddFace
|
|
||||||
(
|
|
||||||
meshMod,
|
|
||||||
mesh.faces()[faceI].reverseFace(), // modified face
|
|
||||||
faceI, // label of face
|
|
||||||
mesh.faceNeighbour()[faceI], // owner
|
|
||||||
true, // face flip
|
|
||||||
newSlavePatches[i], // patch for face
|
|
||||||
fZone.index(), // zone for face
|
|
||||||
true, // face flip in zone
|
|
||||||
modifiedFace // modify or add
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Use owner side of face
|
|
||||||
modifyOrAddFace
|
|
||||||
(
|
|
||||||
meshMod,
|
|
||||||
mesh.faces()[faceI], // modified face
|
|
||||||
faceI, // label of face
|
|
||||||
mesh.faceOwner()[faceI],// owner
|
|
||||||
false, // face flip
|
|
||||||
newSlavePatches[i], // patch for face
|
|
||||||
fZone.index(), // zone for face
|
|
||||||
false, // face flip in zone
|
|
||||||
modifiedFace // modify or add status
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Modify any boundary faces
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
// Normal boundary:
|
|
||||||
// - move to new patch. Might already be back-to-back baffle
|
|
||||||
// you want to add cyclic to. Do warn though.
|
|
||||||
//
|
|
||||||
// Processor boundary:
|
|
||||||
// - do not move to cyclic
|
|
||||||
// - add normal patches though.
|
|
||||||
|
|
||||||
// For warning once per patch.
|
|
||||||
labelHashSet patchWarned;
|
|
||||||
|
|
||||||
forAll(pbm, patchI)
|
|
||||||
{
|
|
||||||
const polyPatch& pp = pbm[patchI];
|
|
||||||
|
|
||||||
label newPatchI = newMasterPatches[i];
|
|
||||||
|
|
||||||
if (pp.coupled() && pbm[newPatchI].coupled())
|
|
||||||
{
|
|
||||||
// Do not allow coupled faces to be moved to different
|
|
||||||
// coupled patches.
|
|
||||||
}
|
|
||||||
else if (pp.coupled() || !internalFacesOnly)
|
|
||||||
{
|
|
||||||
forAll(pp, i)
|
|
||||||
{
|
|
||||||
label faceI = pp.start()+i;
|
|
||||||
|
|
||||||
label zoneFaceI = fZone.whichFace(faceI);
|
|
||||||
|
|
||||||
if (zoneFaceI != -1)
|
|
||||||
{
|
|
||||||
if (patchWarned.insert(patchI))
|
|
||||||
{
|
|
||||||
WarningIn(args.executable())
|
|
||||||
<< "Found boundary face (in patch "
|
|
||||||
<< pp.name()
|
|
||||||
<< ") in faceZone " << fZone.name()
|
|
||||||
<< " to convert to baffle patch "
|
|
||||||
<< pbm[newPatchI].name()
|
|
||||||
<< endl
|
|
||||||
<< " Run with -internalFacesOnly option"
|
|
||||||
<< " if you don't wish to convert"
|
|
||||||
<< " boundary faces." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
modifyOrAddFace
|
|
||||||
(
|
|
||||||
meshMod,
|
|
||||||
mesh.faces()[faceI], // modified face
|
|
||||||
faceI, // label of face
|
|
||||||
mesh.faceOwner()[faceI], // owner
|
|
||||||
false, // face flip
|
|
||||||
newPatchI, // patch for face
|
|
||||||
fZone.index(), // zone for face
|
|
||||||
fZone.flipMap()[zoneFaceI], // face flip in zone
|
|
||||||
modifiedFace // modify or add
|
|
||||||
);
|
|
||||||
nModified++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -672,29 +763,64 @@ int main(int argc, char *argv[])
|
|||||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
forAll(selectors, selectorI)
|
forAll(selectors, selectorI)
|
||||||
{
|
{
|
||||||
const dictionary& patchSources
|
const dictionary& dict = selectors[selectorI].dict();
|
||||||
(
|
if (dict.found("patches"))
|
||||||
selectors[selectorI].dict().subDict("patches")
|
|
||||||
);
|
|
||||||
forAllConstIter(dictionary, patchSources, iter)
|
|
||||||
{
|
{
|
||||||
//const word& patchName = iter().keyword();
|
const dictionary& patchSources = dict.subDict("patches");
|
||||||
const word patchName(iter().dict()["name"]);
|
|
||||||
label patchI = pbm.findPatchID(patchName);
|
|
||||||
|
|
||||||
if (iter().dict().found("patchFields"))
|
forAllConstIter(dictionary, patchSources, iter)
|
||||||
{
|
{
|
||||||
const dictionary& patchFieldsDict = iter().dict().subDict
|
const word patchName(iter().dict()["name"]);
|
||||||
|
label patchI = pbm.findPatchID(patchName);
|
||||||
|
|
||||||
|
if (iter().dict().found("patchFields"))
|
||||||
|
{
|
||||||
|
const dictionary& patchFieldsDict =
|
||||||
|
iter().dict().subDict
|
||||||
|
(
|
||||||
|
"patchFields"
|
||||||
|
);
|
||||||
|
|
||||||
|
fvMeshTools::setPatchFields
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
patchI,
|
||||||
|
patchFieldsDict
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const dictionary& patchSource = dict.subDict("patchPairs");
|
||||||
|
const word& groupName = selectors[selectorI].name();
|
||||||
|
|
||||||
|
if (patchSource.found("patchFields"))
|
||||||
|
{
|
||||||
|
dictionary patchFieldsDict = patchSource.subDict
|
||||||
(
|
(
|
||||||
"patchFields"
|
"patchFields"
|
||||||
);
|
);
|
||||||
|
// Add coupleGroup to all entries
|
||||||
|
forAllIter(dictionary, patchFieldsDict, iter)
|
||||||
|
{
|
||||||
|
if (iter().isDict())
|
||||||
|
{
|
||||||
|
dictionary& dict = iter().dict();
|
||||||
|
dict.set("coupleGroup", groupName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fvMeshTools::setPatchFields
|
const labelList& patchIDs = pbm.groupPatchIDs()[groupName];
|
||||||
(
|
forAll(patchIDs, i)
|
||||||
mesh,
|
{
|
||||||
patchI,
|
fvMeshTools::setPatchFields
|
||||||
patchFieldsDict
|
(
|
||||||
);
|
mesh,
|
||||||
|
patchIDs[i],
|
||||||
|
patchFieldsDict
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,123 +40,47 @@ internalFacesOnly true;
|
|||||||
// Baffles to create.
|
// Baffles to create.
|
||||||
baffles
|
baffles
|
||||||
{
|
{
|
||||||
baffleFaces
|
baffle1
|
||||||
{
|
{
|
||||||
//- Use predefined faceZone to select faces and orientation.
|
//- Use surface to select faces and orientation.
|
||||||
type faceZone;
|
type searchableSurface;
|
||||||
zoneName baffleFaces;
|
surface triSurfaceMesh;
|
||||||
|
name baffle1D.stl;
|
||||||
|
|
||||||
//- Optional flip
|
//- Optional flip
|
||||||
//flip false;
|
//flip false;
|
||||||
|
|
||||||
patches
|
|
||||||
|
// Generate patchGroup baffle1 with two patches:
|
||||||
|
// - baffle1_master
|
||||||
|
// - baffle1_slave
|
||||||
|
patchPairs
|
||||||
{
|
{
|
||||||
master
|
type wall;
|
||||||
|
//- Optional override of added patchfields. If not specified
|
||||||
|
// any added patchfields are of type calculated.
|
||||||
|
patchFields
|
||||||
{
|
{
|
||||||
//- Master side patch
|
U
|
||||||
name baffles;
|
|
||||||
type wall;
|
|
||||||
|
|
||||||
//- Optional override of added patchfields. If not specified
|
|
||||||
// any added patchfields are of type calculated.
|
|
||||||
patchFields
|
|
||||||
{
|
{
|
||||||
epsilon
|
type fixedValue;
|
||||||
{
|
value uniform (0 0 0);
|
||||||
type epsilonWallFunction;
|
|
||||||
Cmu 0.09;
|
|
||||||
kappa 0.41;
|
|
||||||
E 9.8;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
|
||||||
k
|
|
||||||
{
|
|
||||||
type kqRWallFunction;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
|
||||||
nut
|
|
||||||
{
|
|
||||||
type nutkWallFunction;
|
|
||||||
Cmu 0.09;
|
|
||||||
kappa 0.41;
|
|
||||||
E 9.8;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
|
||||||
nuTilda
|
|
||||||
{
|
|
||||||
type zeroGradient;
|
|
||||||
}
|
|
||||||
p
|
|
||||||
{
|
|
||||||
type zeroGradient;
|
|
||||||
}
|
|
||||||
U
|
|
||||||
{
|
|
||||||
type fixedValue;
|
|
||||||
value uniform (0 0 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
slave
|
|
||||||
{
|
|
||||||
//- Slave side patch
|
|
||||||
name baffles;
|
|
||||||
type wall;
|
|
||||||
|
|
||||||
patchFields
|
|
||||||
{
|
|
||||||
epsilon
|
|
||||||
{
|
|
||||||
type epsilonWallFunction;
|
|
||||||
Cmu 0.09;
|
|
||||||
kappa 0.41;
|
|
||||||
E 9.8;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
|
||||||
k
|
|
||||||
{
|
|
||||||
type kqRWallFunction;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
|
||||||
nut
|
|
||||||
{
|
|
||||||
type nutkWallFunction;
|
|
||||||
Cmu 0.09;
|
|
||||||
kappa 0.41;
|
|
||||||
E 9.8;
|
|
||||||
value uniform 0;
|
|
||||||
}
|
|
||||||
nuTilda
|
|
||||||
{
|
|
||||||
type zeroGradient;
|
|
||||||
}
|
|
||||||
p
|
|
||||||
{
|
|
||||||
type zeroGradient;
|
|
||||||
}
|
|
||||||
U
|
|
||||||
{
|
|
||||||
type fixedValue;
|
|
||||||
value uniform (0 0 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cyclicFaces
|
cyclicFaces
|
||||||
{
|
{
|
||||||
//- Select faces and orientation through a searchableSurface
|
//- Select faces and orientation through a searchableSurface
|
||||||
type searchableSurface;
|
type searchableSurface;
|
||||||
surface searchablePlate;
|
surface searchablePlate;
|
||||||
//name sphere.stl; // name if surface=triSurfaceMesh
|
|
||||||
|
|
||||||
origin (0.099 -0.006 0.004);
|
origin (0.099 -0.006 0.004);
|
||||||
span (0 0.012 0.012);
|
span (0 0.012 0.012);
|
||||||
|
|
||||||
|
|
||||||
|
// Generate patches explicitly
|
||||||
patches
|
patches
|
||||||
{
|
{
|
||||||
master
|
master
|
||||||
|
|||||||
@ -199,6 +199,7 @@ mappedPatches/mappedPolyPatch/mappedPatchBase.C
|
|||||||
mappedPatches/mappedPolyPatch/mappedPolyPatch.C
|
mappedPatches/mappedPolyPatch/mappedPolyPatch.C
|
||||||
mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C
|
mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C
|
||||||
mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C
|
mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C
|
||||||
|
mappedPatches/mappedPolyPatch/coupleGroupIdentifier.C
|
||||||
|
|
||||||
mappedPatches/mappedPointPatch/mappedPointPatch.C
|
mappedPatches/mappedPointPatch/mappedPointPatch.C
|
||||||
mappedPatches/mappedPointPatch/mappedWallPointPatch.C
|
mappedPatches/mappedPointPatch/mappedWallPointPatch.C
|
||||||
|
|||||||
@ -144,8 +144,7 @@ inline bool Foam::wallPoint::sameGeometry
|
|||||||
const wallPoint& w2,
|
const wallPoint& w2,
|
||||||
const scalar tol,
|
const scalar tol,
|
||||||
TrackingData& td
|
TrackingData& td
|
||||||
)
|
) const
|
||||||
const
|
|
||||||
{
|
{
|
||||||
scalar diff = mag(distSqr() - w2.distSqr());
|
scalar diff = mag(distSqr() - w2.distSqr());
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,260 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "coupleGroupIdentifier.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::label Foam::coupleGroupIdentifier::findOtherPatchID
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const polyPatch& thisPatch
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
if (!valid())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"coupleGroupIdentifier::findOtherPatchID(const polyPatch&) const"
|
||||||
|
) << "Invalid coupleGroup patch group"
|
||||||
|
<< " on patch " << thisPatch.name()
|
||||||
|
<< " in region " << pbm.mesh().name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
HashTable<labelList, word>::const_iterator fnd =
|
||||||
|
pbm.groupPatchIDs().find(name());
|
||||||
|
|
||||||
|
if (fnd == pbm.groupPatchIDs().end())
|
||||||
|
{
|
||||||
|
if (&mesh == &thisPatch.boundaryMesh().mesh())
|
||||||
|
{
|
||||||
|
// thisPatch should be in patchGroup
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"coupleGroupIdentifier::findOtherPatchID"
|
||||||
|
"(const polyMesh&, const polyPatch&) const"
|
||||||
|
) << "Patch " << thisPatch.name()
|
||||||
|
<< " should be in patchGroup " << name()
|
||||||
|
<< " in region " << pbm.mesh().name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mesh has patch group
|
||||||
|
const labelList& patchIDs = fnd();
|
||||||
|
|
||||||
|
if (&mesh == &thisPatch.boundaryMesh().mesh())
|
||||||
|
{
|
||||||
|
if (patchIDs.size() > 2 || patchIDs.size() == 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"coupleGroupIdentifier::findOtherPatchID"
|
||||||
|
"(const polyMesh&, const polyPatch&) const"
|
||||||
|
) << "Couple patchGroup " << name()
|
||||||
|
<< " with contents " << patchIDs
|
||||||
|
<< " not of size < 2"
|
||||||
|
<< " on patch " << thisPatch.name()
|
||||||
|
<< " region " << thisPatch.boundaryMesh().mesh().name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
label index = findIndex(patchIDs, thisPatch.index());
|
||||||
|
|
||||||
|
if (index == -1)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"coupleGroupIdentifier::findOtherPatchID"
|
||||||
|
"(const polyMesh&, const polyPatch&) const"
|
||||||
|
) << "Couple patchGroup " << name()
|
||||||
|
<< " with contents " << patchIDs
|
||||||
|
<< " does not contain patch " << thisPatch.name()
|
||||||
|
<< " in region " << pbm.mesh().name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (patchIDs.size() == 2)
|
||||||
|
{
|
||||||
|
// Return the other patch
|
||||||
|
return patchIDs[1-index];
|
||||||
|
}
|
||||||
|
else // size == 1
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (patchIDs.size() != 1)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"coupleGroupIdentifier::findOtherPatchID"
|
||||||
|
"(const polyMesh&, const polyPatch&) const"
|
||||||
|
) << "Couple patchGroup " << name()
|
||||||
|
<< " with contents " << patchIDs
|
||||||
|
<< " in region " << mesh.name()
|
||||||
|
<< " should only contain a single patch"
|
||||||
|
<< " when matching patch " << thisPatch.name()
|
||||||
|
<< " in region " << pbm.mesh().name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return patchIDs[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::coupleGroupIdentifier::coupleGroupIdentifier()
|
||||||
|
:
|
||||||
|
name_()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::coupleGroupIdentifier::coupleGroupIdentifier(const word& name)
|
||||||
|
:
|
||||||
|
name_(name)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::coupleGroupIdentifier::coupleGroupIdentifier(const dictionary& dict)
|
||||||
|
:
|
||||||
|
name_(dict.lookupOrDefault<word>("coupleGroup", ""))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::label Foam::coupleGroupIdentifier::findOtherPatchID
|
||||||
|
(
|
||||||
|
const polyPatch& thisPatch
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& pbm = thisPatch.boundaryMesh();
|
||||||
|
|
||||||
|
return findOtherPatchID(pbm.mesh(), thisPatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::label Foam::coupleGroupIdentifier::findOtherPatchID
|
||||||
|
(
|
||||||
|
const polyPatch& thisPatch,
|
||||||
|
word& otherRegion
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const polyBoundaryMesh& pbm = thisPatch.boundaryMesh();
|
||||||
|
const polyMesh& thisMesh = pbm.mesh();
|
||||||
|
const Time& runTime = thisMesh.time();
|
||||||
|
|
||||||
|
|
||||||
|
// Loop over all regions to find other patch in coupleGroup
|
||||||
|
HashTable<const polyMesh*> meshSet = runTime.lookupClass<polyMesh>();
|
||||||
|
|
||||||
|
label otherPatchID = -1;
|
||||||
|
|
||||||
|
forAllConstIter(HashTable<const polyMesh*>, meshSet, iter)
|
||||||
|
{
|
||||||
|
const polyMesh& mesh = *iter();
|
||||||
|
|
||||||
|
label patchID = findOtherPatchID(mesh, thisPatch);
|
||||||
|
|
||||||
|
if (patchID != -1)
|
||||||
|
{
|
||||||
|
if (otherPatchID != -1)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"coupleGroupIdentifier::findOtherPatchID"
|
||||||
|
"(const polyPatch&, word&) const"
|
||||||
|
) << "Couple patchGroup " << name()
|
||||||
|
<< " should be present on only two patches"
|
||||||
|
<< " in any of the meshes in " << meshSet.sortedToc()
|
||||||
|
<< endl
|
||||||
|
<< " It seems to be present on patch "
|
||||||
|
<< thisPatch.name()
|
||||||
|
<< " in region " << thisMesh.name()
|
||||||
|
<< ", on patch " << otherPatchID
|
||||||
|
<< " in region " << otherRegion
|
||||||
|
<< " and on patch " << patchID
|
||||||
|
<< " in region " << mesh.name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
otherPatchID = patchID;
|
||||||
|
otherRegion = mesh.name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (otherPatchID == -1)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"coupleGroupIdentifier::findOtherPatchID"
|
||||||
|
"(const polyPatch&, word&) const"
|
||||||
|
) << "Couple patchGroup " << name()
|
||||||
|
<< " not found in any of the other meshes " << meshSet.sortedToc()
|
||||||
|
<< " on patch " << thisPatch.name()
|
||||||
|
<< " region " << thisMesh.name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return otherPatchID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::coupleGroupIdentifier::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
if (valid())
|
||||||
|
{
|
||||||
|
os.writeKeyword("coupleGroup") << name() << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Ostream& Foam::operator<<(Ostream& os, const coupleGroupIdentifier& p)
|
||||||
|
{
|
||||||
|
p.write(os);
|
||||||
|
os.check("Ostream& operator<<(Ostream& os, const coupleGroupIdentifier& p");
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,128 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::coupleGroupIdentifier
|
||||||
|
|
||||||
|
Description
|
||||||
|
Encapsulates using patchGroups to specify coupled patch
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
coupleGroupIdentifierI.H
|
||||||
|
coupleGroupIdentifier.C
|
||||||
|
coupleGroupIdentifierIO.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef coupleGroupIdentifier_H
|
||||||
|
#define coupleGroupIdentifier_H
|
||||||
|
|
||||||
|
#include "word.H"
|
||||||
|
#include "label.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class dictionary;
|
||||||
|
class polyMesh;
|
||||||
|
class polyPatch;
|
||||||
|
class Ostream;
|
||||||
|
|
||||||
|
// Forward declaration of friend functions and operators
|
||||||
|
class coupleGroupIdentifier;
|
||||||
|
Ostream& operator<<(Ostream&, const coupleGroupIdentifier&);
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class coupleGroupIdentifier Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class coupleGroupIdentifier
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of patchGroup
|
||||||
|
word name_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Find other patch in specified mesh. Returns index of patch or -1.
|
||||||
|
label findOtherPatchID(const polyMesh&, const polyPatch&) const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
coupleGroupIdentifier();
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
coupleGroupIdentifier(const word& patchGroupName);
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
coupleGroupIdentifier(const dictionary&);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Name of patchGroup
|
||||||
|
inline const word& name() const;
|
||||||
|
|
||||||
|
//- Is a valid patchGroup
|
||||||
|
inline bool valid() const;
|
||||||
|
|
||||||
|
//- Find other patch in same region. Returns index of patch or -1.
|
||||||
|
label findOtherPatchID(const polyPatch&) const;
|
||||||
|
|
||||||
|
//- Find other patch and region. Returns index of patch and sets
|
||||||
|
// otherRegion to name of region. Fatal error if patch not found
|
||||||
|
label findOtherPatchID(const polyPatch&, word&) const;
|
||||||
|
|
||||||
|
//- Write the data as a dictionary
|
||||||
|
void write(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
|
// IOstream Operators
|
||||||
|
|
||||||
|
friend Ostream& operator<<(Ostream&, const coupleGroupIdentifier&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "coupleGroupIdentifierI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "coupleGroupIdentifier.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::word& Foam::coupleGroupIdentifier::name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::coupleGroupIdentifier::valid() const
|
||||||
|
{
|
||||||
|
return !name_.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -40,6 +40,7 @@ License
|
|||||||
#include "SubField.H"
|
#include "SubField.H"
|
||||||
#include "triPointRef.H"
|
#include "triPointRef.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
|
#include "treeDataCell.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -202,7 +203,7 @@ void Foam::mappedPatchBase::findSamples
|
|||||||
{
|
{
|
||||||
case NEARESTCELL:
|
case NEARESTCELL:
|
||||||
{
|
{
|
||||||
if (samplePatch_.size() && samplePatch_ != "none")
|
if (samplePatch().size() && samplePatch() != "none")
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
@ -213,14 +214,13 @@ void Foam::mappedPatchBase::findSamples
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Note: face-diagonal decomposition
|
//- Note: face-diagonal decomposition
|
||||||
const meshSearchMeshObject& meshSearchEngine =
|
const indexedOctree<Foam::treeDataCell>& tree = mesh.cellTree();
|
||||||
meshSearchMeshObject::New(mesh);
|
|
||||||
|
|
||||||
forAll(samples, sampleI)
|
forAll(samples, sampleI)
|
||||||
{
|
{
|
||||||
const point& sample = samples[sampleI];
|
const point& sample = samples[sampleI];
|
||||||
|
|
||||||
label cellI = meshSearchEngine.findCell(sample);
|
label cellI = tree.findInside(sample);
|
||||||
|
|
||||||
if (cellI == -1)
|
if (cellI == -1)
|
||||||
{
|
{
|
||||||
@ -391,7 +391,7 @@ void Foam::mappedPatchBase::findSamples
|
|||||||
|
|
||||||
case NEARESTFACE:
|
case NEARESTFACE:
|
||||||
{
|
{
|
||||||
if (samplePatch_.size() && samplePatch_ != "none")
|
if (samplePatch().size() && samplePatch() != "none")
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
@ -454,7 +454,7 @@ void Foam::mappedPatchBase::findSamples
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Info<< "mappedPatchBase::findSamples on mesh " << sampleRegion_
|
Info<< "mappedPatchBase::findSamples on mesh " << sampleRegion()
|
||||||
<< " : " << endl;
|
<< " : " << endl;
|
||||||
forAll(nearest, sampleI)
|
forAll(nearest, sampleI)
|
||||||
{
|
{
|
||||||
@ -516,8 +516,8 @@ void Foam::mappedPatchBase::calcMapping() const
|
|||||||
bool sampleMyself =
|
bool sampleMyself =
|
||||||
(
|
(
|
||||||
mode_ == NEARESTPATCHFACE
|
mode_ == NEARESTPATCHFACE
|
||||||
&& sampleRegion_ == patch_.boundaryMesh().mesh().name()
|
&& sampleRegion() == patch_.boundaryMesh().mesh().name()
|
||||||
&& samplePatch_ == patch_.name()
|
&& samplePatch() == patch_.name()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check offset
|
// Check offset
|
||||||
@ -544,9 +544,9 @@ void Foam::mappedPatchBase::calcMapping() const
|
|||||||
<< " 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
|
||||||
<< "patch_:" << patch_.name() << endl
|
<< "patch_:" << patch_.name() << endl
|
||||||
<< "sampleRegion_:" << sampleRegion_ << endl
|
<< "sampleRegion_:" << sampleRegion() << endl
|
||||||
<< "mode_:" << sampleModeNames_[mode_] << endl
|
<< "mode_:" << sampleModeNames_[mode_] << endl
|
||||||
<< "samplePatch_:" << samplePatch_ << endl
|
<< "samplePatch_:" << samplePatch() << endl
|
||||||
<< "offsetMode_:" << offsetModeNames_[offsetMode_] << endl;
|
<< "offsetMode_:" << offsetModeNames_[offsetMode_] << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,12 +604,10 @@ void Foam::mappedPatchBase::calcMapping() const
|
|||||||
<< " out of " << sampleProcs.size() << " total samples."
|
<< " out of " << sampleProcs.size() << " total samples."
|
||||||
<< " Sampling these on owner cell centre instead." << endl
|
<< " Sampling these on owner cell centre instead." << endl
|
||||||
<< "On patch " << patch_.name()
|
<< "On patch " << patch_.name()
|
||||||
<< " on region " << sampleRegion_
|
<< " on region " << sampleRegion()
|
||||||
<< " in mode " << sampleModeNames_[mode_] << endl
|
<< " in mode " << sampleModeNames_[mode_] << endl
|
||||||
<< "whilst sampling patch " << samplePatch_ << endl
|
<< "with offset mode " << offsetModeNames_[offsetMode_]
|
||||||
<< " with offset mode " << offsetModeNames_[offsetMode_]
|
<< ". Suppressing further warnings from " << type() << endl;
|
||||||
<< endl
|
|
||||||
<< "Suppressing further warnings from " << type() << endl;
|
|
||||||
|
|
||||||
hasWarned = true;
|
hasWarned = true;
|
||||||
}
|
}
|
||||||
@ -657,7 +655,7 @@ void Foam::mappedPatchBase::calcMapping() const
|
|||||||
// << " for proc:" << patchFaceProcs[i]
|
// << " for proc:" << patchFaceProcs[i]
|
||||||
// << " face:" << patchFaces[i]
|
// << " face:" << patchFaces[i]
|
||||||
// << " at:" << patchFc[i] << endl
|
// << " at:" << patchFc[i] << endl
|
||||||
// << "Found data in region " << sampleRegion_
|
// << "Found data in region " << sampleRegion()
|
||||||
// << " at proc:" << sampleProcs[i]
|
// << " at proc:" << sampleProcs[i]
|
||||||
// << " face:" << sampleIndices[i]
|
// << " face:" << sampleIndices[i]
|
||||||
// << " at:" << sampleLocations[i]
|
// << " at:" << sampleLocations[i]
|
||||||
@ -942,7 +940,8 @@ Foam::mappedPatchBase::mappedPatchBase
|
|||||||
patch_(pp),
|
patch_(pp),
|
||||||
sampleRegion_(patch_.boundaryMesh().mesh().name()),
|
sampleRegion_(patch_.boundaryMesh().mesh().name()),
|
||||||
mode_(NEARESTPATCHFACE),
|
mode_(NEARESTPATCHFACE),
|
||||||
samplePatch_("none"),
|
samplePatch_(""),
|
||||||
|
coupleGroup_(),
|
||||||
offsetMode_(UNIFORM),
|
offsetMode_(UNIFORM),
|
||||||
offset_(vector::zero),
|
offset_(vector::zero),
|
||||||
offsets_(pp.size(), offset_),
|
offsets_(pp.size(), offset_),
|
||||||
@ -969,6 +968,7 @@ Foam::mappedPatchBase::mappedPatchBase
|
|||||||
sampleRegion_(sampleRegion),
|
sampleRegion_(sampleRegion),
|
||||||
mode_(mode),
|
mode_(mode),
|
||||||
samplePatch_(samplePatch),
|
samplePatch_(samplePatch),
|
||||||
|
coupleGroup_(),
|
||||||
offsetMode_(NONUNIFORM),
|
offsetMode_(NONUNIFORM),
|
||||||
offset_(vector::zero),
|
offset_(vector::zero),
|
||||||
offsets_(offsets),
|
offsets_(offsets),
|
||||||
@ -995,6 +995,7 @@ Foam::mappedPatchBase::mappedPatchBase
|
|||||||
sampleRegion_(sampleRegion),
|
sampleRegion_(sampleRegion),
|
||||||
mode_(mode),
|
mode_(mode),
|
||||||
samplePatch_(samplePatch),
|
samplePatch_(samplePatch),
|
||||||
|
coupleGroup_(),
|
||||||
offsetMode_(UNIFORM),
|
offsetMode_(UNIFORM),
|
||||||
offset_(offset),
|
offset_(offset),
|
||||||
offsets_(0),
|
offsets_(0),
|
||||||
@ -1021,6 +1022,7 @@ Foam::mappedPatchBase::mappedPatchBase
|
|||||||
sampleRegion_(sampleRegion),
|
sampleRegion_(sampleRegion),
|
||||||
mode_(mode),
|
mode_(mode),
|
||||||
samplePatch_(samplePatch),
|
samplePatch_(samplePatch),
|
||||||
|
coupleGroup_(),
|
||||||
offsetMode_(NORMAL),
|
offsetMode_(NORMAL),
|
||||||
offset_(vector::zero),
|
offset_(vector::zero),
|
||||||
offsets_(0),
|
offsets_(0),
|
||||||
@ -1041,16 +1043,10 @@ Foam::mappedPatchBase::mappedPatchBase
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
patch_(pp),
|
patch_(pp),
|
||||||
sampleRegion_
|
sampleRegion_(dict.lookupOrDefault<word>("sampleRegion", "")),
|
||||||
(
|
|
||||||
dict.lookupOrDefault
|
|
||||||
(
|
|
||||||
"sampleRegion",
|
|
||||||
patch_.boundaryMesh().mesh().name()
|
|
||||||
)
|
|
||||||
),
|
|
||||||
mode_(sampleModeNames_.read(dict.lookup("sampleMode"))),
|
mode_(sampleModeNames_.read(dict.lookup("sampleMode"))),
|
||||||
samplePatch_(dict.lookup("samplePatch")),
|
samplePatch_(dict.lookupOrDefault<word>("samplePatch", "")),
|
||||||
|
coupleGroup_(dict),
|
||||||
offsetMode_(UNIFORM),
|
offsetMode_(UNIFORM),
|
||||||
offset_(vector::zero),
|
offset_(vector::zero),
|
||||||
offsets_(0),
|
offsets_(0),
|
||||||
@ -1062,6 +1058,16 @@ Foam::mappedPatchBase::mappedPatchBase
|
|||||||
surfPtr_(NULL),
|
surfPtr_(NULL),
|
||||||
surfDict_(dict.subOrEmptyDict("surface"))
|
surfDict_(dict.subOrEmptyDict("surface"))
|
||||||
{
|
{
|
||||||
|
if (!coupleGroup_.valid())
|
||||||
|
{
|
||||||
|
if (sampleRegion_.empty())
|
||||||
|
{
|
||||||
|
// If no coupleGroup and no sampleRegion assume local region
|
||||||
|
sampleRegion_ = patch_.boundaryMesh().mesh().name();
|
||||||
|
sameRegion_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dict.found("offsetMode"))
|
if (dict.found("offsetMode"))
|
||||||
{
|
{
|
||||||
offsetMode_ = offsetModeNames_.read(dict.lookup("offsetMode"));
|
offsetMode_ = offsetModeNames_.read(dict.lookup("offsetMode"));
|
||||||
@ -1099,7 +1105,7 @@ Foam::mappedPatchBase::mappedPatchBase
|
|||||||
//offsets_ = pointField(dict.lookup("offsets"));
|
//offsets_ = pointField(dict.lookup("offsets"));
|
||||||
offsets_ = readListOrField("offsets", dict, patch_.size());
|
offsets_ = readListOrField("offsets", dict, patch_.size());
|
||||||
}
|
}
|
||||||
else
|
else if (mode_ != NEARESTPATCHFACE && mode_ != NEARESTPATCHFACEAMI)
|
||||||
{
|
{
|
||||||
FatalIOErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
@ -1116,6 +1122,60 @@ Foam::mappedPatchBase::mappedPatchBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPatchBase::mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const sampleMode mode,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(pp),
|
||||||
|
sampleRegion_(dict.lookupOrDefault<word>("sampleRegion", "")),
|
||||||
|
mode_(mode),
|
||||||
|
samplePatch_(dict.lookupOrDefault<word>("samplePatch", "")),
|
||||||
|
coupleGroup_(dict), //dict.lookupOrDefault<word>("coupleGroup", "")),
|
||||||
|
offsetMode_(UNIFORM),
|
||||||
|
offset_(vector::zero),
|
||||||
|
offsets_(0),
|
||||||
|
distance_(0.0),
|
||||||
|
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
|
||||||
|
mapPtr_(NULL),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dict.subOrEmptyDict("surface"))
|
||||||
|
{
|
||||||
|
if (mode != NEARESTPATCHFACE && mode != NEARESTPATCHFACEAMI)
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"mappedPatchBase::mappedPatchBase\n"
|
||||||
|
"(\n"
|
||||||
|
" const polyPatch&,\n"
|
||||||
|
" const sampleMode,\n"
|
||||||
|
" const dictionary&\n"
|
||||||
|
")\n",
|
||||||
|
dict
|
||||||
|
) << "Construct from sampleMode and dictionary only applicable for "
|
||||||
|
<< " collocated patches in modes "
|
||||||
|
<< sampleModeNames_[NEARESTPATCHFACE] << ','
|
||||||
|
<< sampleModeNames_[NEARESTPATCHFACEAMI]
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!coupleGroup_.valid())
|
||||||
|
{
|
||||||
|
if (sampleRegion_.empty())
|
||||||
|
{
|
||||||
|
// If no coupleGroup and no sampleRegion assume local region
|
||||||
|
sampleRegion_ = patch_.boundaryMesh().mesh().name();
|
||||||
|
sameRegion_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::mappedPatchBase::mappedPatchBase
|
Foam::mappedPatchBase::mappedPatchBase
|
||||||
(
|
(
|
||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
@ -1126,6 +1186,7 @@ Foam::mappedPatchBase::mappedPatchBase
|
|||||||
sampleRegion_(mpb.sampleRegion_),
|
sampleRegion_(mpb.sampleRegion_),
|
||||||
mode_(mpb.mode_),
|
mode_(mpb.mode_),
|
||||||
samplePatch_(mpb.samplePatch_),
|
samplePatch_(mpb.samplePatch_),
|
||||||
|
coupleGroup_(mpb.coupleGroup_),
|
||||||
offsetMode_(mpb.offsetMode_),
|
offsetMode_(mpb.offsetMode_),
|
||||||
offset_(mpb.offset_),
|
offset_(mpb.offset_),
|
||||||
offsets_(mpb.offsets_),
|
offsets_(mpb.offsets_),
|
||||||
@ -1150,6 +1211,7 @@ Foam::mappedPatchBase::mappedPatchBase
|
|||||||
sampleRegion_(mpb.sampleRegion_),
|
sampleRegion_(mpb.sampleRegion_),
|
||||||
mode_(mpb.mode_),
|
mode_(mpb.mode_),
|
||||||
samplePatch_(mpb.samplePatch_),
|
samplePatch_(mpb.samplePatch_),
|
||||||
|
coupleGroup_(mpb.coupleGroup_),
|
||||||
offsetMode_(mpb.offsetMode_),
|
offsetMode_(mpb.offsetMode_),
|
||||||
offset_(mpb.offset_),
|
offset_(mpb.offset_),
|
||||||
offsets_
|
offsets_
|
||||||
@ -1190,7 +1252,7 @@ const Foam::polyMesh& Foam::mappedPatchBase::sampleMesh() const
|
|||||||
{
|
{
|
||||||
return patch_.boundaryMesh().mesh().time().lookupObject<polyMesh>
|
return patch_.boundaryMesh().mesh().time().lookupObject<polyMesh>
|
||||||
(
|
(
|
||||||
sampleRegion_
|
sampleRegion()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1199,12 +1261,12 @@ const Foam::polyPatch& Foam::mappedPatchBase::samplePolyPatch() const
|
|||||||
{
|
{
|
||||||
const polyMesh& nbrMesh = sampleMesh();
|
const polyMesh& nbrMesh = sampleMesh();
|
||||||
|
|
||||||
const label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch_);
|
const label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch());
|
||||||
|
|
||||||
if (patchI == -1)
|
if (patchI == -1)
|
||||||
{
|
{
|
||||||
FatalErrorIn("mappedPatchBase::samplePolyPatch()")
|
FatalErrorIn("mappedPatchBase::samplePolyPatch()")
|
||||||
<< "Cannot find patch " << samplePatch_
|
<< "Cannot find patch " << samplePatch()
|
||||||
<< " in region " << sampleRegion_ << endl
|
<< " in region " << sampleRegion_ << endl
|
||||||
<< "Valid patches are " << nbrMesh.boundaryMesh().names()
|
<< "Valid patches are " << nbrMesh.boundaryMesh().names()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -1340,46 +1402,60 @@ void Foam::mappedPatchBase::write(Ostream& os) const
|
|||||||
{
|
{
|
||||||
os.writeKeyword("sampleMode") << sampleModeNames_[mode_]
|
os.writeKeyword("sampleMode") << sampleModeNames_[mode_]
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("sampleRegion") << sampleRegion_
|
os.writeKeyword("sampleRegion") << sampleRegion()
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("samplePatch") << samplePatch_
|
os.writeKeyword("samplePatch") << samplePatch()
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
|
coupleGroup_.write(os);
|
||||||
|
|
||||||
os.writeKeyword("offsetMode") << offsetModeNames_[offsetMode_]
|
if
|
||||||
<< token::END_STATEMENT << nl;
|
(
|
||||||
|
offsetMode_ == UNIFORM
|
||||||
switch (offsetMode_)
|
&& offset_ == vector::zero
|
||||||
|
&& (mode_ == NEARESTPATCHFACE || mode_ == NEARESTPATCHFACEAMI)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
case UNIFORM:
|
// Collocated mode. No need to write offset data
|
||||||
{
|
|
||||||
os.writeKeyword("offset") << offset_ << token::END_STATEMENT << nl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case NONUNIFORM:
|
|
||||||
{
|
|
||||||
offsets_.writeEntry("offsets", os);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case NORMAL:
|
|
||||||
{
|
|
||||||
os.writeKeyword("distance") << distance_ << token::END_STATEMENT
|
|
||||||
<< nl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (mode_ == NEARESTPATCHFACEAMI)
|
|
||||||
{
|
{
|
||||||
if (AMIReverse_)
|
os.writeKeyword("offsetMode") << offsetModeNames_[offsetMode_]
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
switch (offsetMode_)
|
||||||
{
|
{
|
||||||
os.writeKeyword("flipNormals") << AMIReverse_
|
case UNIFORM:
|
||||||
<< token::END_STATEMENT << nl;
|
{
|
||||||
|
os.writeKeyword("offset") << offset_ << token::END_STATEMENT
|
||||||
|
<< nl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NONUNIFORM:
|
||||||
|
{
|
||||||
|
offsets_.writeEntry("offsets", os);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NORMAL:
|
||||||
|
{
|
||||||
|
os.writeKeyword("distance") << distance_ << token::END_STATEMENT
|
||||||
|
<< nl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!surfDict_.empty())
|
if (mode_ == NEARESTPATCHFACEAMI)
|
||||||
{
|
{
|
||||||
os.writeKeyword(surfDict_.dictName());
|
if (AMIReverse_)
|
||||||
os << surfDict_;
|
{
|
||||||
|
os.writeKeyword("flipNormals") << AMIReverse_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!surfDict_.empty())
|
||||||
|
{
|
||||||
|
os.writeKeyword(surfDict_.dictName());
|
||||||
|
os << surfDict_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,9 +45,13 @@ Description
|
|||||||
// beforehand)
|
// beforehand)
|
||||||
sampleMode nearestCell;
|
sampleMode nearestCell;
|
||||||
|
|
||||||
// If sampleMod is nearestPatchFace : patch to find faces of
|
// If sampleMode is nearestPatchFace : patch to find faces of
|
||||||
samplePatch movingWall;
|
samplePatch movingWall;
|
||||||
|
|
||||||
|
// If sampleMode is nearestPatchFace : specify patchgroup to find
|
||||||
|
// samplePatch and sampleRegion (if not provided)
|
||||||
|
coupleGroup baffleGroup;
|
||||||
|
|
||||||
// How to supply offset (w.r.t. my patch face centres):
|
// How to supply offset (w.r.t. my patch face centres):
|
||||||
// - uniform : single offset vector
|
// - uniform : single offset vector
|
||||||
// - nonuniform : per-face offset vector
|
// - nonuniform : per-face offset vector
|
||||||
@ -78,6 +82,7 @@ SourceFiles
|
|||||||
#include "Tuple2.H"
|
#include "Tuple2.H"
|
||||||
#include "pointIndexHit.H"
|
#include "pointIndexHit.H"
|
||||||
#include "AMIPatchToPatchInterpolation.H"
|
#include "AMIPatchToPatchInterpolation.H"
|
||||||
|
#include "coupleGroupIdentifier.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -180,13 +185,16 @@ protected:
|
|||||||
const polyPatch& patch_;
|
const polyPatch& patch_;
|
||||||
|
|
||||||
//- Region to sample
|
//- Region to sample
|
||||||
const word sampleRegion_;
|
mutable word sampleRegion_;
|
||||||
|
|
||||||
//- What to sample
|
//- What to sample
|
||||||
const sampleMode mode_;
|
const sampleMode mode_;
|
||||||
|
|
||||||
//- Patch (if in sampleMode NEARESTPATCH*)
|
//- Patch (if in sampleMode NEARESTPATCH*)
|
||||||
const word samplePatch_;
|
mutable word samplePatch_;
|
||||||
|
|
||||||
|
//- PatchGroup (if in sampleMode NEARESTPATCH*)
|
||||||
|
const coupleGroupIdentifier coupleGroup_;
|
||||||
|
|
||||||
//- How to obtain samples
|
//- How to obtain samples
|
||||||
offsetMode offsetMode_;
|
offsetMode offsetMode_;
|
||||||
@ -201,7 +209,7 @@ protected:
|
|||||||
scalar distance_;
|
scalar distance_;
|
||||||
|
|
||||||
//- Same region
|
//- Same region
|
||||||
const bool sameRegion_;
|
mutable bool sameRegion_;
|
||||||
|
|
||||||
|
|
||||||
// Derived information
|
// Derived information
|
||||||
@ -315,6 +323,11 @@ public:
|
|||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
mappedPatchBase(const polyPatch&, const dictionary&);
|
mappedPatchBase(const polyPatch&, const dictionary&);
|
||||||
|
|
||||||
|
//- Construct from dictionary and (collocated) sample mode
|
||||||
|
// (only for nearestPatchFace, nearestPatchFaceAMI, nearestPatchPoint)
|
||||||
|
// Assumes zero offset.
|
||||||
|
mappedPatchBase(const polyPatch&, const sampleMode, const dictionary&);
|
||||||
|
|
||||||
//- Construct as copy, resetting patch
|
//- Construct as copy, resetting patch
|
||||||
mappedPatchBase(const polyPatch&, const mappedPatchBase&);
|
mappedPatchBase(const polyPatch&, const mappedPatchBase&);
|
||||||
|
|
||||||
@ -346,6 +359,9 @@ public:
|
|||||||
//- Patch (only if NEARESTPATCHFACE)
|
//- Patch (only if NEARESTPATCHFACE)
|
||||||
inline const word& samplePatch() const;
|
inline const word& samplePatch() const;
|
||||||
|
|
||||||
|
//- PatchGroup (only if NEARESTPATCHFACE)
|
||||||
|
inline const word& coupleGroup() const;
|
||||||
|
|
||||||
//- Return size of mapped mesh/patch/boundary
|
//- Return size of mapped mesh/patch/boundary
|
||||||
inline label sampleSize() const;
|
inline label sampleSize() const;
|
||||||
|
|
||||||
|
|||||||
@ -32,16 +32,62 @@ Foam::mappedPatchBase::mode() const
|
|||||||
|
|
||||||
inline const Foam::word& Foam::mappedPatchBase::sampleRegion() const
|
inline const Foam::word& Foam::mappedPatchBase::sampleRegion() const
|
||||||
{
|
{
|
||||||
|
if (sampleRegion_.empty())
|
||||||
|
{
|
||||||
|
if (!coupleGroup_.valid())
|
||||||
|
{
|
||||||
|
FatalErrorIn("mappedPatchBase::sampleRegion()")
|
||||||
|
<< "Supply either a regionName or a coupleGroup"
|
||||||
|
<< " for patch " << patch_.name()
|
||||||
|
<< " in region " << patch_.boundaryMesh().mesh().name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try and use patchGroup to find samplePatch and sampleRegion
|
||||||
|
label samplePatchID = coupleGroup_.findOtherPatchID
|
||||||
|
(
|
||||||
|
patch_,
|
||||||
|
sampleRegion_
|
||||||
|
);
|
||||||
|
|
||||||
|
samplePatch_ = sampleMesh().boundaryMesh()[samplePatchID].name();
|
||||||
|
}
|
||||||
return sampleRegion_;
|
return sampleRegion_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::word& Foam::mappedPatchBase::samplePatch() const
|
inline const Foam::word& Foam::mappedPatchBase::samplePatch() const
|
||||||
{
|
{
|
||||||
|
if (samplePatch_.empty())
|
||||||
|
{
|
||||||
|
if (!coupleGroup_.valid())
|
||||||
|
{
|
||||||
|
FatalErrorIn("mappedPatchBase::samplePolyPatch()")
|
||||||
|
<< "Supply either a patchName or a coupleGroup"
|
||||||
|
<< " for patch " << patch_.name()
|
||||||
|
<< " in region " << patch_.boundaryMesh().mesh().name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try and use patchGroup to find samplePatch and sampleRegion
|
||||||
|
label samplePatchID = coupleGroup_.findOtherPatchID
|
||||||
|
(
|
||||||
|
patch_,
|
||||||
|
sampleRegion_
|
||||||
|
);
|
||||||
|
|
||||||
|
samplePatch_ = sampleMesh().boundaryMesh()[samplePatchID].name();
|
||||||
|
}
|
||||||
return samplePatch_;
|
return samplePatch_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::word& Foam::mappedPatchBase::coupleGroup() const
|
||||||
|
{
|
||||||
|
return coupleGroup_.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::mappedPatchBase::sampleSize() const
|
inline Foam::label Foam::mappedPatchBase::sampleSize() const
|
||||||
{
|
{
|
||||||
switch (mode_)
|
switch (mode_)
|
||||||
|
|||||||
@ -396,10 +396,7 @@ Foam::labelList Foam::tetOverlapVolume::overlappingCells
|
|||||||
{
|
{
|
||||||
const indexedOctree<treeDataCell>& treeA = fromMesh.cellTree();
|
const indexedOctree<treeDataCell>& treeA = fromMesh.cellTree();
|
||||||
|
|
||||||
treeBoundBox bbB
|
treeBoundBox bbB(toMesh.points(), toMesh.cellPoints()[iTo]);
|
||||||
(
|
|
||||||
pointField(toMesh.points(), toMesh.cellPoints()[iTo])
|
|
||||||
);
|
|
||||||
|
|
||||||
return treeA.findBox(bbB);
|
return treeA.findBox(bbB);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,14 +84,7 @@ bool Foam::meshToMeshMethod::intersect
|
|||||||
|
|
||||||
tetOverlapVolume overlapEngine;
|
tetOverlapVolume overlapEngine;
|
||||||
|
|
||||||
treeBoundBox bbTgtCell
|
treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCellI]);
|
||||||
(
|
|
||||||
pointField
|
|
||||||
(
|
|
||||||
tgt_.points(),
|
|
||||||
tgt_.cellPoints()[tgtCellI]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
return overlapEngine.cellCellOverlapMinDecomp
|
return overlapEngine.cellCellOverlapMinDecomp
|
||||||
(
|
(
|
||||||
@ -113,14 +106,7 @@ Foam::scalar Foam::meshToMeshMethod::interVol
|
|||||||
{
|
{
|
||||||
tetOverlapVolume overlapEngine;
|
tetOverlapVolume overlapEngine;
|
||||||
|
|
||||||
treeBoundBox bbTgtCell
|
treeBoundBox bbTgtCell(tgt_.points(), tgt_.cellPoints()[tgtCellI]);
|
||||||
(
|
|
||||||
pointField
|
|
||||||
(
|
|
||||||
tgt_.points(),
|
|
||||||
tgt_.cellPoints()[tgtCellI]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
scalar vol = overlapEngine.cellCellOverlapVolumeMinDecomp
|
scalar vol = overlapEngine.cellCellOverlapVolumeMinDecomp
|
||||||
(
|
(
|
||||||
|
|||||||
@ -104,7 +104,7 @@ bool Foam::triSurface::readOBJ(const fileName& OBJfileName)
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
string::size_type startNum =
|
string::size_type startNum =
|
||||||
line.find_first_not_of(' ', endNum);
|
line.find_first_not_of(" \r", endNum);
|
||||||
|
|
||||||
if (startNum == string::npos)
|
if (startNum == string::npos)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -93,14 +93,7 @@ thermalBaffle1DFvPatchScalarField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mappedPatchBase
|
mappedPatchBase(p.patch(), NEARESTPATCHFACE, dict),
|
||||||
(
|
|
||||||
p.patch(),
|
|
||||||
p.boundaryMesh().mesh().name(),
|
|
||||||
NEARESTPATCHFACE,
|
|
||||||
dict.lookup("samplePatch"),
|
|
||||||
0.0
|
|
||||||
),
|
|
||||||
mixedFvPatchScalarField(p, iF),
|
mixedFvPatchScalarField(p, iF),
|
||||||
TName_("T"),
|
TName_("T"),
|
||||||
baffleActivated_(dict.lookupOrDefault<bool>("baffleActivated", true)),
|
baffleActivated_(dict.lookupOrDefault<bool>("baffleActivated", true)),
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
T
|
T
|
||||||
{
|
{
|
||||||
type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
|
type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
|
||||||
samplePatch baffle1DWall_slave;
|
|
||||||
|
|
||||||
thickness uniform 0.005; // thickness [m]
|
thickness uniform 0.005; // thickness [m]
|
||||||
Qs uniform 100; // heat flux [W/m2]
|
Qs uniform 100; // heat flux [W/m2]
|
||||||
|
|||||||
@ -29,35 +29,13 @@ baffles
|
|||||||
surface triSurfaceMesh;
|
surface triSurfaceMesh;
|
||||||
name baffle1D.stl;
|
name baffle1D.stl;
|
||||||
|
|
||||||
patches
|
patchPairs
|
||||||
{
|
{
|
||||||
master
|
type wall;
|
||||||
|
patchFields
|
||||||
{
|
{
|
||||||
//- Master side patch
|
#include "./0/include/wallBafflePatches"
|
||||||
name baffle1DWall_master;
|
#include "./0/include/1DBaffle/1DTemperatureMasterBafflePatches"
|
||||||
|
|
||||||
type wall;
|
|
||||||
inGroups (baffleWallGroup);
|
|
||||||
|
|
||||||
patchFields
|
|
||||||
{
|
|
||||||
#include "./0/include/wallBafflePatches"
|
|
||||||
#include "./0/include/1DBaffle/1DTemperatureMasterBafflePatches"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
slave
|
|
||||||
{
|
|
||||||
//- Slave side patch
|
|
||||||
name baffle1DWall_slave;
|
|
||||||
|
|
||||||
type wall;
|
|
||||||
inGroups (baffleWallGroup);
|
|
||||||
|
|
||||||
patchFields
|
|
||||||
{
|
|
||||||
#include "./0/include/wallBafflePatches"
|
|
||||||
#include "./0/include/1DBaffle/1DTemperatureSlaveBafflePatches"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,10 +56,7 @@ baffles
|
|||||||
name ${masterPatchName};
|
name ${masterPatchName};
|
||||||
|
|
||||||
type mappedWall;
|
type mappedWall;
|
||||||
|
inGroups (baffleWallGroup);
|
||||||
|
|
||||||
type interRegionMappedWallGenerator;
|
|
||||||
inGroups (baffleWallGroup);
|
|
||||||
|
|
||||||
sampleMode nearestPatchFace;
|
sampleMode nearestPatchFace;
|
||||||
sampleRegion ${baffleRegionName};
|
sampleRegion ${baffleRegionName};
|
||||||
|
|||||||
Reference in New Issue
Block a user