Revert to latest version of fluentMeshToFoam
Add faunctionality in preservePatchTypes to ensure full compatibility
This commit is contained in:
parent
076f585742
commit
941969a78b
3 changed files with 165 additions and 86 deletions
|
@ -46,6 +46,7 @@ Description
|
||||||
#include "emptyPolyPatch.H"
|
#include "emptyPolyPatch.H"
|
||||||
#include "wallPolyPatch.H"
|
#include "wallPolyPatch.H"
|
||||||
#include "symmetryPolyPatch.H"
|
#include "symmetryPolyPatch.H"
|
||||||
|
#include "preservePatchTypes.H"
|
||||||
#include "cellShape.H"
|
#include "cellShape.H"
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
|
@ -131,7 +132,7 @@ quote \"
|
||||||
dash "-"
|
dash "-"
|
||||||
dotColonDash [.:-]
|
dotColonDash [.:-]
|
||||||
|
|
||||||
schemeSpecialInitial [!$%&*/:<=>?~_^#.]
|
schemeSpecialInitial [!$%&*/\\:<=>?~_^#.@']
|
||||||
schemeSpecialSubsequent [.+-]
|
schemeSpecialSubsequent [.+-]
|
||||||
schemeSymbol (({some_space}|{alpha}|{quote}|{schemeSpecialInitial})({alpha}|{quote}|{digit}|{schemeSpecialInitial}|{schemeSpecialSubsequent})*)
|
schemeSymbol (({some_space}|{alpha}|{quote}|{schemeSpecialInitial})({alpha}|{quote}|{digit}|{schemeSpecialInitial}|{schemeSpecialSubsequent})*)
|
||||||
|
|
||||||
|
@ -141,7 +142,7 @@ integer {decDigit}+
|
||||||
label [1-9]{decDigit}*
|
label [1-9]{decDigit}*
|
||||||
hexLabel {hexDigit}+
|
hexLabel {hexDigit}+
|
||||||
zeroLabel {digit}*
|
zeroLabel {digit}*
|
||||||
|
signedInteger [-+]?{integer}
|
||||||
word ({alpha}|{digit}|{dotColonDash})*
|
word ({alpha}|{digit}|{dotColonDash})*
|
||||||
|
|
||||||
exponent_part [eE][-+]?{digit}+
|
exponent_part [eE][-+]?{digit}+
|
||||||
|
@ -251,9 +252,9 @@ endOfSection {space}")"{space}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- *\
|
/* ------------------------------------------------------------------------ *\
|
||||||
------ Start Lexing ------
|
------ Start Lexing ------
|
||||||
\* ------------------------------------------------------------------------- */
|
\* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
/* ------ Reading control header ------ */
|
/* ------ Reading control header ------ */
|
||||||
|
|
||||||
|
@ -765,7 +766,6 @@ endOfSection {space}")"{space}
|
||||||
}
|
}
|
||||||
|
|
||||||
<readZoneBlock>{lbrac} {
|
<readZoneBlock>{lbrac} {
|
||||||
Info<< "Found unknown block in zone:" << YYText() << endl;
|
|
||||||
yy_push_state(unknownBlock);
|
yy_push_state(unknownBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,7 +785,6 @@ endOfSection {space}")"{space}
|
||||||
|
|
||||||
|
|
||||||
{lbrac}{label} {
|
{lbrac}{label} {
|
||||||
Info<< "Found unknown block:" << YYText() << endl;
|
|
||||||
yy_push_state(unknownBlock);
|
yy_push_state(unknownBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,13 +792,11 @@ endOfSection {space}")"{space}
|
||||||
}
|
}
|
||||||
|
|
||||||
<readComment,unknownBlock,embeddedUnknownBlock>{spaceNl}{lbrac} {
|
<readComment,unknownBlock,embeddedUnknownBlock>{spaceNl}{lbrac} {
|
||||||
Info<< "Embedded blocks in comment or unknown:" << YYText() << endl;
|
|
||||||
yy_push_state(embeddedUnknownBlock);
|
yy_push_state(embeddedUnknownBlock);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<readComment,unknownBlock,embeddedUnknownBlock>{spaceNl}{endOfSection} {
|
<readComment,unknownBlock,embeddedUnknownBlock>{spaceNl}{endOfSection} {
|
||||||
Info<< "Found end of section in unknown:" << YYText() << endl;
|
|
||||||
yy_pop_state();
|
yy_pop_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1002,7 +999,7 @@ int main(int argc, char *argv[])
|
||||||
// Note: In order for the owner-neighbour rules to be right, the
|
// Note: In order for the owner-neighbour rules to be right, the
|
||||||
// points given by Fluent need to represent the FRONT plane of the
|
// points given by Fluent need to represent the FRONT plane of the
|
||||||
// geometry. Therefore, the extrusion will be in -z direction
|
// geometry. Therefore, the extrusion will be in -z direction
|
||||||
//
|
|
||||||
forAll (oldPoints, pointI)
|
forAll (oldPoints, pointI)
|
||||||
{
|
{
|
||||||
points[nNewPoints] = oldPoints[pointI];
|
points[nNewPoints] = oldPoints[pointI];
|
||||||
|
@ -1071,7 +1068,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorIn("fluentToFoam::main(int argc, char *argv[])")
|
FatalErrorIn(args.executable())
|
||||||
<< "unrecognised 2-D cell shape: "
|
<< "unrecognised 2-D cell shape: "
|
||||||
<< fluentCellModelID[celli]
|
<< fluentCellModelID[celli]
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -1085,7 +1082,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (faces[faceI].size() != 2)
|
if (faces[faceI].size() != 2)
|
||||||
{
|
{
|
||||||
FatalErrorIn("fluentToFoam::main(int argc, char *argv[])")
|
FatalErrorIn(args.executable())
|
||||||
<< "fluentMeshToFoam: a 2-D face defined with "
|
<< "fluentMeshToFoam: a 2-D face defined with "
|
||||||
<< faces[faceI].size() << " points." << endl;
|
<< faces[faceI].size() << " points." << endl;
|
||||||
}
|
}
|
||||||
|
@ -1131,7 +1128,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorIn("fluentToFoam::main(int argc, char *argv[])")
|
FatalErrorIn(args.executable())
|
||||||
<< "unrecognised 3-D cell shape: "
|
<< "unrecognised 3-D cell shape: "
|
||||||
<< fluentCellModelID[celli]
|
<< fluentCellModelID[celli]
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -1231,7 +1228,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
label nPatches = 0;
|
label nPatches = 0;
|
||||||
|
|
||||||
// colate information for all patches (internal and external)
|
// Colate information for all patches (internal and external)
|
||||||
|
|
||||||
// Create a file listing patch type for each zone
|
// Create a file listing patch type for each zone
|
||||||
|
|
||||||
|
@ -1274,7 +1271,7 @@ int main(int argc, char *argv[])
|
||||||
++faceGroupEndIndexIter
|
++faceGroupEndIndexIter
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// get face type and name
|
// Get face type and name
|
||||||
const word& curPatchType = patchTypeIDs[faceGroupZoneIDIter()];
|
const word& curPatchType = patchTypeIDs[faceGroupZoneIDIter()];
|
||||||
|
|
||||||
const word& curPatchName = patchNameIDs[faceGroupZoneIDIter()];
|
const word& curPatchName = patchNameIDs[faceGroupZoneIDIter()];
|
||||||
|
@ -1285,10 +1282,10 @@ int main(int argc, char *argv[])
|
||||||
<< " end: " << faceGroupEndIndexIter()
|
<< " end: " << faceGroupEndIndexIter()
|
||||||
<< " type: " << curPatchType << " name: " << curPatchName << endl;
|
<< " type: " << curPatchType << " name: " << curPatchName << endl;
|
||||||
|
|
||||||
// record zone index
|
// Record zone index
|
||||||
zoneToPatchName[faceGroupZoneIDIter()] = curPatchName;
|
zoneToPatchName[faceGroupZoneIDIter()] = curPatchName;
|
||||||
|
|
||||||
// make patch labels
|
// Make patch labels
|
||||||
label faceLabel = faceGroupStartIndexIter() - 1;
|
label faceLabel = faceGroupStartIndexIter() - 1;
|
||||||
|
|
||||||
faceList patchFaces(faceGroupEndIndexIter() - faceLabel);
|
faceList patchFaces(faceGroupEndIndexIter() - faceLabel);
|
||||||
|
@ -1313,7 +1310,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//inlets and outlets
|
// Inlets and outlets
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
curPatchType == "pressure"
|
curPatchType == "pressure"
|
||||||
|
@ -1378,7 +1375,7 @@ int main(int argc, char *argv[])
|
||||||
else if
|
else if
|
||||||
(
|
(
|
||||||
curPatchType == ""
|
curPatchType == ""
|
||||||
) //unnamed face regions default to interior patches
|
) // Unnamed face regions default to interior patches
|
||||||
{
|
{
|
||||||
Info<< "Patch " << faceGroupZoneIDIter()
|
Info<< "Patch " << faceGroupZoneIDIter()
|
||||||
<< ": Faces are defined but "
|
<< ": Faces are defined but "
|
||||||
|
@ -1394,7 +1391,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
else //unknown face regions are not handled
|
else //unknown face regions are not handled
|
||||||
{
|
{
|
||||||
FatalErrorIn("fluentToFoam::main(int argc, char *argv[])")
|
FatalErrorIn(args.executable())
|
||||||
<< "fluent patch type " << curPatchType << " not recognised."
|
<< "fluent patch type " << curPatchType << " not recognised."
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
@ -1439,12 +1436,25 @@ int main(int argc, char *argv[])
|
||||||
label sz = bFaces.size();
|
label sz = bFaces.size();
|
||||||
labelList meshFaces(sz,-1);
|
labelList meshFaces(sz,-1);
|
||||||
|
|
||||||
// Search faces by point matching
|
|
||||||
|
//make face set and write (seperate from rest for clarity)
|
||||||
|
//internal and external Fluent boundaries
|
||||||
|
{
|
||||||
|
faceSet pFaceSet(pShapeMesh, patchNames[patchI], sz);
|
||||||
|
|
||||||
forAll (bFaces, j)
|
forAll (bFaces, j)
|
||||||
{
|
{
|
||||||
const face& f = bFaces[j];
|
const face& f = bFaces[j];
|
||||||
label cMeshFace = findFace(pShapeMesh, f);
|
label cMeshFace = findFace(pShapeMesh, f);
|
||||||
meshFaces[j] = cMeshFace;
|
meshFaces[j] = cMeshFace;
|
||||||
|
pFaceSet.insert(cMeshFace);
|
||||||
|
}
|
||||||
|
if (writeSets)
|
||||||
|
{
|
||||||
|
Info<< "Writing patch " << patchNames[patchI]
|
||||||
|
<< " of size " << sz << " to faceSet." << endl;
|
||||||
|
pFaceSet.write();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1461,7 +1471,7 @@ int main(int argc, char *argv[])
|
||||||
&& !pShapeMesh.isInternalFace(meshFaces[0])
|
&& !pShapeMesh.isInternalFace(meshFaces[0])
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//first face is external and has valid non-internal type
|
// First face is external and has valid non-internal type
|
||||||
|
|
||||||
//check all faces for externalness just to be sure
|
//check all faces for externalness just to be sure
|
||||||
//and mark patch number to global list
|
//and mark patch number to global list
|
||||||
|
@ -1491,7 +1501,7 @@ int main(int argc, char *argv[])
|
||||||
facePatchID[faceI - pShapeMesh.nInternalFaces()] = nBoundaries;
|
facePatchID[faceI - pShapeMesh.nInternalFaces()] = nBoundaries;
|
||||||
}
|
}
|
||||||
|
|
||||||
//add to boundary patch
|
// Add to boundary patch
|
||||||
|
|
||||||
Info<< "Adding new patch " << patchNames[patchI]
|
Info<< "Adding new patch " << patchNames[patchI]
|
||||||
<< " of type " << patchTypes[patchI]
|
<< " of type " << patchTypes[patchI]
|
||||||
|
@ -1538,7 +1548,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
defaultBoundaryFaces.shrink();
|
defaultBoundaryFaces.shrink();
|
||||||
|
|
||||||
if (defaultBoundaryFaces.size())
|
if (defaultBoundaryFaces.size() != 0)
|
||||||
{
|
{
|
||||||
Warning << " fluent mesh has " << defaultBoundaryFaces.size()
|
Warning << " fluent mesh has " << defaultBoundaryFaces.size()
|
||||||
<< " undefined boundary faces." << endl
|
<< " undefined boundary faces." << endl
|
||||||
|
@ -1582,34 +1592,20 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
repatcher.repatch();
|
repatcher.repatch();
|
||||||
|
|
||||||
|
preservePatchTypes
|
||||||
|
(
|
||||||
|
runTime,
|
||||||
|
runTime.constant(),
|
||||||
|
polyMesh::defaultRegion,
|
||||||
|
patchNames,
|
||||||
|
patchTypes,
|
||||||
|
defaultFacesName,
|
||||||
|
defaultFacesType,
|
||||||
|
patchPhysicalTypes
|
||||||
|
);
|
||||||
|
|
||||||
// Set the precision of the points data to 10
|
// Set the precision of the points data to 10
|
||||||
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
|
IOstream::defaultPrecision(10);
|
||||||
|
|
||||||
|
|
||||||
// Re-do face matching to write sets
|
|
||||||
if (writeSets)
|
|
||||||
{
|
|
||||||
forAll(patches, patchI)
|
|
||||||
{
|
|
||||||
const faceList& bFaces = patches[patchI];
|
|
||||||
label sz = bFaces.size();
|
|
||||||
|
|
||||||
faceSet pFaceSet(pShapeMesh, patchNames[patchI], sz);
|
|
||||||
|
|
||||||
forAll(bFaces, j)
|
|
||||||
{
|
|
||||||
const face& f = bFaces[j];
|
|
||||||
label cMeshFace = findFace(pShapeMesh, f);
|
|
||||||
pFaceSet.insert(cMeshFace);
|
|
||||||
}
|
|
||||||
Info<< "Writing patch " << patchNames[patchI]
|
|
||||||
<< " of size " << sz << " to faceSet" << endl;
|
|
||||||
|
|
||||||
pFaceSet.instance() = pShapeMesh.instance();
|
|
||||||
pFaceSet.write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Zones
|
// Zones
|
||||||
|
@ -1663,7 +1659,7 @@ int main(int argc, char *argv[])
|
||||||
// Mark zone cells, used for finding faces
|
// Mark zone cells, used for finding faces
|
||||||
boolList zoneCell(pShapeMesh.nCells(), false);
|
boolList zoneCell(pShapeMesh.nCells(), false);
|
||||||
|
|
||||||
// shift cell indices by 1
|
// Shift cell indices by 1
|
||||||
label nr = 0;
|
label nr = 0;
|
||||||
for (label celli = (start() - 1); celli < end(); celli++)
|
for (label celli = (start() - 1); celli < end(); celli++)
|
||||||
{
|
{
|
||||||
|
@ -1806,6 +1802,6 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- *\
|
/* --------------------------------------------------------------------------*\
|
||||||
------ End of fluentMeshToFoam.L
|
------ End of fluentMeshToFoam.L
|
||||||
\* ------------------------------------------------------------------------- */
|
\* --------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -93,4 +93,74 @@ void Foam::preservePatchTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::preservePatchTypes
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const word& meshInstance,
|
||||||
|
const fileName& meshDir,
|
||||||
|
const wordList& patchNames,
|
||||||
|
wordList& patchTypes,
|
||||||
|
const word& defaultFacesName,
|
||||||
|
word& defaultFacesType,
|
||||||
|
wordList& patchPhysicalTypes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
dictionary patchDictionary;
|
||||||
|
|
||||||
|
{
|
||||||
|
IOobject patchEntriesHeader
|
||||||
|
(
|
||||||
|
"boundary",
|
||||||
|
meshInstance,
|
||||||
|
meshDir,
|
||||||
|
obr,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if (patchEntriesHeader.headerOk())
|
||||||
|
{
|
||||||
|
// Create a list of entries from the boundary file.
|
||||||
|
polyBoundaryMeshEntries patchEntries(patchEntriesHeader);
|
||||||
|
|
||||||
|
forAll(patchEntries, patchi)
|
||||||
|
{
|
||||||
|
patchDictionary.add(patchEntries[patchi]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (patchDictionary.size())
|
||||||
|
{
|
||||||
|
forAll(patchNames, patchi)
|
||||||
|
{
|
||||||
|
if (patchDictionary.found(patchNames[patchi]))
|
||||||
|
{
|
||||||
|
const dictionary& patchDict =
|
||||||
|
patchDictionary.subDict(patchNames[patchi]);
|
||||||
|
|
||||||
|
patchDict.lookup("type") >> patchTypes[patchi];
|
||||||
|
|
||||||
|
patchDict.readIfPresent("geometricType", patchTypes[patchi]);
|
||||||
|
patchDict.readIfPresent
|
||||||
|
(
|
||||||
|
"physicalType",
|
||||||
|
patchPhysicalTypes[patchi]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (patchDictionary.found(defaultFacesName))
|
||||||
|
{
|
||||||
|
const dictionary& patchDict =
|
||||||
|
patchDictionary.subDict(defaultFacesName);
|
||||||
|
|
||||||
|
patchDict.readIfPresent("geometricType", defaultFacesType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << nl << "Default patch type set to " << defaultFacesType << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|
|
@ -58,6 +58,19 @@ void preservePatchTypes
|
||||||
word& defaultFacesType
|
word& defaultFacesType
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- preserve patch types
|
||||||
|
void preservePatchTypes
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const word& meshInstance,
|
||||||
|
const fileName& meshDir,
|
||||||
|
const wordList& patchNames,
|
||||||
|
wordList& patchTypes,
|
||||||
|
const word& defaultFacesName,
|
||||||
|
word& defaultFacesType,
|
||||||
|
wordList& patchPhysicalTypes
|
||||||
|
);
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
Reference in a new issue