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) if (debug)
{ {
Info<< "Find cache entry for " << name << endl; Info<< "Cache: find entry for " << name << endl;
} }
return cache_.found(name); return cache_.found(name);

View File

@ -285,6 +285,7 @@ $(divSchemes)/gaussDivScheme/gaussDivSchemes.C
gradSchemes = finiteVolume/gradSchemes gradSchemes = finiteVolume/gradSchemes
$(gradSchemes)/gradScheme/gradSchemes.C $(gradSchemes)/gradScheme/gradSchemes.C
$(gradSchemes)/gaussGrad/gaussGrads.C $(gradSchemes)/gaussGrad/gaussGrads.C
$(gradSchemes)/leastSquaresGrad/leastSquaresVectors.C $(gradSchemes)/leastSquaresGrad/leastSquaresVectors.C
$(gradSchemes)/leastSquaresGrad/leastSquaresGrads.C $(gradSchemes)/leastSquaresGrad/leastSquaresGrads.C
$(gradSchemes)/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C $(gradSchemes)/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C

View File

@ -177,7 +177,7 @@ public:
virtual tmp<fvMatrix<Type> > fvmDiv virtual tmp<fvMatrix<Type> > fvmDiv
( (
const surfaceScalarField&, const surfaceScalarField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
) const = 0; ) const = 0;
virtual tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDiv virtual tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDiv

View File

