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 #ifndef PureUpwindFitScheme_H
00034 #define PureUpwindFitScheme_H
00035
00036 #include <finiteVolume/UpwindFitData.H>
00037 #include <finiteVolume/upwind.H>
00038 #include <OpenFOAM/Switch.H>
00039
00040
00041
00042 namespace Foam
00043 {
00044
00045
00046
00047
00048
00049 template<class Type, class Polynomial, class Stencil>
00050 class PureUpwindFitScheme
00051 :
00052 public upwind<Type>
00053 {
00054
00055
00056
00057
00058
00059 const scalar linearLimitFactor_;
00060
00061
00062 const scalar centralWeight_;
00063
00064
00065
00066
00067
00068 PureUpwindFitScheme(const PureUpwindFitScheme&);
00069
00070
00071 void operator=(const PureUpwindFitScheme&);
00072
00073
00074 public:
00075
00076
00077 TypeName("PureUpwindFitScheme");
00078
00079
00080
00081
00082
00083
00084
00085 PureUpwindFitScheme(const fvMesh& mesh, Istream& is)
00086 :
00087 upwind<Type>
00088 (
00089 mesh,
00090 mesh.lookupObject<surfaceScalarField>(word(is))
00091 ),
00092 linearLimitFactor_(readScalar(is)),
00093 centralWeight_(1000)
00094 {}
00095
00096
00097
00098 PureUpwindFitScheme
00099 (
00100 const fvMesh& mesh,
00101 const surfaceScalarField& faceFlux,
00102 Istream& is
00103 )
00104 :
00105 upwind<Type>(mesh, faceFlux),
00106 linearLimitFactor_(readScalar(is)),
00107 centralWeight_(1000)
00108 {}
00109
00110
00111
00112
00113
00114 virtual bool corrected() const
00115 {
00116 return true;
00117 }
00118
00119
00120 virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00121 correction
00122 (
00123 const GeometricField<Type, fvPatchField, volMesh>& vf
00124 ) const
00125 {
00126 const fvMesh& mesh = this->mesh();
00127
00128
00129 const extendedUpwindCellToFaceStencil& stencil = Stencil::New(mesh);
00130
00131 const UpwindFitData<Polynomial>& ufd =
00132 UpwindFitData<Polynomial>::New
00133 (
00134 mesh,
00135 stencil,
00136 false,
00137 linearLimitFactor_,
00138 centralWeight_
00139 );
00140
00141 const List<scalarList>& fo = ufd.owncoeffs();
00142 const List<scalarList>& fn = ufd.neicoeffs();
00143
00144 return stencil.weightedSum(this->faceFlux_, vf, fo, fn);
00145 }
00146 };
00147
00148
00149
00150
00151 }
00152
00153
00154
00155
00156
00157 #define makePureUpwindFitSurfaceInterpolationTypeScheme(SS, POLYNOMIAL, STENCIL, TYPE) \
00158 \
00159 typedef PureUpwindFitScheme<TYPE, POLYNOMIAL, STENCIL> \
00160 PureUpwindFitScheme##TYPE##POLYNOMIAL##STENCIL##_; \
00161 defineTemplateTypeNameAndDebugWithName \
00162 (PureUpwindFitScheme##TYPE##POLYNOMIAL##STENCIL##_, #SS, 0); \
00163 \
00164 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
00165 <PureUpwindFitScheme<TYPE, POLYNOMIAL, STENCIL> > \
00166 add##SS##STENCIL##TYPE##MeshConstructorToTable_; \
00167 \
00168 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
00169 <PureUpwindFitScheme<TYPE, POLYNOMIAL, STENCIL> > \
00170 add##SS##STENCIL##TYPE##MeshFluxConstructorToTable_;
00171
00172 #define makePureUpwindFitSurfaceInterpolationScheme(SS, POLYNOMIAL, STENCIL) \
00173 \
00174 makePureUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,scalar) \
00175 makePureUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,vector) \
00176 makePureUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,sphericalTensor) \
00177 makePureUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,symmTensor) \
00178 makePureUpwindFitSurfaceInterpolationTypeScheme(SS,POLYNOMIAL,STENCIL,tensor)
00179
00180
00181
00182
00183 #endif
00184
00185