CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   Programming a CFD code using complex variables (

New coding June 30, 2008 18:02

Programming a CFD code using complex variables

In Math you can use Integer(E), Real(R) or Complex(Z) numbers. In multiphase flow (VOF or bubbles, evaporation, boiling) the results locus and validations can be plotted on Nyquist-type diagrams (plotting the variation of the Amplitude and the Argument Z=Aexp(i.theta).

We would like to program a new CFD code using complex variables (Z = U1 + iU2 = Aexp(i.theta) )

Which language would you suggest to handle complex variables: derivation, convertion to amplitude and argument, etc...


triple_r July 3, 2008 21:32

Re: Programming a CFD code using complex variables
Well, it's easy in MATLAB, but I wouldn't recommend that for much of anything in CFD. Fortran has a complex variable data type, and you can work with complex numbers in C also. In C++ you could even overload the operators which could make the math very easy to write, although you always need to be careful when you do this. So to answer your question, I don't think handling of complex variables should dictate which language you write in. Use what you're comfortable with.

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