fixedBlended.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef fixedBlended_H
00045 #define fixedBlended_H
00046
00047 #include "surfaceInterpolationScheme.H"
00048
00049
00050
00051 namespace Foam
00052 {
00053
00054
00055
00056
00057
00058 template<class Type>
00059 class fixedBlended
00060 :
00061 public surfaceInterpolationScheme<Type>
00062 {
00063
00064
00065 const scalar blendingFactor_;
00066
00067
00068
00069
00070 tmp<surfaceInterpolationScheme<Type> > tScheme1_;
00071
00072
00073 tmp<surfaceInterpolationScheme<Type> > tScheme2_;
00074
00075
00076
00077 fixedBlended(const fixedBlended&);
00078
00079
00080 void operator=(const fixedBlended&);
00081
00082
00083 public:
00084
00085
00086 TypeName("fixedBlended");
00087
00088
00089
00090
00091
00092
00093
00094 fixedBlended
00095 (
00096 const fvMesh& mesh,
00097 Istream& is
00098 )
00099 :
00100 surfaceInterpolationScheme<Type>(mesh),
00101 blendingFactor_(readScalar(is)),
00102 tScheme1_
00103 (
00104 surfaceInterpolationScheme<Type>::New(mesh, is)
00105 ),
00106 tScheme2_
00107 (
00108 surfaceInterpolationScheme<Type>::New(mesh, is)
00109 )
00110 {
00111 if (blendingFactor_ < 0 || blendingFactor_ > 1)
00112 {
00113 FatalIOErrorIn("fixedBlended(const fvMesh&, Istream&)", is)
00114 << "coefficient = " << blendingFactor_
00115 << " should be >= 0 and <= 1"
00116 << exit(FatalIOError);
00117 }
00118 if (surfaceInterpolationScheme<Type>::debug)
00119 {
00120 Info<<"fixedBlended: " << blendingFactor_
00121 << "*" << tScheme1_().type()
00122 << " + (1-" << blendingFactor_ << ")*"
00123 << tScheme2_().type()
00124 <<endl;
00125 }
00126 }
00127
00128
00129
00130 fixedBlended
00131 (
00132 const fvMesh& mesh,
00133 const surfaceScalarField& faceFlux,
00134 Istream& is
00135 )
00136 :
00137 surfaceInterpolationScheme<Type>(mesh),
00138 blendingFactor_(readScalar(is)),
00139 tScheme1_
00140 (
00141 surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
00142 ),
00143 tScheme2_
00144 (
00145 surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
00146 )
00147 {
00148 if (blendingFactor_ < 0 || blendingFactor_ > 1)
00149 {
00150 FatalIOErrorIn("fixedBlended(const fvMesh&, Istream&)", is)
00151 << "coefficient = " << blendingFactor_
00152 << " should be >= 0 and <= 1"
00153 << exit(FatalIOError);
00154 }
00155 if (surfaceInterpolationScheme<Type>::debug)
00156 {
00157 Info<<"fixedBlended: " << blendingFactor_
00158 << "*" << tScheme1_().type()
00159 << " + (1-" << blendingFactor_ << ")*"
00160 << tScheme2_().type()
00161 <<endl;
00162 }
00163 }
00164
00165
00166
00167
00168
00169 tmp<surfaceScalarField>
00170 weights
00171 (
00172 const GeometricField<Type, fvPatchField, volMesh>& vf
00173 ) const
00174 {
00175 return
00176 blendingFactor_*tScheme1_().weights(vf)
00177 + (scalar(1.0) - blendingFactor_)*tScheme2_().weights(vf);
00178 }
00179
00180
00181
00182
00183 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00184 interpolate
00185 (
00186 const GeometricField<Type, fvPatchField, volMesh>& vf
00187 ) const
00188 {
00189 return
00190 blendingFactor_*tScheme1_().interpolate(vf)
00191 + (scalar(1.0) - blendingFactor_)*tScheme2_().interpolate(vf);
00192 }
00193
00194
00195
00196 virtual bool corrected() const
00197 {
00198 return tScheme1_().corrected() || tScheme2_().corrected();
00199 }
00200
00201
00202
00203
00204 virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00205 correction
00206 (
00207 const GeometricField<Type, fvPatchField, volMesh>& vf
00208 ) const
00209 {
00210 if (tScheme1_().corrected())
00211 {
00212 if (tScheme2_().corrected())
00213 {
00214 return
00215 (
00216 blendingFactor_
00217 * tScheme1_().correction(vf)
00218 + (scalar(1.0) - blendingFactor_)
00219 * tScheme2_().correction(vf)
00220 );
00221 }
00222 else
00223 {
00224 return
00225 (
00226 blendingFactor_
00227 * tScheme1_().correction(vf)
00228 );
00229 }
00230 }
00231 else if (tScheme2_().corrected())
00232 {
00233 return
00234 (
00235 (scalar(1.0) - blendingFactor_)
00236 * tScheme2_().correction(vf)
00237 );
00238 }
00239 else
00240 {
00241 return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00242 (
00243 NULL
00244 );
00245 }
00246 }
00247
00248 };
00249
00250
00251
00252
00253 }
00254
00255
00256
00257 #endif
00258
00259
Copyright © 2000-2009 OpenCFD Ltd