Merge branch 'master' of /home/noisy2/OpenFOAM/OpenFOAM-dev/

This commit is contained in:
mattijs
2008-05-13 11:53:42 +01:00
55 changed files with 212 additions and 49305 deletions

View File

@ -1,59 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Global
CourantNo
Description
Calculates and outputs the mean and maximum Courant Numbers.
\*---------------------------------------------------------------------------*/
scalar CoNum = 0.0;
scalar meanCoNum = 0.0;
scalar acousticCoNum = 0.0;
if (mesh.nInternalFaces())
{
surfaceScalarField SfUfbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()*mag(phiv);
CoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
acousticCoNum = max
(
mesh.surfaceInterpolation::deltaCoeffs()/sqrt(fvc::interpolate(psi))
).value()*runTime.deltaT().value();
}
Info<< "phiv Courant Number mean: " << meanCoNum
<< " max: " << CoNum
<< " acoustic max: " << acousticCoNum
<< endl;
// ************************************************************************* //

View File

@ -1,3 +0,0 @@
cavitatingFoam.C
EXE = $(FOAM_APPBIN)/cavitatingFoam

View File

@ -1,7 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/barotropicCompressibilityModel/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lbarotropicCompressibilityModel

View File

@ -1,16 +0,0 @@
surfaceScalarField gammaf = fvc::interpolate(gamma);
surfaceScalarField muf("muf", gammaf*muv + (1.0 - gammaf)*mul);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
- fvm::laplacian(muf, U)
//- (fvc::grad(U) & fvc::grad(muf))
- fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
);
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));
}

View File

@ -1,90 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
cavitatingFoam
Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "barotropicCompressibilityModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "readThermodynamicProperties.H"
# include "readTransportProperties.H"
# include "readControls.H"
# include "createFields.H"
# include "initContinuityErrs.H"
# include "compressibleCourantNo.H"
# include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
# include "readControls.H"
# include "CourantNo.H"
# include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
for (int outerCorr=0; outerCorr<nOuterCorr; outerCorr++)
{
# include "rhoEqn.H"
# include "gammaPsi.H"
# include "UEqn.H"
for (int corr=0; corr<nCorr; corr++)
{
# include "pEqn.H"
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "\n end \n";
return(0);
}
// ************************************************************************* //

View File

@ -1,22 +0,0 @@
{
volScalarField thermoRho = psi*p + (1.0 - gamma)*rhol0;
dimensionedScalar totalMass = fvc::domainIntegrate(rho);
scalar sumLocalContErr =
(
fvc::domainIntegrate(mag(rho - thermoRho))/totalMass
).value();
scalar globalContErr =
(
fvc::domainIntegrate(rho - thermoRho)/totalMass
).value();
cumulativeContErr += globalContErr;
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< ", cumulative = " << cumulativeContErr
<< endl;
}

View File

@ -1,75 +0,0 @@
Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
volScalarField gamma
(
IOobject
(
"gamma",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0))
);
gamma.oldTime();
Info<< "Creating barotropicompressibilityModel\n" << endl;
autoPtr<barotropicCompressibilityModel> psiModel =
barotropicCompressibilityModel::New
(
thermodynamicProperties,
gamma
);
const volScalarField& psi = psiModel->psi();
rho == max
(
psi*p
+ (1.0 - gamma)*rhol0
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
rhoMin
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "createPhiv.H"
# include "compressibleCreatePhi.H"

View File

@ -1,10 +0,0 @@
{
gamma = max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));
Info<< "max-min gamma: " << max(gamma).value()
<< " " << min(gamma).value() << endl;
psiModel->correct();
//Info<< "min a: " << 1.0/sqrt(max(psi)).value() << endl;
}

View File

