diff --git a/src/postProcessing/functionObjects/utilities/Make/files b/src/postProcessing/functionObjects/utilities/Make/files
index 29ca6fe361..4b7341f296 100644
--- a/src/postProcessing/functionObjects/utilities/Make/files
+++ b/src/postProcessing/functionObjects/utilities/Make/files
@@ -6,6 +6,9 @@ codedFunctionObject/codedFunctionObject.C
CourantNo/CourantNo.C
CourantNo/CourantNoFunctionObject.C
+ddt2/ddt2.C
+ddt2/ddt2FunctionObject.C
+
DESModelRegions/DESModelRegions.C
DESModelRegions/DESModelRegionsFunctionObject.C
diff --git a/src/postProcessing/functionObjects/utilities/Make/options b/src/postProcessing/functionObjects/utilities/Make/options
index 82ceb9db5f..3feeee001a 100644
--- a/src/postProcessing/functionObjects/utilities/Make/options
+++ b/src/postProcessing/functionObjects/utilities/Make/options
@@ -32,4 +32,4 @@ LIB_LIBS = \
-lsampling \
-lsurfMesh \
-lchemistryModel \
- -lreactionThermophysicalModels
\ No newline at end of file
+ -lreactionThermophysicalModels
diff --git a/src/postProcessing/functionObjects/utilities/ddt2/IOddt2.H b/src/postProcessing/functionObjects/utilities/ddt2/IOddt2.H
new file mode 100644
index 0000000000..b644076624
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/ddt2/IOddt2.H
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2016 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 .
+
+Typedef
+ Foam::IOddt2
+
+Description
+ Instance of the generic IOOutputFilter for ddt2.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef IOddt2_H
+#define IOddt2_H
+
+#include "ddt2.H"
+#include "IOOutputFilter.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ typedef IOOutputFilter IOddt2;
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/ddt2/ddt2.C b/src/postProcessing/functionObjects/utilities/ddt2/ddt2.C
new file mode 100644
index 0000000000..76975fcd07
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/ddt2/ddt2.C
@@ -0,0 +1,235 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2016 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 .
+
+\*---------------------------------------------------------------------------*/
+
+#include "ddt2.H"
+
+#include "volFields.H"
+#include "dictionary.H"
+#include "FieldFunctions.H"
+#include "fvcDdt.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ defineTypeNameAndDebug(ddt2, 0);
+}
+
+// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+
+
+template
+bool Foam::ddt2::calculate
+(
+ const fvMesh& mesh,
+ bool& done
+)
+{
+ if (done)
+ {
+ return true; // already done - skip
+ }
+
+ done = mesh.foundObject(fieldName_);
+ if (!done)
+ {
+ return false;
+ }
+
+ const FieldType& input =
+ mesh.lookupObject(fieldName_);
+
+ if (!mesh.foundObject(resultName_))
+ {
+ const dimensionSet dims
+ (
+ mag_
+ ? mag(input.dimensions()/dimTime)
+ : magSqr(input.dimensions()/dimTime)
+ );
+
+ mesh.objectRegistry::store
+ (
+ new volScalarField
+ (
+ IOobject
+ (
+ resultName_,
+ mesh.time().timeName(),
+ mesh,
+ IOobject::NO_READ,
+ IOobject::NO_WRITE // OR IOobject::AUTO_WRITE
+ ),
+ mesh,
+ dimensionedScalar
+ (
+ "zero",
+ dims,
+ Zero
+ ),
+ emptyPolyPatch::typeName
+ )
+ );
+ }
+
+ volScalarField& field = const_cast
+ (
+ mesh.lookupObject(resultName_)
+ );
+
+ if (mag_)
+ {
+ field = mag(fvc::ddt(input));
+ }
+ else
+ {
+ field = magSqr(fvc::ddt(input));
+ }
+
+ return done;
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::ddt2::ddt2
+(
+ const word& name,
+ const objectRegistry& obr,
+ const dictionary& dict,
+ const bool loadFromFiles
+)
+:
+ name_(name),
+ obr_(obr),
+ active_(true),
+ fieldName_("undefined-fieldName"),
+ resultName_(word::null),
+ log_(true),
+ mag_(dict.lookupOrDefault("mag", false))
+{
+ // Check if the available mesh is an fvMesh, otherwise deactivate
+ if (!isA(obr_))
+ {
+ active_ = false;
+ WarningInFunction
+ << "No fvMesh available, deactivating." << nl
+ << endl;
+ }
+
+ read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+Foam::ddt2::~ddt2()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void Foam::ddt2::read(const dictionary& dict)
+{
+ if (active_)
+ {
+ log_.readIfPresent("log", dict);
+
+ dict.lookup("fieldName") >> fieldName_;
+ dict.readIfPresent("resultName", resultName_);
+
+ if (resultName_.empty())
+ {
+ resultName_ =
+ (
+ word(mag_ ? "mag" : "magSqr")
+ + "(ddt(" + fieldName_ + "))"
+ );
+ }
+ }
+}
+
+
+void Foam::ddt2::execute()
+{
+ if (active_)
+ {
+ const fvMesh& mesh = refCast(obr_);
+ bool done = false;
+
+ calculate(mesh, done);
+ calculate(mesh, done);
+
+ if (!done)
+ {
+ WarningInFunction
+ << "Unprocessed field " << fieldName_ << endl;
+ }
+ }
+}
+
+
+void Foam::ddt2::end()
+{
+ // Do nothing
+}
+
+
+void Foam::ddt2::timeSet()
+{
+ // Do nothing
+}
+
+
+void Foam::ddt2::write()
+{
+ if (active_)
+ {
+ if (obr_.foundObject(resultName_))
+ {
+ const regIOobject& io =
+ obr_.lookupObject(resultName_);
+
+ if (log_)
+ {
+ const volScalarField& field = dynamicCast
+ (
+ io
+ );
+
+ // could add additional statistics here
+ Info<< type() << " " << name_
+ << " output: writing field " << field.name()
+ << " average: " << gAverage(field) << endl;
+ }
+
+ // could also add option to suppress writing?
+ io.write();
+ }
+ }
+}
+
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/ddt2/ddt2.H b/src/postProcessing/functionObjects/utilities/ddt2/ddt2.H
new file mode 100644
index 0000000000..93ee8ea077
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/ddt2/ddt2.H
@@ -0,0 +1,212 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2016 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 .
+
+Class
+ Foam::ddt2
+
+Group
+ grpFVFunctionObjects
+
+Description
+ This function object calculates the magnitude squared
+ of d(scalarField)/dt.
+
+ The result can be used further for determining variance or RMS values
+ (for example).
+
+ Example of function object specification:
+ \verbatim
+ dpdt2
+ {
+ type ddt2;
+ functionObjectLibs ("libutilityFunctionObjects.so");
+ fieldName p;
+ resultName dpdt2;
+ ...
+ }
+ \endverbatim
+
+ \heading Function object usage
+ \table
+ Property | Description | Required | Default value
+ type | type name: ddt2 | yes |
+ fieldName | Name of field to process | yes |
+ resultName | Name of magnitude field | no | magSqr(ddt(fieldName))
+ log | Log to standard output | no | yes
+ mag | Use 'mag' instead of 'magSqr' | no | false
+ \endtable
+
+ Note that the optional 'mag' entry cannot be changed during the simulation
+ since it alters the dimensions of the output field.
+
+SourceFiles
+ ddt2.C
+ IOddt2.H
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef ddt2_H
+#define ddt2_H
+
+#include "volFieldsFwd.H"
+#include "surfaceFieldsFwd.H"
+#include "pointFieldFwd.H"
+#include "OFstream.H"
+#include "Switch.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+class objectRegistry;
+class dictionary;
+class fvMesh;
+class polyMesh;
+class mapPolyMesh;
+class dimensionSet;
+
+/*---------------------------------------------------------------------------*\
+ Class ddt2 Declaration
+\*---------------------------------------------------------------------------*/
+
+class ddt2
+{
+ // Private data
+
+ //- Name of this ddt2 object
+ word name_;
+
+ //- Reference to the database
+ const objectRegistry& obr_;
+
+ //- On/off switch
+ bool active_;
+
+ //- Name of field to process
+ word fieldName_;
+
+ //- Name of result field
+ word resultName_;
+
+ //- Switch to send output to Info as well as to file
+ Switch log_;
+
+ //- Use 'mag' instead of 'magSqr'.
+ // Cannot be adjusted during the simulation since it alters the
+ // dimensions of the output field.
+ const Switch mag_;
+
+
+ // Private Member Functions
+
+ //- Create result field upon demand
+ volScalarField& getOrCreateResultField
+ (
+ const fvMesh&,
+ const dimensionSet& inputDims
+ );
+
+
+ //- Create result field upon demand
+ template
+ bool calculate(const FieldType& input);
+
+ //- Create result field upon demand
+ template
+ bool calculate(const fvMesh&, bool& done);
+
+
+ //- Disallow default bitwise copy construct
+ ddt2(const ddt2&) = delete;
+
+ //- Disallow default bitwise assignment
+ void operator=(const ddt2&) = delete;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("ddt2");
+
+
+ // Constructors
+
+ //- Construct for given objectRegistry and dictionary.
+ // Allow the possibility to load fields from files
+ ddt2
+ (
+ const word& name,
+ const objectRegistry&,
+ const dictionary&,
+ const bool loadFromFiles = false
+ );
+
+
+ //- Destructor
+ virtual ~ddt2();
+
+
+ // Member Functions
+
+ //- Return name of the ddt2 function object
+ virtual const word& name() const
+ {
+ return name_;
+ }
+
+ //- Read the ddt2 specification
+ virtual void read(const dictionary&);
+
+ //- Execute, currently does nothing
+ virtual void execute();
+
+ //- Execute at the final time-loop, currently does nothing
+ virtual void end();
+
+ //- Called when time was set at the end of the Time::operator++
+ virtual void timeSet();
+
+ //- Calculate the ddt2 and write
+ virtual void write();
+
+ //- Update for changes of mesh
+ virtual void updateMesh(const mapPolyMesh&)
+ {}
+
+ //- Update for changes of mesh
+ virtual void movePoints(const polyMesh&)
+ {}
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.C b/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.C
new file mode 100644
index 0000000000..9e09a15681
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.C
@@ -0,0 +1,42 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2016 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 .
+
+\*---------------------------------------------------------------------------*/
+
+#include "ddt2FunctionObject.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ defineNamedTemplateTypeNameAndDebug(ddt2FunctionObject, 0);
+
+ addToRunTimeSelectionTable
+ (
+ functionObject,
+ ddt2FunctionObject,
+ dictionary
+ );
+}
+
+// ************************************************************************* //
diff --git a/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.H b/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.H
new file mode 100644
index 0000000000..5f36e229c5
--- /dev/null
+++ b/src/postProcessing/functionObjects/utilities/ddt2/ddt2FunctionObject.H
@@ -0,0 +1,53 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2016 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 .
+
+Typedef
+ Foam::ddt2FunctionObject
+
+Description
+ FunctionObject wrapper around ddt2 to allow it to be created
+ via the functions entry within controlDict.
+
+SourceFiles
+ ddt2FunctionObject.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef ddt2FunctionObject_H
+#define ddt2FunctionObject_H
+
+#include "ddt2.H"
+#include "OutputFilterFunctionObject.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ typedef OutputFilterFunctionObject ddt2FunctionObject;
+}
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //