Skip to main content

Rocky Solver SDK 2024 R2

api_omp_contacts

Last update: 17.07.2025
1#pragma once
2
3// Includes ---------------------------------------------------------------------------------------
4#include <rocky20/api/rocky_api_functions.h>
5#include <rocky20/api/rocky_api.h>
6#include <rocky20/api/device/api_device_contacts.hpp>
7#include <rocky20/device/omp_backend.hpp>
8
9namespace rocky::omp
10{
11
12// Contacts ---------------------------------------------------------------------------------------
13void dispatch_frictional_contacts_kernel(
14 IRockyModel& model,
15 contacts_f_type h_particle_contact_f_ptr,
16 contacts_f_type h_triangle_contact_f_ptr,
17 void* udf_data
18);
19
20void dispatch_adhesive_contacts_kernel(
21 IRockyModel& model,
22 contacts_f_type h_particle_contact_f_ptr,
23 contacts_f_type h_triangle_contact_f_ptr,
24 void* udf_data
25);
26
27void dispatch_finished_contacts_kernel(
28 IRockyModel& model,
29 contacts_f_type h_particle_contact_f_ptr,
30 contacts_f_type h_triangle_contact_f_ptr,
31 void* udf_data
32);
33
34void dispatch_active_contacts_kernel(
35 IRockyModel& model,
36 contacts_f_type h_particle_contact_f_ptr,
37 contacts_f_type h_triangle_contact_f_ptr,
38 void* udf_data
39);
40
41void dispatch_all_contacts_kernel(
42 IRockyModel& model,
43 contacts_f_type h_particle_contact_f_ptr,
44 contacts_f_type h_triangle_contact_f_ptr,
45 void* udf_data
46);
47
48template <typename ContactFunctions>
49void dispatch_frictional_contact_forces_kernel(
50 IRockyModel& model, const ContactFunctions& function_ptrs, void* udf_data)
51{
52#ifndef __CUDA_ARCH__
53 SDeviceModel* device_data = model.get_device_data(0);
54
55 const auto n_contacts = device_data->n_contacts;
56 if (n_contacts->particle_fr == 0 && n_contacts->triangle_fr == 0)
57 return;
58
59 #pragma omp parallel num_threads(model.get_number_of_processes())
60 {
61 // particles -> particles
62 device::api_compute_particle_contact_frictional_forces<OMPBackend>(
63 device_data, model.get_current_time(), function_ptrs, udf_data);
64
65 // particles -> triangles
66 device::api_compute_triangle_contact_frictional_forces<OMPBackend>(
67 device_data, model.get_current_time(), function_ptrs, udf_data);
68 }
69#endif
70}
71
72void dispatch_adhesive_contact_forces_kernel(
73 IRockyModel& model,
74 adhesion_forces_f_type h_particle_contact_f_ptr,
75 adhesion_forces_f_type h_triangle_contact_f_ptr,
76 void* udf_data
77);
78
79// Boundary wear on particle-triangle contacts ----------------------------------------------------
80void dispatch_boundaries_wear_kernel(
81 IRockyModel& model,
82 triangle_wear_f_type triangle_wear_f_ptr,
83 void* udf_data
84);
85
86} //namespace rocky::omp
Definition rocky_api.h:60
double get_current_time() const
Definition rocky_api.cpp:129

Connect with Ansys