Giter Club home page Giter Club logo

taichi_sph's People

Contributors

erizmr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

taichicourse01

taichi_sph's Issues

how to understand m_V

Please have a look at the following code:

self.m_V = 0.8 * self.particle_diameter ** self.dim

How to understand m_V? Is it the mass of particle?

But, the mass should be density * v = density * (pi * (radius**2)).

Any suggestion is appreciated~~~

Interaction between different material

Hi Mingrui

Thanks for the work.

When I change the material in the add_cube function in demo.py to 0, it almost works like a black hole and any particle passing through it will vanish. I compared this repo to your previous repo on sph solvers, I couldn't spot the reason, do you know why?

best,

Simon

Maybe three little mistakes in file 'particle_system.py'

I am learning this program to finish my taichiCourse01 final project. And I found three confused lines in file 'particle_system.py':

  1. in line 179, I think it should be 'particle_diameter' but not 'self.particle_radius'. I guess this also leads to an overlap while drawing, so you used 'radius=ps.particle_radius / 1.5 ...' in 'demo.py'.
  2. in line 178, I think there should be a tiny number added after 'lower_corner[i] + cube_size[i]', so you won't lose the particles in the top row and the right colume.
  3. in line 120, I think it should be 'continue' but not 'break', because a break there will lead to a lack of neighbour search. But after I change it to continue, the para 'offset' won't update. As to say, for a para 'center_cell' = [0, 1], para 'cell' should be [-1, 0] then [-1, 1] then ... But actually, para 'cell' will loop as [-1, 0] and won't update to [-1, 1], so this caused an endless loop. Besides, I created a code as follows for test and it went well. I am confused what's the problem and will really appreciate your solution.
import taichi as ti
ti.init(arch=ti.cpu)

dim = 2

center_cell = ti.Vector.field(2, dtype=ti.i32, shape=2)
center_cell[0] = ti.Vector([0, 1])
center_cell[1] = ti.Vector([2, 2])

@ti.func
def is_valid_cell(cell):
    flag = True
    for d in ti.static(range(dim)):
        flag = flag and (0 <= cell[d] < 3)
    return flag

@ti.kernel
def func_test():
    for i in range(2):
        print(center_cell[i], ';')
        for offset in ti.grouped(ti.ndrange(*((-1, 2),) * dim)):
            cell = center_cell[i] + offset
            print(cell, end=', ')
            if not is_valid_cell(cell):
                print('kill', end='! ')
                continue
        print()

func_test()

with an output:
[0, 1] ;
[-1, 0], kill! [-1, 1], kill! [-1, 2], kill! [0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2],
[2, 2] ;
[1, 1], [1, 2], [1, 3], kill! [2, 1], [2, 2], [2, 3], kill! [3, 1], kill! [3, 2], kill! [3, 3], kill!

environment: [Taichi] version 0.8.1, llvm 10.0.0, commit cc2dd342, win, python 3.8.1

win 10 python 3.8.10

File "D:\apps\Python38\lib\site-packages\taichi\lang\impl.py", line 450, in make_constant_expr
raise ValueError(f'Invalid constant scalar expression: {type(val)}')
ValueError: Invalid constant scalar expression: <class 'list'>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.