@ -1,80 +0,0 @@
{
if (nOuterCorr == 1)
{
p =
(
rho
- (1.0 - gamma)*rhol0
- ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
)/psi;
}
surfaceScalarField rhof = fvc::interpolate(rho, "rhof");
volScalarField rUA = 1.0/UEqn.A();
surfaceScalarField rUAf("rUAf", rhof*fvc::interpolate(rUA));
volVectorField HbyA = rUA*UEqn.H();
phiv = (fvc::interpolate(HbyA) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phiv);
p.boundaryField().updateCoeffs();
surfaceScalarField phiGradp = rUAf*mesh.magSf()*fvc::snGrad(p);
phiv -= phiGradp/rhof;
# include "resetPhivPatches.H"
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
- (rhol0 + (psil - psiv)*pSat)*fvc::ddt(gamma) - pSat*fvc::ddt(psi)
+ fvc::div(phiv, rho)
+ fvc::div(phiGradp)
- fvm::laplacian(rUAf, p)
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phiv += (phiGradp + pEqn.flux())/rhof;
}
}
Info<< "max-min p: " << max(p).value()
<< " " << min(p).value() << endl;
U = HbyA - rUA*fvc::grad(p);
// Remove the swirl component of velocity for "wedge" cases
if (piso.found("removeSwirl"))
{
label swirlCmpt(readLabel(piso.lookup("removeSwirl")));
Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
U.field().replace(swirlCmpt, 0.0);
}
U.correctBoundaryConditions();
Info<< "max(U) " << max(mag(U)).value() << endl;
rho == max
(
psi*p
+ (1.0 - gamma)*rhol0
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
rhoMin
);
Info<< "max-min rho: " << max(rho).value()
<< " " << min(rho).value() << endl;
# include "gammaPsi.H"
}

View File

@ -1,9 +0,0 @@
#include "readTimeControls.H"
scalar maxAcousticCo
(
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
);
#include "readPISOControls.H"

View File

