Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2011-05-03 11:15:03 +01:00
161 changed files with 9099 additions and 1141 deletions

View File

@ -120,6 +120,8 @@
+ reuses tracking state in interpolation - improves consistency and speed
*** *Updated* split cyclics into two separate patches.
See [[./doc/changes/splitCyclic.txt]]
* *New* cyclics (and all coupled patches) have optional
matchTolerance entry to allow looser area matching tolerance.
* *Updated* interpolation (volPointInterpolation) now works without the
globalPointPatch. Moving mesh cases can now be run non-parallel and
continued in parallel and reconstructed without any limitation.
@ -312,8 +314,3 @@
* Other
+ compilable with =clang=
In your prefs.sh set the WM_COMPILER to Clang
+ dlclose error: upon exit of e.g. paraFoam you can get the error
Inconsistency detected by ld.so: dl-close.c: 731: _dl_close: Assertion
`map->l_init_called' failed!
This seems to happen with a mix of system libraries and a thirdParty
compiler.

View File

@ -26,4 +26,4 @@
mesh
);
# include "createPhi.H"
#include "createPhi.H"

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -110,7 +110,12 @@ int main(int argc, char *argv[])
if (runTime.outputTime())
{
calcEk(U, K).write(runTime.timePath()/"Ek", runTime.graphFormat());
calcEk(U, K).write
(
runTime.path()/"graphs"/runTime.timeName(),
"Ek",
runTime.graphFormat()
);
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -57,7 +57,7 @@ int main(int argc, char *argv[])
Info<< "\nStarting time loop\n" << endl;
while (pimple.loop())
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

View File

@ -41,12 +41,27 @@ Description
#include "faceSet.H"
#include "DynamicList.H"
#include <cassert>
#include "MeshedSurfaces.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template<>
inline unsigned Hash<face>::operator()(const face& t, unsigned seed) const
{
return Hasher(t.cdata(),t.size()*sizeof(label), seed);
}
template<>
inline unsigned Hash<face>::operator()(const face& t) const
{
return Hash<face>::operator()(t, 0);
}
}
const string SEPARATOR(" -1");
bool isSeparator(const string& line)
@ -98,7 +113,7 @@ void readHeader(IFstream& is)
}
else
{
Sout<< line << endl;
Info<< line << endl;
}
}
}
@ -107,7 +122,7 @@ void readHeader(IFstream& is)
// Skip
void skipSection(IFstream& is)
{
Sout<< "Skipping section at line " << is.lineNumber() << '.' << endl;
Info<< "Skipping section at line " << is.lineNumber() << '.' << endl;
string line;
@ -119,10 +134,6 @@ void skipSection(IFstream& is)
{
break;
}
else
{
// Sout<< line << endl;
}
}
}
@ -148,19 +159,19 @@ void readUnits
scalar& tempOffset
)
{
Sout<< "Starting reading units at line " << is.lineNumber() << '.' << endl;
Info<< "Starting reading units at line " << is.lineNumber() << '.' << endl;
string line;
is.getLine(line);
label l = readLabel(IStringStream(line.substr(0, 10))());
Sout<< "l:" << l << endl;
Info<< "l:" << l << endl;
string units(line.substr(10, 20));
Sout<< "units:" << units << endl;
Info<< "units:" << units << endl;
label unitType = readLabel(IStringStream(line.substr(30, 10))());
Sout<< "unitType:" << unitType << endl;
Info<< "unitType:" << unitType << endl;
// Read lengthscales
is.getLine(line);
@ -172,7 +183,7 @@ void readUnits
is.getLine(line);
tempOffset = readUnvScalar(line.substr(0, 25));
Sout<< "Unit factors:" << nl
Info<< "Unit factors:" << nl
<< " Length scale : " << lengthScale << nl
<< " Force scale : " << forceScale << nl
<< " Temperature scale : " << tempScale << nl
@ -189,7 +200,7 @@ void readPoints
DynamicList<label>& unvPointID // unv index
)
{
Sout<< "Starting reading points at line " << is.lineNumber() << '.' << endl;
Info<< "Starting reading points at line " << is.lineNumber() << '.' << endl;
static bool hasWarned = false;
@ -232,9 +243,22 @@ void readPoints
points.shrink();
unvPointID.shrink();
Sout<< "Read " << points.size() << " points." << endl;
Info<< "Read " << points.size() << " points." << endl;
}
void addAndExtend
(
DynamicList<label>& indizes,
label cellI,
label val
)
{
if (indizes.size() < (cellI+1))
{
indizes.setSize(cellI+1,-1);
}
indizes[cellI] = val;
}
// Reads cells section. Read region as well? Not handled yet but should just
// be a matter of reading corresponding to boundaryFaces the correct property
@ -245,10 +269,21 @@ void readCells
DynamicList<cellShape>& cellVerts,
DynamicList<label>& cellMaterial,
DynamicList<label>& boundaryFaceIndices,
DynamicList<face>& boundaryFaces
DynamicList<face>& boundaryFaces,
DynamicList<label>& cellCorrespondence,
DynamicList<label>& unvPointID // unv index
)
{
Sout<< "Starting reading cells at line " << is.lineNumber() << '.' << endl;
Info<< "Starting reading cells at line " << is.lineNumber() << '.' << endl;
// Invert point numbering.
label maxUnvPoint = 0;
forAll(unvPointID, pointI)
{
maxUnvPoint = max(maxUnvPoint, unvPointID[pointI]);
}
labelList unvToFoam(invert(maxUnvPoint+1, unvPointID));
const cellModel& hex = *(cellModeller::lookup("hex"));
const cellModel& prism = *(cellModeller::lookup("prism"));
@ -328,6 +363,7 @@ void readCells
cellVerts.append(cellShape(tet, cVerts, true));
cellMaterial.append(physProp);
addAndExtend(cellCorrespondence,cellI,cellMaterial.size()-1);
if (cellVerts.last().size() != cVerts.size())
{
@ -352,6 +388,7 @@ void readCells
cellVerts.append(cellShape(prism, cVerts, true));
cellMaterial.append(physProp);
addAndExtend(cellCorrespondence,cellI,cellMaterial.size()-1);
if (cellVerts.last().size() != cVerts.size())
{
@ -376,10 +413,11 @@ void readCells
cellVerts.append(cellShape(hex, cVerts, true));
cellMaterial.append(physProp);
addAndExtend(cellCorrespondence,cellI,cellMaterial.size()-1);
if (cellVerts.last().size() != cVerts.size())
{
Pout<< "Line:" << is.lineNumber()
Info<< "Line:" << is.lineNumber()
<< " element:" << cellI
<< " type:" << feID
<< " collapsed from " << cVerts << nl
@ -407,6 +445,7 @@ void readCells
cellVerts.append(cellShape(tet, cVerts, true));
cellMaterial.append(physProp);
addAndExtend(cellCorrespondence,cellI,cellMaterial.size()-1);
if (cellVerts.last().size() != cVerts.size())
{
@ -433,20 +472,21 @@ void readCells
cellMaterial.shrink();
boundaryFaces.shrink();
boundaryFaceIndices.shrink();
cellCorrespondence.shrink();
Sout<< "Read " << cellVerts.size() << " cells"
Info<< "Read " << cellVerts.size() << " cells"
<< " and " << boundaryFaces.size() << " boundary faces." << endl;
}
void readPatches
void readSets
(
IFstream& is,
DynamicList<word>& patchNames,
DynamicList<labelList>& patchFaceIndices
)
{
Sout<< "Starting reading patches at line " << is.lineNumber() << '.'
Info<< "Starting reading patches at line " << is.lineNumber() << '.'
<< endl;
while (true)
@ -509,7 +549,7 @@ void readPatches
}
else
{
IOWarningIn("readPatches(..)", is)
IOWarningIn("readSets(..)", is)
<< "When reading patches expect entity type code 8"
<< nl << " Skipping group code " << groupType
<< endl;
@ -530,7 +570,7 @@ void readDOFS
DynamicList<labelList>& dofVertices
)
{
Sout<< "Starting reading contraints at line " << is.lineNumber() << '.'
Info<< "Starting reading contraints at line " << is.lineNumber() << '.'
<< endl;
string line;
@ -636,6 +676,9 @@ int main(int argc, char *argv[])
}
// Switch on additional debug info
const bool verbose = false; //true;
// Unit scale factors
scalar lengthScale = 1;
scalar forceScale = 1;
@ -650,6 +693,7 @@ int main(int argc, char *argv[])
// Cells
DynamicList<cellShape> cellVerts;
DynamicList<label> cellMat;
DynamicList<label> cellCorrespondence;
// Boundary faces
DynamicList<label> boundaryFaceIndices;
@ -670,7 +714,7 @@ int main(int argc, char *argv[])
break;
}
Sout<< "Processing tag:" << tag << endl;
Info<< "Processing tag:" << tag << endl;
switch (tag)
{
@ -700,13 +744,15 @@ int main(int argc, char *argv[])
cellVerts,
cellMat,
boundaryFaceIndices,
boundaryFaces
boundaryFaces,
cellCorrespondence,
unvPointID
);
break;
case 2452:
case 2467:
readPatches
readSets
(
inFile,
patchNames,
@ -724,12 +770,12 @@ int main(int argc, char *argv[])
break;
default:
Sout<< "Skipping tag " << tag << " on line "
Info<< "Skipping tag " << tag << " on line "
<< inFile.lineNumber() << endl;
skipSection(inFile);
break;
}
Sout<< endl;
Info<< endl;
}
@ -798,6 +844,58 @@ int main(int argc, char *argv[])
List<faceList> patchFaceVerts;
labelList nrFaceCells(boundaryFaces.size(),0);
HashTable<label,label> faceToCell[2];
{
HashTable<label, face, Hash<face> > faceToFaceID(boundaryFaces.size());
forAll(boundaryFaces, faceI)
{
SortableList<label> foo(boundaryFaces[faceI]);
face theFace(foo);
faceToFaceID.insert(theFace,faceI);
}
forAll(cellVerts, cellI)
{
faceList faces = cellVerts[cellI].faces();
forAll(faces, i)
{
SortableList<label> foo(faces[i]);
face theFace(foo);
if (faceToFaceID.found(theFace))
{
label faceI = faceToFaceID[theFace];
if (nrFaceCells[faceI] < 2)
{
faceToCell[nrFaceCells[faceI]].insert(faceI,cellI);
}
nrFaceCells[faceI]++;
}
}
}
label cnt = 0;
forAll(nrFaceCells, faceI)
{
assert(nrFaceCells[faceI] == 1 || nrFaceCells[faceI] == 2);
if (nrFaceCells[faceI]>1)
{
cnt++;
}
}
if (cnt>0)
{
Info << "Of " << boundaryFaces.size() << " so-called"
<< " boundary faces " << cnt << " belong to two cells "
<< "and are therefore internal" << endl;
}
}
HashTable<labelList,word> cellZones;
HashTable<labelList,word> faceZones;
List<bool> isAPatch(patchNames.size(),true);
if (dofVertIndices.size())
{
@ -867,6 +965,10 @@ int main(int argc, char *argv[])
Info<< "Sorting boundary faces according to group (patch)" << endl;
// make sure that no face is used twice on the boundary
// (possible for boundary-only faceZones)
labelHashSet alreadyOnBoundary;
// Construct map from boundaryFaceIndices
Map<label> boundaryFaceToIndex(boundaryFaceIndices.size());
@ -877,16 +979,101 @@ int main(int argc, char *argv[])
forAll(patchFaceVerts, patchI)
{
Info << patchI << ": " << patchNames[patchI] << " is " << flush;
faceList& patchFaces = patchFaceVerts[patchI];
const labelList& faceIndices = patchFaceIndices[patchI];
patchFaces.setSize(faceIndices.size());
bool duplicateFaces = false;
label cnt = 0;
forAll(patchFaces, i)
{
if (boundaryFaceToIndex.found(faceIndices[i]))
{
label bFaceI = boundaryFaceToIndex[faceIndices[i]];
if (nrFaceCells[bFaceI] == 1)
{
patchFaces[cnt] = boundaryFaces[bFaceI];
cnt++;
if (alreadyOnBoundary.found(bFaceI))
{
duplicateFaces = true;
}
}
}
}
if (cnt != patchFaces.size() || duplicateFaces)
{
isAPatch[patchI] = false;
if (verbose)
{
if (cnt != patchFaces.size())
{
WarningIn(args.executable())
<< "For patch " << patchI << " there were "
<< patchFaces.size()-cnt
<< " faces not used because they seem"
<< " to be internal. "
<< "This seems to be a face or a cell-zone"
<< endl;
}
else
{
WarningIn(args.executable())
<< "Patch "
<< patchI << " has faces that are already "
<< " in use on other boundary-patches,"
<< " Assuming faceZoneset." << endl;
}
}
patchFaces.setSize(0); // Assume that this is no patch at all
if (cellCorrespondence[faceIndices[0]] >= 0)
{
Info << "cellZone" << endl;
labelList theCells(faceIndices.size());
forAll(faceIndices, i)
{
if (cellCorrespondence[faceIndices[0]] < 0)
{
FatalErrorIn(args.executable())
<< "The face index " << faceIndices[i]
<< " was not found amongst the cells."
<< " This kills the theory that "
<< patchNames[patchI] << " is a cell zone"
<< endl
<< abort(FatalError);
}
theCells[i] = cellCorrespondence[faceIndices[i]];
}
cellZones.insert(patchNames[patchI], theCells);
}
else
{
Info << "faceZone" << endl;
labelList theFaces(faceIndices.size());
forAll(faceIndices, i)
{
theFaces[i] = boundaryFaceToIndex[faceIndices[i]];
}
faceZones.insert(patchNames[patchI],theFaces);
}
}
else
{
Info << "patch" << endl;
forAll(patchFaces, i)
{
label bFaceI = boundaryFaceToIndex[faceIndices[i]];
patchFaces[i] = boundaryFaces[bFaceI];
alreadyOnBoundary.insert(bFaceI);
}
}
}
}
@ -920,12 +1107,23 @@ int main(int argc, char *argv[])
}
Info<< "Constructing mesh with non-default patches of size:" << nl;
Info<< "\nConstructing mesh with non-default patches of size:" << nl;
DynamicList<word> usedPatchNames;
DynamicList<faceList> usedPatchFaceVerts;
forAll(patchNames, patchI)
{
if (isAPatch[patchI])
{
Info<< " " << patchNames[patchI] << '\t'
<< patchFaceVerts[patchI].size() << nl;
usedPatchNames.append(patchNames[patchI]);
usedPatchFaceVerts.append(patchFaceVerts[patchI]);
}
}
usedPatchNames.shrink();
usedPatchFaceVerts.shrink();
Info<< endl;
@ -941,14 +1139,124 @@ int main(int argc, char *argv[])
),
xferMove(polyPoints),
cellVerts,
patchFaceVerts, // boundaryFaces,
patchNames, // boundaryPatchNames,
usedPatchFaceVerts, // boundaryFaces,
usedPatchNames, // boundaryPatchNames,
wordList(patchNames.size(), polyPatch::typeName), // boundaryPatchTypes,
"defaultFaces", // defaultFacesName
polyPatch::typeName, // defaultFacesType,
wordList(0) // boundaryPatchPhysicalTypes
);
if (faceZones.size() > 0 || cellZones.size() > 0)
{
Info << "Adding cell and face zones" << endl;
List<pointZone*> pZones(0);
List<faceZone*> fZones(faceZones.size());
List<cellZone*> cZones(cellZones.size());
if (cellZones.size() > 0)
{
forAll(cellZones.toc(), cnt)
{
word name = cellZones.toc()[cnt];
Info<< " Cell Zone " << name << " " << tab
<< cellZones[name].size() << endl;
cZones[cnt] = new cellZone
(
name,
cellZones[name],
cnt,
mesh.cellZones()
);
}
}
if (faceZones.size() > 0)
{
const labelList& own = mesh.faceOwner();
const labelList& nei = mesh.faceNeighbour();
const pointField& centers = mesh.faceCentres();
const pointField& points = mesh.points();
forAll(faceZones.toc(), cnt)
{
word name = faceZones.toc()[cnt];
const labelList& oldIndizes = faceZones[name];
labelList indizes(oldIndizes.size());
Info<< " Face Zone " << name << " " << tab
<< oldIndizes.size() << endl;
forAll(indizes, i)
{
const label old = oldIndizes[i];
label noveau = -1;
label c1 = -1, c2 = -1;
if (faceToCell[0].found(old))
{
c1 = faceToCell[0][old];
}
if (faceToCell[1].found(old))
{
c2 = faceToCell[1][old];
}
if (c1 < c2)
{
label tmp = c1;
c1 = c2;
c2 = tmp;
}
if (c2 == -1)
{
// Boundary face is part of the faceZone
forAll(own, j)
{
if (own[j] == c1)
{
const face& f = boundaryFaces[old];
if (mag(centers[j]- f.centre(points)) < SMALL)
{
noveau = j;
break;
}
}
}
}
else
{
forAll(nei, j)
{
if
(
(c1 == own[j] && c2 == nei[j])
|| (c2 == own[j] && c1 == nei[j])
)
{
noveau = j;
break;
}
}
}
assert(noveau > -1);
indizes[i] = noveau;
}
fZones[cnt] = new faceZone
(
faceZones.toc()[cnt],
indizes,
boolList(indizes.size(),false),
cnt,
mesh.faceZones()
);
}
}
mesh.addZones(pZones, fZones, cZones);
Info << endl;
}
mesh.write();
Info<< "End\n" << endl;

File diff suppressed because it is too large Load Diff

View File

@ -526,13 +526,6 @@ int main(int argc, char *argv[])
// Whether to synchronise points
const Switch pointSync(dict.lookup("pointSync"));
// Set the matching tolerance so we can read illegal meshes
scalar tol = readScalar(dict.lookup("matchTolerance"));
Info<< "Using relative tolerance " << tol
<< " to match up faces and points" << nl << endl;
coupledPolyPatch::matchTol = tol;
# include "createNamedPolyMesh.H"
const word oldInstance = mesh.pointsInstance();

View File

@ -34,19 +34,15 @@ FoamFile
// This will usually fail upon loading:
// "face 0 area does not match neighbour 2 by 0.0100005%"
// " -- possible face ordering problem."
// - change patch type from 'cyclic' to 'patch' in the polyMesh/boundary file.
// - loosen match tolerance to get case to load
// - regenerate cyclic as above
// - in polyMesh/boundary file:
// - loosen matchTolerance of all cyclics to get case to load
// - or change patch type from 'cyclic' to 'patch'
// and regenerate cyclic as above
// Tolerance used in matching faces. Absolute tolerance is span of
// face times this factor. To load incorrectly matches meshes set this
// to a higher value.
matchTolerance 1E-3;
// Do a synchronisation of coupled points after creation of any patches.
// Note: this does not work with points that are on multiple coupled patches
// with transformations.
// with transformations (i.e. cyclics).
pointSync false;
// Patches to create.
@ -67,6 +63,12 @@ patches
transform rotational;
rotationAxis (1 0 0);
rotationCentre (0 0 0);
// transform translational;
// separationVector (1 0 0);
// Optional non-default tolerance to be able to define cyclics
// on bad meshes
//matchTolerance 1E-2;
}
// How to construct: either from 'patches' or 'set'

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -160,8 +160,10 @@ bool Foam::domainDecomposition::writeDecomposition()
}
label maxProcCells = 0;
label totProcFaces = 0;
label maxProcPatches = 0;
label totProcPatches = 0;
label maxProcFaces = 0;
@ -749,6 +751,8 @@ bool Foam::domainDecomposition::writeDecomposition()
<< " Number of cells = " << procMesh.nCells()
<< endl;
maxProcCells = max(maxProcCells, procMesh.nCells());
label nBoundaryFaces = 0;
label nProcPatches = 0;
label nProcFaces = 0;
@ -780,6 +784,7 @@ bool Foam::domainDecomposition::writeDecomposition()
<< " Number of boundary faces = " << nBoundaryFaces << endl;
totProcFaces += nProcFaces;
totProcPatches += nProcPatches;
maxProcPatches = max(maxProcPatches, nProcPatches);
maxProcFaces = max(maxProcFaces, nProcFaces);
@ -851,10 +856,21 @@ bool Foam::domainDecomposition::writeDecomposition()
boundaryProcAddressing.write();
}
scalar avgProcCells = scalar(nCells())/nProcs_;
scalar avgProcPatches = scalar(totProcPatches)/nProcs_;
scalar avgProcFaces = scalar(totProcFaces)/nProcs_;
Info<< nl
<< "Number of processor faces = " << totProcFaces/2 << nl
<< "Max number of processor patches = " << maxProcPatches << nl
<< "Max number of cells = " << maxProcCells
<< " (" << 100.0*(maxProcCells-avgProcCells)/avgProcCells
<< "% above average " << avgProcCells << ")" << nl
<< "Max number of processor patches = " << maxProcPatches
<< " (" << 100.0*(maxProcPatches-avgProcPatches)/avgProcPatches
<< "% above average " << avgProcPatches << ")" << nl
<< "Max number of faces between processors = " << maxProcFaces
<< " (" << 100.0*(maxProcFaces-avgProcFaces)/avgProcFaces
<< "% above average " << avgProcFaces << ")" << nl
<< endl;
return true;

View File

@ -23,6 +23,7 @@ FoamFile
// gnuplot
// raw
// vtk
// csv
setFormat raw;
// Surface output format. Choice of

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,15 +43,15 @@ Description
int main(int argc, char *argv[])
{
argList::noParallel();
# include "setRootCase.H"
#include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
# include "readBoxTurbDict.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "readBoxTurbDict.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Kmesh K(mesh);
@ -67,7 +67,12 @@ int main(int argc, char *argv[])
U.write();
calcEk(U, K).write(runTime.timePath()/"Ek", runTime.graphFormat());
calcEk(U, K).write
(
runTime.path()/"graphs"/runTime.timeName(),
"Ek",
runTime.graphFormat()
);
Info<< "end" << endl;

View File

@ -237,8 +237,6 @@ else
echo "Executing: $APPLICATION $@ > log 2>&1 &"
$APPLICATION $@ > log 2>&1 &
fi
else
fi
#------------------------------------------------------------------------------

View File

@ -67,6 +67,7 @@ then
done
elif [ -d $packDir/platforms ]
then
# obtain archOptions types from platforms/<archOptions>/lib
for archOptions in $packDir/platforms/*/lib

View File

@ -571,6 +571,10 @@ interpolations = interpolations
interpolation = $(interpolations)/interpolation
$(interpolations)/patchToPatchInterpolation/PatchToPatchInterpolationName.C
$(interpolations)/interpolationTable/tableReaders/tableReaders.C
$(interpolations)/interpolationTable/tableReaders/openFoam/openFoamTableReaders.C
$(interpolations)/interpolationTable/tableReaders/csv/csvTableReaders.C
algorithms/MeshWave/MeshWaveName.C
algorithms/MeshWave/FaceCellWaveName.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,6 +27,7 @@ License
#include "OFstream.H"
#include "IOmanip.H"
#include "Pair.H"
#include "OSspecific.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -211,11 +212,11 @@ void Foam::graph::write(Ostream& os, const word& format) const
}
void Foam::graph::write(const fileName& fName, const word& format) const
void Foam::graph::write(const fileName& pName, const word& format) const
{
autoPtr<writer> graphWriter(writer::New(format));
OFstream graphFile(fName + '.' + graphWriter().ext());
OFstream graphFile(pName + '.' + graphWriter().ext());
if (graphFile.good())
{
@ -230,6 +231,18 @@ void Foam::graph::write(const fileName& fName, const word& format) const
}
void Foam::graph::write
(
const fileName& path,
const word& name,
const word& format
) const
{
mkDir(path);
write(path/name, format);
}
Foam::Ostream& Foam::operator<<(Ostream& os, const graph& g)
{
g.writeTable(os);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -252,8 +252,16 @@ public:
//- Write graph to stream in given format
void write(Ostream&, const word& format) const;
//- Write graph to file in given format
void write(const fileName& fName, const word& format) const;
//- Write graph to file in given path-name and format
void write(const fileName& pName, const word& format) const;
//- Write graph to file in given path, name and format
void write
(
const fileName& path,
const word& name,
const word& format
) const;
// Friend operators

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,6 +25,7 @@ License
#include "interpolationTable.H"
#include "IFstream.H"
#include "openFoamTableReader.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
@ -38,19 +39,19 @@ void Foam::interpolationTable<Type>::readTable()
fName.expand();
// Read data from file
IFstream(fName)() >> *this;
// Check that the data are okay
check();
reader_()(fName, *this);
if (this->empty())
{
FatalErrorIn
(
"Foam::interpolationTable<Type>::readTable()"
) << "table is empty" << nl
) << "table read from " << fName << " is empty" << nl
<< exit(FatalError);
}
// Check that the data are okay
check();
}
@ -61,7 +62,8 @@ Foam::interpolationTable<Type>::interpolationTable()
:
List<Tuple2<scalar, Type> >(),
boundsHandling_(interpolationTable::WARN),
fileName_("fileNameIsUndefined")
fileName_("fileNameIsUndefined"),
reader_(NULL)
{}
@ -75,7 +77,8 @@ Foam::interpolationTable<Type>::interpolationTable
:
List<Tuple2<scalar, Type> >(values),
boundsHandling_(bounds),
fileName_(fName)
fileName_(fName),
reader_(NULL)
{}
@ -84,7 +87,8 @@ Foam::interpolationTable<Type>::interpolationTable(const fileName& fName)
:
List<Tuple2<scalar, Type> >(),
boundsHandling_(interpolationTable::WARN),
fileName_(fName)
fileName_(fName),
reader_(new openFoamTableReader<Type>())
{
readTable();
}
@ -95,7 +99,8 @@ Foam::interpolationTable<Type>::interpolationTable(const dictionary& dict)
:
List<Tuple2<scalar, Type> >(),
boundsHandling_(wordToBoundsHandling(dict.lookup("outOfBounds"))),
fileName_(dict.lookup("fileName"))
fileName_(dict.lookup("fileName")),
reader_(tableReader<Type>::New(dict))
{
readTable();
}
@ -109,7 +114,8 @@ Foam::interpolationTable<Type>::interpolationTable
:
List<Tuple2<scalar, Type> >(interpTable),
boundsHandling_(interpTable.boundsHandling_),
fileName_(interpTable.fileName_)
fileName_(interpTable.fileName_),
reader_(interpTable.reader_) // note: steals reader. Used in write().
{}
@ -233,6 +239,10 @@ void Foam::interpolationTable<Type>::write(Ostream& os) const
<< fileName_ << token::END_STATEMENT << nl;
os.writeKeyword("outOfBounds")
<< boundsHandlingToWord(boundsHandling_) << token::END_STATEMENT << nl;
if (reader_.valid())
{
reader_->write(os);
}
}

View File

@ -34,6 +34,19 @@ Description
If \a REPEAT is chosen for the out-of-bounds handling, the final time
value is treated as being equivalent to time=0 for the following periods.
The construct from dictionary reads a filename from a dictionary and
has an optional readerType. Default is to read OpenFOAM format. The only
other format is csv (comma separated values):
Read csv format:
readerType csv;
fileName "$FOAM_CASE/constant/p0vsTime.csv";
hasHeaderLine true; // skip first line
timeColumn 0; // time is in column 0
valueColumns (1); // value starts in column 1
Note
- Accessing an empty list results in an error.
- Accessing a list with a single element always returns the same value.
@ -49,6 +62,9 @@ SourceFiles
#include "List.H"
#include "Tuple2.H"
#include "tableReader.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -87,6 +103,8 @@ private:
//- File name
fileName fileName_;
//- the actual reader
autoPtr<tableReader<Type> > reader_;
// Private Member Functions

View File

@ -0,0 +1,181 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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 "csvTableReader.H"
#include "IFstream.H"
#include "DynamicList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::csvTableReader<Type>::csvTableReader(const dictionary& dict)
:
tableReader<Type>(dict),
headerLine_(readBool(dict.lookup("hasHeaderLine"))),
timeColumn_(readLabel(dict.lookup("timeColumn"))),
componentColumns_(dict.lookup("valueColumns")),
separator_(dict.lookupOrDefault<string>("separator", string(","))[0])
{
if (componentColumns_.size() != pTraits<Type>::nComponents)
{
FatalErrorIn("csvTableReader<Type>::csvTableReader(const dictionary&)")
<< componentColumns_ << " does not have the expected length "
<< pTraits<Type>::nComponents << endl
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::csvTableReader<Type>::~csvTableReader()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
namespace Foam
{
// doesn't recognize specialization otherwise
template<>
scalar csvTableReader<scalar>::readValue(const List<string>& splitted)
{
if (componentColumns_[0] >= splitted.size())
{
FatalErrorIn
(
"csvTableReader<scalar>::readValue(const List<string>&)"
) << "No column " << componentColumns_[0] << " in "
<< splitted << endl
<< exit(FatalError);
}
return readScalar(IStringStream(splitted[componentColumns_[0]])());
}
template<class Type>
Type csvTableReader<Type>::readValue(const List<string>& splitted)
{
Type result;
for(label i = 0;i < pTraits<Type>::nComponents; i++)
{
if (componentColumns_[i] >= splitted.size())
{
FatalErrorIn
(
"csvTableReader<Type>::readValue(const List<string>&)"
) << "No column " << componentColumns_[i] << " in "
<< splitted << endl
<< exit(FatalError);
}
result[i] = readScalar
(
IStringStream(splitted[componentColumns_[i]])()
);
}
return result;
}
}
template<class Type>
void Foam::csvTableReader<Type>::operator()
(
const fileName& fName,
List<Tuple2<scalar, Type> >& data
)
{
IFstream in(fName);
DynamicList<Tuple2<scalar, Type> > values;
// Skip header
if (headerLine_)
{
string line;
in.getLine(line);
}
while (in.good())
{
string line;
in.getLine(line);
DynamicList<string> splitted;
std::size_t pos = 0;
while (pos != std::string::npos)
{
std::size_t nPos = line.find(separator_, pos);
if (nPos == std::string::npos)
{
splitted.append(line.substr(pos));
pos=nPos;
}
else
{
splitted.append(line.substr(pos, nPos-pos));
pos=nPos+1;
}
}
if (splitted.size() <= 1)
{
break;
}
scalar time = readScalar(IStringStream(splitted[timeColumn_])());
Type value = readValue(splitted);
values.append(Tuple2<scalar,Type>(time, value));
}
data.transfer(values);
}
template<class Type>
void Foam::csvTableReader<Type>::write(Ostream& os) const
{
tableReader<Type>::write(os);
os.writeKeyword("hasHeaderLine")
<< headerLine_ << token::END_STATEMENT << nl;
os.writeKeyword("timeColumn")
<< timeColumn_ << token::END_STATEMENT << nl;
os.writeKeyword("valueColumns")
<< componentColumns_ << token::END_STATEMENT << nl;
os.writeKeyword("separator")
<< string(separator_) << token::END_STATEMENT << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,123 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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::tableReader
Description
Reads an interpolation table from a file - CSV-format
SourceFiles
tableReader.C
\*---------------------------------------------------------------------------*/
#ifndef csvTableReader_H
#define csvTableReader_H
#include "tableReader.H"
#include "labelList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class csvTableReader Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class csvTableReader
:
public tableReader<Type>
{
//- does the file have a header line?
const bool headerLine_;
//- column of the time
const label timeColumn_;
//- labels of the components
const labelList componentColumns_;
//- read the next value from the splitted string
Type readValue(const List<string>&);
//- separator character
const char separator_;
public:
//- Runtime type information
TypeName("csv");
// Constructors
//- Construct from dictionary
csvTableReader(const dictionary& dict);
//- Construct and return a copy
virtual autoPtr<tableReader<Type> > clone() const
{
return autoPtr<tableReader<Type> >
(
new csvTableReader<Type>
(
*this
)
);
}
//- Destructor
virtual ~csvTableReader();
// Member Functions
//- Read the table
virtual void operator()(const fileName&, List<Tuple2<scalar, Type> >&);
//- write the remaining parameters
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "csvTableReader.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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 "csvTableReader.H"
#include "tableReaders.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeTableReaders(csvTableReader);
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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 "openFoamTableReader.H"
#include "IFstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::openFoamTableReader<Type>::openFoamTableReader(const dictionary& dict)
:
tableReader<Type>(dict)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::openFoamTableReader<Type>::~openFoamTableReader()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::openFoamTableReader<Type>::operator()
(
const fileName& fName,
List<Tuple2<scalar, Type> >& data
)
{
// Read data from file
IFstream(fName)() >> data;
}
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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::tableReader
Description
Reads an interpolation table from a file - OpenFOAM-format
SourceFiles
tableReader.C
\*---------------------------------------------------------------------------*/
#ifndef openFoamTableReader_H
#define openFoamTableReader_H
#include "tableReader.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class openFoamTableReader Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class openFoamTableReader
:
public tableReader<Type>
{
public:
//- Runtime type information
TypeName("openFoam");
// Constructors
//- Construct from dictionary
openFoamTableReader(const dictionary &dict);
//- Construct and return a copy
virtual autoPtr<tableReader<Type> > clone() const
{
return autoPtr<tableReader<Type> >
(
new openFoamTableReader<Type>
(
*this
)
);
}
//- Destructor
virtual ~openFoamTableReader();
// Member functions
//- Read the table
virtual void operator()(const fileName&, List<Tuple2<scalar, Type> > &);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "openFoamTableReader.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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 "openFoamTableReader.H"
#include "tableReaders.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeTableReaders(openFoamTableReader);
}
// ************************************************************************* //

View File

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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 "tableReader.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class Type>
Foam::autoPtr<Foam::tableReader<Type> > Foam::tableReader<Type>::New
(
const dictionary& spec
)
{
const word readerType = spec.lookupOrDefault<word>
(
"readerType",
"openFoam"
);
typename dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_
->find(readerType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"tableReader::New(const dictionary&)"
) << "Unknown reader type " << readerType
<< nl << nl
<< "Valid reader types : " << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<tableReader<Type> >(cstrIter()(spec));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::tableReader<Type>::tableReader(const dictionary&)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::tableReader<Type>::~tableReader()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::tableReader<Type>::write(Ostream& os) const
{
if (this->type() != "openFoam")
{
os.writeKeyword("readerType")
<< this->type() << token::END_STATEMENT << nl;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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::tableReader
Description
Base class to read table data for the interpolationTable
SourceFiles
tableReader.C
\*---------------------------------------------------------------------------*/
#ifndef tableReader_H
#define tableReader_H
#include "fileName.H"
#include "wordList.H"
#include "vector.H"
#include "tensor.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
#include "autoPtr.H"
#include "dictionary.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class tableReader Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class tableReader
{
public:
//- Runtime type information
TypeName("tableReader");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
tableReader,
dictionary,
(const dictionary& dict),
(dict)
);
// Constructors
//- Construct from dictionary
tableReader(const dictionary& dict);
//- Construct and return a clone
virtual autoPtr<tableReader<Type> > clone() const = 0;
// Selectors
//- Return a reference to the selected tableReader
static autoPtr<tableReader> New(const dictionary& spec);
//- Destructor
virtual ~tableReader();
// Member functions
//- Read the table
virtual void operator()
(
const fileName&,
List<Tuple2<scalar, Type> >&
) = 0;
//- Write additional information
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "tableReader.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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 "tableReaders.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
#define defineTableReaderType(dataType) \
defineNamedTemplateTypeNameAndDebug(tableReader<dataType >, 0); \
defineTemplatedRunTimeSelectionTable(tableReader, dictionary, dataType);
defineTableReaderType(scalar);
defineTableReaderType(vector);
defineTableReaderType(sphericalTensor);
defineTableReaderType(symmTensor);
defineTableReaderType(tensor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,78 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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::tableReader
SourceFiles
tableReaders.C
\*---------------------------------------------------------------------------*/
#ifndef tableReaders_H
#define tableReaders_H
#include "tableReader.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Only used internally
#define makeTypeTableReadersTypeName(typeTableReader, dataType) \
\
defineNamedTemplateTypeNameAndDebug(typeTableReader< dataType >, 0)
// Sometimes used externally
#define makeTableReadersTypeName(typeTableReader) \
\
makeTypeTableReadersTypeName(typeTableReader, scalar); \
makeTypeTableReadersTypeName(typeTableReader, vector); \
makeTypeTableReadersTypeName(typeTableReader, sphericalTensor); \
makeTypeTableReadersTypeName(typeTableReader, symmTensor); \
makeTypeTableReadersTypeName(typeTableReader, tensor)
// Define type info for single dataType template instantiation (eg, vector)
#define makeTableReaderType(typeTableReader, dataType) \
\
defineNamedTemplateTypeNameAndDebug(typeTableReader< dataType >, 0); \
addTemplatedToRunTimeSelectionTable \
( \
tableReader, typeTableReader, dataType, dictionary \
)
// Define type info for scalar, vector etc. instantiations
#define makeTableReaders(typeTableReader) \
\
makeTableReaderType(typeTableReader, scalar); \
makeTableReaderType(typeTableReader, vector); \
makeTableReaderType(typeTableReader, sphericalTensor); \
makeTableReaderType(typeTableReader, symmTensor); \
makeTableReaderType(typeTableReader, tensor)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -34,7 +34,7 @@ namespace Foam
{
defineTypeNameAndDebug(coupledPolyPatch, 0);
scalar coupledPolyPatch::matchTol = 1E-3;
const scalar coupledPolyPatch::defaultMatchTol_ = 1E-4;
template<>
const char* NamedEnum<coupledPolyPatch::transformType, 4>::names[] =
@ -145,6 +145,7 @@ Foam::pointField Foam::coupledPolyPatch::getAnchorPoints
Foam::scalarField Foam::coupledPolyPatch::calcFaceTol
(
const scalar matchTol,
const UList<face>& faces,
const pointField& points,
const pointField& faceCentres
@ -313,7 +314,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
forwardT_.setSize(0);
reverseT_.setSize(0);
separation_ = (nf&(Cr - Cf))*nf;
separation_ = Cr - Cf;
collocated_.setSize(separation_.size());
@ -401,7 +402,8 @@ Foam::coupledPolyPatch::coupledPolyPatch
const polyBoundaryMesh& bm
)
:
polyPatch(name, size, start, index, bm)
polyPatch(name, size, start, index, bm),
matchTolerance_(defaultMatchTol_)
{}
@ -413,7 +415,8 @@ Foam::coupledPolyPatch::coupledPolyPatch
const polyBoundaryMesh& bm
)
:
polyPatch(name, dict, index, bm)
polyPatch(name, dict, index, bm),
matchTolerance_(dict.lookupOrDefault("matchTolerance", defaultMatchTol_))
{}
@ -423,7 +426,8 @@ Foam::coupledPolyPatch::coupledPolyPatch
const polyBoundaryMesh& bm
)
:
polyPatch(pp, bm)
polyPatch(pp, bm),
matchTolerance_(pp.matchTolerance_)
{}
@ -436,7 +440,8 @@ Foam::coupledPolyPatch::coupledPolyPatch
const label newStart
)
:
polyPatch(pp, bm, index, newSize, newStart)
polyPatch(pp, bm, index, newSize, newStart),
matchTolerance_(pp.matchTolerance_)
{}
@ -449,7 +454,8 @@ Foam::coupledPolyPatch::coupledPolyPatch
const label newStart
)
:
polyPatch(pp, bm, index, mapAddressing, newStart)
polyPatch(pp, bm, index, mapAddressing, newStart),
matchTolerance_(pp.matchTolerance_)
{}
@ -459,4 +465,17 @@ Foam::coupledPolyPatch::~coupledPolyPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::coupledPolyPatch::write(Ostream& os) const
{
polyPatch::write(os);
//if (matchTolerance_ != defaultMatchTol_)
{
os.writeKeyword("matchTolerance") << matchTolerance_
<< token::END_STATEMENT << nl;
}
}
// ************************************************************************* //

View File

@ -69,6 +69,12 @@ private:
// Private data
//- default matching tolerance
static const scalar defaultMatchTol_;
//- local matching tolerance
const scalar matchTolerance_;
//- offset (distance) vector from one side of the couple to the other
mutable vectorField separation_;
@ -81,14 +87,6 @@ private:
//- Are faces collocated. Either size 0,1 or length of patch.
mutable boolList collocated_;
public:
// Static data members
//- Relative tolerance (for geometric matching).
static scalar matchTol;
protected:
// Protected Member Functions
@ -105,7 +103,7 @@ protected:
const vectorField& nf,
const vectorField& nr,
const scalarField& smallDist,
const scalar absTol = matchTol,
const scalar absTol,
const transformType = UNKNOWN
) const;
@ -162,6 +160,7 @@ protected:
// from face centre to any of the face vertices.
static scalarField calcFaceTol
(
const scalar matchTol,
const UList<face>& faces,
const pointField& points,
const pointField& faceCentres
@ -295,6 +294,11 @@ public:
return collocated_;
}
scalar matchTolerance() const
{
return matchTolerance_;
}
//- Calculate the patch geometry
virtual void calcGeometry
@ -328,6 +332,9 @@ public:
labelList& faceMap,
labelList& rotation
) const = 0;
//- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const;
};

View File

@ -150,6 +150,7 @@ void Foam::cyclicPolyPatch::calcTransforms
}
// Some sanity checks
if (half0Ctrs.size() != half1Ctrs.size())
{
@ -163,11 +164,30 @@ void Foam::cyclicPolyPatch::calcTransforms
<< exit(FatalError);
}
if (transform_ != neighbPatch().transform_)
{
FatalErrorIn
(
"cyclicPolyPatch::calcTransforms()"
) << "Patch " << name()
<< " has transform type " << transformTypeNames[transform_]
<< ", neighbour patch " << neighbPatchName_
<< " has transform type "
<< neighbPatch().transformTypeNames[transform_]
<< exit(FatalError);
}
// Calculate transformation tensors
if (half0Ctrs.size() > 0)
{
vectorField half0Normals(half0Areas.size());
vectorField half1Normals(half1Areas.size());
scalar maxAreaDiff = -GREAT;
label maxAreaFacei = -1;
forAll(half0, facei)
{
scalar magSf = mag(half0Areas[facei]);
@ -182,24 +202,39 @@ void Foam::cyclicPolyPatch::calcTransforms
half0Normals[facei] = point(1, 0, 0);
half1Normals[facei] = half0Normals[facei];
}
else if (mag(magSf - nbrMagSf)/avSf > coupledPolyPatch::matchTol)
else
{
scalar areaDiff = mag(magSf - nbrMagSf)/avSf;
if (areaDiff > maxAreaDiff)
{
maxAreaDiff = areaDiff;
maxAreaFacei = facei;
}
if (areaDiff > matchTolerance())
{
FatalErrorIn
(
"cyclicPolyPatch::calcTransforms()"
) << "face " << facei << " area does not match neighbour by "
<< 100*mag(magSf - nbrMagSf)/avSf
) << "face " << facei
<< " area does not match neighbour by "
<< 100*areaDiff
<< "% -- possible face ordering problem." << endl
<< "patch:" << name()
<< " my area:" << magSf
<< " neighbour area:" << nbrMagSf
<< " matching tolerance:" << coupledPolyPatch::matchTol
<< " matching tolerance:" << matchTolerance()
<< endl
<< "Mesh face:" << start()+facei
<< " fc:" << half0Ctrs[facei]
<< endl
<< "Neighbour fc:" << half1Ctrs[facei]
<< endl
<< "If you are certain your matching is correct"
<< " you can increase the 'matchTolerance' setting"
<< " in the patch dictionary in the boundary file."
<< endl
<< "Rerun with cyclic debug flag set"
<< " for more information." << exit(FatalError);
}
@ -209,6 +244,18 @@ void Foam::cyclicPolyPatch::calcTransforms
half1Normals[facei] = half1Areas[facei] / nbrMagSf;
}
}
}
// Print area match
if (debug)
{
Pout<< "cyclicPolyPatch::calcTransforms :"
<< " Max area error:" << 100*maxAreaDiff << "% at face:"
<< maxAreaFacei << " at:" << half0Ctrs[maxAreaFacei]
<< " coupled face at:" << half1Ctrs[maxAreaFacei]
<< endl;
}
// Calculate transformation tensors
@ -259,6 +306,7 @@ void Foam::cyclicPolyPatch::calcTransforms
(
calcFaceTol
(
matchTolerance(),
half0,
half0.points(),
static_cast<const pointField&>(half0Ctrs)
@ -272,9 +320,74 @@ void Foam::cyclicPolyPatch::calcTransforms
half0Normals,
half1Normals,
half0Tols,
matchTol,
matchTolerance(),
transform_
);
if (transform_ == TRANSLATIONAL)
{
if (debug)
{
Pout<< "cyclicPolyPatch::calcTransforms :"
<< " Specified separation vector : "
<< separationVector_ << endl;
}
// Check that separation vectors are same.
const scalar avgTol = average(half0Tols);
if
(
mag(separationVector_ + neighbPatch().separationVector_)
> avgTol
)
{
WarningIn
(
"cyclicPolyPatch::calcTransforms()"
) << "Specified separation vector " << separationVector_
<< " differs by that of neighbouring patch "
<< neighbPatch().separationVector_
<< " by more than tolerance " << avgTol << endl
<< "patch:" << name()
<< " neighbour:" << neighbPatchName_
<< endl;
}
// Override computed transform with specified.
if
(
separation().size() != 1
|| mag(separation()[0] - separationVector_) > avgTol
)
{
WarningIn
(
"cyclicPolyPatch::calcTransforms()"
) << "Specified separationVector " << separationVector_
<< " differs from computed separation vector "
<< separation() << endl
<< "This probably means your geometry is not consistent"
<< " with the specified separation and might lead"
<< " to problems." << endl
<< "Continuing with specified separation vector "
<< separationVector_ << endl
<< "patch:" << name()
<< " neighbour:" << neighbPatchName_
<< endl;
}
// Set tensors
const_cast<tensorField&>(forwardT()).clear();
const_cast<tensorField&>(reverseT()).clear();
const_cast<vectorField&>(separation()) = vectorField
(
1,
separationVector_
);
const_cast<boolList&>(collocated()) = boolList(1, false);
}
}
}
}
@ -299,6 +412,16 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
anchors0 = getAnchorPoints(pp0, pp0.points());
half1Ctrs = pp1.faceCentres();
if (debug)
{
Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
<< " patch:" << name() << nl
<< "half0 untransformed faceCentres (avg) : "
<< gAverage(half0Ctrs) << nl
<< "half1 untransformed faceCentres (avg) : "
<< gAverage(half1Ctrs) << endl;
}
switch (transform_)
{
case ROTATIONAL:
@ -355,23 +478,24 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
break;
}
//- Problem: usually specified translation is not accurate enough
//- to get proper match so keep automatic determination over here.
//case TRANSLATIONAL:
//{
// // Transform 0 points.
//
// if (debug)
// {
// Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
// << "Specified translation : " << separationVector_
// << endl;
// }
//
// half0Ctrs += separationVector_;
// anchors0 += separationVector_;
// break;
//}
case TRANSLATIONAL:
{
// Transform 0 points.
if (debug)
{
Pout<< "cyclicPolyPatch::getCentresAndAnchors :"
<< "Specified translation : " << separationVector_
<< endl;
}
// Note: getCentresAndAnchors gets called on the slave side
// so separationVector is owner-slave points.
half0Ctrs -= separationVector_;
anchors0 -= separationVector_;
break;
}
default:
{
// Assumes that cyclic is planar. This is also the initial
@ -387,7 +511,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
vector n1 = pp1[max1I].normal(pp1.points());
n1 /= mag(n1) + VSMALL;
if (mag(n0 & n1) < 1-coupledPolyPatch::matchTol)
if (mag(n0 & n1) < 1-matchTolerance())
{
if (debug)
{
@ -438,7 +562,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
// Calculate typical distance per face
tols = calcFaceTol(pp1, pp1.points(), half1Ctrs);
tols = calcFaceTol(matchTolerance(), pp1, pp1.points(), half1Ctrs);
}
@ -743,6 +867,9 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
}
else if (separated())
{
// transformPosition gets called on the receiving side,
// separation gets calculated on the sending side so subtract.
const vectorField& s = separation();
if (s.size() == 1)
{
@ -1132,6 +1259,13 @@ bool Foam::cyclicPolyPatch::order
labelList& rotation
) const
{
if (debug)
{
Pout<< "order : of " << pp.size()
<< " faces of patch:" << name()
<< " neighbour:" << neighbPatchName_
<< endl;
}
faceMap.setSize(pp.size());
faceMap = -1;
@ -1174,6 +1308,14 @@ bool Foam::cyclicPolyPatch::order
tols
);
if (debug)
{
Pout<< "half0 transformed faceCentres (avg) : "
<< gAverage(half0Ctrs) << nl
<< "half1 untransformed faceCentres (avg) : "
<< gAverage(half1Ctrs) << endl;
}
// Geometric match of face centre vectors
bool matchedAll = matchPoints
(
@ -1308,7 +1450,7 @@ bool Foam::cyclicPolyPatch::order
void Foam::cyclicPolyPatch::write(Ostream& os) const
{
polyPatch::write(os);
coupledPolyPatch::write(os);
os.writeKeyword("neighbourPatch") << neighbPatchName_
<< token::END_STATEMENT << nl;
switch (transform_)

View File

@ -386,7 +386,7 @@ void Foam::oldCyclicPolyPatch::getCentresAndAnchors
vector n1 = half1Faces[max1I].normal(pp.points());
n1 /= mag(n1) + VSMALL;
if (mag(n0 & n1) < 1-coupledPolyPatch::matchTol)
if (mag(n0 & n1) < 1-matchTolerance())
{
if (debug)
{
@ -444,7 +444,7 @@ void Foam::oldCyclicPolyPatch::getCentresAndAnchors
// Calculate typical distance per face
tols = calcFaceTol(half1Faces, pp.points(), half1Ctrs);
tols = calcFaceTol(matchTolerance(), half1Faces, pp.points(), half1Ctrs);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -194,7 +194,7 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs)
faceNormals[facei] = point(1, 0, 0);
nbrFaceNormals[facei] = faceNormals[facei];
}
else if (mag(magSf - nbrMagSf)/avSf > coupledPolyPatch::matchTol)
else if (mag(magSf - nbrMagSf)/avSf > matchTolerance())
{
fileName nm
(
@ -214,12 +214,16 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs)
<< "patch:" << name()
<< " my area:" << magSf
<< " neighbour area:" << nbrMagSf
<< " matching tolerance:" << coupledPolyPatch::matchTol
<< " matching tolerance:" << matchTolerance()
<< endl
<< "Mesh face:" << start()+facei
<< " vertices:"
<< UIndirectList<point>(points(), operator[](facei))()
<< endl
<< "If you are certain your matching is correct"
<< " you can increase the 'matchTolerance' setting"
<< " in the patch dictionary in the boundary file."
<< endl
<< "Rerun with processor debug flag set for"
<< " more information." << exit(FatalError);
}
@ -236,7 +240,8 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs)
neighbFaceCentres_,
faceNormals,
nbrFaceNormals,
calcFaceTol(*this, points(), faceCentres())
calcFaceTol(matchTolerance(), *this, points(), faceCentres()),
matchTolerance()
);
}
}
@ -538,7 +543,10 @@ bool Foam::processorPolyPatch::order
}
// Calculate typical distance from face centre
scalarField tols(calcFaceTol(pp, pp.points(), pp.faceCentres()));
scalarField tols
(
calcFaceTol(matchTolerance(), pp, pp.points(), pp.faceCentres())
);
if (debug || masterCtrs.size() != pp.size())
{
@ -697,7 +705,7 @@ bool Foam::processorPolyPatch::order
void Foam::processorPolyPatch::write(Ostream& os) const
{
polyPatch::write(os);
coupledPolyPatch::write(os);
os.writeKeyword("myProcNo") << myProcNo_
<< token::END_STATEMENT << nl;
os.writeKeyword("neighbProcNo") << neighbProcNo_

View File

@ -125,6 +125,7 @@ void Foam::globalIndexAndTransform::determineTransforms()
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
transforms_ = List<vectorTensorTransform>(6);
scalarField maxTol(6);
label nextTrans = 0;
@ -148,8 +149,6 @@ void Foam::globalIndexAndTransform::determineTransforms()
if (mag(sepVec) > SMALL)
{
scalar tol = coupledPolyPatch::matchTol;
vectorTensorTransform transform(sepVec);
if
@ -159,12 +158,13 @@ void Foam::globalIndexAndTransform::determineTransforms()
transforms_,
dummyMatch,
transform,
tol,
cpp.matchTolerance(),
false
) == 0
)
{
transforms_[nextTrans++] = transform;
transforms_[nextTrans] = transform;
maxTol[nextTrans++] = cpp.matchTolerance();
}
if (nextTrans > 6)
@ -191,8 +191,6 @@ void Foam::globalIndexAndTransform::determineTransforms()
if (mag(transT - I) > SMALL)
{
scalar tol = coupledPolyPatch::matchTol;
vectorTensorTransform transform(transT);
if
@ -202,12 +200,13 @@ void Foam::globalIndexAndTransform::determineTransforms()
transforms_,
dummyMatch,
transform,
tol,
cpp.matchTolerance(),
false
) == 0
)
{
transforms_[nextTrans++] = transform;
transforms_[nextTrans] = transform;
maxTol[nextTrans++] = cpp.matchTolerance();
}
if (nextTrans > 6)
@ -227,12 +226,18 @@ void Foam::globalIndexAndTransform::determineTransforms()
}
}
// Collect transforms on master
List<List<vectorTensorTransform> > allTransforms(Pstream::nProcs());
allTransforms[Pstream::myProcNo()] = transforms_;
Pstream::gatherList(allTransforms);
// Collect matching tolerance on master
List<scalarField> allTols(Pstream::nProcs());
allTols[Pstream::myProcNo()] = maxTol;
Pstream::gatherList(allTols);
if (Pstream::master())
{
transforms_ = List<vectorTensorTransform>(3);
@ -250,8 +255,6 @@ void Foam::globalIndexAndTransform::determineTransforms()
if (mag(transform.t()) > SMALL || transform.hasR())
{
scalar tol = coupledPolyPatch::matchTol;
if
(
matchTransform
@ -259,7 +262,7 @@ void Foam::globalIndexAndTransform::determineTransforms()
transforms_,
dummyMatch,
transform,
tol,
allTols[procI][pSVI],
true
) == 0
)
@ -378,8 +381,6 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
if (mag(sepVec) > SMALL)
{
scalar tol = coupledPolyPatch::matchTol;
vectorTensorTransform t(sepVec);
label sign = matchTransform
@ -387,7 +388,7 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
transforms_,
matchTransI,
t,
tol,
cpp.matchTolerance(),
true
);
@ -424,8 +425,6 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
if (mag(transT - I) > SMALL)
{
scalar tol = coupledPolyPatch::matchTol;
vectorTensorTransform t(transT);
label sign = matchTransform
@ -433,7 +432,7 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
transforms_,
matchTransI,
t,
tol,
cpp.matchTolerance(),
true
);

View File

@ -26,7 +26,7 @@ Global
Description
Set the initial timestep corresponding to the timestep adjustment
algorithm in setDeltaT
algorithm in setDeltaT but only if it would reduce the timestep.
\*---------------------------------------------------------------------------*/
@ -39,7 +39,7 @@ if (adjustTimeStep)
min
(
maxCo*runTime.deltaTValue()/CoNum,
maxDeltaT
runTime.deltaTValue()
)
);
}

View File

@ -25,7 +25,9 @@ Class
Foam::timeVaryingFlowRateInletVelocityFvPatchVectorField
Description
A time-varying form of a flow normal vector boundary condition.
A time-varying form of a flow normal vector boundary condition. The
variation is specified as an interpolationTable (see
Foam::interpolationTable).
Example of the boundary condition specification:
\verbatim

View File

@ -25,7 +25,9 @@ Class
Foam::timeVaryingUniformFixedValueFvPatchField
Description
A time-varying form of a uniform fixed value boundary condition.
A time-varying form of a uniform fixed value boundary condition. The
variation is specified as an interpolationTable (see
Foam::interpolationTable for read options).
Example of the boundary condition specification:
\verbatim

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,9 @@ Class
Foam::timeVaryingUniformTotalPressureFvPatchScalarField
Description
A time-varying form of a uniform total pressure boundary condition.
A time-varying form of a uniform total pressure boundary condition. The
variation is specified as an interpolationTable (see
Foam::interpolationTable).
See Also
Foam::timeVaryingUniformFixedValueFvPatchField

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -52,17 +52,6 @@ void Foam::cyclicFvPatch::makeWeights(scalarField& w) const
forAll(magFa, facei)
{
scalar avFa = (magFa[facei] + nbrMagFa[facei])/2.0;
if (mag(magFa[facei] - nbrMagFa[facei])/avFa > 1e-4)
{
FatalErrorIn("cyclicFvPatch::makeWeights(scalarField&) const")
<< "face " << facei << " areas do not match by "
<< 100*mag(magFa[facei] - nbrMagFa[facei])/avFa
<< "% -- possible face ordering problem"
<< abort(FatalError);
}
scalar di = deltas[facei];
scalar dni = nbrDeltas[facei];

View File

@ -10,6 +10,6 @@ then
wmake $makeType MGridGenGamgAgglomeration
fi
wmake libso pairPatchAgglomeration
wmake $makeType pairPatchAgglomeration
# ----------------------------------------------------------------- end-of-file

View File

@ -251,6 +251,7 @@ void Foam::autoLayerDriver::handleNonManifolds
(
const indirectPrimitivePatch& pp,
const labelList& meshEdges,
const labelListList& edgeGlobalFaces,
pointField& patchDisp,
labelList& patchNLayers,
List<extrudeMode>& extrudeStatus
@ -268,11 +269,50 @@ void Foam::autoLayerDriver::handleNonManifolds
// 1. Local check
checkManifold(pp, nonManifoldPoints);
// 2. Remote check for boundary edges on coupled boundaries
forAll(edgeGlobalFaces, edgeI)
{
if
(
pp.edgeFaces()[edgeI].size() == 1
&& edgeGlobalFaces[edgeI].size() > 2
)
{
// So boundary edges that are connected to more than 2 processors
// i.e. a non-manifold edge which is exactly on a processor
// boundary.
const edge& e = pp.edges()[edgeI];
nonManifoldPoints.insert(pp.meshPoints()[e[0]]);
nonManifoldPoints.insert(pp.meshPoints()[e[1]]);
}
}
label nNonManif = returnReduce(nonManifoldPoints.size(), sumOp<label>());
Info<< "Outside of local patch is multiply connected across edges or"
<< " points at " << nNonManif << " points." << endl;
if (nNonManif > 0)
{
const labelList& meshPoints = pp.meshPoints();
forAll(meshPoints, patchPointI)
{
if (nonManifoldPoints.found(meshPoints[patchPointI]))
{
unmarkExtrusion
(
patchPointI,
patchDisp,
patchNLayers,
extrudeStatus
);
}
}
}
Info<< "Set displacement to zero for all " << nNonManif
<< " non-manifold points" << endl;
}
@ -1309,11 +1349,109 @@ void Foam::autoLayerDriver::getPatchDisplacement
}
bool Foam::autoLayerDriver::sameEdgeNeighbour
(
const labelListList& globalEdgeFaces,
const label myGlobalFaceI,
const label nbrGlobFaceI,
const label edgeI
) const
{
const labelList& eFaces = globalEdgeFaces[edgeI];
if (eFaces.size() == 2)
{
return edge(myGlobalFaceI, nbrGlobFaceI) == edge(eFaces[0], eFaces[1]);
}
else
{
return false;
}
}
void Foam::autoLayerDriver::getVertexString
(
const indirectPrimitivePatch& pp,
const labelListList& globalEdgeFaces,
const label faceI,
const label edgeI,
const label myGlobFaceI,
const label nbrGlobFaceI,
DynamicList<label>& vertices
) const
{
const labelList& fEdges = pp.faceEdges()[faceI];
label fp = findIndex(fEdges, edgeI);
if (fp == -1)
{
FatalErrorIn("autoLayerDriver::getVertexString(..)")
<< "problem." << abort(FatalError);
}
// Search back
label startFp = fp;
forAll(fEdges, i)
{
label prevFp = fEdges.rcIndex(startFp);
if
(
!sameEdgeNeighbour
(
globalEdgeFaces,
myGlobFaceI,
nbrGlobFaceI,
fEdges[prevFp]
)
)
{
break;
}
startFp = prevFp;
}
label endFp = fp;
forAll(fEdges, i)
{
label nextFp = fEdges.fcIndex(endFp);
if
(
!sameEdgeNeighbour
(
globalEdgeFaces,
myGlobFaceI,
nbrGlobFaceI,
fEdges[nextFp]
)
)
{
break;
}
endFp = nextFp;
}
const face& f = pp.localFaces()[faceI];
vertices.clear();
fp = startFp;
while (fp != endFp)
{
vertices.append(f[fp]);
fp = f.fcIndex(fp);
}
vertices.append(f[fp]);
fp = f.fcIndex(fp);
vertices.append(f[fp]);
}
// Truncates displacement
// - for all patchFaces in the faceset displacement gets set to zero
// - all displacement < minThickness gets set to zero
Foam::label Foam::autoLayerDriver::truncateDisplacement
(
const globalIndex& globalFaces,
const labelListList& edgeGlobalFaces,
const motionSmoother& meshMover,
const scalarField& minThickness,
const faceSet& illegalPatchFaces,
@ -1405,6 +1543,10 @@ Foam::label Foam::autoLayerDriver::truncateDisplacement
extrudeStatus
);
// Pinch
// ~~~~~
// Make sure that a face doesn't have two non-consecutive areas
// not extruded (e.g. quad where vertex 0 and 2 are not extruded
// but 1 and 3 are) since this gives topological errors.
@ -1457,6 +1599,112 @@ Foam::label Foam::autoLayerDriver::truncateDisplacement
<< " faces due to non-consecutive vertices being extruded." << endl;
// Butterfly
// ~~~~~~~~~
// Make sure that a string of edges becomes a single face so
// not a butterfly. Occassionally an 'edge' will have a single dangling
// vertex due to face combining. These get extruded as a single face
// (with a dangling vertex) so make sure this extrusion forms a single
// shape.
// - continuous i.e. no butterfly:
// + +
// |\ /|
// | \ / |
// +--+--+
// - extrudes from all but the endpoints i.e. no partial
// extrude
// +
// /|
// / |
// +--+--+
// The common error topology is a pinch somewhere in the middle
label nButterFly = 0;
{
DynamicList<label> stringedVerts;
forAll(pp.edges(), edgeI)
{
const labelList& globFaces = edgeGlobalFaces[edgeI];
if (globFaces.size() == 2)
{
label myFaceI = pp.edgeFaces()[edgeI][0];
label myGlobalFaceI = globalFaces.toGlobal
(
pp.addressing()[myFaceI]
);
label nbrGlobalFaceI =
(
globFaces[0] != myGlobalFaceI
? globFaces[0]
: globFaces[1]
);
getVertexString
(
pp,
edgeGlobalFaces,
myFaceI,
edgeI,
myGlobalFaceI,
nbrGlobalFaceI,
stringedVerts
);
if
(
extrudeStatus[stringedVerts[0]] != NOEXTRUDE
|| extrudeStatus[stringedVerts.last()] != NOEXTRUDE
)
{
// Any pinch in the middle
bool pinch = false;
for (label i = 1; i < stringedVerts.size()-1; i++)
{
if
(
extrudeStatus[stringedVerts[i]] == NOEXTRUDE
)
{
pinch = true;
break;
}
}
if (pinch)
{
forAll(stringedVerts, i)
{
if
(
unmarkExtrusion
(
stringedVerts[i],
patchDisp,
patchNLayers,
extrudeStatus
)
)
{
nButterFly++;
nChanged++;
}
}
}
}
}
}
}
reduce(nButterFly, sumOp<label>());
Info<< "truncateDisplacement : Unextruded " << nButterFly
<< " faces due to stringed edges with inconsistent extrusion."
<< endl;
// Consistent number of layers
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Make sure that a face has consistent number of layers for all
// its vertices.
@ -1504,7 +1752,7 @@ Foam::label Foam::autoLayerDriver::truncateDisplacement
//Info<< "truncateDisplacement : Unextruded " << nDiffering
// << " faces due to having differing number of layers." << endl;
if (nPinched+nDiffering == 0)
if (nPinched+nButterFly+nDiffering == 0)
{
break;
}
@ -1536,7 +1784,7 @@ void Foam::autoLayerDriver::setupLayerInfoTruncation
Info<< nl << "Performing no layer truncation."
<< " nBufferCellsNoExtrude set to less than 0 ..." << endl;
// Face layers if any point get extruded
// Face layers if any point gets extruded
forAll(pp.localFaces(), patchFaceI)
{
const face& f = pp.localFaces()[patchFaceI];
@ -2066,6 +2314,7 @@ void Foam::autoLayerDriver::addLayers
(
pp,
meshEdges,
edgeGlobalFaces,
patchDisp,
patchNLayers,
@ -2408,10 +2657,13 @@ void Foam::autoLayerDriver::addLayers
}
// Truncate displacements that are too small (this will do internal
// ones, coupled ones have already been truncated by syncPatch)
// ones, coupled ones have already been truncated by
// syncPatchDisplacement)
faceSet dummySet(mesh, "wrongPatchFaces", 0);
truncateDisplacement
(
globalFaces,
edgeGlobalFaces,
meshMover(),
minThickness,
dummySet,
@ -2467,9 +2719,9 @@ void Foam::autoLayerDriver::addLayers
// (first layer = layer of cells next to the original mesh)
vectorField firstDisp(patchNLayers.size(), vector::zero);
forAll(patchNLayers, i)
forAll(nPatchPointLayers, i)
{
if (patchNLayers[i] > 0)
if (nPatchPointLayers[i] > 0)
{
if (expansionRatio[i] == 1.0)
{

View File

@ -153,6 +153,7 @@ class autoLayerDriver
(
const indirectPrimitivePatch& pp,
const labelList& meshEdges,
const labelListList& edgeGlobalFaces,
pointField& patchDisp,
labelList& patchNLayers,
List<extrudeMode>& extrudeStatus
@ -261,12 +262,36 @@ class autoLayerDriver
List<extrudeMode>& extrudeStatus
) const;
//- for truncateDisplacement: find strings of edges
bool sameEdgeNeighbour
(
const labelListList& globalEdgeFaces,
const label myGlobalFaceI,
const label nbrGlobFaceI,
const label edgeI
) const;
//- for truncateDisplacement: find strings of edges
void getVertexString
(
const indirectPrimitivePatch& pp,
const labelListList& globalEdgeFaces,
const label faceI,
const label edgeI,
const label myGlobFaceI,
const label nbrGlobFaceI,
DynamicList<label>& vertices
) const;
//- Truncates displacement
// - for all patchFaces in the faceset displacement gets set
// to zero
// - all displacement < minThickness gets set to zero
// - all non-consecutive extrusions get set to 0
label truncateDisplacement
(
const globalIndex& globalFaces,
const labelListList& edgeGlobalFaces,
const motionSmoother& meshMover,
const scalarField& minThickness,
const faceSet& illegalPatchFaces,

View File

@ -1,11 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
makeType=${1:-libso}
set -x
wmake libso regionModel
#wmake libso pyrolysisModels
wmake libso surfaceFilmModels
#wmake libso regionCoupling
wmake $makeType regionModel
#wmake $makeType pyrolysisModels
wmake $makeType surfaceFilmModels
#wmake $makeType regionCoupling
# ----------------------------------------------------------------- end-of-file

View File

@ -24,6 +24,7 @@ $(setWriters)/jplot/jplotSetWriterRunTime.C
$(setWriters)/raw/rawSetWriterRunTime.C
$(setWriters)/vtk/vtkSetWriterRunTime.C
$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
$(setWriters)/csv/csvSetWriterRunTime.C
cuttingPlane/cuttingPlane.C

View File

@ -16,6 +16,9 @@ void writeCellGraph
const word& graphFormat
)
{
fileName path(vsf.time().path()/"graphs"/vsf.time().timeName());
mkDir(path);
graph
(
vsf.name(),
@ -23,7 +26,7 @@ void writeCellGraph
vsf.name(),
vsf.mesh().C().internalField().component(vector::X),
vsf.internalField()
).write(vsf.time().timePath()/vsf.name(), graphFormat);
).write(path/vsf.name(), graphFormat);
}

View File

@ -0,0 +1,202 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2011 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 "csvSetWriter.H"
#include "coordSet.H"
#include "fileName.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::csvSetWriter<Type>::csvSetWriter()
:
writer<Type>()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::csvSetWriter<Type>::~csvSetWriter()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::fileName Foam::csvSetWriter<Type>::getFileName
(
const coordSet& points,
const wordList& valueSetNames
) const
{
return this->getBaseName(points, valueSetNames) + ".csv";
}
template<class Type>
void Foam::csvSetWriter<Type>::write
(
const coordSet& points,
const wordList& valueSetNames,
const List<const Field<Type>*>& valueSets,
Ostream& os
) const
{
writeHeader(points,valueSetNames,os);
// Collect sets into columns
List<const List<Type>*> columns(valueSets.size());
forAll(valueSets, i)
{
columns[i] = valueSets[i];
}
writeTable(points, columns, os);
}
template<class Type>
void Foam::csvSetWriter<Type>::write
(
const bool writeTracks,
const PtrList<coordSet>& points,
const wordList& valueSetNames,
const List<List<Field<Type> > >& valueSets,
Ostream& os
) const
{
writeHeader(points[0],valueSetNames,os);
if (valueSets.size() != valueSetNames.size())
{
FatalErrorIn("csvSetWriter<Type>::write(..)")
<< "Number of variables:" << valueSetNames.size() << endl
<< "Number of valueSets:" << valueSets.size()
<< exit(FatalError);
}
List<const List<Type>*> columns(valueSets.size());
forAll(points, trackI)
{
// Collect sets into columns
forAll(valueSets, i)
{
columns[i] = &valueSets[i][trackI];
}
writeTable(points[trackI], columns, os);
os << nl << nl;
}
}
template<class Type>
void Foam::csvSetWriter<Type>::writeSeparator(Ostream& os) const
{
os << token::COMMA;
}
namespace Foam
{
// otherwise compiler complains about specialization
template<>
void csvSetWriter<scalar>::writeHeader
(
const coordSet& points,
const wordList& valueSetNames,
Ostream& os
) const
{
writeCoordHeader(points, os);
forAll(valueSetNames, i)
{
if (i > 0)
{
writeSeparator(os);
}
os << valueSetNames[i];
}
os << nl;
}
} // end namespace
template<class Type>
void Foam::csvSetWriter<Type>::writeHeader
(
const coordSet& points,
const wordList& valueSetNames,
Ostream& os
) const
{
writeCoordHeader(points, os);
forAll(valueSetNames, i)
{
for (label j=0; j<Type::nComponents; j++)
{
if (i>0 || j>0)
{
writeSeparator(os);
}
os << valueSetNames[i] << "_" << j;
}
}
os << nl;
}
template<class Type>
void Foam::csvSetWriter<Type>::writeCoordHeader
(
const coordSet& points,
Ostream& os
) const
{
if (points.hasVectorAxis())
{
forAll(points, i)
{
os << points.axis()[i];
writeSeparator(os);
}
}
else
{
os << points.axis();
writeSeparator(os);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,122 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2011 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::csvSetWriter
Description
SourceFiles
csvSetWriter.C
\*---------------------------------------------------------------------------*/
#ifndef csvSetWriter_H
#define csvSetWriter_H
#include "writer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class csvSetWriter Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class csvSetWriter
:
public writer<Type>
{
// Private Member Functions
void writeCoordHeader(const coordSet&, Ostream&) const;
void writeHeader(const coordSet&, const wordList&, Ostream&) const;
protected:
virtual void writeSeparator(Ostream&) const;
public:
//- Runtime type information
TypeName("csv");
// Constructors
//- Construct null
csvSetWriter();
//- Destructor
virtual ~csvSetWriter();
// 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 "csvSetWriter.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2011 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 "csvSetWriter.H"
#include "writers.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeSetWriters(csvSetWriter);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -105,8 +105,7 @@ void Foam::writer<Type>::writeTable
forAll(points, pointI)
{
writeCoord(points, pointI, os);
os << token::SPACE;
writeSeparator(os);
write(values[pointI], os);
os << nl;
}
@ -127,7 +126,8 @@ void Foam::writer<Type>::writeTable
forAll(valuesPtrList, i)
{
os << token::SPACE;
writeSeparator(os);
const List<Type>& values = *valuesPtrList[i];
write(values[pointI], os);
}
@ -173,17 +173,27 @@ Foam::Ostream& Foam::writer<Type>::writeVS
{
for (direction d=0; d<VSType::nComponents; d++)
{
os << value.component(d);
if (d <= VSType::nComponents-1)
if (d > 0)
{
os << ' ' << token::TAB;
writeSeparator(os);
}
os << value.component(d);
}
return os;
}
template<class Type>
void Foam::writer<Type>::writeSeparator
(
Ostream& os
) const
{
os << token::SPACE << token::TAB;
}
template<class Type>
Foam::Ostream& Foam::writer<Type>::write
(

View File

@ -107,6 +107,8 @@ protected:
Ostream& os
) const;
//- Writes a separator. Used by write functions.
virtual void writeSeparator(Ostream& os) const;
public:

View File

@ -1,22 +0,0 @@
"E(k)"
"k"
"E(k)"
(0 0 0)
(0 0 0)
1
(
"E(k)"
0
8
(
(5.86431 0.000436377 0)
(11.7286 3.48387e-06 0)
(17.5929 6.63884e-14 0)
(23.4572 4.68122e-28 0)
(29.3215 6.81256e-37 0)
(35.1858 4.37547e-35 0)
(41.0501 1.40555e-36 0)
(46.9145 1.95116e-34 0)
)
)

View File

@ -1,8 +0,0 @@
1.02593 7.63421e-05
0.00204766 6.08238e-10
1.73423e-11 6.54427e-26
6.87852e-26 1.3727e-54
6.40659e-35 1.48851e-72
2.85745e-33 3.55332e-69
6.74385e-35 2.30909e-72
7.16752e-33 2.98095e-68

View File

@ -1,51 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "1";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 1 -1 0 0 0 0 ];
internalField uniform ( 0 0 0 );
boundaryField
{
patch0_half0
{
type cyclic;
}
patch1_half0
{
type cyclic;
}
patch2_half0
{
type cyclic;
}
patch2_half1
{
type cyclic;
}
patch1_half1
{
type cyclic;
}
patch0_half1
{
type cyclic;
}
}
// ************************************************************************* //

View File

@ -1,57 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1";
object enstrophy;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 0 -2 0 0 0 0 ];
internalField uniform 0;
boundaryField
{
patch0_half0
{
type cyclic;
value uniform 0;
}
patch1_half0
{
type cyclic;
value uniform 0;
}
patch2_half0
{
type cyclic;
value uniform 0;
}
patch2_half1
{
type cyclic;
value uniform 0;
}
patch1_half1
{
type cyclic;
value uniform 0;
}
patch0_half1
{
type cyclic;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 2 -2 0 0 0 0 ];
internalField uniform 0;
boundaryField
{
patch0_half0
{
type cyclic;
}
patch1_half0
{
type cyclic;
}
patch2_half0
{
type cyclic;
}
patch2_half1
{
type cyclic;
}
patch1_half1
{
type cyclic;
}
patch0_half1
{
type cyclic;
}
}
// ************************************************************************* //

View File

@ -1,22 +0,0 @@
"E(k)"
"k"
"E(k)"
(0 0 0)
(0 0 0)
1
(
"E(k)"
0
8
(
(5.86431 0.000436377 0)
(11.7286 3.48387e-06 0)
(17.5929 6.63884e-14 0)
(23.4572 4.68122e-28 0)
(29.3215 6.81256e-37 0)
(35.1858 4.37547e-35 0)
(41.0501 1.40555e-36 0)
(46.9145 1.95116e-34 0)
)
)

View File

@ -1,8 +0,0 @@
1.02593 7.63421e-05
0.00204766 6.08238e-10
1.73423e-11 6.54427e-26
6.87852e-26 1.3727e-54
6.40659e-35 1.48851e-72
2.85745e-33 3.55332e-69
6.74385e-35 2.30909e-72
7.16752e-33 2.98095e-68

File diff suppressed because it is too large Load Diff

View File

@ -1,57 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "1";
object enstrophy;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 0 0 -2 0 0 0 0 ];
internalField uniform 0;
boundaryField
{
patch0_half0
{
type cyclic;
value uniform 0;
}
patch1_half0
{
type cyclic;
value uniform 0;
}
patch2_half0
{
type cyclic;
value uniform 0;
}
patch2_half1
{
type cyclic;
value uniform 0;
}
patch1_half1
{
type cyclic;
value uniform 0;
}
patch0_half1
{
type cyclic;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -5,7 +5,6 @@ cd ${0%/*} || exit 1 # run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf 0
cp -r 0.org 0
rm -f 0/enstrophy
# ----------------------------------------------------------------- end-of-file

View File

View File

@ -22,13 +22,28 @@ FoamFile
// is done for all coupled faces, not just for any patches created.
// - optional: synchronise points on coupled patches.
// Tolerance used in matching faces. Absolute tolerance is span of
// face times this factor. To load incorrectly matches meshes set this
// to a higher value.
matchTolerance 1e-3;
// 1. Create cyclic:
// - specify where the faces should come from
// - specify the type of cyclic. If a rotational specify the rotationAxis
// and centre to make matching easier
// - always create both halves in one invocation with correct 'neighbourPatch'
// setting.
// - optionally pointSync true to guarantee points to line up.
// 2. Correct incorrect cyclic:
// This will usually fail upon loading:
// "face 0 area does not match neighbour 2 by 0.0100005%"
// " -- possible face ordering problem."
// - in polyMesh/boundary file:
// - loosen matchTolerance of all cyclics to get case to load
// - or change patch type from 'cyclic' to 'patch'
// and regenerate cyclic as above
// Do a synchronisation of coupled points after creation of any patches.
pointSync true;
// Note: this does not work with points that are on multiple coupled patches
// with transformations (i.e. cyclics).
pointSync false;
// Patches to create.
patches

View File

@ -22,13 +22,28 @@ FoamFile
// is done for all coupled faces, not just for any patches created.
// - optional: synchronise points on coupled patches.
// Tolerance used in matching faces. Absolute tolerance is span of
// face times this factor. To load incorrectly matches meshes set this
// to a higher value.
matchTolerance 1e-3;
// 1. Create cyclic:
// - specify where the faces should come from
// - specify the type of cyclic. If a rotational specify the rotationAxis
// and centre to make matching easier
// - always create both halves in one invocation with correct 'neighbourPatch'
// setting.
// - optionally pointSync true to guarantee points to line up.
// 2. Correct incorrect cyclic:
// This will usually fail upon loading:
// "face 0 area does not match neighbour 2 by 0.0100005%"
// " -- possible face ordering problem."
// - in polyMesh/boundary file:
// - loosen matchTolerance of all cyclics to get case to load
// - or change patch type from 'cyclic' to 'patch'
// and regenerate cyclic as above
// Do a synchronisation of coupled points after creation of any patches.
pointSync true;
// Note: this does not work with points that are on multiple coupled patches
// with transformations (i.e. cyclics).
pointSync false;
// Patches to create.
patches

View File

@ -1,3 +1,4 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
m4 constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict

View File

@ -1,3 +1,4 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
m4 constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict

View File

@ -102,10 +102,10 @@ PIMPLE
relaxationFactors
{
U 1;
h 1;
k 1;
epsilon 1;
"U.*" 1;
"h.*" 1;
"k.*" 1;
"epsilon.*" 1;
}

View File

@ -23,7 +23,7 @@ startTime 0;
stopAt endTime;
endTime 0.025;
endTime 0.01;
deltaT 1e-6;

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application=`getApplication`
runApplication blockMesh
runApplication $application
# ----------------------------------------------------------------- end-of-file

View File

@ -20,35 +20,12 @@ internalField uniform 0;
boundaryField
{
floor
".*"
{
type MarshakRadiation;
T T;
emissivity 1;
value uniform 0;
}
fixedWalls
{
type MarshakRadiation;
T T;
emissivity 1;
value uniform 0;
}
ceiling
{
type MarshakRadiation;
T T;
emissivity 1;
value uniform 0;
}
box
{
type MarshakRadiation;
T T;
emissivity 1;
emissivityMode lookup;
emissivity uniform 1.0;
value uniform 0;
}
}

View File

@ -0,0 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application=`getApplication`
runApplication blockMesh
runApplication $application
# ----------------------------------------------------------------- end-of-file

View File

@ -77,8 +77,8 @@ PIMPLE
relaxationFactors
{
h 1;
U 1;
"h.*" 1;
"U.*" 1;
}
// ************************************************************************* //

View File

@ -79,8 +79,8 @@ PIMPLE
relaxationFactors
{
h 1;
U 1;
"h.*" 1;
"U.*" 1;
}
// ************************************************************************* //

View File

@ -77,8 +77,8 @@ PIMPLE
relaxationFactors
{
h 1;
U 1;
"h.* 1;
"U.*" 1;
}
// ************************************************************************* //

View File

@ -79,8 +79,8 @@ PIMPLE
relaxationFactors
{
h 1;
U 1;
"h.*" 1;
"U.*" 1;
}
// ************************************************************************* //

View File

@ -70,8 +70,8 @@ PIMPLE
relaxationFactors
{
h 1;
U 1;
"h.*" 1;
"U.*" 1;
}
// ************************************************************************* //

View File

@ -72,8 +72,8 @@ PIMPLE
relaxationFactors
{
h 1;
U 1;
"h.*" 1;
"U.*" 1;
}
// ************************************************************************* //

View File

@ -1,29 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object cp;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 -1 0 0 0];
internalField uniform 450;
boundaryField
{
".*"
{
type calculated;
}
}
// ************************************************************************* //

View File

@ -1,29 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object rho;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -3 0 0 0 0 0];
internalField uniform 8000;
boundaryField
{
".*"
{
type calculated;
}
}
// ************************************************************************* //

View File

@ -139,7 +139,7 @@ charCoeffs
thermoProperties
{
Hf 0;
C0 611.0;; // Cp = C0*(T/Tref)^n0
C0 611.0; // Cp = C0*(T/Tref)^n0
Tref 300;
n0 1.31;
}

View File

@ -19,13 +19,7 @@ FoamFile
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
method scotch;
// method hierarchical;
// method simple;
// method manual;
simpleCoeffs
{
@ -40,33 +34,10 @@ hierarchicalCoeffs
order xyz;
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -40,12 +40,12 @@ divSchemes
laplacianSchemes
{
default none;
laplacian(muEff,U) Gauss linear limited 0.333;
laplacian((rho*(1|A(U))),p_rgh) Gauss linear limited 0.333;
laplacian(alphaEff,h) Gauss linear limited 0.333;
laplacian(DkEff,k) Gauss linear limited 0.333;
laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333;
laplacian(DREff,R) Gauss linear limited 0.333;
laplacian(muEff,U) Gauss linear uncorrected;
laplacian((rho*(1|A(U))),p_rgh) Gauss linear uncorrected;
laplacian(alphaEff,h) Gauss linear uncorrected;
laplacian(DkEff,k) Gauss linear uncorrected;
laplacian(DepsilonEff,epsilon) Gauss linear uncorrected;
laplacian(DREff,R) Gauss linear uncorrected;
}
interpolationSchemes
@ -55,7 +55,7 @@ interpolationSchemes
snGradSchemes
{
default limited 0.333;
default uncorrected;
}
fluxRequired

View File

@ -19,13 +19,7 @@ FoamFile
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
method scotch;
// method hierarchical;
// method simple;
// method manual;
simpleCoeffs
{
@ -40,33 +34,10 @@ hierarchicalCoeffs
order xyz;
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
dataFile "decompositionData";
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -32,7 +32,7 @@ divSchemes
laplacianSchemes
{
default none;
laplacian(K,T) Gauss linear limited 0.333;
laplacian(K,T) Gauss linear uncorrected;
}
interpolationSchemes
@ -42,7 +42,7 @@ interpolationSchemes
snGradSchemes
{
default limited 0.333;
default uncorrected;
}
fluxRequired

View File

@ -19,13 +19,7 @@ FoamFile
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
method scotch;
// method hierarchical;
// method simple;
// method manual;
simpleCoeffs
{
@ -40,18 +34,6 @@ hierarchicalCoeffs
order xyz;
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
@ -59,14 +41,4 @@ manualCoeffs
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -32,7 +32,7 @@ divSchemes
laplacianSchemes
{
default none;
laplacian(K,T) Gauss linear limited 0.333;
laplacian(K,T) Gauss linear uncorrected;
}
interpolationSchemes
@ -42,7 +42,7 @@ interpolationSchemes
snGradSchemes
{
default limited 0.333;
default uncorrected;
}
fluxRequired

View File

@ -19,13 +19,8 @@ FoamFile
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
method scotch;
// method hierarchical;
// method simple;
// method manual;
simpleCoeffs
{
@ -40,18 +35,6 @@ hierarchicalCoeffs
order xyz;
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
@ -59,14 +42,4 @@ manualCoeffs
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -32,7 +32,7 @@ divSchemes
laplacianSchemes
{
default none;
laplacian(K,T) Gauss linear limited 0.333;
laplacian(K,T) Gauss linear uncorrected;
}
interpolationSchemes
@ -42,7 +42,7 @@ interpolationSchemes
snGradSchemes
{
default limited 0.333;
default uncorrected;
}
fluxRequired

View File

@ -19,13 +19,8 @@ FoamFile
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
method scotch;
// method hierarchical;
// method simple;
// method manual;
simpleCoeffs
{
@ -40,18 +35,6 @@ hierarchicalCoeffs
order xyz;
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
@ -59,14 +42,4 @@ manualCoeffs
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -40,12 +40,12 @@ divSchemes
laplacianSchemes
{
default none;
laplacian(muEff,U) Gauss linear limited 0.333;
laplacian((rho*(1|A(U))),p_rgh) Gauss linear limited 0.333;
laplacian(alphaEff,h) Gauss linear limited 0.333;
laplacian(DkEff,k) Gauss linear limited 0.333;
laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333;
laplacian(DREff,R) Gauss linear limited 0.333;
laplacian(muEff,U) Gauss linear uncorrected;
laplacian((rho*(1|A(U))),p_rgh) Gauss linear uncorrected;
laplacian(alphaEff,h) Gauss linear uncorrected;
laplacian(DkEff,k) Gauss linear uncorrected;
laplacian(DepsilonEff,epsilon) Gauss linear uncorrected;
laplacian(DREff,R) Gauss linear uncorrected;
}
interpolationSchemes
@ -55,7 +55,7 @@ interpolationSchemes
snGradSchemes
{
default limited 0.333;
default uncorrected;
}
fluxRequired

View File

@ -1,29 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object rho;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -3 0 0 0 0 0];
internalField uniform 8000;
boundaryField
{
".*"
{
type calculated;
}
}
// ************************************************************************* //

View File

@ -19,13 +19,7 @@ FoamFile
numberOfSubdomains 4;
//- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3);
method scotch;
// method hierarchical;
// method simple;
// method manual;
simpleCoeffs
{
@ -40,18 +34,6 @@ hierarchicalCoeffs
order xyz;
}
scotchCoeffs
{
//processorWeights
//(
// 1
// 1
// 1
// 1
//);
//writeGraph true;
//strategy "b";
}
manualCoeffs
{
@ -59,14 +41,4 @@ manualCoeffs
}
//// Is the case distributed
//distributed yes;
//// Per slave (so nProcs-1 entries) the directory above the case.
//roots
//(
// "/tmp"
// "/tmp"
//);
// ************************************************************************* //

View File

@ -41,13 +41,13 @@ divSchemes
laplacianSchemes
{
default none;
laplacian(muEff,U) Gauss linear corrected;
laplacian((rho*(1|A(U))),p_rgh) Gauss linear corrected;
laplacian(alphaEff,h) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
laplacian(DREff,R) Gauss linear corrected;
laplacian(gammaRad,G) Gauss linear corrected;
laplacian(muEff,U) Gauss linear uncorrected;
laplacian((rho*(1|A(U))),p_rgh) Gauss linear uncorrected;
laplacian(alphaEff,h) Gauss linear uncorrected;
laplacian(DkEff,k) Gauss linear uncorrected;
laplacian(DepsilonEff,epsilon) Gauss linear uncorrected;
laplacian(DREff,R) Gauss linear uncorrected;
laplacian(gammaRad,G) Gauss linear uncorrected;
}
interpolationSchemes
@ -57,7 +57,7 @@ interpolationSchemes
snGradSchemes
{
default corrected;
default uncorrected;
}
fluxRequired

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