ProjectPhysX / FluidX3D

The fastest and most memory efficient lattice Boltzmann CFD software, running on all GPUs via OpenCL. Free for non-commercial use.
https://youtube.com/@ProjectPhysX
Other
3.81k stars 301 forks source link

About updating density and velocity #37

Closed tyrafluid closed 1 year ago

tyrafluid commented 1 year ago

Hi @ProjectPhysX ,

I would like to know the difference between when I use this option and when I dont use this option. image

As long as I use this option, density and velocity arent updated during time marching? Moreover, could you teach me how I set up this option.

Thank you

ProjectPhysX commented 1 year ago

Hi @tyrafluid! By default, density and velocity are not updated during time marching. Only when you call lbm.update_fields(); in main_setup() explicitly, they are updated in GPU memory, and a subsequent lbm.rho.read_from_device();/lbm.u.read_from_device(); brings them in CPU memory to evaluate by accessing lbm.rho[n]/lbm.u.x[n]/lbm.u.y[n]/lbm.u.z[n].

If you want density and velocity do be updated during time marching, you can add the line #define UPDATE_FIELDS somewhere in src/defines.hpp.

tyrafluid commented 1 year ago

Thank you @ProjectPhysX I want to know how to read the your code. First of all, I would like to learn the structure of your code. Could you teach me ?