skewCorrected.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 #ifndef skewCorrected_H
00038 #define skewCorrected_H
00039
00040 #include "surfaceInterpolationScheme.H"
00041 #include "skewCorrectionVectors.H"
00042 #include "linear.H"
00043 #include "gaussGrad.H"
00044
00045
00046
00047 namespace Foam
00048 {
00049
00050
00051
00052
00053
00054 template<class Type>
00055 class skewCorrected
00056 :
00057 public surfaceInterpolationScheme<Type>
00058 {
00059
00060
00061 tmp<surfaceInterpolationScheme<Type> > tScheme_;
00062
00063
00064
00065
00066
00067 skewCorrected(const skewCorrected&);
00068
00069
00070 void operator=(const skewCorrected&);
00071
00072
00073 public:
00074
00075
00076 TypeName("skewCorrected");
00077
00078
00079
00080
00081
00082 skewCorrected
00083 (
00084 const fvMesh& mesh,
00085 Istream& is
00086 )
00087 :
00088 surfaceInterpolationScheme<Type>(mesh),
00089 tScheme_
00090 (
00091 surfaceInterpolationScheme<Type>::New(mesh, is)
00092 )
00093 {}
00094
00095
00096
00097 skewCorrected
00098 (
00099 const fvMesh& mesh,
00100 const surfaceScalarField& faceFlux,
00101 Istream& is
00102 )
00103 :
00104 surfaceInterpolationScheme<Type>(mesh),
00105 tScheme_
00106 (
00107 surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
00108 )
00109 {}
00110
00111
00112
00113
00114
00115 tmp<surfaceScalarField> weights
00116 (
00117 const GeometricField<Type, fvPatchField, volMesh>& vf
00118 ) const
00119 {
00120 return tScheme_().weights(vf);
00121 }
00122
00123
00124 virtual bool corrected() const
00125 {
00126 return
00127 tScheme_().corrected()
00128 || skewCorrectionVectors::New(this->mesh()).skew();
00129 }
00130
00131 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00132 skewCorrection
00133 (
00134 const GeometricField<Type, fvPatchField, volMesh>& vf
00135 ) const
00136 {
00137 const fvMesh& mesh = this->mesh();
00138
00139 const skewCorrectionVectors& scv = skewCorrectionVectors::New(mesh);
00140
00141 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr
00142 (
00143 new GeometricField<Type, fvsPatchField, surfaceMesh>
00144 (
00145 IOobject
00146 (
00147 vf.name(),
00148 mesh.time().timeName(),
00149 mesh
00150 ),
00151 mesh,
00152 dimensioned<Type>
00153 (
00154 vf.name(),
00155 vf.dimensions(),
00156 pTraits<Type>::zero
00157 )
00158 )
00159 );
00160
00161 for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
00162 {
00163 tsfCorr().replace
00164 (
00165 cmpt,
00166 scv() & linear
00167 <
00168 typename outerProduct
00169 <
00170 vector,
00171 typename pTraits<Type>::cmptType
00172 >::type
00173 > (mesh).interpolate
00174 (
00175 fv::gaussGrad<typename pTraits<Type>::cmptType>
00176 (mesh).grad(vf.component(cmpt))
00177 )
00178 );
00179 }
00180
00181 return tsfCorr;
00182 }
00183
00184
00185
00186 virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00187 correction
00188 (
00189 const GeometricField<Type, fvPatchField, volMesh>& vf
00190 ) const
00191 {
00192 if
00193 (
00194 tScheme_().corrected()
00195 && skewCorrectionVectors::New(this->mesh()).skew()
00196 )
00197 {
00198 return tScheme_().correction(vf) + skewCorrection(vf);
00199 }
00200 else if (tScheme_().corrected())
00201 {
00202 return tScheme_().correction(vf);
00203 }
00204 else if (skewCorrectionVectors::New(this->mesh()).skew())
00205 {
00206 return skewCorrection(vf);
00207 }
00208 else
00209 {
00210 return
00211 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >(NULL);
00212 }
00213 }
00214 };
00215
00216
00217
00218
00219 }
00220
00221
00222
00223 #endif
00224
00225
Copyright © 2000-2009 OpenCFD Ltd