Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
commit
3c5afbfcac
@ -55,8 +55,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< nl << "Starting time loop" << endl;
|
Info<< nl << "Starting time loop" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
|
@ -48,8 +48,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nCalculating temperature distribution\n" << endl;
|
Info<< "\nCalculating temperature distribution\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readSIMPLEControls.H"
|
# include "readSIMPLEControls.H"
|
||||||
|
@ -50,8 +50,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
# include "CourantNo.H"
|
# include "CourantNo.H"
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readSIMPLEControls.H"
|
# include "readSIMPLEControls.H"
|
||||||
|
@ -63,7 +63,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info << "\nStarting time loop\n" << endl;
|
Info << "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
while(runTime.run())
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
# include "compressibleCourantNo.H"
|
# include "compressibleCourantNo.H"
|
||||||
|
@ -51,8 +51,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readSIMPLEControls.H"
|
# include "readSIMPLEControls.H"
|
||||||
|
@ -49,8 +49,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
#include "readSIMPLEControls.H"
|
#include "readSIMPLEControls.H"
|
||||||
|
@ -47,8 +47,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
surfaceScalarField phiv
|
surfaceScalarField phiv
|
||||||
|
@ -53,8 +53,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.value() << nl << endl;
|
Info<< "Time = " << runTime.value() << nl << endl;
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
|
@ -52,8 +52,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
autoPtr<Foam::motionSolver> motionPtr = motionSolver::New(mesh);
|
autoPtr<Foam::motionSolver> motionPtr = motionSolver::New(mesh);
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
#include "readPISOControls.H"
|
#include "readPISOControls.H"
|
||||||
|
@ -49,8 +49,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
#include "readPISOControls.H"
|
#include "readPISOControls.H"
|
||||||
|
@ -50,8 +50,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
|
@ -47,8 +47,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting iteration loop\n" << endl;
|
Info<< "\nStarting iteration loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Iteration = " << runTime.timeName() << nl << endl;
|
Info<< "Iteration = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
solve
|
solve
|
||||||
|
@ -71,8 +71,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< nl << "Starting time loop" << endl;
|
Info<< nl << "Starting time loop" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
# include "readBPISOControls.H"
|
# include "readBPISOControls.H"
|
||||||
|
|
||||||
|
@ -55,8 +55,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "Starting time loop\n" << endl;
|
Info<< "Starting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
delta == fvc::grad(V)().component(Foam::vector::X);
|
delta == fvc::grad(V)().component(Foam::vector::X);
|
||||||
|
|
||||||
solve
|
solve
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
buoyantBoussinesqFoam.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/buoyantBoussinesqFoam
|
|
@ -0,0 +1,3 @@
|
|||||||
|
buoyantBoussinesqPisoFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/buoyantBoussinesqPisoFoam
|
@ -23,10 +23,10 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Application
|
Application
|
||||||
buoyantBoussinesqSimpleFoam
|
buoyantBoussinesqPisoFoam
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Steady-state solver for buoyant, turbulent flow of incompressible fluids
|
Transient solver for buoyant, turbulent flow of incompressible fluids
|
||||||
|
|
||||||
Uses the Boussinesq approximation:
|
Uses the Boussinesq approximation:
|
||||||
\f[
|
\f[
|
||||||
@ -69,8 +69,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readTimeControls.H"
|
# include "readTimeControls.H"
|
@ -66,8 +66,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readSIMPLEControls.H"
|
# include "readSIMPLEControls.H"
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
buoyantFoam.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/buoyantFoam
|
|
@ -0,0 +1,3 @@
|
|||||||
|
buoyantPisoFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/buoyantPisoFoam
|
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Application
|
Application
|
||||||
buoyantFoam
|
buoyantPisoFoam
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Transient Solver for buoyant, turbulent flow of compressible fluids for
|
Transient Solver for buoyant, turbulent flow of compressible fluids for
|
@ -51,8 +51,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readSIMPLEControls.H"
|
# include "readSIMPLEControls.H"
|
||||||
|
@ -54,8 +54,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readSIMPLEControls.H"
|
# include "readSIMPLEControls.H"
|
||||||
|
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
|||||||
# include "setInitialDeltaT.H"
|
# include "setInitialDeltaT.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
while(runTime.run())
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
# include "readTimeControls.H"
|
# include "readTimeControls.H"
|
||||||
|
|
||||||
|
@ -58,8 +58,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
fvVectorMatrix divR = turbulence->divDevReff(U);
|
fvVectorMatrix divR = turbulence->divDevReff(U);
|
||||||
|
@ -51,8 +51,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for(runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
#include "readPISOControls.H"
|
#include "readPISOControls.H"
|
||||||
|
@ -48,8 +48,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
|
@ -49,8 +49,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
|
@ -52,8 +52,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 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 maximum Courant Number.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
scalar CoNum = 0.0;
|
||||||
|
scalar meanCoNum = 0.0;
|
||||||
|
scalar waveCoNum = 0.0;
|
||||||
|
|
||||||
|
if (mesh.nInternalFaces())
|
||||||
|
{
|
||||||
|
surfaceScalarField SfUfbyDelta =
|
||||||
|
mesh.surfaceInterpolation::deltaCoeffs()
|
||||||
|
*mag(phi)/fvc::interpolate(h);
|
||||||
|
|
||||||
|
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||||
|
.value()*runTime.deltaT().value();
|
||||||
|
|
||||||
|
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||||
|
.value()*runTime.deltaT().value();
|
||||||
|
|
||||||
|
// Gravity wave Courant number
|
||||||
|
waveCoNum =
|
||||||
|
0.5*max
|
||||||
|
(
|
||||||
|
mesh.surfaceInterpolation::deltaCoeffs()
|
||||||
|
*sqrt(fvc::interpolate(h))
|
||||||
|
).value()*sqrt(magg).value()*runTime.deltaT().value();
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "Courant number mean: " << meanCoNum
|
||||||
|
<< " max: " << CoNum << endl;
|
||||||
|
|
||||||
|
Info<< "Gravity wave Courant number max: " << waveCoNum
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,3 @@
|
|||||||
|
shallowWaterFoam.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/shallowWaterFoam
|
@ -0,0 +1,74 @@
|
|||||||
|
Info<< "Reading field h\n" << endl;
|
||||||
|
volScalarField h
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"h",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reading field h0 if present\n" << endl;
|
||||||
|
volScalarField h0
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"h0",
|
||||||
|
runTime.findInstance("polyMesh", "points"),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("h0", dimLength, 0.0)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Reading field U\n" << endl;
|
||||||
|
volVectorField U
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"U",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Creating field hU\n" << endl;
|
||||||
|
volVectorField hU
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"hU",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
h*U,
|
||||||
|
U.boundaryField().types()
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Creating field hTotal for post processing\n" << endl;
|
||||||
|
volScalarField hTotal
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"hTotal",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
h+h0
|
||||||
|
);
|
||||||
|
hTotal.write();
|
||||||
|
|
||||||
|
# include "createPhi.H"
|
||||||
|
|
||||||
|
Info<< "Creating Coriolis Force" << endl;
|
||||||
|
const dimensionedVector F("F", ((2.0*Omega) & gHat)*gHat);
|
@ -0,0 +1,57 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 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
|
||||||
|
createPhi
|
||||||
|
|
||||||
|
Description
|
||||||
|
Creates and initialises the face-flux field phi.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef createPhi_H
|
||||||
|
#define createPhi_H
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "Reading/calculating face flux field phi\n" << endl;
|
||||||
|
|
||||||
|
surfaceScalarField phi
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"phi",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
linearInterpolate(hU) & mesh.Sf()
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -0,0 +1,21 @@
|
|||||||
|
Info<< "\nReading environmentalProperties" << endl;
|
||||||
|
|
||||||
|
IOdictionary environmentalProperties
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"environmentalProperties",
|
||||||
|
runTime.constant(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const dimensionedVector g(environmentalProperties.lookup("g"));
|
||||||
|
const Switch rotating(environmentalProperties.lookup("rotating"));
|
||||||
|
const dimensionedVector Omega =
|
||||||
|
rotating ? environmentalProperties.lookup("Omega")
|
||||||
|
: dimensionedVector("Omega", -dimTime, vector(0,0,0));
|
||||||
|
const dimensionedScalar magg = mag(g);
|
||||||
|
const dimensionedVector gHat = g/magg;
|
@ -0,0 +1,163 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 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
|
||||||
|
shallowWaterFoam
|
||||||
|
|
||||||
|
Description
|
||||||
|
Transient solver for inviscid shallow-water equations with rotation.
|
||||||
|
If the geometry is 3D then it is assumed to be one layers of cells and the
|
||||||
|
component of the velocity normal to gravity is removed.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
#include "readEnvironmentalProperties.H"
|
||||||
|
#include "createFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
while (runTime.loop())
|
||||||
|
{
|
||||||
|
Info<< "\n Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
#include "readPISOControls.H"
|
||||||
|
#include "CourantNo.H"
|
||||||
|
|
||||||
|
for (int ucorr=0; ucorr<nOuterCorr; ucorr++)
|
||||||
|
{
|
||||||
|
surfaceScalarField phiv("phiv", phi/fvc::interpolate(h));
|
||||||
|
|
||||||
|
fvVectorMatrix hUEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(hU)
|
||||||
|
+ fvm::div(phiv, hU)
|
||||||
|
);
|
||||||
|
|
||||||
|
hUEqn.relax();
|
||||||
|
|
||||||
|
if (momentumPredictor)
|
||||||
|
{
|
||||||
|
if (rotating)
|
||||||
|
{
|
||||||
|
solve(hUEqn + (F ^ hU) == -magg*h*fvc::grad(h + h0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
solve(hUEqn == -magg*h*fvc::grad(h + h0));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constrain the momentum to be in the geometry if 3D geometry
|
||||||
|
if (mesh.nGeometricD() == 3)
|
||||||
|
{
|
||||||
|
hU -= (gHat & hU)*gHat;
|
||||||
|
hU.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- PISO loop
|
||||||
|
for (int corr=0; corr<nCorr; corr++)
|
||||||
|
{
|
||||||
|
surfaceScalarField hf = fvc::interpolate(h);
|
||||||
|
volScalarField rUA = 1.0/hUEqn.A();
|
||||||
|
surfaceScalarField ghrUAf = magg*fvc::interpolate(h*rUA);
|
||||||
|
|
||||||
|
surfaceScalarField phih0 = ghrUAf*mesh.magSf()*fvc::snGrad(h0);
|
||||||
|
|
||||||
|
if (rotating)
|
||||||
|
{
|
||||||
|
hU = rUA*(hUEqn.H() - (F ^ hU));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hU = rUA*hUEqn.H();
|
||||||
|
}
|
||||||
|
|
||||||
|
phi = (fvc::interpolate(hU) & mesh.Sf())
|
||||||
|
+ fvc::ddtPhiCorr(rUA, h, hU, phi)
|
||||||
|
- phih0;
|
||||||
|
|
||||||
|
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||||
|
{
|
||||||
|
fvScalarMatrix hEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(h)
|
||||||
|
+ fvc::div(phi)
|
||||||
|
- fvm::laplacian(ghrUAf, h)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (ucorr < nOuterCorr-1 || corr < nCorr-1)
|
||||||
|
{
|
||||||
|
hEqn.solve();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hEqn.solve(mesh.solver(h.name() + "Final"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nonOrth == nNonOrthCorr)
|
||||||
|
{
|
||||||
|
phi += hEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hU -= rUA*h*magg*fvc::grad(h + h0);
|
||||||
|
|
||||||
|
// Constrain the momentum to be in the geometry if 3D geometry
|
||||||
|
if (mesh.nGeometricD() == 3)
|
||||||
|
{
|
||||||
|
hU -= (gHat & hU)*gHat;
|
||||||
|
}
|
||||||
|
|
||||||
|
hU.correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
U == hU/h;
|
||||||
|
hTotal == h + h0;
|
||||||
|
|
||||||
|
runTime.write();
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
@ -49,8 +49,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readSIMPLEControls.H"
|
# include "readSIMPLEControls.H"
|
||||||
|
@ -53,8 +53,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readBubbleFoamControls.H"
|
# include "readBubbleFoamControls.H"
|
||||||
|
@ -57,8 +57,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
|
@ -52,8 +52,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
|
@ -57,8 +57,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nCalculating displacement field\n" << endl;
|
Info<< "\nCalculating displacement field\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Iteration: " << runTime.value() << nl << endl;
|
Info<< "Iteration: " << runTime.value() << nl << endl;
|
||||||
|
|
||||||
# include "readSolidDisplacementFoamControls.H"
|
# include "readSolidDisplacementFoamControls.H"
|
||||||
|
@ -55,8 +55,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nCalculating displacement field\n" << endl;
|
Info<< "\nCalculating displacement field\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Iteration: " << runTime.value() << nl << endl;
|
Info<< "Iteration: " << runTime.value() << nl << endl;
|
||||||
|
|
||||||
# include "readSteadyStressFoamControls.H"
|
# include "readSteadyStressFoamControls.H"
|
||||||
|
@ -53,8 +53,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
# include "readPISOControls.H"
|
# include "readPISOControls.H"
|
||||||
|
@ -120,8 +120,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << endl;
|
Info<< "Time = " << runTime.timeName() << endl;
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,8 +46,9 @@ int main(int argc, char *argv[])
|
|||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
# include "createDynamicFvMesh.H"
|
# include "createDynamicFvMesh.H"
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << endl;
|
Info<< "Time = " << runTime.timeName() << endl;
|
||||||
|
|
||||||
mesh.update();
|
mesh.update();
|
||||||
|
@ -47,8 +47,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "\nStarting time loop\n" << endl;
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.theta() << " CA-deg\n" << endl;
|
Info<< "Time = " << runTime.theta() << " CA-deg\n" << endl;
|
||||||
|
|
||||||
mesh.move();
|
mesh.move();
|
||||||
|
@ -46,8 +46,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
autoPtr<Foam::motionSolver> motionPtr = motionSolver::New(mesh);
|
autoPtr<Foam::motionSolver> motionPtr = motionSolver::New(mesh);
|
||||||
|
|
||||||
for (runTime++; !runTime.end(); runTime++)
|
while (runTime.run())
|
||||||
{
|
{
|
||||||
|
runTime++;
|
||||||
Info<< "Time = " << runTime.timeName() << endl;
|
Info<< "Time = " << runTime.timeName() << endl;
|
||||||
|
|
||||||
mesh.movePoints(motionPtr->newPoints());
|
mesh.movePoints(motionPtr->newPoints());
|
||||||
|
@ -74,7 +74,7 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
functionObjectList fol(runTime, runTime.controlDict());
|
functionObjectList fol(runTime);
|
||||||
fol.start();
|
fol.start();
|
||||||
fol.execute();
|
fol.execute();
|
||||||
}
|
}
|
||||||
|
@ -144,11 +144,14 @@ $(regIOobject)/regIOobjectWrite.C
|
|||||||
|
|
||||||
db/IOobjectList/IOobjectList.C
|
db/IOobjectList/IOobjectList.C
|
||||||
db/objectRegistry/objectRegistry.C
|
db/objectRegistry/objectRegistry.C
|
||||||
db/functionObject/functionObject.C
|
|
||||||
db/functionObjectList/functionObjectList.C
|
|
||||||
db/CallbackRegistry/CallbackRegistryName.C
|
db/CallbackRegistry/CallbackRegistryName.C
|
||||||
db/dlLibraryTable/dlLibraryTable.C
|
db/dlLibraryTable/dlLibraryTable.C
|
||||||
|
|
||||||
|
db/functionObjects/functionObject/functionObject.C
|
||||||
|
db/functionObjects/functionObjectList/functionObjectList.C
|
||||||
|
db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C
|
||||||
|
|
||||||
|
|
||||||
Time = db/Time
|
Time = db/Time
|
||||||
$(Time)/TimePaths.C
|
$(Time)/TimePaths.C
|
||||||
$(Time)/TimeState.C
|
$(Time)/TimeState.C
|
||||||
|
@ -352,25 +352,27 @@ Foam::Time::Time
|
|||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Time::~Time()
|
Foam::Time::~Time()
|
||||||
{}
|
{
|
||||||
|
// destroy function objects first
|
||||||
|
functionObjects_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::word Foam::Time::timeName(const scalar t)
|
Foam::word Foam::Time::timeName(const scalar t)
|
||||||
{
|
{
|
||||||
std::ostringstream osBuffer;
|
std::ostringstream buf;
|
||||||
osBuffer.setf(ios_base::fmtflags(format_), ios_base::floatfield);
|
buf.setf(ios_base::fmtflags(format_), ios_base::floatfield);
|
||||||
osBuffer.precision(precision_);
|
buf.precision(precision_);
|
||||||
osBuffer << t;
|
buf << t;
|
||||||
return osBuffer.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::word Foam::Time::timeName() const
|
Foam::word Foam::Time::timeName() const
|
||||||
{
|
{
|
||||||
return dimensionedScalar::name();
|
return dimensionedScalar::name();
|
||||||
//return timeName(timeOutputValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -432,7 +434,7 @@ Foam::instant Foam::Time::findClosestTime(const scalar t) const
|
|||||||
return times[nearestIndex];
|
return times[nearestIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// This should work too,
|
// This should work too,
|
||||||
// if we don't worry about checking "constant" explicitly
|
// if we don't worry about checking "constant" explicitly
|
||||||
//
|
//
|
||||||
@ -490,9 +492,28 @@ bool Foam::Time::run() const
|
|||||||
{
|
{
|
||||||
bool running = value() < (endTime_ - 0.5*deltaT_);
|
bool running = value() < (endTime_ - 0.5*deltaT_);
|
||||||
|
|
||||||
if (!subCycling_ && !running && timeIndex_ != startTimeIndex_)
|
if (!subCycling_)
|
||||||
{
|
{
|
||||||
const_cast<functionObjectList&>(functionObjects_).execute();
|
// only execute when the condition is no longer true
|
||||||
|
// ie, when exiting the control loop
|
||||||
|
if (!running && timeIndex_ != startTimeIndex_)
|
||||||
|
{
|
||||||
|
// Note, end() also calls an indirect start() as required
|
||||||
|
functionObjects_.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return running;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::Time::loop()
|
||||||
|
{
|
||||||
|
bool running = run();
|
||||||
|
|
||||||
|
if (running)
|
||||||
|
{
|
||||||
|
operator++();
|
||||||
}
|
}
|
||||||
|
|
||||||
return running;
|
return running;
|
||||||
@ -501,7 +522,7 @@ bool Foam::Time::run() const
|
|||||||
|
|
||||||
bool Foam::Time::end() const
|
bool Foam::Time::end() const
|
||||||
{
|
{
|
||||||
return (value() > (endTime_ + 0.5*deltaT_));
|
return value() > (endTime_ + 0.5*deltaT_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -611,9 +632,7 @@ Foam::Time& Foam::Time::operator+=(const dimensionedScalar& deltaT)
|
|||||||
Foam::Time& Foam::Time::operator+=(const scalar deltaT)
|
Foam::Time& Foam::Time::operator+=(const scalar deltaT)
|
||||||
{
|
{
|
||||||
setDeltaT(deltaT);
|
setDeltaT(deltaT);
|
||||||
operator++();
|
return operator++();
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -643,22 +662,22 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
setTime(0.0, timeIndex_);
|
setTime(0.0, timeIndex_);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(writeControl_)
|
switch (writeControl_)
|
||||||
{
|
{
|
||||||
case wcTimeStep:
|
case wcTimeStep:
|
||||||
outputTime_ = !(timeIndex_%label(writeInterval_));
|
outputTime_ = !(timeIndex_ % label(writeInterval_));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wcRunTime:
|
case wcRunTime:
|
||||||
case wcAdjustableRunTime:
|
case wcAdjustableRunTime:
|
||||||
{
|
{
|
||||||
label outputTimeIndex =
|
label outputIndex =
|
||||||
label(((value() - startTime_) + 0.5*deltaT_)/writeInterval_);
|
label(((value() - startTime_) + 0.5*deltaT_)/writeInterval_);
|
||||||
|
|
||||||
if (outputTimeIndex > outputTimeIndex_)
|
if (outputIndex > outputTimeIndex_)
|
||||||
{
|
{
|
||||||
outputTime_ = true;
|
outputTime_ = true;
|
||||||
outputTimeIndex_ = outputTimeIndex;
|
outputTimeIndex_ = outputIndex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -669,13 +688,11 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
|
|
||||||
case wcCpuTime:
|
case wcCpuTime:
|
||||||
{
|
{
|
||||||
label outputTimeIndex =
|
label outputIndex = label(elapsedCpuTime()/writeInterval_);
|
||||||
label(elapsedCpuTime()/writeInterval_);
|
if (outputIndex > outputTimeIndex_)
|
||||||
|
|
||||||
if (outputTimeIndex > outputTimeIndex_)
|
|
||||||
{
|
{
|
||||||
outputTime_ = true;
|
outputTime_ = true;
|
||||||
outputTimeIndex_ = outputTimeIndex;
|
outputTimeIndex_ = outputIndex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -686,11 +703,11 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
|
|
||||||
case wcClockTime:
|
case wcClockTime:
|
||||||
{
|
{
|
||||||
label outputTimeIndex = label(elapsedClockTime()/writeInterval_);
|
label outputIndex = label(elapsedClockTime()/writeInterval_);
|
||||||
if (outputTimeIndex > outputTimeIndex_)
|
if (outputIndex > outputTimeIndex_)
|
||||||
{
|
{
|
||||||
outputTime_ = true;
|
outputTime_ = true;
|
||||||
outputTimeIndex_ = outputTimeIndex;
|
outputTimeIndex_ = outputIndex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -698,8 +715,9 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
// see if endTime needs adjustment to stop at the next run()/end() check
|
||||||
if (!end())
|
if (!end())
|
||||||
{
|
{
|
||||||
if (stopAt_ == saNoWriteNow)
|
if (stopAt_ == saNoWriteNow)
|
||||||
|
@ -26,7 +26,7 @@ Class
|
|||||||
Foam::Time
|
Foam::Time
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Class to control time during FOAM simulations which is also the
|
Class to control time during OpenFOAM simulations that is also the
|
||||||
top-level objectRegistry.
|
top-level objectRegistry.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -124,7 +124,7 @@ protected:
|
|||||||
label purgeWrite_;
|
label purgeWrite_;
|
||||||
mutable FIFOStack<word> previousOutputTimes_;
|
mutable FIFOStack<word> previousOutputTimes_;
|
||||||
|
|
||||||
//- Is the time currently being sub-cycled
|
//- Is the time currently being sub-cycled?
|
||||||
bool subCycling_;
|
bool subCycling_;
|
||||||
|
|
||||||
//- Time directory name format
|
//- Time directory name format
|
||||||
@ -157,21 +157,21 @@ private:
|
|||||||
//- Default graph format
|
//- Default graph format
|
||||||
word graphFormat_;
|
word graphFormat_;
|
||||||
|
|
||||||
//- Is runtim modification of dictionaries allowed
|
//- Is runtime modification of dictionaries allowed?
|
||||||
Switch runTimeModifiable_;
|
Switch runTimeModifiable_;
|
||||||
|
|
||||||
//- Instantiate a dummy class to cause the reading of dynamic libraries
|
//- Instantiate a dummy class to cause the reading of dynamic libraries
|
||||||
dlLibraryTable::readDlLibrary readLibs_;
|
dlLibraryTable::readDlLibrary readLibs_;
|
||||||
|
|
||||||
//- Function objects executed at start and on ++, +=
|
//- Function objects executed at start and on ++, +=
|
||||||
functionObjectList functionObjects_;
|
mutable functionObjectList functionObjects_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TypeName("time");
|
TypeName("time");
|
||||||
|
|
||||||
//- The default control dictionary name
|
//- The default control dictionary name (normally "controlDict")
|
||||||
static word controlDictName;
|
static word controlDictName;
|
||||||
|
|
||||||
|
|
||||||
@ -282,8 +282,8 @@ public:
|
|||||||
void readModifiedObjects();
|
void readModifiedObjects();
|
||||||
|
|
||||||
//- Return the location of "dir" containing the file "name".
|
//- Return the location of "dir" containing the file "name".
|
||||||
// (Used in reading mesh data)
|
// (eg, used in reading mesh data)
|
||||||
// If name is null search for the directory "dir" only
|
// If name is null, search for the directory "dir" only
|
||||||
word findInstance
|
word findInstance
|
||||||
(
|
(
|
||||||
const fileName& dir,
|
const fileName& dir,
|
||||||
@ -291,7 +291,7 @@ public:
|
|||||||
const IOobject::readOption rOpt = IOobject::MUST_READ
|
const IOobject::readOption rOpt = IOobject::MUST_READ
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Search tha case for valid time directories
|
//- Search the case for valid time directories
|
||||||
instantList times() const;
|
instantList times() const;
|
||||||
|
|
||||||
//- Search the case for the time directory path
|
//- Search the case for the time directory path
|
||||||
@ -307,9 +307,9 @@ public:
|
|||||||
//- Write using given format, version and compression
|
//- Write using given format, version and compression
|
||||||
virtual bool writeObject
|
virtual bool writeObject
|
||||||
(
|
(
|
||||||
IOstream::streamFormat fmt,
|
IOstream::streamFormat,
|
||||||
IOstream::versionNumber ver,
|
IOstream::versionNumber,
|
||||||
IOstream::compressionType cmp
|
IOstream::compressionType
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Write the objects now and continue the run
|
//- Write the objects now and continue the run
|
||||||
@ -348,10 +348,43 @@ public:
|
|||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|
||||||
//- Return true if run should continue
|
//- Return true if run should continue,
|
||||||
|
// also invokes the functionObjectList::end() method
|
||||||
|
// when the time goes out of range
|
||||||
|
// @note
|
||||||
|
// For correct behaviour, the following style of time-loop
|
||||||
|
// is recommended:
|
||||||
|
// @code
|
||||||
|
// while (runTime.run())
|
||||||
|
// {
|
||||||
|
// runTime++;
|
||||||
|
// solve;
|
||||||
|
// runTime.write();
|
||||||
|
// }
|
||||||
|
// @endcode
|
||||||
virtual bool run() const;
|
virtual bool run() const;
|
||||||
|
|
||||||
//- Return true if end of run
|
//- Return true if run should continue and if so increment time
|
||||||
|
// also invokes the functionObjectList::end() method
|
||||||
|
// when the time goes out of range
|
||||||
|
// @note
|
||||||
|
// For correct behaviour, the following style of time-loop
|
||||||
|
// is recommended:
|
||||||
|
// @code
|
||||||
|
// while (runTime.loop())
|
||||||
|
// {
|
||||||
|
// solve;
|
||||||
|
// runTime.write();
|
||||||
|
// }
|
||||||
|
// @endcode
|
||||||
|
virtual bool loop();
|
||||||
|
|
||||||
|
//- Return true if end of run,
|
||||||
|
// does not invoke any functionObject methods
|
||||||
|
// @note
|
||||||
|
// The rounding heuristics near endTime mean that
|
||||||
|
// @code run() @endcode and @code !end() @endcode may
|
||||||
|
// not yield the same result
|
||||||
virtual bool end() const;
|
virtual bool end() const;
|
||||||
|
|
||||||
|
|
||||||
@ -400,16 +433,18 @@ public:
|
|||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
//- Set deltaT to that specified and increment time
|
//- Set deltaT to that specified and increment time via operator++()
|
||||||
virtual Time& operator+=(const dimensionedScalar&);
|
virtual Time& operator+=(const dimensionedScalar&);
|
||||||
|
|
||||||
//- Set deltaT to that specified and increment time
|
//- Set deltaT to that specified and increment time via operator++()
|
||||||
virtual Time& operator+=(const scalar);
|
virtual Time& operator+=(const scalar);
|
||||||
|
|
||||||
//- Prefix increment
|
//- Prefix increment,
|
||||||
|
// also invokes the functionObjectList::start() or
|
||||||
|
// functionObjectList::execute() method, depending on the time-index
|
||||||
virtual Time& operator++();
|
virtual Time& operator++();
|
||||||
|
|
||||||
//- Postfix increment
|
//- Postfix increment, this is identical to the prefix increment
|
||||||
virtual Time& operator++(int);
|
virtual Time& operator++(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ void Foam::Time::readDict()
|
|||||||
|
|
||||||
if (oldWriteInterval != writeInterval_)
|
if (oldWriteInterval != writeInterval_)
|
||||||
{
|
{
|
||||||
switch(writeControl_)
|
switch (writeControl_)
|
||||||
{
|
{
|
||||||
case wcRunTime:
|
case wcRunTime:
|
||||||
case wcAdjustableRunTime:
|
case wcAdjustableRunTime:
|
||||||
@ -180,11 +180,7 @@ void Foam::Time::readDict()
|
|||||||
}
|
}
|
||||||
|
|
||||||
controlDict_.readIfPresent("graphFormat", graphFormat_);
|
controlDict_.readIfPresent("graphFormat", graphFormat_);
|
||||||
|
controlDict_.readIfPresent("runTimeModifiable", runTimeModifiable_);
|
||||||
if (controlDict_.found("runTimeModifiable"))
|
|
||||||
{
|
|
||||||
runTimeModifiable_ = Switch(controlDict_.lookup("runTimeModifiable"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -268,25 +264,14 @@ bool Foam::Time::writeObject
|
|||||||
timeDict.add("deltaT", deltaT_);
|
timeDict.add("deltaT", deltaT_);
|
||||||
timeDict.add("deltaT0", deltaT0_);
|
timeDict.add("deltaT0", deltaT0_);
|
||||||
|
|
||||||
timeDict.regIOobject::writeObject
|
timeDict.regIOobject::writeObject(fmt, ver, cmp);
|
||||||
(
|
bool writeOK = objectRegistry::writeObject(fmt, ver, cmp);
|
||||||
fmt,
|
|
||||||
ver,
|
|
||||||
cmp
|
|
||||||
);
|
|
||||||
|
|
||||||
bool writeOK = objectRegistry::writeObject
|
|
||||||
(
|
|
||||||
fmt,
|
|
||||||
ver,
|
|
||||||
cmp
|
|
||||||
);
|
|
||||||
|
|
||||||
if (writeOK && purgeWrite_)
|
if (writeOK && purgeWrite_)
|
||||||
{
|
{
|
||||||
previousOutputTimes_.push(timeName());
|
previousOutputTimes_.push(timeName());
|
||||||
|
|
||||||
while(previousOutputTimes_.size() > purgeWrite_)
|
while (previousOutputTimes_.size() > purgeWrite_)
|
||||||
{
|
{
|
||||||
rmDir(objectRegistry::path(previousOutputTimes_.pop()));
|
rmDir(objectRegistry::path(previousOutputTimes_.pop()));
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class subCycleTimeTime Declaration
|
Class subCycleTime Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class subCycleTime
|
class subCycleTime
|
||||||
@ -62,7 +62,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from original time and number of sub-cycles
|
//- Construct from original time and number of sub-cycles
|
||||||
subCycleTime(Time& t, const label nSubCycles);
|
subCycleTime(Time&, const label nSubCycles);
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
@ -72,6 +72,7 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
|
//- Return true if the number of sub-cycles has been reached
|
||||||
bool end() const;
|
bool end() const;
|
||||||
|
|
||||||
//- End the sub-cycling and reset the time-state
|
//- End the sub-cycling and reset the time-state
|
||||||
|
@ -65,6 +65,20 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class OutputFilter>
|
||||||
|
void Foam::OutputFilterFunctionObject<OutputFilter>::on()
|
||||||
|
{
|
||||||
|
enabled_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class OutputFilter>
|
||||||
|
void Foam::OutputFilterFunctionObject<OutputFilter>::off()
|
||||||
|
{
|
||||||
|
enabled_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
template<class OutputFilter>
|
||||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
|
bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
|
||||||
{
|
{
|
||||||
@ -120,16 +134,19 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute()
|
|||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
template<class OutputFilter>
|
||||||
void Foam::OutputFilterFunctionObject<OutputFilter>::on()
|
bool Foam::OutputFilterFunctionObject<OutputFilter>::end()
|
||||||
{
|
{
|
||||||
enabled_ = true;
|
if (enabled_)
|
||||||
}
|
{
|
||||||
|
ptr_->end();
|
||||||
|
|
||||||
|
if (enabled_ && outputControl_.output())
|
||||||
|
{
|
||||||
|
ptr_->write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<class OutputFilter>
|
return true;
|
||||||
void Foam::OutputFilterFunctionObject<OutputFilter>::off()
|
|
||||||
{
|
|
||||||
enabled_ = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ class OutputFilterFunctionObject
|
|||||||
word regionName_;
|
word regionName_;
|
||||||
word dictName_;
|
word dictName_;
|
||||||
|
|
||||||
//- Switch for the execution of the functionObjects
|
//- Switch for the execution of the functionObject
|
||||||
bool enabled_;
|
bool enabled_;
|
||||||
|
|
||||||
outputFilterOutputControl outputControl_;
|
outputFilterOutputControl outputControl_;
|
||||||
@ -114,20 +114,25 @@ public:
|
|||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- start is called at the start of the time-loop
|
|
||||||
virtual bool start();
|
|
||||||
|
|
||||||
//- execute is called at each ++ or += of the time-loop
|
|
||||||
virtual bool execute();
|
|
||||||
|
|
||||||
//- Switch the function object on
|
//- Switch the function object on
|
||||||
virtual void on();
|
virtual void on();
|
||||||
|
|
||||||
//- Switch the function object off
|
//- Switch the function object off
|
||||||
virtual void off();
|
virtual void off();
|
||||||
|
|
||||||
//- Read and set the function object if its data has changed
|
|
||||||
virtual bool read(const dictionary& dict);
|
//- Called at the start of the time-loop
|
||||||
|
virtual bool start();
|
||||||
|
|
||||||
|
//- Called at each ++ or += of the time-loop
|
||||||
|
virtual bool execute();
|
||||||
|
|
||||||
|
//- Called when Time::run() determines that the time-loop exits
|
||||||
|
virtual bool end();
|
||||||
|
|
||||||
|
|
||||||
|
//- Read and set the function object if its data have changed
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -30,11 +30,8 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
defineRunTimeSelectionTable(Foam::functionObject, dictionary);
|
||||||
{
|
int Foam::functionObject::debug(Foam::debug::debugSwitch("functionObject", 0));
|
||||||
defineRunTimeSelectionTable(functionObject, dictionary);
|
|
||||||
int functionObject::debug(::Foam::debug::debugSwitch("functionObject", 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -71,10 +68,10 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
|||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"functionObject::New"
|
"functionObject::New"
|
||||||
"(const word& functionType, const Time&, const dictionary&)"
|
"(const word& name, const Time&, const dictionary&)"
|
||||||
) << "Unknown function type "
|
) << "Unknown function type "
|
||||||
<< functionType << endl << endl
|
<< functionType << nl << nl
|
||||||
<< "Table of functionObjects is empty"
|
<< "Table of functionObjects is empty" << endl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,11 +83,11 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
|||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"functionObject::New"
|
"functionObject::New"
|
||||||
"(const word& functionType, const Time&, const dictionary&)"
|
"(const word& name, const Time&, const dictionary&)"
|
||||||
) << "Unknown function type "
|
) << "Unknown function type "
|
||||||
<< functionType << endl << endl
|
<< functionType << nl << nl
|
||||||
<< "Valid functions are : " << endl
|
<< "Valid functions are : " << nl
|
||||||
<< dictionaryConstructorTablePtr_->toc()
|
<< dictionaryConstructorTablePtr_->toc() << endl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +103,12 @@ Foam::functionObject::~functionObject()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::functionObject::end()
|
||||||
|
{
|
||||||
|
return execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::autoPtr<Foam::functionObject> Foam::functionObject::iNew::operator()
|
Foam::autoPtr<Foam::functionObject> Foam::functionObject::iNew::operator()
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
@ -121,7 +121,7 @@ public:
|
|||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Select from Time and Istream
|
//- Select from dictionary, based on its "type" entry
|
||||||
static autoPtr<functionObject> New
|
static autoPtr<functionObject> New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
@ -137,14 +137,18 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- start is called at the start of the time-loop
|
//- Called at the start of the time-loop
|
||||||
virtual bool start() = 0;
|
virtual bool start() = 0;
|
||||||
|
|
||||||
//- execute is called at each ++ or += of the time-loop
|
//- Called at each ++ or += of the time-loop
|
||||||
virtual bool execute() = 0;
|
virtual bool execute() = 0;
|
||||||
|
|
||||||
//- Read and set the function object if its data has changed
|
//- Called when Time::run() determines that the time-loop exits.
|
||||||
virtual bool read(const dictionary& dict) = 0;
|
// By default it simply calls execute().
|
||||||
|
virtual bool end();
|
||||||
|
|
||||||
|
//- Read and set the function object if its data have changed
|
||||||
|
virtual bool read(const dictionary&) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -29,7 +29,8 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObject* Foam::functionObjectList::remove(const word& key)
|
Foam::functionObject*
|
||||||
|
Foam::functionObjectList::remove(const word& key, label& oldIndex)
|
||||||
{
|
{
|
||||||
functionObject* ptr = 0;
|
functionObject* ptr = 0;
|
||||||
|
|
||||||
@ -38,10 +39,16 @@ Foam::functionObject* Foam::functionObjectList::remove(const word& key)
|
|||||||
|
|
||||||
if (fnd != indices_.end())
|
if (fnd != indices_.end())
|
||||||
{
|
{
|
||||||
// remove the pointer from the old list
|
oldIndex = fnd();
|
||||||
ptr = functions_.set(fnd(), 0).ptr();
|
|
||||||
|
// retrieve the pointer and remove it from the old list
|
||||||
|
ptr = this->set(oldIndex, 0).ptr();
|
||||||
indices_.erase(fnd);
|
indices_.erase(fnd);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oldIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
@ -55,7 +62,8 @@ Foam::functionObjectList::functionObjectList
|
|||||||
const bool execution
|
const bool execution
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functions_(),
|
PtrList<functionObject>(),
|
||||||
|
digests_(),
|
||||||
indices_(),
|
indices_(),
|
||||||
time_(t),
|
time_(t),
|
||||||
parentDict_(t.controlDict()),
|
parentDict_(t.controlDict()),
|
||||||
@ -71,7 +79,8 @@ Foam::functionObjectList::functionObjectList
|
|||||||
const bool execution
|
const bool execution
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functions_(),
|
PtrList<functionObject>(),
|
||||||
|
digests_(),
|
||||||
indices_(),
|
indices_(),
|
||||||
time_(t),
|
time_(t),
|
||||||
parentDict_(parentDict),
|
parentDict_(parentDict),
|
||||||
@ -88,6 +97,34 @@ Foam::functionObjectList::~functionObjectList()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::functionObjectList::clear()
|
||||||
|
{
|
||||||
|
PtrList<functionObject>::clear();
|
||||||
|
digests_.clear();
|
||||||
|
indices_.clear();
|
||||||
|
updated_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjectList::on()
|
||||||
|
{
|
||||||
|
execution_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjectList::off()
|
||||||
|
{
|
||||||
|
// for safety, also force a read() when execution is turned back on
|
||||||
|
updated_ = execution_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjectList::status() const
|
||||||
|
{
|
||||||
|
return execution_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjectList::start()
|
bool Foam::functionObjectList::start()
|
||||||
{
|
{
|
||||||
return read();
|
return read();
|
||||||
@ -105,7 +142,12 @@ bool Foam::functionObjectList::execute()
|
|||||||
read();
|
read();
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllIter(PtrList<functionObject>, functions_, iter)
|
forAllIter
|
||||||
|
(
|
||||||
|
PtrList<functionObject>,
|
||||||
|
static_cast<PtrList<functionObject>&>(*this),
|
||||||
|
iter
|
||||||
|
)
|
||||||
{
|
{
|
||||||
ok = iter().execute() && ok;
|
ok = iter().execute() && ok;
|
||||||
}
|
}
|
||||||
@ -115,15 +157,29 @@ bool Foam::functionObjectList::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectList::on()
|
bool Foam::functionObjectList::end()
|
||||||
{
|
{
|
||||||
execution_ = true;
|
bool ok = true;
|
||||||
}
|
|
||||||
|
|
||||||
|
if (execution_)
|
||||||
|
{
|
||||||
|
if (!updated_)
|
||||||
|
{
|
||||||
|
read();
|
||||||
|
}
|
||||||
|
|
||||||
void Foam::functionObjectList::off()
|
forAllIter
|
||||||
{
|
(
|
||||||
execution_ = false;
|
PtrList<functionObject>,
|
||||||
|
static_cast<PtrList<functionObject>&>(*this),
|
||||||
|
iter
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ok = iter().end() && ok;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -143,6 +199,7 @@ bool Foam::functionObjectList::read()
|
|||||||
if (entryPtr)
|
if (entryPtr)
|
||||||
{
|
{
|
||||||
PtrList<functionObject> newPtrs;
|
PtrList<functionObject> newPtrs;
|
||||||
|
List<SHA1Digest> newDigs;
|
||||||
HashTable<label> newIndices;
|
HashTable<label> newIndices;
|
||||||
|
|
||||||
label nFunc = 0;
|
label nFunc = 0;
|
||||||
@ -151,7 +208,9 @@ bool Foam::functionObjectList::read()
|
|||||||
{
|
{
|
||||||
// a dictionary of functionObjects
|
// a dictionary of functionObjects
|
||||||
const dictionary& functionDicts = entryPtr->dict();
|
const dictionary& functionDicts = entryPtr->dict();
|
||||||
|
|
||||||
newPtrs.setSize(functionDicts.size());
|
newPtrs.setSize(functionDicts.size());
|
||||||
|
newDigs.setSize(functionDicts.size());
|
||||||
|
|
||||||
forAllConstIter(dictionary, functionDicts, iter)
|
forAllConstIter(dictionary, functionDicts, iter)
|
||||||
{
|
{
|
||||||
@ -163,12 +222,18 @@ bool Foam::functionObjectList::read()
|
|||||||
const word& key = iter().keyword();
|
const word& key = iter().keyword();
|
||||||
const dictionary& dict = iter().dict();
|
const dictionary& dict = iter().dict();
|
||||||
|
|
||||||
functionObject* objPtr = remove(key);
|
newDigs[nFunc] = dict.digest();
|
||||||
|
|
||||||
|
label oldIndex;
|
||||||
|
functionObject* objPtr = remove(key, oldIndex);
|
||||||
if (objPtr)
|
if (objPtr)
|
||||||
{
|
{
|
||||||
// existing functionObject
|
// an existing functionObject, and dictionary changed
|
||||||
|
if (newDigs[nFunc] != digests_[oldIndex])
|
||||||
|
{
|
||||||
ok = objPtr->read(dict) && ok;
|
ok = objPtr->read(dict) && ok;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// new functionObject
|
// new functionObject
|
||||||
@ -185,7 +250,9 @@ bool Foam::functionObjectList::read()
|
|||||||
{
|
{
|
||||||
// a list of functionObjects
|
// a list of functionObjects
|
||||||
PtrList<entry> functionDicts(entryPtr->stream());
|
PtrList<entry> functionDicts(entryPtr->stream());
|
||||||
|
|
||||||
newPtrs.setSize(functionDicts.size());
|
newPtrs.setSize(functionDicts.size());
|
||||||
|
newDigs.setSize(functionDicts.size());
|
||||||
|
|
||||||
forAllIter(PtrList<entry>, functionDicts, iter)
|
forAllIter(PtrList<entry>, functionDicts, iter)
|
||||||
{
|
{
|
||||||
@ -197,12 +264,18 @@ bool Foam::functionObjectList::read()
|
|||||||
const word& key = iter().keyword();
|
const word& key = iter().keyword();
|
||||||
const dictionary& dict = iter().dict();
|
const dictionary& dict = iter().dict();
|
||||||
|
|
||||||
functionObject* objPtr = remove(key);
|
newDigs[nFunc] = dict.digest();
|
||||||
|
|
||||||
|
label oldIndex;
|
||||||
|
functionObject* objPtr = remove(key, oldIndex);
|
||||||
if (objPtr)
|
if (objPtr)
|
||||||
{
|
{
|
||||||
// existing functionObject
|
// an existing functionObject, and dictionary changed
|
||||||
|
if (newDigs[nFunc] != digests_[oldIndex])
|
||||||
|
{
|
||||||
ok = objPtr->read(dict) && ok;
|
ok = objPtr->read(dict) && ok;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// new functionObject
|
// new functionObject
|
||||||
@ -218,15 +291,18 @@ bool Foam::functionObjectList::read()
|
|||||||
|
|
||||||
// safety:
|
// safety:
|
||||||
newPtrs.setSize(nFunc);
|
newPtrs.setSize(nFunc);
|
||||||
|
newDigs.setSize(nFunc);
|
||||||
|
|
||||||
// update PtrList of functionObjects
|
// updating the PtrList of functionObjects also deletes any existing,
|
||||||
// also deletes existing, unused functionObjects
|
// but unused functionObjects
|
||||||
functions_.transfer(newPtrs);
|
PtrList<functionObject>::transfer(newPtrs);
|
||||||
|
digests_.transfer(newDigs);
|
||||||
indices_.transfer(newIndices);
|
indices_.transfer(newIndices);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
functions_.clear();
|
PtrList<functionObject>::clear();
|
||||||
|
digests_.clear();
|
||||||
indices_.clear();
|
indices_.clear();
|
||||||
}
|
}
|
||||||
|
|
@ -26,8 +26,8 @@ Class
|
|||||||
Foam::functionObjectList
|
Foam::functionObjectList
|
||||||
|
|
||||||
Description
|
Description
|
||||||
List of function objects with execute() function that is called for each
|
List of function objects with start(), execute() and end() functions
|
||||||
object.
|
that is called for each object.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
Foam::functionObject and Foam::OutputFilterFunctionObject
|
Foam::functionObject and Foam::OutputFilterFunctionObject
|
||||||
@ -40,9 +40,10 @@ SourceFiles
|
|||||||
#ifndef functionObjectList_H
|
#ifndef functionObjectList_H
|
||||||
#define functionObjectList_H
|
#define functionObjectList_H
|
||||||
|
|
||||||
#include "functionObject.H"
|
|
||||||
#include "HashTable.H"
|
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
|
#include "functionObject.H"
|
||||||
|
#include "SHA1Digest.H"
|
||||||
|
#include "HashTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -54,20 +55,20 @@ namespace Foam
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class functionObjectList
|
class functionObjectList
|
||||||
|
:
|
||||||
|
private PtrList<functionObject>
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- A list of function objects
|
//- A list of SHA1 digests for the function object dictionaries
|
||||||
// Avoid 'is-a' relationship for protection
|
List<SHA1Digest> digests_;
|
||||||
PtrList<functionObject> functions_;
|
|
||||||
|
|
||||||
//- Quick lookup of the index into the PtrList<functionObject>
|
//- Quick lookup of the index into functions/digests
|
||||||
// Currently only used to manage rereading/deletion
|
|
||||||
HashTable<label> indices_;
|
HashTable<label> indices_;
|
||||||
|
|
||||||
const Time& time_;
|
const Time& time_;
|
||||||
|
|
||||||
//- Dictionary containing the "functions" entry
|
//- The parent dictionary containing a "functions" entry
|
||||||
// This entry can either be a list or a dictionary of
|
// This entry can either be a list or a dictionary of
|
||||||
// functionObject specifications.
|
// functionObject specifications.
|
||||||
const dictionary& parentDict_;
|
const dictionary& parentDict_;
|
||||||
@ -75,15 +76,16 @@ class functionObjectList
|
|||||||
//- Switch for the execution of the functionObjects
|
//- Switch for the execution of the functionObjects
|
||||||
bool execution_;
|
bool execution_;
|
||||||
|
|
||||||
//- Tracks if read() was called while execution was turned off
|
//- Tracks if read() was called while execution is on
|
||||||
bool updated_;
|
bool updated_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Remove and return the function object pointer by name.
|
//- Remove and return the function object pointer by name,
|
||||||
// Return NULL if it didn't exist.
|
// and returns the old index via the parameter.
|
||||||
functionObject* remove(const word&);
|
// Returns a NULL pointer (and index -1) if it didn't exist.
|
||||||
|
functionObject* remove(const word&, label& oldIndex);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
functionObjectList(const functionObjectList&);
|
functionObjectList(const functionObjectList&);
|
||||||
@ -105,8 +107,11 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Construct from Time, dictionary with "functions" entry
|
//- Construct from Time, a dictionary with "functions" entry
|
||||||
// and the execution setting
|
// and the execution setting.
|
||||||
|
// @param[in] parentDict - the parent dictionary containing
|
||||||
|
// a "functions" entry, which can either be a list or a dictionary
|
||||||
|
// of functionObject specifications.
|
||||||
functionObjectList
|
functionObjectList
|
||||||
(
|
(
|
||||||
const Time&,
|
const Time&,
|
||||||
@ -122,11 +127,15 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Start is called at the start of the time-loop
|
//- Return the number of elements in the List.
|
||||||
virtual bool start();
|
using PtrList<functionObject>::size;
|
||||||
|
|
||||||
|
//- Return true if the List is empty (ie, size() is zero).
|
||||||
|
using PtrList<functionObject>::empty;
|
||||||
|
|
||||||
|
//- Clear the list of function objects
|
||||||
|
virtual void clear();
|
||||||
|
|
||||||
//- Execute is called at each ++ or += of the time-loop
|
|
||||||
virtual bool execute();
|
|
||||||
|
|
||||||
//- Switch the function objects on
|
//- Switch the function objects on
|
||||||
virtual void on();
|
virtual void on();
|
||||||
@ -134,8 +143,22 @@ public:
|
|||||||
//- Switch the function objects off
|
//- Switch the function objects off
|
||||||
virtual void off();
|
virtual void off();
|
||||||
|
|
||||||
|
//- Return the execution status (on/off) of the function objects
|
||||||
|
virtual bool status() const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Called at the start of the time-loop
|
||||||
|
virtual bool start();
|
||||||
|
|
||||||
|
//- Called at each ++ or += of the time-loop
|
||||||
|
virtual bool execute();
|
||||||
|
|
||||||
|
//- Called when Time::run() determines that the time-loop exits
|
||||||
|
virtual bool end();
|
||||||
|
|
||||||
//- Read and set the function objects if their data have changed
|
//- Read and set the function objects if their data have changed
|
||||||
virtual bool read();
|
virtual bool read();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -47,11 +47,11 @@ const Foam::NamedEnum<Foam::outputFilterOutputControl::outputControls, 2>
|
|||||||
|
|
||||||
Foam::outputFilterOutputControl::outputFilterOutputControl
|
Foam::outputFilterOutputControl::outputFilterOutputControl
|
||||||
(
|
(
|
||||||
const Time& time,
|
const Time& t,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
time_(time),
|
time_(t),
|
||||||
outputControl_(ocTimeStep),
|
outputControl_(ocTimeStep),
|
||||||
outputInterval_(0)
|
outputInterval_(0)
|
||||||
{
|
{
|
||||||
@ -93,8 +93,8 @@ bool Foam::outputFilterOutputControl::output() const
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
!(time_.timeIndex() % outputInterval_)
|
(outputInterval_ <= 1)
|
||||||
|| (outputInterval_ <= 1)
|
|| !(time_.timeIndex() % outputInterval_)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
@ -88,12 +88,8 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from dictionary and Time object
|
//- Construct from Time object and dictionary
|
||||||
outputFilterOutputControl
|
outputFilterOutputControl(const Time&, const dictionary&);
|
||||||
(
|
|
||||||
const Time& time,
|
|
||||||
const dictionary& dict
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
@ -103,7 +99,7 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
void read(const dictionary& dict);
|
void read(const dictionary&);
|
||||||
|
|
||||||
//- Return const access to the Time object
|
//- Return const access to the Time object
|
||||||
const Time& time() const
|
const Time& time() const
|
@ -29,10 +29,7 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
defineTypeNameAndDebug(Foam::objectRegistry, 0);
|
||||||
{
|
|
||||||
defineTypeNameAndDebug(objectRegistry, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -86,9 +83,9 @@ Foam::objectRegistry::~objectRegistry()
|
|||||||
{
|
{
|
||||||
if (iter()->ownedByRegistry())
|
if (iter()->ownedByRegistry())
|
||||||
{
|
{
|
||||||
regIOobject* elemPtr = iter();
|
regIOobject* object = iter();
|
||||||
erase(iter);
|
erase(iter);
|
||||||
delete elemPtr;
|
delete object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,18 +203,15 @@ bool Foam::objectRegistry::checkOut(regIOobject& io) const
|
|||||||
|
|
||||||
bool Foam::objectRegistry::modified() const
|
bool Foam::objectRegistry::modified() const
|
||||||
{
|
{
|
||||||
bool anyModified = false;
|
|
||||||
|
|
||||||
for (const_iterator iter = begin(); iter != end(); ++iter)
|
for (const_iterator iter = begin(); iter != end(); ++iter)
|
||||||
{
|
{
|
||||||
if (iter()->modified())
|
if (iter()->modified())
|
||||||
{
|
{
|
||||||
anyModified = true;
|
return true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return anyModified;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,25 +31,20 @@ Description
|
|||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
defineTypeNameAndDebug(regIOobject, 0);
|
defineTypeNameAndDebug(Foam::regIOobject, 0);
|
||||||
|
|
||||||
int regIOobject::fileModificationSkew
|
int Foam::regIOobject::fileModificationSkew
|
||||||
(
|
(
|
||||||
debug::optimisationSwitch("fileModificationSkew", 30)
|
Foam::debug::optimisationSwitch("fileModificationSkew", 30)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from IOobject
|
// Construct from IOobject
|
||||||
regIOobject::regIOobject(const IOobject& io)
|
Foam::regIOobject::regIOobject(const IOobject& io)
|
||||||
:
|
:
|
||||||
IOobject(io),
|
IOobject(io),
|
||||||
registered_(false),
|
registered_(false),
|
||||||
@ -66,7 +61,7 @@ regIOobject::regIOobject(const IOobject& io)
|
|||||||
|
|
||||||
|
|
||||||
// Construct as copy
|
// Construct as copy
|
||||||
regIOobject::regIOobject(const regIOobject& rio)
|
Foam::regIOobject::regIOobject(const regIOobject& rio)
|
||||||
:
|
:
|
||||||
IOobject(rio),
|
IOobject(rio),
|
||||||
registered_(false),
|
registered_(false),
|
||||||
@ -80,7 +75,7 @@ regIOobject::regIOobject(const regIOobject& rio)
|
|||||||
|
|
||||||
// Construct as copy, and transfering objectRegistry registration to copy
|
// Construct as copy, and transfering objectRegistry registration to copy
|
||||||
// if registerCopy is true
|
// if registerCopy is true
|
||||||
regIOobject::regIOobject(const regIOobject& rio, bool registerCopy)
|
Foam::regIOobject::regIOobject(const regIOobject& rio, bool registerCopy)
|
||||||
:
|
:
|
||||||
IOobject(rio),
|
IOobject(rio),
|
||||||
registered_(false),
|
registered_(false),
|
||||||
@ -99,7 +94,7 @@ regIOobject::regIOobject(const regIOobject& rio, bool registerCopy)
|
|||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Delete read stream, checkout from objectRegistry and destroy
|
// Delete read stream, checkout from objectRegistry and destroy
|
||||||
regIOobject::~regIOobject()
|
Foam::regIOobject::~regIOobject()
|
||||||
{
|
{
|
||||||
if (objectRegistry::debug)
|
if (objectRegistry::debug)
|
||||||
{
|
{
|
||||||
@ -125,7 +120,7 @@ regIOobject::~regIOobject()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void regIOobject::checkIn()
|
void Foam::regIOobject::checkIn()
|
||||||
{
|
{
|
||||||
if (!registered_)
|
if (!registered_)
|
||||||
{
|
{
|
||||||
@ -153,7 +148,7 @@ void regIOobject::checkIn()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void regIOobject::checkOut()
|
void Foam::regIOobject::checkOut()
|
||||||
{
|
{
|
||||||
if (registered_)
|
if (registered_)
|
||||||
{
|
{
|
||||||
@ -164,7 +159,7 @@ void regIOobject::checkOut()
|
|||||||
|
|
||||||
|
|
||||||
// Rename object and re-register with objectRegistry under new name
|
// Rename object and re-register with objectRegistry under new name
|
||||||
void regIOobject::rename(const word& newName)
|
void Foam::regIOobject::rename(const word& newName)
|
||||||
{
|
{
|
||||||
// Check out of objectRegistry
|
// Check out of objectRegistry
|
||||||
checkOut();
|
checkOut();
|
||||||
@ -177,7 +172,7 @@ void regIOobject::rename(const word& newName)
|
|||||||
|
|
||||||
|
|
||||||
// Assign to IOobject
|
// Assign to IOobject
|
||||||
void regIOobject::operator=(const IOobject& io)
|
void Foam::regIOobject::operator=(const IOobject& io)
|
||||||
{
|
{
|
||||||
if (isPtr_)
|
if (isPtr_)
|
||||||
{
|
{
|
||||||
@ -195,8 +190,4 @@ void regIOobject::operator=(const IOobject& io)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
@ -5,6 +5,6 @@ set -x
|
|||||||
wmake libo postCalc
|
wmake libo postCalc
|
||||||
wmake libso foamCalcFunctions
|
wmake libso foamCalcFunctions
|
||||||
|
|
||||||
(cd functionObjects && ./Allwmake)
|
functionObjects/Allwmake
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
@ -26,19 +26,13 @@ License
|
|||||||
|
|
||||||
#include "fieldAverage.H"
|
#include "fieldAverage.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "dictionary.H"
|
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "IFstream.H"
|
|
||||||
#include "OFstream.H"
|
|
||||||
|
|
||||||
#include "fieldAverageItem.H"
|
#include "fieldAverageItem.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
defineTypeNameAndDebug(Foam::fieldAverage, 0);
|
||||||
{
|
|
||||||
defineTypeNameAndDebug(fieldAverage, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Foam::word Foam::fieldAverage::EXT_MEAN = "Mean";
|
const Foam::word Foam::fieldAverage::EXT_MEAN = "Mean";
|
||||||
const Foam::word Foam::fieldAverage::EXT_PRIME2MEAN = "Prime2Mean";
|
const Foam::word Foam::fieldAverage::EXT_PRIME2MEAN = "Prime2Mean";
|
||||||
@ -46,100 +40,81 @@ const Foam::word Foam::fieldAverage::EXT_PRIME2MEAN = "Prime2Mean";
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::fieldAverage::checkoutFields(const wordList& fieldNames) const
|
void Foam::fieldAverage::resetFields(wordList& names)
|
||||||
{
|
{
|
||||||
forAll(fieldNames, i)
|
forAll(names, fieldI)
|
||||||
{
|
{
|
||||||
if (fieldNames[i] != word::null)
|
if (names[fieldI].size())
|
||||||
{
|
{
|
||||||
obr_.checkOut(*obr_[fieldNames[i]]);
|
obr_.checkOut(*obr_[names[fieldI]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
names.clear();
|
||||||
|
names.setSize(faItems_.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldAverage::resetLists(const label nItems)
|
void Foam::fieldAverage::initialize()
|
||||||
{
|
{
|
||||||
checkoutFields(meanScalarFields_);
|
resetFields(meanScalarFields_);
|
||||||
meanScalarFields_.clear();
|
resetFields(meanVectorFields_);
|
||||||
meanScalarFields_.setSize(nItems);
|
resetFields(meanSphericalTensorFields_);
|
||||||
|
resetFields(meanSymmTensorFields_);
|
||||||
|
resetFields(meanTensorFields_);
|
||||||
|
|
||||||
checkoutFields(meanVectorFields_);
|
resetFields(prime2MeanScalarFields_);
|
||||||
meanVectorFields_.clear();
|
resetFields(prime2MeanSymmTensorFields_);
|
||||||
meanVectorFields_.setSize(nItems);
|
|
||||||
|
|
||||||
checkoutFields(meanSphericalTensorFields_);
|
|
||||||
meanSphericalTensorFields_.clear();
|
|
||||||
meanSphericalTensorFields_.setSize(nItems);
|
|
||||||
|
|
||||||
checkoutFields(meanSymmTensorFields_);
|
|
||||||
meanSymmTensorFields_.clear();
|
|
||||||
meanSymmTensorFields_.setSize(nItems);
|
|
||||||
|
|
||||||
checkoutFields(meanTensorFields_);
|
|
||||||
meanTensorFields_.clear();
|
|
||||||
meanTensorFields_.setSize(nItems);
|
|
||||||
|
|
||||||
checkoutFields(prime2MeanScalarFields_);
|
|
||||||
prime2MeanScalarFields_.clear();
|
|
||||||
prime2MeanScalarFields_.setSize(nItems);
|
|
||||||
|
|
||||||
checkoutFields(prime2MeanSymmTensorFields_);
|
|
||||||
prime2MeanSymmTensorFields_.clear();
|
|
||||||
prime2MeanSymmTensorFields_.setSize(nItems);
|
|
||||||
|
|
||||||
totalIter_.clear();
|
totalIter_.clear();
|
||||||
totalIter_.setSize(nItems, 1);
|
totalIter_.setSize(faItems_.size(), 1);
|
||||||
|
|
||||||
totalTime_.clear();
|
totalTime_.clear();
|
||||||
totalTime_.setSize(nItems, obr_.time().deltaT().value());
|
totalTime_.setSize(faItems_.size(), obr_.time().deltaT().value());
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldAverage::initialise()
|
|
||||||
{
|
|
||||||
// Add mean fields to the field lists
|
// Add mean fields to the field lists
|
||||||
forAll(faItems_, i)
|
forAll(faItems_, fieldI)
|
||||||
{
|
{
|
||||||
const word& fieldName = faItems_[i].fieldName();
|
const word& fieldName = faItems_[fieldI].fieldName();
|
||||||
if (obr_.foundObject<volScalarField>(fieldName))
|
if (obr_.foundObject<volScalarField>(fieldName))
|
||||||
{
|
{
|
||||||
addMeanField<scalar>(i, meanScalarFields_);
|
addMeanField<scalar>(fieldI, meanScalarFields_);
|
||||||
}
|
}
|
||||||
else if (obr_.foundObject<volVectorField>(fieldName))
|
else if (obr_.foundObject<volVectorField>(fieldName))
|
||||||
{
|
{
|
||||||
addMeanField<vector>(i, meanVectorFields_);
|
addMeanField<vector>(fieldI, meanVectorFields_);
|
||||||
}
|
}
|
||||||
else if (obr_.foundObject<volSphericalTensorField>(fieldName))
|
else if (obr_.foundObject<volSphericalTensorField>(fieldName))
|
||||||
{
|
{
|
||||||
addMeanField<sphericalTensor>(i, meanSphericalTensorFields_);
|
addMeanField<sphericalTensor>(fieldI, meanSphericalTensorFields_);
|
||||||
}
|
}
|
||||||
else if (obr_.foundObject<volSymmTensorField>(fieldName))
|
else if (obr_.foundObject<volSymmTensorField>(fieldName))
|
||||||
{
|
{
|
||||||
addMeanField<symmTensor>(i, meanSymmTensorFields_);
|
addMeanField<symmTensor>(fieldI, meanSymmTensorFields_);
|
||||||
}
|
}
|
||||||
else if (obr_.foundObject<volTensorField>(fieldName))
|
else if (obr_.foundObject<volTensorField>(fieldName))
|
||||||
{
|
{
|
||||||
addMeanField<tensor>(i, meanTensorFields_);
|
addMeanField<tensor>(fieldI, meanTensorFields_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorIn("Foam::fieldAverage::initialise()")
|
FatalErrorIn("Foam::fieldAverage::initialize()")
|
||||||
<< "Requested field " << faItems_[i].fieldName()
|
<< "Requested field " << faItems_[fieldI].fieldName()
|
||||||
<< " does not exist in the database" << nl
|
<< " does not exist in the database" << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add prime-squared mean fields to the field lists
|
// Add prime-squared mean fields to the field lists
|
||||||
forAll(faItems_, i)
|
forAll(faItems_, fieldI)
|
||||||
{
|
{
|
||||||
if (faItems_[i].prime2Mean())
|
if (faItems_[fieldI].prime2Mean())
|
||||||
{
|
{
|
||||||
const word& fieldName = faItems_[i].fieldName();
|
const word& fieldName = faItems_[fieldI].fieldName();
|
||||||
if (!faItems_[i].mean())
|
if (!faItems_[fieldI].mean())
|
||||||
{
|
{
|
||||||
FatalErrorIn("Foam::fieldAverage::initialise()")
|
FatalErrorIn("Foam::fieldAverage::initialize()")
|
||||||
<< "To calculate the prime-squared average, the "
|
<< "To calculate the prime-squared average, the "
|
||||||
<< "mean average must also be selected for field "
|
<< "mean average must also be selected for field "
|
||||||
<< fieldName << nl << exit(FatalError);
|
<< fieldName << nl << exit(FatalError);
|
||||||
@ -149,7 +124,7 @@ void Foam::fieldAverage::initialise()
|
|||||||
{
|
{
|
||||||
addPrime2MeanField<scalar, scalar>
|
addPrime2MeanField<scalar, scalar>
|
||||||
(
|
(
|
||||||
i,
|
fieldI,
|
||||||
meanScalarFields_,
|
meanScalarFields_,
|
||||||
prime2MeanScalarFields_
|
prime2MeanScalarFields_
|
||||||
);
|
);
|
||||||
@ -158,14 +133,14 @@ void Foam::fieldAverage::initialise()
|
|||||||
{
|
{
|
||||||
addPrime2MeanField<vector, symmTensor>
|
addPrime2MeanField<vector, symmTensor>
|
||||||
(
|
(
|
||||||
i,
|
fieldI,
|
||||||
meanVectorFields_,
|
meanVectorFields_,
|
||||||
prime2MeanSymmTensorFields_
|
prime2MeanSymmTensorFields_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorIn("Foam::fieldAverage::initialise()")
|
FatalErrorIn("Foam::fieldAverage::initialize()")
|
||||||
<< "prime2Mean average can only be applied to "
|
<< "prime2Mean average can only be applied to "
|
||||||
<< "volScalarFields and volVectorFields"
|
<< "volScalarFields and volVectorFields"
|
||||||
<< nl << " Field: " << fieldName << nl
|
<< nl << " Field: " << fieldName << nl
|
||||||
@ -176,102 +151,26 @@ void Foam::fieldAverage::initialise()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::fieldAverage::fieldAverage
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const dictionary& dict,
|
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
|
||||||
:
|
|
||||||
name_(name),
|
|
||||||
obr_(obr),
|
|
||||||
active_(true),
|
|
||||||
cleanRestart_(dict.lookupOrDefault<Switch>("cleanRestart", false)),
|
|
||||||
faItems_(dict.lookup("fields")),
|
|
||||||
meanScalarFields_(faItems_.size()),
|
|
||||||
meanVectorFields_(faItems_.size()),
|
|
||||||
meanSphericalTensorFields_(faItems_.size()),
|
|
||||||
meanSymmTensorFields_(faItems_.size()),
|
|
||||||
meanTensorFields_(faItems_.size()),
|
|
||||||
prime2MeanScalarFields_(faItems_.size()),
|
|
||||||
prime2MeanSymmTensorFields_(faItems_.size()),
|
|
||||||
totalIter_(faItems_.size(), 1),
|
|
||||||
totalTime_(faItems_.size(), obr_.time().deltaT().value())
|
|
||||||
{
|
|
||||||
// Check if the available mesh is an fvMesh otherise deactivate
|
|
||||||
if (!isA<fvMesh>(obr_))
|
|
||||||
{
|
|
||||||
active_ = false;
|
|
||||||
WarningIn
|
|
||||||
(
|
|
||||||
"fieldAverage::fieldAverage\n"
|
|
||||||
"(\n"
|
|
||||||
"const word&,\n"
|
|
||||||
"const objectRegistry&,\n"
|
|
||||||
"const dictionary&,\n"
|
|
||||||
"const bool\n"
|
|
||||||
")"
|
|
||||||
) << "No fvMesh available, deactivating."
|
|
||||||
<< nl << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
read(dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::fieldAverage::~fieldAverage()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::fieldAverage::read(const dictionary& dict)
|
|
||||||
{
|
|
||||||
if (active_)
|
|
||||||
{
|
|
||||||
faItems_.clear();
|
|
||||||
faItems_ = List<fieldAverageItem>(dict.lookup("fields"));
|
|
||||||
|
|
||||||
resetLists(faItems_.size());
|
|
||||||
|
|
||||||
initialise();
|
|
||||||
|
|
||||||
readAveragingProperties();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldAverage::execute()
|
|
||||||
{
|
|
||||||
if (active_)
|
|
||||||
{
|
|
||||||
calcAverages();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldAverage::write()
|
|
||||||
{
|
|
||||||
if (active_)
|
|
||||||
{
|
|
||||||
writeAverages();
|
|
||||||
writeAveragingProperties();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldAverage::calcAverages()
|
void Foam::fieldAverage::calcAverages()
|
||||||
{
|
{
|
||||||
Info<< "Calculating averages" << nl << endl;
|
const label currentTimeIndex =
|
||||||
forAll(faItems_, i)
|
static_cast<const fvMesh&>(obr_).time().timeIndex();
|
||||||
|
|
||||||
|
if (prevTimeIndex_ == currentTimeIndex)
|
||||||
{
|
{
|
||||||
totalIter_[i]++;
|
return;
|
||||||
totalTime_[i] += obr_.time().deltaT().value();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prevTimeIndex_ = currentTimeIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Calculating averages" << nl << endl;
|
||||||
|
forAll(faItems_, fieldI)
|
||||||
|
{
|
||||||
|
totalIter_[fieldI]++;
|
||||||
|
totalTime_[fieldI] += obr_.time().deltaT().value();
|
||||||
}
|
}
|
||||||
|
|
||||||
addMeanSqrToPrime2Mean<scalar, scalar>
|
addMeanSqrToPrime2Mean<scalar, scalar>
|
||||||
@ -333,12 +232,12 @@ void Foam::fieldAverage::writeAveragingProperties() const
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
forAll(faItems_, i)
|
forAll(faItems_, fieldI)
|
||||||
{
|
{
|
||||||
const word& fieldName = faItems_[i].fieldName();
|
const word& fieldName = faItems_[fieldI].fieldName();
|
||||||
propsDict.add(fieldName, dictionary());
|
propsDict.add(fieldName, dictionary());
|
||||||
propsDict.subDict(fieldName).add("totalIter", totalIter_[i]);
|
propsDict.subDict(fieldName).add("totalIter", totalIter_[fieldI]);
|
||||||
propsDict.subDict(fieldName).add("totalTime", totalTime_[i]);
|
propsDict.subDict(fieldName).add("totalTime", totalTime_[fieldI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
propsDict.regIOobject::write();
|
propsDict.regIOobject::write();
|
||||||
@ -354,34 +253,39 @@ void Foam::fieldAverage::readAveragingProperties()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IFstream propsFile
|
IOobject propsDictHeader
|
||||||
(
|
(
|
||||||
obr_.time().path()/obr_.time().timeName()
|
"fieldAveragingProperties",
|
||||||
/"uniform"/"fieldAveragingProperties"
|
obr_.time().timeName(),
|
||||||
|
"uniform",
|
||||||
|
obr_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!propsFile.good())
|
if (!propsDictHeader.headerOk())
|
||||||
{
|
{
|
||||||
Info<< "fieldAverage: starting averaging at time "
|
Info<< "fieldAverage: starting averaging at time "
|
||||||
<< obr_.time().timeName() << nl << endl;
|
<< obr_.time().timeName() << nl << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dictionary propsDict(dictionary::null, propsFile);
|
IOdictionary propsDict(propsDictHeader);
|
||||||
|
|
||||||
Info<< "fieldAverage: restarting averaging for fields:" << endl;
|
Info<< "fieldAverage: restarting averaging for fields:" << endl;
|
||||||
forAll(faItems_, i)
|
forAll(faItems_, fieldI)
|
||||||
{
|
{
|
||||||
const word& fieldName = faItems_[i].fieldName();
|
const word& fieldName = faItems_[fieldI].fieldName();
|
||||||
if (propsDict.found(fieldName))
|
if (propsDict.found(fieldName))
|
||||||
{
|
{
|
||||||
dictionary fieldDict(propsDict.subDict(fieldName));
|
dictionary fieldDict(propsDict.subDict(fieldName));
|
||||||
|
|
||||||
totalIter_[i] = readLabel(fieldDict.lookup("totalIter"));
|
totalIter_[fieldI] = readLabel(fieldDict.lookup("totalIter"));
|
||||||
totalTime_[i] = readScalar(fieldDict.lookup("totalTime"));
|
totalTime_[fieldI] = readScalar(fieldDict.lookup("totalTime"));
|
||||||
Info<< " " << fieldName
|
Info<< " " << fieldName
|
||||||
<< " iters = " << totalIter_[i]
|
<< " iters = " << totalIter_[fieldI]
|
||||||
<< " time = " << totalTime_[i] << endl;
|
<< " time = " << totalTime_[fieldI] << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
@ -389,6 +293,104 @@ void Foam::fieldAverage::readAveragingProperties()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fieldAverage::fieldAverage
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const dictionary& dict,
|
||||||
|
const bool loadFromFiles
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
obr_(obr),
|
||||||
|
active_(true),
|
||||||
|
prevTimeIndex_(-1),
|
||||||
|
cleanRestart_(false),
|
||||||
|
faItems_(),
|
||||||
|
meanScalarFields_(),
|
||||||
|
meanVectorFields_(),
|
||||||
|
meanSphericalTensorFields_(),
|
||||||
|
meanSymmTensorFields_(),
|
||||||
|
meanTensorFields_(),
|
||||||
|
prime2MeanScalarFields_(),
|
||||||
|
prime2MeanSymmTensorFields_(),
|
||||||
|
totalIter_(),
|
||||||
|
totalTime_()
|
||||||
|
{
|
||||||
|
// Only active if a fvMesh is available
|
||||||
|
if (isA<fvMesh>(obr_))
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
active_ = false;
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"fieldAverage::fieldAverage\n"
|
||||||
|
"(\n"
|
||||||
|
"const word&,\n"
|
||||||
|
"const objectRegistry&,\n"
|
||||||
|
"const dictionary&,\n"
|
||||||
|
"const bool\n"
|
||||||
|
")"
|
||||||
|
) << "No fvMesh available, deactivating."
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fieldAverage::~fieldAverage()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fieldAverage::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
dict.readIfPresent("cleanRestart", cleanRestart_);
|
||||||
|
dict.lookup("fields") >> faItems_;
|
||||||
|
|
||||||
|
initialize();
|
||||||
|
readAveragingProperties();
|
||||||
|
|
||||||
|
// ensure first averaging works unconditionally
|
||||||
|
prevTimeIndex_ = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fieldAverage::execute()
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
calcAverages();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fieldAverage::end()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fieldAverage::write()
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
calcAverages();
|
||||||
|
writeAverages();
|
||||||
|
writeAveragingProperties();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldAverage::updateMesh(const mapPolyMesh&)
|
void Foam::fieldAverage::updateMesh(const mapPolyMesh&)
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@ -41,7 +41,7 @@ Description
|
|||||||
// averaging info if available
|
// averaging info if available
|
||||||
cleanRestart true;
|
cleanRestart true;
|
||||||
|
|
||||||
// Fields to be probed. runTime modifiable!
|
// Fields to be averaged. runTime modifiable!
|
||||||
fields
|
fields
|
||||||
(
|
(
|
||||||
U
|
U
|
||||||
@ -107,6 +107,14 @@ class fieldAverage
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
// File and field name extensions
|
||||||
|
|
||||||
|
//- Mean average
|
||||||
|
static const word EXT_MEAN;
|
||||||
|
|
||||||
|
//- Prime-squared average
|
||||||
|
static const word EXT_PRIME2MEAN;
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of this set of field averages.
|
//- Name of this set of field averages.
|
||||||
@ -118,6 +126,9 @@ protected:
|
|||||||
//- On/off switch
|
//- On/off switch
|
||||||
bool active_;
|
bool active_;
|
||||||
|
|
||||||
|
//- Time at last call, prevents repeated averaging
|
||||||
|
label prevTimeIndex_;
|
||||||
|
|
||||||
//- Clean restart flag
|
//- Clean restart flag
|
||||||
Switch cleanRestart_;
|
Switch cleanRestart_;
|
||||||
|
|
||||||
@ -125,15 +136,6 @@ protected:
|
|||||||
// calculated and output
|
// calculated and output
|
||||||
List<fieldAverageItem> faItems_;
|
List<fieldAverageItem> faItems_;
|
||||||
|
|
||||||
// File and field name extensions
|
|
||||||
|
|
||||||
//- Mean average
|
|
||||||
static const word EXT_MEAN;
|
|
||||||
|
|
||||||
//- Prime-squared average
|
|
||||||
static const word EXT_PRIME2MEAN;
|
|
||||||
|
|
||||||
|
|
||||||
// Lists of averages
|
// Lists of averages
|
||||||
|
|
||||||
// Arithmetic mean fields
|
// Arithmetic mean fields
|
||||||
@ -143,7 +145,8 @@ protected:
|
|||||||
wordList meanSymmTensorFields_;
|
wordList meanSymmTensorFields_;
|
||||||
wordList meanTensorFields_;
|
wordList meanTensorFields_;
|
||||||
|
|
||||||
// Prime-squared fields - applicable to volVectorFields only
|
// Prime-squared fields
|
||||||
|
// Only applicable to volScalarFields / volVectorFields
|
||||||
wordList prime2MeanScalarFields_;
|
wordList prime2MeanScalarFields_;
|
||||||
wordList prime2MeanSymmTensorFields_;
|
wordList prime2MeanSymmTensorFields_;
|
||||||
|
|
||||||
@ -162,20 +165,18 @@ protected:
|
|||||||
// Initialisation routines
|
// Initialisation routines
|
||||||
|
|
||||||
//- Checkout fields (causes deletion) from the database
|
//- Checkout fields (causes deletion) from the database
|
||||||
void checkoutFields(const wordList&) const;
|
// and reset lists
|
||||||
|
void resetFields(wordList&);
|
||||||
|
|
||||||
//- Reset size of lists (clear existing values)
|
//- Reset lists (clear existing values) and initialize averaging.
|
||||||
void resetLists(const label nItems);
|
// Check requested field averages are valid, populate field lists
|
||||||
|
void initialize();
|
||||||
|
|
||||||
//- Intitialise averaging. Check requested field averages are
|
//- Add mean average field to list
|
||||||
// valid, and populate field lists
|
|
||||||
void initialise();
|
|
||||||
|
|
||||||
//- Add mean average field to PtrList
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void addMeanField(const label, wordList&) const;
|
void addMeanField(const label, wordList&) const;
|
||||||
|
|
||||||
//- Add prime-squared average field to PtrList
|
//- Add prime-squared average field to list
|
||||||
template<class Type1, class Type2>
|
template<class Type1, class Type2>
|
||||||
void addPrime2MeanField
|
void addPrime2MeanField
|
||||||
(
|
(
|
||||||
@ -211,7 +212,7 @@ protected:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// IO
|
||||||
|
|
||||||
//- Write averages
|
//- Write averages
|
||||||
virtual void writeAverages() const;
|
virtual void writeAverages() const;
|
||||||
@ -281,6 +282,9 @@ public:
|
|||||||
//- Execute the averaging
|
//- Execute the averaging
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute the averaging at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Calculate the field average data and write
|
//- Calculate the field average data and write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
};
|
};
|
||||||
|
@ -33,15 +33,15 @@ License
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fieldAverage::addMeanField
|
void Foam::fieldAverage::addMeanField
|
||||||
(
|
(
|
||||||
const label fieldi,
|
const label fieldI,
|
||||||
wordList& meanFieldList
|
wordList& meanFieldList
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (faItems_[fieldi].mean())
|
if (faItems_[fieldI].mean())
|
||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
const word& fieldName = faItems_[fieldi].fieldName();
|
const word& fieldName = faItems_[fieldI].fieldName();
|
||||||
|
|
||||||
const word meanFieldName = fieldName + EXT_MEAN;
|
const word meanFieldName = fieldName + EXT_MEAN;
|
||||||
|
|
||||||
@ -49,14 +49,14 @@ void Foam::fieldAverage::addMeanField
|
|||||||
|
|
||||||
if (obr_.foundObject<fieldType>(meanFieldName))
|
if (obr_.foundObject<fieldType>(meanFieldName))
|
||||||
{
|
{
|
||||||
meanFieldList[fieldi] = meanFieldName;
|
meanFieldList[fieldI] = meanFieldName;
|
||||||
}
|
}
|
||||||
else if (obr_.found(meanFieldName))
|
else if (obr_.found(meanFieldName))
|
||||||
{
|
{
|
||||||
Info<< "Cannot allocate average field " << meanFieldName
|
Info<< "Cannot allocate average field " << meanFieldName
|
||||||
<< " since an object with that name already exists."
|
<< " since an object with that name already exists."
|
||||||
<< " Disabling averaging." << nl << endl;
|
<< " Disabling averaging." << nl << endl;
|
||||||
meanFieldList[fieldi] = word::null;
|
meanFieldList[fieldI] = word::null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -79,7 +79,7 @@ void Foam::fieldAverage::addMeanField
|
|||||||
// Store on registry
|
// Store on registry
|
||||||
fPtr->store();
|
fPtr->store();
|
||||||
|
|
||||||
meanFieldList[fieldi] = meanFieldName;
|
meanFieldList[fieldI] = meanFieldName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,38 +88,38 @@ void Foam::fieldAverage::addMeanField
|
|||||||
template<class Type1, class Type2>
|
template<class Type1, class Type2>
|
||||||
void Foam::fieldAverage::addPrime2MeanField
|
void Foam::fieldAverage::addPrime2MeanField
|
||||||
(
|
(
|
||||||
const label fieldi,
|
const label fieldI,
|
||||||
const wordList& meanFieldList,
|
const wordList& meanFieldList,
|
||||||
wordList& prime2MeanFieldList
|
wordList& prime2MeanFieldList
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (faItems_[fieldi].mean() && meanFieldList[fieldi] != word::null)
|
if (faItems_[fieldI].mean() && meanFieldList[fieldI].size())
|
||||||
{
|
{
|
||||||
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
|
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
|
||||||
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
|
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
|
||||||
|
|
||||||
const word& fieldName = faItems_[fieldi].fieldName();
|
const word& fieldName = faItems_[fieldI].fieldName();
|
||||||
|
|
||||||
const word meanFieldName = fieldName + EXT_PRIME2MEAN;
|
const word meanFieldName = fieldName + EXT_PRIME2MEAN;
|
||||||
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
|
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
|
||||||
|
|
||||||
if (obr_.foundObject<fieldType2>(meanFieldName))
|
if (obr_.foundObject<fieldType2>(meanFieldName))
|
||||||
{
|
{
|
||||||
prime2MeanFieldList[fieldi] = meanFieldName;
|
prime2MeanFieldList[fieldI] = meanFieldName;
|
||||||
}
|
}
|
||||||
else if (obr_.found(meanFieldName))
|
else if (obr_.found(meanFieldName))
|
||||||
{
|
{
|
||||||
Info<< "Cannot allocate average field " << meanFieldName
|
Info<< "Cannot allocate average field " << meanFieldName
|
||||||
<< " since an object with that name already exists."
|
<< " since an object with that name already exists."
|
||||||
<< " Disabling averaging." << nl << endl;
|
<< " Disabling averaging." << nl << endl;
|
||||||
prime2MeanFieldList[fieldi] = word::null;
|
prime2MeanFieldList[fieldI] = word::null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const fieldType1& baseField =
|
const fieldType1& baseField =
|
||||||
obr_.lookupObject<fieldType1>(fieldName);
|
obr_.lookupObject<fieldType1>(fieldName);
|
||||||
const fieldType1& meanField =
|
const fieldType1& meanField =
|
||||||
obr_.lookupObject<fieldType1>(meanFieldList[fieldi]);
|
obr_.lookupObject<fieldType1>(meanFieldList[fieldI]);
|
||||||
|
|
||||||
fieldType2* fPtr = new fieldType2
|
fieldType2* fPtr = new fieldType2
|
||||||
(
|
(
|
||||||
@ -137,7 +137,7 @@ void Foam::fieldAverage::addPrime2MeanField
|
|||||||
// Store on registry
|
// Store on registry
|
||||||
fPtr->store();
|
fPtr->store();
|
||||||
|
|
||||||
prime2MeanFieldList[fieldi] = meanFieldName;
|
prime2MeanFieldList[fieldI] = meanFieldName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ const
|
|||||||
|
|
||||||
forAll(faItems_, i)
|
forAll(faItems_, i)
|
||||||
{
|
{
|
||||||
if (faItems_[i].mean() && meanFieldList[i] != word::null)
|
if (faItems_[i].mean() && meanFieldList[i].size())
|
||||||
{
|
{
|
||||||
const word& fieldName = faItems_[i].fieldName();
|
const word& fieldName = faItems_[i].fieldName();
|
||||||
const fieldType& baseField =
|
const fieldType& baseField =
|
||||||
@ -199,8 +199,8 @@ void Foam::fieldAverage::calculatePrime2MeanFields
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
faItems_[i].prime2Mean()
|
faItems_[i].prime2Mean()
|
||||||
&& meanFieldList[i] != word::null
|
&& meanFieldList[i].size()
|
||||||
&& prime2MeanFieldList[i] != word::null
|
&& prime2MeanFieldList[i].size()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word& fieldName = faItems_[i].fieldName();
|
const word& fieldName = faItems_[i].fieldName();
|
||||||
@ -250,8 +250,8 @@ void Foam::fieldAverage::addMeanSqrToPrime2Mean
|
|||||||
if
|
if
|
||||||
(
|
(
|
||||||
faItems_[i].prime2Mean()
|
faItems_[i].prime2Mean()
|
||||||
&& meanFieldList[i] != word::null
|
&& meanFieldList[i].size()
|
||||||
&& prime2MeanFieldList[i] != word::null
|
&& prime2MeanFieldList[i].size()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fieldType1& meanField =
|
const fieldType1& meanField =
|
||||||
@ -274,7 +274,7 @@ void Foam::fieldAverage::writeFieldList(const wordList& fieldList) const
|
|||||||
|
|
||||||
forAll(fieldList, i)
|
forAll(fieldList, i)
|
||||||
{
|
{
|
||||||
if (fieldList[i] != word::null)
|
if (fieldList[i].size())
|
||||||
{
|
{
|
||||||
const fieldType& f = obr_.lookupObject<fieldType>(fieldList[i]);
|
const fieldType& f = obr_.lookupObject<fieldType>(fieldList[i]);
|
||||||
f.write();
|
f.write();
|
||||||
|
@ -76,14 +76,12 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem)
|
|||||||
"(Foam::Ostream&, const Foam::fieldAverageItem&)"
|
"(Foam::Ostream&, const Foam::fieldAverageItem&)"
|
||||||
);
|
);
|
||||||
|
|
||||||
os<< faItem.fieldName_ << nl;
|
os << faItem.fieldName_ << nl << token::BEGIN_BLOCK << nl;
|
||||||
os<< token::BEGIN_BLOCK << nl;
|
|
||||||
os.writeKeyword("mean") << faItem.mean_ << token::END_STATEMENT << nl;
|
os.writeKeyword("mean") << faItem.mean_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("prime2Mean") << faItem.mean_
|
os.writeKeyword("prime2Mean") << faItem.mean_
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("base") << faItem.baseTypeNames_[faItem.base_]
|
os.writeKeyword("base") << faItem.baseTypeNames_[faItem.base_]
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl << token::END_BLOCK << nl;
|
||||||
os<< token::END_BLOCK << nl;
|
|
||||||
|
|
||||||
os.check
|
os.check
|
||||||
(
|
(
|
||||||
|
@ -163,6 +163,13 @@ void Foam::fieldMinMax::execute()
|
|||||||
// Do nothing - only valid on write
|
// Do nothing - only valid on write
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fieldMinMax::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldMinMax::write()
|
void Foam::fieldMinMax::write()
|
||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
|
@ -80,8 +80,8 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of this set of forces,
|
//- Name of this set of field min/max.
|
||||||
// Also used as the name of the probes directory.
|
// Also used as the name of the output directory.
|
||||||
word name_;
|
word name_;
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
@ -108,7 +108,7 @@ protected:
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- If the forces file has not been created create it
|
//- If the output file has not been created create it
|
||||||
void makeFile();
|
void makeFile();
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
@ -147,18 +147,21 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the set of forces
|
//- Return name of the set of field min/max
|
||||||
virtual const word& name() const
|
virtual const word& name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Read the forces data
|
//- Read the field min/max data
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Calculate the field min/max
|
//- Calculate the field min/max
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void calcMinMaxFields(const word& fieldName);
|
void calcMinMaxFields(const word& fieldName);
|
||||||
|
@ -104,6 +104,12 @@ void Foam::forceCoeffs::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::forceCoeffs::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::forceCoeffs::write()
|
void Foam::forceCoeffs::write()
|
||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
|
@ -126,9 +126,12 @@ public:
|
|||||||
//- Read the forces data
|
//- Read the forces data
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Write the forces
|
//- Write the forces
|
||||||
virtual void write();
|
virtual void write();
|
||||||
};
|
};
|
||||||
|
@ -273,6 +273,13 @@ void Foam::forces::execute()
|
|||||||
// Do nothing - only valid on write
|
// Do nothing - only valid on write
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::forces::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::forces::write()
|
void Foam::forces::write()
|
||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
|
@ -200,9 +200,12 @@ public:
|
|||||||
//- Read the forces data
|
//- Read the forces data
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Write the forces
|
//- Write the forces
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
|
@ -41,15 +41,14 @@ namespace Foam
|
|||||||
Foam::systemCall::systemCall
|
Foam::systemCall::systemCall
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry&,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool loadFromFiles
|
const bool
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
|
||||||
active_(true),
|
|
||||||
executeCalls_(),
|
executeCalls_(),
|
||||||
|
endCalls_(),
|
||||||
writeCalls_()
|
writeCalls_()
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
@ -66,8 +65,16 @@ Foam::systemCall::~systemCall()
|
|||||||
|
|
||||||
void Foam::systemCall::read(const dictionary& dict)
|
void Foam::systemCall::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("executeCalls") >> executeCalls_;
|
dict.readIfPresent("executeCalls", executeCalls_);
|
||||||
dict.lookup("writeCalls") >> writeCalls_;
|
dict.readIfPresent("endCalls", endCalls_);
|
||||||
|
dict.readIfPresent("writeCalls", writeCalls_);
|
||||||
|
|
||||||
|
if (executeCalls_.empty() && endCalls_.empty() && writeCalls_.empty())
|
||||||
|
{
|
||||||
|
WarningIn("Foam::system::read(const dictionary&)")
|
||||||
|
<< "no executeCalls, endCalls or writeCalls defined."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -79,6 +86,16 @@ void Foam::systemCall::execute()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::systemCall::end()
|
||||||
|
{
|
||||||
|
forAll(endCalls_, callI)
|
||||||
|
{
|
||||||
|
::system(endCalls_[callI].c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::systemCall::write()
|
void Foam::systemCall::write()
|
||||||
{
|
{
|
||||||
forAll(writeCalls_, callI)
|
forAll(writeCalls_, callI)
|
||||||
|
@ -63,14 +63,12 @@ protected:
|
|||||||
//- Name of this set of system calls
|
//- Name of this set of system calls
|
||||||
word name_;
|
word name_;
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- on/off switch
|
|
||||||
bool active_;
|
|
||||||
|
|
||||||
//- List of calls to execute - every step
|
//- List of calls to execute - every step
|
||||||
stringList executeCalls_;
|
stringList executeCalls_;
|
||||||
|
|
||||||
|
//- List of calls to execute when exiting the time-loop
|
||||||
|
stringList endCalls_;
|
||||||
|
|
||||||
//- List of calls to execute - write steps
|
//- List of calls to execute - write steps
|
||||||
stringList writeCalls_;
|
stringList writeCalls_;
|
||||||
|
|
||||||
@ -97,9 +95,9 @@ public:
|
|||||||
systemCall
|
systemCall
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const objectRegistry& unused,
|
||||||
const dictionary&,
|
const dictionary&,
|
||||||
const bool loadFromFiles = false
|
const bool loadFromFilesUnused = false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -119,10 +117,13 @@ public:
|
|||||||
//- Read the system calls
|
//- Read the system calls
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
//- Execute the "executeCalls" at each time-step
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
//- Write
|
//- Execute the "endCalls" at the final time-loop
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
|
//- Write, execute the "writeCalls"
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
//- Update for changes of mesh
|
//- Update for changes of mesh
|
||||||
|
@ -58,7 +58,7 @@ Foam::dynamicPressure::dynamicPressure
|
|||||||
name_(name),
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
active_(true),
|
active_(true),
|
||||||
pName_(dict.lookup("p")),
|
pName_(dict.lookupOrDefault<word>("p", "p")),
|
||||||
rho_(readScalar(dict.lookup("rho")))
|
rho_(readScalar(dict.lookup("rho")))
|
||||||
{
|
{
|
||||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||||
@ -68,7 +68,7 @@ Foam::dynamicPressure::dynamicPressure
|
|||||||
WarningIn
|
WarningIn
|
||||||
(
|
(
|
||||||
"dynamicPressure::dynamicPressure"
|
"dynamicPressure::dynamicPressure"
|
||||||
"(const objectRegistry& obr, const dictionary& dict)"
|
"(const objectRegistry&, const dictionary&)"
|
||||||
) << "No fvMesh available, deactivating." << nl
|
) << "No fvMesh available, deactivating." << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ Foam::dynamicPressure::dynamicPressure
|
|||||||
WarningIn
|
WarningIn
|
||||||
(
|
(
|
||||||
"dynamicPressure::dynamicPressure"
|
"dynamicPressure::dynamicPressure"
|
||||||
"(const objectRegistry& obr, const dictionary& dict)"
|
"(const objectRegistry&, const dictionary&)"
|
||||||
) << "Pressure is not kinematic pressure, deactivating." << nl
|
) << "Pressure is not kinematic pressure, deactivating." << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ void Foam::dynamicPressure::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
dict.lookup("p") >> pName_;
|
dict.readIfPresent("p", pName_);
|
||||||
dict.lookup("rho") >> rho_;
|
dict.lookup("rho") >> rho_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,6 +115,12 @@ void Foam::dynamicPressure::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::dynamicPressure::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::dynamicPressure::write()
|
void Foam::dynamicPressure::write()
|
||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
|
@ -66,10 +66,10 @@ class dynamicPressure
|
|||||||
//- on/off switch
|
//- on/off switch
|
||||||
bool active_;
|
bool active_;
|
||||||
|
|
||||||
//- Name of pressure field
|
//- Name of pressure field, default is "p"
|
||||||
word pName_;
|
word pName_;
|
||||||
|
|
||||||
//- Density
|
//- Density value
|
||||||
scalar rho_;
|
scalar rho_;
|
||||||
|
|
||||||
|
|
||||||
@ -120,9 +120,12 @@ public:
|
|||||||
//- Read the dynamicPressure data
|
//- Read the dynamicPressure data
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Calculate the dynamicPressure and write
|
//- Calculate the dynamicPressure and write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
|
@ -48,8 +48,6 @@ graphField/writePatchGraph.C
|
|||||||
graphField/writeCellGraph.C
|
graphField/writeCellGraph.C
|
||||||
graphField/makeGraph.C
|
graphField/makeGraph.C
|
||||||
|
|
||||||
outputFilters/outputFilterOutputControl/outputFilterOutputControl.C
|
|
||||||
|
|
||||||
meshToMesh = meshToMeshInterpolation/meshToMesh
|
meshToMesh = meshToMeshInterpolation/meshToMesh
|
||||||
$(meshToMesh)/meshToMesh.C
|
$(meshToMesh)/meshToMesh.C
|
||||||
$(meshToMesh)/calculateMeshToMeshAddressing.C
|
$(meshToMesh)/calculateMeshToMeshAddressing.C
|
||||||
|
@ -304,6 +304,12 @@ void Foam::probes::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::probes::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::probes::write()
|
void Foam::probes::write()
|
||||||
{
|
{
|
||||||
if (probeLocations_.size() && checkFieldTypes())
|
if (probeLocations_.size() && checkFieldTypes())
|
||||||
|
@ -194,15 +194,18 @@ public:
|
|||||||
return cellList_;
|
return cellList_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Execute, currently does nothing
|
||||||
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Sample and write
|
//- Sample and write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
//- Read the probes
|
//- Read the probes
|
||||||
virtual void read(const dictionary&);
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
//- Execute
|
|
||||||
virtual void execute();
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
//- Update for changes of mesh
|
||||||
virtual void updateMesh(const mapPolyMesh&)
|
virtual void updateMesh(const mapPolyMesh&)
|
||||||
{}
|
{}
|
||||||
|
@ -275,6 +275,12 @@ void Foam::sampledSets::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sampledSets::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::sampledSets::write()
|
void Foam::sampledSets::write()
|
||||||
{
|
{
|
||||||
if (size() && checkFieldTypes())
|
if (size() && checkFieldTypes())
|
||||||
|
@ -270,9 +270,12 @@ public:
|
|||||||
//- set verbosity level
|
//- set verbosity level
|
||||||
void verbose(const bool verbosity = true);
|
void verbose(const bool verbosity = true);
|
||||||
|
|
||||||
//- Execute
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
//- Sample and write
|
//- Sample and write
|
||||||
virtual void write();
|
virtual void write();
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ bool Foam::sampledIsoSurface::updateGeometry() const
|
|||||||
|
|
||||||
subMeshPtr_.reset
|
subMeshPtr_.reset
|
||||||
(
|
(
|
||||||
new fvMeshSubset(static_cast<const fvMesh&>(mesh()))
|
new fvMeshSubset(fvm)
|
||||||
);
|
);
|
||||||
subMeshPtr_().setLargeCellSubset
|
subMeshPtr_().setLargeCellSubset
|
||||||
(
|
(
|
||||||
|
@ -87,7 +87,7 @@ class sampledIsoSurface
|
|||||||
|
|
||||||
// Recreated for every isoSurface
|
// Recreated for every isoSurface
|
||||||
|
|
||||||
//- Time at last call, also track it surface needs an update
|
//- Time at last call, also track if surface needs an update
|
||||||
mutable label prevTimeIndex_;
|
mutable label prevTimeIndex_;
|
||||||
|
|
||||||
//- Cached volfield
|
//- Cached volfield
|
||||||
|
@ -203,7 +203,6 @@ Foam::sampledSurfaces::~sampledSurfaces()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
void Foam::sampledSurfaces::verbose(const bool verbosity)
|
void Foam::sampledSurfaces::verbose(const bool verbosity)
|
||||||
{
|
{
|
||||||
verbose_ = verbosity;
|
verbose_ = verbosity;
|
||||||
@ -216,6 +215,12 @@ void Foam::sampledSurfaces::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sampledSurfaces::end()
|
||||||
|
{
|
||||||
|
// Do nothing - only valid on write
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::sampledSurfaces::write()
|
void Foam::sampledSurfaces::write()
|
||||||
{
|
{
|
||||||
if (size() && checkFieldTypes())
|
if (size() && checkFieldTypes())
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user