Skip to content
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
CFD中文网

CFD中文网

  1. CFD中文网
  2. OpenFOAM
  3. 梯度场的correctBoundaryConditions()是什么意思?

梯度场的correctBoundaryConditions()是什么意思?

已定时 已固定 已锁定 已移动 OpenFOAM
4 帖子 2 发布者 1.7k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • V 离线
    V 离线
    Voynich
    写于 最后由 编辑
    #1

    最近开始学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;
    }
    
    1 条回复 最后回复
  • 李东岳李 离线
    李东岳李 离线
    李东岳 管理员
    写于 最后由 编辑
    #2

    correctBoundaryConditions()不更新的话,边界条件的值没有随着更新。你的理解是正确的

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    V 1 条回复 最后回复
  • V 离线
    V 离线
    Voynich
    在 中回复了 李东岳 最后由 编辑
    #3

    @李东岳 李老师,您是说gGrad.correctBoundaryConditions();的作用就是根据gGrad的边界条件更新gGrad的边界值,是吗?

    1 条回复 最后回复
  • 李东岳李 离线
    李东岳李 离线
    李东岳 管理员
    写于 最后由 编辑
    #4

    是的。

    http://dyfluid.com/index.html
    需要帮助debug算例的看这个 https://cfd-china.com/topic/8018

    1 条回复 最后回复

  • 登录

  • 登录或注册以进行搜索。
  • 第一个帖子
    最后一个帖子
0
  • 最新
  • 版块
  • 东岳流体
  • 随机看[请狂点我]