OpenFoam:更改 STL 位置会导致未定义的行为或崩溃
OpenFoam: changing STL position lead to undefine behaviour or crash
我正在测试 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 文件中的一点位置偏移会破坏模拟。
提前致谢。
尝试将 0.orig/U
中的代码更改为您的 cylinder
边界条件,如下所示(参见评论):
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);
#};
}
我正在测试 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 文件中的一点位置偏移会破坏模拟。
提前致谢。
尝试将 0.orig/U
中的代码更改为您的 cylinder
边界条件,如下所示(参见评论):
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);
#};
}