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