CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   What's the use of "complex" number mathematics in CFD? (https://www.cfd-online.com/Forums/main/245208-whats-use-complex-number-mathematics-cfd.html)

aerosayan September 21, 2022 08:31

What's the use of "complex" number mathematics in CFD?
 
Hello everyone,

I saw in CFL3D's code that it can be built to run with complex numbers. Same for BLAS/LAPACK and few other.

What is their use in CFD?

And, is it important for me to learn writing code with complex numbers? and when would it be important to learn?

LuckyTran September 21, 2022 09:21

The Harmonic balance method comes to mind which is a specific approach for solving the phase-averaged or ensemble averaged Navier-Stokes, which is in between steady RANS and time-domain unsteady RANS.

Any time turbulence modeling is involved then we tend to stick with a time-domain approach with real vectors due to the chaotic, random nature of turbulence. If there is no turbulence and you have a nice laminar coherent system of equations then it could make more sense to use complex representations, especially when your system is coupled with other complex systems (i.e. maxwell's equations, MHD, QED, and so on).

I would say no specifically to complex numbers from a coding standpoint. That is because you can always convert a (say linear) differential equation in complex numbers into a system of non-linear algebraic equations that can then be solved using methods for solving linear systems that you are already familiar with.

FMDenaro September 21, 2022 11:05

Quote:

Originally Posted by aerosayan (Post 836233)
Hello everyone,

I saw in CFL3D's code that it can be built to run with complex numbers. Same for BLAS/LAPACK and few other.

What is their use in CFD?

And, is it important for me to learn writing code with complex numbers? and when would it be important to learn?




Fourier series is based on complex number, therefore spectral methods requires to know that before to work in CFD.
But also to understand the role of the stability analysis (von Neumann), numerical diffusion and dispersion you need to know complex numbers.

agd September 21, 2022 12:04

I don't know about CFL3d in particular, but the most common use of complex variables in a flow solver (or any implicit solver where a system Jacobian has to be computed) is to use complex differentiation to easily evaluate 2nd-order accurate values for the system Jacobian. It is a technique that can be thought of as a poor man's automatic differentiation. You can find a number of papers on it if you google complex differentiation for numerics or some such topic.


All times are GMT -4. The time now is 12:18.