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.48k stars 281 forks source link

How to extract force data for multiple propellers separately #172

Closed wjsjtu123 closed 3 months ago

wjsjtu123 commented 3 months ago

image I have recently been simulating the rotational motion of multiple propellers with the geometric schematic shown in the figure.I want to extract the propeller forces separately. How do I voxelise each of the propellers using additional flags? There are only two flags in the code,TYPE_X and TYPE_Y.I would like to know what the difference is between the TYPE_X and the TYPE_Y. I find that the force is the same when i use the following code. I think it should be wrong. image

ProjectPhysX commented 3 months ago

Hi @wjsjtu123,

tag all propellers with TYPE_S + an individual flag combination, for example:

lbm.voxelize_mesh_on_device(propeller_1, TYPE_S|TYPE_X);
lbm.voxelize_mesh_on_device(propeller_2, TYPE_S|TYPE_Y);
lbm.voxelize_mesh_on_device(propeller_3, TYPE_S|TYPE_X|TYPE_Y);
lbm.voxelize_mesh_on_device(propeller_4, TYPE_S|TYPE_F);
lbm.voxelize_mesh_on_device(propeller_5, TYPE_S|TYPE_I);

Then compute the forces with these same individual flag combinations:

lbm.calculate_force_on_boundaries(); // compute forces on all TYPE_S cells with or without additional flags
lbm.F.read_from_device(); // copy force field from GPU VRAM to CPU memory
const float3 propeller_1_force_lbm = lbm.calculate_force_on_object(TYPE_S|TYPE_X); // sum over all grid cells with TYPE_S|TYPE_X flag combination
const float3 propeller_2_force_lbm = lbm.calculate_force_on_object(TYPE_S|TYPE_Y);
const float3 propeller_3_force_lbm = lbm.calculate_force_on_object(TYPE_S|TYPE_X|TYPE_Y);
const float3 propeller_4_force_lbm = lbm.calculate_force_on_object(TYPE_S|TYPE_F);
const float3 propeller_5_force_lbm = lbm.calculate_force_on_object(TYPE_S|TYPE_I);

Note that TYPE_S|TYPE_X|TYPE_X|TYPE_X|TYPE_X|TYPE_X is the same as TYPE_S|TYPE_X.

You need individual combinations of different flag bits. Since here you don't use the SURFACE extension, you can also use it's flags TYPE_F/TYPE_I/TYPE_G, and since you don't use the TEMPERATURE extension, you can also use TYPE_T. Together with TYPE_X/TYPE_Y, you can mark up to 2^6=64 parts of the model differently. When using these extension flags, you need to disable initialization sanity checks by commenting out the call to sanity_checks_initialization(); in this line.

Kind regards, Moritz