|
[Sponsors] |
runtime error after succ. compilation + vector component division |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 22, 2011, 11:12 |
runtime error after succ. compilation + vector component division
|
#1 |
New Member
Join Date: Aug 2010
Location: Chennai
Posts: 24
Rep Power: 16 |
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 : ) Last edited by ramhari; May 22, 2011 at 15:08. Reason: I corrected the typo |
|
May 25, 2011, 12:08 |
|
#2 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
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.
|
|
May 26, 2011, 02:18 |
|
#3 |
New Member
Join Date: Aug 2010
Location: Chennai
Posts: 24
Rep Power: 16 |
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. |
|
May 26, 2011, 09:37 |
|
#4 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
The stabilize function will add a small amount to the number if it is close to zero.
|
|
May 28, 2011, 16:53 |
|
#5 |
New Member
Join Date: Aug 2010
Location: Chennai
Posts: 24
Rep Power: 16 |
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! |
|
May 28, 2011, 17:01 |
|
#6 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
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) ); |
|
May 30, 2011, 07:40 |
|
#7 |
New Member
Join Date: Aug 2010
Location: Chennai
Posts: 24
Rep Power: 16 |
Thanks marupio,
|
|
Tags |
division, exception, floating, point, vector |
|
|