Higher-order upwinded: Reorganised linearUpwind and created an equivalent quadraticUpwind scheme from it

This commit is contained in:
Henry
2011-02-02 12:40:14 +00:00
parent 81387e3239
commit 49c79f073a
7 changed files with 189 additions and 18 deletions

View File

@ -243,13 +243,14 @@ $(schemes)/cubicUpwindFit/cubicUpwindFit.C
$(schemes)/quadraticLinearPureUpwindFit/quadraticLinearPureUpwindFit.C
*/
$(schemes)/linearPureUpwindFit/linearPureUpwindFit.C
$(schemes)/linearUpwind/linearUpwind.C
$(schemes)/linearUpwind/linearUpwindV.C
$(schemes)/quadraticUpwind/quadraticUpwind.C
limitedSchemes = $(surfaceInterpolation)/limitedSchemes
$(limitedSchemes)/limitedSurfaceInterpolationScheme/limitedSurfaceInterpolationSchemes.C
$(limitedSchemes)/upwind/upwind.C
$(limitedSchemes)/blended/blended.C
$(limitedSchemes)/linearUpwind/linearUpwind.C
$(limitedSchemes)/linearUpwind/linearUpwindV.C
$(limitedSchemes)/Gamma/Gamma.C
$(limitedSchemes)/SFCD/SFCD.C
$(limitedSchemes)/Minmod/Minmod.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,6 @@ License
#include "linearUpwind.H"
#include "fvMesh.H"
#include "zeroGradientFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -85,16 +84,8 @@ Foam::linearUpwind<Type>::correction
forAll(faceFlux, facei)
{
if (faceFlux[facei] > 0)
{
label own = owner[facei];
sfCorr[facei] = (Cf[facei] - C[own]) & gradVf[own];
}
else
{
label nei = neighbour[facei];
sfCorr[facei] = (Cf[facei] - C[nei]) & gradVf[nei];
}
label celli = (faceFlux[facei] > 0) ? owner[facei] : neighbour[facei];
sfCorr[facei] = (Cf[facei] - C[celli]) & gradVf[celli];
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,7 +26,8 @@ Class
Description
linearUpwind interpolation scheme class derived from upwind and returns
upwind weighting factors but also applies an explicit correction.
upwind weighting factors and also applies a gradient-based explicit
correction.
SourceFiles
linearUpwind.C
@ -67,6 +68,12 @@ class linearUpwind
//- Disallow default bitwise assignment
void operator=(const linearUpwind&);
//- Hide the limiter because this is not formally a limited scheme
virtual tmp<surfaceScalarField> limiter
(
const GeometricField<Type, fvPatchField, volMesh>&
) const;
public:

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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 "quadraticUpwind.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
//makeSurfaceInterpolationScheme(quadraticUpwind);
makeSurfaceInterpolationTypeScheme(quadraticUpwind, scalar);
makeSurfaceInterpolationTypeScheme(quadraticUpwind, vector);
}
// ************************************************************************* //

View File

@ -0,0 +1,134 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2011 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 3 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, see <http://www.gnu.org/licenses/>.
Class
quadraticUpwind
Description
quadraticUpwind interpolation scheme class derived from linearUpwind and
returns blended linear/upwind weighting factors and also applies a explicit
gradient-based correction obtained from the linearUpwind scheme.
SourceFiles
quadraticUpwind.C
\*---------------------------------------------------------------------------*/
#ifndef quadraticUpwind_H
#define quadraticUpwind_H
#include "linearUpwind.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class quadraticUpwind Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class quadraticUpwind
:
public linearUpwind<Type>
{
// Private Member Functions
//- Disallow default bitwise copy construct
quadraticUpwind(const quadraticUpwind&);
//- Disallow default bitwise assignment
void operator=(const quadraticUpwind&);
public:
//- Runtime type information
TypeName("quadraticUpwind");
// Constructors
//- Construct from mesh and Istream
quadraticUpwind
(
const fvMesh& mesh,
Istream& schemeData
)
:
linearUpwind<Type>(mesh, schemeData)
{}
//- Construct from mesh, faceFlux and Istream
quadraticUpwind
(
const fvMesh& mesh,
const surfaceScalarField& faceFlux,
Istream& schemeData
)
:
linearUpwind<Type>(mesh, faceFlux, schemeData)
{}
// Member Functions
//- Return the interpolation weighting factors
virtual tmp<surfaceScalarField> weights
(
const GeometricField<Type, fvPatchField, volMesh>&
) const
{
return
0.75*this->mesh().surfaceInterpolation::weights()
+ 0.25*linearUpwind<Type>::weights();
}
//- Return true if this scheme uses an explicit correction
virtual bool corrected() const
{
return true;
}
//- Return the explicit correction to the face-interpolate
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
correction
(
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
return 0.25*linearUpwind<Type>::correction(vf);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //