CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Basic and simple SPH-code questions (smoothed particle hydrodynamics)

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 11, 2014, 14:02
Default Basic and simple SPH-code questions (smoothed particle hydrodynamics)
  #1
New Member
 
Philipp
Join Date: Mar 2014
Posts: 3
Rep Power: 12
Peacekeeper is on a distinguished road
Hi!
This is my first post in this forum, so I really appreciate any help. This problem is driving me crazy in the last days. And sorry for my English …
As a hobby i´m trying to improve my python (3.3) skills and my knowledge in fluid dynamics. Recently I discovered some interesting paper concerning SPH (Smoothed Particle Hydrodynamics).

http://software.intel.com/en-us/arti...-games-part-15
http://obswww.unige.ch/lastro/confer...f/lecture4.pdf

The Internet is full of it, so I decided to create my own very basic version of it. My goals are:

- Acceleration only based on the pressure gradient for now (tough enough! )
- Collision, viscosity and not using euler integration is scheduled for later…
- Thanks to numpy a fast nearest neighbor algorithm is already integrated

But after getting the first (rather unstable) results I begin to wonder if I really understand the math behind it. I will begin with the two most basic things to do in sph - get the density and pressure with the kernel.
Regarding the density I used this equatation:

With a spiky kernel (q = r/h for normalization)

After blindly programming everything the results worry me:

How can I compute density by rather random weighted functions? How can I compute density by adding weighted point masses together? In the end I still have a mass. If I increase the range h I get information from more and more particles so the “density”-value will rise. Some kernels return “1” for zero “q” (= maximum value of W) some return random values like “3.92”. So I get totally random values for my particle density. In my head as an (unprofessional) example it looks like this:

Shouldn’t I somehow tie the accumulated masses to the observed volume (or surface) to get the density? But I have not seen that in the codes I looked at:

"dist = particle.Position - ((FluidParticle) particles[nIdx]).Position;
particle.Density += particle.Mass * this.SKGeneral.Calculate(ref dist);”

Most authors use this to calculate the pressure afterwards:

P_0 ist called the rest density and usually 998 kg/m³ for water. Then it really stops making any sense to me:

Pi=k * (0.0217 kg(?) -998 kg/m³ ) .. äh what?

Result is obviously a totally wrong pressure.
My next question is how to use a gradient when I have no scalar-field but a simple function W(r,h). I think I did it the right way but before I go into that in detail I hope my most noobish questions can be answered

Greetings
JP
Peacekeeper is offline   Reply With Quote

 


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ICEM] Meshing adjacent wall geometry and simple ICEM questions everdimension ANSYS Meshing & Geometry 25 June 20, 2012 04:25
LES basic and simple questions. dshawul Main CFD Forum 0 October 4, 2010 10:56
Basic Blade Design Code apoorv Main CFD Forum 0 April 5, 2010 06:37
Progressing to write my own simple code Jonny6001 Main CFD Forum 5 October 19, 2009 15:09
A simple CFD code for teaching basic CFD? Christoph Lund Main CFD Forum 13 September 14, 2005 04:36


All times are GMT -4. The time now is 15:09.