Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to get the laplacian of a scalar field?

  1. Mar 4, 2015 #1
    Hi,

    I am trying to calculate the laplacian of a scalar field but I might actually need something else. So basically I am applying reaction diffusion on a 2d image. I am reading the neighbours, multiplying them with these weights and then add them.

    4K0V1JA.png

    This works great. I don't know if what I am doing is called laplacian but I was told that it is.

    Now I am trying to do the same thing in 3d volumes:
    http://www.openvdb.org/

    But the problem is I don't know what weights to use to sum the neighbours. If I use the same weights on a 2d volume, it works just the same. But in 3d, I am not sure what the weights would be.

    I also tried using actual laplacian (OpenVDB has tools to calculate it), but after 7-8 iterations the values in the volume go to infinity. Maybe what I need is not really laplacian. But whatever is coming from the neighbours has to be in balance so just like in the 2d image version, the values don't get bigger and bigger while nothing is getting smaller. That's my understanding.

    I tried calculating the laplacian manually also by using the actual definition, and got different result that the build-in tools. Not sure if I am missing something:
    http://paste.ofcode.org/QYUec5tu63AM6n2Bmax6C7 [Broken]

    Do you guys know what I need?


    Cheers :)
     
    Last edited by a moderator: May 7, 2017
  2. jcsd
  3. Mar 4, 2015 #2

    jedishrfu

    Staff: Mentor

    Are the weights tied to the number of surrounding cells? So that for 3d you'd have 26 neighbors instead of 8 for 2d.

    Or tied the number of lines through the point? so for 2d it would be 4 and for 3d it would be 4+9 or 13.

    This is just my guess. It would be best if you knew how the weights are calculated.
     
    Last edited: Mar 4, 2015
  4. Mar 4, 2015 #3
    Thanks a lot for replying. It's tied to the number of surrounding cells. So for 2d, it's 8 and for 3d it's 26 just like you said.

    Also the positive and negative weights have to cancel out, which is why in 2d the original cell has a weight of -1 and the surrounding cells have a total weight of 1.

    So in a way the 3d volume is like a stack of 2d images.
     
  5. Mar 5, 2015 #4
  6. Mar 7, 2015 #5
    Thanks wolfman, I think that works. I tried it before I think but didn't divide the result by 6 :( Now it seems to work at least.

    Thanks a lot :)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: How to get the laplacian of a scalar field?
  1. Laplacian Transform (Replies: 3)

  2. Laplacian property (Replies: 0)

Loading...