correctBoundaryConditions里修正面心梯度的公式没看明白



  • 代码在src/finiteVolume/finiteVolume/gradSchemes/gaussGrad/gaussGrad.C144行:

    template<class Type>
    void Foam::fv::gaussGrad<Type>::correctBoundaryConditions
    (
        const GeometricField<Type, fvPatchField, volMesh>& vsf,   
        GeometricField
        <
            typename outerProduct<vector, Type>::type, fvPatchField, volMesh
        >& gGrad
    )
    {
        typename GeometricField
        <
            typename outerProduct<vector, Type>::type, fvPatchField, volMesh
        >::Boundary& gGradbf = gGrad.boundaryFieldRef();
    
        forAll(vsf.boundaryField(), patchi)
        {
            if (!vsf.boundaryField()[patchi].coupled())
            {
                const vectorField n
                (
                    vsf.mesh().Sf().boundaryField()[patchi]
                  / vsf.mesh().magSf().boundaryField()[patchi]
                );
    
                gGradbf[patchi] += n *
                (
                    vsf.boundaryField()[patchi].snGrad()
                  - (n & gGradbf[patchi])
                );
            }
         }
    }
    

    里面vsf应该是待求梯度的场吧、然后gGradbf是根据体心梯度插值得到的面心梯度、n是面单位法向、.snGrad()是$\frac{\phi_{f}-\phi_{C}}{d_{Cf}}$ ?
    这个面心梯度的修正公式怎么来的我还是没看懂:

    gGradbf[patchi] += n *
    (
        vsf.boundaryField()[patchi].snGrad()
      - (n & gGradbf[patchi])
    );
    


  • 自己翻书找到答案了:136:《The FVM in CFD(OpenFOAM, Matlab)》那本书Page 303有讲到:
    选区_001.png



  • 感谢分享!!:146: :146:


Log in to reply