diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointContinuityErrs.H b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointContinuityErrs.H
index b8d6fd0687..8315aa3770 100644
--- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointContinuityErrs.H
+++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointContinuityErrs.H
@@ -35,11 +35,11 @@ Description
scalar globalContErr = runTime.deltaTValue()*
fvc::div(phia)().weightedAverage(mesh.V()).value();
- cumulativeContErr += globalContErr;
+ cumulativeAdjointContErr += globalContErr;
Info<< "Adjoint continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
- << ", cumulative = " << cumulativeContErr
+ << ", cumulative = " << cumulativeAdjointContErr
<< endl;
}
diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C
index bedc12b3ba..b5a699cc87 100644
--- a/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C
+++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/adjointShapeOptimizationFoam.C
@@ -74,6 +74,7 @@ int main(int argc, char *argv[])
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"
+ #include "initAdjointContinuityErrs.H"
simpleControl simple(mesh);
diff --git a/applications/solvers/incompressible/adjointShapeOptimizationFoam/initAdjointContinuityErrs.H b/applications/solvers/incompressible/adjointShapeOptimizationFoam/initAdjointContinuityErrs.H
new file mode 100644
index 0000000000..9d6c3b55be
--- /dev/null
+++ b/applications/solvers/incompressible/adjointShapeOptimizationFoam/initAdjointContinuityErrs.H
@@ -0,0 +1,43 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011 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 .
+
+Global
+ cumulativeAdjointContErr
+
+Description
+ Declare and initialise the cumulative ddjoint continuity error.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef initAdjointContinuityErrs_H
+#define initAdjointContinuityErrs_H
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+scalar cumulativeAdjointContErr = 0;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C
index 1f308edfb6..41e28c3f64 100644
--- a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C
+++ b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C
@@ -243,6 +243,7 @@ void Foam::uniqueOrder
order[n++] = order[i];
}
}
+ order[n++] = order[order.size()-1];
order.setSize(n);
}
}
diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C
index 20fca2c4db..6ab3baa700 100644
--- a/src/OpenFOAM/db/Time/Time.C
+++ b/src/OpenFOAM/db/Time/Time.C
@@ -170,7 +170,7 @@ void Foam::Time::setControls()
readDict();
deltaTSave_ = deltaT_;
- deltaT0_ = deltaTSave_;
+ deltaT0_ = deltaT_;
if (Pstream::parRun())
{
@@ -203,11 +203,14 @@ void Foam::Time::setControls()
)
);
- if (timeDict.readIfPresent("deltaT", deltaTSave_))
+ if (timeDict.readIfPresent("deltaT", deltaT_))
{
- deltaT0_ = deltaTSave_;
+ deltaTSave_ = deltaT_;
+ deltaT0_ = deltaT_;
}
+ timeDict.readIfPresent("deltaT0", deltaT0_);
+
if (timeDict.readIfPresent("index", startTimeIndex_))
{
timeIndex_ = startTimeIndex_;
diff --git a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C
index b23165415b..9d1b6e1504 100644
--- a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C
+++ b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C
@@ -26,6 +26,7 @@ License
#include "zone.H"
#include "IOstream.H"
#include "demandDrivenData.H"
+#include "HashSet.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -192,6 +193,9 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
bool hasError = false;
+ // To check for duplicate entries
+ labelHashSet elems(size());
+
forAll(addr, i)
{
if (addr[i] < 0 || addr[i] >= maxSize)
@@ -215,6 +219,18 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
break;
}
}
+ else if (!elems.insert(addr[i]))
+ {
+ if (report)
+ {
+ WarningIn
+ (
+ "bool zone::checkDefinition("
+ "const label maxSize, const bool report) const"
+ ) << "Zone " << name_
+ << " contains duplicate index label " << addr[i] << endl;
+ }
+ }
}
return hasError;
diff --git a/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C b/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C
index 4bf4054dee..62f40e5454 100644
--- a/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C
+++ b/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C
@@ -26,11 +26,6 @@ License
#include "cachedRandom.H"
#include "OSspecific.H"
-#if INT_MAX != 2147483647
-# error "INT_MAX != 2147483647"
-# error "The random number generator may not work!"
-#endif
-
// * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * //
Foam::scalar Foam::cachedRandom::scalar01()
@@ -79,7 +74,7 @@ Foam::cachedRandom::cachedRandom(const label seed, const label count)
osRandomSeed(seed_);
forAll(samples_, i)
{
- samples_[i] = drand48();
+ samples_[i] = osRandomDouble();
}
}
diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C
index 9bbf331022..ebe1c773d2 100644
--- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C
+++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C
@@ -306,6 +306,7 @@ Foam::FacePostProcessing::FacePostProcessing
DynamicList