mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: snappyHexMesh. Added leak-path detection.
Detects connections (during refinement) between locationsInsideMesh and locationsOutsideMesh and writes a sampledSet for postprocessing.
This commit is contained in:
@ -62,6 +62,7 @@ Description
|
||||
#include "fvMeshTools.H"
|
||||
#include "profiling.H"
|
||||
#include "processorMeshes.H"
|
||||
#include "vtkSetWriter.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -788,6 +789,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
const bool keepPatches(meshDict.lookupOrDefault("keepPatches", false));
|
||||
|
||||
// format to be used for writing lines
|
||||
const word setFormat
|
||||
(
|
||||
meshDict.lookupOrDefault
|
||||
(
|
||||
"setFormat",
|
||||
vtkSetWriter<scalar>::typeName
|
||||
)
|
||||
);
|
||||
const autoPtr<writer<scalar>> setFormatter
|
||||
(
|
||||
writer<scalar>::New(setFormat)
|
||||
);
|
||||
|
||||
|
||||
// Read decomposePar dictionary
|
||||
dictionary decomposeDict;
|
||||
@ -1038,7 +1053,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
100.0, // max size ratio
|
||||
1e-9, // intersection tolerance
|
||||
autoPtr<writer<scalar>>(new vtkSetWriter<scalar>()),
|
||||
setFormatter,
|
||||
0.01, // min triangle quality
|
||||
true
|
||||
);
|
||||
@ -1476,7 +1491,8 @@ int main(int argc, char *argv[])
|
||||
decomposer,
|
||||
distributor,
|
||||
globalToMasterPatch,
|
||||
globalToSlavePatch
|
||||
globalToSlavePatch,
|
||||
setFormatter
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -785,6 +785,10 @@ meshQualityControls
|
||||
// layerFields // write volScalarField for layer coverage
|
||||
//);
|
||||
|
||||
|
||||
//// Format for writing lines. E.g. leak path. Default is vtk format.
|
||||
//setFormat ensight;
|
||||
|
||||
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
|
||||
// Note: the write tolerance needs to be higher than this.
|
||||
mergeTolerance 1e-6;
|
||||
|
||||
@ -3,6 +3,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
|
||||
@ -52,5 +52,6 @@ $(setWriters)/raw/rawSetWriterRunTime.C
|
||||
$(setWriters)/vtk/vtkSetWriterRunTime.C
|
||||
$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
|
||||
$(setWriters)/csv/csvSetWriterRunTime.C
|
||||
$(setWriters)/nastran/nastranSetWriterRunTime.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfileFormats
|
||||
|
||||
228
src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.C
Normal file
228
src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.C
Normal file
@ -0,0 +1,228 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 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 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 "nastranSetWriter.H"
|
||||
#include "coordSet.H"
|
||||
#include "IOmanip.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::nastranSetWriter<Type>::nastranSetWriter()
|
||||
:
|
||||
writer<Type>()
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::nastranSetWriter<Type>::~nastranSetWriter()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::fileName Foam::nastranSetWriter<Type>::getFileName
|
||||
(
|
||||
const coordSet& points,
|
||||
const wordList& valueSetNames
|
||||
) const
|
||||
{
|
||||
return this->getBaseName(points, valueSetNames) + ".nas";
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::nastranSetWriter<Type>::write
|
||||
(
|
||||
const coordSet& points,
|
||||
const wordList& valueSetNames,
|
||||
const List<const Field<Type>*>& valueSets,
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
os << "TITLE=OpenFOAM "
|
||||
<< this->getBaseName(points, valueSetNames).c_str()
|
||||
<< nl
|
||||
<< "$" << nl
|
||||
<< "BEGIN BULK" << nl;
|
||||
|
||||
forAll(points, pointi)
|
||||
{
|
||||
fileFormats::NASCore::writeKeyword(os, "GRID", fieldFormat::FREE);
|
||||
|
||||
const point& pt = points[pointi];
|
||||
|
||||
//os.setf(std::ios_base::right);
|
||||
//os << setw(8) << pointi+1
|
||||
// << setw(8) << ' '
|
||||
// << setw(8) << float(pt.x())
|
||||
// << setw(8) << float(pt.y())
|
||||
// << setw(8) << float(pt.z())
|
||||
// << nl;
|
||||
//os.unsetf(std::ios_base::right);
|
||||
os << ',' << pointi+1
|
||||
<< ','
|
||||
<< ',' << float(pt.x())
|
||||
<< ',' << float(pt.y())
|
||||
<< ',' << float(pt.z())
|
||||
<< nl;
|
||||
}
|
||||
|
||||
if (false)
|
||||
{
|
||||
// Single track with multiple segments
|
||||
const label nEdges = points.size()-1;
|
||||
for (label edgei = 0; edgei < nEdges; ++edgei)
|
||||
{
|
||||
fileFormats::NASCore::writeKeyword
|
||||
(
|
||||
os,
|
||||
"PLOTEL",
|
||||
fieldFormat::FREE
|
||||
);
|
||||
|
||||
//os.setf(std::ios_base::right);
|
||||
//os << setw(8) << edgei+1
|
||||
// << setw(8) << edgei+1
|
||||
// << setw(8) << edgei+2
|
||||
// << nl;
|
||||
//os.unsetf(std::ios_base::right);
|
||||
os << ',' << edgei+1
|
||||
<< ',' << edgei+1
|
||||
<< ',' << edgei+2
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
os << "ENDDATA" << nl;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::nastranSetWriter<Type>::write
|
||||
(
|
||||
const bool writeTracks,
|
||||
const PtrList<coordSet>& tracks,
|
||||
const wordList& valueSetNames,
|
||||
const List<List<Field<Type>>>& valueSets,
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
if (valueSets.size() != valueSetNames.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Number of variables:" << valueSetNames.size() << endl
|
||||
<< "Number of valueSets:" << valueSets.size()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
if (tracks.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
os << "TITLE=OpenFOAM "
|
||||
<< this->getBaseName(tracks[0], valueSetNames).c_str()
|
||||
<< nl
|
||||
<< "$" << nl
|
||||
<< "BEGIN BULK" << nl;
|
||||
|
||||
// label nTracks = tracks.size();
|
||||
// label nPoints = 0;
|
||||
// forAll(tracks, i)
|
||||
// {
|
||||
// nPoints += tracks[i].size();
|
||||
// }
|
||||
|
||||
label globalPti = 0;
|
||||
forAll(tracks, tracki)
|
||||
{
|
||||
const coordSet& points = tracks[tracki];
|
||||
forAll(points, pointi)
|
||||
{
|
||||
fileFormats::NASCore::writeKeyword(os, "GRID", fieldFormat::FREE);
|
||||
|
||||
const point& pt = points[pointi];
|
||||
|
||||
//os.setf(std::ios_base::right);
|
||||
//os << setw(8) << globalPti++
|
||||
// << setw(8) << ' '
|
||||
// << setw(8) << float(pt.x())
|
||||
// << setw(8) << float(pt.y())
|
||||
// << setw(8) << float(pt.z())
|
||||
// << nl;
|
||||
//os.unsetf(std::ios_base::right);
|
||||
os << ',' << globalPti++
|
||||
<< ','
|
||||
<< ',' << float(pt.x())
|
||||
<< ',' << float(pt.y())
|
||||
<< ',' << float(pt.z())
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
|
||||
if (writeTracks)
|
||||
{
|
||||
// Write ids of track points to file
|
||||
label globalEdgei = 0;
|
||||
label globalPointi = 0;
|
||||
forAll(tracks, tracki)
|
||||
{
|
||||
const coordSet& points = tracks[tracki];
|
||||
|
||||
const label nEdges = points.size()-1;
|
||||
for (label edgei = 0; edgei < nEdges; ++edgei)
|
||||
{
|
||||
fileFormats::NASCore::writeKeyword
|
||||
(
|
||||
os,
|
||||
"PLOTEL",
|
||||
fieldFormat::FREE
|
||||
);
|
||||
|
||||
//os.setf(std::ios_base::right);
|
||||
//os << setw(8) << globalEdgei+1
|
||||
// << setw(8) << globalPointi+1
|
||||
// << setw(8) << globalPointi+2
|
||||
// << nl;
|
||||
//os.unsetf(std::ios_base::right);
|
||||
|
||||
os << ',' << globalEdgei+1
|
||||
<< ',' << globalPointi+1
|
||||
<< ',' << globalPointi+2
|
||||
<< nl;
|
||||
globalEdgei++;
|
||||
globalPointi++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
os << "ENDDATA" << nl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
131
src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.H
Normal file
131
src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.H
Normal file
@ -0,0 +1,131 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 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 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::nastranSetWriter
|
||||
|
||||
Description
|
||||
Line format in Nastran (currently hardcoded to 'free' format)
|
||||
|
||||
Does not do field data.
|
||||
|
||||
SourceFiles
|
||||
nastranSetWriter.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef nastranSetWriter_H
|
||||
#define nastranSetWriter_H
|
||||
|
||||
#include "writer.H"
|
||||
#include "NASCore.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class nastranSetWriter Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class nastranSetWriter
|
||||
:
|
||||
public writer<Type>
|
||||
{
|
||||
public:
|
||||
|
||||
//- File field formats
|
||||
using fieldFormat = Foam::fileFormats::NASCore::fieldFormat;
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Write the formatted keyword to the output stream
|
||||
Ostream& writeKeyword
|
||||
(
|
||||
Ostream& os,
|
||||
const word& keyword
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("nastran");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
nastranSetWriter();
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~nastranSetWriter();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
virtual fileName getFileName
|
||||
(
|
||||
const coordSet&,
|
||||
const wordList&
|
||||
) const;
|
||||
|
||||
virtual void write
|
||||
(
|
||||
const coordSet&,
|
||||
const wordList&,
|
||||
const List<const Field<Type>*>&,
|
||||
Ostream&
|
||||
) const;
|
||||
|
||||
virtual void write
|
||||
(
|
||||
const bool writeTracks,
|
||||
const PtrList<coordSet>&,
|
||||
const wordList& valueSetNames,
|
||||
const List<List<Field<Type>>>&,
|
||||
Ostream&
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "nastranSetWriter.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,37 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2018 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 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 "nastranSetWriter.H"
|
||||
#include "writers.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeSetWriters(nastranSetWriter);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,6 +2,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
|
||||
@ -57,6 +57,10 @@ License
|
||||
#include "motionSmoother.H"
|
||||
#include "faceSet.H"
|
||||
|
||||
// Leak path
|
||||
#include "shortestPathSet.H"
|
||||
#include "meshSearch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -2220,8 +2224,10 @@ Foam::label Foam::meshRefinement::findRegions
|
||||
const vector& perturbVec,
|
||||
const pointField& locationsInMesh,
|
||||
const pointField& locationsOutsideMesh,
|
||||
const writer<scalar>& leakPathFormatter,
|
||||
const label nRegions,
|
||||
labelList& cellRegion
|
||||
labelList& cellRegion,
|
||||
const boolList& blockedFace
|
||||
)
|
||||
{
|
||||
bitSet insideCell(mesh.nCells());
|
||||
@ -2273,11 +2279,170 @@ Foam::label Foam::meshRefinement::findRegions
|
||||
label index = insideRegions.find(regioni);
|
||||
if (index != -1)
|
||||
{
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
fileName outputDir;
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputDir =
|
||||
mesh.time().path()
|
||||
/ (Pstream::parRun() ? ".." : "")
|
||||
/ functionObject::outputPrefix
|
||||
/ mesh.pointsInstance();
|
||||
outputDir.clean();
|
||||
mkDir(outputDir);
|
||||
}
|
||||
|
||||
|
||||
// Write the leak path
|
||||
|
||||
meshSearch searchEngine(mesh);
|
||||
shortestPathSet leakPath
|
||||
(
|
||||
"leakPath",
|
||||
mesh,
|
||||
searchEngine,
|
||||
coordSet::coordFormatNames[coordSet::coordFormat::DISTANCE],
|
||||
false, //true,
|
||||
50, // tbd. Number of iterations
|
||||
pbm.groupPatchIDs()["wall"],
|
||||
locationsInMesh,
|
||||
locationsOutsideMesh,
|
||||
blockedFace
|
||||
);
|
||||
|
||||
// Split leak path according to segment. Note: segment index
|
||||
// is global (= index in locationsInsideMesh)
|
||||
List<pointList> segmentPoints;
|
||||
List<scalarList> segmentDist;
|
||||
{
|
||||
label nSegments = 0;
|
||||
if (leakPath.segments().size())
|
||||
{
|
||||
nSegments = max(leakPath.segments())+1;
|
||||
}
|
||||
reduce(nSegments, maxOp<label>());
|
||||
|
||||
labelList nElemsPerSegment(nSegments, 0);
|
||||
for (label segmenti : leakPath.segments())
|
||||
{
|
||||
nElemsPerSegment[segmenti]++;
|
||||
}
|
||||
segmentPoints.setSize(nElemsPerSegment.size());
|
||||
segmentDist.setSize(nElemsPerSegment.size());
|
||||
forAll(nElemsPerSegment, i)
|
||||
{
|
||||
segmentPoints[i].setSize(nElemsPerSegment[i]);
|
||||
segmentDist[i].setSize(nElemsPerSegment[i]);
|
||||
}
|
||||
nElemsPerSegment = 0;
|
||||
|
||||
forAll(leakPath, elemi)
|
||||
{
|
||||
label segmenti = leakPath.segments()[elemi];
|
||||
pointList& points = segmentPoints[segmenti];
|
||||
scalarList& dist = segmentDist[segmenti];
|
||||
label& n = nElemsPerSegment[segmenti];
|
||||
|
||||
points[n] = leakPath[elemi];
|
||||
dist[n] = leakPath.curveDist()[elemi];
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
PtrList<coordSet> allLeakPaths(segmentPoints.size());
|
||||
forAll(allLeakPaths, segmenti)
|
||||
{
|
||||
// Collect data from all processors
|
||||
List<pointList> gatheredPts(Pstream::nProcs());
|
||||
gatheredPts[Pstream::myProcNo()] =
|
||||
std::move(segmentPoints[segmenti]);
|
||||
Pstream::gatherList(gatheredPts);
|
||||
|
||||
List<scalarList> gatheredDist(Pstream::nProcs());
|
||||
gatheredDist[Pstream::myProcNo()] =
|
||||
std::move(segmentDist[segmenti]);
|
||||
Pstream::gatherList(gatheredDist);
|
||||
|
||||
// Combine processor lists into one big list.
|
||||
pointList allPts
|
||||
(
|
||||
ListListOps::combine<pointList>
|
||||
(
|
||||
gatheredPts, accessOp<pointList>()
|
||||
)
|
||||
);
|
||||
scalarList allDist
|
||||
(
|
||||
ListListOps::combine<scalarList>
|
||||
(
|
||||
gatheredDist, accessOp<scalarList>()
|
||||
)
|
||||
);
|
||||
|
||||
// Sort according to curveDist
|
||||
labelList indexSet;
|
||||
Foam::sortedOrder(allDist, indexSet);
|
||||
|
||||
allLeakPaths.set
|
||||
(
|
||||
segmenti,
|
||||
new coordSet
|
||||
(
|
||||
leakPath.name(),
|
||||
leakPath.axis(),
|
||||
pointList(allPts, indexSet),
|
||||
//scalarList(allDist, indexSet)
|
||||
scalarList(allPts.size(), scalar(segmenti))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
fileName fName;
|
||||
if (Pstream::master())
|
||||
{
|
||||
List<List<scalarField>> allLeakData(1);
|
||||
List<scalarField>& varData = allLeakData[0];
|
||||
varData.setSize(allLeakPaths.size());
|
||||
forAll(allLeakPaths, segmenti)
|
||||
{
|
||||
varData[segmenti] = allLeakPaths[segmenti].curveDist();
|
||||
}
|
||||
|
||||
const wordList valueSetNames(1, "leakPath");
|
||||
|
||||
fName =
|
||||
outputDir
|
||||
/leakPathFormatter.getFileName
|
||||
(
|
||||
allLeakPaths[0],
|
||||
valueSetNames
|
||||
);
|
||||
|
||||
// Note scope to force writing to finish before
|
||||
// FatalError exit
|
||||
OFstream ofs(fName);
|
||||
if (ofs.opened())
|
||||
{
|
||||
leakPathFormatter.write
|
||||
(
|
||||
true, // write tracks
|
||||
allLeakPaths,
|
||||
valueSetNames,
|
||||
allLeakData,
|
||||
ofs
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::scatter(fName);
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Location in mesh " << locationsInMesh[index]
|
||||
<< " is inside same mesh region " << regioni
|
||||
<< " as location outside mesh "
|
||||
<< locationsOutsideMesh[i]
|
||||
<< " as one of the locations outside mesh "
|
||||
<< locationsOutsideMesh
|
||||
<< nl << " Dumped leak path to " << fName
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -2309,7 +2474,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
|
||||
const labelList& globalToMasterPatch,
|
||||
const labelList& globalToSlavePatch,
|
||||
const pointField& locationsInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
const pointField& locationsOutsideMesh,
|
||||
const writer<scalar>& leakPathFormatter
|
||||
)
|
||||
{
|
||||
// Force calculation of face decomposition (used in findCell)
|
||||
@ -2329,8 +2495,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
|
||||
mergeDistance_ * vector::one, // perturbVec
|
||||
locationsInMesh,
|
||||
locationsOutsideMesh,
|
||||
leakPathFormatter,
|
||||
cellRegion.nRegions(),
|
||||
cellRegion
|
||||
cellRegion,
|
||||
blockedFace
|
||||
);
|
||||
|
||||
// Subset
|
||||
|
||||
@ -56,6 +56,7 @@ SourceFiles
|
||||
#include "surfaceZonesInfo.H"
|
||||
#include "volumeType.H"
|
||||
#include "DynamicField.H"
|
||||
#include "writer.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -1090,7 +1091,8 @@ public:
|
||||
const labelList& globalToSlavePatch,
|
||||
const pointField& locationsInMesh,
|
||||
const wordList& regionsInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
const pointField& locationsOutsideMesh,
|
||||
const writer<scalar>& leakPathFormatter
|
||||
);
|
||||
|
||||
//- Merge free-standing baffles
|
||||
@ -1106,7 +1108,8 @@ public:
|
||||
const labelList& globalToMasterPatch,
|
||||
const labelList& globalToSlavePatch,
|
||||
const pointField& locationsInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
const pointField& locationsOutsideMesh,
|
||||
const writer<scalar>& leakPathFormatter
|
||||
);
|
||||
|
||||
//- Split off (with optional buffer layers) unreachable areas
|
||||
@ -1120,7 +1123,8 @@ public:
|
||||
|
||||
const pointField& locationsInMesh,
|
||||
const wordList& regionsInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
const pointField& locationsOutsideMesh,
|
||||
const writer<scalar>& leakPathFormatter
|
||||
);
|
||||
|
||||
//- Remove cells from limitRegions if level -1
|
||||
@ -1278,8 +1282,10 @@ public:
|
||||
const vector& perturbVec,
|
||||
const pointField& locationsInMesh,
|
||||
const pointField& locationsOutsideMesh,
|
||||
const writer<scalar>& leakPathFormatter,
|
||||
const label nRegions,
|
||||
labelList& cellRegion
|
||||
labelList& cellRegion,
|
||||
const boolList& blockedFace
|
||||
);
|
||||
|
||||
//- Split mesh. Keep part containing point. Return empty map if
|
||||
@ -1289,7 +1295,8 @@ public:
|
||||
const labelList& globalToMasterPatch,
|
||||
const labelList& globalToSlavePatch,
|
||||
const pointField& locationsInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
const pointField& locationsOutsideMesh,
|
||||
const writer<scalar>& leakPathFormatter
|
||||
);
|
||||
|
||||
//- Split faces into two
|
||||
|
||||
@ -3561,7 +3561,8 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
||||
|
||||
const pointField& locationsInMesh,
|
||||
const wordList& zonesInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
const pointField& locationsOutsideMesh,
|
||||
const writer<scalar>& leakPathFormatter
|
||||
)
|
||||
{
|
||||
// Introduce baffles
|
||||
@ -3695,7 +3696,8 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
||||
globalToMasterPatch,
|
||||
globalToSlavePatch,
|
||||
locationsInMesh,
|
||||
locationsOutsideMesh
|
||||
locationsOutsideMesh,
|
||||
leakPathFormatter
|
||||
);
|
||||
|
||||
if (debug)
|
||||
@ -3737,7 +3739,8 @@ void Foam::meshRefinement::mergeFreeStandingBaffles
|
||||
const labelList& globalToMasterPatch,
|
||||
const labelList& globalToSlavePatch,
|
||||
const pointField& locationsInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
const pointField& locationsOutsideMesh,
|
||||
const writer<scalar>& leakPathFormatter
|
||||
)
|
||||
{
|
||||
// Merge baffles
|
||||
@ -3803,7 +3806,8 @@ void Foam::meshRefinement::mergeFreeStandingBaffles
|
||||
globalToMasterPatch,
|
||||
globalToSlavePatch,
|
||||
locationsInMesh,
|
||||
locationsOutsideMesh
|
||||
locationsOutsideMesh,
|
||||
leakPathFormatter
|
||||
);
|
||||
|
||||
|
||||
@ -3827,7 +3831,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
||||
|
||||
const pointField& locationsInMesh,
|
||||
const wordList& zonesInMesh,
|
||||
const pointField& locationsOutsideMesh
|
||||
const pointField& locationsOutsideMesh,
|
||||
const writer<scalar>& leakPathFormatter
|
||||
)
|
||||
{
|
||||
// Determine patches to put intersections into
|
||||
@ -3869,7 +3874,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
||||
|
||||
|
||||
regionSplit cellRegion(mesh_, blockedFace);
|
||||
blockedFace.clear();
|
||||
|
||||
// Set unreachable cells to -1
|
||||
findRegions
|
||||
@ -3878,8 +3882,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
||||
mergeDistance_ * vector::one, // perturbVec
|
||||
locationsInMesh,
|
||||
locationsOutsideMesh,
|
||||
leakPathFormatter,
|
||||
cellRegion.nRegions(),
|
||||
cellRegion
|
||||
cellRegion,
|
||||
blockedFace
|
||||
);
|
||||
|
||||
return splitMesh
|
||||
|
||||
@ -60,14 +60,16 @@ Foam::snappyRefineDriver::snappyRefineDriver
|
||||
decompositionMethod& decomposer,
|
||||
fvMeshDistribute& distributor,
|
||||
const labelUList& globalToMasterPatch,
|
||||
const labelUList& globalToSlavePatch
|
||||
const labelUList& globalToSlavePatch,
|
||||
const writer<scalar>& setFormatter
|
||||
)
|
||||
:
|
||||
meshRefiner_(meshRefiner),
|
||||
decomposer_(decomposer),
|
||||
distributor_(distributor),
|
||||
globalToMasterPatch_(globalToMasterPatch),
|
||||
globalToSlavePatch_(globalToSlavePatch)
|
||||
globalToSlavePatch_(globalToSlavePatch),
|
||||
setFormatter_(setFormatter)
|
||||
{}
|
||||
|
||||
|
||||
@ -1386,7 +1388,8 @@ void Foam::snappyRefineDriver::removeInsideCells
|
||||
globalToSlavePatch_,
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.zonesInMesh(),
|
||||
refineParams.locationsOutsideMesh()
|
||||
refineParams.locationsOutsideMesh(),
|
||||
setFormatter_
|
||||
);
|
||||
|
||||
if (debug&meshRefinement::MESH)
|
||||
@ -2353,7 +2356,8 @@ void Foam::snappyRefineDriver::baffleAndSplitMesh
|
||||
globalToSlavePatch_,
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.zonesInMesh(),
|
||||
refineParams.locationsOutsideMesh()
|
||||
refineParams.locationsOutsideMesh(),
|
||||
setFormatter_
|
||||
);
|
||||
|
||||
|
||||
@ -2371,7 +2375,8 @@ void Foam::snappyRefineDriver::baffleAndSplitMesh
|
||||
globalToMasterPatch_,
|
||||
globalToSlavePatch_,
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.locationsOutsideMesh()
|
||||
refineParams.locationsOutsideMesh(),
|
||||
setFormatter_
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2481,7 +2486,8 @@ void Foam::snappyRefineDriver::splitAndMergeBaffles
|
||||
globalToSlavePatch_,
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.zonesInMesh(),
|
||||
refineParams.locationsOutsideMesh()
|
||||
refineParams.locationsOutsideMesh(),
|
||||
setFormatter_
|
||||
);
|
||||
|
||||
// Merge free-standing baffles always
|
||||
@ -2497,7 +2503,8 @@ void Foam::snappyRefineDriver::splitAndMergeBaffles
|
||||
globalToMasterPatch_,
|
||||
globalToSlavePatch_,
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.locationsOutsideMesh()
|
||||
refineParams.locationsOutsideMesh(),
|
||||
setFormatter_
|
||||
);
|
||||
|
||||
if (debug)
|
||||
@ -2536,7 +2543,8 @@ void Foam::snappyRefineDriver::splitAndMergeBaffles
|
||||
globalToMasterPatch_,
|
||||
globalToSlavePatch_,
|
||||
refineParams.locationsInMesh(),
|
||||
refineParams.locationsOutsideMesh()
|
||||
refineParams.locationsOutsideMesh(),
|
||||
setFormatter_
|
||||
);
|
||||
|
||||
if (debug)
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#include "labelList.H"
|
||||
#include "scalarField.H"
|
||||
#include "Tuple2.H"
|
||||
#include "writer.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -76,6 +77,9 @@ class snappyRefineDriver
|
||||
//- From surface region to patch
|
||||
const labelList globalToSlavePatch_;
|
||||
|
||||
//- How to write lines. Used e.g. when writing leak-paths
|
||||
const writer<scalar>& setFormatter_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -220,7 +224,8 @@ public:
|
||||
decompositionMethod& decomposer,
|
||||
fvMeshDistribute& distributor,
|
||||
const labelUList& globalToMasterPatch,
|
||||
const labelUList& globalToSlavePatch
|
||||
const labelUList& globalToSlavePatch,
|
||||
const writer<scalar>& setFormatter
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -419,7 +419,8 @@ void Foam::sampledSet::setSamples
|
||||
|
||||
Foam::autoPtr<Foam::coordSet> Foam::sampledSet::gather
|
||||
(
|
||||
labelList& indexSet
|
||||
labelList& indexSet,
|
||||
labelList& allSegments
|
||||
) const
|
||||
{
|
||||
// Combine sampleSet from processors. Sort by curveDist. Return
|
||||
@ -448,12 +449,10 @@ Foam::autoPtr<Foam::coordSet> Foam::sampledSet::gather
|
||||
gatheredPts, accessOp<List<point>>()
|
||||
)
|
||||
);
|
||||
labelList allSegments
|
||||
(
|
||||
allSegments =
|
||||
ListListOps::combine<labelList>
|
||||
(
|
||||
gatheredSegments, accessOp<labelList>()
|
||||
)
|
||||
);
|
||||
scalarList allCurveDist
|
||||
(
|
||||
@ -475,6 +474,8 @@ Foam::autoPtr<Foam::coordSet> Foam::sampledSet::gather
|
||||
Foam::sortedOrder(allCurveDist, indexSet); // uses stable sort
|
||||
scalarList sortedDist(allCurveDist, indexSet); // with indices for mapping
|
||||
|
||||
allSegments = UIndirectList<label>(allSegments, indexSet)();
|
||||
|
||||
return autoPtr<coordSet>::New
|
||||
(
|
||||
name(),
|
||||
|
||||
@ -296,7 +296,11 @@ public:
|
||||
|
||||
//- Helper: gather onto master and sort.
|
||||
// \return (on master) gathered set and overall sort order
|
||||
autoPtr<coordSet> gather(labelList& indexSet) const;
|
||||
autoPtr<coordSet> gather
|
||||
(
|
||||
labelList& indexSet,
|
||||
labelList& allSegments
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -69,10 +69,11 @@ void Foam::sampledSets::combineSampledSets
|
||||
|
||||
forAll(sampledSets, setI)
|
||||
{
|
||||
labelList segments;
|
||||
masterSampledSets.set
|
||||
(
|
||||
setI,
|
||||
sampledSets[setI].gather(indexSets[setI])
|
||||
sampledSets[setI].gather(indexSets[setI], segments)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,6 +30,13 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "FaceCellWave.H"
|
||||
#include "syncTools.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "OBJstream.H"
|
||||
#include "surfaceWriter.H"
|
||||
#include "meshedSurfRef.H"
|
||||
#include "PatchTools.H"
|
||||
#include "vtkSurfaceWriter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -47,6 +54,8 @@ Foam::label Foam::shortestPathSet::findMinFace
|
||||
const polyMesh& mesh,
|
||||
const label cellI,
|
||||
const List<topoDistanceData>& allFaceInfo,
|
||||
const PackedBoolList& isLeakPoint,
|
||||
const bool distanceMode,
|
||||
const point& origin
|
||||
)
|
||||
{
|
||||
@ -56,6 +65,7 @@ Foam::label Foam::shortestPathSet::findMinFace
|
||||
|
||||
label minDist = labelMax;
|
||||
label minFaceI = -1;
|
||||
label nMin = 0;
|
||||
forAll(cFaces2, i)
|
||||
{
|
||||
label faceI = cFaces2[i];
|
||||
@ -64,10 +74,20 @@ Foam::label Foam::shortestPathSet::findMinFace
|
||||
{
|
||||
minDist = info.distance();
|
||||
minFaceI = faceI;
|
||||
nMin = 1;
|
||||
}
|
||||
else if (info.distance() == minDist)
|
||||
{
|
||||
nMin++;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Check all faces with minDist for minimum distance to origin
|
||||
if (nMin > 1)
|
||||
{
|
||||
// 2. Check all faces with minDist for minimum (or maximum)
|
||||
// distance to origin
|
||||
if (distanceMode)
|
||||
{
|
||||
scalar minDist2 = ROOTVGREAT;
|
||||
forAll(cFaces2, i)
|
||||
{
|
||||
@ -82,43 +102,76 @@ Foam::label Foam::shortestPathSet::findMinFace
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Avoid leak points
|
||||
label minLeakPoints = labelMax;
|
||||
forAll(cFaces2, i)
|
||||
{
|
||||
label faceI = cFaces2[i];
|
||||
if (allFaceInfo[faceI].distance() == minDist)
|
||||
{
|
||||
// Count number of leak points
|
||||
label nLeak = 0;
|
||||
{
|
||||
const face& f = mesh.faces()[faceI];
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (isLeakPoint[f[fp]])
|
||||
{
|
||||
nLeak++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nLeak < minLeakPoints)
|
||||
{
|
||||
minLeakPoints = nLeak;
|
||||
minFaceI = faceI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return minFaceI;
|
||||
}
|
||||
|
||||
|
||||
void Foam::shortestPathSet::genSamples(const polyMesh& mesh)
|
||||
void Foam::shortestPathSet::calculateDistance
|
||||
(
|
||||
const label iter,
|
||||
const polyMesh& mesh,
|
||||
const label cellI,
|
||||
|
||||
List<topoDistanceData>& allFaceInfo,
|
||||
List<topoDistanceData>& allCellInfo
|
||||
) const
|
||||
{
|
||||
// Storage for sample points
|
||||
DynamicList<point> samplingPts;
|
||||
DynamicList<label> samplingCells;
|
||||
DynamicList<label> samplingFaces;
|
||||
DynamicList<label> samplingSegments;
|
||||
DynamicList<scalar> samplingCurveDist;
|
||||
int dummyTrackData = 0;
|
||||
|
||||
forAll(insidePoints_, pointI)
|
||||
// Seed faces on cell1
|
||||
DynamicList<topoDistanceData> faceDist;
|
||||
DynamicList<label> cFaces1;
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
label cell1I = mesh.findCell(insidePoints_[pointI]);
|
||||
const labelList& cFaces = mesh.cells()[cellI];
|
||||
faceDist.reserve(cFaces.size());
|
||||
cFaces1.reserve(cFaces.size());
|
||||
|
||||
//
|
||||
// Pass1: Set initial changed faces from cell1 (seed)
|
||||
//
|
||||
|
||||
List<topoDistanceData> faceDist;
|
||||
labelList cFaces1;
|
||||
|
||||
if (cell1I != -1)
|
||||
for (label facei : cFaces)
|
||||
{
|
||||
cFaces1 = mesh.cells()[cell1I];
|
||||
faceDist.setSize
|
||||
(
|
||||
cFaces1.size(),
|
||||
topoDistanceData(123, 0)
|
||||
);
|
||||
if (!allFaceInfo[facei].valid(dummyTrackData))
|
||||
{
|
||||
cFaces1.append(facei);
|
||||
faceDist.append(topoDistanceData(123, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<topoDistanceData> allFaceInfo(mesh.nFaces());
|
||||
List<topoDistanceData> allCellInfo(mesh.nCells());
|
||||
|
||||
|
||||
// Walk through face-cell wave till all cells are reached
|
||||
FaceCellWave
|
||||
@ -134,38 +187,239 @@ void Foam::shortestPathSet::genSamples(const polyMesh& mesh)
|
||||
mesh.globalData().nTotalCells()+1 // max iterations
|
||||
);
|
||||
|
||||
// Pass2: walk from outside points backwards. Note: could be done using
|
||||
// FaceCellWave as well but is overly complex since does
|
||||
// not allow logic comparing all faces of a cell.
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const fvMesh& fm = refCast<const fvMesh>(mesh);
|
||||
|
||||
const_cast<fvMesh&>(fm).setInstance(fm.time().timeName());
|
||||
fm.write();
|
||||
volScalarField fld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"allCellInfo" + Foam::name(iter),
|
||||
fm.time().timeName(),
|
||||
fm,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fm,
|
||||
dimensionedScalar(dimless, Zero)
|
||||
);
|
||||
forAll(allCellInfo, celli)
|
||||
{
|
||||
fld[celli] = allCellInfo[celli].distance();
|
||||
}
|
||||
forAll(fld.boundaryField(), patchi)
|
||||
{
|
||||
const polyPatch& pp = mesh.boundaryMesh()[patchi];
|
||||
SubList<topoDistanceData> p(pp.patchSlice(allFaceInfo));
|
||||
scalarField pfld(fld.boundaryField()[patchi].size());
|
||||
forAll(pfld, i)
|
||||
{
|
||||
pfld[i] = 1.0*allFaceInfo[pp.start()+i].distance();
|
||||
}
|
||||
fld.boundaryFieldRef()[patchi] == pfld;
|
||||
}
|
||||
//Note: do not swap cell values so do not do
|
||||
//fld.correctBoundaryConditions();
|
||||
fld.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::shortestPathSet::sync
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
PackedBoolList& isLeakFace,
|
||||
PackedBoolList& isLeakPoint,
|
||||
const label celli,
|
||||
point& origin,
|
||||
bool& findMinDistance
|
||||
) const
|
||||
{
|
||||
syncTools::syncPointList
|
||||
(
|
||||
mesh,
|
||||
isLeakPoint,
|
||||
orEqOp<unsigned int>(),
|
||||
0u
|
||||
);
|
||||
syncTools::syncFaceList
|
||||
(
|
||||
mesh,
|
||||
isLeakFace,
|
||||
orEqOp<unsigned int>()
|
||||
);
|
||||
// Sync origin, findMinDistance
|
||||
{
|
||||
typedef Tuple2<label, Tuple2<point, bool>> ProcData;
|
||||
|
||||
ProcData searchData
|
||||
(
|
||||
celli,
|
||||
Tuple2<point, bool>(origin, findMinDistance)
|
||||
);
|
||||
Foam::combineReduce
|
||||
(
|
||||
searchData,
|
||||
[](ProcData& x, const ProcData& y)
|
||||
{
|
||||
if (y.first() != -1)
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
);
|
||||
origin = searchData.second().first();
|
||||
findMinDistance = searchData.second().second();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::shortestPathSet::touchesWall
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label facei,
|
||||
|
||||
PackedBoolList& isLeakFace,
|
||||
const PackedBoolList& isLeakPoint
|
||||
) const
|
||||
{
|
||||
// Check if facei touches leakPoint
|
||||
const face& f = mesh.faces()[facei];
|
||||
forAll(f, fp)
|
||||
{
|
||||
if (isLeakPoint[f[fp]])
|
||||
{
|
||||
if (isLeakFace.set(facei))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::shortestPathSet::genSamples
|
||||
(
|
||||
const bool markLeakPath,
|
||||
const label maxIter,
|
||||
const polyMesh& mesh,
|
||||
const boolList& isBlockedFace,
|
||||
const point& insidePoint,
|
||||
const label insideCelli,
|
||||
const point& outsidePoint,
|
||||
|
||||
DynamicList<point>& samplingPts,
|
||||
DynamicList<label>& samplingCells,
|
||||
DynamicList<label>& samplingFaces,
|
||||
DynamicList<label>& samplingSegments,
|
||||
DynamicList<scalar>& samplingCurveDist,
|
||||
PackedBoolList& isLeakCell,
|
||||
PackedBoolList& isLeakFace,
|
||||
PackedBoolList& isLeakPoint
|
||||
) const
|
||||
{
|
||||
const topoDistanceData maxData(labelMax, labelMax);
|
||||
|
||||
// Get the target point
|
||||
label outsideCelli = mesh.findCell(outsidePoint);
|
||||
|
||||
// Maintain overall track length. Used to make curveDist continuous.
|
||||
label trackLength = 0;
|
||||
|
||||
for (label iter = 0; iter < maxIter; iter++)
|
||||
{
|
||||
List<topoDistanceData> allFaceInfo(mesh.nFaces());
|
||||
List<topoDistanceData> allCellInfo(mesh.nCells());
|
||||
|
||||
// Mark blocked faces with high distance
|
||||
forAll(isBlockedFace, facei)
|
||||
{
|
||||
if (isBlockedFace[facei])
|
||||
{
|
||||
allFaceInfo[facei] = maxData;
|
||||
}
|
||||
}
|
||||
|
||||
if (markLeakPath)
|
||||
{
|
||||
// Mark any previously found leak path. This marks all
|
||||
// faces of all cells on the path. This will make sure that
|
||||
// ultimately the path will go through another gap.
|
||||
forAll(isLeakCell, celli)
|
||||
{
|
||||
if (celli != insideCelli && celli != outsideCelli)
|
||||
{
|
||||
if (isLeakCell[celli])
|
||||
{
|
||||
allCellInfo[celli] = maxData;
|
||||
const cell& cFaces = mesh.cells()[celli];
|
||||
for (auto facei : cFaces)
|
||||
{
|
||||
allFaceInfo[facei] = maxData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mark any previously found leak faces. These are faces that
|
||||
// are (point-)connected to an existing boundary.
|
||||
forAll(isLeakFace, facei)
|
||||
{
|
||||
if (isLeakFace[facei])
|
||||
{
|
||||
allFaceInfo[facei] = maxData;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Pass1: Get distance to insideCelli
|
||||
|
||||
calculateDistance(iter, mesh, insideCelli, allFaceInfo, allCellInfo);
|
||||
|
||||
|
||||
|
||||
// Pass2: walk from outside points backwards. Note: could be done
|
||||
// using FaceCellWave as well but is overly complex since
|
||||
// does not allow logic comparing all faces of a cell.
|
||||
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
// Get the target point
|
||||
label cell2I = mesh.findCell(outsidePoints_[pointI]);
|
||||
|
||||
// The number of cells between cell1 and cell2 is the max number of
|
||||
// iterations to search backward
|
||||
label nPathPoints = 0;
|
||||
|
||||
if (cell2I != -1)
|
||||
bool targetFound = false;
|
||||
if (outsideCelli != -1)
|
||||
{
|
||||
if (!allCellInfo[cell2I].valid(wallDistCalc.data()))
|
||||
int dummyTrackData;
|
||||
targetFound = allCellInfo[outsideCelli].valid(dummyTrackData);
|
||||
if (!targetFound)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Point " << outsidePoints_[pointI]
|
||||
<< " not reachable by walk. Probably mesh has "
|
||||
<< " island/regions. Skipped route detection." << endl;
|
||||
return;
|
||||
<< "Point " << outsidePoint
|
||||
<< " not reachable by walk from " << insidePoint
|
||||
<< ". Probably mesh has island/regions."
|
||||
<< " Skipped route detection." << endl;
|
||||
}
|
||||
}
|
||||
reduce(targetFound, orOp<bool>());
|
||||
if (!targetFound)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
nPathPoints = allCellInfo[cell2I].distance();
|
||||
}
|
||||
reduce(nPathPoints, maxOp<label>());
|
||||
|
||||
// Start with given target cell and walk back
|
||||
label frontCellI = cell2I;
|
||||
// If point happens to be on multiple processors, random pick
|
||||
label frontCellI = outsideCelli;
|
||||
point origin(outsidePoint);
|
||||
bool findMinDistance = true;
|
||||
|
||||
while (nPathPoints--)
|
||||
while (true)
|
||||
{
|
||||
label frontFaceI = -1;
|
||||
|
||||
@ -180,21 +434,32 @@ void Foam::shortestPathSet::genSamples(const polyMesh& mesh)
|
||||
// x | x 2 1 2 2 3 3 4 4
|
||||
// --- + --- + --- + -3- + -4- + -5-
|
||||
// x | x 3 2 3 3 4 4 5 5
|
||||
// e.g. if we start from cell with value = 4, we have neighbour
|
||||
// faces 4, 4, 5, 5. Choose 4 (least distance to seed)
|
||||
// and continue...
|
||||
// e.g. if we start from cell with value = 4, we have
|
||||
// neighbour faces 4, 4, 5, 5. Choose 4 (least distance
|
||||
// to seed) and continue...
|
||||
|
||||
frontFaceI = findMinFace
|
||||
(
|
||||
mesh,
|
||||
frontCellI,
|
||||
allFaceInfo,
|
||||
outsidePoints_[pointI]
|
||||
isLeakPoint,
|
||||
findMinDistance, // mode : find min or find max
|
||||
origin
|
||||
);
|
||||
|
||||
|
||||
// Loop until we hit a boundary face
|
||||
PackedBoolList isNewLeakPoint(isLeakPoint);
|
||||
while (mesh.isInternalFace(frontFaceI))
|
||||
{
|
||||
if (isBlockedFace.size() && isBlockedFace[frontFaceI])
|
||||
{
|
||||
// Pout<< " Found blocked face" << endl;
|
||||
frontCellI = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
// Step to neighbouring cell
|
||||
label nbrCellI = mesh.faceOwner()[frontFaceI];
|
||||
if (nbrCellI == frontCellI)
|
||||
@ -202,7 +467,7 @@ void Foam::shortestPathSet::genSamples(const polyMesh& mesh)
|
||||
nbrCellI = mesh.faceNeighbour()[frontFaceI];
|
||||
}
|
||||
|
||||
if (nbrCellI == cell1I)
|
||||
if (nbrCellI == insideCelli)
|
||||
{
|
||||
// Pout<< " Found connection seed cell!" << endl;
|
||||
frontCellI = -1;
|
||||
@ -217,27 +482,57 @@ void Foam::shortestPathSet::genSamples(const polyMesh& mesh)
|
||||
mesh,
|
||||
frontCellI,
|
||||
allFaceInfo,
|
||||
outsidePoints_[pointI]
|
||||
isLeakPoint,
|
||||
findMinDistance,
|
||||
origin
|
||||
);
|
||||
|
||||
// Set the sampling point
|
||||
const topoDistanceData& cInfo = allCellInfo[frontCellI];
|
||||
const topoDistanceData& fInfo = allFaceInfo[frontFaceI];
|
||||
|
||||
if (fInfo.distance() <= cInfo.distance())
|
||||
{
|
||||
samplingPts.append(mesh.cellCentres()[frontCellI]);
|
||||
samplingCells.append(frontCellI);
|
||||
samplingFaces.append(-1);
|
||||
samplingSegments.append(pointI);
|
||||
//Check if mag of distance is useful
|
||||
samplingCurveDist.append(nPathPoints);
|
||||
}
|
||||
samplingSegments.append(iter);
|
||||
samplingCurveDist.append
|
||||
(
|
||||
trackLength+cInfo.distance()
|
||||
);
|
||||
isLeakCell.set(frontCellI);
|
||||
|
||||
if
|
||||
(
|
||||
touchesWall
|
||||
(
|
||||
mesh,
|
||||
frontFaceI,
|
||||
isLeakFace,
|
||||
isLeakPoint
|
||||
)
|
||||
)
|
||||
{
|
||||
isNewLeakPoint.set(mesh.faces()[frontFaceI]);
|
||||
origin = mesh.faceCentres()[frontFaceI];
|
||||
findMinDistance = false;
|
||||
}
|
||||
|
||||
// Situation 1: we found the destination cell (do nothing)
|
||||
if (!returnReduce(frontCellI != -1, orOp<bool>()))
|
||||
}
|
||||
}
|
||||
isLeakPoint.transfer(isNewLeakPoint);
|
||||
}
|
||||
|
||||
// Situation 1: we found the destination cell (do nothing),
|
||||
// frontCellI is -1 on all processors
|
||||
if (returnReduce(frontCellI == -1, andOp<bool>()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Situation 2: we're on a coupled patch and might need to
|
||||
// switch processor/cell
|
||||
// switch processor/cell. We need to transfer:
|
||||
// -frontface -frontdistance -leak points/faces
|
||||
boolList isFront(mesh.nBoundaryFaces(), false);
|
||||
|
||||
if (frontFaceI != -1)
|
||||
@ -246,32 +541,259 @@ void Foam::shortestPathSet::genSamples(const polyMesh& mesh)
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh, isFront);
|
||||
|
||||
label minCellDistance = labelMax;
|
||||
if (frontCellI != -1)
|
||||
{
|
||||
minCellDistance = allCellInfo[frontCellI].distance();
|
||||
}
|
||||
reduce(minCellDistance, minOp<label>());
|
||||
|
||||
// Sync all leak data
|
||||
sync
|
||||
(
|
||||
mesh,
|
||||
isLeakFace,
|
||||
isLeakPoint,
|
||||
frontCellI,
|
||||
origin,
|
||||
findMinDistance
|
||||
);
|
||||
|
||||
|
||||
|
||||
const label oldFrontFaceI = frontFaceI;
|
||||
frontCellI = -1;
|
||||
frontFaceI = -1;
|
||||
forAll(pbm, patchI)
|
||||
{
|
||||
const polyPatch& pp = pbm[patchI];
|
||||
forAll(pp, i)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
if (isFront[faceI-mesh.nInternalFaces()])
|
||||
if
|
||||
(
|
||||
oldFrontFaceI == -1
|
||||
&& isFront[faceI-mesh.nInternalFaces()]
|
||||
&& (isBlockedFace.empty() || !isBlockedFace[faceI])
|
||||
)
|
||||
{
|
||||
frontFaceI = faceI;
|
||||
frontCellI = pp.faceCells()[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (frontCellI != -1)
|
||||
if
|
||||
(
|
||||
frontCellI != -1
|
||||
&& allCellInfo[frontCellI].distance() < minCellDistance
|
||||
)
|
||||
{
|
||||
const topoDistanceData& cInfo = allCellInfo[frontCellI];
|
||||
|
||||
samplingPts.append(mesh.cellCentres()[frontCellI]);
|
||||
samplingCells.append(frontCellI);
|
||||
samplingFaces.append(-1);
|
||||
samplingSegments.append(pointI);
|
||||
samplingCurveDist.append(nPathPoints);
|
||||
samplingSegments.append(iter);
|
||||
samplingCurveDist.append
|
||||
(
|
||||
trackLength+cInfo.distance()
|
||||
);
|
||||
isLeakCell.set(frontCellI);
|
||||
|
||||
// Check if frontFacei touches leakPoint
|
||||
if
|
||||
(
|
||||
touchesWall
|
||||
(
|
||||
mesh,
|
||||
frontFaceI,
|
||||
isLeakFace,
|
||||
isLeakPoint
|
||||
)
|
||||
)
|
||||
{
|
||||
isLeakPoint.set(mesh.faces()[frontFaceI]);
|
||||
origin = mesh.faceCentres()[frontFaceI];
|
||||
findMinDistance = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// When seed cell is isolated by processor boundaries
|
||||
if (insideCelli != -1 && frontCellI == insideCelli)
|
||||
{
|
||||
// Pout<< " Found connection seed cell!" << endl;
|
||||
frontCellI = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Sync all leak data
|
||||
sync
|
||||
(
|
||||
mesh,
|
||||
isLeakFace,
|
||||
isLeakPoint,
|
||||
frontCellI,
|
||||
origin,
|
||||
findMinDistance
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Recalculate the overall trackLength
|
||||
trackLength = returnReduce
|
||||
(
|
||||
(
|
||||
samplingCurveDist.size()
|
||||
? samplingCurveDist.last()
|
||||
: 0
|
||||
),
|
||||
maxOp<scalar>()
|
||||
);
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const fvMesh& fm = refCast<const fvMesh>(mesh);
|
||||
|
||||
const_cast<fvMesh&>(fm).setInstance(fm.time().timeName());
|
||||
volScalarField fld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"isLeakCell",
|
||||
fm.time().timeName(),
|
||||
fm,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fm,
|
||||
dimensionedScalar(dimless, Zero)
|
||||
);
|
||||
forAll(isLeakCell, celli)
|
||||
{
|
||||
fld[celli] = isLeakCell[celli];
|
||||
}
|
||||
fld.correctBoundaryConditions();
|
||||
fld.write();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::shortestPathSet::genSamples
|
||||
(
|
||||
const bool markLeakPath,
|
||||
const label maxIter,
|
||||
const polyMesh& mesh,
|
||||
const labelUList& wallPatches,
|
||||
const boolList& isBlockedFace
|
||||
)
|
||||
{
|
||||
// Storage for sample points
|
||||
DynamicList<point> samplingPts;
|
||||
DynamicList<label> samplingCells;
|
||||
DynamicList<label> samplingFaces;
|
||||
DynamicList<label> samplingSegments;
|
||||
DynamicList<scalar> samplingCurveDist;
|
||||
|
||||
// Seed faces and points on 'real' boundary
|
||||
PackedBoolList isLeakFace(mesh.nFaces());
|
||||
PackedBoolList isLeakPoint(mesh.nPoints());
|
||||
{
|
||||
// Real boundaries
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
for (label patchi : wallPatches)
|
||||
{
|
||||
const polyPatch& pp = pbm[patchi];
|
||||
forAll(pp, i)
|
||||
{
|
||||
isLeakPoint.set(pp[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Meshed boundaries
|
||||
forAll(isBlockedFace, facei)
|
||||
{
|
||||
if (isBlockedFace[facei])
|
||||
{
|
||||
isLeakPoint.set(mesh.faces()[facei]);
|
||||
}
|
||||
}
|
||||
|
||||
syncTools::syncPointList
|
||||
(
|
||||
mesh,
|
||||
isLeakPoint,
|
||||
orEqOp<unsigned int>(),
|
||||
0u
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// All cells along leak paths
|
||||
PackedBoolList isLeakCell(mesh.nCells());
|
||||
|
||||
label prevSegmenti = 0;
|
||||
scalar prevDistance = 0.0;
|
||||
|
||||
for (auto insidePoint : insidePoints_)
|
||||
{
|
||||
const label insideCelli = mesh.findCell(insidePoint);
|
||||
|
||||
for (auto outsidePoint : outsidePoints_)
|
||||
{
|
||||
const label nOldSamples = samplingSegments.size();
|
||||
|
||||
// Append any leak path to sampling*
|
||||
genSamples
|
||||
(
|
||||
markLeakPath,
|
||||
maxIter,
|
||||
mesh,
|
||||
isBlockedFace,
|
||||
insidePoint,
|
||||
insideCelli,
|
||||
outsidePoint,
|
||||
|
||||
samplingPts,
|
||||
samplingCells,
|
||||
samplingFaces,
|
||||
samplingSegments,
|
||||
samplingCurveDist,
|
||||
isLeakCell,
|
||||
isLeakFace,
|
||||
isLeakPoint
|
||||
);
|
||||
|
||||
// Make segment, distance consecutive
|
||||
label maxSegment = 0;
|
||||
scalar maxDistance = 0.0;
|
||||
for (label i = nOldSamples; i < samplingSegments.size(); ++i)
|
||||
{
|
||||
samplingSegments[i] += prevSegmenti;
|
||||
maxSegment = max(maxSegment, samplingSegments[i]);
|
||||
samplingCurveDist[i] += prevDistance;
|
||||
maxDistance = max(maxDistance, samplingCurveDist[i]);
|
||||
}
|
||||
prevSegmenti = returnReduce(maxSegment, maxOp<label>());
|
||||
prevDistance = returnReduce(maxDistance, maxOp<scalar>());
|
||||
}
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
const faceList leakFaces(mesh.faces(), isLeakFace.sortedToc());
|
||||
|
||||
OBJstream str(mesh.time().path()/"isLeakFace.obj");
|
||||
str.write(leakFaces, mesh.points(), false);
|
||||
Pout<< "Writing " << leakFaces.size() << " faces to " << str.name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
samplingPts.shrink();
|
||||
samplingCells.shrink();
|
||||
@ -304,15 +826,100 @@ Foam::shortestPathSet::shortestPathSet
|
||||
const polyMesh& mesh,
|
||||
const meshSearch& searchEngine,
|
||||
const word& axis,
|
||||
const bool markLeakPath,
|
||||
const label maxIter,
|
||||
const labelUList& wallPatches,
|
||||
const pointField& insidePoints,
|
||||
const pointField& outsidePoints
|
||||
const pointField& outsidePoints,
|
||||
const boolList& isBlockedFace
|
||||
)
|
||||
:
|
||||
sampledSet(name, mesh, searchEngine, axis),
|
||||
insidePoints_(insidePoints),
|
||||
outsidePoints_(outsidePoints)
|
||||
{
|
||||
genSamples(mesh);
|
||||
if (debug)
|
||||
{
|
||||
fileName outputDir;
|
||||
if (Pstream::master())
|
||||
{
|
||||
outputDir =
|
||||
mesh.time().path()
|
||||
/ (Pstream::parRun() ? ".." : "")
|
||||
/ functionObject::outputPrefix
|
||||
/ mesh.pointsInstance();
|
||||
outputDir.clean();
|
||||
mkDir(outputDir);
|
||||
Info<< "shortestPathSet : Writing blocked faces to "
|
||||
<< outputDir << endl;
|
||||
}
|
||||
|
||||
const vtkSurfaceWriter surfWriter;
|
||||
|
||||
const indirectPrimitivePatch setPatch
|
||||
(
|
||||
IndirectList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
findIndices(isBlockedFace, true)
|
||||
),
|
||||
mesh.points()
|
||||
);
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
labelList pointToGlobal;
|
||||
labelList uniqueMeshPointLabels;
|
||||
autoPtr<globalIndex> globalPoints;
|
||||
autoPtr<globalIndex> globalFaces;
|
||||
faceList mergedFaces;
|
||||
pointField mergedPoints;
|
||||
Foam::PatchTools::gatherAndMerge
|
||||
(
|
||||
mesh,
|
||||
setPatch.localFaces(),
|
||||
setPatch.meshPoints(),
|
||||
setPatch.meshPointMap(),
|
||||
|
||||
pointToGlobal,
|
||||
uniqueMeshPointLabels,
|
||||
globalPoints,
|
||||
globalFaces,
|
||||
|
||||
mergedFaces,
|
||||
mergedPoints
|
||||
);
|
||||
|
||||
// Write
|
||||
if (Pstream::master())
|
||||
{
|
||||
surfWriter.write
|
||||
(
|
||||
outputDir,
|
||||
"blockedFace",
|
||||
meshedSurfRef
|
||||
(
|
||||
mergedPoints,
|
||||
mergedFaces
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
surfWriter.write
|
||||
(
|
||||
outputDir,
|
||||
"blockedFace",
|
||||
meshedSurfRef
|
||||
(
|
||||
setPatch.localPoints(),
|
||||
setPatch.localFaces()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
genSamples(markLeakPath, maxIter, mesh, wallPatches, isBlockedFace);
|
||||
}
|
||||
|
||||
|
||||
@ -328,7 +935,22 @@ Foam::shortestPathSet::shortestPathSet
|
||||
insidePoints_(dict.get<pointField>("insidePoints")),
|
||||
outsidePoints_(dict.get<pointField>("outsidePoints"))
|
||||
{
|
||||
genSamples(mesh);
|
||||
const label maxIter(dict.lookupOrDefault<label>("maxIter", 50));
|
||||
const bool markLeakPath(dict.lookupOrDefault<bool>("markLeakPath", true));
|
||||
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
DynamicList<label> wallPatches(pbm.size());
|
||||
forAll(pbm, patchi)
|
||||
{
|
||||
const polyPatch& pp = pbm[patchi];
|
||||
if (!pp.coupled() && !isA<emptyPolyPatch>(pp))
|
||||
{
|
||||
wallPatches.append(patchi);
|
||||
}
|
||||
}
|
||||
|
||||
genSamples(markLeakPath, maxIter, mesh, wallPatches, boolList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -73,6 +73,7 @@ SourceFiles
|
||||
#define shortestPathSet_H
|
||||
|
||||
#include "sampledSet.H"
|
||||
#include "PackedBoolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -106,11 +107,81 @@ class shortestPathSet
|
||||
const polyMesh& mesh,
|
||||
const label cellI,
|
||||
const List<topoDistanceData>& allFaceInfo,
|
||||
const PackedBoolList& isLeakPoint,
|
||||
const bool minDistance,
|
||||
const point& origin
|
||||
);
|
||||
|
||||
//- Generate whole path
|
||||
void genSamples(const polyMesh& mesh);
|
||||
//- Sync the leak path data
|
||||
void sync
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
PackedBoolList& isLeakFace,
|
||||
PackedBoolList& isLeakPoint,
|
||||
const label celli,
|
||||
point& origin,
|
||||
bool& findMinDistance
|
||||
) const;
|
||||
|
||||
//- Calculate (topological) distance to cellI
|
||||
void calculateDistance
|
||||
(
|
||||
const label iter,
|
||||
const polyMesh& mesh,
|
||||
const label cellI,
|
||||
|
||||
List<topoDistanceData>& allFaceInfo,
|
||||
List<topoDistanceData>& allCellInfo
|
||||
) const;
|
||||
|
||||
//- Checks if face uses a leak point
|
||||
bool touchesWall
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label facei,
|
||||
|
||||
PackedBoolList& isLeakFace,
|
||||
const PackedBoolList& isLeakPoint
|
||||
) const;
|
||||
|
||||
//- Calculate path between insideCelli (-1 if not on current processor)
|
||||
// and outsidePoint. Appends cellcentres on path to track.
|
||||
// isLeakCell : track passes through cell
|
||||
// isLeakFace : faces of leak cells that are also on boundary
|
||||
// isLeakPoint : points of leak faces ,,
|
||||
void genSamples
|
||||
(
|
||||
const bool markLeakPath,
|
||||
const label maxIter,
|
||||
const polyMesh& mesh,
|
||||
const boolList& isBlockedFace,
|
||||
const point& insidePoint,
|
||||
const label insideCelli,
|
||||
const point& outsidePoint,
|
||||
|
||||
DynamicList<point>& samplingPts,
|
||||
DynamicList<label>& samplingCells,
|
||||
DynamicList<label>& samplingFaces,
|
||||
DynamicList<label>& samplingSegments,
|
||||
DynamicList<scalar>& samplingCurveDist,
|
||||
PackedBoolList& isLeakCell,
|
||||
PackedBoolList& isLeakFace,
|
||||
PackedBoolList& isLeakPoint
|
||||
) const;
|
||||
|
||||
//- Generate whole path. With markLeakPath it will block all faces
|
||||
// along the whole path so will maximise the chances of finding
|
||||
// multiple gaps. With markLeakPath=false it will only block any
|
||||
// faces connected to a boundary. This makes for the nicest
|
||||
// hole-filling.
|
||||
void genSamples
|
||||
(
|
||||
const bool markLeakPath, // mark all cells along path
|
||||
const label maxIter,
|
||||
const polyMesh& mesh,
|
||||
const labelUList& wallPatches,
|
||||
const boolList& blockedFace
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
@ -121,15 +192,20 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
//- Construct from components. blockedFace is an optional specification
|
||||
// of face that behave as if a wall
|
||||
shortestPathSet
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const meshSearch& searchEngine,
|
||||
const word& axis,
|
||||
const bool markLeakPath,
|
||||
const label maxIter,
|
||||
const labelUList& wallPatches,
|
||||
const pointField& insidePoints,
|
||||
const pointField& outsidePoints
|
||||
const pointField& outsidePoints,
|
||||
const boolList& blockedFace
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volVectorField;
|
||||
location "0";
|
||||
object U;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/initialConditions"
|
||||
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
|
||||
internalField uniform $flowVelocity;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
#include "include/fixedInlet"
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue uniform (0 0 0);
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
lowerWall
|
||||
{
|
||||
type fixedValue;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
motorBikeGroup
|
||||
{
|
||||
type noSlip;
|
||||
}
|
||||
|
||||
#include "include/frontBackUpperPatches"
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,15 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
inlet
|
||||
{
|
||||
type fixedValue;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,19 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
upperWall
|
||||
{
|
||||
type slip;
|
||||
}
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type slip;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,14 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
flowVelocity (20 0 0);
|
||||
pressure 0;
|
||||
turbulentKE 0.24;
|
||||
turbulentOmega 1.78;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,53 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object k;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/initialConditions"
|
||||
|
||||
dimensions [0 2 -2 0 0 0 0];
|
||||
|
||||
internalField uniform $turbulentKE;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
//- Define inlet conditions
|
||||
#include "include/fixedInlet"
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
lowerWall
|
||||
{
|
||||
type kqRWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
motorBikeGroup
|
||||
{
|
||||
type kqRWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
#include "include/frontBackUpperPatches"
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,64 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object nut;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 2 -1 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
frontAndBack
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
inlet
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
lowerWall
|
||||
{
|
||||
type nutkWallFunction;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
upperWall
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
motorBikeGroup
|
||||
{
|
||||
type nutkWallFunction;
|
||||
value uniform 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,52 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object omega;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/initialConditions"
|
||||
|
||||
dimensions [0 0 -1 0 0 0 0];
|
||||
|
||||
internalField uniform $turbulentOmega;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
#include "include/fixedInlet"
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
lowerWall
|
||||
{
|
||||
type omegaWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
motorBikeGroup
|
||||
{
|
||||
type omegaWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
#include "include/frontBackUpperPatches"
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,51 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object p;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "include/initialConditions"
|
||||
|
||||
dimensions [0 2 -2 0 0 0 0];
|
||||
|
||||
internalField uniform $pressure;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
inlet
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
type fixedValue;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
lowerWall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
motorBikeGroup
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
#include "include/frontBackUpperPatches"
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
11
tutorials/mesh/snappyHexMesh/motorBike_leakDetection/Allclean
Executable file
11
tutorials/mesh/snappyHexMesh/motorBike_leakDetection/Allclean
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
|
||||
cleanCase0
|
||||
|
||||
# Remove surface and features
|
||||
rm -f constant/triSurface/*.eMesh > /dev/null 2>&1
|
||||
rm -rf constant/extendedFeatureEdgeMesh > /dev/null 2>&1
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
27
tutorials/mesh/snappyHexMesh/motorBike_leakDetection/Allrun
Executable file
27
tutorials/mesh/snappyHexMesh/motorBike_leakDetection/Allrun
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
|
||||
|
||||
# Alternative decomposeParDict name:
|
||||
decompDict="-decomposeParDict system/decomposeParDict.6"
|
||||
## Standard decomposeParDict name:
|
||||
# unset decompDict
|
||||
|
||||
runApplication surfaceFeatureExtract
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication $decompDict decomposePar
|
||||
|
||||
# Using distributedTriSurfaceMesh?
|
||||
if foamDictionary -entry geometry -value system/snappyHexMeshDict | \
|
||||
grep -q distributedTriSurfaceMesh
|
||||
then
|
||||
runParallel $decompDict surfaceRedistributePar motorBike.obj independent
|
||||
fi
|
||||
|
||||
runParallel $decompDict snappyHexMesh -overwrite
|
||||
|
||||
runParallel $decompDict checkMesh -writeFields '(nonOrthoAngle)' -constant
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object transportProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
transportModel Newtonian;
|
||||
|
||||
nu 1.5e-05;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,4 @@
|
||||
Directory to house tri-surfaces
|
||||
|
||||
The Allrun script copies the surface from the $FOAM_TUTORIALS/resources/geometry
|
||||
directory
|
||||
@ -0,0 +1,134 @@
|
||||
# Wavefront OBJ file written 2018-08-03T14:33:08
|
||||
o bag_open
|
||||
|
||||
# points : 42
|
||||
# faces : 78
|
||||
# zones : 1
|
||||
# 0 bag (nFaces: 78)
|
||||
|
||||
# <points count="42">
|
||||
v 0.731382 -0.184759 1.21724
|
||||
v 0.730354 0.179212 1.2226
|
||||
v 0.763861 -0.186029 1.30968
|
||||
v 0.762833 0.177942 1.31504
|
||||
v 0.767511 -0.186152 1.31877
|
||||
v 0.768041 -0.186168 1.31992
|
||||
v 0.766482 0.177819 1.32413
|
||||
v 0.773217 -0.186297 1.3297
|
||||
v 0.772189 0.177674 1.33506
|
||||
v 0.779326 -0.186416 1.33893
|
||||
v 0.778297 0.177555 1.34429
|
||||
v 1.11457 -0.181694 1.08265
|
||||
v 1.11354 0.182278 1.08801
|
||||
v 0.7863 -0.186523 1.34752
|
||||
v 0.785272 0.177448 1.35288
|
||||
v 0.794069 -0.186617 1.35537
|
||||
v 0.79304 0.177355 1.36073
|
||||
v 0.802557 -0.186696 1.36242
|
||||
v 0.801529 0.177275 1.36778
|
||||
v 0.811685 -0.186762 1.3686
|
||||
v 0.810657 0.17721 1.37396
|
||||
v 0.821369 -0.186812 1.37385
|
||||
v 0.820341 0.17716 1.37921
|
||||
v 0.831521 -0.186846 1.37812
|
||||
v 0.830492 0.177126 1.38348
|
||||
v 0.842048 -0.186864 1.38138
|
||||
v 0.841019 0.177107 1.38674
|
||||
v 0.852854 -0.186866 1.38359
|
||||
v 0.851825 0.177105 1.38895
|
||||
v 0.863837 -0.186852 1.38474
|
||||
v 0.862809 0.177119 1.3901
|
||||
v 0.874894 -0.186822 1.38481
|
||||
v 0.873866 0.177149 1.39017
|
||||
v 0.885914 -0.186776 1.3838
|
||||
v 0.884886 0.177195 1.38916
|
||||
v 0.898014 -0.186706 1.38141
|
||||
v 0.895756 0.177257 1.38708
|
||||
v 0.907386 -0.186638 1.37858
|
||||
v 0.896986 0.177265 1.38677
|
||||
v 0.906357 0.177333 1.38394
|
||||
v 1.18436 -0.184423 1.2813
|
||||
v 1.18333 0.179549 1.28666
|
||||
# </points>
|
||||
|
||||
# <faces count="78">
|
||||
g bag
|
||||
f 2 1 4
|
||||
f 4 1 3
|
||||
f 3 5 4
|
||||
f 4 5 7
|
||||
f 7 5 6
|
||||
f 9 6 8
|
||||
f 10 9 8
|
||||
f 10 11 9
|
||||
f 10 14 11
|
||||
f 11 14 15
|
||||
f 15 14 16
|
||||
f 17 16 18
|
||||
f 19 18 20
|
||||
f 21 20 22
|
||||
f 23 22 24
|
||||
f 25 24 26
|
||||
f 27 26 28
|
||||
f 29 28 30
|
||||
f 31 30 32
|
||||
f 33 32 34
|
||||
f 35 34 37
|
||||
f 35 33 34
|
||||
f 34 36 37
|
||||
f 37 36 39
|
||||
f 39 36 38
|
||||
f 40 39 38
|
||||
f 33 31 32
|
||||
f 31 29 30
|
||||
f 29 27 28
|
||||
f 27 25 26
|
||||
f 25 23 24
|
||||
f 23 21 22
|
||||
f 21 19 20
|
||||
f 19 17 18
|
||||
f 17 15 16
|
||||
f 9 7 6
|
||||
f 13 2 40
|
||||
f 42 13 40
|
||||
f 7 9 4
|
||||
f 4 9 11
|
||||
f 40 11 33
|
||||
f 35 40 33
|
||||
f 35 37 40
|
||||
f 40 37 39
|
||||
f 11 15 33
|
||||
f 33 15 31
|
||||
f 31 15 17
|
||||
f 29 17 19
|
||||
f 27 19 21
|
||||
f 25 21 23
|
||||
f 25 27 21
|
||||
f 27 29 19
|
||||
f 29 31 17
|
||||
f 2 4 40
|
||||
f 40 4 11
|
||||
f 41 38 12
|
||||
f 12 38 1
|
||||
f 1 38 3
|
||||
f 3 38 10
|
||||
f 8 3 10
|
||||
f 8 6 3
|
||||
f 3 6 5
|
||||
f 36 34 38
|
||||
f 38 34 32
|
||||
f 10 32 14
|
||||
f 10 38 32
|
||||
f 32 30 14
|
||||
f 14 30 16
|
||||
f 16 30 28
|
||||
f 18 28 26
|
||||
f 20 26 24
|
||||
f 22 20 24
|
||||
f 20 18 26
|
||||
f 18 16 28
|
||||
f 42 40 41
|
||||
f 41 40 38
|
||||
f 41 12 42
|
||||
f 42 12 13
|
||||
# </faces>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType RAS;
|
||||
|
||||
RAS
|
||||
{
|
||||
RASModel kOmegaSST;
|
||||
|
||||
turbulence on;
|
||||
|
||||
printCoeffs on;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,86 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
scale 1;
|
||||
|
||||
vertices
|
||||
(
|
||||
(-5 -4 0)
|
||||
(15 -4 0)
|
||||
(15 4 0)
|
||||
(-5 4 0)
|
||||
(-5 -4 8)
|
||||
(15 -4 8)
|
||||
(15 4 8)
|
||||
(-5 4 8)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (20 8 8) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
frontAndBack
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(3 7 6 2)
|
||||
(1 5 4 0)
|
||||
);
|
||||
}
|
||||
inlet
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(0 4 7 3)
|
||||
);
|
||||
}
|
||||
outlet
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(2 6 5 1)
|
||||
);
|
||||
}
|
||||
lowerWall
|
||||
{
|
||||
type patch; //wall;
|
||||
faces
|
||||
(
|
||||
(0 3 2 1)
|
||||
);
|
||||
}
|
||||
upperWall
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(4 5 6 7)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,98 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Where to load it from (if not already in solver)
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
|
||||
DebugSwitches
|
||||
{
|
||||
//shortestPath 1;
|
||||
}
|
||||
|
||||
|
||||
application simpleFoam;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 500;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 100;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat binary;
|
||||
|
||||
writePrecision 6;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
functions
|
||||
{
|
||||
processorField
|
||||
{
|
||||
// Type of functionObject
|
||||
type processorField;
|
||||
|
||||
// Where to load it from (if not already in solver)
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
|
||||
// Function object enabled flag
|
||||
enabled true;
|
||||
|
||||
// When to output the average fields
|
||||
//writeControl writeTime;
|
||||
}
|
||||
|
||||
leakFind
|
||||
{
|
||||
type sets;
|
||||
|
||||
writeControl timeStep;
|
||||
interpolationScheme cell;
|
||||
setFormat vtk;
|
||||
|
||||
sets
|
||||
(
|
||||
leakFind
|
||||
{
|
||||
type shortestPath;
|
||||
insidePoints ((3.0001 3.0001 0.43));
|
||||
outsidePoints ((1 0 1.3));
|
||||
axis xyz;
|
||||
}
|
||||
);
|
||||
|
||||
// Needs at least one field
|
||||
fields ( processorID );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,37 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
cuttingPlane
|
||||
{
|
||||
type surfaces;
|
||||
libs ("libsampling.so");
|
||||
writeControl writeTime;
|
||||
|
||||
surfaceFormat vtk;
|
||||
fields ( p U );
|
||||
|
||||
interpolationScheme cellPoint;
|
||||
|
||||
surfaces
|
||||
(
|
||||
yNormal
|
||||
{
|
||||
type cuttingPlane;
|
||||
planeType pointAndNormal;
|
||||
pointAndNormalDict
|
||||
{
|
||||
point (0 0 0);
|
||||
normal (0 1 0);
|
||||
}
|
||||
interpolate true;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,30 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 6;
|
||||
|
||||
method hierarchical;
|
||||
// method ptscotch;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (3 2 1);
|
||||
//delta 0.001; // default=0.001
|
||||
//order xyz; // default=xzy
|
||||
dataFile "cellDecomposition";
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,17 @@
|
||||
// -*- C++ -*-
|
||||
// Minimal example of using the ensight write function object.
|
||||
// Many more options possible
|
||||
ensightWrite
|
||||
{
|
||||
type ensightWrite;
|
||||
libs ("libutilityFunctionObjects.so");
|
||||
log true;
|
||||
|
||||
// Fields to output (words or regex)
|
||||
fields (U p "(k|epsilon|omega)");
|
||||
|
||||
writeControl writeTime;
|
||||
writeInterval 1;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,41 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
forceCoeffs1
|
||||
{
|
||||
type forceCoeffs;
|
||||
|
||||
libs ("libforces.so");
|
||||
|
||||
writeControl timeStep;
|
||||
timeInterval 1;
|
||||
|
||||
log yes;
|
||||
|
||||
patches (motorBikeGroup);
|
||||
rho rhoInf; // Indicates incompressible
|
||||
rhoInf 1; // Redundant for incompressible
|
||||
liftDir (0 0 1);
|
||||
dragDir (1 0 0);
|
||||
CofR (0.72 0 0); // Axle midpoint on ground
|
||||
pitchAxis (0 1 0);
|
||||
magUInf 20;
|
||||
lRef 1.42; // Wheelbase length
|
||||
Aref 0.75; // Estimated
|
||||
/*
|
||||
binData
|
||||
{
|
||||
nBin 20; // output data into 20 bins
|
||||
direction (1 0 0); // bin direction
|
||||
cumulative yes;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,58 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default steadyState;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
grad(U) cellLimited Gauss linear 1;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) bounded Gauss linearUpwindV grad(U);
|
||||
div(phi,k) bounded Gauss upwind;
|
||||
div(phi,omega) bounded Gauss upwind;
|
||||
div((nuEff*dev2(T(grad(U))))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
wallDist
|
||||
{
|
||||
method meshWave;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,86 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
p
|
||||
{
|
||||
solver GAMG;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-7;
|
||||
relTol 0.01;
|
||||
}
|
||||
|
||||
Phi
|
||||
{
|
||||
$p;
|
||||
}
|
||||
|
||||
U
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0.1;
|
||||
nSweeps 1;
|
||||
}
|
||||
|
||||
k
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0.1;
|
||||
nSweeps 1;
|
||||
}
|
||||
|
||||
omega
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother GaussSeidel;
|
||||
tolerance 1e-8;
|
||||
relTol 0.1;
|
||||
nSweeps 1;
|
||||
}
|
||||
}
|
||||
|
||||
SIMPLE
|
||||
{
|
||||
nNonOrthogonalCorrectors 0;
|
||||
consistent yes;
|
||||
}
|
||||
|
||||
potentialFlow
|
||||
{
|
||||
nNonOrthogonalCorrectors 10;
|
||||
}
|
||||
|
||||
relaxationFactors
|
||||
{
|
||||
equations
|
||||
{
|
||||
U 0.9;
|
||||
k 0.7;
|
||||
omega 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
cache
|
||||
{
|
||||
grad(U);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,24 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object meshQualityDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Include defaults parameters from master dictionary
|
||||
#includeEtc "caseDicts/meshQualityDict"
|
||||
|
||||
//- minFaceWeight (0 -> 0.5)
|
||||
minFaceWeight 0.02;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,340 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object snappyHexMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Which of the steps to run
|
||||
castellatedMesh true;
|
||||
snap true;
|
||||
addLayers true;
|
||||
|
||||
|
||||
// Geometry. Definition of all surfaces. All surfaces are of class
|
||||
// searchableSurface.
|
||||
// Surfaces are used
|
||||
// - to specify refinement for any mesh cell intersecting it
|
||||
// - to specify refinement for any mesh cell inside/outside/near
|
||||
// - to 'snap' the mesh boundary to the surface
|
||||
geometry
|
||||
{
|
||||
//motorBike-wo-visor.obj
|
||||
motorBike-wo-visor-w-deletedElementsOnBack.obj
|
||||
{
|
||||
type triSurfaceMesh;
|
||||
name motorBike;
|
||||
}
|
||||
|
||||
bag_open.obj
|
||||
{
|
||||
type triSurfaceMesh;
|
||||
name motorBike_bag;
|
||||
}
|
||||
|
||||
refinementBox
|
||||
{
|
||||
type searchableBox;
|
||||
min (-1.0 -0.7 0.0);
|
||||
max ( 8.0 0.7 2.5);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Settings for the castellatedMesh generation.
|
||||
castellatedMeshControls
|
||||
{
|
||||
|
||||
// Refinement parameters
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// If local number of cells is >= maxLocalCells on any processor
|
||||
// switches from from refinement followed by balancing
|
||||
// (current method) to (weighted) balancing before refinement.
|
||||
maxLocalCells 100000;
|
||||
|
||||
// Overall cell limit (approximately). Refinement will stop immediately
|
||||
// upon reaching this number so a refinement level might not complete.
|
||||
// Note that this is the number of cells before removing the part which
|
||||
// is not 'visible' from the keepPoint. The final number of cells might
|
||||
// actually be a lot less.
|
||||
maxGlobalCells 2000000;
|
||||
|
||||
// The surface refinement loop might spend lots of iterations refining just a
|
||||
// few cells. This setting will cause refinement to stop if <= minimumRefine
|
||||
// are selected for refinement. Note: it will at least do one iteration
|
||||
// (unless the number of cells to refine is 0)
|
||||
minRefinementCells 10;
|
||||
|
||||
// Allow a certain level of imbalance during refining
|
||||
// (since balancing is quite expensive)
|
||||
// Expressed as fraction of perfect balance (= overall number of cells /
|
||||
// nProcs). 0=balance always.
|
||||
maxLoadUnbalance 0.10;
|
||||
|
||||
|
||||
// Number of buffer layers between different levels.
|
||||
// 1 means normal 2:1 refinement restriction, larger means slower
|
||||
// refinement.
|
||||
nCellsBetweenLevels 3;
|
||||
|
||||
|
||||
|
||||
// Explicit feature edge refinement
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Specifies a level for any cell intersected by its edges.
|
||||
// This is a featureEdgeMesh, read from constant/triSurface for now.
|
||||
features
|
||||
(
|
||||
{
|
||||
file "motorBike-wo-visor.eMesh";
|
||||
level 6;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Surface based refinement
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Specifies two levels for every surface. The first is the minimum level,
|
||||
// every cell intersecting a surface gets refined up to the minimum level.
|
||||
// The second level is the maximum level. Cells that 'see' multiple
|
||||
// intersections where the intersections make an
|
||||
// angle > resolveFeatureAngle get refined up to the maximum level.
|
||||
|
||||
refinementSurfaces
|
||||
{
|
||||
"motorBike.*"
|
||||
{
|
||||
// Surface-wise min and max refinement level
|
||||
level (5 6);
|
||||
|
||||
// Optional specification of patch type (default is wall). No
|
||||
// constraint types (cyclic, symmetry) etc. are allowed.
|
||||
patchInfo
|
||||
{
|
||||
type wall;
|
||||
inGroups (motorBikeGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve sharp angles
|
||||
resolveFeatureAngle 30;
|
||||
|
||||
|
||||
// Region-wise refinement
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Specifies refinement level for cells in relation to a surface. One of
|
||||
// three modes
|
||||
// - distance. 'levels' specifies per distance to the surface the
|
||||
// wanted refinement level. The distances need to be specified in
|
||||
// descending order.
|
||||
// - inside. 'levels' is only one entry and only the level is used. All
|
||||
// cells inside the surface get refined up to the level. The surface
|
||||
// needs to be closed for this to be possible.
|
||||
// - outside. Same but cells outside.
|
||||
|
||||
refinementRegions
|
||||
{
|
||||
refinementBox
|
||||
{
|
||||
mode inside;
|
||||
levels ((1E15 4));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Mesh selection
|
||||
// ~~~~~~~~~~~~~~
|
||||
|
||||
// After refinement patches get added for all refinementSurfaces and
|
||||
// all cells intersecting the surfaces get put into these patches. The
|
||||
// section reachable from the locationInMesh is kept.
|
||||
// NOTE: This point should never be on a face, always inside a cell, even
|
||||
// after refinement.
|
||||
locationInMesh (3.0001 3.0001 0.43);
|
||||
|
||||
locationsOutsideMesh ((1 0 1.3));
|
||||
|
||||
|
||||
// Whether any faceZones (as specified in the refinementSurfaces)
|
||||
// are only on the boundary of corresponding cellZones or also allow
|
||||
// free-standing zone faces. Not used if there are no faceZones.
|
||||
allowFreeStandingZoneFaces true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Settings for the snapping.
|
||||
snapControls
|
||||
{
|
||||
//- Number of patch smoothing iterations before finding correspondence
|
||||
// to surface
|
||||
nSmoothPatch 3;
|
||||
|
||||
//- Relative distance for points to be attracted by surface feature point
|
||||
// or edge. True distance is this factor times local
|
||||
// maximum edge length.
|
||||
tolerance 2.0;
|
||||
|
||||
//- Number of mesh displacement relaxation iterations.
|
||||
nSolveIter 30;
|
||||
|
||||
//- Maximum number of snapping relaxation iterations. Should stop
|
||||
// before upon reaching a correct mesh.
|
||||
nRelaxIter 5;
|
||||
|
||||
// Feature snapping
|
||||
|
||||
//- Number of feature edge snapping iterations.
|
||||
// Leave out altogether to disable.
|
||||
nFeatureSnapIter 10;
|
||||
|
||||
//- Detect (geometric only) features by sampling the surface
|
||||
// (default=false).
|
||||
implicitFeatureSnap false;
|
||||
|
||||
//- Use castellatedMeshControls::features (default = true)
|
||||
explicitFeatureSnap true;
|
||||
|
||||
//- Detect points on multiple surfaces (only for explicitFeatureSnap)
|
||||
multiRegionFeatureSnap false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Settings for the layer addition.
|
||||
addLayersControls
|
||||
{
|
||||
// Are the thickness parameters below relative to the undistorted
|
||||
// size of the refined cell outside layer (true) or absolute sizes (false).
|
||||
relativeSizes true;
|
||||
|
||||
// Per final patch (so not geometry!) the layer information
|
||||
layers
|
||||
{
|
||||
"(lowerWall|motorBike).*"
|
||||
{
|
||||
nSurfaceLayers 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Expansion factor for layer mesh
|
||||
expansionRatio 1.0;
|
||||
|
||||
// Wanted thickness of final added cell layer. If multiple layers
|
||||
// is the thickness of the layer furthest away from the wall.
|
||||
// Relative to undistorted size of cell outside layer.
|
||||
// See relativeSizes parameter.
|
||||
finalLayerThickness 0.3;
|
||||
|
||||
// Minimum thickness of cell layer. If for any reason layer
|
||||
// cannot be above minThickness do not add layer.
|
||||
// Relative to undistorted size of cell outside layer.
|
||||
minThickness 0.1;
|
||||
|
||||
// If points get not extruded do nGrow layers of connected faces that are
|
||||
// also not grown. This helps convergence of the layer addition process
|
||||
// close to features.
|
||||
// Note: changed(corrected) w.r.t 1.7.x! (didn't do anything in 1.7.x)
|
||||
nGrow 0;
|
||||
|
||||
// Advanced settings
|
||||
|
||||
// When not to extrude surface. 0 is flat surface, 90 is when two faces
|
||||
// are perpendicular
|
||||
featureAngle 60;
|
||||
|
||||
// At non-patched sides allow mesh to slip if extrusion direction makes
|
||||
// angle larger than slipFeatureAngle.
|
||||
slipFeatureAngle 30;
|
||||
|
||||
// Maximum number of snapping relaxation iterations. Should stop
|
||||
// before upon reaching a correct mesh.
|
||||
nRelaxIter 3;
|
||||
|
||||
// Number of smoothing iterations of surface normals
|
||||
nSmoothSurfaceNormals 1;
|
||||
|
||||
// Number of smoothing iterations of interior mesh movement direction
|
||||
nSmoothNormals 3;
|
||||
|
||||
// Smooth layer thickness over surface patches
|
||||
nSmoothThickness 10;
|
||||
|
||||
// Stop layer growth on highly warped cells
|
||||
maxFaceThicknessRatio 0.5;
|
||||
|
||||
// Reduce layer growth where ratio thickness to medial
|
||||
// distance is large
|
||||
maxThicknessToMedialRatio 0.3;
|
||||
|
||||
// Angle used to pick up medial axis points
|
||||
// Note: changed(corrected) w.r.t 1.7.x! 90 degrees corresponds to 130
|
||||
// in 1.7.x.
|
||||
minMedianAxisAngle 90;
|
||||
|
||||
|
||||
// Create buffer region for new layer terminations
|
||||
nBufferCellsNoExtrude 0;
|
||||
|
||||
|
||||
// Overall max number of layer addition iterations. The mesher will exit
|
||||
// if it reaches this number of iterations; possibly with an illegal
|
||||
// mesh.
|
||||
nLayerIter 50;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Generic mesh quality settings. At any undoable phase these determine
|
||||
// where to undo.
|
||||
meshQualityControls
|
||||
{
|
||||
#include "meshQualityDict"
|
||||
|
||||
|
||||
// Advanced
|
||||
|
||||
//- Number of error distribution iterations
|
||||
nSmoothScale 4;
|
||||
//- Amount to scale back displacement at error points
|
||||
errorReduction 0.75;
|
||||
}
|
||||
|
||||
|
||||
// Advanced
|
||||
|
||||
// Format to use for lines (e.g. leak path)
|
||||
setFormat nastran;
|
||||
|
||||
|
||||
// Write flags
|
||||
writeFlags
|
||||
(
|
||||
scalarLevels
|
||||
layerSets
|
||||
layerFields // write volScalarField for layer coverage
|
||||
);
|
||||
|
||||
|
||||
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
|
||||
// Note: the write tolerance needs to be higher than this.
|
||||
mergeTolerance 1e-6;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,58 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
streamLines
|
||||
{
|
||||
// Where to load it from
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
|
||||
type streamLine;
|
||||
|
||||
// Output every
|
||||
writeControl writeTime;
|
||||
// writeInterval 10;
|
||||
|
||||
setFormat vtk; //gnuplot; //xmgr; //raw; //jplot; //csv; //ensight;
|
||||
|
||||
// Tracked forwards (+U) or backwards (-U)
|
||||
trackForward true;
|
||||
|
||||
// Names of fields to sample. Should contain above velocity field!
|
||||
fields (p U k);
|
||||
|
||||
// Steps particles can travel before being removed
|
||||
lifeTime 10000;
|
||||
|
||||
//- Specify either absolute length of steps (trackLength) or a number
|
||||
// of subcycling steps per cell (nSubCycle)
|
||||
|
||||
// Size of single track segment [m]
|
||||
//trackLength 1e-3;
|
||||
|
||||
// Number of steps per cell (estimate). Set to 1 to disable subcycling.
|
||||
nSubCycle 5;
|
||||
|
||||
|
||||
// Cloud name to use
|
||||
cloud particleTracks;
|
||||
|
||||
// Seeding method.
|
||||
seedSampleSet
|
||||
{
|
||||
type uniform;
|
||||
axis x; //distance;
|
||||
|
||||
// Note: tracks slightly offset so as not to be on a face
|
||||
start (-1.001 -0.05 0.0011);
|
||||
end (-1.001 -0.05 1.0011);
|
||||
nPoints 20;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,45 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object surfaceFeatureExtractDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
motorBike-wo-visor.obj
|
||||
{
|
||||
// How to obtain raw features (extractFromFile || extractFromSurface)
|
||||
extractionMethod extractFromSurface;
|
||||
|
||||
// Mark edges whose adjacent surface normals are at an angle less
|
||||
// than includedAngle as features
|
||||
// - 0 : selects no edges
|
||||
// - 180: selects all edges
|
||||
includedAngle 150;
|
||||
|
||||
subsetFeatures
|
||||
{
|
||||
// Keep nonManifold edges (edges with >2 connected faces)
|
||||
nonManifoldEdges no;
|
||||
|
||||
// Keep open edges (edges with 1 connected face)
|
||||
openEdges yes;
|
||||
}
|
||||
|
||||
|
||||
// Write options
|
||||
|
||||
// Write features to obj format for postprocessing
|
||||
writeObj yes;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,100 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1806 |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Interpolate U to create near-wall UNear
|
||||
near
|
||||
{
|
||||
// Where to load it from
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
|
||||
type nearWallFields;
|
||||
|
||||
// Output every
|
||||
writeControl writeTime;
|
||||
|
||||
// Calculate every
|
||||
executeControl writeTime;
|
||||
|
||||
// Fields to be sampled. Per field original name and mapped field to
|
||||
// create.
|
||||
// Note: fields only get updated when writing!
|
||||
fields
|
||||
(
|
||||
(U UNear)
|
||||
);
|
||||
|
||||
// Patches/groups to sample (regular expressions)
|
||||
patches (motorBikeGroup);
|
||||
|
||||
// Distance to sample
|
||||
distance 0.001;
|
||||
}
|
||||
|
||||
// Use UNear to track along wall
|
||||
wallBoundedStreamLines
|
||||
{
|
||||
// Where to load it from (if not already in solver)
|
||||
libs ("libfieldFunctionObjects.so");
|
||||
type wallBoundedStreamLine;
|
||||
|
||||
// Output every
|
||||
writeControl writeTime;
|
||||
|
||||
setFormat vtk; //gnuplot; //xmgr; //raw; //jplot;
|
||||
|
||||
// Velocity field to use for tracking.
|
||||
U UNear;
|
||||
|
||||
// Interpolation method. Default is cellPoint.
|
||||
// interpolationScheme pointMVC;
|
||||
|
||||
// Tracked forwards (+U) or backwards (-U)
|
||||
trackForward true;
|
||||
|
||||
interpolationScheme cellPoint;
|
||||
|
||||
// Names of fields to sample. Should contain above velocity field!
|
||||
fields (p U k UNear);
|
||||
|
||||
// Steps particles can travel before being removed
|
||||
lifeTime 100;
|
||||
|
||||
// Cloud name to use
|
||||
cloud wallBoundedParticleTracks;
|
||||
|
||||
// Seeding method.
|
||||
seedSampleSet
|
||||
{
|
||||
type patchSeed;
|
||||
|
||||
uniformCoeffs
|
||||
{
|
||||
axis x; //distance;
|
||||
|
||||
start (0.0035 0.0999 0.0001);
|
||||
end (0.0035 0.0999 0.0099);
|
||||
nPoints 20;
|
||||
}
|
||||
|
||||
cloudCoeffs
|
||||
{
|
||||
axis x; //distance;
|
||||
points ((0.351516548679288 -0.0116085375585099 1.24));
|
||||
}
|
||||
|
||||
patchSeedCoeffs
|
||||
{
|
||||
patches (motorBikeGroup);
|
||||
axis x; //distance;
|
||||
maxPoints 20000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user