@ -1,27 +0,0 @@
Info<< "Reading thermodynamicProperties\n" << endl;
IOdictionary thermodynamicProperties
(
IOobject
(
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dimensionedScalar psil(thermodynamicProperties.lookup("psil"));
dimensionedScalar rholSat(thermodynamicProperties.lookup("rholSat"));
dimensionedScalar psiv(thermodynamicProperties.lookup("psiv"));
dimensionedScalar pSat(thermodynamicProperties.lookup("pSat"));
dimensionedScalar rhovSat("rhovSat", psiv*pSat);
dimensionedScalar rhol0("rhol0", rholSat - pSat*psil);
dimensionedScalar rhoMin(thermodynamicProperties.lookup("rhoMin"));

View File

@ -1,23 +0,0 @@
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dimensionedScalar mul
(
transportProperties.lookup("mul")
);
dimensionedScalar muv
(
transportProperties.lookup("muv")
);

View File

@ -1,15 +0,0 @@
fvsPatchScalarFieldField& phiPatches = phi.boundaryField();
const fvPatchScalarFieldField& rhoPatches = rho.boundaryField();
const fvPatchVectorFieldField& Upatches = U.boundaryField();
const fvsPatchVectorFieldField& SfPatches = mesh.Sf().boundaryField();
forAll(phiPatches, patchI)
{
if (phi.boundaryField().types()[patchI] == "calculated")
{
calculatedFvsPatchScalarField& phiPatch =
refCast<calculatedFvsPatchScalarField>(phiPatches[patchI]);
phiPatch == ((rhoPatches[patchI]*Upatches[patchI]) & SfPatches[patchI]);
}
}

View File

@ -1,14 +0,0 @@
surfaceScalarField::GeometricBoundaryField& phivPatches = phiv.boundaryField();
const volVectorField::GeometricBoundaryField& Upatches = U.boundaryField();
const surfaceVectorField::GeometricBoundaryField& SfPatches = mesh.Sf().boundaryField();
forAll(phivPatches, patchI)
{
if (phiv.boundaryField().types()[patchI] == "calculated")
{
calculatedFvsPatchScalarField& phivPatch =
refCast<calculatedFvsPatchScalarField>(phivPatches[patchI]);
phivPatch == (Upatches[patchI] & SfPatches[patchI]);
}
}

View File

@ -1,16 +0,0 @@
{
fvScalarMatrix rhoEqn
(
fvm::ddt(rho)
+ fvm::div(phiv, rho)
);
rhoEqn.solve();
phi = rhoEqn.flux();
Info<< "max-min rho: " << max(rho).value()
<< " " << min(rho).value() << endl;
rho == max(rho, rhoMin);
}

View File

@ -1,54 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Global
setDeltaT
Description
Reset the timestep to maintain a constant maximum courant Number.
Reduction of time-step is imediate but increase is damped to avoid
unstable oscillations.
\*---------------------------------------------------------------------------*/
if (adjustTimeStep)
{
scalar maxDeltaTFact =
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
runTime.setDeltaT
(
min
(
deltaTFact*runTime.deltaT().value(),
maxDeltaT
)
);
Info<< "deltaT = " << runTime.deltaT().value() << endl;
}
// ************************************************************************* //

View File

@ -1,54 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Global
setInitialDeltaT
Description
Set the initial timestep corresponding to the timestep adjustment
algorithm in setDeltaT
\*---------------------------------------------------------------------------*/
if (adjustTimeStep)
{
# include "CourantNo.H"
if (CoNum > SMALL)
{
scalar maxDeltaTFact =
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
runTime.setDeltaT
(
min
(
maxDeltaTFact*runTime.deltaT().value(),
maxDeltaT
)
);
}
}
// ************************************************************************* //

View File

@ -1,18 +1,17 @@
surfaceScalarField gammaf = fvc::interpolate(gamma);
surfaceScalarField muf
(
"muf",
gammaf*muv + (1.0 - gammaf)*mul
+ fvc::interpolate(rho*turbulence->nuSgs())
);
surfaceScalarField muEff
(
"muEff",
twoPhaseProperties.muf()
+ fvc::interpolate(rho*turbulence->nuSgs())
);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
- fvm::laplacian(muf, U)
- fvm::laplacian(muEff, U)
//- (fvc::grad(U) & fvc::grad(muf))
- fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
);
if (momentumPredictor)

View File

@ -1,12 +0,0 @@
Info << "Calculating averages" << endl;
scalar alpha =
(runTime.value() - timeToStartAveraging - runTime.deltaT().value())
/(runTime.value() - timeToStartAveraging);
scalar onemAlpha = 1.0 - alpha;
Umean == alpha*Umean + onemAlpha*U;
rhoMean == alpha*rhoMean + onemAlpha*rho;
pMean == alpha*pMean + onemAlpha*p;
gammaMean == alpha*gammaMean + onemAlpha*gamma;

View File

@ -1,53 +0,0 @@
scalar timeToStartAveraging = runTime.value();
volVectorField Umean
(
IOobject
(
"Umean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
U
);
volScalarField rhoMean
(
IOobject
(
"rhoMean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
rho
);
volScalarField pMean
(
IOobject
(
"pMean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p
);
volScalarField gammaMean
(
IOobject
(
"gammaMean",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gamma
);

View File

@ -44,10 +44,8 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createMesh.H"
# include "readThermodynamicProperties.H"
# include "readTransportProperties.H"
# include "readControls.H"
# include "createFields.H"
# include "createAverages.H"
# include "initContinuityErrs.H"
# include "compressibleCourantNo.H"
# include "setInitialDeltaT.H"
@ -79,8 +77,6 @@ int main(int argc, char *argv[])
}
}
# include "calculateAverages.H"
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -1,23 +0,0 @@
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dimensionedScalar mul
(
transportProperties.lookup("mul")
);
dimensionedScalar muv
(
transportProperties.lookup("muv")
);

View File

@ -1,14 +1,17 @@
surfaceScalarField muf =
twoPhaseProperties.muf()
+ fvc::interpolate(rho*turbulence->nuSgs());
surfaceScalarField muEff
(
"muEff",
twoPhaseProperties.muf()
+ fvc::interpolate(rho*turbulence->nuSgs())
);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::laplacian(muf, U)
- (fvc::grad(U) & fvc::grad(muf))
//- fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
- fvm::laplacian(muEff, U)
- (fvc::grad(U) & fvc::grad(muEff))
//- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
);
if (momentumPredictor)

View File

@ -1,18 +1,17 @@
surfaceScalarField gammaf = fvc::interpolate(gamma);
surfaceScalarField muf
(
"muf",
gammaf*muv + (1.0 - gammaf)*mul
+ fvc::interpolate(rho*turbulence->nuEff())
);
surfaceScalarField muEff
(
"muEff",
twoPhaseProperties.muf()
+ fvc::interpolate(rho*turbulence->nut())
);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
- fvm::laplacian(muf, U)
- fvm::laplacian(muEff, U)
//- (fvc::grad(U) & fvc::grad(muf))
- fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
);
if (momentumPredictor)

View File

@ -44,7 +44,6 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createMesh.H"
# include "readThermodynamicProperties.H"
# include "readTransportProperties.H"
# include "readControls.H"
# include "createFields.H"
# include "initContinuityErrs.H"

View File

@ -1,23 +0,0 @@
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dimensionedScalar mul
(
transportProperties.lookup("mul")
);
dimensionedScalar muv
(
transportProperties.lookup("muv")
);

View File

@ -1,14 +1,17 @@
surfaceScalarField muf =
twoPhaseProperties.muf()
+ fvc::interpolate(rho*turbulence->nut());
surfaceScalarField muEff
(
"muEff",
twoPhaseProperties.muf()
+ fvc::interpolate(rho*turbulence->nut())
);
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::laplacian(muf, U)
- (fvc::grad(U) & fvc::grad(muf))
//- fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
- fvm::laplacian(muEff, U)
- (fvc::grad(U) & fvc::grad(muEff))
//- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
);
if (momentumPredictor)

