1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Gradient question for fluid simulation

  1. Sep 18, 2007 #1
    Simple gradient question.. I have a kernel function that determines the influence of each water droplet given a radius r:

    (10/pi*h^5)*(h-r)^3

    The gradient of that is:
    (-30/pi*h^5)*(h-r)^2

    But 'r' is not a vector, its a scalar, its just the distance to the point in question. So how do I get a gradient vector out of that equation? Maybe I want to replace 'r' with the x distance and use that to determine the 'x' component of the gradient, and same for 'y'? But that doesn't seem right..

    (yes, i know this is a newb question, thanks for any help! It's not homework just a project I'm working on for fun.)
    -John
     
  2. jcsd
  3. Sep 18, 2007 #2

    nrqed

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Welcome to Physics Forums!

    It depends what you mean by "r" here. What coordinate system are you using? Are you in spherical coordinates? Then you simply have to look up the gradient in spherical coordinates
    [tex] \vec{\nabla} V = \frac{\partial V}{\partial r} \hat{r} + \frac{1}{r} \frac{\partial V}{\partial \theta} \hat{\theta} + \frac{1}{r sin \theta} \frac{\partial V}{\partial \phi} \hat{\phi} [/tex]
     
  4. Sep 18, 2007 #3
    Thanks :)

    It's actually in Cartesian coordinates, x and y (it's 2d, not 3d). When I calculate this function, I first compute the distance from 0,0 to x,y, and assign that to 'r'. 'h' is a constant (representing the size of the kernel I'm applying).

    So maybe I want something like:

    (gradient f) = { (change in x)/(change in f), (change in y)/(change in f) }

    And then restructure my equation, substituting '(sqrt(x^2 + y^2))' for r... Does that sound right?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Gradient question for fluid simulation
Loading...