【问题标题】:OpenFoam: changing STL position lead to undefine behaviour or crashOpenFoam:更改 STL 位置会导致未定义行为或崩溃
【发布时间】:2021-12-27 21:11:45
【问题描述】:

我正在测试 OpenFoam-9 的马格努斯效应示例 https://drive.google.com/file/d/1J2rKIRU8DAZadORyjUfd6OBBcfR-9rLo/view?usp=sharing

我从https://holzmann-cfd.com/community/training-cases/magnus-effect得到什么

而且效果很好:

但是当我改变 STL 对象并在 STL 文件中移动一点位置时,模拟就会中断

snappyHexMeshDict:
geometry
{
    cylinder_x01y0z0.stl
    {
        type triSurfaceMesh;
        name cylinder;
    }
};

请帮助理解为什么 STL 文件中的一点位置移动会破坏模拟。

提前谢谢你。

【问题讨论】:

    标签: simulation openfoam


    【解决方案1】:

    尝试为您的cylinder 边界条件更改0.orig/U 中的代码,如下所示(参见cmets):

        cylinder 
        {
    
            type            codedFixedValue;
            value           uniform (0 0 0);
            name            myBC;
    
            code
            #{
                const scalar time = this->db().time().value();
    
                const fvPatch& boundaryPatch = patch(); 
    
                const vectorField& Cf = boundaryPatch.Cf(); 
    
                vectorField rot(Cf.size(), vector(0,0,0));
                
                const vector CENTER(0.1,0.0, 0.0); // <<<< Add this line and add it below
    
                const scalar rotate_speed_max = 10.0;
                const scalar rotate_time_start = 0.0;
    
                scalar rotate_speed = 0.5 * (time - rotate_time_start) * (time - rotate_time_start);
                rotate_speed = rotate_speed > rotate_speed_max ? rotate_speed_max : rotate_speed;
    
                //- Start motion of the wall after 15s
                if (time > rotate_time_start)
                {
                    rot = rotate_speed * vector(0,0,1) ^ (Cf- CENTER); //<<<< Added here
                    // std::cout << __func__ << ":" << __LINE__ << " rotate_speed=" << rotate_speed <<std::endl;
                }
    
                operator==(rot);
    
            #};
        }
    

    【讨论】:

      猜你喜欢
      • 2018-03-08
      • 1970-01-01
      • 2020-07-06
      • 1970-01-01
      • 2016-03-29
      • 2019-12-28
      • 2011-04-06
      • 2012-05-19
      • 1970-01-01
      相关资源
      最近更新 更多