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

How can I use complex numbers in OpenFOAM.

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 20, 2009, 10: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, 13:54
Default
  #2
Senior Member
 
Kevin Smith
Join Date: Mar 2009
Posts: 103
Rep Power: 7
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;
}
kev4573 is offline   Reply With Quote

Reply

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
How can I use complex numbers in OpenFOAM. zola OpenFOAM Programming & Development 0 November 19, 2009 14:49
Superlinear speedup in OpenFOAM 13 msrinath80 OpenFOAM Running, Solving & CFD 17 August 22, 2009 03:59
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 18:07
OpenFoam and complex numbers panara OpenFOAM Pre-Processing 2 July 12, 2005 05:52


All times are GMT -4. The time now is 19:50.