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