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. 粒子求解器如何实现将粒子的性质加和

粒子求解器如何实现将粒子的性质加和

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

    各位好
    如果想要实现将当前时间步中,计算域内所有粒子的某个性质全部加起来,并且输出(比如我现在想要把当前时间步所有粒子的直径加起来,并且输出)。应该怎样做呢?
    谢谢各位!

    T 1 条回复 最后回复
  • T 在线
    T 在线
    Tens 神
    在 中回复了 杨英狄 最后由 编辑
    #2

    这里以sprayCloud为例,以下代码应该可以达到这个功能,没测试过

    typedef typename basicSprayCloud::parcelType parceltype;
    
    scalar SumD=0;
    
    forAllIter(typename basicSprayCloud::sprayCloudType,parcels,pIter)
    {
       parceltype& p = pIter();
       
       SumD+=p.d();
    }
    Info<<"Sum of D is :"<<SumD<<endl;
    
    杨英狄杨 1 条回复 最后回复
  • 杨英狄杨 离线
    杨英狄杨 离线
    杨英狄
    在 中回复了 Tens 最后由 编辑
    #3

    @ten非常感谢!

    星 1 条回复 最后回复
  • 星 离线
    星 离线
    星星星星晴
    写于 最后由 编辑
    #4

    可以在cloudfunction做这个

    游荡

    杨英狄杨 1 条回复 最后回复
  • 星 离线
    星 离线
    星星星星晴
    在 中回复了 杨英狄 最后由 编辑
    #5

    @杨英狄 可以照抄这个原始的cloudfunction 可以类似楼上在forAllIter中生成一个值。
    https://github.com/OpenFOAM/OpenFOAM-8/blob/master/src/lagrangian/intermediate/submodels/CloudFunctionObjects/RelativeVelocity/RelativeVelocity.C

    其实也可以在cloud中直接找Dij这个function,就能生成了

    template<class CloudType>
    inline Foam::scalar Foam::KinematicCloud<CloudType>::Dij
    (
        const label i,
        const label j
    ) const
    {
        scalar si = 0.0;
        scalar sj = 0.0;
        forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
        {
            const parcelType& p = iter();
            si += p.nParticle()*pow(p.d(), i);
            sj += p.nParticle()*pow(p.d(), j);
        }
    
        reduce(si, sumOp<scalar>());
        reduce(sj, sumOp<scalar>());
        sj = max(sj, vSmall);
    
        return si/sj;
    }
    
    
    template<class CloudType>
    inline Foam::scalar Foam::KinematicCloud<CloudType>::Dmax() const
    {
        scalar d = -great;
        forAllConstIter(typename KinematicCloud<CloudType>, *this, iter)
        {
            const parcelType& p = iter();
            d = max(d, p.d());
        }
    
        reduce(d, maxOp<scalar>());
    
        return max(0.0, d);
    }
    

    sprayCloud就是如下

    template<class CloudType>
    void Foam::SprayCloud<CloudType>::info()
    {
        CloudType::info();
        scalar d32 = 1.0e+6*this->Dij(3, 2);
        scalar d10 = 1.0e+6*this->Dij(1, 0);
        scalar dMax = 1.0e+6*this->Dmax();
        scalar pen = this->penetration(0.95);
    
        Info << "    D10, D32, Dmax (mu)             = " << d10 << ", " << d32
             << ", " << dMax << nl
             << "    Liquid penetration 95% mass (m) = " << pen << endl;
    }
    

    游荡

    1 条回复 最后回复
  • 杨英狄杨 离线
    杨英狄杨 离线
    杨英狄
    在 中回复了 星星星星晴 最后由 编辑
    #6

    @星星星星晴 非常感谢!

    1 条回复 最后回复

  • 登录

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