Go to the documentation of this file.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 #include "limitedSurfaceInterpolationScheme.H"
00027 #include <finiteVolume/volFields.H>
00028 #include <finiteVolume/surfaceFields.H>
00029 #include <finiteVolume/coupledFvPatchField.H>
00030
00031
00032
00033 namespace Foam
00034 {
00035
00036
00037
00038 template<class Type>
00039 tmp<limitedSurfaceInterpolationScheme<Type> >
00040 limitedSurfaceInterpolationScheme<Type>::New
00041 (
00042 const fvMesh& mesh,
00043 Istream& schemeData
00044 )
00045 {
00046 if (surfaceInterpolation::debug)
00047 {
00048 Info<< "limitedSurfaceInterpolationScheme<Type>::"
00049 "New(const fvMesh&, Istream&)"
00050 " : constructing limitedSurfaceInterpolationScheme<Type>"
00051 << endl;
00052 }
00053
00054 if (schemeData.eof())
00055 {
00056 FatalIOErrorIn
00057 (
00058 "limitedSurfaceInterpolationScheme<Type>::"
00059 "New(const fvMesh&, Istream&)",
00060 schemeData
00061 ) << "Discretisation scheme not specified"
00062 << endl << endl
00063 << "Valid schemes are :" << endl
00064 << MeshConstructorTablePtr_->sortedToc()
00065 << exit(FatalIOError);
00066 }
00067
00068 word schemeName(schemeData);
00069
00070 typename MeshConstructorTable::iterator constructorIter =
00071 MeshConstructorTablePtr_->find(schemeName);
00072
00073 if (constructorIter == MeshConstructorTablePtr_->end())
00074 {
00075 FatalIOErrorIn
00076 (
00077 "limitedSurfaceInterpolationScheme<Type>::"
00078 "New(const fvMesh&, Istream&)",
00079 schemeData
00080 ) << "Unknown discretisation scheme " << schemeName
00081 << endl << endl
00082 << "Valid schemes are :" << endl
00083 << MeshConstructorTablePtr_->sortedToc()
00084 << exit(FatalIOError);
00085 }
00086
00087 return constructorIter()(mesh, schemeData);
00088 }
00089
00090
00091
00092 template<class Type>
00093 tmp<limitedSurfaceInterpolationScheme<Type> >
00094 limitedSurfaceInterpolationScheme<Type>::New
00095 (
00096 const fvMesh& mesh,
00097 const surfaceScalarField& faceFlux,
00098 Istream& schemeData
00099 )
00100 {
00101 if (surfaceInterpolation::debug)
00102 {
00103 Info<< "limitedSurfaceInterpolationScheme<Type>::New"
00104 "(const fvMesh&, const surfaceScalarField&, Istream&) : "
00105 "constructing limitedSurfaceInterpolationScheme<Type>"
00106 << endl;
00107 }
00108
00109 if (schemeData.eof())
00110 {
00111 FatalIOErrorIn
00112 (
00113 "limitedSurfaceInterpolationScheme<Type>::New"
00114 "(const fvMesh&, const surfaceScalarField&, Istream&)",
00115 schemeData
00116 ) << "Discretisation scheme not specified"
00117 << endl << endl
00118 << "Valid schemes are :" << endl
00119 << MeshConstructorTablePtr_->sortedToc()
00120 << exit(FatalIOError);
00121 }
00122
00123 word schemeName(schemeData);
00124
00125 typename MeshFluxConstructorTable::iterator constructorIter =
00126 MeshFluxConstructorTablePtr_->find(schemeName);
00127
00128 if (constructorIter == MeshFluxConstructorTablePtr_->end())
00129 {
00130 FatalIOErrorIn
00131 (
00132 "limitedSurfaceInterpolationScheme<Type>::New"
00133 "(const fvMesh&, const surfaceScalarField&, Istream&)",
00134 schemeData
00135 ) << "Unknown discretisation scheme " << schemeName
00136 << endl << endl
00137 << "Valid schemes are :" << endl
00138 << MeshFluxConstructorTablePtr_->sortedToc()
00139 << exit(FatalIOError);
00140 }
00141
00142 return constructorIter()(mesh, faceFlux, schemeData);
00143 }
00144
00145
00146
00147
00148 template<class Type>
00149 limitedSurfaceInterpolationScheme<Type>::~limitedSurfaceInterpolationScheme()
00150 {}
00151
00152
00153
00154
00155 template<class Type>
00156 tmp<surfaceScalarField> limitedSurfaceInterpolationScheme<Type>::weights
00157 (
00158 const GeometricField<Type, fvPatchField, volMesh>& phi,
00159 const surfaceScalarField& CDweights,
00160 tmp<surfaceScalarField> tLimiter
00161 ) const
00162 {
00163
00164
00165 surfaceScalarField& Weights = tLimiter();
00166
00167 scalarField& pWeights = Weights.internalField();
00168
00169 forAll(pWeights, face)
00170 {
00171 pWeights[face] =
00172 pWeights[face]*CDweights[face]
00173 + (1.0 - pWeights[face])*pos(faceFlux_[face]);
00174 }
00175
00176 surfaceScalarField::GeometricBoundaryField& bWeights =
00177 Weights.boundaryField();
00178
00179 forAll(bWeights, patchI)
00180 {
00181 scalarField& pWeights = bWeights[patchI];
00182
00183 const scalarField& pCDweights = CDweights.boundaryField()[patchI];
00184 const scalarField& pFaceFlux = faceFlux_.boundaryField()[patchI];
00185
00186 forAll(pWeights, face)
00187 {
00188 pWeights[face] =
00189 pWeights[face]*pCDweights[face]
00190 + (1.0 - pWeights[face])*pos(pFaceFlux[face]);
00191 }
00192 }
00193
00194 return tLimiter;
00195 }
00196
00197 template<class Type>
00198 tmp<surfaceScalarField> limitedSurfaceInterpolationScheme<Type>::weights
00199 (
00200 const GeometricField<Type, fvPatchField, volMesh>& phi
00201 ) const
00202 {
00203 return this->weights
00204 (
00205 phi,
00206 this->mesh().surfaceInterpolation::weights(),
00207 this->limiter(phi)
00208 );
00209 }
00210
00211 template<class Type>
00212 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
00213 limitedSurfaceInterpolationScheme<Type>::flux
00214 (
00215 const GeometricField<Type, fvPatchField, volMesh>& phi
00216 ) const
00217 {
00218 return faceFlux_*this->interpolate(phi);
00219 }
00220
00221
00222
00223
00224 }
00225
00226