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

atan(s) function. openFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 7, 2011, 08:23
Exclamation atan(s) function. openFoam
  #1
Member
 
luca
Join Date: Feb 2011
Posts: 34
Rep Power: 6
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
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,503
Blog Entries: 34
Rep Power: 86
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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: 6
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

Reply

Tags
atan, function, openfoam

Thread Tools
Display Modes

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 On
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 05: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 12:31
OpenFoam 14 installation problem gfcoppola OpenFOAM Installation 20 November 2, 2007 14:38


All times are GMT -4. The time now is 07:38.