Navigation

    CFD中文网

    CFD中文网

    • Login
    • Search
    • 最新

    在StochasticDispersionRAS模型中调用颗粒位置的值

    OpenFOAM
    3
    7
    770
    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.
    • H
      hotairballon1997 last edited by

      现想通过修改StochasticDispersionRAS的C文件,使颗粒的随机扰动UTurb,和颗粒所处的位置(距离原点的位置)相关。请问在颗粒的C文件中应该怎样正确地调用颗粒位置的值呢?

      我有试过“const vector & position”,和“position()”之类的,但是并不能成功编译。

      浪 1 Reply Last reply Reply Quote
      • 浪
        浪迹天大 @hotairballon1997 last edited by

        @hotairballon1997 应该无法获取的,可以直接改接口,把 position 传进来。

        OpenFOAM 学习交流:https://openfoam.top

        1 Reply Last reply Reply Quote
        • H
          hotairballon1997 last edited by hotairballon1997

          @浪迹天大 请问您说的改接口是指怎么操作?

          我看到插值读取Uc的代码里,确实有颗粒位置值position()带入,您提到的改接口的意思是把这个position()赋值给一个新变量嘛?

          Uc_ = td.UInterp().interpolate(this->position(), tetIs);
          
          浪 1 Reply Last reply Reply Quote
          • 浪
            浪迹天大 @hotairballon1997 last edited by

            @hotairballon1997 我的意思是,找到能够获取 position的地方,然后通过函数参数,一层一层传到当前的函数。

            OpenFOAM 学习交流:https://openfoam.top

            1 Reply Last reply Reply Quote
            • 李东岳
              李东岳 管理员 last edited by

              插一句,UTurb这个应该是放在连续相的
              再插一句,楼主算的是什么,拉格朗日这面湍流分散力我们之前曾经研究过2个月,至少针对气液多相流来说,结果很不好。后来那个学生去香港了,就不了了之了。

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

              H 1 Reply Last reply Reply Quote
              • H
                hotairballon1997 @李东岳 last edited by

                @浪迹天大 谢谢您的回复,我还是想问问这个position()是不是所说的颗粒的位置值?但是好像参数的格式与我最终要传到UTurb里的格式不太一样,所以导致无法编译成功。。想问问应该怎么一层一层传导?

                @李东岳 谢谢李老师关注,我在做的是颗粒流射入腔体内的一个模拟,确实stochastic模型本身是只适合于各向同性流动的,算出来的结果很不好,所以我现在想将UTurb的计算过程进行修改,所以还是针对颗粒相的。

                之前有试过在UTurb的方向值dir中添加与流体速度Uc的相关性(修改如下),结果能稍微有些改进。现在想将与颗粒位置的相关性也添加进来,但是position和Uc不一样,没有在这个C文件中声明,所以不知道该怎么调用它?

                        {
                            tTurb = 0;
                
                            const scalar sigma = sqrt(2*k/3.0);
                
                            // Calculate a random direction dir distributed uniformly
                            // in spherical coordinates
                
                            const scalar theta = rnd.sample01<scalar>()*twoPi;
                            const scalar u = 2*rnd.sample01<scalar>() - 1;
                
                            const scalar a = sqrt(1 - sqr(u));
                
                            // 修改部分开始
                            const scalar Uc_x = Uc.component(0);
                            const scalar Uc_y = Uc.component(1);
                            const scalar Uc_z = Uc.component(2);
                        
                            scalar f_x = mag(sqrt(sqr(Uc_y)+sqr(Uc_z)))/mag(Uc);
                            scalar f_y = mag(sqrt(sqr(Uc_x)+sqr(Uc_z)))/mag(Uc);
                            scalar f_z = mag(sqrt(sqr(Uc_x)+sqr(Uc_y)))/mag(Uc);
                
                            scalar dir_x = f_x*a*cos(theta); 
                            scalar dir_y = f_y*a*sin(theta);
                            scalar dir_z = f_z*u;
                            const vector dir(dir_x, dir_y, dir_z);
                            // 修改部分结束
                            (源文件是只有一句:const vector dir(a*cos(theta), a*sin(theta), u);)
                
                            UTurb = sigma*mag(rnd.GaussNormal<scalar>())*dir;
                        }
                
                1 Reply Last reply Reply Quote
                • 李东岳
                  李东岳 管理员 last edited by

                  我们当时也是添加各向异性,你可以把这个加到你的dispersion函数里面

                  const typename TrackCloudType::parcelType& p =
                          static_cast<const typename TrackCloudType::parcelType&>(*this);
                  const point start = p.position();
                  

                  这个函数上面添加上p.position()然后传入进去,因为td没有position()函数,但是p有

                  就是 @浪迹天大 说的,一步一步弄,

                  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