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

How can I use complex numbers in OpenFOAM.

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By kev4573

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 20, 2009, 11:16
Angry How can I use complex numbers in OpenFOAM.
  #1
New Member
 
Join Date: Nov 2009
Posts: 2
Rep Power: 0
zola is on a distinguished road
Hi Foamers
How can I use complex numbers in OpenFOAM. I want to introduce a formula such:
a/(c+ i d).
Thanks
zola is offline   Reply With Quote

Old   November 21, 2009, 14:54
Default
  #2
Senior Member
 
Kevin Smith
Join Date: Mar 2009
Posts: 104
Rep Power: 17
kev4573 is on a distinguished road
The source code for complex numbers is in
src/OpenFOAM/primitives/complex under your root openfoam directory.

All the operators are there so the code should be pretty simple, something like the following should get you started.

#include "complex.H"
#include "IOstreams.H"

using namespace Foam;

int main()
{
complex a(1, 3);
complex b(1, 2);
complex c = a / b;
Info << a << " / " << b << " = " << c << endl;
return 0;
}
Aaron_L likes this.
kev4573 is offline   Reply With Quote

Reply


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
OpenFoam and complex numbers panara OpenFOAM Pre-Processing 3 June 13, 2017 06:25
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 06:36
How can I use complex numbers in OpenFOAM. zola OpenFOAM Programming & Development 0 November 19, 2009 15:49
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 03:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 04:34.