Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev into feature/cvMesh

Conflicts:
	src/OpenFOAM/primitives/triad/triad.C
This commit is contained in:
laurence
2013-01-28 15:17:48 +00:00
206 changed files with 4316 additions and 872 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -383,12 +383,7 @@ int main(int argc, char *argv[])
// Determine extrudePatch normal
pointField extrudePatchPointNormals
(
PatchTools::pointNormals //calcNormals
(
mesh,
extrudePatch,
meshFaces
)
PatchTools::pointNormals(mesh, extrudePatch)
);
@ -629,12 +624,13 @@ int main(int argc, char *argv[])
const labelListList& layerFaces = layerExtrude.layerFaces();
backPatchFaces.setSize(layerFaces.size());
frontPatchFaces.setSize(layerFaces.size());
forAll(backPatchFaces, i)
forAll(backPatchFaces, patchFaceI)
{
backPatchFaces[i] = layerFaces[i].first();
frontPatchFaces[i] = layerFaces[i].last();
backPatchFaces[patchFaceI] = layerFaces[patchFaceI].first();
frontPatchFaces[patchFaceI] = layerFaces[patchFaceI].last();
}
// Create dummy fvSchemes, fvSolution
createDummyFvMeshFiles(mesh, regionDir);
@ -654,6 +650,13 @@ int main(int argc, char *argv[])
mesh
);
layerExtrude.updateMesh
(
map(),
identity(extrudePatch.size()),
identity(extrudePatch.nPoints())
);
// Calculate face labels for front and back.
frontPatchFaces = renumber
(

View File

@ -1,10 +1,12 @@
EXE_INC = \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/mesh/extrudeModel/lnInclude
EXE_LIBS = \
-lsurfMesh \
-lfiniteVolume \
-lmeshTools \
-ldynamicMesh \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -133,6 +133,8 @@ Notes:
#include "pointFields.H"
//#include "ReadFields.H"
#include "fvMeshTools.H"
#include "OBJstream.H"
#include "PatchTools.H"
using namespace Foam;
@ -1233,6 +1235,252 @@ void setCouplingInfo
}
// Extrude and write geometric properties
void extrudeGeometricProperties
(
const polyMesh& mesh,
const primitiveFacePatch& extrudePatch,
const createShellMesh& extruder,
const polyMesh& regionMesh,
const extrudeModel& model
)
{
const pointIOField patchFaceCentres
(
IOobject
(
"patchFaceCentres",
mesh.pointsInstance(),
mesh.meshSubDir,
mesh,
IOobject::MUST_READ
)
);
const pointIOField patchEdgeCentres
(
IOobject
(
"patchEdgeCentres",
mesh.pointsInstance(),
mesh.meshSubDir,
mesh,
IOobject::MUST_READ
)
);
//forAll(extrudePatch.edges(), edgeI)
//{
// const edge& e = extrudePatch.edges()[edgeI];
// Pout<< "Edge:" << e.centre(extrudePatch.localPoints()) << nl
// << "read:" << patchEdgeCentres[edgeI]
// << endl;
//}
// Determine edge normals on original patch
labelList patchEdges;
labelList coupledEdges;
PackedBoolList sameEdgeOrientation;
PatchTools::matchEdges
(
extrudePatch,
mesh.globalData().coupledPatch(),
patchEdges,
coupledEdges,
sameEdgeOrientation
);
pointField patchEdgeNormals
(
PatchTools::edgeNormals
(
mesh,
extrudePatch,
patchEdges,
coupledEdges
)
);
pointIOField faceCentres
(
IOobject
(
"faceCentres",
regionMesh.pointsInstance(),
regionMesh.meshSubDir,
regionMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
regionMesh.nFaces()
);
// Work out layers. Guaranteed in columns so no fancy parallel bits.
forAll(extruder.faceToFaceMap(), faceI)
{
if (extruder.faceToFaceMap()[faceI] != 0)
{
// 'horizontal' face
label patchFaceI = mag(extruder.faceToFaceMap()[faceI])-1;
label cellI = regionMesh.faceOwner()[faceI];
if (regionMesh.isInternalFace(faceI))
{
cellI = max(cellI, regionMesh.faceNeighbour()[faceI]);
}
// Calculate layer from cell numbering (see createShellMesh)
label layerI = (cellI % model.nLayers());
if
(
!regionMesh.isInternalFace(faceI)
&& extruder.faceToFaceMap()[faceI] > 0
)
{
// Top face
layerI++;
}
// Recalculate based on extrusion model
faceCentres[faceI] = model
(
patchFaceCentres[patchFaceI],
extrudePatch.faceNormals()[patchFaceI],
layerI
);
}
else
{
// 'vertical face
label patchEdgeI = extruder.faceToEdgeMap()[faceI];
label layerI =
(
regionMesh.faceOwner()[faceI]
% model.nLayers()
);
// Extrude patch edge centre to this layer
point pt0 = model
(
patchEdgeCentres[patchEdgeI],
patchEdgeNormals[patchEdgeI],
layerI
);
// Extrude patch edge centre to next layer
point pt1 = model
(
patchEdgeCentres[patchEdgeI],
patchEdgeNormals[patchEdgeI],
layerI+1
);
// Interpolate
faceCentres[faceI] = 0.5*(pt0+pt1);
}
}
pointIOField cellCentres
(
IOobject
(
"cellCentres",
regionMesh.pointsInstance(),
regionMesh.meshSubDir,
regionMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
regionMesh.nCells()
);
forAll(extruder.cellToFaceMap(), cellI)
{
label patchFaceI = extruder.cellToFaceMap()[cellI];
// Calculate layer from cell numbering (see createShellMesh)
label layerI = (cellI % model.nLayers());
// Recalculate based on extrusion model
point pt0 = model
(
patchFaceCentres[patchFaceI],
extrudePatch.faceNormals()[patchFaceI],
layerI
);
point pt1 = model
(
patchFaceCentres[patchFaceI],
extrudePatch.faceNormals()[patchFaceI],
layerI+1
);
// Interpolate
cellCentres[cellI] = 0.5*(pt0+pt1);
}
// Bit of checking
if (false)
{
OBJstream faceStr(regionMesh.time().path()/"faceCentres.obj");
OBJstream cellStr(regionMesh.time().path()/"cellCentres.obj");
forAll(faceCentres, faceI)
{
Pout<< "Model :" << faceCentres[faceI] << endl
<< "regionMesh:" << regionMesh.faceCentres()[faceI] << endl;
faceStr.write
(
linePointRef
(
faceCentres[faceI],
regionMesh.faceCentres()[faceI]
)
);
}
forAll(cellCentres, cellI)
{
Pout<< "Model :" << cellCentres[cellI] << endl
<< "regionMesh:" << regionMesh.cellCentres()[cellI] << endl;
cellStr.write
(
linePointRef
(
cellCentres[cellI],
regionMesh.cellCentres()[cellI]
)
);
}
}
Info<< "Writing geometric properties for mesh " << regionMesh.name()
<< " to " << regionMesh.pointsInstance() << nl
<< endl;
bool ok = faceCentres.write() && cellCentres.write();
if (!ok)
{
FatalErrorIn("extrudeGeometricProperties(..)")
<< "Failed writing " << faceCentres.objectPath()
<< " and " << cellCentres.objectPath()
<< exit(FatalError);
}
}
// Main program:
int main(int argc, char *argv[])
@ -2393,6 +2641,36 @@ int main(int argc, char *argv[])
}
// See if we need to extrude coordinates as well
{
autoPtr<pointIOField> patchFaceCentresPtr;
IOobject io
(
"patchFaceCentres",
mesh.pointsInstance(),
mesh.meshSubDir,
mesh,
IOobject::MUST_READ
);
if (io.headerOk())
{
// Read patchFaceCentres and patchEdgeCentres
Info<< "Reading patch face,edge centres : "
<< io.name() << " and patchEdgeCentres" << endl;
extrudeGeometricProperties
(
mesh,
extrudePatch,
extruder,
regionMesh,
model()
);
}
}
// Insert baffles into original mesh

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
wclean libso helpTypes
wclean
# ----------------------------------------------------------------- end-of-file

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -176,38 +176,32 @@ Foam::doxygenXmlParser::doxygenXmlParser
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::doxygenXmlParser::skipBlock(IFstream& is, const word blockName) const
void Foam::doxygenXmlParser::skipBlock
(
IFstream& is,
const word& blockName
) const
{
// recurse to move forward in 'is' until come across </blockName>
string closeName = "";
// fast-forward until we reach a '<'
char c;
while (is.get(c) && c != '<')
{}
// check to see if this is a closing block
if (is.get(c) && c == '/')
while (is.good() && (closeName != blockName))
{
while (is.get(c) && c != '>')
{
closeName += c;
}
// fast-forward until we reach a '<'
while (is.get(c) && c != '<')
{}
if (closeName == blockName)
// check to see if this is a closing block
if (is.get(c) && c == '/')
{
// finished reading block
return;
closeName = "";
while (is.get(c) && c != '>')
{
closeName += c;
}
}
else
{
skipBlock(is, blockName);
}
}
else
{
skipBlock(is, blockName);
}
}
@ -215,7 +209,7 @@ void Foam::doxygenXmlParser::skipBlock(IFstream& is, const word blockName) const
void Foam::doxygenXmlParser::skipForward
(
IFstream& is,
const word blockName
const word& blockName
) const
{
// recurse to move forward in 'is' until come across <blockName>

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,8 +25,10 @@ Class
Foam::doxygenXmlParser
Description
Parser for doxygen XML
SourceFiles
doxygenXmlParser.C
\*---------------------------------------------------------------------------*/
@ -65,10 +67,10 @@ public:
// Member functions
//- Skip past a block
void skipBlock(IFstream& is, const word blockName) const;
void skipBlock(IFstream& is, const word& blockName) const;
//- Skip forward to block
void skipForward(IFstream& is, const word blockName) const;
void skipForward(IFstream& is, const word& blockName) const;
//- Return the entry
template<class Type>

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -148,7 +148,12 @@ void Foam::helpType::displayDoc
{
FatalErrorIn
(
"void Foam::helpType::displayDoc(const word, const string)"
"void Foam::helpType::displayDoc"
"("
"const word&, "
"const string&, "
"const bool"
")"
)
<< "No help for type " << className << " found."
<< " Valid options include:" << SortableList<word>(parser.toc())

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,6 +43,24 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool haveAllTimes
(
const HashSet<word>& masterTimeDirSet,
const instantList& timeDirs
)
{
// Loop over all times
forAll(timeDirs, timeI)
{
if (!masterTimeDirSet.found(timeDirs[timeI].name()))
{
return false;
}
}
return true;
}
int main(int argc, char *argv[])
{
argList::addNote
@ -54,7 +72,7 @@ int main(int argc, char *argv[])
// enable -zeroTime to prevent accidentally trashing the initial fields
timeSelector::addOptions(true, true);
argList::noParallel();
# include "addRegionOption.H"
#include "addRegionOption.H"
argList::addBoolOption
(
"allRegions",
@ -86,8 +104,8 @@ int main(int argc, char *argv[])
"only reconstruct new times (i.e. that do not exist already)"
);
# include "setRootCase.H"
# include "createTime.H"
#include "setRootCase.H"
#include "createTime.H"
HashSet<word> selectedFields;
if (args.optionFound("fields"))
@ -169,6 +187,11 @@ int main(int argc, char *argv[])
{
masterTimeDirs = runTime.times();
}
HashSet<word> masterTimeDirSet(2*masterTimeDirs.size());
forAll(masterTimeDirs, i)
{
masterTimeDirSet.insert(masterTimeDirs[i].name());
}
// Set all times on processor meshes equal to reconstructed mesh
@ -222,6 +245,21 @@ int main(int argc, char *argv[])
Info<< "\n\nReconstructing fields for mesh " << regionName << nl
<< endl;
if
(
newTimes
&& regionNames.size() == 1
&& regionDirs[0].empty()
&& haveAllTimes(masterTimeDirSet, timeDirs)
)
{
Info<< "Skipping region " << regionName
<< " since already have all times"
<< endl << endl;
continue;
}
fvMesh mesh
(
IOobject
@ -240,29 +278,16 @@ int main(int argc, char *argv[])
// check face addressing for meshes that have been decomposed
// with a very old foam version
# include "checkFaceAddressingComp.H"
#include "checkFaceAddressingComp.H"
// Loop over all times
forAll(timeDirs, timeI)
{
if (newTimes)
if (newTimes && masterTimeDirSet.found(timeDirs[timeI].name()))
{
// Compare on timeName, not value
bool foundTime = false;
forAll(masterTimeDirs, i)
{
if (masterTimeDirs[i].name() == timeDirs[timeI].name())
{
foundTime = true;
break;
}
}
if (foundTime)
{
Info<< "Skipping time " << timeDirs[timeI].name()
<< endl << endl;
continue;
}
Info<< "Skipping time " << timeDirs[timeI].name()
<< endl << endl;
continue;
}