emmanuel germaine, 2009-01-29 12:10
I want to plot the 1D energy spectra (Euu=f(kappa)) at different y-location (e.g, one close to the wall and the other close to the centerline).
Can I do that starting with the following ?
u.makeSpectral();
u.saveSpectrum("data/uspectra");
Thank you Emmanuel
Discussion
Ooops! I haven't been checking this forum often enough.
No, the FlowField::saveSpectrum function saves a 2D function E(kx,kz) where
I.e the (square root of) the total energy in the kx,kz Fourier mode.
Can you write n expression for me the quantity you want to compute in terms of the velocity field? Then I can tel you how to compute it.
John
I mean, write down an expression that shows mathematically how the quantity you are interested is derived from the velocity field. E.g. for vorticity, it would be
There are too many conventional quantities in fluid mechanics for me to keep track of!
Gotcha. There is not a built-in function for doing this but you could write one along these lines
array<Real> Ekx(FlowField& u, int ny) { u.makeState(Spectral, Physical); array<Real> rtn(u.kxMax()); for (int kx=0; kx<u.kxMax(); ++kx) { Real sum=0; int mx = u.mx(kx); for (int i=0; i<u.Nd(); ++i) for (int mz=0; mz<u.Mz; ++mz) sum += abs2(u.cmplx(mx,ny,mz,i)); rtn[kx] = sum; } return rtn; }and similarly for kz. A couple caveats: The textbook E(kappa_x) is for continuous kappa_x and the above is for discrete values kx, where kappa_x = 2*pi*kx/Lx. You would have to double-check that relation and test out the results on some known functions to be sure. Also, the above code only produces E(kx) for kx>0. I suppose it'll be symmetric in +/- kx for real-valued fields, right?
John