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