mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -35,11 +35,11 @@ Description
|
|||||||
|
|
||||||
scalar globalContErr = runTime.deltaTValue()*
|
scalar globalContErr = runTime.deltaTValue()*
|
||||||
fvc::div(phia)().weightedAverage(mesh.V()).value();
|
fvc::div(phia)().weightedAverage(mesh.V()).value();
|
||||||
cumulativeContErr += globalContErr;
|
cumulativeAdjointContErr += globalContErr;
|
||||||
|
|
||||||
Info<< "Adjoint continuity errors : sum local = " << sumLocalContErr
|
Info<< "Adjoint continuity errors : sum local = " << sumLocalContErr
|
||||||
<< ", global = " << globalContErr
|
<< ", global = " << globalContErr
|
||||||
<< ", cumulative = " << cumulativeContErr
|
<< ", cumulative = " << cumulativeAdjointContErr
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -74,6 +74,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
|
#include "initAdjointContinuityErrs.H"
|
||||||
|
|
||||||
simpleControl simple(mesh);
|
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[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
order[n++] = order[order.size()-1];
|
||||||
order.setSize(n);
|
order.setSize(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,7 +170,7 @@ void Foam::Time::setControls()
|
|||||||
|
|
||||||
readDict();
|
readDict();
|
||||||
deltaTSave_ = deltaT_;
|
deltaTSave_ = deltaT_;
|
||||||
deltaT0_ = deltaTSave_;
|
deltaT0_ = deltaT_;
|
||||||
|
|
||||||
if (Pstream::parRun())
|
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_))
|
if (timeDict.readIfPresent("index", startTimeIndex_))
|
||||||
{
|
{
|
||||||
timeIndex_ = startTimeIndex_;
|
timeIndex_ = startTimeIndex_;
|
||||||
|
|||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "zone.H"
|
#include "zone.H"
|
||||||
#include "IOstream.H"
|
#include "IOstream.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -192,6 +193,9 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
|
|||||||
|
|
||||||
bool hasError = false;
|
bool hasError = false;
|
||||||
|
|
||||||
|
// To check for duplicate entries
|
||||||
|
labelHashSet elems(size());
|
||||||
|
|
||||||
forAll(addr, i)
|
forAll(addr, i)
|
||||||
{
|
{
|
||||||
if (addr[i] < 0 || addr[i] >= maxSize)
|
if (addr[i] < 0 || addr[i] >= maxSize)
|
||||||
@ -215,6 +219,18 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
|
|||||||
break;
|
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;
|
return hasError;
|
||||||
|
|||||||
@ -26,11 +26,6 @@ License
|
|||||||
#include "cachedRandom.H"
|
#include "cachedRandom.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
|
||||||
#if INT_MAX != 2147483647
|
|
||||||
# error "INT_MAX != 2147483647"
|
|
||||||
# error "The random number generator may not work!"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::scalar Foam::cachedRandom::scalar01()
|
Foam::scalar Foam::cachedRandom::scalar01()
|
||||||
@ -79,7 +74,7 @@ Foam::cachedRandom::cachedRandom(const label seed, const label count)
|
|||||||
osRandomSeed(seed_);
|
osRandomSeed(seed_);
|
||||||
forAll(samples_, i)
|
forAll(samples_, i)
|
||||||
{
|
{
|
||||||
samples_[i] = drand48();
|
samples_[i] = osRandomDouble();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -306,6 +306,7 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
|
|||||||
DynamicList<label> zoneIDs;
|
DynamicList<label> zoneIDs;
|
||||||
const faceZoneMesh& fzm = owner.mesh().faceZones();
|
const faceZoneMesh& fzm = owner.mesh().faceZones();
|
||||||
const surfaceScalarField& magSf = owner.mesh().magSf();
|
const surfaceScalarField& magSf = owner.mesh().magSf();
|
||||||
|
const polyBoundaryMesh& pbm = owner.mesh().boundaryMesh();
|
||||||
forAll(faceZoneNames, i)
|
forAll(faceZoneNames, i)
|
||||||
{
|
{
|
||||||
const word& zoneName = faceZoneNames[i];
|
const word& zoneName = faceZoneNames[i];
|
||||||
@ -314,16 +315,38 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
|
|||||||
{
|
{
|
||||||
zoneIDs.append(zoneI);
|
zoneIDs.append(zoneI);
|
||||||
const faceZone& fz = fzm[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>());
|
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;
|
Info<< " " << zoneName << " faces: " << nFaces << nl;
|
||||||
|
|
||||||
scalar totArea = 0.0;
|
scalar totArea = 0.0;
|
||||||
forAll(fz, j)
|
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>());
|
totArea = returnReduce(totArea, sumOp<scalar>());
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,8 @@ boundaryField
|
|||||||
{
|
{
|
||||||
type porousBafflePressure;
|
type porousBafflePressure;
|
||||||
patchType cyclic;
|
patchType cyclic;
|
||||||
jump uniform 0 value uniform 0;
|
jump uniform 0;
|
||||||
|
value uniform 0;
|
||||||
D 700;
|
D 700;
|
||||||
I 500;
|
I 500;
|
||||||
length 1.05;
|
length 1.05;
|
||||||
|
|||||||
Reference in New Issue
Block a user