|
[Sponsors] |
Division of a dimensionedScalar by a volScalar Field - Arithmetic Exception |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 25, 2018, 16:22 |
Division of a dimensionedScalar by a volScalar Field - Arithmetic Exception
|
#1 |
Member
Join Date: Feb 2018
Posts: 91
Rep Power: 8 |
Hello,
I would appreciate any input to this problem am facing. Here is the piece of the code. Code:
const volVectorField Uduct = U.db().lookupObject<volVectorField>("U"); const volScalarField Uduct1 = mag(U); dimensionedScalar Length ( "Length", dimensionSet(0, 1, 0, 0, 0, 0, 0), 0.75 ); dimensionedScalar mu ( "mu", dimensionSet(0, 2, -1, 0, 0, 0, 0), 1.81e-05 ); const volScalarField Reynold = (Uduct1*Length)/mu; const scalar first = (3.0/0.4572)/3.7; const scalar second = Foam::pow(first,1.11); dimensionedScalar t1 ( "t1", dimensionSet(0, 0, 0, 0, 0, 0, 0), 6.9 ); const volScalarField third = t1/Reynold; const volScalarField fourth = 4.518/Reynold; const volScalarField fifth = fourth*log10(second+third); const volScalarField frict = -2*log10(first - fifth); const volScalarField frictfact = pow(1/frict,2); The error comes from the line of the code Code:
const volScalarField third = t1/Reynold; Code:
Program received signal SIGFPE, Arithmetic exception. Code:
const volScalarField third = Reynold/t1; Thanks. |
|
June 25, 2018, 16:51 |
|
#2 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30 |
Can you guarantee your velocity to be non-zero everywhere? Otherwise this is plain division by zero.
__________________
*On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer. |
|
June 26, 2018, 07:04 |
|
#3 |
Member
Join Date: Feb 2018
Posts: 91
Rep Power: 8 |
Hi,
Yeah you are right. I cannot guarantee that. What do you recommend. Do I make use of the velocity at the initial condition to calculate the reynolds number, or do I use an if loop to avoid non-zero velocities. P.S. I still can't explain why I get a value when I reverse the division I get a value. Code:
const volScalarField third = Reynold/t1; |
|
June 26, 2018, 07:57 |
|
#4 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30 |
These are really very simple basics. t1 is a non-zero constant, so there is no reason why a division would not give a value. What is unclear?
__________________
*On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer. |
|
June 27, 2018, 10:57 |
|
#5 |
Member
Join Date: Feb 2018
Posts: 91
Rep Power: 8 |
Yeah i was just a bit confused. STill figuring basic details of OpenFOAM.
Thanks a lot |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problems after decomposing for running | alessio.nz | OpenFOAM | 7 | March 5, 2021 05:49 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
Modifying boundaryfield of a volscalar field | hawkeye321 | OpenFOAM | 5 | February 15, 2013 06:01 |
Is good initial guess field is neccessary ? | mmkr825 | OpenFOAM | 5 | October 17, 2012 13:58 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 07:51 |