CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

atan(s) function. openFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 7, 2011, 08:23
Exclamation atan(s) function. openFoam
  #1
Member
 
luca
Join Date: Feb 2011
Posts: 34
Rep Power: 15
lulo is on a distinguished road
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
lulo is offline   Reply With Quote

Old   October 7, 2011, 08:41
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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
__________________
wyldckat is offline   Reply With Quote

Old   October 7, 2011, 08:59
Default
  #3
Member
 
luca
Join Date: Feb 2011
Posts: 34
Rep Power: 15
lulo is on a distinguished road
Thanks a lot.

I was trying atan2(s) but of course it needs 2 variables atan2(x,y).
lulo is offline   Reply With Quote

Old   August 11, 2016, 08:35
Default
  #4
Member
 
Join Date: Nov 2012
Posts: 83
Rep Power: 13
Henning86 is on a distinguished road
in doubleScalar it is

atan (y,x)
Henning86 is offline   Reply With Quote

Reply

Tags
atan, function, openfoam


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
bug in "average" function of OpenFOAM jms OpenFOAM 0 March 22, 2011 04:04
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 wyldckat OpenFOAM Announcements from Other Sources 3 September 8, 2010 06:25
Modified OpenFOAM Forum Structure and New Mailing-List pete Site News & Announcements 0 June 29, 2009 05:56
Could you please help me about the VTKFoam liugx212 OpenFOAM Pre-Processing 5 February 13, 2008 11:31
OpenFoam 14 installation problem gfcoppola OpenFOAM Installation 20 November 2, 2007 13:38


All times are GMT -4. The time now is 06:10.