Skip to main content

Rocky Solver SDK 2025 R2

api_omp_contacts

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

Connect with Ansys