# decay 2d turbulence - the initial field

 Register Blogs Members List Search Today's Posts Mark Forums Read

 October 18, 2013, 10:53 #21 New Member   Dhruv Mehta Join Date: Jun 2012 Posts: 22 Rep Power: 7 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: 7 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 Senior Member   Reza Join Date: Mar 2009 Location: Appleton, WI Posts: 116 Rep Power: 10 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: 7 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     Praveen. C Join Date: Mar 2009 Location: Bangalore Posts: 273 Blog Entries: 6 Rep Power: 11 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. FMDenaro likes this. __________________ http://cpraveen.github.io http://twitter.com/cfdlab

 December 15, 2013, 04:54 #26 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,689 Rep Power: 41 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 diverge-free 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 divergence-free results. This example explains why when the solution is divergence-free 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: 7
Quote:
 Originally Posted by praveen 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.

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 Senior Member   Reza Join Date: Mar 2009 Location: Appleton, WI Posts: 116 Rep Power: 10 They are mathematically equal. So divergence free-ness 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 wave-form will have a k of sin(kh)/h. So, if you want your physical space to be divergence-free 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: 7 Thank you very much I will try to edit the code to satisfy the 'sine' condition you mentioned.

 December 15, 2013, 11:44 #30 Senior Member   Reza Join Date: Mar 2009 Location: Appleton, WI Posts: 116 Rep Power: 10 That is a work-around 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: 7 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 Senior Member   Reza Join Date: Mar 2009 Location: Appleton, WI Posts: 116 Rep Power: 10 I see. So you are not using a spectral code to solve the problem, and just need an initial velocity for your non-sectral 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 divergence-free 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: 7 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 energy-conserving schemes. Thank you again for helping me with this

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Industrial_CFD OpenFOAM Running, Solving & CFD 21 February 24, 2013 16:39 tH3f0rC3 OpenFOAM 7 February 23, 2013 06:37 nileshjrane OpenFOAM Running, Solving & CFD 8 August 26, 2010 12:50 vaina74 OpenFOAM Running, Solving & CFD 3 June 8, 2010 12:30 ronaldo OpenFOAM 4 September 14, 2009 07:11

All times are GMT -4. The time now is 11:54.