@ -69,7 +69,7 @@ tmp<fvMatrix<Type> >
gaussConvectionScheme<Type>::fvmDiv gaussConvectionScheme<Type>::fvmDiv
( (
const surfaceScalarField& faceFlux, const surfaceScalarField& faceFlux,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) const ) const
{ {
tmp<surfaceScalarField> tweights = tinterpScheme_().weights(vf); tmp<surfaceScalarField> tweights = tinterpScheme_().weights(vf);
@ -89,9 +89,9 @@ gaussConvectionScheme<Type>::fvmDiv
fvm.upper() = fvm.lower() + faceFlux.internalField(); fvm.upper() = fvm.lower() + faceFlux.internalField();
fvm.negSumDiag(); 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& patchFlux = faceFlux.boundaryField()[patchI];
const fvsPatchScalarField& pw = weights.boundaryField()[patchI]; const fvsPatchScalarField& pw = weights.boundaryField()[patchI];

View File

@ -124,7 +124,7 @@ public:
tmp<fvMatrix<Type> > fvmDiv tmp<fvMatrix<Type> > fvmDiv
( (
const surfaceScalarField&, const surfaceScalarField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
) const; ) const;
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDiv tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDiv

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "multivariateGaussConvectionScheme.H" #include "multivariateGaussConvectionScheme.H"
@ -81,7 +79,7 @@ tmp<fvMatrix<Type> >
multivariateGaussConvectionScheme<Type>::fvmDiv multivariateGaussConvectionScheme<Type>::fvmDiv
( (
const surfaceScalarField& faceFlux, const surfaceScalarField& faceFlux,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) const ) const
{ {
return gaussConvectionScheme<Type> return gaussConvectionScheme<Type>

View File

@ -114,7 +114,7 @@ public:
tmp<fvMatrix<Type> > fvmDiv tmp<fvMatrix<Type> > fvmDiv
( (
const surfaceScalarField&, const surfaceScalarField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
) const; ) const;
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDiv 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 You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "EulerD2dt2Scheme.H" #include "EulerD2dt2Scheme.H"
@ -181,7 +181,7 @@ EulerD2dt2Scheme<Type>::fvcD2dt2
coefft coefft
*(rho.boundaryField() + rho.oldTime().boundaryField()) *(rho.boundaryField() + rho.oldTime().boundaryField())
*vf.boundaryField() *vf.boundaryField()
- ( - (
coefft coefft
*( *(
@ -232,7 +232,7 @@ template<class Type>
tmp<fvMatrix<Type> > tmp<fvMatrix<Type> >
EulerD2dt2Scheme<Type>::fvmD2dt2 EulerD2dt2Scheme<Type>::fvmD2dt2
( (
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -292,7 +292,7 @@ tmp<fvMatrix<Type> >
EulerD2dt2Scheme<Type>::fvmD2dt2 EulerD2dt2Scheme<Type>::fvmD2dt2
( (
const dimensionedScalar& rho, const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -353,7 +353,7 @@ tmp<fvMatrix<Type> >
EulerD2dt2Scheme<Type>::fvmD2dt2 EulerD2dt2Scheme<Type>::fvmD2dt2
( (
const volScalarField& rho, const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm

View File

@ -109,19 +109,19 @@ public:
tmp<fvMatrix<Type> > fvmD2dt2 tmp<fvMatrix<Type> > fvmD2dt2
( (
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmD2dt2 tmp<fvMatrix<Type> > fvmD2dt2
( (
const dimensionedScalar&, const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmD2dt2 tmp<fvMatrix<Type> > fvmD2dt2
( (
const volScalarField&, const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
}; };

View File

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

View File

@ -21,7 +21,7 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "steadyStateD2dt2Scheme.H" #include "steadyStateD2dt2Scheme.H"
@ -107,7 +107,7 @@ template<class Type>
tmp<fvMatrix<Type> > tmp<fvMatrix<Type> >
steadyStateD2dt2Scheme<Type>::fvmD2dt2 steadyStateD2dt2Scheme<Type>::fvmD2dt2
( (
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -128,7 +128,7 @@ tmp<fvMatrix<Type> >
steadyStateD2dt2Scheme<Type>::fvmD2dt2 steadyStateD2dt2Scheme<Type>::fvmD2dt2
( (
const dimensionedScalar& rho, const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -149,7 +149,7 @@ tmp<fvMatrix<Type> >
steadyStateD2dt2Scheme<Type>::fvmD2dt2 steadyStateD2dt2Scheme<Type>::fvmD2dt2
( (
const volScalarField& rho, const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm

View File

@ -108,19 +108,19 @@ public:
tmp<fvMatrix<Type> > fvmD2dt2 tmp<fvMatrix<Type> > fvmD2dt2
( (
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmD2dt2 tmp<fvMatrix<Type> > fvmD2dt2
( (
const dimensionedScalar&, const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmD2dt2 tmp<fvMatrix<Type> > fvmD2dt2
( (
const volScalarField&, 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 You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "CoEulerDdtScheme.H" #include "CoEulerDdtScheme.H"
@ -69,10 +69,10 @@ tmp<volScalarField> CoEulerDdtScheme<Type>::CorDeltaT() const
forAll(owner, faceI) forAll(owner, faceI)
{ {
corDeltaT[owner[faceI]] = corDeltaT[owner[faceI]] =
max(corDeltaT[owner[faceI]], cofrDeltaT[faceI]); max(corDeltaT[owner[faceI]], cofrDeltaT[faceI]);
corDeltaT[neighbour[faceI]] = corDeltaT[neighbour[faceI]] =
max(corDeltaT[neighbour[faceI]], cofrDeltaT[faceI]); max(corDeltaT[neighbour[faceI]], cofrDeltaT[faceI]);
} }
@ -127,7 +127,7 @@ tmp<surfaceScalarField> CoEulerDdtScheme<Type>::CofrDeltaT() const
const volScalarField& rho = const volScalarField& rho =
static_cast<const objectRegistry&>(mesh()) static_cast<const objectRegistry&>(mesh())
.lookupObject<volScalarField>(rhoName_).oldTime(); .lookupObject<volScalarField>(rhoName_).oldTime();
surfaceScalarField Co surfaceScalarField Co
( (
mesh().surfaceInterpolation::deltaCoeffs() mesh().surfaceInterpolation::deltaCoeffs()
@ -369,7 +369,7 @@ template<class Type>
tmp<fvMatrix<Type> > tmp<fvMatrix<Type> >
CoEulerDdtScheme<Type>::fvmDdt CoEulerDdtScheme<Type>::fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -386,7 +386,7 @@ CoEulerDdtScheme<Type>::fvmDdt
scalarField rDeltaT = CorDeltaT()().internalField(); scalarField rDeltaT = CorDeltaT()().internalField();
fvm.diag() = rDeltaT*mesh().V(); fvm.diag() = rDeltaT*mesh().V();
if (mesh().moving()) if (mesh().moving())
{ {
fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V0(); fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V0();
@ -405,7 +405,7 @@ tmp<fvMatrix<Type> >
CoEulerDdtScheme<Type>::fvmDdt CoEulerDdtScheme<Type>::fvmDdt
( (
const dimensionedScalar& rho, const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -421,7 +421,7 @@ CoEulerDdtScheme<Type>::fvmDdt
scalarField rDeltaT = CorDeltaT()().internalField(); scalarField rDeltaT = CorDeltaT()().internalField();
fvm.diag() = rDeltaT*rho.value()*mesh().V(); fvm.diag() = rDeltaT*rho.value()*mesh().V();
if (mesh().moving()) if (mesh().moving())
{ {
fvm.source() = rDeltaT fvm.source() = rDeltaT
@ -442,7 +442,7 @@ tmp<fvMatrix<Type> >
CoEulerDdtScheme<Type>::fvmDdt CoEulerDdtScheme<Type>::fvmDdt
( (
const volScalarField& rho, const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -588,7 +588,7 @@ CoEulerDdtScheme<Type>::fvcDdtPhiCorr
) )
); );
} }
else if else if
( (
U.dimensions() == dimVelocity U.dimensions() == dimVelocity
&& phi.dimensions() == dimDensity*dimVelocity*dimArea && phi.dimensions() == dimDensity*dimVelocity*dimArea
@ -617,7 +617,7 @@ CoEulerDdtScheme<Type>::fvcDdtPhiCorr
) )
); );
} }
else if else if
( (
U.dimensions() == dimDensity*dimVelocity U.dimensions() == dimDensity*dimVelocity
&& phi.dimensions() == dimDensity*dimVelocity*dimArea && phi.dimensions() == dimDensity*dimVelocity*dimArea

View File

@ -142,19 +142,19 @@ public:
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const dimensionedScalar&, const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const volScalarField&, const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType; typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;

View File

@ -625,7 +625,7 @@ template<class Type>
tmp<fvMatrix<Type> > tmp<fvMatrix<Type> >
CrankNicholsonDdtScheme<Type>::fvmDdt CrankNicholsonDdtScheme<Type>::fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
DDt0Field<GeometricField<Type, fvPatchField, volMesh> >& ddt0 = DDt0Field<GeometricField<Type, fvPatchField, volMesh> >& ddt0 =
@ -709,7 +709,7 @@ tmp<fvMatrix<Type> >
CrankNicholsonDdtScheme<Type>::fvmDdt CrankNicholsonDdtScheme<Type>::fvmDdt
( (
const dimensionedScalar& rho, const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
DDt0Field<GeometricField<Type, fvPatchField, volMesh> >& ddt0 = DDt0Field<GeometricField<Type, fvPatchField, volMesh> >& ddt0 =
@ -791,7 +791,7 @@ tmp<fvMatrix<Type> >
CrankNicholsonDdtScheme<Type>::fvmDdt CrankNicholsonDdtScheme<Type>::fvmDdt
( (
const volScalarField& rho, const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
DDt0Field<GeometricField<Type, fvPatchField, volMesh> >& ddt0 = DDt0Field<GeometricField<Type, fvPatchField, volMesh> >& ddt0 =

View File

@ -90,7 +90,7 @@ class CrankNicholsonDdtScheme
//- Return the start-time index //- Return the start-time index
label startTimeIndex() const; label startTimeIndex() const;
//- Cast to the underlying GeoField //- Cast to the underlying GeoField
GeoField& operator()(); GeoField& operator()();
@ -213,19 +213,19 @@ public:
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const dimensionedScalar&, const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const volScalarField&, const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType; typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;

View File

@ -262,7 +262,7 @@ template<class Type>
tmp<fvMatrix<Type> > tmp<fvMatrix<Type> >
EulerDdtScheme<Type>::fvmDdt EulerDdtScheme<Type>::fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -298,7 +298,7 @@ tmp<fvMatrix<Type> >
EulerDdtScheme<Type>::fvmDdt EulerDdtScheme<Type>::fvmDdt
( (
const dimensionedScalar& rho, const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -335,7 +335,7 @@ tmp<fvMatrix<Type> >
EulerDdtScheme<Type>::fvmDdt EulerDdtScheme<Type>::fvmDdt
( (
const volScalarField& rho, const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm

View File

@ -120,19 +120,19 @@ public:
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const dimensionedScalar&, const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const volScalarField&, const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType; 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 You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "SLTSDdtScheme.H" #include "SLTSDdtScheme.H"
@ -369,7 +369,7 @@ template<class Type>
tmp<fvMatrix<Type> > tmp<fvMatrix<Type> >
SLTSDdtScheme<Type>::fvmDdt SLTSDdtScheme<Type>::fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -388,7 +388,7 @@ SLTSDdtScheme<Type>::fvmDdt
Info<< "max/min rDeltaT " << max(rDeltaT) << " " << min(rDeltaT) << endl; Info<< "max/min rDeltaT " << max(rDeltaT) << " " << min(rDeltaT) << endl;
fvm.diag() = rDeltaT*mesh().V(); fvm.diag() = rDeltaT*mesh().V();
if (mesh().moving()) if (mesh().moving())
{ {
fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V0(); fvm.source() = rDeltaT*vf.oldTime().internalField()*mesh().V0();
@ -407,7 +407,7 @@ tmp<fvMatrix<Type> >
SLTSDdtScheme<Type>::fvmDdt SLTSDdtScheme<Type>::fvmDdt
( (
const dimensionedScalar& rho, const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -423,7 +423,7 @@ SLTSDdtScheme<Type>::fvmDdt
scalarField rDeltaT = SLrDeltaT()().internalField(); scalarField rDeltaT = SLrDeltaT()().internalField();
fvm.diag() = rDeltaT*rho.value()*mesh().V(); fvm.diag() = rDeltaT*rho.value()*mesh().V();
if (mesh().moving()) if (mesh().moving())
{ {
fvm.source() = rDeltaT fvm.source() = rDeltaT
@ -444,7 +444,7 @@ tmp<fvMatrix<Type> >
SLTSDdtScheme<Type>::fvmDdt SLTSDdtScheme<Type>::fvmDdt
( (
const volScalarField& rho, const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -590,7 +590,7 @@ SLTSDdtScheme<Type>::fvcDdtPhiCorr
) )
); );
} }
else if else if
( (
U.dimensions() == dimVelocity U.dimensions() == dimVelocity
&& phi.dimensions() == dimDensity*dimVelocity*dimArea && phi.dimensions() == dimDensity*dimVelocity*dimArea
@ -619,7 +619,7 @@ SLTSDdtScheme<Type>::fvcDdtPhiCorr
) )
); );
} }
else if else if
( (
U.dimensions() == dimDensity*dimVelocity U.dimensions() == dimDensity*dimVelocity
&& phi.dimensions() == dimDensity*dimVelocity*dimArea && phi.dimensions() == dimDensity*dimVelocity*dimArea

View File

@ -143,19 +143,19 @@ public:
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const dimensionedScalar&, const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const volScalarField&, const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType; typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;

View File

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

View File

@ -131,19 +131,19 @@ public:
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const dimensionedScalar&, const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const volScalarField&, const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType; 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 You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "boundedBackwardDdtScheme.H" #include "boundedBackwardDdtScheme.H"
@ -413,7 +413,7 @@ boundedBackwardDdtScheme::fvcDdt
tmp<fvScalarMatrix> tmp<fvScalarMatrix>
boundedBackwardDdtScheme::fvmDdt boundedBackwardDdtScheme::fvmDdt
( (
volScalarField& vf const volScalarField& vf
) )
{ {
tmp<fvScalarMatrix> tfvm tmp<fvScalarMatrix> tfvm
@ -484,7 +484,7 @@ tmp<fvScalarMatrix>
boundedBackwardDdtScheme::fvmDdt boundedBackwardDdtScheme::fvmDdt
( (
const dimensionedScalar& rho, const dimensionedScalar& rho,
volScalarField& vf const volScalarField& vf
) )
{ {
tmp<fvScalarMatrix> tfvm tmp<fvScalarMatrix> tfvm
@ -554,7 +554,7 @@ tmp<fvScalarMatrix>
boundedBackwardDdtScheme::fvmDdt boundedBackwardDdtScheme::fvmDdt
( (
const volScalarField& rho, const volScalarField& rho,
volScalarField& vf const volScalarField& vf
) )
{ {
tmp<fvScalarMatrix> tfvm tmp<fvScalarMatrix> tfvm

View File

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

View File

@ -21,7 +21,7 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "boundedBackwardDdtScheme.H" #include "boundedBackwardDdtScheme.H"

View File

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

View File

@ -21,7 +21,7 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "steadyStateDdtScheme.H" #include "steadyStateDdtScheme.H"
@ -162,7 +162,7 @@ template<class Type>
tmp<fvMatrix<Type> > tmp<fvMatrix<Type> >
steadyStateDdtScheme<Type>::fvmDdt steadyStateDdtScheme<Type>::fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -183,7 +183,7 @@ tmp<fvMatrix<Type> >
steadyStateDdtScheme<Type>::fvmDdt steadyStateDdtScheme<Type>::fvmDdt
( (
const dimensionedScalar& rho, const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm
@ -204,7 +204,7 @@ tmp<fvMatrix<Type> >
steadyStateDdtScheme<Type>::fvmDdt steadyStateDdtScheme<Type>::fvmDdt
( (
const volScalarField& rho, const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm tmp<fvMatrix<Type> > tfvm

View File

@ -119,19 +119,19 @@ public:
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const dimensionedScalar&, const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
tmp<fvMatrix<Type> > fvmDdt tmp<fvMatrix<Type> > fvmDdt
( (
const volScalarField&, const volScalarField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType; typedef typename ddtScheme<Type>::fluxFieldType fluxFieldType;

View File

@ -54,7 +54,7 @@ grad
const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf 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(),
vf.mesh().gradScheme(name) 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, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "volFields.H" #include "volFields.H"
@ -48,7 +45,7 @@ template<class Type>
tmp<fvMatrix<Type> > tmp<fvMatrix<Type> >
d2dt2 d2dt2
( (
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
return fv::d2dt2Scheme<Type>::New return fv::d2dt2Scheme<Type>::New
@ -64,7 +61,7 @@ tmp<fvMatrix<Type> >
d2dt2 d2dt2
( (
const dimensionedScalar& rho, const dimensionedScalar& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
return fv::d2dt2Scheme<Type>::New return fv::d2dt2Scheme<Type>::New
@ -80,7 +77,7 @@ tmp<fvMatrix<Type> >
d2dt2 d2dt2
( (
const volScalarField& rho, const volScalarField& rho,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
return fv::d2dt2Scheme<Type>::New return fv::d2dt2Scheme<Type>::New

View File

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

View File

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

View File

@ -54,28 +54,28 @@ namespace fvm
template<class Type> template<class Type>
tmp<fvMatrix<Type> > ddt tmp<fvMatrix<Type> > ddt
( (
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
tmp<fvMatrix<Type> > ddt tmp<fvMatrix<Type> > ddt
( (
const oneField&, const oneField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
tmp<fvMatrix<Type> > ddt tmp<fvMatrix<Type> > ddt
( (
const dimensionedScalar&, const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
tmp<fvMatrix<Type> > ddt tmp<fvMatrix<Type> > ddt
( (
const volScalarField&, 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, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvmDiv.H" #include "fvmDiv.H"
@ -49,7 +46,7 @@ tmp<fvMatrix<Type> >
div div
( (
const surfaceScalarField& flux, const surfaceScalarField& flux,
GeometricField<Type, fvPatchField, volMesh>& vf, const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name const word& name
) )
{ {
@ -66,7 +63,7 @@ tmp<fvMatrix<Type> >
div div
( (
const tmp<surfaceScalarField>& tflux, const tmp<surfaceScalarField>& tflux,
GeometricField<Type, fvPatchField, volMesh>& vf, const GeometricField<Type, fvPatchField, volMesh>& vf,
const word& name const word& name
) )
{ {
@ -81,7 +78,7 @@ tmp<fvMatrix<Type> >
div div
( (
const surfaceScalarField& flux, const surfaceScalarField& flux,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
return fvm::div(flux, vf, "div("+flux.name()+','+vf.name()+')'); return fvm::div(flux, vf, "div("+flux.name()+','+vf.name()+')');
@ -92,7 +89,7 @@ tmp<fvMatrix<Type> >
div div
( (
const tmp<surfaceScalarField>& tflux, const tmp<surfaceScalarField>& tflux,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > Div(fvm::div(tflux(), vf)); tmp<fvMatrix<Type> > Div(fvm::div(tflux(), vf));

View File

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

View File

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

View File

@ -55,14 +55,14 @@ namespace fvm
template<class Type> template<class Type>
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
GeometricField<Type, fvPatchField, volMesh>&, const GeometricField<Type, fvPatchField, volMesh>&,
const word& const word&
); );
template<class Type> template<class Type>
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
@ -70,7 +70,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const zeroField&, const zeroField&,
GeometricField<Type, fvPatchField, volMesh>&, const GeometricField<Type, fvPatchField, volMesh>&,
const word& const word&
); );
@ -78,7 +78,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const zeroField&, const zeroField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
@ -86,7 +86,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const oneField&, const oneField&,
GeometricField<Type, fvPatchField, volMesh>&, const GeometricField<Type, fvPatchField, volMesh>&,
const word& const word&
); );
@ -94,7 +94,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const oneField&, const oneField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
@ -102,7 +102,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const dimensioned<GType>&, const dimensioned<GType>&,
GeometricField<Type, fvPatchField, volMesh>&, const GeometricField<Type, fvPatchField, volMesh>&,
const word& const word&
); );
@ -110,7 +110,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const dimensioned<GType>&, const dimensioned<GType>&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
@ -118,7 +118,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const GeometricField<GType, fvPatchField, volMesh>&, const GeometricField<GType, fvPatchField, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>&, const GeometricField<Type, fvPatchField, volMesh>&,
const word& const word&
); );
@ -126,7 +126,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const GeometricField<GType, fvPatchField, volMesh>&, const GeometricField<GType, fvPatchField, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
@ -134,7 +134,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const tmp<GeometricField<GType, fvPatchField, volMesh> >&, const tmp<GeometricField<GType, fvPatchField, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>&, const GeometricField<Type, fvPatchField, volMesh>&,
const word& const word&
); );
@ -142,7 +142,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const tmp<GeometricField<GType, fvPatchField, volMesh> >&, 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 tmp<fvMatrix<Type> > laplacian
( (
const GeometricField<GType, fvsPatchField, surfaceMesh>&, const GeometricField<GType, fvsPatchField, surfaceMesh>&,
GeometricField<Type, fvPatchField, volMesh>&, const GeometricField<Type, fvPatchField, volMesh>&,
const word& const word&
); );
@ -158,7 +158,7 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const tmp<GeometricField<GType, fvsPatchField, surfaceMesh> >&, const tmp<GeometricField<GType, fvsPatchField, surfaceMesh> >&,
GeometricField<Type, fvPatchField, volMesh>&, const GeometricField<Type, fvPatchField, volMesh>&,
const word& const word&
); );
@ -166,14 +166,14 @@ namespace fvm
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const GeometricField<GType, fvsPatchField, surfaceMesh>&, const GeometricField<GType, fvsPatchField, surfaceMesh>&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type, class GType> template<class Type, class GType>
tmp<fvMatrix<Type> > laplacian tmp<fvMatrix<Type> > laplacian
( (
const tmp<GeometricField<GType, fvsPatchField, surfaceMesh> >&, 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 Foam::fvm::Su
( (
const DimensionedField<Type, volMesh>& su, const DimensionedField<Type, volMesh>& su,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
const fvMesh& mesh = vf.mesh(); const fvMesh& mesh = vf.mesh();
@ -60,7 +60,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Su Foam::fvm::Su
( (
const tmp<DimensionedField<Type, volMesh> >& tsu, 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); tmp<fvMatrix<Type> > tfvm = fvm::Su(tsu(), vf);
@ -73,7 +73,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Su Foam::fvm::Su
( (
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tsu, 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); tmp<fvMatrix<Type> > tfvm = fvm::Su(tsu(), vf);
@ -86,7 +86,7 @@ Foam::zeroField
Foam::fvm::Su Foam::fvm::Su
( (
const zeroField&, const zeroField&,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
return zeroField(); return zeroField();
@ -98,7 +98,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Sp Foam::fvm::Sp
( (
const DimensionedField<scalar, volMesh>& sp, const DimensionedField<scalar, volMesh>& sp,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
const fvMesh& mesh = vf.mesh(); const fvMesh& mesh = vf.mesh();
@ -123,7 +123,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Sp Foam::fvm::Sp
( (
const tmp<DimensionedField<scalar, volMesh> >& tsp, 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); tmp<fvMatrix<Type> > tfvm = fvm::Sp(tsp(), vf);
@ -136,7 +136,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Sp Foam::fvm::Sp
( (
const tmp<volScalarField>& tsp, const tmp<volScalarField>& tsp,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm = fvm::Sp(tsp(), vf); tmp<fvMatrix<Type> > tfvm = fvm::Sp(tsp(), vf);
@ -150,7 +150,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::Sp Foam::fvm::Sp
( (
const dimensionedScalar& sp, const dimensionedScalar& sp,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
const fvMesh& mesh = vf.mesh(); const fvMesh& mesh = vf.mesh();
@ -175,7 +175,7 @@ Foam::zeroField
Foam::fvm::Sp Foam::fvm::Sp
( (
const zeroField&, const zeroField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
) )
{ {
return zeroField(); return zeroField();
@ -187,7 +187,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::SuSp Foam::fvm::SuSp
( (
const DimensionedField<scalar, volMesh>& susp, const DimensionedField<scalar, volMesh>& susp,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
const fvMesh& mesh = vf.mesh(); const fvMesh& mesh = vf.mesh();
@ -215,7 +215,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::SuSp Foam::fvm::SuSp
( (
const tmp<DimensionedField<scalar, volMesh> >& tsusp, 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); tmp<fvMatrix<Type> > tfvm = fvm::SuSp(tsusp(), vf);
@ -228,7 +228,7 @@ Foam::tmp<Foam::fvMatrix<Type> >
Foam::fvm::SuSp Foam::fvm::SuSp
( (
const tmp<volScalarField>& tsusp, const tmp<volScalarField>& tsusp,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<fvMatrix<Type> > tfvm = fvm::SuSp(tsusp(), vf); tmp<fvMatrix<Type> > tfvm = fvm::SuSp(tsusp(), vf);
@ -241,7 +241,7 @@ Foam::zeroField
Foam::fvm::SuSp Foam::fvm::SuSp
( (
const zeroField&, const zeroField&,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
return zeroField(); return zeroField();

View File

@ -56,28 +56,28 @@ namespace fvm
tmp<fvMatrix<Type> > Su tmp<fvMatrix<Type> > Su
( (
const DimensionedField<Type, volMesh>&, const DimensionedField<Type, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
tmp<fvMatrix<Type> > Su tmp<fvMatrix<Type> > Su
( (
const tmp<DimensionedField<Type, volMesh> >&, const tmp<DimensionedField<Type, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
tmp<fvMatrix<Type> > Su tmp<fvMatrix<Type> > Su
( (
const tmp<GeometricField<Type, fvPatchField, volMesh> >&, const tmp<GeometricField<Type, fvPatchField, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
zeroField Su zeroField Su
( (
const zeroField&, const zeroField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
@ -87,21 +87,21 @@ namespace fvm
tmp<fvMatrix<Type> > Sp tmp<fvMatrix<Type> > Sp
( (
const DimensionedField<scalar, volMesh>&, const DimensionedField<scalar, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
tmp<fvMatrix<Type> > Sp tmp<fvMatrix<Type> > Sp
( (
const tmp<DimensionedField<scalar, volMesh> >&, const tmp<DimensionedField<scalar, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
tmp<fvMatrix<Type> > Sp tmp<fvMatrix<Type> > Sp
( (
const tmp<volScalarField>&, const tmp<volScalarField>&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
@ -109,7 +109,7 @@ namespace fvm
tmp<fvMatrix<Type> > Sp tmp<fvMatrix<Type> > Sp
( (
const dimensionedScalar&, const dimensionedScalar&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
@ -117,7 +117,7 @@ namespace fvm
zeroField Sp zeroField Sp
( (
const zeroField&, const zeroField&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
@ -127,28 +127,28 @@ namespace fvm
tmp<fvMatrix<Type> > SuSp tmp<fvMatrix<Type> > SuSp
( (
const DimensionedField<scalar, volMesh>&, const DimensionedField<scalar, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
tmp<fvMatrix<Type> > SuSp tmp<fvMatrix<Type> > SuSp
( (
const tmp<DimensionedField<scalar, volMesh> >&, const tmp<DimensionedField<scalar, volMesh> >&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
tmp<fvMatrix<Type> > SuSp tmp<fvMatrix<Type> > SuSp
( (
const tmp<volScalarField>&, const tmp<volScalarField>&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
template<class Type> template<class Type>
zeroField SuSp zeroField SuSp
( (
const zeroField&, 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 You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "extendedLeastSquaresGrad.H" #include "extendedLeastSquaresGrad.H"
@ -35,27 +35,20 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> 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 ) const
{ {
typedef typename outerProduct<vector, Type>::type GradType; typedef typename outerProduct<vector, Type>::type GradType;
@ -68,7 +61,7 @@ extendedLeastSquaresGrad<Type>::grad
( (
IOobject IOobject
( (
"grad("+vsf.name()+')', name,
vsf.instance(), vsf.instance(),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
@ -120,7 +113,7 @@ extendedLeastSquaresGrad<Type>::grad
if (vsf.boundaryField()[patchi].coupled()) if (vsf.boundaryField()[patchi].coupled())
{ {
Field<Type> neiVsf = Field<Type> neiVsf =
vsf.boundaryField()[patchi].patchNeighbourField(); vsf.boundaryField()[patchi].patchNeighbourField();
forAll(neiVsf, patchFaceI) 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 // Member Functions
tmp //- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
< <
GeometricField GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh> <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad > calcGrad
( (
const GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const; ) const;
}; };

View File

@ -21,7 +21,7 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fourthGrad.H" #include "fourthGrad.H"
@ -35,27 +35,20 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> 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 ) const
{ {
// The fourth-order gradient is calculated in two passes. First, // The fourth-order gradient is calculated in two passes. First,
@ -80,7 +73,7 @@ fourthGrad<Type>::grad
( (
IOobject IOobject
( (
"grad("+vsf.name()+')', name,
vsf.instance(), vsf.instance(),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
@ -130,7 +123,7 @@ fourthGrad<Type>::grad
const scalarField& lambdap = lambda.boundaryField()[patchi]; const scalarField& lambdap = lambda.boundaryField()[patchi];
// Build the d-vectors // Build the d-vectors
vectorField pd = vectorField pd =
mesh.Sf().boundaryField()[patchi] mesh.Sf().boundaryField()[patchi]
/( /(
mesh.magSf().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 // Member Functions
tmp //- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
< <
GeometricField GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh> <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad > calcGrad
( (
const GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const; ) const;
}; };

View File

@ -21,7 +21,7 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "gaussGrad.H" #include "gaussGrad.H"
@ -29,27 +29,20 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> 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; typedef typename outerProduct<vector, Type>::type GradType;
@ -62,7 +55,7 @@ gaussGrad<Type>::grad
( (
IOobject IOobject
( (
"grad("+ssf.name()+')', name,
ssf.instance(), ssf.instance(),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
@ -119,27 +112,29 @@ gaussGrad<Type>::grad
template<class Type> 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 ) const
{ {
typedef typename outerProduct<vector, Type>::type GradType; typedef typename outerProduct<vector, Type>::type GradType;
tmp<GeometricField<GradType, fvPatchField, volMesh> > tgGrad tmp<GeometricField<GradType, fvPatchField, volMesh> > tgGrad
( (
grad(tinterpScheme_().interpolate(vsf)) gradf(tinterpScheme_().interpolate(vsf), name)
); );
GeometricField<GradType, fvPatchField, volMesh>& gGrad = tgGrad(); GeometricField<GradType, fvPatchField, volMesh>& gGrad = tgGrad();
gGrad.rename("grad(" + vsf.name() + ')');
correctBoundaryConditions(vsf, gGrad); correctBoundaryConditions(vsf, gGrad);
return tgGrad; return tgGrad;
@ -147,7 +142,7 @@ gaussGrad<Type>::grad
template<class Type> template<class Type>
void gaussGrad<Type>::correctBoundaryConditions void Foam::fv::gaussGrad<Type>::correctBoundaryConditions
( (
const GeometricField<Type, fvPatchField, volMesh>& vsf, const GeometricField<Type, fvPatchField, volMesh>& vsf,
GeometricField 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)) tinterpScheme_(new linear<Type>(mesh))
{} {}
//- Construct from Istream //- Construct from mesh and Istream
gaussGrad(const fvMesh& mesh, Istream& is) gaussGrad(const fvMesh& mesh, Istream& is)
: :
gradScheme<Type>(mesh), gradScheme<Type>(mesh),
@ -116,31 +116,31 @@ public:
// Member Functions // 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 // calculated using Gauss' theorem on the given surface field
static static
tmp tmp
< <
GeometricField GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh> <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 to the gradScheme::grad
//- Return the gradient of the given field calculated // for optional caching
// using Gauss' theorem on the interpolated field virtual tmp
tmp
< <
GeometricField GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh> <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad > calcGrad
( (
const GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const; ) const;
//- Correct the boundary values of the gradient using the patchField //- Correct the boundary values of the gradient using the patchField
// snGrad functions // snGrad functions
static void correctBoundaryConditions static void correctBoundaryConditions

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvMesh.H" #include "fvMesh.H"

View File

@ -22,28 +22,16 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 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 "fv.H"
#include "HashTable.H" #include "objectRegistry.H"
#include "solution.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
tmp<gradScheme<Type> > gradScheme<Type>::New Foam::tmp<Foam::fv::gradScheme<Type> > Foam::fv::gradScheme<Type>::New
( (
const fvMesh& mesh, const fvMesh& mesh,
Istream& schemeData Istream& schemeData
@ -51,7 +39,8 @@ tmp<gradScheme<Type> > gradScheme<Type>::New
{ {
if (fv::debug) if (fv::debug)
{ {
Info<< "gradScheme<Type>::New(Istream& schemeData) : " Info<< "gradScheme<Type>::New"
"(const fvMesh& mesh, Istream& schemeData) : "
"constructing gradScheme<Type>" "constructing gradScheme<Type>"
<< endl; << endl;
} }
@ -60,7 +49,8 @@ tmp<gradScheme<Type> > gradScheme<Type>::New
{ {
FatalIOErrorIn FatalIOErrorIn
( (
"gradScheme<Type>::New(Istream& schemeData)", "gradScheme<Type>::New"
"(const fvMesh& mesh, Istream& schemeData)",
schemeData schemeData
) << "Grad scheme not specified" << endl << endl ) << "Grad scheme not specified" << endl << endl
<< "Valid grad schemes are :" << endl << "Valid grad schemes are :" << endl
@ -77,7 +67,8 @@ tmp<gradScheme<Type> > gradScheme<Type>::New
{ {
FatalIOErrorIn FatalIOErrorIn
( (
"gradScheme<Type>::New(Istream& schemeData)", "gradScheme<Type>::New"
"(const fvMesh& mesh, Istream& schemeData)",
schemeData schemeData
) << "unknown grad scheme " << schemeName << endl << endl ) << "unknown grad scheme " << schemeName << endl << endl
<< "Valid grad schemes are :" << endl << "Valid grad schemes are :" << endl
@ -92,16 +83,153 @@ tmp<gradScheme<Type> > gradScheme<Type>::New
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> 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 //- Destructor
virtual ~gradScheme();
virtual ~gradScheme();
// Member Functions // Member Functions
@ -127,15 +126,54 @@ public:
return mesh_; 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 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 GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh> <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad > grad
( (
const GeometricField<Type, fvPatchField, volMesh>& 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 You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "leastSquaresGrad.H" #include "leastSquaresGrad.H"
@ -35,27 +35,20 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> 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 ) const
{ {
typedef typename outerProduct<vector, Type>::type GradType; typedef typename outerProduct<vector, Type>::type GradType;
@ -68,7 +61,7 @@ leastSquaresGrad<Type>::grad
( (
IOobject IOobject
( (
"grad("+vsf.name()+')', name,
vsf.instance(), vsf.instance(),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
@ -116,7 +109,7 @@ leastSquaresGrad<Type>::grad
if (vsf.boundaryField()[patchi].coupled()) if (vsf.boundaryField()[patchi].coupled())
{ {
Field<Type> neiVsf = Field<Type> neiVsf =
vsf.boundaryField()[patchi].patchNeighbourField(); vsf.boundaryField()[patchi].patchNeighbourField();
forAll(neiVsf, patchFaceI) 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 // Member Functions
tmp //- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
< <
GeometricField GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh> <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad > calcGrad
( (
const GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const; ) const;
}; };

View File

@ -117,18 +117,82 @@ public:
const Type& extrapolate const Type& extrapolate
); );
//- Return the gradient of the given field to the gradScheme::grad
tmp // for optional caching
virtual tmp
< <
GeometricField GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh> <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad > calcGrad
( (
const GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const; ) 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 } // End namespace fv

View File

@ -36,70 +36,25 @@ License
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv namespace fv
{ {
makeFvGradScheme(cellLimitedGrad)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // }
}
makeFvGradScheme(cellLimitedGrad)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<> template<>
inline void cellLimitedGrad<scalar>::limitFace Foam::tmp<Foam::volVectorField>
Foam::fv::cellLimitedGrad<Foam::scalar>::calcGrad
( (
scalar& limiter, const volScalarField& vsf,
const scalar& maxDelta, const word& name
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 ) const
{ {
const fvMesh& mesh = vsf.mesh(); const fvMesh& mesh = vsf.mesh();
tmp<volVectorField> tGrad = basicGradScheme_().grad(vsf); tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL) if (k_ < SMALL)
{ {
@ -244,14 +199,16 @@ tmp<volVectorField> cellLimitedGrad<scalar>::grad
template<> 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
{ {
const fvMesh& mesh = vsf.mesh(); const fvMesh& mesh = vsf.mesh();
tmp<volTensorField> tGrad = basicGradScheme_().grad(vsf); tmp<volTensorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL) 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 const vector& dcf
); );
tmp //- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
< <
GeometricField GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh> <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad > calcGrad
( (
const GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const; ) 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 } // End namespace fv

View File

@ -36,27 +36,26 @@ License
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv namespace fv
{ {
makeFvGradScheme(cellMDLimitedGrad)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvGradScheme(cellMDLimitedGrad)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<> 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
{ {
const fvMesh& mesh = vsf.mesh(); const fvMesh& mesh = vsf.mesh();
tmp<volVectorField> tGrad = basicGradScheme_().grad(vsf); tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL) if (k_ < SMALL)
{ {
@ -190,14 +189,16 @@ tmp<volVectorField> cellMDLimitedGrad<scalar>::grad
template<> 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
{ {
const fvMesh& mesh = vsf.mesh(); const fvMesh& mesh = vsf.mesh();
tmp<volTensorField> tGrad = basicGradScheme_().grad(vsf); tmp<volTensorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL) 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 // Member Functions
tmp //- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
< <
GeometricField GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh> <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad > calcGrad
( (
const GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>& vsf,
) const; 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 } // End namespace fv

View File

@ -21,7 +21,7 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faceLimitedGrad.H" #include "faceLimitedGrad.H"
@ -36,49 +36,26 @@ License
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv namespace fv
{ {
makeFvGradScheme(faceLimitedGrad)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // }
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);
}
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<> 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
{ {
const fvMesh& mesh = vsf.mesh(); const fvMesh& mesh = vsf.mesh();
tmp<volVectorField> tGrad = basicGradScheme_().grad(vsf); tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL) if (k_ < SMALL)
{ {
@ -205,14 +182,16 @@ tmp<volVectorField> faceLimitedGrad<scalar>::grad
template<> 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
{ {
const fvMesh& mesh = vvf.mesh(); const fvMesh& mesh = vvf.mesh();
tmp<volTensorField> tGrad = basicGradScheme_().grad(vvf); tmp<volTensorField> tGrad = basicGradScheme_().calcGrad(vvf, name);
if (k_ < SMALL) 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 // Member Functions
tmp //- Return the gradient of the given field to the gradScheme::grad
// for optional caching
virtual tmp
< <
GeometricField GeometricField
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh> <typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
> grad > calcGrad
( (
const GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>& vsf,
const word& name
) const; ) 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 } // End namespace fv

View File

@ -21,7 +21,7 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faceMDLimitedGrad.H" #include "faceMDLimitedGrad.H"
@ -37,28 +37,25 @@ License
namespace Foam namespace Foam
{ {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv namespace fv
{ {
makeFvGradScheme(faceMDLimitedGrad)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvGradScheme(faceMDLimitedGrad)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// FaceLimited scalar gradient
template<> 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
{ {
const fvMesh& mesh = vsf.mesh(); const fvMesh& mesh = vsf.mesh();
tmp<volVectorField> tGrad = basicGradScheme_().grad(vsf); tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf, name);
if (k_ < SMALL) if (k_ < SMALL)
{ {
@ -189,14 +186,16 @@ tmp<volVectorField> faceMDLimitedGrad<scalar>::grad
template<> 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
{ {
const fvMesh& mesh = vvf.mesh(); const fvMesh& mesh = vvf.mesh();
tmp<volTensorField> tGrad = basicGradScheme_().grad(vvf); tmp<volTensorField> tGrad = basicGradScheme_().calcGrad(vvf, name);
if (k_ < SMALL) 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 gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected
( (
const surfaceScalarField& gammaMagSf, const surfaceScalarField& gammaMagSf,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
tmp<surfaceScalarField> tdeltaCoeffs = tmp<surfaceScalarField> tdeltaCoeffs =
@ -67,9 +67,9 @@ gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected
fvm.upper() = deltaCoeffs.internalField()*gammaMagSf.internalField(); fvm.upper() = deltaCoeffs.internalField()*gammaMagSf.internalField();
fvm.negSumDiag(); 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 = const fvsPatchScalarField& patchGamma =
gammaMagSf.boundaryField()[patchI]; gammaMagSf.boundaryField()[patchI];
@ -149,7 +149,7 @@ tmp<fvMatrix<Type> >
gaussLaplacianScheme<Type, GType>::fvmLaplacian gaussLaplacianScheme<Type, GType>::fvmLaplacian
( (
const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma, const GeometricField<GType, fvsPatchField, surfaceMesh>& gamma,
GeometricField<Type, fvPatchField, volMesh>& vf const GeometricField<Type, fvPatchField, volMesh>& vf
) )
{ {
const fvMesh& mesh = this->mesh(); const fvMesh& mesh = this->mesh();

View File

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

View File

@ -21,7 +21,7 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "gaussLaplacianScheme.H" #include "gaussLaplacianScheme.H"
@ -44,7 +44,7 @@ Foam::tmp<Foam::fvMatrix<Foam::Type> > \
Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvmLaplacian \ Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvmLaplacian \
( \ ( \
const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \ const GeometricField<scalar, fvsPatchField, surfaceMesh>& gamma, \
GeometricField<Type, fvPatchField, volMesh>& vf \ const GeometricField<Type, fvPatchField, volMesh>& vf \
) \ ) \
{ \ { \
const fvMesh& mesh = this->mesh(); \ const fvMesh& mesh = this->mesh(); \

View File

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

View File

@ -173,13 +173,13 @@ public:
virtual tmp<fvMatrix<Type> > fvmLaplacian virtual tmp<fvMatrix<Type> > fvmLaplacian
( (
const GeometricField<GType, fvsPatchField, surfaceMesh>&, const GeometricField<GType, fvsPatchField, surfaceMesh>&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
) = 0; ) = 0;
virtual tmp<fvMatrix<Type> > fvmLaplacian virtual tmp<fvMatrix<Type> > fvmLaplacian
( (
const GeometricField<GType, fvPatchField, volMesh>&, const GeometricField<GType, fvPatchField, volMesh>&,
GeometricField<Type, fvPatchField, volMesh>& const GeometricField<Type, fvPatchField, volMesh>&
); );
virtual tmp<GeometricField<Type, fvPatchField, volMesh> > fvcLaplacian 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, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Simple central-difference snGrad scheme with non-orthogonal correction.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "correctedSnGrad.H" #include "correctedSnGrad.H"
@ -34,28 +31,44 @@ Description
#include "fvcGrad.H" #include "fvcGrad.H"
#include "gaussGrad.H" #include "gaussGrad.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
correctedSnGrad<Type>::~correctedSnGrad() Foam::fv::correctedSnGrad<Type>::~correctedSnGrad()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
correctedSnGrad<Type>::correction 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 GeometricField<Type, fvPatchField, volMesh>& vf
) const ) const
@ -89,7 +102,7 @@ correctedSnGrad<Type>::correction
mesh.correctionVectors() mesh.correctionVectors()
& linear & linear
< <
typename typename
outerProduct<vector, typename pTraits<Type>::cmptType>::type outerProduct<vector, typename pTraits<Type>::cmptType>::type
>(mesh).interpolate >(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 //- 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> > virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
correction(const GeometricField<Type, fvPatchField, volMesh>&) const; 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 } // End namespace fv

View File

@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Simple central-difference snGrad scheme with non-orthogonal correction.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "correctedSnGrad.H" #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> template<class Type>
Foam::fvMatrix<Type>::fvMatrix Foam::fvMatrix<Type>::fvMatrix
( (
GeometricField<Type, fvPatchField, volMesh>& psi, const GeometricField<Type, fvPatchField, volMesh>& psi,
const dimensionSet& ds 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> template<class Type>
Foam::fvMatrix<Type>::fvMatrix Foam::fvMatrix<Type>::fvMatrix
( (
GeometricField<Type, fvPatchField, volMesh>& psi, const GeometricField<Type, fvPatchField, volMesh>& psi,
Istream& is Istream& is
) )
: :
@ -404,12 +410,17 @@ void Foam::fvMatrix<Type>::setValues
const unallocLabelList& nei = mesh.neighbour(); const unallocLabelList& nei = mesh.neighbour();
scalarField& Diag = diag(); scalarField& Diag = diag();
Field<Type>& psi =
const_cast
<
GeometricField<Type, fvPatchField, volMesh>&
>(psi_).internalField();
forAll(cellLabels, i) forAll(cellLabels, i)
{ {
label celli = cellLabels[i]; label celli = cellLabels[i];
psi_[celli] = values[i]; psi[celli] = values[i];
source_[celli] = values[i]*Diag[celli]; source_[celli] = values[i]*Diag[celli];
if (symmetric() || asymmetric()) if (symmetric() || asymmetric())

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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