View File

@ -1,10 +1,10 @@
#!/bin/sh
set -x
( cd $FOAM_SRC/other && ./Allwmake )
( cd $FOAM_SRC/OpenFOAM && wmakeLnInclude . )
( cd $FOAM_SRC/other && ./Allwmake )
( cd Pstream && ./Allwmake )
wmake libo OSspecific/$WM_OS

View File

@ -3,3 +3,5 @@ set -x
wmake libo postCalc
wmake libso forces
wmake libso fieldAverage

View File

@ -1,9 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/OpenFOAM/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lOpenFOAM \
-lsampling

View File

@ -62,7 +62,7 @@ functions
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Fields to be probed. runTime modifiable!
// Fields to be averaged - runTime modifiable
fields
(
U

View File

@ -66,8 +66,8 @@ void Foam::fieldAverage::resetLists(const label nItems)
prime2MeanSymmTensorFields_.clear();
prime2MeanSymmTensorFields_.setSize(nItems);
nSteps_.clear();
nSteps_.setSize(nItems, 1);
totalIter_.clear();
totalIter_.setSize(nItems, 1);
totalTime_.clear();
totalTime_.setSize(nItems, obr_.time().deltaT().value());
@ -170,7 +170,7 @@ Foam::fieldAverage::fieldAverage
meanSphericalTensorFields_(faItems_.size()),
prime2MeanScalarFields_(faItems_.size()),
prime2MeanSymmTensorFields_(faItems_.size()),
nSteps_(faItems_.size(), 1),
totalIter_(faItems_.size(), 1),
totalTime_(faItems_.size(), obr_.time().deltaT().value())
{
// Check if the available mesh is an fvMesh otherise deactivate
@ -239,7 +239,7 @@ void Foam::fieldAverage::calcAverages()
Info<< "Calculating averages" << nl << endl;
forAll(faItems_, i)
{
nSteps_[i]++;
totalIter_[i]++;
totalTime_[i] += obr_.time().deltaT().value();
}
@ -287,7 +287,7 @@ void Foam::fieldAverage::writeAveragingProperties() const
{
const word fieldName = faItems_[i].fieldName();
propsDict.add(fieldName, dictionary());
propsDict.subDict(fieldName).add("nSteps", nSteps_[i]);
propsDict.subDict(fieldName).add("totalIter", totalIter_[i]);
propsDict.subDict(fieldName).add("totalTime", totalTime_[i]);
}
@ -317,7 +317,7 @@ void Foam::fieldAverage::readAveragingProperties()
{
dictionary fieldDict(propsDict.subDict(fieldName));
nSteps_[i] = readLabel(fieldDict.lookup("nSteps"));
totalIter_[i] = readLabel(fieldDict.lookup("totalIter"));
totalTime_[i] = readScalar(fieldDict.lookup("totalTime"));
}
}

View File

@ -29,19 +29,28 @@ Description
Calculates the field averages given list of fieldAverageItems, e.g.
@verbatim
fieldAverage1
{
// Type of functionObject
type fieldAverage;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Fields to be probed. runTime modifiable!
fields
(
U
{
mean on;
prime2Mean on;
base time; // ensemble
base time;
}
p
{
mean on;
prime2Mean on;
base time; // ensemble
base time;
}
);
@endverbatim
@ -133,8 +142,8 @@ protected:
// Counters
//- Integration steps counter
List<label> nSteps_;
//- Iteration steps counter
List<label> totalIter_;
//- Total time counter
List<scalar> totalTime_;

View File

@ -138,8 +138,8 @@ void Foam::fieldAverage::calculateMeanFields
}
else
{
alpha = scalar(nSteps_[i] - 1)/scalar(nSteps_[i]);
beta = 1.0/scalar(nSteps_[i]);
alpha = scalar(totalIter_[i] - 1)/scalar(totalIter_[i]);
beta = 1.0/scalar(totalIter_[i]);
}
meanField = alpha*meanField + beta*baseField;
@ -183,8 +183,8 @@ void Foam::fieldAverage::calculatePrime2MeanFields
}
else
{
alpha = scalar(nSteps_[i] - 1)/scalar(nSteps_[i]);
beta = 1.0/scalar(nSteps_[i]);
alpha = scalar(totalIter_[i] - 1)/scalar(totalIter_[i]);
beta = 1.0/scalar(totalIter_[i]);
}
prime2MeanField =
@ -196,6 +196,7 @@ void Foam::fieldAverage::calculatePrime2MeanFields
}
}
template<class Type1, class Type2>
void Foam::fieldAverage::addMeanSqrToPrime2Mean
(

View File

@ -31,7 +31,7 @@ License
template<>
const char* Foam::NamedEnum<Foam::fieldAverageItem::baseType, 2>::names[] =
{
"ensemble",
"iteration",
"time"
};
@ -46,7 +46,7 @@ Foam::fieldAverageItem::fieldAverageItem()
fieldName_("unknown"),
mean_(0),
prime2Mean_(0),
base_(ENSEMBLE)
base_(ITER)
{}

View File

@ -33,7 +33,7 @@ Description
{
mean on;
prime2Mean on;
base time; // ensemble
base time; // iteration
}
@endverbatim
@ -77,7 +77,7 @@ public:
//- Enumeration defining the averaging base type
enum baseType
{
ENSEMBLE,
ITER,
TIME
};
@ -158,10 +158,10 @@ public:
return baseTypeNames_[base_];
}
//- Return true if base is ensemble
Switch ensembleBase() const
//- Return true if base is ITER
Switch ITERBase() const
{
return base_ == ENSEMBLE;
return base_ == ITER;
}
//- Return true if base is time

