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