CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   atan(s) function. openFoam (http://www.cfd-online.com/Forums/openfoam/93187-atan-s-function-openfoam.html)

lulo October 7, 2011 08:23

atan(s) function. openFoam
 
Hi

I can see that the function atan(s) in openFoam can only give results in the 1st and 4th quadrant. (angles between -pi and +pi)

My angle can variate between 0 and 2pi.
Is there any function in openFoam which can give the right result?
I know in Matlab is called atan2(s) but openFoam does not recognise that.

Any idea???

Thanks

wyldckat October 7, 2011 08:41

Hi Luca,

When in doubt about some detail like this, check the code documentation: http://www.openfoam.com/docs/cpp/

Here's the proof that atan2 does exist in OpenFOAM: http://foam.sourceforge.net/docs/cpp...ce.html#l00085 - AFAIK it's the standard C/C++ libraries that don't have atan2.

To use it, you might need to call it by the full path name:
Code:

value = Foam::atan2(x,y);
Instead of:
Code:

value = atan2(x,y);
This last one will most likely assume that the function is a global one, i.e. if available it would be the standard C/C++ one.

Best regards,
Bruno

lulo October 7, 2011 08:59

Thanks a lot.

I was trying atan2(s) but of course it needs 2 variables atan2(x,y).


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