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 <finiteVolume/volFields.H>
00027 #include <finiteVolume/surfaceFields.H>
00028 #include <finiteVolume/fvcGrad.H>
00029 #include <finiteVolume/coupledFvPatchFields.H>
00030 #include <finiteVolume/surfaceInterpolate.H>
00031
00032
00033
00034 namespace Foam
00035 {
00036
00037
00038
00039 template<class Type, class PhiLimiter>
00040 tmp<surfaceScalarField> PhiScheme<Type, PhiLimiter>::limiter
00041 (
00042 const GeometricField<Type, fvPatchField, volMesh>& phi
00043 ) const
00044 {
00045 const fvMesh& mesh = this->mesh();
00046
00047 tmp<surfaceScalarField> tLimiter
00048 (
00049 new surfaceScalarField
00050 (
00051 IOobject
00052 (
00053 "PhiLimiter",
00054 mesh.time().timeName(),
00055 mesh
00056 ),
00057 mesh,
00058 dimless
00059 )
00060 );
00061 surfaceScalarField& Limiter = tLimiter();
00062
00063 const surfaceScalarField& CDweights = mesh.surfaceInterpolation::weights();
00064
00065 const surfaceVectorField& Sf = mesh.Sf();
00066 const surfaceScalarField& magSf = mesh.magSf();
00067
00068 const unallocLabelList& owner = mesh.owner();
00069 const unallocLabelList& neighbour = mesh.neighbour();
00070
00071 tmp<surfaceScalarField> tUflux = this->faceFlux_;
00072
00073 if (this->faceFlux_.dimensions() == dimDensity*dimVelocity*dimArea)
00074 {
00075 const volScalarField& rho =
00076 phi.db().objectRegistry::lookupObject<volScalarField>("rho");
00077 tUflux = this->faceFlux_/fvc::interpolate(rho);
00078 }
00079 else if (this->faceFlux_.dimensions() != dimVelocity*dimArea)
00080 {
00081 FatalErrorIn
00082 (
00083 "PhiScheme<PhiLimiter>::limiter"
00084 "(const GeometricField<Type, fvPatchField, volMesh>& phi)"
00085 ) << "dimensions of faceFlux are not correct"
00086 << exit(FatalError);
00087 }
00088
00089 const surfaceScalarField& Uflux = tUflux();
00090
00091 scalarField& pLimiter = Limiter.internalField();
00092
00093 forAll(pLimiter, face)
00094 {
00095 pLimiter[face] = PhiLimiter::limiter
00096 (
00097 CDweights[face],
00098 Uflux[face],
00099 phi[owner[face]],
00100 phi[neighbour[face]],
00101 Sf[face],
00102 magSf[face]
00103 );
00104 }
00105
00106
00107 surfaceScalarField::GeometricBoundaryField& bLimiter =
00108 Limiter.boundaryField();
00109
00110 forAll(bLimiter, patchI)
00111 {
00112 scalarField& pLimiter = bLimiter[patchI];
00113
00114 if (bLimiter[patchI].coupled())
00115 {
00116 const scalarField& pCDweights = CDweights.boundaryField()[patchI];
00117 const vectorField& pSf = Sf.boundaryField()[patchI];
00118 const scalarField& pmagSf = magSf.boundaryField()[patchI];
00119 const scalarField& pFaceFlux = Uflux.boundaryField()[patchI];
00120 Field<Type> pphiP =
00121 phi.boundaryField()[patchI].patchInternalField();
00122 Field<Type> pphiN =
00123 phi.boundaryField()[patchI].patchNeighbourField();
00124
00125 forAll(pLimiter, face)
00126 {
00127 pLimiter[face] = PhiLimiter::limiter
00128 (
00129 pCDweights[face],
00130 pFaceFlux[face],
00131 pphiP[face],
00132 pphiN[face],
00133 pSf[face],
00134 pmagSf[face]
00135 );
00136 }
00137 }
00138 else
00139 {
00140 pLimiter = 1.0;
00141 }
00142 }
00143
00144 return tLimiter;
00145 }
00146
00147
00148
00149
00150 }
00151
00152