CoBlended: New version of the interpolation scheme which is controlled by a lower and upper Courant number

See CoBlended.H for details
This commit is contained in:
Henry
2013-07-17 16:28:26 +01:00
parent d3fa77a93e
commit f73f2b8a5c

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,11 +28,31 @@ Description
Two-scheme Courant number based blending differencing scheme.
Similar to localBlended but uses a blending factor computed from the
face-based Courant number and the alpha factor supplied:
face-based Courant number and the lower and upper Courant number limits
supplied:
\f[
weight = 1 - max(min((Co - Co1)/(Co2 - Co1), 1), 0)
\f]
where
\vartable
Co1 | Courant number below which scheme1 is used
Co2 | Courant number above which scheme2 is used
\endvartable
weight = 1 - Co/alpha
The weight applies to the first scheme and 1-weight to the second scheme.
The weight applies to the first scheme and 1-factor to the second scheme.
Example of the CoBlended scheme specification using LUST for Courant numbers
less than 1 and linearUpwind for Courant numbers greater than 10:
\verbatim
divSchemes
{
.
.
div(phi,U) Gauss CoBlended 1 LUST grad(U) 10 linearUpwind grad(U);
.
.
}
\endverbatim
SourceFiles
CoBlended.C
@ -60,13 +80,15 @@ class CoBlended
{
// Private data
const scalar alpha_;
// Private Member Functions
//- Courant number below which scheme1 is used
const scalar Co1_;
//- Scheme 1
tmp<surfaceInterpolationScheme<Type> > tScheme1_;
//- Courant number above which scheme2 is used
const scalar Co2_;
//- Scheme 2
tmp<surfaceInterpolationScheme<Type> > tScheme2_;
@ -74,6 +96,8 @@ class CoBlended
const surfaceScalarField& faceFlux_;
// Private Member Functions
//- Disallow default bitwise copy construct
CoBlended(const CoBlended&);
@ -99,11 +123,12 @@ public:
)
:
surfaceInterpolationScheme<Type>(mesh),
alpha_(readScalar(is)),
Co1_(readScalar(is)),
tScheme1_
(
surfaceInterpolationScheme<Type>::New(mesh, is)
),
Co2_(readScalar(is)),
tScheme2_
(
surfaceInterpolationScheme<Type>::New(mesh, is)
@ -116,11 +141,11 @@ public:
)
)
{
if (alpha_ <= 0 )
if (Co1_ < 0 || Co2_ < 0 || Co1_ >= Co2_)
{
FatalIOErrorIn("CoBlended(const fvMesh&, Istream&)", is)
<< "coefficient = " << alpha_
<< " should be > 0"
<< "coefficients = " << Co1_ << " and " << Co2_
<< " should be > 0 and Co2 > Co1"
<< exit(FatalIOError);
}
}
@ -135,22 +160,23 @@ public:
)
:
surfaceInterpolationScheme<Type>(mesh),
alpha_(readScalar(is)),
Co1_(readScalar(is)),
tScheme1_
(
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
),
Co2_(readScalar(is)),
tScheme2_
(
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
),
faceFlux_(faceFlux)
{
if (alpha_ <= 0)
if (Co1_ < 0 || Co2_ < 0 || Co1_ >= Co2_)
{
FatalIOErrorIn("CoBlended(const fvMesh&, Istream&)", is)
<< "coefficient = " << alpha_
<< " should be > 0"
<< "coefficients = " << Co1_ << " and " << Co2_
<< " should be > 0 and Co2 > Co1"
<< exit(FatalIOError);
}
}
@ -165,11 +191,18 @@ public:
return
(
scalar(1) -
max
(
scalar(1)
- mesh.time().deltaT()*mesh.deltaCoeffs()*mag(faceFlux_)
/(mesh.magSf()*alpha_),
min
(
(
mesh.time().deltaT()*mesh.deltaCoeffs()
*mag(faceFlux_)/mesh.magSf()
- Co1_
)/(Co2_ - Co1_),
scalar(1)
),
scalar(0)
)
);
@ -185,6 +218,8 @@ public:
{
surfaceScalarField bf(blendingFactor());
Info<< "weights " << max(bf) << " " << min(bf) << endl;
return
bf*tScheme1_().weights(vf)
+ (scalar(1.0) - bf)*tScheme2_().weights(vf);