
[Sponsors] 
October 18, 2013, 10:53 

#21 
New Member
Dhruv Mehta
Join Date: Jun 2012
Posts: 22
Rep Power: 5 
Thank you !
I will try to run it 

October 24, 2013, 05:50 

#22 
New Member
Dhruv Mehta
Join Date: Jun 2012
Posts: 22
Rep Power: 5 
Hello Reza
I had another question regarding the 3D field generated with Rogallo's code and would be very thankful if you could help me. The spectrum of the velocity field that the code generates is not matching the spectrum that the velocity field is expected to have, which is also an input to the code for generating the velocity field. There is a dampening of the spectrum by a large factor, especially at low wavenumbers. I was wondering if you would know why is this happening. I checked my code and could not find anything wrong in the formulae that I use. Thank you. Regards 

October 24, 2013, 22:14 

#23 
Member
Reza
Join Date: Mar 2009
Location: Appleton, WI
Posts: 99
Rep Power: 8 
I don't remember such a difference. How are you calculating the spectrum? At higher frequencies because of aliasing you might get a bit higher energy, but can't think of a reason for a difference in lower frequencies. It was a long time ago when I was playing with DNS.


December 14, 2013, 22:12 

#24 
New Member
Dhruv Mehta
Join Date: Jun 2012
Posts: 22
Rep Power: 5 
Hello Reza
I tried using the code that you gave me. It does indeed help make enforce the conjugate symmetry. However, I noticed that using ifftn (in MATLAB) with 'symmetric' defining the type of ifft, also delivers the same result. With that done, I have a big problem. Although the velocity field is divergence free in wavenumber space, it loses its solenoidal character when the ifft is used to convert it into physical space. Would you know why this happens or if there is a way of correcting this? Thank you ! Kind regards Dhruv 

December 15, 2013, 01:15 

#25 
Super Moderator

How do you compute divergence in physical space ? using finite differences will not be accurate. You have to take divergence of the spectral interpolation of the velocity field, which should then give you zero divergence upto machine precision, since it is constructed to be solenoidal in fourier space.
__________________
http://twitter.com/cfdlab 

December 15, 2013, 04:54 

#26 
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,584
Rep Power: 20 
yes, this problem is quite usual .... just think about a simulation performend in the physical space, for example an exact projection with second order discretization. You will have a divergefree solution up to machine precision but only when the divergence of the velocity is computed on the compact stencil with central second order formula. If you try to compute the divergence using different discretizations (even higher order discretizations) you have no longer a divergencefree results.
This example explains why when the solution is divergencefree in wavenumber space you can not ensure the same result (in discrete sense) in physical space. You can try different formulas of various accuracy but you have to accept some tolerance. 

December 15, 2013, 09:22 

#27  
New Member
Dhruv Mehta
Join Date: Jun 2012
Posts: 22
Rep Power: 5 
Quote:
Hello Praveen Thank you for your reply. However, I still did not understand whether it converting Rogallo's spectral field into a divergence free field in physical space is possible or not. I did get zero divergence in spectral space using kx*u + ky*v + kz*w, you mean that is all I can get? Thanks again ! Regards Dhruv 

December 15, 2013, 11:16 

#28 
Member
Reza
Join Date: Mar 2009
Location: Appleton, WI
Posts: 99
Rep Power: 8 
They are mathematically equal. So divergence freeness in physical space, means kx ux+ky uy+kz uz = 0 in the Fourier space. But this doesn't mean they are numerically the same. For example, if you calculate du/dx in physical space by central difference with a grid size of h, then the equivalent waveform will have a k of sin(kh)/h. So, if you want your physical space to be divergencefree with central difference, then you should have:
sin(k_x h)/h u_x+sin(k_y h)/h u_y+sin(k_z h)/h u_z=0 in Fourier space. Last edited by triple_r; December 15, 2013 at 11:17. Reason: typo 

December 15, 2013, 11:39 

#29 
New Member
Dhruv Mehta
Join Date: Jun 2012
Posts: 22
Rep Power: 5 
Thank you very much
I will try to edit the code to satisfy the 'sine' condition you mentioned. 

December 15, 2013, 11:44 

#30 
Member
Reza
Join Date: Mar 2009
Location: Appleton, WI
Posts: 99
Rep Power: 8 
That is a workaround though. And it just converts your spectral code to a central finite difference code.


December 15, 2013, 11:47 

#31 
New Member
Dhruv Mehta
Join Date: Jun 2012
Posts: 22
Rep Power: 5 
So, I can use the velocity field generated with Rogallo's code after converting it to physical space for a normal simulation?
I would then expect the field to readjust itself (to a possibly lower values of divergence) in physical space after a few turnover times after evolving in accordance with the navier stokes equation? 

December 15, 2013, 11:51 

#32 
Member
Reza
Join Date: Mar 2009
Location: Appleton, WI
Posts: 99
Rep Power: 8 
I see. So you are not using a spectral code to solve the problem, and just need an initial velocity for your nonsectral method? If that is the case, then you can use the sine relation I gave above to get the physical velocity field that better satisfies the continuity. But you need to change the velocity field given by Rogallo as it won't be divergencefree in the sense that you are after.


December 15, 2013, 11:56 

#33 
New Member
Dhruv Mehta
Join Date: Jun 2012
Posts: 22
Rep Power: 5 
Yes, I have started changing the code to satisfy
sum( sin(h*kx)/h * ux ) = 0 and obtain u,v,w in spectral space. Then I will convert these into physical space for my simulations. I know it is weird to use a physical space code for LES, but I am working with energyconserving schemes. Thank you again for helping me with this 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
pisoFoam  unstable pressure residual  Industrial_CFD  OpenFOAM Running, Solving & CFD  21  February 24, 2013 16:39 
problem with Min/max rho  tH3f0rC3  OpenFOAM  7  February 23, 2013 06:37 
Error while running rhoPisoFoam..  nileshjrane  OpenFOAM Running, Solving & CFD  8  August 26, 2010 12:50 
lift and drag on ship superstructures  vaina74  OpenFOAM Running, Solving & CFD  3  June 8, 2010 12:30 
ForcesCoeffs  ronaldo  OpenFOAM  4  September 14, 2009 07:11 