diff --git a/applications/utilities/postProcessing/patch/patchAverage/Make/files b/applications/utilities/postProcessing/patch/patchAverage/Make/files
deleted file mode 100644
index 4d17c39ce..000000000
--- a/applications/utilities/postProcessing/patch/patchAverage/Make/files
+++ /dev/null
@@ -1,3 +0,0 @@
-patchAverage.C
-
-EXE = $(FOAM_APPBIN)/patchAverage
diff --git a/applications/utilities/postProcessing/patch/patchAverage/Make/options b/applications/utilities/postProcessing/patch/patchAverage/Make/options
deleted file mode 100644
index 318e1be8f..000000000
--- a/applications/utilities/postProcessing/patch/patchAverage/Make/options
+++ /dev/null
@@ -1,8 +0,0 @@
-EXE_INC = \
- -I$(LIB_SRC)/finiteVolume/lnInclude \
- -I$(LIB_SRC)/meshTools/lnInclude
-
-EXE_LIBS = \
- -lgenericPatchFields \
- -lfiniteVolume \
- -lmeshTools
diff --git a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C b/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
deleted file mode 100644
index 0d79e42b8..000000000
--- a/applications/utilities/postProcessing/patch/patchAverage/patchAverage.C
+++ /dev/null
@@ -1,147 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ 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 .
-
-Application
- patchAverage
-
-Description
- Calculates the average of the specified field over the specified patch.
-
-\*---------------------------------------------------------------------------*/
-
-#include "fvCFD.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-template
-void printAverage
-(
- const fvMesh& mesh,
- const IOobject& fieldHeader,
- const scalar area,
- const label patchi,
- bool& done
-)
-{
- if (!done && fieldHeader.headerClassName() == FieldType::typeName)
- {
- Info<< " Reading " << fieldHeader.headerClassName() << " "
- << fieldHeader.name() << endl;
-
- FieldType field(fieldHeader, mesh);
-
- typename FieldType::value_type sumField =
- Zero;
-
- if (area > 0)
- {
- sumField = gSum
- (
- mesh.magSf().boundaryField()[patchi]
- * field.boundaryField()[patchi]
- ) / area;
- }
-
- Info<< " Average of " << fieldHeader.headerClassName()
- << " over patch "
- << mesh.boundary()[patchi].name()
- << '[' << patchi << ']' << " = "
- << sumField << endl;
-
- done = true;
- }
-}
-
-
-
-int main(int argc, char *argv[])
-{
- timeSelector::addOptions();
- #include "addRegionOption.H"
- argList::validArgs.append("fieldName");
- argList::validArgs.append("patchName");
- #include "setRootCase.H"
- #include "createTime.H"
- instantList timeDirs = timeSelector::select0(runTime, args);
- #include "createNamedMesh.H"
-
- const word fieldName = args[1];
- const word patchName = args[2];
-
- forAll(timeDirs, timeI)
- {
- runTime.setTime(timeDirs[timeI], timeI);
- Info<< "Time = " << runTime.timeName() << endl;
-
- IOobject io
- (
- fieldName,
- runTime.timeName(),
- mesh,
- IOobject::MUST_READ
- );
-
- // Check field exists
- if (io.headerOk())
- {
- mesh.readUpdate();
-
- const label patchi = mesh.boundaryMesh().findPatchID(patchName);
- if (patchi < 0)
- {
- FatalError
- << "Unable to find patch " << patchName << nl
- << exit(FatalError);
- }
- scalar area = gSum(mesh.magSf().boundaryField()[patchi]);
-
- bool done = false;
- printAverage(mesh, io, area, patchi, done);
- printAverage(mesh, io, area, patchi, done);
- printAverage(mesh, io, area, patchi, done);
- printAverage(mesh, io, area, patchi, done);
- printAverage(mesh, io, area, patchi, done);
-
- if (!done)
- {
- FatalError
- << "Only possible to average volFields."
- << " Field " << fieldName << " is of type "
- << io.headerClassName()
- << nl << exit(FatalError);
- }
- }
- else
- {
- Info<< " No field " << fieldName << endl;
- }
-
- Info<< endl;
- }
-
- Info<< "End\n" << endl;
-
- return 0;
-}
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/Make/files b/applications/utilities/postProcessing/patch/patchIntegrate/Make/files
deleted file mode 100644
index 6595b6a7f..000000000
--- a/applications/utilities/postProcessing/patch/patchIntegrate/Make/files
+++ /dev/null
@@ -1,3 +0,0 @@
-patchIntegrate.C
-
-EXE = $(FOAM_APPBIN)/patchIntegrate
diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/Make/options b/applications/utilities/postProcessing/patch/patchIntegrate/Make/options
deleted file mode 100644
index 318e1be8f..000000000
--- a/applications/utilities/postProcessing/patch/patchIntegrate/Make/options
+++ /dev/null
@@ -1,8 +0,0 @@
-EXE_INC = \
- -I$(LIB_SRC)/finiteVolume/lnInclude \
- -I$(LIB_SRC)/meshTools/lnInclude
-
-EXE_LIBS = \
- -lgenericPatchFields \
- -lfiniteVolume \
- -lmeshTools
diff --git a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C b/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
deleted file mode 100644
index 61cecad44..000000000
--- a/applications/utilities/postProcessing/patch/patchIntegrate/patchIntegrate.C
+++ /dev/null
@@ -1,255 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ 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 .
-
-Application
- patchIntegrate
-
-Description
- Calculates the integral of the specified field over the specified patch.
-
-\*---------------------------------------------------------------------------*/
-
-#include "fvCFD.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-template
-void printIntegrate
-(
- const fvMesh& mesh,
- const IOobject& fieldHeader,
- const label patchi,
- bool& done
-)
-{
- if (!done && fieldHeader.headerClassName() == FieldType::typeName)
- {
- Info<< " Reading " << fieldHeader.headerClassName() << " "
- << fieldHeader.name() << endl;
-
- FieldType field(fieldHeader, mesh);
-
- Info<< " Integral of " << fieldHeader.name()
- << " over vector area of patch "
- << mesh.boundary()[patchi].name() << '[' << patchi << ']' << " = "
- << gSum
- (
- mesh.Sf().boundaryField()[patchi]
- *field.boundaryField()[patchi]
- )
- << nl;
-
- Info<< " Integral of " << fieldHeader.name()
- << " over area magnitude of patch "
- << mesh.boundary()[patchi].name() << '[' << patchi << ']' << " = "
- << gSum
- (
- mesh.magSf().boundaryField()[patchi]
- *field.boundaryField()[patchi]
- )
- << nl;
-
- done = true;
- }
-}
-
-
-template
-void printSum
-(
- const fvMesh& mesh,
- const IOobject& fieldHeader,
- const label patchi,
- bool& done
-)
-{
- if (!done && fieldHeader.headerClassName() == FieldType::typeName)
- {
- Info<< " Reading " << FieldType::typeName << " "
- << fieldHeader.name() << endl;
-
- FieldType field(fieldHeader, mesh);
- typename FieldType::value_type sumField = gSum
- (
- field.boundaryField()[patchi]
- );
-
- Info<< " Integral of " << fieldHeader.name() << " over patch "
- << mesh.boundary()[patchi].name() << '[' << patchi << ']' << " = "
- << sumField << nl;
-
- done = true;
- }
-}
-
-
-
-int main(int argc, char *argv[])
-{
- timeSelector::addOptions();
- #include "addRegionOption.H"
- argList::validArgs.append("fieldName");
- argList::validArgs.append("patchName");
- #include "setRootCase.H"
- #include "createTime.H"
- instantList timeDirs = timeSelector::select0(runTime, args);
- #include "createNamedMesh.H"
-
- const word fieldName = args[1];
- const word patchName = args[2];
-
- forAll(timeDirs, timeI)
- {
- runTime.setTime(timeDirs[timeI], timeI);
- Info<< "Time = " << runTime.timeName() << endl;
-
- IOobject fieldHeader
- (
- fieldName,
- runTime.timeName(),
- mesh,
- IOobject::MUST_READ
- );
-
- // Check field exists
- if (fieldHeader.headerOk())
- {
- mesh.readUpdate();
-
- const label patchi = mesh.boundaryMesh().findPatchID(patchName);
- if (patchi < 0)
- {
- FatalError
- << "Unable to find patch " << patchName << nl
- << exit(FatalError);
- }
-
- // Give patch area
- Info<< " Area vector of patch "
- << patchName << '[' << patchi << ']' << " = "
- << gSum(mesh.Sf().boundaryField()[patchi]) << endl;
- Info<< " Area magnitude of patch "
- << patchName << '[' << patchi << ']' << " = "
- << gSum(mesh.magSf().boundaryField()[patchi]) << endl;
-
- // Read field and calc integral
- bool done = false;
- printIntegrate
- (
- mesh,
- fieldHeader,
- patchi,
- done
- );
- printIntegrate
- (
- mesh,
- fieldHeader,
- patchi,
- done
- );
-
- //- No tensor integrations
- //printIntegrate
- //(
- // mesh,
- // fieldHeader,
- // patchi,
- // done
- //);
- //printIntegrate
- //(
- // mesh,
- // fieldHeader,
- // patchi,
- // done
- //);
- //printIntegrate
- //(
- // mesh,
- // fieldHeader,
- // patchi,
- // done
- //);
-
- printSum
- (
- mesh,
- fieldHeader,
- patchi,
- done
- );
- printSum
- (
- mesh,
- fieldHeader,
- patchi,
- done
- );
- printSum
- (
- mesh,
- fieldHeader,
- patchi,
- done
- );
- printSum
- (
- mesh,
- fieldHeader,
- patchi,
- done
- );
- printSum
- (
- mesh,
- fieldHeader,
- patchi,
- done
- );
-
- if (!done)
- {
- FatalError
- << "Only possible to integrate "
- << "volFields and surfaceFields."
- << " Field " << fieldName << " is of type "
- << fieldHeader.headerClassName()
- << nl << exit(FatalError);
- }
- }
- else
- {
- Info<< " No field " << fieldName << endl;
- }
-
- Info<< endl;
- }
-
- Info<< "End\n" << endl;
-
- return 0;
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/postProcess/postProcess.C b/applications/utilities/postProcessing/postProcess/postProcess.C
index 335006d17..3b3878d4b 100644
--- a/applications/utilities/postProcessing/postProcess/postProcess.C
+++ b/applications/utilities/postProcessing/postProcess/postProcess.C
@@ -128,6 +128,9 @@ int main(int argc, char *argv[])
#include "addRegionOption.H"
#include "addFunctionObjectOptions.H"
+ // Set functionObject post-processing mode
+ functionObject::postProcess = true;
+
#include "setRootCase.H"
if (args.optionFound("list"))
diff --git a/bin/patchAverage b/bin/patchAverage
new file mode 100755
index 000000000..bd15b518c
--- /dev/null
+++ b/bin/patchAverage
@@ -0,0 +1,37 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# ========= |
+# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+# \\ / O peration |
+# \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
+# \\/ 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 .
+#
+# Script
+# patchAverage
+#
+# Description
+# Script to suggest using the new "postProcess" utility.
+#
+#------------------------------------------------------------------------------
+Script=${0##*/}
+
+echo $Script "has been superceded by the postProcess utility:"
+echo "postProcess -func '"$Script"(name=inlet,p)'"
+
+#------------------------------------------------------------------------------
diff --git a/bin/patchIntegrate b/bin/patchIntegrate
new file mode 100755
index 000000000..72c602144
--- /dev/null
+++ b/bin/patchIntegrate
@@ -0,0 +1,37 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# ========= |
+# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+# \\ / O peration |
+# \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
+# \\/ 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 .
+#
+# Script
+# patchIntegrate
+#
+# Description
+# Script to suggest using the new "postProcess" utility.
+#
+#------------------------------------------------------------------------------
+Script=${0##*/}
+
+echo $Script "has been superceded by the postProcess utility:"
+echo "postProcess -func '"$Script"(name=inlet,p)'"
+
+#------------------------------------------------------------------------------
diff --git a/etc/caseDicts/postProcessing/surfaceRegion/patchAverage b/etc/caseDicts/postProcessing/surfaceRegion/patchAverage
index 8f042fa96..2a1bda2fc 100644
--- a/etc/caseDicts/postProcessing/surfaceRegion/patchAverage
+++ b/etc/caseDicts/postProcessing/surfaceRegion/patchAverage
@@ -17,8 +17,6 @@ patchAverage
operation average;
#includeEtc "caseDicts/postProcessing/surfaceRegion/patch.cfg"
-
- log true;
}
diff --git a/etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate b/etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate
index 1c86de232..41b247353 100644
--- a/etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate
+++ b/etc/caseDicts/postProcessing/surfaceRegion/patchIntegrate
@@ -17,8 +17,6 @@ patchIntegrate
operation areaIntegrate;
#includeEtc "caseDicts/postProcessing/surfaceRegion/patch.cfg"
-
- log true;
}
diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C
index 965cafff5..c0cd27a97 100644
--- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C
+++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C
@@ -36,12 +36,15 @@ namespace Foam
defineRunTimeSelectionTable(functionObject, dictionary);
}
+bool Foam::functionObject::postProcess(false);
+
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObject::functionObject(const word& name)
:
- name_(name)
+ name_(name),
+ log(postProcess)
{}
@@ -120,6 +123,17 @@ const Foam::word& Foam::functionObject::name() const
}
+bool Foam::functionObject::read(const dictionary& dict)
+{
+ if (!postProcess)
+ {
+ log = dict.lookupOrDefault("log", true);
+ }
+
+ return true;
+}
+
+
bool Foam::functionObject::end()
{
return execute() && write();
diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H
index 7958dc37d..74457227a 100644
--- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H
+++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H
@@ -112,6 +112,7 @@ SourceFiles
#include "typeInfo.H"
#include "autoPtr.H"
+#include "Switch.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -152,6 +153,12 @@ public:
static int debug;
+ //- Global post-processing mode switch
+ static bool postProcess;
+
+ //- Switch write log to Info
+ Switch log;
+
// Declare run-time constructor selection tables
@@ -199,7 +206,7 @@ public:
const word& name() const;
//- Read and set the function object if its data have changed
- virtual bool read(const dictionary&) = 0;
+ virtual bool read(const dictionary&);
//- Called at each ++ or += of the time-loop.
// postProcess overrides the usual executeControl behaviour and
diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H
index d264ebf49..09a3b0d95 100644
--- a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H
+++ b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H
@@ -73,6 +73,9 @@ if (argList::postProcess(argc, argv))
#include "addRegionOption.H"
#include "addFunctionObjectOptions.H"
+ // Set functionObject post-processing mode
+ functionObject::postProcess = true;
+
#include "setRootCase.H"
if (args.optionFound("list"))
diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C
index d4cef1916..c010855bc 100644
--- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C
+++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.C
@@ -105,8 +105,7 @@ Foam::functionObjects::regionFunctionObject::regionFunctionObject
(
dict.lookupOrDefault("region", polyMesh::defaultRegion)
)
- ),
- log(true)
+ )
{}
@@ -119,8 +118,7 @@ Foam::functionObjects::regionFunctionObject::regionFunctionObject
:
functionObject(name),
time_(obr.time()),
- obr_(obr),
- log(true)
+ obr_(obr)
{}
@@ -134,9 +132,7 @@ Foam::functionObjects::regionFunctionObject::~regionFunctionObject()
bool Foam::functionObjects::regionFunctionObject::read(const dictionary& dict)
{
- log = dict.lookupOrDefault("log", true);
-
- return true;
+ return functionObject::read(dict);
}
diff --git a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H
index dcdb7b7f4..928ad04ab 100644
--- a/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H
+++ b/src/OpenFOAM/db/functionObjects/regionFunctionObject/regionFunctionObject.H
@@ -40,7 +40,6 @@ SourceFiles
#define functionObjects_regionFunctionObject_H
#include "functionObject.H"
-#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -115,9 +114,6 @@ public:
//- Runtime type information
TypeName("regionFunctionObject");
- //- Switch write log to Info
- Switch log;
-
// Constructors