lavenderses / NSsimulation

The Simulations of Navier-Stokes Equation in 2D and 3D.
MIT License
15 stars 7 forks source link

How to generate a uv map #13

Open mshmoon opened 2 months ago

mshmoon commented 2 months ago

1.Hello,I am very happy to learn your the repo. 2.But ,when I run "python simulation 2D" . finally, I got a lot of map with particles. 3.My question is how to generate a map like this: image

mshmoon commented 2 months ago

And another question is how to put rectangles or cycles in the room map for this repo.

lavenderses commented 2 months ago

Hello. Thank you for having an interest in this repo.

2.But ,when I run "python simulation 2D" . finally, I got a lot of map with particles. 3.My question is how to generate a map like this:

I'm sorry for not describing it. You have to pass an arg arrow=True to Simulate2D.update method like this (if you want to simulate in 2D. ditto 3D). https://github.com/lavenderses/NSsimulation/blob/989bcd4472400a869dee91e51ed9056ddd6d04a0/simulater.py#L311

Please see this commit: https://github.com/lavenderses/NSsimulation/commit/989bcd4472400a869dee91e51ed9056ddd6d04a0.

(I think it would have been better to be able to pass it as a command line arg...)

how to put rectangles or cycles in the room map for this repo

I think treating the velocity on the point the object (rectangles / cycles) exists as 0 might be a solution. (ux and uy in Simulation2D class are the velocity vectors)

Main process of simulation is here. And each calculation of velocity is in functions/advection_viscosity.py. Treat ux[i][j] (and uy[i][j]) as 0 for i, j where the object exists. Also, you have to consider boundary condition on the calculation. https://github.com/lavenderses/NSsimulation/blob/989bcd4472400a869dee91e51ed9056ddd6d04a0/simulater.py#L121-L132

Calculation of boundary condition will be much complicated, I think it will be hard work to introduce this improvement. But also it is a great enhauncement.


I'm sorry for not maintaining this repository for a long time.

mshmoon commented 2 months ago

Thank you for your reply. Because I am not particularly familiar with CFD, I would like to ask a question. In CFD, how to add obstacles to the numerical calculation process, my understanding is to divide the obstacles into small grids, but I am not particularly clear about how these small grids affect the calculation results.