Final iteration information now available in mesh::data (used to be mesh::fvData)

Relaxation and solution parameters for the final iteration in PIMPLE loops are
now selected according to the value of the "finalIteration" entry in the
mesh::data dictionary.

rhoPimpleFoam significantly updates and now replaces rhoPisoFoam.
This commit is contained in:
henry
2010-05-25 18:45:25 +01:00
parent 49ccf0ffaa
commit 361b153343
161 changed files with 685 additions and 859 deletions

View File

@ -543,4 +543,6 @@ $(writers)/gnuplotGraph/gnuplotGraph.C
$(writers)/xmgrGraph/xmgrGraph.C
$(writers)/jplotGraph/jplotGraph.C
meshes/data/data.C
LIB = $(FOAM_LIBBIN)/libOpenFOAM

View File

@ -27,6 +27,7 @@ License
#include "Time.H"
#include "demandDrivenData.H"
#include "dictionary.H"
#include "data.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -918,6 +919,15 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::needReference() const
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::relax(const scalar alpha)
{
if (debug)
{
InfoIn
(
"GeometricField<Type, PatchField, GeoMesh>::relax"
"(const scalar alpha)"
) << "Relaxing" << endl << this->info() << " by " << alpha << endl;
}
operator==(prevIter() + alpha*(*this - prevIter()));
}
@ -925,16 +935,33 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::relax(const scalar alpha)
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::relax()
{
scalar alpha = 0;
word name = this->name();
if (this->mesh().relax(this->name()))
if (this->mesh().data::lookupOrDefault<bool>("finalIteration", false))
{
alpha = this->mesh().relaxationFactor(this->name());
name += "Final";
}
if (alpha > 0)
if (this->mesh().relax(name))
{
relax(alpha);
relax(this->mesh().relaxationFactor(name));
}
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::word Foam::GeometricField<Type, PatchField, GeoMesh>::select
(
bool final
) const
{
if (final)
{
return this->name() + "Final";
}
else
{
return this->name();
}
}

View File

@ -476,6 +476,11 @@ public:
// alpha is read from controlDict
void relax();
//- Select the final iteration parameters if `final' is true
// by returning the field name + "Final"
// otherwise the standard parameters by returning the field name
word select(bool final) const;
// Member function *this operators

View File

@ -23,23 +23,23 @@ License
\*---------------------------------------------------------------------------*/
#include "fvData.H"
#include "data.H"
#include "Time.H"
#include "lduMatrix.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int Foam::fvData::debug(Foam::debug::debugSwitch("fvData", false));
int Foam::data::debug(Foam::debug::debugSwitch("data", false));
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvData::fvData(const objectRegistry& obr)
Foam::data::data(const objectRegistry& obr)
:
IOdictionary
(
IOobject
(
"fvData",
"data",
obr.time().system(),
obr,
IOobject::NO_READ,
@ -53,13 +53,13 @@ Foam::fvData::fvData(const objectRegistry& obr)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::dictionary& Foam::fvData::solverPerformanceDict() const
const Foam::dictionary& Foam::data::solverPerformanceDict() const
{
return subDict("solverPerformance");
}
void Foam::fvData::setSolverPerformance
void Foam::data::setSolverPerformance
(
const word& name,
const lduMatrix::solverPerformance& sp

View File

@ -22,20 +22,21 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fvData
Foam::data
Description
Database for finite volume solution data, solver performance and
other reduced data. fvMesh is derived from fvData so that all fields have
access to the fvData from the mesh reference they hold.
Database for solution data, solver performance and other reduced data.
fvMesh is derived from data so that all fields have access to the data from
the mesh reference they hold.
SourceFiles
fvData.C
data.C
\*---------------------------------------------------------------------------*/
#ifndef fvData_H
#define fvData_H
#ifndef data_H
#define data_H
#include "IOdictionary.H"
#include "lduMatrix.H"
@ -46,20 +47,20 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fvData Declaration
Class data Declaration
\*---------------------------------------------------------------------------*/
class fvData
class data
:
public IOdictionary
{
// Private Member Functions
//- Disallow default bitwise copy construct
fvData(const fvData&);
data(const data&);
//- Disallow default bitwise assignment
void operator=(const fvData&);
void operator=(const data&);
public:
@ -71,7 +72,7 @@ public:
// Constructors
//- Construct for objectRegistry
fvData(const objectRegistry& obr);
data(const objectRegistry& obr);
// Member Functions

View File

@ -270,7 +270,6 @@ $(multivariateSchemes)/limitedCubic/multivariateLimitedCubic.C
finiteVolume/fv/fv.C
finiteVolume/fvSchemes/fvSchemes.C
finiteVolume/fvData/fvData.C
ddtSchemes = finiteVolume/ddtSchemes
$(ddtSchemes)/ddtScheme/ddtSchemes.C

View File

@ -506,6 +506,13 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
return;
}
if (debug)
{
InfoIn("fvMatrix<Type>::relax(const scalar alpha)")
<< "Relaxing " << psi_.name() << " by " << alpha
<< endl;
}
Field<Type>& S = source();
scalarField& D = diag();
@ -591,9 +598,14 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
template<class Type>
void Foam::fvMatrix<Type>::relax()
{
if (psi_.mesh().relax(psi_.name()))
word name = psi_.select
(
psi_.mesh().data::lookupOrDefault<bool>("finalIteration", false)
);
if (psi_.mesh().relax(name))
{
relax(psi_.mesh().relaxationFactor(psi_.name()));
relax(psi_.mesh().relaxationFactor(name));
}
}

View File

@ -167,21 +167,48 @@ template<class Type>
Foam::autoPtr<typename Foam::fvMatrix<Type>::fvSolver>
Foam::fvMatrix<Type>::solver()
{
return solver(psi_.mesh().solverDict(psi_.name()));
return solver
(
psi_.mesh().solverDict
(
psi_.select
(
psi_.mesh().data::lookupOrDefault<bool>("finalIteration", false)
)
)
);
}
template<class Type>
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::fvSolver::solve()
{
return solve(psi_.mesh().solverDict(psi_.name()));
return solve
(
psi_.mesh().solverDict
(
psi_.select
(
psi_.mesh().data::lookupOrDefault<bool>("finalIteration", false)
)
)
);
}
template<class Type>
Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve()
{
return solve(psi_.mesh().solverDict(psi_.name()));
return solve
(
psi_.mesh().solverDict
(
psi_.select
(
psi_.mesh().data::lookupOrDefault<bool>("finalIteration", false)
)
)
);
}

View File

@ -153,7 +153,7 @@ Foam::fvMesh::fvMesh(const IOobject& io)
surfaceInterpolation(*this),
fvSchemes(static_cast<const objectRegistry&>(*this)),
fvSolution(static_cast<const objectRegistry&>(*this)),
fvData(static_cast<const objectRegistry&>(*this)),
data(static_cast<const objectRegistry&>(*this)),
boundary_(*this, boundaryMesh()),
lduPtr_(NULL),
curTimeIndex_(time().timeIndex()),
@ -248,7 +248,7 @@ Foam::fvMesh::fvMesh
surfaceInterpolation(*this),
fvSchemes(static_cast<const objectRegistry&>(*this)),
fvSolution(static_cast<const objectRegistry&>(*this)),
fvData(static_cast<const objectRegistry&>(*this)),
data(static_cast<const objectRegistry&>(*this)),
boundary_(*this),
lduPtr_(NULL),
curTimeIndex_(time().timeIndex()),
@ -281,7 +281,7 @@ Foam::fvMesh::fvMesh
surfaceInterpolation(*this),
fvSchemes(static_cast<const objectRegistry&>(*this)),
fvSolution(static_cast<const objectRegistry&>(*this)),
fvData(static_cast<const objectRegistry&>(*this)),
data(static_cast<const objectRegistry&>(*this)),
boundary_(*this),
lduPtr_(NULL),
curTimeIndex_(time().timeIndex()),

View File

@ -54,7 +54,7 @@ SourceFiles
#include "surfaceInterpolation.H"
#include "fvSchemes.H"
#include "fvSolution.H"
#include "fvData.H"
#include "data.H"
#include "DimensionedField.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
@ -83,7 +83,7 @@ class fvMesh
public surfaceInterpolation,
public fvSchemes,
public fvSolution,
public fvData
public data
{
// Private data