diff --git a/applications/test/fvc2D/Make/files b/applications/test/fvc2D/Make/files
new file mode 100644
index 0000000000..ffd2664354
--- /dev/null
+++ b/applications/test/fvc2D/Make/files
@@ -0,0 +1,3 @@
+Test-fvc2D.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-fvc2D
diff --git a/applications/test/fvc2D/Make/options b/applications/test/fvc2D/Make/options
new file mode 100644
index 0000000000..d27c95d033
--- /dev/null
+++ b/applications/test/fvc2D/Make/options
@@ -0,0 +1,7 @@
+EXE_INC = \
+ -I$(LIB_SRC)/finiteVolume/lnInclude \
+ -I$(LIB_SRC)/meshTools/lnInclude
+
+EXE_LIBS = \
+ -lfiniteVolume \
+ -lmeshTools
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.H b/applications/test/fvc2D/Test-fvc2D.C
similarity index 59%
rename from applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.H
rename to applications/test/fvc2D/Test-fvc2D.C
index 0977a38960..527cfbd3cc 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/itoa.H
+++ b/applications/test/fvc2D/Test-fvc2D.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -21,27 +21,52 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
-InApplication
- foamToEnsight
+Application
+ test
Description
+ Finite volume method test code for 2-D space.
\*---------------------------------------------------------------------------*/
-#include "word.H"
-#include "label.H"
+#include "fvCFD.H"
+#include "vector2D.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
namespace Foam
{
+ typedef GeometricField volVector2DField;
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+ defineTemplate2TypeNameAndDebug(volVector2DField::Internal, 0);
+ defineTemplateTypeNameAndDebug(volVector2DField, 0);
-word itoa(const label n);
+ typedef fvPatchField fvPatchVector2DField;
+ makeFvPatchField(fvPatchVector2DField)
+}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-} // End namespace Foam
+int main(int argc, char *argv[])
+{
+ #include "setRootCase.H"
+
+ #include "createTime.H"
+ #include "createMesh.H"
+
+ GeometricField fld
+ (
+ IOobject
+ (
+ "U",
+ runTime.timeName(),
+ mesh,
+ IOobject::MUST_READ,
+ IOobject::AUTO_WRITE
+ ),
+ mesh
+ );
+
+ Info<< "end" << endl;
+}
+
// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files
index 44c513a079..421e8392b8 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/files
@@ -1,6 +1,5 @@
-itoa.C
ensightMesh.C
-ensightParticlePositions.C
+ensightCloud.C
foamToEnsight.C
EXE = $(FOAM_APPBIN)/foamToEnsight
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options
index 2a683c0529..e2fc5311ff 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/Make/options
@@ -4,11 +4,13 @@ EXE_INC = \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
- -I$(LIB_SRC)/lagrangian/basic/lnInclude
+ -I$(LIB_SRC)/lagrangian/basic/lnInclude \
+ -I$(LIB_SRC)/conversion/lnInclude
EXE_LIBS = \
-ldynamicMesh \
-lfileFormats \
-lsampling \
-lgenericPatchFields \
- -llagrangian
+ -llagrangian \
+ -lconversion
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H
index 47a3540da7..50e78e781c 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkData.H
@@ -1,21 +1,33 @@
-// ignore special fields or fields that we don't handle
-//
-bool variableGood = true;
-for (label n1=0; n1 2 && fieldName(fieldName.size() - 2, 2) == "_0")
+ bool variableGood = false;
+
+ forAll(timeDirs, n1)
{
- variableGood = false;
- }
- else
- {
- variableGood = IOobject
+ variableGood =
(
- fieldName,
- Times[n1].name(),
- mesh,
- IOobject::NO_READ
- ).typeHeaderOk(false);
+ fieldName.size() > 2 && fieldName(fieldName.size()-2, 2) == "_0"
+ ? false
+ : IOobject
+ (
+ fieldName,
+ timeDirs[n1].name(),
+ mesh,
+ IOobject::NO_READ
+ ).typeHeaderOk(false)
+ );
+
+ if (variableGood)
+ {
+ break;
+ }
}
+
+ reduce(variableGood, andOp());
+ fieldsToUse.set(fieldName, variableGood);
}
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H
index d4027ad1c5..bda9220acb 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/checkMeshMoving.H
@@ -1,27 +1,50 @@
// check for "points" in any of the result directories
bool meshMoving = false;
-if (Times.size() > 1)
+
+if (timeDirs.size() > 1 && Pstream::master())
{
- // We already loaded a mesh (usually from constant). See if any other
- // points files
- forAll(Times, timeI)
+ // We already loaded a mesh (usually from constant).
+ // See if any other "polyMesh/points" files exist too.
+
+ const fileName& baseDir = mesh.time().path();
+
+ Info<< "Search for moving mesh ... " << flush;
+ forAll(timeDirs, timeI)
{
- if (Times[timeI].name() != mesh.pointsInstance())
- {
- IOobject io
+ const word& timeName = timeDirs[timeI].name();
+
+ meshMoving =
+ (
+ timeName != mesh.pointsInstance()
+ && isDir(baseDir/timeName/polyMesh::meshSubDir)
+ && IOobject
(
"points",
- Times[timeI].name(),
+ timeName,
polyMesh::meshSubDir,
mesh,
- IOobject::NO_READ
- );
- if (io.typeHeaderOk(true))
- {
- meshMoving = true;
- break;
- }
+ IOobject::NO_READ,
+ IOobject::NO_WRITE,
+ false // no register
+ ).typeHeaderOk(true)
+ );
+
+ if (meshMoving)
+ {
+ break;
}
}
+
+ if (meshMoving)
+ {
+ Info<< "found." << nl
+ << " Writing meshes for every timestep." << endl;
+ }
+ else
+ {
+ Info<< "none detected." << endl;
+ }
}
+
+reduce(meshMoving, orOp());
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H
index 68eb88e158..ceccc987ae 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightAsciiStream.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -52,17 +52,17 @@ class ensightAsciiStream
{
// Private data
- //- Description of data_
+ //- Output file stream
OFstream str_;
// Private Member Functions
//- Disallow default bitwise copy construct
- ensightAsciiStream(const ensightAsciiStream&);
+ ensightAsciiStream(const ensightAsciiStream&) = delete;
//- Disallow default bitwise assignment
- void operator=(const ensightAsciiStream&);
+ void operator=(const ensightAsciiStream&) = delete;
public:
@@ -70,14 +70,14 @@ public:
// Constructors
//- Construct from components
- ensightAsciiStream(const fileName& f, const Time& runTime)
+ ensightAsciiStream(const fileName& f)
:
ensightStream(f),
str_
(
f,
- runTime.writeFormat(),
- runTime.writeVersion(),
+ IOstream::ASCII,
+ IOstream::currentVersion,
IOstream::UNCOMPRESSED
)
{
@@ -139,14 +139,6 @@ public:
<< setw(10) << partI << nl;
}
- // Member Operators
-
- // Friend Functions
-
- // Friend Operators
-
- // IOstream Operators
-
};
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H
index d343567722..d1c3d6e3b3 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightBinaryStream.H
@@ -51,17 +51,17 @@ class ensightBinaryStream
{
// Private data
- //- Description of data_
+ //- Output file stream
autoPtr str_;
// Private Member Functions
//- Disallow default bitwise copy construct
- ensightBinaryStream(const ensightBinaryStream&);
+ ensightBinaryStream(const ensightBinaryStream&) = delete;
//- Disallow default bitwise assignment
- void operator=(const ensightBinaryStream&);
+ void operator=(const ensightBinaryStream&) = delete;
public:
@@ -69,7 +69,7 @@ public:
// Constructors
//- Construct from components
- ensightBinaryStream(const fileName& f, const Time&)
+ ensightBinaryStream(const fileName& f)
:
ensightStream(f),
str_
@@ -90,11 +90,6 @@ public:
// Member Functions
- virtual bool ascii() const
- {
- return false;
- }
-
virtual void write(const char* val)
{
char buffer[80];
@@ -141,14 +136,6 @@ public:
write(partI);
}
- // Member Operators
-
- // Friend Functions
-
- // Friend Operators
-
- // IOstream Operators
-
};
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H
index 6ec8373fcf..5a18a953c7 100644
--- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCaseTail.H
@@ -1,5 +1,8 @@
if (Pstream::master())
{
+ ensightCaseFile.setf(ios_base::scientific, ios_base::floatfield);
+ ensightCaseFile.precision(5);
+
ensightCaseFile << nl << "TIME" << nl
<< "time set: " << 1 << nl
<< "number of steps: " << nTimeSteps << nl
@@ -8,20 +11,17 @@ if (Pstream::master())
ensightCaseFile << "time values:" << nl;
- ensightCaseFile.setf(ios_base::scientific, ios_base::floatfield);
- ensightCaseFile.precision(5);
-
label count = 0;
scalar Tcorr = 0.0;
- if (Times[0].value() < 0)
+ if (timeDirs[0].value() < 0)
{
- Tcorr = - Times[0].value();
+ Tcorr = -timeDirs[0].value();
Info<< "Correcting time values. Adding " << Tcorr << endl;
}
- forAll(Times, n)
+ forAll(timeDirs, n)
{
- ensightCaseFile << setw(12) << Times[n].value() + Tcorr << " ";
+ ensightCaseFile << setw(12) << timeDirs[n].value() + Tcorr << " ";
if (++count % 6 == 0)
{
diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloud.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloud.C
new file mode 100644
index 0000000000..08779ff0a8
--- /dev/null
+++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightCloud.C
@@ -0,0 +1,180 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+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 .
+
+\*---------------------------------------------------------------------------*/
+
+#include "ensightCloud.H"
+#include "ensightFile.H"
+#include "fvMesh.H"
+#include "passiveParticle.H"
+#include "Cloud.H"
+#include "pointList.H"
+
+// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
+
+void Foam::ensightParticlePositions
+(
+ const fvMesh& mesh,
+ const fileName& dataDir,
+ const label timeIndex,
+ const word& cloudName,
+ const bool dataExists,
+ IOstream::streamFormat format
+)
+{
+ if (dataExists)
+ {
+ Info<< " positions";
+ }
+ else
+ {
+ Info<< " positions{0}";
+ }
+
+ // Total number of parcels on all processes
+ label nTotParcels = 0;
+ autoPtr> cloudPtr;
+
+ if (dataExists)
+ {
+ cloudPtr.reset(new Cloud(mesh, cloudName, false));
+ nTotParcels = cloudPtr().size();
+ }
+ reduce(nTotParcels, sumOp