Permalink
Browse files

Merge branch 'master' of github.com:OpenFOAM/OpenFOAM-2.0.x

  • Loading branch information...
2 parents ef52116 + 0721eb3 commit 3f995a420562e3a5903ca7f79f096ac1d8f1203a andy committed Nov 4, 2011
@@ -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;
}
@@ -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);
@@ -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 <http://www.gnu.org/licenses/>.
+
+Global
+ cumulativeAdjointContErr
+
+Description
+ Declare and initialise the cumulative ddjoint continuity error.
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef initAdjointContinuityErrs_H
+#define initAdjointContinuityErrs_H
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+scalar cumulativeAdjointContErr = 0;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
@@ -243,6 +243,7 @@ void Foam::uniqueOrder
order[n++] = order[i];
}
}
+ order[n++] = order[order.size()-1];
order.setSize(n);
}
}
@@ -163,7 +163,7 @@ void Foam::Time::setControls()
readDict();
deltaTSave_ = deltaT_;
- deltaT0_ = deltaTSave_;
+ deltaT0_ = deltaT_;
if (Pstream::parRun())
{
@@ -196,11 +196,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_;
@@ -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();
}
}
@@ -306,6 +306,7 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
DynamicList<label> zoneIDs;
const faceZoneMesh& fzm = owner.mesh().faceZones();
const surfaceScalarField& magSf = owner.mesh().magSf();
+ const polyBoundaryMesh& pbm = owner.mesh().boundaryMesh();
forAll(faceZoneNames, i)
{
const word& zoneName = faceZoneNames[i];
@@ -314,16 +315,38 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
{
zoneIDs.append(zoneI);
const faceZone& fz = fzm[zoneI];
+ mass_[i].setSize(fz.size(), 0.0);
+ massTotal_[i].setSize(fz.size(), 0.0);
+ massFlux_[i].setSize(fz.size(), 0.0);
+
label nFaces = returnReduce(fz.size(), sumOp<label>());
- mass_[i].setSize(nFaces, 0.0);
- massTotal_[i].setSize(nFaces, 0.0);
- massFlux_[i].setSize(nFaces, 0.0);
Info<< " " << zoneName << " faces: " << nFaces << nl;
scalar totArea = 0.0;
forAll(fz, j)
{
- totArea += magSf[fz[j]];
+ label faceI = fz[j];
+ label bFaceI = faceI - owner.mesh().nInternalFaces();
+ label patchI = pbm.patchID()[bFaceI];
+
+ if (patchI == -1)
+ {
+ totArea += magSf[fz[j]];
+ }
+ else
+ {
+ const polyPatch& pp = pbm[patchI];
+
+ if
+ (
+ !pp.coupled()
+ || refCast<const coupledPolyPatch>(pp).owner()
+ )
+ {
+ label localFaceI = pp.whichFace(faceI);
+ totArea += magSf.boundaryField()[patchI][localFaceI];
+ }
+ }
}
totArea = returnReduce(totArea, sumOp<scalar>());

0 comments on commit 3f995a4

Please sign in to comment.