Giter VIP home page Giter VIP logo

Comments (5)

strongoier avatar strongoier commented on September 26, 2024 4

Hi @xiangzi1992. This repo was last updated 1 year ago, and many APIs of Taichi have been changed since then. If you want to run the demo immediately, you can use some version earlier than v0.7.20. I will update this repo to match the latest version of Taichi as soon as possible.

from quantaichi.

yuanming-hu avatar yuanming-hu commented on September 26, 2024

Ah, 2 is probably related to the recent quant API update - @strongoier could you help with this? Many thanks!

from quantaichi.

xiangzi1992 avatar xiangzi1992 commented on September 26, 2024

It works. Thanks.

I am confused about the pressure projection when the velocity is stored in the grid center (eulerian_fluid/solver.py).

  1. calculating the divergence:
    div[i, j] = -0.5 * (v[i+1, j].x -v[i-1, j].x + v[i, j+1].y - v[i, j-1].y)
  2. initializing mgpcg, and solving the Poisson equation
  3. updating v based on the pressure, p
    v[i, j].x = v[i, j].x - 0.5 * (p[i +1, j] - p[i -1, j]) + avg_v[i, j] .x
    v[i, j].y = v[i, j].y - 0.5 * (p[i, j +1] - p[i, j -1]) + avg_v[i, j] .y

My confusions are:

  1. why do we need to add the average velocity?
  2. I realized incompressible fluid in the same way. After the projection, I recalculate the divergence, but it does not approximate to zero. I am not sure whether my understanding of the projection is right or not.

from quantaichi.

yuanming-hu avatar yuanming-hu commented on September 26, 2024

why do we need to add the average velocity?

I don't think there are these lines of code in this repo: https://github.com/taichi-dev/quantaichi/search?q=avg_v
Do they come from somewhere else? I guess that's because you have all Neumann boundary conditions and there is a null space. See Algorithm 3 of https://www.math.ucla.edu/~jteran/papers/MST10.pdf.

from quantaichi.

xiangzi1992 avatar xiangzi1992 commented on September 26, 2024

why do we need to add the average velocity?

I don't think there are these lines of code in this repo: https://github.com/taichi-dev/quantaichi/search?q=avg_v Do they come from somewhere else? I guess that's because you have all Neumann boundary conditions and there is a null space. See Algorithm 3 of https://www.math.ucla.edu/~jteran/papers/MST10.pdf.

I am sorry, I didn't express my problem clearly.
These lines are not in the code, I just describe my understanding after reading your code.

Here is the original code.

self.mgpcg.reset()
self.compute_div_and_init_pressure_solver(v)
self.mgpcg.solve(max_iters=12, verbose=True)
self.mgpcg.fetch_result(self.pressure.field)
self.average_v[None] = [0] * self.dim

if enforce_zero_average:
self.compute_average_v(v)
self.apply_pressure_with_adjustments(v, self.pressure)

compute_div_and_init_pressure_solver does:
div[i, j] = -0.5 * (v[i+1, j].x -v[i-1, j].x + v[i, j+1].y - v[i, j-1].y)

apply_pressure_with_adjustments does:
v[i, j].x = v[i, j].x - 0.5 * (p[i +1, j] - p[i -1, j]) + avg_v[i, j] .x
v[i, j].y = v[i, j].y - 0.5 * (p[i, j +1] - p[i, j -1]) + avg_v[i, j] .y

I did the projection in this way. After the projection, I recalculate the divergence, but the value is not approximate to zero. I indeed took the boundary into consideration.
This is my problem.

from quantaichi.

Related Issues (2)

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.