mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -28,11 +28,31 @@ Description
|
|||||||
Two-scheme Courant number based blending differencing scheme.
|
Two-scheme Courant number based blending differencing scheme.
|
||||||
|
|
||||||
Similar to localBlended but uses a blending factor computed from the
|
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
|
SourceFiles
|
||||||
CoBlended.C
|
CoBlended.C
|
||||||
@ -60,13 +80,15 @@ class CoBlended
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
const scalar alpha_;
|
//- Courant number below which scheme1 is used
|
||||||
|
const scalar Co1_;
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Scheme 1
|
//- Scheme 1
|
||||||
tmp<surfaceInterpolationScheme<Type> > tScheme1_;
|
tmp<surfaceInterpolationScheme<Type> > tScheme1_;
|
||||||
|
|
||||||
|
//- Courant number above which scheme2 is used
|
||||||
|
const scalar Co2_;
|
||||||
|
|
||||||
//- Scheme 2
|
//- Scheme 2
|
||||||
tmp<surfaceInterpolationScheme<Type> > tScheme2_;
|
tmp<surfaceInterpolationScheme<Type> > tScheme2_;
|
||||||
|
|
||||||
@ -74,6 +96,8 @@ class CoBlended
|
|||||||
const surfaceScalarField& faceFlux_;
|
const surfaceScalarField& faceFlux_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
CoBlended(const CoBlended&);
|
CoBlended(const CoBlended&);
|
||||||
|
|
||||||
@ -99,11 +123,12 @@ public:
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
surfaceInterpolationScheme<Type>(mesh),
|
surfaceInterpolationScheme<Type>(mesh),
|
||||||
alpha_(readScalar(is)),
|
Co1_(readScalar(is)),
|
||||||
tScheme1_
|
tScheme1_
|
||||||
(
|
(
|
||||||
surfaceInterpolationScheme<Type>::New(mesh, is)
|
surfaceInterpolationScheme<Type>::New(mesh, is)
|
||||||
),
|
),
|
||||||
|
Co2_(readScalar(is)),
|
||||||
tScheme2_
|
tScheme2_
|
||||||
(
|
(
|
||||||
surfaceInterpolationScheme<Type>::New(mesh, is)
|
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)
|
FatalIOErrorIn("CoBlended(const fvMesh&, Istream&)", is)
|
||||||
<< "coefficient = " << alpha_
|
<< "coefficients = " << Co1_ << " and " << Co2_
|
||||||
<< " should be > 0"
|
<< " should be > 0 and Co2 > Co1"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,22 +160,23 @@ public:
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
surfaceInterpolationScheme<Type>(mesh),
|
surfaceInterpolationScheme<Type>(mesh),
|
||||||
alpha_(readScalar(is)),
|
Co1_(readScalar(is)),
|
||||||
tScheme1_
|
tScheme1_
|
||||||
(
|
(
|
||||||
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
|
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
|
||||||
),
|
),
|
||||||
|
Co2_(readScalar(is)),
|
||||||
tScheme2_
|
tScheme2_
|
||||||
(
|
(
|
||||||
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
|
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
|
||||||
),
|
),
|
||||||
faceFlux_(faceFlux)
|
faceFlux_(faceFlux)
|
||||||
{
|
{
|
||||||
if (alpha_ <= 0)
|
if (Co1_ < 0 || Co2_ < 0 || Co1_ >= Co2_)
|
||||||
{
|
{
|
||||||
FatalIOErrorIn("CoBlended(const fvMesh&, Istream&)", is)
|
FatalIOErrorIn("CoBlended(const fvMesh&, Istream&)", is)
|
||||||
<< "coefficient = " << alpha_
|
<< "coefficients = " << Co1_ << " and " << Co2_
|
||||||
<< " should be > 0"
|
<< " should be > 0 and Co2 > Co1"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,11 +191,18 @@ public:
|
|||||||
|
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
|
scalar(1) -
|
||||||
max
|
max
|
||||||
(
|
(
|
||||||
scalar(1)
|
min
|
||||||
- mesh.time().deltaT()*mesh.deltaCoeffs()*mag(faceFlux_)
|
(
|
||||||
/(mesh.magSf()*alpha_),
|
(
|
||||||
|
mesh.time().deltaT()*mesh.deltaCoeffs()
|
||||||
|
*mag(faceFlux_)/mesh.magSf()
|
||||||
|
- Co1_
|
||||||
|
)/(Co2_ - Co1_),
|
||||||
|
scalar(1)
|
||||||
|
),
|
||||||
scalar(0)
|
scalar(0)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -185,6 +218,8 @@ public:
|
|||||||
{
|
{
|
||||||
surfaceScalarField bf(blendingFactor());
|
surfaceScalarField bf(blendingFactor());
|
||||||
|
|
||||||
|
Info<< "weights " << max(bf) << " " << min(bf) << endl;
|
||||||
|
|
||||||
return
|
return
|
||||||
bf*tScheme1_().weights(vf)
|
bf*tScheme1_().weights(vf)
|
||||||
+ (scalar(1.0) - bf)*tScheme2_().weights(vf);
|
+ (scalar(1.0) - bf)*tScheme2_().weights(vf);
|
||||||
|
|||||||
Reference in New Issue
Block a user