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 #ifndef outletStabilised_H
00040 #define outletStabilised_H
00041
00042 #include "surfaceInterpolationScheme.H"
00043 #include "skewCorrectionVectors.H"
00044 #include "linear.H"
00045 #include "gaussGrad.H"
00046 #include "mixedFvPatchField.H"
00047 #include "directionMixedFvPatchField.H"
00048
00049
00050
00051 namespace Foam
00052 {
00053
00054
00055
00056
00057
00058 template<class Type>
00059 class outletStabilised
00060 :
00061 public surfaceInterpolationScheme<Type>
00062 {
00063
00064
00065 const surfaceScalarField& faceFlux_;
00066 tmp<surfaceInterpolationScheme<Type> > tScheme_;
00067
00068
00069
00070
00071
00072 outletStabilised(const outletStabilised&);
00073
00074
00075 void operator=(const outletStabilised&);
00076
00077
00078 public:
00079
00080
00081 TypeName("outletStabilised");
00082
00083
00084
00085
00086
00087 outletStabilised
00088 (
00089 const fvMesh& mesh,
00090 Istream& is
00091 )
00092 :
00093 surfaceInterpolationScheme<Type>(mesh),
00094 faceFlux_
00095 (
00096 mesh.lookupObject<surfaceScalarField>
00097 (
00098 word(is)
00099 )
00100 ),
00101 tScheme_
00102 (
00103 surfaceInterpolationScheme<Type>::New(mesh, faceFlux_, is)
00104 )
00105 {}
00106
00107
00108
00109 outletStabilised
00110 (
00111 const fvMesh& mesh,
00112 const surfaceScalarField& faceFlux,
00113 Istream& is
00114 )
00115 :
00116 surfaceInterpolationScheme<Type>(mesh),
00117 faceFlux_(faceFlux),
00118 tScheme_
00119 (
00120 surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
00121 )
00122 {}
00123
00124
00125
00126
00127
00128 tmp<surfaceScalarField> weights
00129 (
00130 const GeometricField<Type, fvPatchField, volMesh>& vf
00131 ) const
00132 {
00133 tmp<surfaceScalarField> tw = tScheme_().weights(vf);
00134 surfaceScalarField& w = tw();
00135
00136 const fvMesh& mesh_ = this->mesh();
00137 const cellList& cells = mesh_.cells();
00138
00139 forAll(vf.boundaryField(), patchi)
00140 {
00141 if
00142 (
00143 isA<zeroGradientFvPatchField<Type> >
00144 (vf.boundaryField()[patchi])
00145 || isA<mixedFvPatchField<Type> >(vf.boundaryField()[patchi])
00146 || isA<directionMixedFvPatchField<Type> >
00147 (vf.boundaryField()[patchi])
00148 )
00149 {
00150 const labelList& pFaceCells =
00151 mesh_.boundary()[patchi].faceCells();
00152
00153 forAll(pFaceCells, pFacei)
00154 {
00155 const cell& pFaceCell = cells[pFaceCells[pFacei]];
00156
00157 forAll(pFaceCell, fi)
00158 {
00159 label facei = pFaceCell[fi];
00160
00161 if (mesh_.isInternalFace(facei))
00162 {
00163
00164 w[facei] = pos(faceFlux_[facei]);
00165 }
00166 }
00167 }
00168 }
00169 }
00170
00171 return tw;
00172 }
00173
00174
00175 virtual bool corrected() const
00176 {
00177 return tScheme_().corrected();
00178 }
00179
00180
00181
00182 virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00183 correction
00184 (
00185 const GeometricField<Type, fvPatchField, volMesh>& vf
00186 ) const
00187 {
00188 if (tScheme_().corrected())
00189 {
00190 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tcorr =
00191 tScheme_().correction(vf);
00192
00193 GeometricField<Type, fvsPatchField, surfaceMesh>& corr = tcorr();
00194
00195 const fvMesh& mesh_ = this->mesh();
00196 const cellList& cells = mesh_.cells();
00197
00198 forAll(vf.boundaryField(), patchi)
00199 {
00200 if
00201 (
00202 isA<zeroGradientFvPatchField<Type> >
00203 (vf.boundaryField()[patchi])
00204 || isA<mixedFvPatchField<Type> >
00205 (vf.boundaryField()[patchi])
00206 )
00207 {
00208 const labelList& pFaceCells =
00209 mesh_.boundary()[patchi].faceCells();
00210
00211 forAll(pFaceCells, pFacei)
00212 {
00213 const cell& pFaceCell = cells[pFaceCells[pFacei]];
00214
00215 forAll(pFaceCell, fi)
00216 {
00217 label facei = pFaceCell[fi];
00218
00219 if (mesh_.isInternalFace(facei))
00220 {
00221
00222 corr[facei] = pTraits<Type>::zero;
00223 }
00224 }
00225 }
00226 }
00227 }
00228
00229 return tcorr;
00230 }
00231 else
00232 {
00233 return
00234 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >(NULL);
00235 }
00236 }
00237 };
00238
00239
00240
00241
00242 }
00243
00244
00245
00246 #endif
00247
00248
Copyright © 2000-2007 OpenCFD Ltd