Merge commit 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2009-12-15 10:48:51 +01:00
161 changed files with 4698 additions and 51200 deletions

View File

@ -93,9 +93,9 @@ void readAndRotateFields
}
void rotateFields(const Time& runTime, const tensor& T)
void rotateFields(const argList& args, const Time& runTime, const tensor& T)
{
# include "createMesh.H"
# include "createNamedMesh.H"
// Read objects in time directory
IOobjectList objects(mesh, runTime.timeName());
@ -167,7 +167,11 @@ int main(int argc, char *argv[])
"vector",
"transform in terms of '( yaw pitch roll )' in degrees"
);
argList::addBoolOption("rotateFields");
argList::addBoolOption
(
"rotateFields",
"read and transform vector and tensor fields too"
);
argList::addOption
(
"scale",
@ -176,16 +180,29 @@ int main(int argc, char *argv[])
"uniform [mm] to [m] scaling"
);
# include "addRegionOption.H"
# include "setRootCase.H"
# include "createTime.H"
word regionName = polyMesh::defaultRegion;
fileName meshDir;
if (args.optionReadIfPresent("region", regionName))
{
meshDir = regionName/polyMesh::meshSubDir;
}
else
{
meshDir = polyMesh::meshSubDir;
}
pointIOField points
(
IOobject
(
"points",
runTime.findInstance(polyMesh::meshSubDir, "points"),
polyMesh::meshSubDir,
runTime.findInstance(meshDir, "points"),
meshDir,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
@ -224,7 +241,7 @@ int main(int argc, char *argv[])
if (args.optionFound("rotateFields"))
{
rotateFields(runTime, T);
rotateFields(args, runTime, T);
}
}
else if (args.optionFound("rollPitchYaw"))
@ -247,7 +264,7 @@ int main(int argc, char *argv[])
if (args.optionFound("rotateFields"))
{
rotateFields(runTime, R.R());
rotateFields(args, runTime, R.R());
}
}
else if (args.optionFound("yawPitchRoll"))
@ -276,7 +293,7 @@ int main(int argc, char *argv[])
if (args.optionFound("rotateFields"))
{
rotateFields(runTime, R.R());
rotateFields(args, runTime, R.R());
}
}

View File

