CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (https://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   OpenFOAM 1.5.x.git (https://www.cfd-online.com/Forums/openfoam-bugs/62778-openfoam-1-5-x-git.html)

niklas March 19, 2009 08:23

setDeltaT
 
Im running 1.5.x.git version.

dont know if this counts as a bug, but it produces a sigFpe error.

I'm running engineCompRatio and when I reach TDC it crashes.
I traced the crash to the setDeltaT-line, when t1=0

Code:

   
while(mag(ca-ca1) > eps)
{
    ca = runTime.theta();
    scalar t1 = runTime.userTimeToTime(ca1-ca);
    runTime.setDeltaT(t1);
    runTime++;
    Info << "CA = " << runTime.theta() << endl;
    mesh.move();
}

Its easily fixed by the modification below.
But should there be some sort of warning/fix in setDeltaT when one tries to set the timestep to 0.

Code:

   
while(mag(ca-ca1) > eps)
{
    ca = runTime.theta();
    if (mag(ca-ca1) > eps)
    {
        scalar t1 = runTime.userTimeToTime(ca1-ca);
        runTime.setDeltaT(t1);
        runTime++;
        Info << "CA = " << runTime.theta() << endl;
        mesh.move();
    }
}

N

henry March 22, 2009 17:46

Is it possible for the first loop:

if (mag(ca - ca0) > eps)
{
while(mag(ca - ca0) > eps)
{
ca = runTime.theta();
scalar t0 = runTime.userTimeToTime(ca0 - ca);
runTime.setDeltaT(t0);
runTime++;
Info << "CA = " << ca << endl;
mesh.move();
}
}

to suffer from the same problem? Also wouldn't it be better to reorganize the loops so that the test is only required once?

H

niklas March 23, 2009 04:46

Sorry for the bad naming of the topic, I tried to edit it afterwards, but that wasnt possible...

Quote:

Originally Posted by henry (Post 210308)
Is it possible for the first loop:

if (mag(ca - ca0) > eps)
{
while(mag(ca - ca0) > eps)
{
ca = runTime.theta();
scalar t0 = runTime.userTimeToTime(ca0 - ca);
runTime.setDeltaT(t0);
runTime++;
Info << "CA = " << ca << endl;
mesh.move();
}
}

to suffer from the same problem?

Yes, it is. I just havent seen this yet since I always start at BDC so the
criteria at the entry of the while statement is always false.

Quote:

Originally Posted by henry (Post 210308)
Also wouldn't it be better to reorganize the loops so that the test is only required once?

I just realized you dont have to do anything really,
just replace the ca-caX from the while (..) check and
use runTime.theta()-caX, then the if's can be removed.

N

henry March 23, 2009 10:35

Thanks for the fix, I have pushed it into 1.5.x.

H


All times are GMT -4. The time now is 05:05.