0
changing STL position breaks simulation or crash solver

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.


OpenFOAM 28-12-21, 2:52 a.m. VadymOstanin
0
1. Try "Rescale to data range" in ParaView to see correct results. Sometimes it does not update automatically. 2. Are you getting any error in the terminal while running the simulation or it is just when you visualize results in ParaView? Regards,
Divyesh Variya
28-12-21, 4:59 p.m. divyesh

@divyesh Thank you for your efforts.

Rescalling over all timesteps smooth alittle, but no the Magnus effect.

And if STL is with shifted cylinder 0.1mm over X axis ("constant/triSurface/cylinder_x01y0z0.stl" ) then crash occured after 3 seconds of simulation

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::GaussSeidelSmoother::smooth(Foam::word const&, Foam::Field<double>&, Foam::lduMatrix const&, Foam::Field<double> const&, Foam::FieldField<Foam::Field, double> const&, Foam::UPtrList<Foam::lduInterfaceField const> const&, unsigned char, int) at ??:?
#4  Foam::GaussSeidelSmoother::smooth(Foam::Field<double>&, Foam::Field<double> const&, unsigned char, int) const at ??:?
#5  Foam::smoothSolver::solve(Foam::Field<double>&, Foam::Field<double> const&, unsigned char) const at ??:?
#6  ? in "/opt/openfoam9/platforms/linux64GccDPInt32Opt/bin/pisoFoam"
#7  ? in "/opt/openfoam9/platforms/linux64GccDPInt32Opt/bin/pisoFoam"
#8  ? in "/opt/openfoam9/platforms/linux64GccDPInt32Opt/bin/pisoFoam"
#9  ? in "/opt/openfoam9/platforms/linux64GccDPInt32Opt/bin/pisoFoam"
#10  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#11  ? in "/opt/openfoam9/platforms/linux64GccDPInt32Opt/bin/pisoFoam"
./run: line 74:  8840 Floating point exception(core dumped) pisoFoam > logSolver
   - Simulation ended


28-12-21, 10:55 p.m. VadymOstanin

Login to add comment


0
@divyesh Solution is found. Appling shifting vector to rotation transformation solves issue. https://stackoverflow.com/questions/70500453/openfoam-changing-stl-position-lead-to-undefine-behaviour-or-crash# Fix code is with "<<<<" 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);

        #};
    }
29-12-21, 1:22 a.m. VadymOstanin

Great! Thanks for posting the correct code. It will help others too.

Regards,
Divyesh Variya


29-12-21, 10:15 a.m. divyesh

Login to add comment


0
I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.
run 3
05-01-22, 1:16 p.m. run3donlineaz


0
Really knew some new facts here las vegas eyelash extensions
21-03-22, 7:36 p.m. geebranz


Log-in to answer to this question.