@ -34,13 +34,19 @@ Description
Can also work like decomposePar:
@verbatim
# Create empty processor directories (have to exist for argList)
mkdir processor0
..
mkdir processorN
# Copy undecomposed polyMesh
cp -r constant processor0
# Distribute
mpirun -np ddd redistributeMeshPar -parallel
@endverbatim
\*---------------------------------------------------------------------------*/
#include "Field.H"
#include "fvMesh.H"
#include "decompositionMethod.H"
#include "PstreamReduceOps.H"
@ -62,6 +68,7 @@ static const scalar defaultMergeTol = 1E-6;
autoPtr<fvMesh> createMesh
(
const Time& runTime,
const word& regionName,
const fileName& instDir,
const bool haveMesh
)
@ -69,43 +76,33 @@ autoPtr<fvMesh> createMesh
Pout<< "Create mesh for time = "
<< runTime.timeName() << nl << endl;
// Create dummy mesh. Only used on procs that don't have mesh.
// Note constructed on all processors since does parallel comms.
fvMesh dummyMesh
IOobject io
(
IOobject
(
fvMesh::defaultRegion,
instDir,
runTime,
IOobject::MUST_READ
),
xferCopy(pointField()),
xferCopy(faceList()),
xferCopy(labelList()),
xferCopy(labelList())
regionName,
instDir,
runTime,
IOobject::MUST_READ
);
if (!haveMesh)
{
Pout<< "Writing dummy mesh to " << runTime.path()/instDir << endl;
// Create dummy mesh. Only used on procs that don't have mesh.
fvMesh dummyMesh
(
io,
xferCopy(pointField()),
xferCopy(faceList()),
xferCopy(labelList()),
xferCopy(labelList()),
false
);
Pout<< "Writing dummy mesh to " << dummyMesh.polyMesh::objectPath()
<< endl;
dummyMesh.write();
}
Pout<< "Reading mesh from " << runTime.path()/instDir << endl;
autoPtr<fvMesh> meshPtr
(
new fvMesh
(
IOobject
(
fvMesh::defaultRegion,
instDir,
runTime,
IOobject::MUST_READ
)
)
);
Pout<< "Reading mesh from " << io.objectPath() << endl;
autoPtr<fvMesh> meshPtr(new fvMesh(io));
fvMesh& mesh = meshPtr();
@ -229,8 +226,9 @@ autoPtr<fvMesh> createMesh
if (!haveMesh)
{
// We created a dummy mesh file above. Delete it.
Pout<< "Removing dummy mesh in " << runTime.path()/instDir << endl;
rmDir(runTime.path()/instDir/polyMesh::meshSubDir);
Pout<< "Removing dummy mesh " << io.objectPath()
<< endl;
rmDir(io.objectPath());
}
// Force recreation of globalMeshData.
@ -285,7 +283,6 @@ scalar getMergeDistance
void printMeshData(Ostream& os, const polyMesh& mesh)
{
os << "Number of points: " << mesh.points().size() << nl
<< " edges: " << mesh.edges().size() << nl
<< " faces: " << mesh.faces().size() << nl
<< " internal faces: " << mesh.faceNeighbour().size() << nl
<< " cells: " << mesh.cells().size() << nl
@ -506,33 +503,53 @@ void compareFields
int main(int argc, char *argv[])
{
# include "addRegionOption.H"
argList::addOption("mergeTol", "relative merge distance");
// Create argList. This will check for non-existing processor dirs.
# include "setRootCase.H"
// Create processor directory if non-existing
if (!Pstream::master() && !isDir(args.path()))
{
Pout<< "Creating case directory " << args.path() << endl;
mkDir(args.path());
}
//- Not useful anymore. See above.
//// Create processor directory if non-existing
//if (!Pstream::master() && !isDir(args.path()))
//{
// Pout<< "Creating case directory " << args.path() << endl;
// mkDir(args.path());
//}
# include "createTime.H"
word regionName = polyMesh::defaultRegion;
fileName meshSubDir;
if (args.optionReadIfPresent("region", regionName))
{
meshSubDir = regionName/polyMesh::meshSubDir;
}
else
{
meshSubDir = polyMesh::meshSubDir;
}
Info<< "Using mesh subdirectory " << meshSubDir << nl << endl;
// Get time instance directory. Since not all processors have meshes
// just use the master one everywhere.
fileName masterInstDir;
if (Pstream::master())
{
masterInstDir = runTime.findInstance(polyMesh::meshSubDir, "points");
masterInstDir = runTime.findInstance(meshSubDir, "points");
}
Pstream::scatter(masterInstDir);
// Check who has a mesh
const fileName meshDir = runTime.path()/masterInstDir/polyMesh::meshSubDir;
const fileName meshPath = runTime.path()/masterInstDir/meshSubDir;
Info<< "Found points in " << meshPath << nl << endl;
boolList haveMesh(Pstream::nProcs(), false);
haveMesh[Pstream::myProcNo()] = isDir(meshDir);
haveMesh[Pstream::myProcNo()] = isDir(meshPath);
Pstream::gatherList(haveMesh);
Pstream::scatterList(haveMesh);
Info<< "Per processor mesh availability : " << haveMesh << endl;
@ -542,6 +559,7 @@ int main(int argc, char *argv[])
autoPtr<fvMesh> meshPtr = createMesh
(
runTime,
regionName,
masterInstDir,
haveMesh[Pstream::myProcNo()]
);
@ -799,7 +817,7 @@ int main(int argc, char *argv[])
<< nl
<< "the processor directories with 0 sized meshes in them." << nl
<< "Below is a sample set of commands to do this."
<< " Take care when issueing these" << nl
<< " Take care when issuing these" << nl
<< "commands." << nl << endl;
forAll(nFaces, procI)
@ -812,8 +830,8 @@ int main(int argc, char *argv[])
}
else
{
fileName timeDir = procDir/runTime.timeName()/polyMesh::meshSubDir;
fileName constDir = procDir/runTime.constant()/polyMesh::meshSubDir;
fileName timeDir = procDir/runTime.timeName()/meshSubDir;
fileName constDir = procDir/runTime.constant()/meshSubDir;
Info<< " rm -r " << constDir.c_str() << nl
<< " mv " << timeDir.c_str()

View File

@ -9,4 +9,5 @@ EXE_LIBS = \
-ltecio \
-llagrangian \
-lfiniteVolume \
-lgenericPatchFields \
-lmeshTools

View File

@ -909,106 +909,115 @@ int main(int argc, char *argv[])
const polyPatch& pp = patches[patchID];
//INTEGER4 strandID = 1 + i;
Info<< " Writing patch " << patchID << "\t" << pp.name()
<< "\tstrand:" << strandID << nl << endl;
const indirectPrimitivePatch ipp
(
IndirectList<face>(pp, identity(pp.size())),
pp.points()
);
writer.writePolygonalZone
(
pp.name(),
strandID++, //strandID,
ipp,
allVarLocation
);
// Write coordinates
writer.writeField(ipp.localPoints().component(0)());
writer.writeField(ipp.localPoints().component(1)());
writer.writeField(ipp.localPoints().component(2)());
// Write all fields
forAll(vsf, i)
if (pp.size() > 0)
{
writer.writeField
Info<< " Writing patch " << patchID << "\t" << pp.name()
<< "\tstrand:" << strandID << nl << endl;
const indirectPrimitivePatch ipp
(
writer.getPatchField
IndirectList<face>(pp, identity(pp.size())),
pp.points()
);
writer.writePolygonalZone
(
pp.name(),
strandID++, //strandID,
ipp,
allVarLocation
);
// Write coordinates
writer.writeField(ipp.localPoints().component(0)());
writer.writeField(ipp.localPoints().component(1)());
writer.writeField(ipp.localPoints().component(2)());
// Write all fields
forAll(vsf, i)
{
writer.writeField
(
nearCellValue,
vsf[i],
patchID
)()
);
}
forAll(vvf, i)
{
writer.writeField
(
writer.getPatchField
writer.getPatchField
(
nearCellValue,
vsf[i],
patchID
)()
);
}
forAll(vvf, i)
{
writer.writeField
(
nearCellValue,
vvf[i],
patchID
)()
);
}
forAll(vSpheretf, i)
{
writer.writeField
(
writer.getPatchField
writer.getPatchField
(
nearCellValue,
vvf[i],
patchID
)()
);
}
forAll(vSpheretf, i)
{
writer.writeField
(
nearCellValue,
vSpheretf[i],
patchID
)()
);
}
forAll(vSymmtf, i)
{
writer.writeField
(
writer.getPatchField
writer.getPatchField
(
nearCellValue,
vSpheretf[i],
patchID
)()
);
}
forAll(vSymmtf, i)
{
writer.writeField
(
nearCellValue,
vSymmtf[i],
patchID
)()
);
}
forAll(vtf, i)
{
writer.writeField
(
writer.getPatchField
writer.getPatchField
(
nearCellValue,
vSymmtf[i],
patchID
)()
);
}
forAll(vtf, i)
{
writer.writeField
(
nearCellValue,
vtf[i],
patchID
)()
);
}
writer.getPatchField
(
nearCellValue,
vtf[i],
patchID
)()
);
}
forAll(psf, i)
{
writer.writeField
(
psf[i].boundaryField()[patchID].patchInternalField()()
);
}
forAll(pvf, i)
{
writer.writeField
(
pvf[i].boundaryField()[patchID].patchInternalField()()
);
}
forAll(psf, i)
{
writer.writeField
(
psf[i].boundaryField()[patchID].patchInternalField()()
);
}
forAll(pvf, i)
{
writer.writeField
(
pvf[i].boundaryField()[patchID].patchInternalField()()
);
}
writer.writeConnectivity(ipp);
writer.writeConnectivity(ipp);
}
else
{
Info<< " Skipping zero sized patch " << patchID
<< "\t" << pp.name()
<< nl << endl;
}
}
writer.writeEnd();

View File

@ -5,7 +5,7 @@ set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
case "$ParaView_VERSION" in
3*)
3* | git)
wmake libso vtkPV3Readers
PV3blockMeshReader/Allwmake
PV3FoamReader/Allwmake

View File

@ -5,7 +5,7 @@ set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
case "$ParaView_VERSION" in
3*)
3* | git)
wmake libso vtkPV3Foam
(
cd PV3FoamReader

View File

@ -5,7 +5,7 @@ set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
then
case "$ParaView_VERSION" in
3*)
3* | git)
wmake libso vtkPV3blockMesh
(
cd PV3blockMeshReader