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