View File

@ -52,5 +52,34 @@ timePrecision 6;
runTimeModifiable yes;
functions
(
fieldAverage1
{
// Type of functionObject
type fieldAverage;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Fields to be averaged - runTime modifiable
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
p
{
mean on;
prime2Mean on;
base time;
}
);
}
);
// ************************************************************************* //

View File

@ -52,5 +52,34 @@ timePrecision 6;
runTimeModifiable yes;
functions
(
fieldAverage1
{
// Type of functionObject
type fieldAverage;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Fields to be averaged - runTime modifiable
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
p
{
mean on;
prime2Mean on;
base time;
}
);
}
);
// ************************************************************************* //

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -52,5 +52,34 @@ timePrecision 6;
runTimeModifiable yes;
functions
(
fieldAverage1
{
// Type of functionObject
type fieldAverage;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Fields to be averaged - runTime modifiable
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
p
{
mean on;
prime2Mean on;
base time;
}
);
}
);
// ************************************************************************* //

View File

@ -52,5 +52,34 @@ timePrecision 6;
runTimeModifiable yes;
functions
(
fieldAverage1
{
// Type of functionObject
type fieldAverage;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Fields to be averaged - runTime modifiable
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
p
{
mean on;
prime2Mean on;
base time;
}
);
}
);
// ************************************************************************* //

View File

@ -80,6 +80,32 @@ functions
p
);
}
fieldAverage1
{
// Type of functionObject
type fieldAverage;
// Where to load it from (if not already in solver)
functionObjectLibs ("libfieldAverage.so");
// Fields to be averaged - runTime modifiable
fields
(
U
{
mean on;
prime2Mean on;
base time;
}
p
{
mean on;
prime2Mean on;
base time;
}
);
}
);
// ************************************************************************* //