| Heterogeneous: |
| //The data in the array is assigned to the buffer in the flow field. |
| buffer_to_field<<<Grid_4, Block_4>>>() |
| //The GPU performs IB-LBM simulation. |
| for i = 0 ⟶ buffer do |
| compute_force<<<Grid_1, Block_1>>>() |
| spread_force<<<Grid_1, Block_1>>>() |
| discrete_force<<<Grid_2, Block_2>>>() |
| collision<<<Grid_2, Block_2>>>() |
| streaming<<<Grid_2, Block_2>>>() |
| boundary<<<Grid_3, Block_3>>>() |
| compute_macroscopic<<<Grid_2, Block_2>>>() |
| interpolation_velocity<<<Grid_1, Block_1>>>() |
| lagrangian_move<<<Grid_1, Block_1>>>() |
| end for |
| //Copy the data of the buffer area in the flow field to a separate array. |
| field_to_buffer<<<Grid_4, Block_4>>>() |
| //The CPU performs IB-LBM simulation. |
| for j = 0 ⟶ buffer do |
| compute_force () |
| spread_force () |
| discrete_force () |
| collision () |
| streaming () |
| boundary () |
| compute_macroscopic () |
| interpolation_velocity () |
| lagrangian_move () |
| cudaMemcpy (cudaMemcpyDeviceToHost) |
| exchange_data () |
| cudaMemcpy (cudaMemcpyHostToDevice) |
| step_count+ = buffer |
| if (step_count! = total_step) |
| goto heterogeneous |