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.
This commit is contained in:
henry
2009-10-26 14:01:39 +00:00
parent d6a278f2b2
commit 00cd6ac8b7
75 changed files with 859 additions and 590 deletions

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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];

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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>&
);
};

View File

@ -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;
};

View File

@ -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

View File

@ -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>&
);
};

View File

@ -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

View File

@ -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;

View File

@ -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 =

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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>&
);
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;

View File

@ -361,7 +361,7 @@ template<class Type>
tmp<fvMatrix<Type> >
backwardDdtScheme<Type>::fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
@ -413,7 +413,7 @@ tmp<fvMatrix<Type> >
backwardDdtScheme<Type>::fvmDdt
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
@ -464,7 +464,7 @@ tmp<fvMatrix<Type> >
backwardDdtScheme<Type>::fvmDdt
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm

View File

@ -131,19 +131,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;

View File

@ -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 "boundedBackwardDdtScheme.H"
@ -413,7 +413,7 @@ boundedBackwardDdtScheme::fvcDdt
tmp<fvScalarMatrix>
boundedBackwardDdtScheme::fvmDdt
(
volScalarField& vf
const volScalarField& vf
)
{
tmp<fvScalarMatrix> tfvm
@ -484,7 +484,7 @@ tmp<fvScalarMatrix>
boundedBackwardDdtScheme::fvmDdt
(
const dimensionedScalar& rho,
volScalarField& vf
const volScalarField& vf
)
{
tmp<fvScalarMatrix> tfvm
@ -554,7 +554,7 @@ tmp<fvScalarMatrix>
boundedBackwardDdtScheme::fvmDdt
(
const volScalarField& rho,
volScalarField& vf
const volScalarField& vf
)
{
tmp<fvScalarMatrix> tfvm

View File

@ -142,19 +142,19 @@ public:
tmp<fvScalarMatrix> fvmDdt
(
volScalarField&
const volScalarField&
);
tmp<fvScalarMatrix> fvmDdt
(
const dimensionedScalar&,
volScalarField&
const volScalarField&
);
tmp<fvScalarMatrix> fvmDdt
(
const volScalarField&,
volScalarField&
const volScalarField&
);
tmp<surfaceScalarField> fvcDdtPhiCorr

View File

@ -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 "boundedBackwardDdtScheme.H"

View File

@ -164,19 +164,19 @@ public:
virtual tmp<fvMatrix<Type> > fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
) = 0;
virtual tmp<fvMatrix<Type> > fvmDdt
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
) = 0;
virtual tmp<fvMatrix<Type> > fvmDdt
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
) = 0;

View File

@ -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 "steadyStateDdtScheme.H"
@ -162,7 +162,7 @@ template<class Type>
tmp<fvMatrix<Type> >
steadyStateDdtScheme<Type>::fvmDdt
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
@ -183,7 +183,7 @@ tmp<fvMatrix<Type> >
steadyStateDdtScheme<Type>::fvmDdt
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm
@ -204,7 +204,7 @@ tmp<fvMatrix<Type> >
steadyStateDdtScheme<Type>::fvmDdt
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm

View File

@ -119,19 +119,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;

View File

@ -54,7 +54,7 @@ grad
const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
)
{
return fv::gaussGrad<Type>::grad(ssf);
return fv::gaussGrad<Type>::gradf(ssf, "grad(" + ssf.name() + ')');
}
@ -99,7 +99,7 @@ grad
(
vf.mesh(),
vf.mesh().gradScheme(name)
)().grad(vf);
)().grad(vf, name);
}

View File

@ -22,9 +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 "volFields.H"
@ -48,7 +45,7 @@ template<class Type>
tmp<fvMatrix<Type> >
d2dt2
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fv::d2dt2Scheme<Type>::New
@ -64,7 +61,7 @@ tmp<fvMatrix<Type> >
d2dt2
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fv::d2dt2Scheme<Type>::New
@ -80,7 +77,7 @@ tmp<fvMatrix<Type> >
d2dt2
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fv::d2dt2Scheme<Type>::New

View File

@ -54,20 +54,20 @@ namespace fvm
tmp<fvMatrix<Type> > d2dt2
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > d2dt2
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > d2dt2
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
}

View File

@ -45,7 +45,7 @@ template<class Type>
tmp<fvMatrix<Type> >
ddt
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fv::ddtScheme<Type>::New
@ -61,7 +61,7 @@ tmp<fvMatrix<Type> >
ddt
(
const oneField&,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return ddt(vf);
@ -73,7 +73,7 @@ tmp<fvMatrix<Type> >
ddt
(
const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fv::ddtScheme<Type>::New
@ -89,7 +89,7 @@ tmp<fvMatrix<Type> >
ddt
(
const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fv::ddtScheme<Type>::New

View File

@ -54,28 +54,28 @@ namespace fvm
template<class Type>
tmp<fvMatrix<Type> > ddt
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const oneField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > ddt
(
const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
}

View File

@ -22,9 +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 "fvmDiv.H"
@ -49,7 +46,7 @@ tmp<fvMatrix<Type> >
div
(
const surfaceScalarField& flux,
GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name
)
{
@ -66,7 +63,7 @@ tmp<fvMatrix<Type> >
div
(
const tmp<surfaceScalarField>& tflux,
GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name
)
{
@ -81,7 +78,7 @@ tmp<fvMatrix<Type> >
div
(
const surfaceScalarField& flux,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fvm::div(flux, vf, "div("+flux.name()+','+vf.name()+')');
@ -92,7 +89,7 @@ tmp<fvMatrix<Type> >
div
(
const tmp<surfaceScalarField>& tflux,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > Div(fvm::div(tflux(), vf));

View File

@ -56,7 +56,7 @@ namespace fvm
tmp<fvMatrix<Type> > div
(
const surfaceScalarField&,
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const word& name
);
@ -64,7 +64,7 @@ namespace fvm
tmp<fvMatrix<Type> > div
(
const tmp<surfaceScalarField>&,
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const word& name
);
@ -73,14 +73,14 @@ namespace fvm
tmp<fvMatrix<Type> > div
(
const surfaceScalarField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > div
(
const tmp<surfaceScalarField>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
}

View File

@ -45,7 +45,7 @@ template<class Type>
tmp<fvMatrix<Type> >
laplacian
(
GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name
)
{
@ -70,7 +70,7 @@ template<class Type>
tmp<fvMatrix<Type> >
laplacian
(
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
surfaceScalarField Gamma
@ -100,7 +100,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const zeroField&,
GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name
)
{
@ -116,7 +116,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const zeroField&,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return tmp<fvMatrix<Type> >
@ -131,7 +131,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const oneField&,
GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name
)
{
@ -144,7 +144,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const oneField&,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fvm::laplacian(vf);
@ -156,11 +156,11 @@ tmp<fvMatrix<Type> >
laplacian
(
const dimensioned<GType>& gamma,
GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name
)
{
GeometricField<GType, fvsPatchField, surfaceMesh> Gamma
const GeometricField<GType, fvsPatchField, surfaceMesh> Gamma
(
IOobject
(
@ -182,10 +182,10 @@ tmp<fvMatrix<Type> >
laplacian
(
const dimensioned<GType>& gamma,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
GeometricField<GType, fvsPatchField, surfaceMesh> Gamma
const GeometricField<GType, fvsPatchField, surfaceMesh> Gamma
(
IOobject
(
@ -209,7 +209,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const GeometricField<GType, fvPatchField, volMesh>& gamma,
GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name
)
{
@ -226,7 +226,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const tmp<GeometricField<GType, fvPatchField, volMesh> >& tgamma,
GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name
)
{
@ -241,7 +241,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const GeometricField<GType, fvPatchField, volMesh>& gamma,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fvm::laplacian
@ -258,7 +258,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const tmp<GeometricField<GType, fvPatchField, volMesh> >& tgamma,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > Laplacian(fvm::laplacian(tgamma(), vf));
@ -274,7 +274,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma,
GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name
)
{
@ -291,7 +291,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const tmp<GeometricField<GType, fvsPatchField, surfaceMesh> >& tgamma,
GeometricField<Type, fvPatchField, volMesh>& vf,
const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name
)
{
@ -306,7 +306,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fvm::laplacian
@ -323,7 +323,7 @@ tmp<fvMatrix<Type> >
laplacian
(
const tmp<GeometricField<GType, fvsPatchField, surfaceMesh> >& tGamma,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm(fvm::laplacian(tGamma(), vf));

View File

@ -55,14 +55,14 @@ namespace fvm
template<class Type>
tmp<fvMatrix<Type> > laplacian
(
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const word&
);
template<class Type>
tmp<fvMatrix<Type> > laplacian
(
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
@ -70,7 +70,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const zeroField&,
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const word&
);
@ -78,7 +78,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const zeroField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
@ -86,7 +86,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const oneField&,
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const word&
);
@ -94,7 +94,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const oneField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
@ -102,7 +102,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const dimensioned<GType>&,
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const word&
);
@ -110,7 +110,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const dimensioned<GType>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
@ -118,7 +118,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const GeometricField<GType, fvPatchField, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const word&
);
@ -126,7 +126,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const GeometricField<GType, fvPatchField, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
@ -134,7 +134,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const tmp<GeometricField<GType, fvPatchField, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const word&
);
@ -142,7 +142,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const tmp<GeometricField<GType, fvPatchField, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
@ -150,7 +150,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>&,
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const word&
);
@ -158,7 +158,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const tmp<GeometricField<GType, fvsPatchField, surfaceMesh> >&,
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const word&
);
@ -166,14 +166,14 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type, class GType>
tmp<fvMatrix<Type> > laplacian
(
const tmp<GeometricField<GType, fvsPatchField, surfaceMesh> >&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
}

View File

@ -35,7 +35,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Su
(
const DimensionedField<Type, volMesh>& su,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
@ -60,7 +60,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Su
(
const tmp<DimensionedField<Type, volMesh> >& tsu,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm = fvm::Su(tsu(), vf);
@ -73,7 +73,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Su
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm = fvm::Su(tsu(), vf);
@ -86,7 +86,7 @@ Foam::zeroField
Foam::fvm::Su
(
const zeroField&,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return zeroField();
@ -98,7 +98,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Sp
(
const DimensionedField<scalar, volMesh>& sp,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
@ -123,7 +123,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Sp
(
const tmp<DimensionedField<scalar, volMesh> >& tsp,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm = fvm::Sp(tsp(), vf);
@ -136,7 +136,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Sp
(
const tmp<volScalarField>& tsp,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm = fvm::Sp(tsp(), vf);
@ -150,7 +150,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Sp
(
const dimensionedScalar& sp,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
@ -175,7 +175,7 @@ Foam::zeroField
Foam::fvm::Sp
(
const zeroField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
)
{
return zeroField();
@ -187,7 +187,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::SuSp
(
const DimensionedField<scalar, volMesh>& susp,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = vf.mesh();
@ -215,7 +215,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::SuSp
(
const tmp<DimensionedField<scalar, volMesh> >& tsusp,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm = fvm::SuSp(tsusp(), vf);
@ -228,7 +228,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::SuSp
(
const tmp<volScalarField>& tsusp,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<fvMatrix<Type> > tfvm = fvm::SuSp(tsusp(), vf);
@ -241,7 +241,7 @@ Foam::zeroField
Foam::fvm::SuSp
(
const zeroField&,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return zeroField();

View File

@ -56,28 +56,28 @@ namespace fvm
tmp<fvMatrix<Type> > Su
(
const DimensionedField<Type, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > Su
(
const tmp<DimensionedField<Type, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > Su
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
zeroField Su
(
const zeroField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
@ -87,21 +87,21 @@ namespace fvm
tmp<fvMatrix<Type> > Sp
(
const DimensionedField<scalar, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > Sp
(
const tmp<DimensionedField<scalar, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > Sp
(
const tmp<volScalarField>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
@ -109,7 +109,7 @@ namespace fvm
tmp<fvMatrix<Type> > Sp
(
const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
@ -117,7 +117,7 @@ namespace fvm
zeroField Sp
(
const zeroField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
@ -127,28 +127,28 @@ namespace fvm
tmp<fvMatrix<Type> > SuSp
(
const DimensionedField<scalar, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > SuSp
(
const tmp<DimensionedField<scalar, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
tmp<fvMatrix<Type> > SuSp
(
const tmp<volScalarField>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
template<class Type>
zeroField SuSp
(
const zeroField&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
}

View File

@ -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 "extendedLeastSquaresGrad.H"
@ -35,27 +35,20 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
tmp
Foam::tmp
<
GeometricField
Foam::GeometricField
<
typename outerProduct<vector, Type>::type, fvPatchField, volMesh
typename Foam::outerProduct<Foam::vector, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>
>
extendedLeastSquaresGrad<Type>::grad
Foam::fv::extendedLeastSquaresGrad<Type>::calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>& vsf
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const
{
typedef typename outerProduct<vector, Type>::type GradType;
@ -68,7 +61,7 @@ extendedLeastSquaresGrad<Type>::grad
(
IOobject
(
"grad("+vsf.name()+')',
name,
vsf.instance(),
mesh,
IOobject::NO_READ,
@ -120,7 +113,7 @@ extendedLeastSquaresGrad<Type>::grad
if (vsf.boundaryField()[patchi].coupled())
{
Field<Type> neiVsf =
Field<Type> neiVsf =
vsf.boundaryField()[patchi].patchNeighbourField();
forAll(neiVsf, patchFaceI)
@ -162,12 +155,4 @@ extendedLeastSquaresGrad<Type>::grad
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -102,13 +102,16 @@ public:
// Member Functions
tmp
//- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
> calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const;
};

View File

@ -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 "fourthGrad.H"
@ -35,27 +35,20 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
tmp
Foam::tmp
<
GeometricField
Foam::GeometricField
<
typename outerProduct<vector, Type>::type, fvPatchField, volMesh
typename Foam::outerProduct<Foam::vector, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>
>
fourthGrad<Type>::grad
Foam::fv::fourthGrad<Type>::calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>& vsf
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const
{
// The fourth-order gradient is calculated in two passes. First,
@ -80,7 +73,7 @@ fourthGrad<Type>::grad
(
IOobject
(
"grad("+vsf.name()+')',
name,
vsf.instance(),
mesh,
IOobject::NO_READ,
@ -130,7 +123,7 @@ fourthGrad<Type>::grad
const scalarField& lambdap = lambda.boundaryField()[patchi];
// Build the d-vectors
vectorField pd =
vectorField pd =
mesh.Sf().boundaryField()[patchi]
/(
mesh.magSf().boundaryField()[patchi]
@ -171,12 +164,4 @@ fourthGrad<Type>::grad
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -83,13 +83,16 @@ public:
// Member Functions
tmp
//- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
> calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const;
};

View File

@ -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 "gaussGrad.H"
@ -29,27 +29,20 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
tmp
Foam::tmp
<
GeometricField
Foam::GeometricField
<
typename outerProduct<vector, Type>::type, fvPatchField, volMesh
typename Foam::outerProduct<Foam::vector, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>
>
gaussGrad<Type>::grad
Foam::fv::gaussGrad<Type>::gradf
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf
const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf,
const word& name
)
{
typedef typename outerProduct<vector, Type>::type GradType;
@ -62,7 +55,7 @@ gaussGrad<Type>::grad
(
IOobject
(
"grad("+ssf.name()+')',
name,
ssf.instance(),
mesh,
IOobject::NO_READ,
@ -119,27 +112,29 @@ gaussGrad<Type>::grad
template<class Type>
tmp
Foam::tmp
<
GeometricField
Foam::GeometricField
<
typename outerProduct<vector, Type>::type, fvPatchField, volMesh
typename Foam::outerProduct<Foam::vector, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>
>
gaussGrad<Type>::grad
Foam::fv::gaussGrad<Type>::calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>& vsf
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const
{
typedef typename outerProduct<vector, Type>::type GradType;
tmp<GeometricField<GradType, fvPatchField, volMesh> > tgGrad
(
grad(tinterpScheme_().interpolate(vsf))
gradf(tinterpScheme_().interpolate(vsf), name)
);
GeometricField<GradType, fvPatchField, volMesh>& gGrad = tgGrad();
gGrad.rename("grad(" + vsf.name() + ')');
correctBoundaryConditions(vsf, gGrad);
return tgGrad;
@ -147,7 +142,7 @@ gaussGrad<Type>::grad
template<class Type>
void gaussGrad<Type>::correctBoundaryConditions
void Foam::fv::gaussGrad<Type>::correctBoundaryConditions
(
const GeometricField<Type, fvPatchField, volMesh>& vsf,
GeometricField
@ -174,12 +169,4 @@ void gaussGrad<Type>::correctBoundaryConditions
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -89,7 +89,7 @@ public:
tinterpScheme_(new linear<Type>(mesh))
{}
//- Construct from Istream
//- Construct from mesh and Istream
gaussGrad(const fvMesh& mesh, Istream& is)
:
gradScheme<Type>(mesh),
@ -116,31 +116,31 @@ public:
// Member Functions
//- Return the gradient of the given field
//- Return the gradient of the given field
// calculated using Gauss' theorem on the given surface field
static
tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
> gradf
(
const GeometricField<Type, fvsPatchField, surfaceMesh>&
const GeometricField<Type, fvsPatchField, surfaceMesh>&,
const word& name
);
//- Return the gradient of the given field calculated
// using Gauss' theorem on the interpolated field
tmp
//- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
> calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const;
//- Correct the boundary values of the gradient using the patchField
// snGrad functions
static void correctBoundaryConditions

View File

@ -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 "fvMesh.H"

View File

@ -22,28 +22,16 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Abstract base class for finite volume calculus gradient schemes.
\*---------------------------------------------------------------------------*/
#include "fv.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
#include "objectRegistry.H"
#include "solution.H"
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
template<class Type>
tmp<gradScheme<Type> > gradScheme<Type>::New
Foam::tmp<Foam::fv::gradScheme<Type> > Foam::fv::gradScheme<Type>::New
(
const fvMesh& mesh,
Istream& schemeData
@ -51,7 +39,8 @@ tmp<gradScheme<Type> > gradScheme<Type>::New
{
if (fv::debug)
{
Info<< "gradScheme<Type>::New(Istream& schemeData) : "
Info<< "gradScheme<Type>::New"
"(const fvMesh& mesh, Istream& schemeData) : "
"constructing gradScheme<Type>"
<< endl;
}
@ -60,7 +49,8 @@ tmp<gradScheme<Type> > gradScheme<Type>::New
{
FatalIOErrorIn
(
"gradScheme<Type>::New(Istream& schemeData)",
"gradScheme<Type>::New"
"(const fvMesh& mesh, Istream& schemeData)",
schemeData
) << "Grad scheme not specified" << endl << endl
<< "Valid grad schemes are :" << endl
@ -77,7 +67,8 @@ tmp<gradScheme<Type> > gradScheme<Type>::New
{
FatalIOErrorIn
(
"gradScheme<Type>::New(Istream& schemeData)",
"gradScheme<Type>::New"
"(const fvMesh& mesh, Istream& schemeData)",
schemeData
) << "unknown grad scheme " << schemeName << endl << endl
<< "Valid grad schemes are :" << endl
@ -92,16 +83,153 @@ tmp<gradScheme<Type> > gradScheme<Type>::New
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
gradScheme<Type>::~gradScheme()
Foam::fv::gradScheme<Type>::~gradScheme()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
namespace Foam
{
template<class Type>
inline void cachePrintMessage
(
const char* message,
const word& name,
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
if (solution::debug)
{
Info<< "Cache: " << message << token::SPACE << name
<< ", " << vf.name() << " event No. " << vf.eventNo()
<< endl;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
Foam::tmp
<
Foam::GeometricField
<
typename Foam::outerProduct<Foam::vector, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>
>
Foam::fv::gradScheme<Type>::grad
(
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const
{
typedef typename outerProduct<vector, Type>::type GradType;
typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
if (!this->mesh().changing() && this->mesh().cache(name))
{
if (!mesh().objectRegistry::foundObject<GradFieldType>(name))
{
cachePrintMessage("Caching", name, vsf);
tmp<GradFieldType> tgGrad = calcGrad(vsf, name);
regIOobject::store(tgGrad.ptr());
}
cachePrintMessage("Retreiving", name, vsf);
GradFieldType& gGrad = const_cast<GradFieldType&>
(
mesh().objectRegistry::lookupObject<GradFieldType>(name)
);
if (gGrad.upToDate(vsf))
{
return gGrad;
}
else
{
cachePrintMessage("Deleting", name, vsf);
gGrad.release();
delete &gGrad;
cachePrintMessage("Recalculating", name, vsf);
tmp<GradFieldType> tgGrad = calcGrad(vsf, name);
cachePrintMessage("Storing", name, vsf);
regIOobject::store(tgGrad.ptr());
GradFieldType& gGrad = const_cast<GradFieldType&>
(
mesh().objectRegistry::lookupObject<GradFieldType>(name)
);
return gGrad;
}
}
else
{
if (mesh().objectRegistry::foundObject<GradFieldType>(name))
{
cachePrintMessage("Retreiving", name, vsf);
GradFieldType& gGrad = const_cast<GradFieldType&>
(
mesh().objectRegistry::lookupObject<GradFieldType>(name)
);
if (gGrad.ownedByRegistry())
{
cachePrintMessage("Deleting", name, vsf);
gGrad.release();
delete &gGrad;
}
}
cachePrintMessage("Calculating", name, vsf);
return calcGrad(vsf, name);
}
}
template<class Type>
Foam::tmp
<
Foam::GeometricField
<
typename Foam::outerProduct<Foam::vector, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>
>
Foam::fv::gradScheme<Type>::grad
(
const GeometricField<Type, fvPatchField, volMesh>& vsf
) const
{
return grad(vsf, "grad(" + vsf.name() + ')');
}
template<class Type>
Foam::tmp
<
Foam::GeometricField
<
typename Foam::outerProduct<Foam::vector, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>
>
Foam::fv::gradScheme<Type>::grad
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvsf
) const
{
typedef typename outerProduct<vector, Type>::type GradType;
typedef GeometricField<GradType, fvPatchField, volMesh> GradFieldType;
tmp<GradFieldType> tgrad = grad(tvsf());
tvsf.clear();
return tgrad;
}
} // End namespace Foam
// ************************************************************************* //

View File

@ -114,9 +114,8 @@ public:
);
// Destructor
virtual ~gradScheme();
//- Destructor
virtual ~gradScheme();
// Member Functions
@ -127,15 +126,54 @@ public:
return mesh_;
}
//- Calculate and return the grad of the given field
//- Calculate and return the grad of the given field.
// Used by grad either to recalculate the cached gradient when it is
// out of date with respect to the field or when it is not cached.
virtual tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>&,
const word& name
) const = 0;
//- Calculate and return the grad of the given field
// which may have been cached
tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
(
const GeometricField<Type, fvPatchField, volMesh>&,
const word& name
) const;
//- Calculate and return the grad of the given field
// with the default name
// which may have been cached
tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
(
const GeometricField<Type, fvPatchField, volMesh>&
) const = 0;
) const;
//- Calculate and return the grad of the given field
// with the default name
// which may have been cached
tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
(
const tmp<GeometricField<Type, fvPatchField, volMesh> >&
) const;
};

View File

@ -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 "leastSquaresGrad.H"
@ -35,27 +35,20 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
tmp
Foam::tmp
<
GeometricField
Foam::GeometricField
<
typename outerProduct<vector, Type>::type, fvPatchField, volMesh
typename Foam::outerProduct<Foam::vector, Type>::type,
Foam::fvPatchField,
Foam::volMesh
>
>
leastSquaresGrad<Type>::grad
Foam::fv::leastSquaresGrad<Type>::calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>& vsf
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const
{
typedef typename outerProduct<vector, Type>::type GradType;
@ -68,7 +61,7 @@ leastSquaresGrad<Type>::grad
(
IOobject
(
"grad("+vsf.name()+')',
name,
vsf.instance(),
mesh,
IOobject::NO_READ,
@ -116,7 +109,7 @@ leastSquaresGrad<Type>::grad
if (vsf.boundaryField()[patchi].coupled())
{
Field<Type> neiVsf =
Field<Type> neiVsf =
vsf.boundaryField()[patchi].patchNeighbourField();
forAll(neiVsf, patchFaceI)
@ -147,12 +140,4 @@ leastSquaresGrad<Type>::grad
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -89,13 +89,16 @@ public:
// Member Functions
tmp
//- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
> calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const;
};

View File

@ -117,18 +117,82 @@ public:
const Type& extrapolate
);
tmp
//- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
> calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const;
};
// * * * * * * * * * * * * Inline Member Function * * * * * * * * * * * * * //
template<>
inline void cellLimitedGrad<scalar>::limitFace
(
scalar& limiter,
const scalar& maxDelta,
const scalar& minDelta,
const scalar& extrapolate
)
{
if (extrapolate > maxDelta + VSMALL)
{
limiter = min(limiter, maxDelta/extrapolate);
}
else if (extrapolate < minDelta - VSMALL)
{
limiter = min(limiter, minDelta/extrapolate);
}
}
template<class Type>
inline void cellLimitedGrad<Type>::limitFace
(
Type& limiter,
const Type& maxDelta,
const Type& minDelta,
const Type& extrapolate
)
{
for(direction cmpt=0; cmpt<Type::nComponents; cmpt++)
{
cellLimitedGrad<scalar>::limitFace
(
limiter.component(cmpt),
maxDelta.component(cmpt),
minDelta.component(cmpt),
extrapolate.component(cmpt)
);
}
}
// * * * * * * * * Template Member Function Specialisations * * * * * * * * //
template<>
tmp<volVectorField> cellLimitedGrad<scalar>::calcGrad
(
const volScalarField& vsf,
const word& name
) const;
template<>
tmp<volTensorField> cellLimitedGrad<vector>::calcGrad
(
const volVectorField& vsf,
const word& name
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View File

@ -36,70 +36,25 @@ License
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvGradScheme(cellLimitedGrad)
makeFvGradScheme(cellLimitedGrad)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
inline void cellLimitedGrad<scalar>::limitFace
Foam::tmp<Foam::volVectorField>
Foam::fv::cellLimitedGrad<Foam::scalar>::calcGrad
(
scalar& limiter,
const scalar& maxDelta,
const scalar& minDelta,
const scalar& extrapolate
)
{
if (extrapolate > maxDelta + VSMALL)
{
limiter = min(limiter, maxDelta/extrapolate);
}
else if (extrapolate < minDelta - VSMALL)
{
limiter = min(limiter, minDelta/extrapolate);
}
}
template<class Type>
inline void cellLimitedGrad<Type>::limitFace
(
Type& limiter,
const Type& maxDelta,
const Type& minDelta,
const Type& extrapolate
)
{
for(direction cmpt=0; cmpt<Type::nComponents; cmpt++)
{
cellLimitedGrad<scalar>::limitFace
(
limiter.component(cmpt),
maxDelta.component(cmpt),
minDelta.component(cmpt),
extrapolate.component(cmpt)
);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
tmp<volVectorField> cellLimitedGrad<scalar>::grad
(
const volScalarField& vsf
const volScalarField& vsf,
const word& name
) const
{
const fvMesh& mesh = vsf.mesh();
tmp<volVectorField> tGrad = basicGradScheme_().grad(vsf);
tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL)
{
@ -244,14 +199,16 @@ tmp<volVectorField> cellLimitedGrad<scalar>::grad
template<>
tmp<volTensorField> cellLimitedGrad<vector>::grad
Foam::tmp<Foam::volTensorField>
Foam::fv::cellLimitedGrad<Foam::vector>::calcGrad
(
const volVectorField& vsf
const volVectorField& vsf,
const word& name
) const
{
const fvMesh& mesh = vsf.mesh();
tmp<volTensorField> tGrad = basicGradScheme_().grad(vsf);
tmp<volTensorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL)
{
@ -402,12 +359,4 @@ tmp<volTensorField> cellLimitedGrad<vector>::grad
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -117,13 +117,16 @@ public:
const vector& dcf
);
tmp
//- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
> calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const;
};
@ -178,6 +181,24 @@ inline void cellMDLimitedGrad<Type>::limitFace
}
// * * * * * * * * Template Member Function Specialisations * * * * * * * * //
template<>
tmp<volVectorField> cellMDLimitedGrad<scalar>::calcGrad
(
const volScalarField& vsf,
const word& name
) const;
template<>
tmp<volTensorField> cellMDLimitedGrad<vector>::calcGrad
(
const volVectorField& vsf,
const word& name
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View File

@ -36,27 +36,26 @@ License
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
makeFvGradScheme(cellMDLimitedGrad)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvGradScheme(cellMDLimitedGrad)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
tmp<volVectorField> cellMDLimitedGrad<scalar>::grad
Foam::tmp<Foam::volVectorField>
Foam::fv::cellMDLimitedGrad<Foam::scalar>::calcGrad
(
const volScalarField& vsf
const volScalarField& vsf,
const word& name
) const
{
const fvMesh& mesh = vsf.mesh();
tmp<volVectorField> tGrad = basicGradScheme_().grad(vsf);
tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL)
{
@ -190,14 +189,16 @@ tmp<volVectorField> cellMDLimitedGrad<scalar>::grad
template<>
tmp<volTensorField> cellMDLimitedGrad<vector>::grad
Foam::tmp<Foam::volTensorField>
Foam::fv::cellMDLimitedGrad<Foam::vector>::calcGrad
(
const volVectorField& vsf
const volVectorField& vsf,
const word& name
) const
{
const fvMesh& mesh = vsf.mesh();
tmp<volTensorField> tGrad = basicGradScheme_().grad(vsf);
tmp<volTensorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL)
{
@ -329,12 +330,4 @@ tmp<volTensorField> cellMDLimitedGrad<vector>::grad
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -118,17 +118,63 @@ public:
// Member Functions
tmp
//- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
> calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>&
) const;
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const
{
return grad(vsf);
}
};
// * * * * * * * * * * * * Inline Member Function * * * * * * * * * * * * * //
template<class Type>
inline void faceLimitedGrad<Type>::limitFace
(
scalar& limiter,
const scalar maxDelta,
const scalar minDelta,
const scalar extrapolate
) const
{
if (extrapolate > maxDelta + VSMALL)
{
limiter = min(limiter, maxDelta/extrapolate);
}
else if (extrapolate < minDelta - VSMALL)
{
limiter = min(limiter, minDelta/extrapolate);
}
}
// * * * * * * * * Template Member Function Specialisations * * * * * * * * //
template<>
tmp<volVectorField> faceLimitedGrad<scalar>::calcGrad
(
const volScalarField& vsf,
const word& name
) const;
template<>
tmp<volTensorField> faceLimitedGrad<vector>::calcGrad
(
const volVectorField& vsf,
const word& name
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View File

@ -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 "faceLimitedGrad.H"
@ -36,49 +36,26 @@ License
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvGradScheme(faceLimitedGrad)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
inline void faceLimitedGrad<Type>::limitFace
(
scalar& limiter,
const scalar maxDelta,
const scalar minDelta,
const scalar extrapolate
) const
{
if (extrapolate > maxDelta + VSMALL)
{
limiter = min(limiter, maxDelta/extrapolate);
}
else if (extrapolate < minDelta - VSMALL)
{
limiter = min(limiter, minDelta/extrapolate);
}
makeFvGradScheme(faceLimitedGrad)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<>
tmp<volVectorField> faceLimitedGrad<scalar>::grad
Foam::tmp<Foam::volVectorField>
Foam::fv::faceLimitedGrad<Foam::scalar>::calcGrad
(
const volScalarField& vsf
const volScalarField& vsf,
const word& name
) const
{
const fvMesh& mesh = vsf.mesh();
tmp<volVectorField> tGrad = basicGradScheme_().grad(vsf);
tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL)
{
@ -205,14 +182,16 @@ tmp<volVectorField> faceLimitedGrad<scalar>::grad
template<>
tmp<volTensorField> faceLimitedGrad<vector>::grad
Foam::tmp<Foam::volTensorField>
Foam::fv::faceLimitedGrad<Foam::vector>::calcGrad
(
const volVectorField& vvf
const volVectorField& vvf,
const word& name
) const
{
const fvMesh& mesh = vvf.mesh();
tmp<volTensorField> tGrad = basicGradScheme_().grad(vvf);
tmp<volTensorField> tGrad = basicGradScheme_().calcGrad(vvf, name);
if (k_ < SMALL)
{
@ -363,12 +342,4 @@ tmp<volTensorField> faceLimitedGrad<vector>::grad
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -118,17 +118,38 @@ public:
// Member Functions
tmp
//- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
<
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad
> calcGrad
(
const GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const;
};
// * * * * * * * * Template Member Function Specialisations * * * * * * * * //
template<>
tmp<volVectorField> faceMDLimitedGrad<scalar>::calcGrad
(
const volScalarField& vsf,
const word& name
) const;
template<>
tmp<volTensorField> faceMDLimitedGrad<vector>::calcGrad
(
const volVectorField& vsf,
const word& name
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View File

@ -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 "faceMDLimitedGrad.H"
@ -37,28 +37,25 @@ License
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
makeFvGradScheme(faceMDLimitedGrad)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvGradScheme(faceMDLimitedGrad)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// FaceLimited scalar gradient
template<>
tmp<volVectorField> faceMDLimitedGrad<scalar>::grad
Foam::tmp<Foam::volVectorField>
Foam::fv::faceMDLimitedGrad<Foam::scalar>::calcGrad
(
const volScalarField& vsf
const volScalarField& vsf,
const word& name
) const
{
const fvMesh& mesh = vsf.mesh();
tmp<volVectorField> tGrad = basicGradScheme_().grad(vsf);
tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL)
{
@ -189,14 +186,16 @@ tmp<volVectorField> faceMDLimitedGrad<scalar>::grad
template<>
tmp<volTensorField> faceMDLimitedGrad<vector>::grad
Foam::tmp<Foam::volTensorField>
Foam::fv::faceMDLimitedGrad<Foam::vector>::calcGrad
(
const volVectorField& vvf
const volVectorField& vvf,
const word& name
) const
{
const fvMesh& mesh = vvf.mesh();
tmp<volTensorField> tGrad = basicGradScheme_().grad(vvf);
tmp<volTensorField> tGrad = basicGradScheme_().calcGrad(vvf, name);
if (k_ < SMALL)
{
@ -327,12 +326,4 @@ tmp<volTensorField> faceMDLimitedGrad<vector>::grad
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -47,7 +47,7 @@ tmp<fvMatrix<Type> >
gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected
(
const surfaceScalarField& gammaMagSf,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
tmp<surfaceScalarField> tdeltaCoeffs =
@ -67,9 +67,9 @@ gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected
fvm.upper() = deltaCoeffs.internalField()*gammaMagSf.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& patchGamma =
gammaMagSf.boundaryField()[patchI];
@ -149,7 +149,7 @@ tmp<fvMatrix<Type> >
gaussLaplacianScheme<Type, GType>::fvmLaplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
const fvMesh& mesh = this->mesh();

View File

@ -62,7 +62,7 @@ class gaussLaplacianScheme
tmp<fvMatrix<Type> > fvmLaplacianUncorrected
(
const surfaceScalarField& gammaMagSf,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > gammaSnGradCorr
@ -126,7 +126,7 @@ public:
tmp<fvMatrix<Type> > fvmLaplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcLaplacian
@ -146,7 +146,7 @@ template<> \
tmp<fvMatrix<Type> > gaussLaplacianScheme<Type, scalar>::fvmLaplacian \
( \
const GeometricField<scalar, fvsPatchField, surfaceMesh>&, \
GeometricField<Type, fvPatchField, volMesh>& \
const GeometricField<Type, fvPatchField, volMesh>& \
); \
\
template<> \

View File

@ -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 "gaussLaplacianScheme.H"
@ -44,7 +44,7 @@ Foam::tmp<Foam::fvMatrix<Foam::Type> > \
Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvmLaplacian \
( \
const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \
GeometricField<Type, fvPatchField, volMesh>& vf \
const GeometricField<Type, fvPatchField, volMesh>& vf \
) \
{ \
const fvMesh& mesh = this->mesh(); \

View File

@ -102,7 +102,7 @@ tmp<fvMatrix<Type> >
laplacianScheme<Type, GType>::fvmLaplacian
(
const GeometricField<GType, fvPatchField, volMesh>& gamma,
GeometricField<Type, fvPatchField, volMesh>& vf
const GeometricField<Type, fvPatchField, volMesh>& vf
)
{
return fvmLaplacian(tinterpGammaScheme_().interpolate(gamma)(), vf);

View File

@ -173,13 +173,13 @@ public:
virtual tmp<fvMatrix<Type> > fvmLaplacian
(
const GeometricField<GType, fvsPatchField, surfaceMesh>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
) = 0;
virtual tmp<fvMatrix<Type> > fvmLaplacian
(
const GeometricField<GType, fvPatchField, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>&
const GeometricField<Type, fvPatchField, volMesh>&
);
virtual tmp<GeometricField<Type, fvPatchField, volMesh> > fvcLaplacian

View File

@ -22,9 +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
Simple central-difference snGrad scheme with non-orthogonal correction.
\*---------------------------------------------------------------------------*/
#include "correctedSnGrad.H"
@ -34,28 +31,44 @@ Description
#include "fvcGrad.H"
#include "gaussGrad.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
correctedSnGrad<Type>::~correctedSnGrad()
Foam::fv::correctedSnGrad<Type>::~correctedSnGrad()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
correctedSnGrad<Type>::correction
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
Foam::fv::correctedSnGrad<Type>::fullGradCorrection
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
const fvMesh& mesh = this->mesh();
// construct GeometricField<Type, fvsPatchField, surfaceMesh>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tssf =
mesh.correctionVectors()
& linear<typename outerProduct<vector, Type>::type>(mesh).interpolate
(
gradScheme<Type>::New
(
mesh,
mesh.gradScheme(vf.name())
)().grad(vf, "grad(" + vf.name() + ')')
);
tssf().rename("snGradCorr(" + vf.name() + ')');
return tssf;
}
template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
Foam::fv::correctedSnGrad<Type>::correction
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
@ -89,7 +102,7 @@ correctedSnGrad<Type>::correction
mesh.correctionVectors()
& linear
<
typename
typename
outerProduct<vector, typename pTraits<Type>::cmptType>::type
>(mesh).interpolate
(
@ -108,12 +121,4 @@ correctedSnGrad<Type>::correction
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -108,12 +108,36 @@ public:
}
//- Return the explicit correction to the correctedSnGrad
// for the given field
// for the given field using the gradient of the field
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
fullGradCorrection
(
const GeometricField<Type, fvPatchField, volMesh>&
) const;
//- Return the explicit correction to the correctedSnGrad
// for the given field using the gradients of the field components
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
correction(const GeometricField<Type, fvPatchField, volMesh>&) const;
};
// * * * * * * * * Template Member Function Specialisations * * * * * * * * //
template<>
tmp<surfaceScalarField> correctedSnGrad<scalar>::correction
(
const volScalarField& vsf
) const;
template<>
tmp<surfaceVectorField> correctedSnGrad<vector>::correction
(
const volVectorField& vvf
) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv

View File

@ -22,9 +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
Simple central-difference snGrad scheme with non-orthogonal correction.
\*---------------------------------------------------------------------------*/
#include "correctedSnGrad.H"
@ -40,4 +37,27 @@ namespace fv
}
}
template<>
Foam::tmp<Foam::surfaceScalarField>
Foam::fv::correctedSnGrad<Foam::scalar>::correction
(
const volScalarField& vsf
) const
{
return fullGradCorrection(vsf);
}
template<>
Foam::tmp<Foam::surfaceVectorField>
Foam::fv::correctedSnGrad<Foam::vector>::correction
(
const volVectorField& vvf
) const
{
return fullGradCorrection(vvf);
}
// ************************************************************************* //

View File

@ -183,7 +183,7 @@ void Foam::fvMatrix<Type>::addBoundarySource
template<class Type>
Foam::fvMatrix<Type>::fvMatrix
(
GeometricField<Type, fvPatchField, volMesh>& psi,
const GeometricField<Type, fvPatchField, volMesh>& psi,
const dimensionSet& ds
)
:
@ -227,7 +227,13 @@ Foam::fvMatrix<Type>::fvMatrix
);
}
psi_.boundaryField().updateCoeffs();
// Update the boundary coefficients of psi without changing it's event No.
GeometricField<Type, fvPatchField, volMesh>& psiRef =
const_cast<GeometricField<Type, fvPatchField, volMesh>&>(psi_);
label currentStatePsi = psiRef.eventNo();
psiRef.boundaryField().updateCoeffs();
psiRef.eventNo() = currentStatePsi;
}
@ -322,7 +328,7 @@ Foam::fvMatrix<Type>::fvMatrix(const tmp<fvMatrix<Type> >& tfvm)
template<class Type>
Foam::fvMatrix<Type>::fvMatrix
(
GeometricField<Type, fvPatchField, volMesh>& psi,
const GeometricField<Type, fvPatchField, volMesh>& psi,
Istream& is
)
:
@ -404,12 +410,17 @@ void Foam::fvMatrix<Type>::setValues
const unallocLabelList& nei = mesh.neighbour();
scalarField& Diag = diag();
Field<Type>& psi =
const_cast
<
GeometricField<Type, fvPatchField, volMesh>&
>(psi_).internalField();
forAll(cellLabels, i)
{
label celli = cellLabels[i];
psi_[celli] = values[i];
psi[celli] = values[i];
source_[celli] = values[i]*Diag[celli];
if (symmetric() || asymmetric())

View File

@ -117,8 +117,9 @@ public:
// Private data
// Reference to GeometricField<Type, fvPatchField, volMesh>
GeometricField<Type, fvPatchField, volMesh>& psi_;
//- Const reference to GeometricField<Type, fvPatchField, volMesh>
// Converted into a non-const reference at the point of solution.
const GeometricField<Type, fvPatchField, volMesh>& psi_;
//- Dimension set
dimensionSet dimensions_;
@ -237,7 +238,7 @@ public:
//- Construct given a field to solve for
fvMatrix
(
GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, fvPatchField, volMesh>&,
const dimensionSet&
);
@ -245,12 +246,12 @@ public:
fvMatrix(const fvMatrix<Type>&);
//- Construct as copy of tmp<fvMatrix<Type> > deleting argument
# ifdef ConstructFromTmp
#ifdef ConstructFromTmp
fvMatrix(const tmp<fvMatrix<Type> >&);
# endif
#endif
//- Construct from Istream given field to solve for
fvMatrix(GeometricField<Type, fvPatchField, volMesh>&, Istream&);
fvMatrix(const GeometricField<Type, fvPatchField, volMesh>&, Istream&);
// Destructor
@ -267,11 +268,6 @@ public:
return psi_;
}
GeometricField<Type, fvPatchField, volMesh>& psi()
{
return psi_;
}
const dimensionSet& dimensions() const
{
return dimensions_;

View File

@ -63,10 +63,13 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
<< endl;
}
GeometricField<Type, fvPatchField, volMesh>& psi =
const_cast<GeometricField<Type, fvPatchField, volMesh>&>(psi_);
lduMatrix::solverPerformance solverPerfVec
(
"fvMatrix<Type>::solve",
psi_.name()
psi.name()
);
scalarField saveDiag = diag();
@ -82,7 +85,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
(
pow
(
psi_.mesh().solutionD(),
psi.mesh().solutionD(),
pTraits<typename powProduct<Vector<label>, Type::rank>::type>::zero
)
);
@ -93,7 +96,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
// copy field and source
scalarField psiCmpt = psi_.internalField().component(cmpt);
scalarField psiCmpt = psi.internalField().component(cmpt);
addBoundaryDiag(diag(), cmpt);
scalarField sourceCmpt = source.component(cmpt);
@ -109,7 +112,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
);
lduInterfaceFieldPtrsList interfaces =
psi_.boundaryField().interfaces();
psi.boundaryField().interfaces();
// Use the initMatrixInterfaces and updateMatrixInterfaces to correct
// bouCoeffsCmpt for the explicit part of the coupled boundary
@ -137,7 +140,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
// Solver call
solverPerf = lduMatrix::solver::New
(
psi_.name() + pTraits<Type>::componentNames[cmpt],
psi.name() + pTraits<Type>::componentNames[cmpt],
*this,
bouCoeffsCmpt,
intCoeffsCmpt,
@ -156,11 +159,11 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve
solverPerfVec = solverPerf;
}
psi_.internalField().replace(cmpt, psiCmpt);
psi.internalField().replace(cmpt, psiCmpt);
diag() = saveDiag;
}
psi_.correctBoundaryConditions();
psi.correctBoundaryConditions();
return solverPerfVec;
}

View File

@ -99,6 +99,10 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
const dictionary& solverControls
)
{
GeometricField<scalar, fvPatchField, volMesh>& psi =
const_cast<GeometricField<scalar, fvPatchField, volMesh>&>
(fvMat_.psi());
scalarField saveDiag = fvMat_.diag();
fvMat_.addBoundaryDiag(fvMat_.diag(), 0);
@ -108,14 +112,17 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::fvSolver::solve
// assign new solver controls
solver_->read(solverControls);
lduMatrix::solverPerformance solverPerf =
solver_->solve(fvMat_.psi().internalField(), totalSource);
lduMatrix::solverPerformance solverPerf = solver_->solve
(
psi.internalField(),
totalSource
);
solverPerf.print();
fvMat_.diag() = saveDiag;
fvMat_.psi().correctBoundaryConditions();
psi.correctBoundaryConditions();
return solverPerf;
}
@ -134,6 +141,9 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::solve
<< endl;
}
GeometricField<scalar, fvPatchField, volMesh>& psi =
const_cast<GeometricField<scalar, fvPatchField, volMesh>&>(psi_);
scalarField saveDiag = diag();
addBoundaryDiag(diag(), 0);
@ -143,19 +153,19 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Foam::scalar>::solve
// Solver call
lduMatrix::solverPerformance solverPerf = lduMatrix::solver::New
(
psi_.name(),
psi.name(),
*this,
boundaryCoeffs_,
internalCoeffs_,
psi_.boundaryField().interfaces(),
psi.boundaryField().interfaces(),
solverControls
)->solve(psi_.internalField(), totalSource);
)->solve(psi.internalField(), totalSource);
solverPerf.print();
diag() = saveDiag;
psi_.correctBoundaryConditions();
psi.correctBoundaryConditions();
return solverPerf;
}

View File

@ -66,8 +66,10 @@ tmp<surfaceScalarField> LimitedScheme<Type, Limiter, LimitFunc>::limiter
const GeometricField<typename Limiter::phiType, fvPatchField, volMesh>&
lPhi = tlPhi();
GeometricField<typename Limiter::gradPhiType, fvPatchField, volMesh>
gradc(fvc::grad(lPhi));
tmp<GeometricField<typename Limiter::gradPhiType, fvPatchField, volMesh> >
tgradc(fvc::grad(lPhi));
const GeometricField<typename Limiter::gradPhiType, fvPatchField, volMesh>&
gradc = tgradc();
const surfaceScalarField& CDweights = mesh.surfaceInterpolation::weights();
@ -116,7 +118,7 @@ tmp<surfaceScalarField> LimitedScheme<Type, Limiter, LimitFunc>::limiter
gradc.boundaryField()[patchi].patchNeighbourField();
// Build the d-vectors
vectorField pd =
vectorField pd =
mesh.Sf().boundaryField()[patchi]
/(
mesh.magSf().boundaryField()[patchi]

View File

@ -67,9 +67,22 @@ Foam::linearUpwind<Type>::correction
const volVectorField& C = mesh.C();
const surfaceVectorField& Cf = mesh.Cf();
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
gradVf = gradScheme_().grad(vf);
tmp
<
GeometricField
<
typename outerProduct<vector, Type>::type,
fvPatchField,
volMesh
>
> tgradVf = gradScheme_().grad(vf, gradSchemeName_);
const GeometricField
<
typename outerProduct<vector, Type>::type,
fvPatchField,
volMesh
>& gradVf = tgradVf();
forAll(faceFlux, facei)
{
@ -95,7 +108,7 @@ Foam::linearUpwind<Type>::correction
if (pSfCorr.coupled())
{
const unallocLabelList& pOwner =
const unallocLabelList& pOwner =
mesh.boundary()[patchi].faceCells();
const vectorField& pCf = Cf.boundaryField()[patchi];
@ -106,7 +119,7 @@ Foam::linearUpwind<Type>::correction
gradVf.boundaryField()[patchi].patchNeighbourField();
// Build the d-vectors
vectorField pd =
vectorField pd =
mesh.Sf().boundaryField()[patchi]
/(
mesh.magSf().boundaryField()[patchi]
@ -129,7 +142,7 @@ Foam::linearUpwind<Type>::correction
}
else
{
pSfCorr[facei] =
pSfCorr[facei] =
(pCf[facei] - pd[facei] - C[own]) & pGradVfNei[facei];
}
}

View File

@ -56,6 +56,7 @@ class linearUpwind
{
// Private Data
word gradSchemeName_;
tmp<fv::gradScheme<Type> > gradScheme_;
@ -84,6 +85,7 @@ public:
)
:
upwind<Type>(mesh, faceFlux),
gradSchemeName_("grad"),
gradScheme_
(
new fv::gaussGrad<Type>(mesh)
@ -100,12 +102,13 @@ public:
)
:
upwind<Type>(mesh, schemeData),
gradSchemeName_(schemeData),
gradScheme_
(
fv::gradScheme<Type>::New
(
mesh,
schemeData
mesh.gradScheme(gradSchemeName_)
)
)
{}
@ -119,12 +122,13 @@ public:
)
:
upwind<Type>(mesh, faceFlux, schemeData),
gradSchemeName_(schemeData),
gradScheme_
(
fv::gradScheme<Type>::New
(
mesh,
schemeData
mesh.gradScheme(gradSchemeName_)
)
)
{}

View File

@ -74,9 +74,22 @@ Foam::linearUpwindV<Type>::correction
const vectorField& C = mesh.C();
const vectorField& Cf = mesh.Cf();
GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
gradVf = gradScheme_().grad(vf);
tmp
<
GeometricField
<
typename outerProduct<vector, Type>::type,
fvPatchField,
volMesh
>
> tgradVf = gradScheme_().grad(vf, gradSchemeName_);
const GeometricField
<
typename outerProduct<vector, Type>::type,
fvPatchField,
volMesh
>& gradVf = tgradVf();
forAll(faceFlux, facei)
{

View File

@ -56,6 +56,7 @@ class linearUpwindV
{
// Private Data
word gradSchemeName_;
tmp<fv::gradScheme<Type> > gradScheme_;
@ -84,6 +85,7 @@ public:
)
:
upwind<Type>(mesh, faceFlux),
gradSchemeName_("grad"),
gradScheme_
(
new fv::gaussGrad<Type>(mesh)
@ -100,12 +102,13 @@ public:
)
:
upwind<Type>(mesh, schemeData),
gradSchemeName_(schemeData),
gradScheme_
(
fv::gradScheme<Type>::New
(
mesh,
schemeData
mesh.gradScheme(gradSchemeName_)
)
)
{}
@ -119,12 +122,13 @@ public:
)
:
upwind<Type>(mesh, faceFlux, schemeData),
gradSchemeName_(schemeData),
gradScheme_
(
fv::gradScheme<Type>::New
(
mesh,
schemeData
mesh.gradScheme(gradSchemeName_)
)
)
{}