diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H index 9be5cd0420..e8ed67a9d8 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H @@ -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 > tScheme1_; + //- Courant number above which scheme2 is used + const scalar Co2_; + //- Scheme 2 tmp > 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(mesh), - alpha_(readScalar(is)), + Co1_(readScalar(is)), tScheme1_ ( surfaceInterpolationScheme::New(mesh, is) ), + Co2_(readScalar(is)), tScheme2_ ( surfaceInterpolationScheme::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(mesh), - alpha_(readScalar(is)), + Co1_(readScalar(is)), tScheme1_ ( surfaceInterpolationScheme::New(mesh, faceFlux, is) ), + Co2_(readScalar(is)), tScheme2_ ( surfaceInterpolationScheme::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);