Navigation

    CFD中文网

    CFD中文网

    • Login
    • Search
    • 最新

    OpenFOAM源代码解析问题

    OpenFOAM
    2
    6
    192
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 赵
      赵海盛 last edited by 李东岳

      大伙好,最近在读OpenFOAM源代码,遇到两个问题不太明白,望各路大神指点啊。

      1)比如这样的语法:theta.primitiveFieldRef() /= mesh.time().deltaTValue()*mesh.V();
      以我幼儿园级别的C++语法知识,mesh是类对象,time()是成员函数,但搞不懂为何成员函数后面还可以加“.deltaTValue()”这个成员函数呢?

      2)经常看到这样的一个表达形式,

      scalarField sumPhi
      (
              fvc::surfaceSum(mag(phi))().primitiveField()
      );
      

      这个代码我能读懂啥意思,就是求某个单元体的各个面的通量和,但有两个问题,一个是surfaceSum(mag(phi))(),为何(mag(phi))后面还有个(),费解啊,不懂啊;第二个是primitiveField()这个函数是干啥的,看到很多地方都用它。

      求指点,好人一生平安!!!

      李东岳 1 Reply Last reply Reply Quote
      • 李东岳
        李东岳 管理员 @赵海盛 last edited by 李东岳

        @赵海盛

        mesh是类对象,time()是成员函数,但搞不懂为何成员函数后面还可以加“.deltaTValue()”这个成员函数呢?

        可以理解成mesh是类对象,time()是成员函数,但是还返回一个类对象,其实mesh.time()返回的是TimeState对象,然后deltaTValue()是TimeState对象的成员函数

        ()OpenFOAM有一些括号被重载了。目前你说的这个表示tmp类型的重载(),要不然的话返回的是一个tmp类型。primitiveField()可以理解成是内部场。

        求某个单元体的各个面的通量和

        对,就是这个意思。对网格单元的面的通量的绝对值加和

        CFD课程 改成线上了 http://dyfluid.com/class.html
        CFD高性能服务器 http://dyfluid.com/servers.html

        赵 1 Reply Last reply Reply Quote
        • 赵
          赵海盛 @李东岳 last edited by

          @李东岳 多谢东岳大婶,恍然大悟的赶脚啊,:140:

          李东岳 1 Reply Last reply Reply Quote
          • 李东岳
            李东岳 管理员 @赵海盛 last edited by

            @赵海盛 是大连的赵老师么 :chouchou:

            CFD课程 改成线上了 http://dyfluid.com/class.html
            CFD高性能服务器 http://dyfluid.com/servers.html

            赵 1 Reply Last reply Reply Quote
            • 赵
              赵海盛 @李东岳 last edited by

              @李东岳 是滴:huahua:

              李东岳 1 Reply Last reply Reply Quote
              • 李东岳
                李东岳 管理员 @赵海盛 last edited by

                @赵海盛 :high: :high: :high:

                CFD课程 改成线上了 http://dyfluid.com/class.html
                CFD高性能服务器 http://dyfluid.com/servers.html

                1 Reply Last reply Reply Quote
                • First post
                  Last post

                CFD中文网 | 东岳流体 | 京ICP备15017992号-2