mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
bugfix fixedBlended scheme, cosmetics changes
- actually blend correction factors as well in fixedBlended scheme - consistency change: move 'linearUpwindV' into same directory as 'linearUpwind', move correction code from .H into .C code. - minor docu format/spelling changes A more general question: ~~~~~~~~~~~~~~~~~~~~~~~~ - would it make more sense to use template specializations for the '*V' differencing schemes?
This commit is contained in:
@ -206,7 +206,7 @@ $(limitedSchemes)/limitedSurfaceInterpolationScheme/limitedSurfaceInterpolationS
|
|||||||
$(limitedSchemes)/upwind/upwind.C
|
$(limitedSchemes)/upwind/upwind.C
|
||||||
$(limitedSchemes)/blended/blended.C
|
$(limitedSchemes)/blended/blended.C
|
||||||
$(limitedSchemes)/linearUpwind/linearUpwind.C
|
$(limitedSchemes)/linearUpwind/linearUpwind.C
|
||||||
$(limitedSchemes)/linearUpwindV/linearUpwindV.C
|
$(limitedSchemes)/linearUpwind/linearUpwindV.C
|
||||||
$(limitedSchemes)/Gamma/Gamma.C
|
$(limitedSchemes)/Gamma/Gamma.C
|
||||||
$(limitedSchemes)/SFCD/SFCD.C
|
$(limitedSchemes)/SFCD/SFCD.C
|
||||||
$(limitedSchemes)/Minmod/Minmod.C
|
$(limitedSchemes)/Minmod/Minmod.C
|
||||||
|
|||||||
@ -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 "cellLimitedGrad.H"
|
#include "cellLimitedGrad.H"
|
||||||
@ -377,7 +377,7 @@ tmp<volTensorField> cellLimitedGrad<vector>::grad
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fv::debug)
|
if (fv::debug)
|
||||||
{
|
{
|
||||||
Info<< "gradient limiter for: " << vsf.name()
|
Info<< "gradient limiter for: " << vsf.name()
|
||||||
|
|||||||
@ -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 "cellMDLimitedGrad.H"
|
#include "cellMDLimitedGrad.H"
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class LimitedLimiter Declaration
|
Class LimitedLimiter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class LimitedScheme>
|
template<class LimitedScheme>
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class Limited01Limiter Declaration
|
Class Limited01Limiter Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class LimitedScheme>
|
template<class LimitedScheme>
|
||||||
|
|||||||
@ -79,18 +79,17 @@ public:
|
|||||||
{
|
{
|
||||||
scalar phiCD = cdWeight*phiP + (1 - cdWeight)*phiN;
|
scalar phiCD = cdWeight*phiP + (1 - cdWeight)*phiN;
|
||||||
|
|
||||||
scalar phif;
|
scalar phiU, phif;
|
||||||
scalar phiU;
|
|
||||||
|
|
||||||
if (faceFlux > 0)
|
if (faceFlux > 0)
|
||||||
{
|
{
|
||||||
phif = 0.5*(phiCD + phiP + (1 - cdWeight)*(d & gradcP));
|
|
||||||
phiU = phiP;
|
phiU = phiP;
|
||||||
|
phif = 0.5*(phiCD + phiP + (1 - cdWeight)*(d & gradcP));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
phif = 0.5*(phiCD + phiN - cdWeight*(d & gradcN));
|
|
||||||
phiU = phiN;
|
phiU = phiN;
|
||||||
|
phif = 0.5*(phiCD + phiN - cdWeight*(d & gradcN));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the effective limiter for the QUICK interpolation
|
// Calculate the effective limiter for the QUICK interpolation
|
||||||
|
|||||||
@ -81,8 +81,7 @@ public:
|
|||||||
|
|
||||||
scalar phiCD = gradfV & (cdWeight*phiP + (1 - cdWeight)*phiN);
|
scalar phiCD = gradfV & (cdWeight*phiP + (1 - cdWeight)*phiN);
|
||||||
|
|
||||||
scalar phif;
|
scalar phiU, phif;
|
||||||
scalar phiU;
|
|
||||||
|
|
||||||
if (faceFlux > 0)
|
if (faceFlux > 0)
|
||||||
{
|
{
|
||||||
@ -95,7 +94,7 @@ public:
|
|||||||
phif = 0.5*(phiCD + phiU - cdWeight*(gradfV & (d & gradcN)));
|
phif = 0.5*(phiCD + phiU - cdWeight*(gradfV & (d & gradcN)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the effective limiter for the linearUpwind interpolation
|
// Calculate the effective limiter for the QUICK interpolation
|
||||||
scalar QLimiter = (phif - phiU)/stabilise(phiCD - phiU, SMALL);
|
scalar QLimiter = (phif - phiU)/stabilise(phiCD - phiU, SMALL);
|
||||||
|
|
||||||
// Limit the limiter between upwind and downwind
|
// Limit the limiter between upwind and downwind
|
||||||
|
|||||||
@ -26,7 +26,7 @@ Class
|
|||||||
Foam::filteredLinearLimiter
|
Foam::filteredLinearLimiter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Class to generate weighting factors for the filtered-linear
|
Class to generate weighting factors for the filteredLinear
|
||||||
differencing scheme.
|
differencing scheme.
|
||||||
|
|
||||||
The aim is to remove high-frequency modes with "staggering"
|
The aim is to remove high-frequency modes with "staggering"
|
||||||
|
|||||||
@ -26,7 +26,7 @@ Class
|
|||||||
Foam::filteredLinear2Limiter
|
Foam::filteredLinear2Limiter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Class to generate weighting factors for the filtered-linear-2
|
Class to generate weighting factors for the filteredLinear2
|
||||||
differencing scheme.
|
differencing scheme.
|
||||||
|
|
||||||
The aim is to remove high-frequency modes with "staggering"
|
The aim is to remove high-frequency modes with "staggering"
|
||||||
|
|||||||
@ -26,11 +26,13 @@ Class
|
|||||||
Foam::filteredLinear2VLimiter
|
Foam::filteredLinear2VLimiter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Class to generate weighting factors for the filteredLinear2V differencing
|
Class to generate weighting factors for the filteredLinear2V
|
||||||
scheme. The aim is to remove high-frequency modes with "staggering"
|
differencing scheme.
|
||||||
characteristics from vector fields by comparing the face gradient in the
|
|
||||||
direction of maximum gradient with both neighbouring cell gradients and
|
The aim is to remove high-frequency modes with "staggering"
|
||||||
introduce small amounts of upwind in order to damp these modes.
|
characteristics from vector fields by comparing the face gradient in
|
||||||
|
the direction of maximum gradient with both neighbouring cell gradients
|
||||||
|
and introduce small amounts of upwind in order to damp these modes.
|
||||||
|
|
||||||
Used in conjunction with the template class LimitedScheme.
|
Used in conjunction with the template class LimitedScheme.
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ Class
|
|||||||
Foam::filteredLinear3Limiter
|
Foam::filteredLinear3Limiter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Class to generate weighting factors for the filtered-linear-3
|
Class to generate weighting factors for the filteredLinear
|
||||||
differencing scheme.
|
differencing scheme.
|
||||||
|
|
||||||
The aim is to remove high-frequency modes with "staggering"
|
The aim is to remove high-frequency modes with "staggering"
|
||||||
@ -79,7 +79,7 @@ public:
|
|||||||
<< "coefficient = " << k_
|
<< "coefficient = " << k_
|
||||||
<< " should be >= 0 and <= 1"
|
<< " should be >= 0 and <= 1"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar limiter
|
scalar limiter
|
||||||
|
|||||||
@ -26,11 +26,13 @@ Class
|
|||||||
Foam::filteredLinear3VLimiter
|
Foam::filteredLinear3VLimiter
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Class to generate weighting factors for the filteredLinear3V differencing
|
Class to generate weighting factors for the filteredLinear3V
|
||||||
scheme. The aim is to remove high-frequency modes with "staggering"
|
differencing scheme.
|
||||||
characteristics from vector fields by comparing the face gradient in the
|
|
||||||
direction of maximum gradient with both neighbouring cell gradients and
|
The aim is to remove high-frequency modes with "staggering"
|
||||||
introduce small amounts of upwind in order to damp these modes.
|
characteristics from vector fields by comparing the face gradient in
|
||||||
|
the direction of maximum gradient with both neighbouring cell gradients
|
||||||
|
and introduce small amounts of upwind in order to damp these modes.
|
||||||
|
|
||||||
Used in conjunction with the template class LimitedScheme.
|
Used in conjunction with the template class LimitedScheme.
|
||||||
|
|
||||||
@ -77,7 +79,7 @@ public:
|
|||||||
<< "coefficient = " << k_
|
<< "coefficient = " << k_
|
||||||
<< " should be >= 0 and <= 1"
|
<< " should be >= 0 and <= 1"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar limiter
|
scalar limiter
|
||||||
|
|||||||
@ -90,7 +90,7 @@ public:
|
|||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Construct from Istream.
|
//- Construct from Istream.
|
||||||
// The name of the flux field is read from the Istream and looked-up
|
// The name of the flux field is read from the Istream and looked-up
|
||||||
// from the mesh objectRegistry
|
// from the mesh objectRegistry
|
||||||
linearUpwind
|
linearUpwind
|
||||||
@ -142,8 +142,9 @@ public:
|
|||||||
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||||
correction
|
correction
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vf
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,136 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "linearUpwindV.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
|
||||||
|
Foam::linearUpwindV<Type>::correction
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const fvMesh& mesh = this->mesh();
|
||||||
|
|
||||||
|
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr
|
||||||
|
(
|
||||||
|
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
vf.name(),
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensioned<Type>
|
||||||
|
(
|
||||||
|
vf.name(),
|
||||||
|
vf.dimensions(),
|
||||||
|
pTraits<Type>::zero
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
GeometricField<Type, fvsPatchField, surfaceMesh>& sfCorr = tsfCorr();
|
||||||
|
|
||||||
|
const surfaceScalarField& faceFlux = this->faceFlux_;
|
||||||
|
const surfaceScalarField& w = mesh.weights();
|
||||||
|
|
||||||
|
const labelList& own = mesh.owner();
|
||||||
|
const labelList& nei = mesh.neighbour();
|
||||||
|
|
||||||
|
const vectorField& C = mesh.C();
|
||||||
|
const vectorField& Cf = mesh.Cf();
|
||||||
|
|
||||||
|
GeometricField
|
||||||
|
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
|
||||||
|
gradVf = gradScheme_().grad(vf);
|
||||||
|
|
||||||
|
forAll(faceFlux, facei)
|
||||||
|
{
|
||||||
|
vector maxCorr;
|
||||||
|
|
||||||
|
if (faceFlux[facei] > 0.0)
|
||||||
|
{
|
||||||
|
maxCorr =
|
||||||
|
(1.0 - w[facei])
|
||||||
|
*(vf[nei[facei]] - vf[own[facei]]);
|
||||||
|
|
||||||
|
sfCorr[facei] =
|
||||||
|
(Cf[facei] - C[own[facei]]) & gradVf[own[facei]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxCorr =
|
||||||
|
w[facei]*(vf[own[facei]] - vf[nei[facei]]);
|
||||||
|
|
||||||
|
sfCorr[facei] =
|
||||||
|
(Cf[facei] - C[nei[facei]]) & gradVf[nei[facei]];
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar sfCorrs = magSqr(sfCorr[facei]);
|
||||||
|
scalar maxCorrs = sfCorr[facei] & maxCorr;
|
||||||
|
|
||||||
|
if (sfCorrs > 0)
|
||||||
|
{
|
||||||
|
if (maxCorrs < 0)
|
||||||
|
{
|
||||||
|
sfCorr[facei] = vector::zero;
|
||||||
|
}
|
||||||
|
else if (sfCorrs > maxCorrs)
|
||||||
|
{
|
||||||
|
sfCorr[facei] *= maxCorrs/(sfCorrs + VSMALL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (sfCorrs < 0)
|
||||||
|
{
|
||||||
|
if (maxCorrs > 0)
|
||||||
|
{
|
||||||
|
sfCorr[facei] = vector::zero;
|
||||||
|
}
|
||||||
|
else if (sfCorrs < maxCorrs)
|
||||||
|
{
|
||||||
|
sfCorr[facei] *= maxCorrs/(sfCorrs - VSMALL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tsfCorr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
makelimitedSurfaceInterpolationTypeScheme(linearUpwindV, vector)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -90,7 +90,7 @@ public:
|
|||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Construct from Istream.
|
//- Construct from Istream.
|
||||||
// The name of the flux field is read from the Istream and looked-up
|
// The name of the flux field is read from the Istream and looked-up
|
||||||
// from the mesh objectRegistry
|
// from the mesh objectRegistry
|
||||||
linearUpwindV
|
linearUpwindV
|
||||||
@ -142,97 +142,9 @@ public:
|
|||||||
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||||
correction
|
correction
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vf
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
) const
|
) const;
|
||||||
{
|
|
||||||
const fvMesh& mesh = this->mesh();
|
|
||||||
|
|
||||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr
|
|
||||||
(
|
|
||||||
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
vf.name(),
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh
|
|
||||||
),
|
|
||||||
mesh,
|
|
||||||
dimensioned<Type>
|
|
||||||
(
|
|
||||||
vf.name(),
|
|
||||||
vf.dimensions(),
|
|
||||||
pTraits<Type>::zero
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
GeometricField<Type, fvsPatchField, surfaceMesh>& sfCorr = tsfCorr();
|
|
||||||
|
|
||||||
const surfaceScalarField& faceFlux = this->faceFlux_;
|
|
||||||
const surfaceScalarField& w = mesh.weights();
|
|
||||||
|
|
||||||
const labelList& own = mesh.owner();
|
|
||||||
const labelList& nei = mesh.neighbour();
|
|
||||||
|
|
||||||
const vectorField& C = mesh.C();
|
|
||||||
const vectorField& Cf = mesh.Cf();
|
|
||||||
|
|
||||||
GeometricField
|
|
||||||
<typename outerProduct<vector, Type>::type, fvPatchField, volMesh>
|
|
||||||
gradVf = gradScheme_().grad(vf);
|
|
||||||
|
|
||||||
forAll(faceFlux, facei)
|
|
||||||
{
|
|
||||||
vector maxCorr;
|
|
||||||
|
|
||||||
if (faceFlux[facei] > 0.0)
|
|
||||||
{
|
|
||||||
maxCorr =
|
|
||||||
(1.0 - w[facei])
|
|
||||||
*(vf[nei[facei]] - vf[own[facei]]);
|
|
||||||
|
|
||||||
sfCorr[facei] =
|
|
||||||
(Cf[facei] - C[own[facei]]) & gradVf[own[facei]];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxCorr =
|
|
||||||
w[facei]*(vf[own[facei]] - vf[nei[facei]]);
|
|
||||||
|
|
||||||
sfCorr[facei] =
|
|
||||||
(Cf[facei] - C[nei[facei]]) & gradVf[nei[facei]];
|
|
||||||
}
|
|
||||||
|
|
||||||
scalar sfCorrs = magSqr(sfCorr[facei]);
|
|
||||||
scalar maxCorrs = sfCorr[facei] & maxCorr;
|
|
||||||
|
|
||||||
if (sfCorrs > 0)
|
|
||||||
{
|
|
||||||
if (maxCorrs < 0)
|
|
||||||
{
|
|
||||||
sfCorr[facei] = vector::zero;
|
|
||||||
}
|
|
||||||
else if (sfCorrs > maxCorrs)
|
|
||||||
{
|
|
||||||
sfCorr[facei] *= maxCorrs/(sfCorrs + VSMALL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (sfCorrs < 0)
|
|
||||||
{
|
|
||||||
if (maxCorrs > 0)
|
|
||||||
{
|
|
||||||
sfCorr[facei] = vector::zero;
|
|
||||||
}
|
|
||||||
else if (sfCorrs < maxCorrs)
|
|
||||||
{
|
|
||||||
sfCorr[facei] *= maxCorrs/(sfCorrs - VSMALL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tsfCorr;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by the
|
|
||||||
Free Software Foundation; either version 2 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "linearUpwindV.H"
|
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "surfaceFields.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
makelimitedSurfaceInterpolationTypeScheme(linearUpwindV, vector)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -58,11 +58,11 @@ class UpwindFitData
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- For each face of the mesh store the coefficients to multiply the
|
//- For each face of the mesh store the coefficients to multiply the
|
||||||
// stencil cell values by if the flow is from the owner
|
// stencil cell values by if the flow is from the owner
|
||||||
List<scalarList> owncoeffs_;
|
List<scalarList> owncoeffs_;
|
||||||
|
|
||||||
//- For each face of the mesh store the coefficients to multiply the
|
//- For each face of the mesh store the coefficients to multiply the
|
||||||
// stencil cell values by if the flow is from the neighbour
|
// stencil cell values by if the flow is from the neighbour
|
||||||
List<scalarList> neicoeffs_;
|
List<scalarList> neicoeffs_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ Class
|
|||||||
Foam::UpwindFitScheme
|
Foam::UpwindFitScheme
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Upwind biased fit surface interpolation scheme which applies an explicit
|
Upwind biased fit surface interpolation scheme that applies an explicit
|
||||||
correction to linear.
|
correction to linear.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -27,7 +27,8 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
BiLinear polynomial for interpolation fitting.
|
BiLinear polynomial for interpolation fitting.
|
||||||
Can be used with the CentredFit scheme to crate a biLinear surface
|
|
||||||
|
Can be used with the CentredFit scheme to create a biLinear surface
|
||||||
interpolation scheme
|
interpolation scheme
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -28,7 +28,7 @@ Class
|
|||||||
Description
|
Description
|
||||||
Cubic polynomial for upwind biased interpolation fitting.
|
Cubic polynomial for upwind biased interpolation fitting.
|
||||||
|
|
||||||
Can be used with the UpwindFit scheme to crate a cubic surface
|
Can be used with the UpwindFit scheme to create a cubic surface
|
||||||
interpolation scheme
|
interpolation scheme
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -125,6 +125,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Construct from mesh, faceFlux and Istream
|
//- Construct from mesh, faceFlux and Istream
|
||||||
fixedBlended
|
fixedBlended
|
||||||
(
|
(
|
||||||
@ -165,7 +166,8 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return the interpolation weighting factors
|
//- Return the interpolation weighting factors
|
||||||
tmp<surfaceScalarField> weights
|
tmp<surfaceScalarField>
|
||||||
|
weights
|
||||||
(
|
(
|
||||||
const GeometricField<Type, fvPatchField, volMesh>& vf
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
) const
|
) const
|
||||||
@ -175,15 +177,74 @@ public:
|
|||||||
+ (scalar(1.0) - blendingFactor_)*tScheme2_().weights(vf);
|
+ (scalar(1.0) - blendingFactor_)*tScheme2_().weights(vf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return the face-interpolate of the given cell field
|
//- Return the face-interpolate of the given cell field
|
||||||
// with explicit correction
|
// with explicit correction
|
||||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||||
interpolate(const GeometricField<Type, fvPatchField, volMesh>& vf) const
|
interpolate
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
blendingFactor_*tScheme1_().interpolate(vf)
|
blendingFactor_*tScheme1_().interpolate(vf)
|
||||||
+ (scalar(1.0) - blendingFactor_)*tScheme2_().interpolate(vf);
|
+ (scalar(1.0) - blendingFactor_)*tScheme2_().interpolate(vf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return true if this scheme uses an explicit correction
|
||||||
|
virtual bool corrected() const
|
||||||
|
{
|
||||||
|
return tScheme1_().corrected() || tScheme2_().corrected();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return the explicit correction to the face-interpolate
|
||||||
|
// for the given field
|
||||||
|
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||||
|
correction
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (tScheme1_().corrected())
|
||||||
|
{
|
||||||
|
if (tScheme2_().corrected())
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
blendingFactor_
|
||||||
|
* tScheme1_().correction(vf)
|
||||||
|
+ (scalar(1.0) - blendingFactor_)
|
||||||
|
* tScheme2_().correction(vf)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
blendingFactor_
|
||||||
|
* tScheme1_().correction(vf)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (tScheme2_().corrected())
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
(scalar(1.0) - blendingFactor_)
|
||||||
|
* tScheme2_().correction(vf)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
|
||||||
|
(
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,9 +26,10 @@ Class
|
|||||||
Foam::harmonic
|
Foam::harmonic
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Harmonic-mean differencing scheme class. This scheme interpolates 1/field
|
Harmonic-mean differencing scheme class.
|
||||||
using a scheme specified at run-time and return the reciprocal of the
|
|
||||||
interpolate.
|
This scheme interpolates 1/field using a scheme specified at run-time
|
||||||
|
and return the reciprocal of the interpolate.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
harmonic.C
|
harmonic.C
|
||||||
@ -76,7 +77,7 @@ public:
|
|||||||
surfaceInterpolationScheme<scalar>(mesh)
|
surfaceInterpolationScheme<scalar>(mesh)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Construct from Istream.
|
//- Construct from Istream.
|
||||||
// The name of the flux field is read from the Istream and looked-up
|
// The name of the flux field is read from the Istream and looked-up
|
||||||
// from the mesh objectRegistry
|
// from the mesh objectRegistry
|
||||||
harmonic
|
harmonic
|
||||||
|
|||||||
@ -27,7 +27,8 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Linear polynomial for interpolation fitting.
|
Linear polynomial for interpolation fitting.
|
||||||
Can be used with the CentredFit scheme to crate a linear surface
|
|
||||||
|
Can be used with the CentredFit scheme to create a linear surface
|
||||||
interpolation scheme
|
interpolation scheme
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -26,9 +26,10 @@ Class
|
|||||||
Foam::localMax
|
Foam::localMax
|
||||||
|
|
||||||
Description
|
Description
|
||||||
LocalMax-mean differencing scheme class. This scheme interpolates 1/field
|
LocalMax-mean differencing scheme class.
|
||||||
using a scheme specified at run-time and return the reciprocal of the
|
|
||||||
interpolate.
|
This scheme interpolates 1/field using a scheme specified at run-time
|
||||||
|
and return the reciprocal of the interpolate.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
localMax.C
|
localMax.C
|
||||||
|
|||||||
@ -26,9 +26,10 @@ Class
|
|||||||
Foam::localMin
|
Foam::localMin
|
||||||
|
|
||||||
Description
|
Description
|
||||||
LocalMin-mean differencing scheme class. This scheme interpolates 1/field
|
LocalMin-mean differencing scheme class.
|
||||||
using a scheme specified at run-time and return the reciprocal of the
|
|
||||||
interpolate.
|
This scheme interpolates 1/field using a scheme specified at run-time
|
||||||
|
and return the reciprocal of the interpolate.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
localMin.C
|
localMin.C
|
||||||
|
|||||||
@ -27,9 +27,11 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Outlet-stabilised interpolation scheme which applies upwind differencing
|
Outlet-stabilised interpolation scheme which applies upwind differencing
|
||||||
to the faces of teh cells adjacent to outlets. This is particularly
|
to the faces of the cells adjacent to outlets.
|
||||||
useful to stabilise the velocity at entrainment boundaries for LES
|
|
||||||
cases using linear or other centred differencing schemes.
|
This is particularly useful to stabilise the velocity at entrainment
|
||||||
|
boundaries for LES cases using linear or other centred differencing
|
||||||
|
schemes.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
outletStabilised.C
|
outletStabilised.C
|
||||||
@ -138,7 +140,7 @@ public:
|
|||||||
|
|
||||||
forAll(vf.boundaryField(), patchi)
|
forAll(vf.boundaryField(), patchi)
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
isA<zeroGradientFvPatchField<Type> >
|
isA<zeroGradientFvPatchField<Type> >
|
||||||
(vf.boundaryField()[patchi])
|
(vf.boundaryField()[patchi])
|
||||||
@ -187,7 +189,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (tScheme_().corrected())
|
if (tScheme_().corrected())
|
||||||
{
|
{
|
||||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tcorr =
|
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tcorr =
|
||||||
tScheme_().correction(vf);
|
tScheme_().correction(vf);
|
||||||
|
|
||||||
GeometricField<Type, fvsPatchField, surfaceMesh>& corr = tcorr();
|
GeometricField<Type, fvsPatchField, surfaceMesh>& corr = tcorr();
|
||||||
@ -197,7 +199,7 @@ public:
|
|||||||
|
|
||||||
forAll(vf.boundaryField(), patchi)
|
forAll(vf.boundaryField(), patchi)
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
isA<zeroGradientFvPatchField<Type> >
|
isA<zeroGradientFvPatchField<Type> >
|
||||||
(vf.boundaryField()[patchi])
|
(vf.boundaryField()[patchi])
|
||||||
@ -230,7 +232,7 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >(NULL);
|
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ Class
|
|||||||
Description
|
Description
|
||||||
Quadratic polynomial for centred interpolation fitting.
|
Quadratic polynomial for centred interpolation fitting.
|
||||||
|
|
||||||
Can be used with the CentredFit scheme to crate a quadratic surface
|
Can be used with the CentredFit scheme to create a quadratic surface
|
||||||
interpolation scheme
|
interpolation scheme
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -30,7 +30,7 @@ Description
|
|||||||
quadratic normal to the face,
|
quadratic normal to the face,
|
||||||
linear in the plane of the face for consistency with 2nd-order Gauss.
|
linear in the plane of the face for consistency with 2nd-order Gauss.
|
||||||
|
|
||||||
Can be used with the CentredFit scheme to crate a quadratic surface
|
Can be used with the CentredFit scheme to create a quadratic surface
|
||||||
interpolation scheme
|
interpolation scheme
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -28,7 +28,7 @@ Class
|
|||||||
Description
|
Description
|
||||||
Quadratic polynomial for upwind biased interpolation fitting.
|
Quadratic polynomial for upwind biased interpolation fitting.
|
||||||
|
|
||||||
Can be used with the UpwindFit scheme to crate a quadratic surface
|
Can be used with the UpwindFit scheme to create a quadratic surface
|
||||||
interpolation scheme
|
interpolation scheme
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -28,7 +28,7 @@ Class
|
|||||||
Description
|
Description
|
||||||
Quadratic polynomial for upwind biased interpolation fitting.
|
Quadratic polynomial for upwind biased interpolation fitting.
|
||||||
|
|
||||||
Can be used with the UpwindFit scheme to crate a quadratic surface
|
Can be used with the UpwindFit scheme to create a quadratic surface
|
||||||
interpolation scheme
|
interpolation scheme
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -27,6 +27,7 @@ Class
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Inversed weight central-differencing interpolation scheme class.
|
Inversed weight central-differencing interpolation scheme class.
|
||||||
|
|
||||||
Useful for inverse weighted and harmonic interpolations.
|
Useful for inverse weighted and harmonic interpolations.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
|
|||||||
@ -26,7 +26,7 @@ Class
|
|||||||
Foam::skewCorrected
|
Foam::skewCorrected
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Skewness-corrected interpolation scheme which applies an explicit
|
Skewness-corrected interpolation scheme that applies an explicit
|
||||||
correction to given scheme.
|
correction to given scheme.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
|
|||||||
Reference in New Issue
Block a user