FluidX3D
FluidX3D copied to clipboard
Coriolis force implementation
Hi! I wonder is there any more optimal way to model the Coriolis force than rhis
while (true) { // main simulation loop
lbm.u.read_from_device();
for (uint z = 1u; z < Nz - 1u; z++) {
for (uint y = 1u; y < Ny-1u; y++) {
for (uint x = 1u; x < Nx - 1u; x++) {
const uint n = x + (y + z * Ny) * Nx;
lbm.F.x[n] = -Co * lbm.u.y[n];
lbm.F.y[n] = Co * lbm.u.x[n];
lbm.F.z[n] = 0.0f;
}
}
}
lbm.F.write_to_device();
lbm.run(1u);
}
It slows down a thousand times :(
Hi @rodionstepanov,
here you copy the data over PCIe every time step. This of course is very slow.
I recommend writing a small OpenCL kernel that does the force update, without data movement. Or you can integrate this into an existing kernel.
Kind regards, Moritz
I recommend writing a small OpenCL kernel that does the force update, without data movement. Or you can unterste this into an existing kernel.
it sounds simple but I find no example. Do you mean to add new function similar to update_force_field?