CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   runtime error after succ. compilation + vector component division (https://www.cfd-online.com/Forums/openfoam-programming-development/88631-runtime-error-after-succ-compilation-vector-component-division.html)

ramhari May 22, 2011 10:12

runtime error after succ. compilation + vector component division
 
I have a problem in running after successfully compiling the modified rhoCentralFoam code.

volVectorField rhoU_dummy = rhoU_old;
:
:///////////
:
:
volScalarField q_2 = ( rhoU.component(vector::X) - rhoU_dummy.component(vector::X) ) / rhoU_dummy.component(vector::X) );

compiles well. But when it runs immediately shows "floating point exception" error.
The denominator going zero may be one of the reason. I tried even tried adding 1e-06 to it. It compiles well but throws away the same error during run time.

may be my vector component division goes wrong?

Can anyone help me please : )

marupio May 25, 2011 11:08

You could try using the stabilise function on the denominator. Also, try adding log lines just prior to the equation, so you can see what values are going into it.

ramhari May 26, 2011 01:18

The velocity vector is initially set zero. I think by adding some 1e-06 to it before division should not show any problem. The floating point exception error shows at the
second iteration itself.

marupio May 26, 2011 08:37

The stabilize function will add a small amount to the number if it is close to zero.

ramhari May 28, 2011 15:53

Dear marupio,

I am sorry that i m not getting clearly of what u mean by stabilise function. Can u pls post something of that sort!

marupio May 28, 2011 16:01

Sorry, the function is stabilise(scalar value, scalar smallAmount).

I was wrong - it doesn't check if it is close to zero, it always adds the smallAmount. But, it will add it in the right direction (positive or negative).

Here's how you'd use it:

Code:

volScalarField q_2 = ( rhoU.component(vector::X) - rhoU_dummy.component(vector::X) ) / stabilise(rhoU_dummy.component(vector::X), SMALL) );

ramhari May 30, 2011 06:40

Thanks marupio,


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