Commit 00cd6ac8 authored by henry's avatar henry
Browse files

Added support for the caching of gradients.

This is controlled by providing a list of the fields to be cached in the "cache"
sub-dictionary of fvSolution.

Debug information about the caching is printed when the solution::debug switch
is on.

There are still a couple of issues to do with the naming of gradients used in
corrected snGrads and limited interpolation schemes that need to be resolved
but these are no different to previously and hence not urgent.
parent d6a278f2
......@@ -152,7 +152,7 @@ bool Foam::solution::cache(const word& name) const
{
if (debug)
{
Info<< "Find cache entry for " << name << endl;
Info<< "Cache: find entry for " << name << endl;
}
return cache_.found(name);
......
......@@ -285,6 +285,7 @@ $(divSchemes)/gaussDivScheme/gaussDivSchemes.C
gradSchemes = finiteVolume/gradSchemes
$(gradSchemes)/gradScheme/gradSchemes.C
$(gradSchemes)/gaussGrad/gaussGrads.C
$(gradSchemes)/leastSquaresGrad/leastSquaresVectors.C
$(gradSchemes)/leastSquaresGrad/leastSquaresGrads.C
$(gradSchemes)/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C
......
......@@ -177,7 +177,7 @@ public:
virtual tmp<fvMatrix<Type> > fvmDiv
(
const surfaceScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
) const = 0;
virtual tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDiv
......
......@@ -69,7 +69,7 @@ tmp<fvMatrix<Type> >
gaussConvectionScheme<Type>::fvmDiv
(
const surfaceScalarField& faceFlux,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
tmp<surfaceScalarField> tweights = tinterpScheme_().weights(vf);
......@@ -89,9 +89,9 @@ gaussConvectionScheme<Type>::fvmDiv
fvm.upper() = fvm.lower() + faceFlux.internalField();
fvm.negSumDiag();
forAll(fvm.psi().boundaryField(), patchI)
forAll(vf.boundaryField(), patchI)
{
const fvPatchField<Type>& psf = fvm.psi().boundaryField()[patchI];
const fvPatchField<Type>& psf = vf.boundaryField()[patchI];
const fvsPatchScalarField& patchFlux = faceFlux.boundaryField()[patchI];
const fvsPatchScalarField& pw = weights.boundaryField()[patchI];
......
......@@ -124,7 +124,7 @@ public:
tmp<fvMatrix<Type> > fvmDiv
(
const surfaceScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
) const;
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDiv
......
......@@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "multivariateGaussConvectionScheme.H"
......@@ -81,7 +79,7 @@ tmp<fvMatrix<Type> >
multivariateGaussConvectionScheme<Type>::fvmDiv
(
const surfaceScalarField& faceFlux,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
return gaussConvectionScheme<Type>
......
......@@ -114,7 +114,7 @@ public:
tmp<fvMatrix<Type> > fvmDiv
(
const surfaceScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
) const;
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDiv
......
......@@ -21,7 +21,7 @@ License
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
\*---------------------------------------------------------------------------*/
#include "EulerD2dt2Scheme.H"
......@@ -181,7 +181,7 @@ EulerD2dt2Scheme<Type>::fvcD2dt2
coefft
*(rho.boundaryField() + rho.oldTime().boundaryField())
*vf.boundaryField()
- (
coefft
*(
......@@ -232,7 +232,7 @@ template<class Type>
tmp<fvMatrix<Type> >
EulerD2dt2Scheme<Type>::fvmD2dt2
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -292,7 +292,7 @@ tmp<fvMatrix<Type> >
EulerD2dt2Scheme<Type>::fvmD2dt2
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -353,7 +353,7 @@ tmp<fvMatrix<Type> >
EulerD2dt2Scheme<Type>::fvmD2dt2
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......
......@@ -109,19 +109,19 @@ public:
tmp<fvMatrix<Type> > fvmD2dt2
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmD2dt2
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmD2dt2
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
};
......
......@@ -153,19 +153,19 @@ public:
virtual tmp<fvMatrix<Type> > fvmD2dt2
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
) = 0;
virtual tmp<fvMatrix<Type> > fvmD2dt2
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
) = 0;
virtual tmp<fvMatrix<Type> > fvmD2dt2
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
) = 0;
};
......
......@@ -21,7 +21,7 @@ License
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
\*---------------------------------------------------------------------------*/
#include "steadyStateD2dt2Scheme.H"
......@@ -107,7 +107,7 @@ template<class Type>
tmp<fvMatrix<Type> >
steadyStateD2dt2Scheme<Type>::fvmD2dt2
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -128,7 +128,7 @@ tmp<fvMatrix<Type> >
steadyStateD2dt2Scheme<Type>::fvmD2dt2
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -149,7 +149,7 @@ tmp<fvMatrix<Type> >
steadyStateD2dt2Scheme<Type>::fvmD2dt2
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......
......@@ -108,19 +108,19 @@ public:
tmp<fvMatrix<Type> > fvmD2dt2
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmD2dt2
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmD2dt2
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
};
......
......@@ -21,7 +21,7 @@ License
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
\*---------------------------------------------------------------------------*/
#include "CoEulerDdtScheme.H"
......@@ -69,10 +69,10 @@ tmp<volScalarField> CoEulerDdtScheme<Type>::CorDeltaT() const
forAll(owner, faceI)
{
corDeltaT[owner[faceI]] =
corDeltaT[owner[faceI]] =
max(corDeltaT[owner[faceI]], cofrDeltaT[faceI]);
corDeltaT[neighbour[faceI]] =
corDeltaT[neighbour[faceI]] =
max(corDeltaT[neighbour[faceI]], cofrDeltaT[faceI]);
}
......@@ -127,7 +127,7 @@ tmp<surfaceScalarField> CoEulerDdtScheme<Type>::CofrDeltaT() const
const volScalarField& rho =
static_cast<const objectRegistry&>(mesh())
.lookupObject<volScalarField>(rhoName_).oldTime();
surfaceScalarField Co
(
mesh().surfaceInterpolation::deltaCoeffs()
......@@ -369,7 +369,7 @@ template<class Type>
tmp<fvMatrix<Type> >
CoEulerDdtScheme<Type>::fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -386,7 +386,7 @@ CoEulerDdtScheme<Type>::fvmDdt
scalarField rDeltaT = CorDeltaT()().internalField();
fvm.diag() = rDeltaT*mesh().V();
if (mesh().moving())
{
fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V0();
......@@ -405,7 +405,7 @@ tmp<fvMatrix<Type> >
CoEulerDdtScheme<Type>::fvmDdt
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -421,7 +421,7 @@ CoEulerDdtScheme<Type>::fvmDdt
scalarField rDeltaT = CorDeltaT()().internalField();
fvm.diag() = rDeltaT*rho.value()*mesh().V();
if (mesh().moving())
{
fvm.source() = rDeltaT
......@@ -442,7 +442,7 @@ tmp<fvMatrix<Type> >
CoEulerDdtScheme<Type>::fvmDdt
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -588,7 +588,7 @@ CoEulerDdtScheme<Type>::fvcDdtPhiCorr
)
);
}
else if
else if
(
U.dimensions() == dimVelocity
&& phi.dimensions() == dimDensity*dimVelocity*dimArea
......@@ -617,7 +617,7 @@ CoEulerDdtScheme<Type>::fvcDdtPhiCorr
)
);
}
else if
else if
(
U.dimensions() == dimDensity*dimVelocity
&& phi.dimensions() == dimDensity*dimVelocity*dimArea
......
......@@ -142,19 +142,19 @@ public:
tmp<fvMatrix<Type> > fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmDdt
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmDdt
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;
......
......@@ -625,7 +625,7 @@ template<class Type>
tmp<fvMatrix<Type> >
CrankNicholsonDdtScheme<Type>::fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
DDt0Field<GeometricField<Type, fvPatchField, volMesh> >& ddt0 =
......@@ -709,7 +709,7 @@ tmp<fvMatrix<Type> >
CrankNicholsonDdtScheme<Type>::fvmDdt
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
DDt0Field<GeometricField<Type, fvPatchField, volMesh> >& ddt0 =
......@@ -791,7 +791,7 @@ tmp<fvMatrix<Type> >
CrankNicholsonDdtScheme<Type>::fvmDdt
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
DDt0Field<GeometricField<Type, fvPatchField, volMesh> >& ddt0 =
......
......@@ -90,7 +90,7 @@ class CrankNicholsonDdtScheme
//- Return the start-time index
label startTimeIndex() const;
//- Cast to the underlying GeoField
GeoField& operator()();
......@@ -213,19 +213,19 @@ public:
tmp<fvMatrix<Type> > fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmDdt
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmDdt
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;
......
......@@ -262,7 +262,7 @@ template<class Type>
tmp<fvMatrix<Type> >
EulerDdtScheme<Type>::fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -298,7 +298,7 @@ tmp<fvMatrix<Type> >
EulerDdtScheme<Type>::fvmDdt
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -335,7 +335,7 @@ tmp<fvMatrix<Type> >
EulerDdtScheme<Type>::fvmDdt
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......
......@@ -120,19 +120,19 @@ public:
tmp<fvMatrix<Type> > fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmDdt
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmDdt
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;
......
......@@ -21,7 +21,7 @@ License
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
\*---------------------------------------------------------------------------*/
#include "SLTSDdtScheme.H"
......@@ -369,7 +369,7 @@ template<class Type>
tmp<fvMatrix<Type> >
SLTSDdtScheme<Type>::fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -388,7 +388,7 @@ SLTSDdtScheme<Type>::fvmDdt
Info<< "max/min rDeltaT " << max(rDeltaT) << " " << min(rDeltaT) << endl;
fvm.diag() = rDeltaT*mesh().V();
if (mesh().moving())
{
fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V0();
......@@ -407,7 +407,7 @@ tmp<fvMatrix<Type> >
SLTSDdtScheme<Type>::fvmDdt
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -423,7 +423,7 @@ SLTSDdtScheme<Type>::fvmDdt
scalarField rDeltaT = SLrDeltaT()().internalField();
fvm.diag() = rDeltaT*rho.value()*mesh().V();
if (mesh().moving())
{
fvm.source() = rDeltaT
......@@ -444,7 +444,7 @@ tmp<fvMatrix<Type> >
SLTSDdtScheme<Type>::fvmDdt
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
......@@ -590,7 +590,7 @@ SLTSDdtScheme<Type>::fvcDdtPhiCorr
)
);
}
else if
else if
(
U.dimensions() == dimVelocity
&& phi.dimensions() == dimDensity*dimVelocity*dimArea
......@@ -619,7 +619,7 @@ SLTSDdtScheme<Type>::fvcDdtPhiCorr
)
);
}
else if
else if
(
U.dimensions() == dimDensity*dimVelocity
&& phi.dimensions() == dimDensity*dimVelocity*dimArea
......
......@@ -143,19 +143,19 @@ public:
tmp<fvMatrix<Type> > fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmDdt
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<fvMatrix<Type> > fvmDdt
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);