exp() function not working?
Hello,
For some reason I don't think that exp() is doing anything... can you please tell me what you think is wrong? I have the following code: Code:
argf2 = sqr(k_)/(6.0*nu()*epsilon_); However, when I bring up f2 in paraview it just shows up as 1 everywhere. If I define f2 in the following way: Code:
f2 = 99-2/9*Foam::exp(-1.0*sqr(argf2)); If I define f2 in the following way: Code:
f2 = -2/9*Foam::exp(-1.0*sqr(argf2)); I have also tried to not use "Foam::" before exp() and it doesn't make a difference. Additionally, when I look at the f2 that was output to the time directory it looks like this: Code:
/*--------------------------------*- C++ -*----------------------------------*\ Thank you! :confused: |
Hi,
Code:
1-2/9*Foam::exp(-1.0*sqr(argf2)) |
Thank you Alexey!
Adding the ".0" to each integer made a difference. Instead of f2 being set to 1 everywhere, it is being set to 0.777778 (i.e.: 1.0 - 2.0/9.0). OpenFOAM still doesn't recognize the Code:
Foam::exp(-1.0*sqr(argf2)) Code:
f2 = 1-2.0*Foam::exp(-1.0*sqr(argf2))/9.0; Code:
/*--------------------------------*- C++ -*----------------------------------*\ Do you think it may have something to do with the way I have initialized f2 and argf2? Code:
argf2 Code:
argf2= sqr(k_)/(6.0*nu()*epsilon_); |
Hi!
Well, as I don't know other values in your problem, I'll try to guess Code:
argf2= sqr(k_)/(6.0*nu()*epsilon_); |
Alexey,
My values for the internal field in the 0 folder are the following: k=2.16e-3 epsilon=6.27e-4 nu=1.53e-5 which would make argf2=(2.16e-3)^2/(6*1.53e-5*6.27e-4)=81.06 (based on initial conditions) Based on your argument, I can tell that f2 should in fact approach 0.77778! exp(-1.0*sqr(argf2)) = 0 -> f2=1.0-2.0/9.0 Thank you. Now the next question is why does OpenFOAM not create the nonuniform list <scalar>? Code:
/*--------------------------------*- C++ -*----------------------------------*\ |
Hi,
Quote:
Code:
f2 = 1.0 - 2.0/9.0*exp(-sqr(argf2)) Quote:
|
Ooops!
My apologies, I was thinking of the value of argf2 at a solid boundary, which yields argf2=0, leading to f2=1-2.0/9.0.*1. Thank you for your help Alexey! |
All times are GMT -4. The time now is 23:22. |