I am testing example of the Magnus Effect for OpenFoam-9 https://drive.google.com/file/d/1J2rKIRU8DAZadORyjUfd6OBBcfR-9rLo/view?usp=sharing
What I got from https://holzmann-cfd.com/community/training-cases/magnus-effect
And it works fine:
But when I change STL object with shifted a little position in STL file then simulation is breaking
snappyHexMeshDict:
geometry
{
cylinder_x01y0z0.stl
{
type triSurfaceMesh;
name cylinder;
}
};
Please help to understand why a little position shifting in STL file breaks simulation.
Thank you in advance.
Try to change the code in 0.orig/U
for your cylinder
boundary condition as follows (See the comments):
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);
#};
}