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