梯度场的correctBoundaryConditions()是什么意思?
-
最近开始学OpenFOAM源码,发现在src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C中的gradf函数最后面(下面代码块的65行),对计算出来的梯度场gGrad调用了GeometricField的成员函数correctBoundaryConditions(),这是什么意思呢?是根据梯度场自己的边界条件更新边界值吗?那梯度场自己的边界条件是在哪一步得到的呢?:
template<class Type> Foam::tmp < Foam::VolField<typename Foam::outerProduct<Foam::vector, Type>::type> > Foam::fv::gaussGrad<Type>::gradf ( const GeometricField<Type, fvsPatchField, surfaceMesh>& ssf, const word& name ) { typedef typename outerProduct<vector, Type>::type GradType; const fvMesh& mesh = ssf.mesh(); tmp<GeometricField<GradType, fvPatchField, volMesh>> tgGrad ( GeometricField<GradType, fvPatchField, volMesh>::New ( name, mesh, dimensioned<GradType> ( "0", ssf.dimensions()/dimLength, Zero ), extrapolatedCalculatedFvPatchField<GradType>::typeName ) ); GeometricField<GradType, fvPatchField, volMesh>& gGrad = tgGrad.ref(); const labelUList& owner = mesh.owner(); const labelUList& neighbour = mesh.neighbour(); const vectorField& Sf = mesh.Sf(); Field<GradType>& igGrad = gGrad; const Field<Type>& issf = ssf; forAll(owner, facei) { GradType Sfssf = Sf[facei]*issf[facei]; igGrad[owner[facei]] += Sfssf; igGrad[neighbour[facei]] -= Sfssf; } forAll(mesh.boundary(), patchi) { const labelUList& pFaceCells = mesh.boundary()[patchi].faceCells(); const vectorField& pSf = mesh.Sf().boundaryField()[patchi]; const fvsPatchField<Type>& pssf = ssf.boundaryField()[patchi]; forAll(mesh.boundary()[patchi], facei) { igGrad[pFaceCells[facei]] += pSf[facei]*pssf[facei]; } } igGrad /= mesh.V(); gGrad.correctBoundaryConditions(); // 调用GeometricField成员函数 return tgGrad; }