Skip to content

Fluid velocity at defined point #203

Closed Answered by ProjectPhysX
pk-guest asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @pk-guest,

all the functions in src/kernel.cpp are OpenCL C code that runs on the GPU. This code is compeltely separate from C++ host code, yet mostly compatible so it's possible to port functions over. But here you don't need this, it's much simpler.

Here is how to get one 3D velocity vector at specific 3D space + time coordinates in the main_setup() function:

	const uint probe_x = 25u;
	const uint probe_y = 36u;
	const uint probe_z = 47u;
	const ulong probe_t = 123ull;
	float3 probe_u; // velocity to be read at x/y/z/t

	lbm.run(probe_t); // run probe_t time steps
	lbm.u.read_from_device(); // copy velocity field from device memory (GPU VRAM) to host memory (CPU RAM)
	const ulong pro…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ProjectPhysX
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants