Skip to main content

Rocky Solver SDK 2025 R2

rocky_sph_interaction_api

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 "rocky_sph_element_api.hpp"
6#include "rocky_sph_interaction.hpp"
7#include <rocky20/api/rocky_boundary_api.hpp>
8
9// ================================================================================================
10// IRockySPHElementInteraction
11// ================================================================================================
12
19{
23 ROCKY_FUNCTIONS float3 calculate_elements_distance() const;
24
28 ROCKY_FUNCTIONS float3 calculate_elements_relative_velocity() const;
29
33 ROCKY_FUNCTIONS float3 get_home_element_velocity() const;
34
38 ROCKY_FUNCTIONS float3 get_near_element_velocity() const;
39
44 ROCKY_FUNCTIONS IRockySPHElement get_home_element() const;
45
50 ROCKY_FUNCTIONS IRockySPHElement get_near_element() const;
51
59 ROCKY_FUNCTIONS void add_force(float3 force);
60
69 ROCKY_FUNCTIONS void add_acceleration(float3 acceleration);
70
73 ROCKY_FUNCTIONS explicit IRockySPHElementInteraction(
74 RockySPHElementInteraction* interaction_impl);
75
76 RockySPHElementInteraction* _impl;
77
79};
80
81inline ROCKY_FUNCTIONS IRockySPHElementInteraction::IRockySPHElementInteraction(
82 RockySPHElementInteraction* interaction_impl)
83 : _impl(interaction_impl)
84{
85}
86
88{
89 return this->_impl->get_distance_vector();
90}
91
92inline ROCKY_FUNCTIONS float3
94{
95 return this->_impl->calculate_elements_relative_velocity();
96}
97
98inline ROCKY_FUNCTIONS float3 IRockySPHElementInteraction::get_home_element_velocity() const
99{
100 return this->_impl->get_home_velocity();
101}
102
104{
105 return this->_impl->get_near_velocity();
106}
107
109{
110 return IRockySPHElement { this->_impl->get_home_element(), this->_impl->current_time };
111}
112
114{
115 return IRockySPHElement { this->_impl->get_near_element(), this->_impl->current_time };
116}
117
118inline ROCKY_FUNCTIONS void IRockySPHElementInteraction::add_force(float3 force)
119{
120 this->_impl->add_force(force);
121}
122
123inline ROCKY_FUNCTIONS void IRockySPHElementInteraction::add_acceleration(float3 acceleration)
124{
125 this->_impl->add_acceleration(acceleration);
126}
127
128// ================================================================================================
129// IRockySPHTriangleInteraction
130// ================================================================================================
131
138{
143 ROCKY_FUNCTIONS IRockySPHElement get_home_element() const;
144
149 ROCKY_FUNCTIONS IRockyGeometryTriangle get_near_triangle() const;
150
155 ROCKY_FUNCTIONS float calculate_element_triangle_distance() const;
156
161 ROCKY_FUNCTIONS float3 get_orthogonal_projection() const;
162
167 ROCKY_FUNCTIONS float3 get_unit_vector() const;
168
172 ROCKY_FUNCTIONS float3 get_home_element_velocity() const;
173
178 ROCKY_FUNCTIONS float3 get_boundary_velocity() const;
179
184 ROCKY_FUNCTIONS real_sph get_normal_relative_velocity() const;
185
190 ROCKY_FUNCTIONS real_sph get_tangential_relative_velocity() const;
191
203 ROCKY_FUNCTIONS float get_wall_turbulent_thermal_conductance(
204 const float &v_tang,const float &dst_wall) const;
205
214 ROCKY_FUNCTIONS void add_force(float3 force);
215
224 ROCKY_FUNCTIONS void add_acceleration(float3 acceleration);
225
228 ROCKY_FUNCTIONS explicit IRockySPHTriangleInteraction(
229 RockySPHTriangleInteraction* interaction_impl);
230
231 RockySPHTriangleInteraction* _impl;
232
233 [[deprecated]]
234 ROCKY_FUNCTIONS float3 get_distance_to_home_vector() const;
235
236 [[deprecated("Use IRockySPHTriangleInteraction::get_orthogonal_projection() instead.")]]
237 ROCKY_FUNCTIONS float3 get_nearest_point_to_home() const;
238
239 [[deprecated("Use IRockySPHTriangleInteraction::calculate_element_triangle_distance() instead.")]]
240 ROCKY_FUNCTIONS float get_distance_to_home() const;
241
243};
244
245inline ROCKY_FUNCTIONS IRockySPHTriangleInteraction::IRockySPHTriangleInteraction(
246 RockySPHTriangleInteraction* interaction_impl)
247 : _impl(interaction_impl)
248{
249}
250
252{
253 return this->_impl->get_home_velocity();
254}
255
257{
258 return IRockySPHElement { this->_impl->get_home_element(), this->_impl->current_time };
259}
260
261inline ROCKY_FUNCTIONS void IRockySPHTriangleInteraction::add_force(float3 force)
262{
263 this->_impl->add_force(force);
264}
265
266inline ROCKY_FUNCTIONS void IRockySPHTriangleInteraction::add_acceleration(float3 acceleration)
267{
268 this->_impl->add_acceleration(acceleration);
269}
270
272 const float &tangential_velocity ,const float &wall_distance) const
273{
274 return this->_impl->get_wall_turbulent_thermal_conductance(
275 tangential_velocity, wall_distance, this->get_home_element().get_molecular_viscosity());
276}
277
278inline ROCKY_FUNCTIONS IRockyGeometryTriangle
280{
281 return { this->_impl->near_index, this->_impl->rocky_model };
282}
283
285{
286 return this->_impl->get_distance();
287}
288
290{
291 return this->_impl->get_nearest_point_to_home();
292}
293
294inline ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_boundary_velocity() const
295{
296 return this->_impl->get_near_velocity();
297}
298
299inline ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_unit_vector() const
300{
301 return this->_impl->get_unit_vector();
302}
303
305{
306 return this->_impl->normal_velocity;
307}
308
310{
311 return this->_impl->tangential_velocity;
312}
313
314// deprecated
315inline ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_distance_to_home_vector() const
316{
317 return this->_impl->get_unit_vector() * this->_impl->get_distance();
318}
319
320inline ROCKY_FUNCTIONS float IRockySPHTriangleInteraction::get_distance_to_home() const
321{
322 return this->_impl->get_distance();
323}
324
325inline ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_nearest_point_to_home() const
326{
327 return this->_impl->get_nearest_point_to_home();
328}
329
Definition rocky_boundary_api.hpp:146
Definition rocky_sph_interaction_api.hpp:19
ROCKY_FUNCTIONS IRockySPHElement get_near_element() const
Definition rocky_sph_interaction_api.hpp:113
ROCKY_FUNCTIONS float3 calculate_elements_relative_velocity() const
Definition rocky_sph_interaction_api.hpp:93
ROCKY_FUNCTIONS void add_force(float3 force)
Definition rocky_sph_interaction_api.hpp:118
ROCKY_FUNCTIONS void add_acceleration(float3 acceleration)
Definition rocky_sph_interaction_api.hpp:123
ROCKY_FUNCTIONS float3 calculate_elements_distance() const
Definition rocky_sph_interaction_api.hpp:87
ROCKY_FUNCTIONS IRockySPHElement get_home_element() const
Definition rocky_sph_interaction_api.hpp:108
ROCKY_FUNCTIONS float3 get_near_element_velocity() const
Definition rocky_sph_interaction_api.hpp:103
ROCKY_FUNCTIONS float3 get_home_element_velocity() const
Definition rocky_sph_interaction_api.hpp:98
Definition rocky_sph_element_api.hpp:21
ROCKY_FUNCTIONS void add_force(const float3 &force)
Definition rocky_sph_element_api.hpp:58
Definition rocky_sph_interaction_api.hpp:138
ROCKY_FUNCTIONS void add_acceleration(float3 acceleration)
Definition rocky_sph_interaction_api.hpp:266
ROCKY_FUNCTIONS float3 get_unit_vector() const
Definition rocky_sph_interaction_api.hpp:299
ROCKY_FUNCTIONS IRockyGeometryTriangle get_near_triangle() const
Definition rocky_sph_interaction_api.hpp:279
ROCKY_FUNCTIONS real_sph get_tangential_relative_velocity() const
Definition rocky_sph_interaction_api.hpp:309
ROCKY_FUNCTIONS float3 get_orthogonal_projection() const
Definition rocky_sph_interaction_api.hpp:289
ROCKY_FUNCTIONS float calculate_element_triangle_distance() const
Definition rocky_sph_interaction_api.hpp:284
ROCKY_FUNCTIONS void add_force(float3 force)
Definition rocky_sph_interaction_api.hpp:261
ROCKY_FUNCTIONS real_sph get_normal_relative_velocity() const
Definition rocky_sph_interaction_api.hpp:304
ROCKY_FUNCTIONS float get_wall_turbulent_thermal_conductance(const float &v_tang, const float &dst_wall) const
Definition rocky_sph_interaction_api.hpp:271
ROCKY_FUNCTIONS float3 get_boundary_velocity() const
Definition rocky_sph_interaction_api.hpp:294
ROCKY_FUNCTIONS IRockySPHElement get_home_element() const
Definition rocky_sph_interaction_api.hpp:256
ROCKY_FUNCTIONS float3 get_home_element_velocity() const
Definition rocky_sph_interaction_api.hpp:251

Connect with Ansys