AlejGarcia / IntroFHD

Introductory materials (notes, Python notebook, etc.) for fluctuating hydrodynamics (FHD)
4 stars 0 forks source link

Static structure factor #1

Open sijiehuang23 opened 5 months ago

sijiehuang23 commented 5 months ago

Prof. Garcia,

On line 8 in the last cell of the Jupyter note book, when you computing the static structure factor, you multiply it by the cell number NN, for which I don't understand. Could you please explain it?

Thanks!

AlejGarcia commented 5 months ago

Hello, The factor is due to the way that NumPy normalizes the FFT Fourier transform. Often this factor of N is included in the definition of the structure factor but I wanted to use the NumPy result directly. Hope that makes sense, if not let me know. Alejandro

sijiehuang23 commented 5 months ago

Hello, The factor is due to the way that NumPy normalizes the FFT Fourier transform. Often this factor of N is included in the definition of the structure factor but I wanted to use the NumPy result directly. Hope that makes sense, if not let me know. Alejandro

I kind of guessed that it is related to the FFT. But the structure factor is <\hat{u}\hat{u}^*>, shouldn't it be multiplying NN^2 for the structure factor?

AlejGarcia commented 5 months ago

I had the same question at first but then if you look at eqn. (23) in the notes (Intro_FHD_notes.pdf), plug it into the definition in the notes of structure factor ($S_k = \langle \hat{T}_k \hat{T}^*_k \rangle$) using eqn. (24) for the definition of Fourier transform then you should get eqn. (25) once you evaluate the summations.

It should be noted that structure factor is often defined such that the factor of N does not appear by putting a factor of 1/sqrt(N) in the definition of the Fourier transform. Make sense?

sijiehuang23 commented 5 months ago

Okay, I see your point. So if I'm not wrong, the factor $N$ comes from the orthogonality of the Fourier basis when we plug eq.(23 & 24) into the definition $S_k = \langle \hat{T}_k\hat{T}^*_k\rangle$, with $\langle T_i\rangle^2 = T_e^2$. Am I correct?

However, this brings to another question. If we look at the stochastic heat equation in Fourier space $$d_t\hat{T}_k = -\kappa k^2\hat{T}_k + i\boldsymbol{k}\hat{\boldsymbol{Z}}_k$$ This is basically a Langevin equation. By the fluctuation-dissipation theorem, we should have $$\langle\hat{T}_k\hat{T}^*_k\rangle = \frac{k_BT_e^2}{\rho c_V}$$ without the factor $N$. I don't know how to reconcile these two different conclusions (with and without factor $N$).

When I carry out my only simulation of a 2D stochastic heat equation (using Galerkin Fourier method and the RK3 time integrator in Delong et al., 2013), given the FFT convention used in numpy (without normalizing by $N$) $$\hat{T}_k = \sum_j T_je^{-i2\pi kj/N}$$ I have to compute the following $$\frac{\rho c_V}{Nk_BT_e^2}\langle\hat{T}_k\hat{T}^*_k\rangle = 1$$ to show the result of unity, which does imply that there is a factor $N$ in the structure factor, i.e., $$S_k = \frac{k_BT_e^2}{\rho c_V}N.$$ I think this is similar to how the power spectral density is computed (see this). But still, I don't see how $N$ comes into play if we derive the structure factor in Fourier space like I mentioned above. For now, I can only guess that this is related to the discrete nature of FFT.