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