Skip to main content

Rocky Solver SDK 2025 R2

rocky_sph_model_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 "rocky20/api/rocky_particle_api.hpp"
6#include "rocky20/api/rocky_point_cloud_api.hpp"
7
8#include "rocky_sph_element_scalars.hpp"
9#include "rocky_sph_element_api.hpp"
10#include "rocky_sph_model.hpp"
11
12// ================================================================================================
13// IRockySPHModel
14// ================================================================================================
15
22{
31
37
43
49
56
64 ESPHKernelType get_kernel_type() const;
65
70 float get_initial_element_spacing() const;
71
77 float get_smoothing_length() const;
78
82 float get_element_mass() const;
83
87 ROCKY_FUNCTIONS float get_fluid_viscosity() const;
88
92 ROCKY_FUNCTIONS float get_fluid_density() const;
93
97 ROCKY_FUNCTIONS float get_fluid_thermal_conductivity() const;
98
102 ROCKY_FUNCTIONS float get_fluid_specific_heat() const;
103
107 ROCKY_FUNCTIONS float get_speed_of_sound() const;
108
112 ROCKY_FUNCTIONS float get_surface_tension() const;
113
117 bool is_enabled() const;
118
125 ROCKY_FUNCTIONS void set_htc_distance_factor(float htc_distance_factor) const;
126
129 ROCKY_FUNCTIONS IRockySPHModel(SPHModel* impl, const std::vector<int>& device_ids);
130
131 SPHModel* _impl;
132 const std::vector<int>& _device_ids;
133
135};
136
137inline ROCKY_FUNCTIONS IRockySPHModel::IRockySPHModel(
138 SPHModel* impl, const std::vector<int>& device_ids)
139 : _impl(impl)
140 , _device_ids(device_ids)
141{
142}
143
144// ================================================================================================
145// IRockySPHDeviceModel
146// ================================================================================================
147
155{
159 ROCKY_FUNCTIONS float get_sph_timestep() const;
160
164 ROCKY_FUNCTIONS float get_element_mass() const;
165
170 ROCKY_FUNCTIONS float get_initial_element_spacing() const;
171
179 ROCKY_FUNCTIONS ESPHKernelType get_kernel_type() const;
180
188 ROCKY_FUNCTIONS float get_kernel_weight(float distance) const;
189
197 ROCKY_FUNCTIONS float get_kernel_derivative(float distance) const;
198
204 ROCKY_FUNCTIONS float get_smoothing_length() const;
205
210 ROCKY_FUNCTIONS float get_minimum_distance() const;
211
216 ROCKY_FUNCTIONS float get_minimum_distance_squared() const;
217
222 ROCKY_FUNCTIONS float get_fluid_viscosity() const;
223
227 ROCKY_FUNCTIONS float get_fluid_density() const;
228
232 ROCKY_FUNCTIONS float get_fluid_thermal_conductivity() const;
233
237 ROCKY_FUNCTIONS float get_fluid_specific_heat() const;
238
244 ROCKY_FUNCTIONS float get_turbulent_prandtl_number() const;
245
249 ROCKY_FUNCTIONS float get_speed_of_sound() const;
250
254 ROCKY_FUNCTIONS float get_surface_tension() const;
255
260 ROCKY_FUNCTIONS float get_stiffness() const;
261
266 ROCKY_FUNCTIONS float get_damping_coefficient() const;
267
278 ROCKY_FUNCTIONS ESPHBoundaryType get_boundary_condition_type (int geometry_index) const;
279
290 ROCKY_FUNCTIONS float get_wall_turbulent_thermal_conductance(
291 float velocity, float distance) const;
292
308 ROCKY_FUNCTIONS IRockyCloudPoint
309 get_element_cloud_point(int point_cloud_index, const IRockySPHElement& element);
310
314 ROCKY_FUNCTIONS bool has_turbulence_modeling() const;
315
316
319 [[deprecated("Use get_element_mass() instead.")]]
320 ROCKY_FUNCTIONS float get_mass() const;
321
322 // (ROCKY - 15509) : candidates for removing from the API
323 // reason: they are model-specific parameters, they are not general
324
325 ROCKY_FUNCTIONS float get_les_smagorinsky_constant() const;
326
327 ROCKY_FUNCTIONS float get_les_distance_factor() const;
328
329 ROCKY_FUNCTIONS float get_stabilization_positive_factor() const;
330
331 ROCKY_FUNCTIONS float get_stabilization_negative_factor() const;
332
333 ROCKY_FUNCTIONS float get_stabilization_degree() const;
334
335 ROCKY_FUNCTIONS float get_boundary_distance_normal_factor() const;
336
337 ROCKY_FUNCTIONS float get_boundary_distance_tangential_factor() const;
338
339 ROCKY_FUNCTIONS bool has_variable_molecular_viscosity() const;
340
341 ROCKY_FUNCTIONS IRockySPHDeviceModel(
342 SDeviceModel* model, cuda_general_sph* _gen_sph, SPHDeviceModel* _sph_model);
343
344 RockySPHDeviceModel _impl;
345 SDeviceModel* device_model;
346
348};
349
350inline ROCKY_FUNCTIONS IRockySPHDeviceModel::IRockySPHDeviceModel(
351 SDeviceModel* model, cuda_general_sph* _gen_sph, SPHDeviceModel* _sph_model)
352 : device_model(model)
353 , _impl(_gen_sph, _sph_model)
354{
355}
356
357inline ROCKY_FUNCTIONS ESPHKernelType IRockySPHDeviceModel::get_kernel_type() const
358{
359 return this->_impl.get_kernel_type();
360}
361
362inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_sph_timestep() const
363{
364 return this->_impl.get_timestep();
365}
366
367inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_mass() const
368{
369 return this->_impl.get_mass();
370}
371
372inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_element_mass() const
373{
374 return this->_impl.get_mass();
375}
376
377inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_initial_element_spacing() const
378{
379 return this->_impl.get_general_size();
380}
381
382[[deprecated("Use "
383 "IRockySPHElement::get_kernel instead")]]
384inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_kernel_weight(float distance) const
385{
386 return this->_impl.gen_sph->get_kernel_single(distance);;
387}
388
389[[deprecated("Use "
390 "IRockySPHElement::get_kernel_derivative instead")]]
391inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_kernel_derivative(float distance) const
392{
393 return this->_impl.gen_sph->get_kernel_derivative(distance);
394}
395
396[[deprecated("Use "
397 "IRockySPHElement::get_smoothing_length instead")]]
398inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_smoothing_length() const
399{
400 return this->_impl.gen_sph->dist_init * this->_impl.gen_sph->kern_factor;
401}
402
403inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_minimum_distance() const
404{
405 return this->_impl.get_minimum_distance();
406}
407
408inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_minimum_distance_squared() const
409{
410 return this->_impl.get_minimum_distance_squared();
411}
412
413[[deprecated("Use "
414 "IRockySPHElement::get_molecular_viscosity instead")]]
415inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_fluid_viscosity() const
416{
417 return this->_impl.get_general_viscosity();
418}
419
420inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_fluid_density() const
421{
422 return this->_impl.get_general_density();
423}
424
426{
427 return this->_impl.get_general_thermal_conductivity();
428}
429
430inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_fluid_specific_heat() const
431{
432 return this->_impl.get_general_specific_heat();
433}
434
435inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_turbulent_prandtl_number() const
436{
437 return this->_impl.get_turbulent_prandtl_number();
438}
439
440inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_speed_of_sound() const
441{
442 return this->_impl.get_speed_of_sound();
443}
444
445inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_surface_tension() const
446{
447 return this->_impl.get_surface_tension();
448}
449
450inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_damping_coefficient() const
451{
452 return this->_impl.get_damping_coefficient();
453}
454
455inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_stiffness() const
456{
457 return this->_impl.get_stiffness();
458}
459
460inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_les_smagorinsky_constant() const
461{
462 return this->_impl.get_les_smagorinsky_constant();
463}
464
465inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_les_distance_factor() const
466{
467 return this->_impl.get_les_distance_factor();
468}
469
470inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_stabilization_positive_factor() const
471{
472 return this->_impl.get_stabilization_positive_factor();
473}
474
475inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_stabilization_negative_factor() const
476{
477 return this->_impl.get_stabilization_negative_factor();
478}
479
480inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_stabilization_degree() const
481{
482 return this->_impl.get_stabilization_degree();
483}
484
485inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_boundary_distance_normal_factor() const
486{
487 return this->_impl.get_boundary_distance_normal_factor();
488}
489
490inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_boundary_distance_tangential_factor() const
491{
492 return this->_impl.get_boundary_distance_tangential_factor();
493}
494
495inline ROCKY_FUNCTIONS ESPHBoundaryType IRockySPHDeviceModel::get_boundary_condition_type(int geometry_index) const
496{
497 return this->_impl.get_boundary_condition_type(geometry_index);
498}
499
500[[deprecated("Use "
501 "IRockySPHTriangleInteraction::get_wall_turbulent_thermal_conductance instead")]]
503 float velocity, float distance) const
504{
505 return this->_impl.gen_sph->get_wall_turbulent_thermal_conductance(
506 velocity, distance, this->_impl.get_general_viscosity(), this->get_initial_element_spacing(),
507 false);
508}
509
511 int point_cloud_index, const IRockySPHElement& element)
512{
513 auto point_cloud = this->device_model->point_clouds + point_cloud_index;
514 int point_index = this->_impl.device_model->sph_particle_scalars->get_scalar<int>(
515 point_cloud->sph_scalars_index, element._impl.element_index);
516 return IRockyCloudPoint(point_cloud, point_index);
517}
518
519inline ROCKY_FUNCTIONS bool IRockySPHDeviceModel::has_turbulence_modeling() const
520{
521 return this->_impl.gen_sph->turb_type != ttLaminar;
522}
523
524inline ROCKY_FUNCTIONS bool IRockySPHDeviceModel::has_variable_molecular_viscosity() const
525{
526 return this->_impl.gen_sph->has_variable_molecular_viscosity();
527}
Definition rocky_point_cloud_api.hpp:16
Definition rocky_sph_model_api.hpp:155
ROCKY_FUNCTIONS float get_minimum_distance_squared() const
Definition rocky_sph_model_api.hpp:408
ROCKY_FUNCTIONS float get_smoothing_length() const
Definition rocky_sph_model_api.hpp:398
ROCKY_FUNCTIONS float get_turbulent_prandtl_number() const
Definition rocky_sph_model_api.hpp:435
ROCKY_FUNCTIONS float get_fluid_viscosity() const
Definition rocky_sph_model_api.hpp:415
ROCKY_FUNCTIONS float get_minimum_distance() const
Definition rocky_sph_model_api.hpp:403
ROCKY_FUNCTIONS float get_sph_timestep() const
Definition rocky_sph_model_api.hpp:362
ROCKY_FUNCTIONS ESPHKernelType get_kernel_type() const
Definition rocky_sph_model_api.hpp:357
ROCKY_FUNCTIONS float get_element_mass() const
Definition rocky_sph_model_api.hpp:372
ROCKY_FUNCTIONS float get_fluid_density() const
Definition rocky_sph_model_api.hpp:420
ROCKY_FUNCTIONS float get_fluid_specific_heat() const
Definition rocky_sph_model_api.hpp:430
ROCKY_FUNCTIONS float get_speed_of_sound() const
Definition rocky_sph_model_api.hpp:440
ROCKY_FUNCTIONS float get_fluid_thermal_conductivity() const
Definition rocky_sph_model_api.hpp:425
ROCKY_FUNCTIONS IRockyCloudPoint get_element_cloud_point(int point_cloud_index, const IRockySPHElement &element)
Definition rocky_sph_model_api.hpp:510
ROCKY_FUNCTIONS float get_damping_coefficient() const
Definition rocky_sph_model_api.hpp:450
ROCKY_FUNCTIONS float get_kernel_derivative(float distance) const
Definition rocky_sph_model_api.hpp:391
ROCKY_FUNCTIONS float get_wall_turbulent_thermal_conductance(float velocity, float distance) const
Definition rocky_sph_model_api.hpp:502
ROCKY_FUNCTIONS ESPHBoundaryType get_boundary_condition_type(int geometry_index) const
Definition rocky_sph_model_api.hpp:495
ROCKY_FUNCTIONS float get_initial_element_spacing() const
Definition rocky_sph_model_api.hpp:377
ROCKY_FUNCTIONS float get_stiffness() const
Definition rocky_sph_model_api.hpp:455
ROCKY_FUNCTIONS float get_kernel_weight(float distance) const
Definition rocky_sph_model_api.hpp:384
ROCKY_FUNCTIONS float get_surface_tension() const
Definition rocky_sph_model_api.hpp:445
ROCKY_FUNCTIONS bool has_turbulence_modeling() const
Definition rocky_sph_model_api.hpp:519
Definition rocky_sph_element_scalars.hpp:30
Definition rocky_sph_element_api.hpp:21
Definition rocky_sph_model_api.hpp:22
ROCKY_FUNCTIONS float get_fluid_density() const
Definition rocky_sph_model_api.cpp:58
ROCKY_FUNCTIONS void set_htc_distance_factor(float htc_distance_factor) const
Definition rocky_sph_model_api.cpp:88
float get_initial_element_spacing() const
Definition rocky_sph_model_api.cpp:39
ROCKY_FUNCTIONS float get_speed_of_sound() const
Definition rocky_sph_model_api.cpp:73
float get_smoothing_length() const
Definition rocky_sph_model_api.cpp:43
ESPHKernelType get_kernel_type() const
Definition rocky_sph_model_api.cpp:34
int get_number_of_active_sph_elements() const
Definition rocky_sph_model_api.cpp:19
int get_number_of_sph_elements() const
Definition rocky_sph_model_api.cpp:14
int get_number_of_active_free_sph_elements() const
Definition rocky_sph_model_api.cpp:29
IRockySPHElementScalarsModel get_sph_element_scalars() const
Definition rocky_sph_model_api.cpp:7
int get_number_of_active_linked_sph_elements() const
Definition rocky_sph_model_api.cpp:24
ROCKY_FUNCTIONS float get_fluid_viscosity() const
Definition rocky_sph_model_api.cpp:53
ROCKY_FUNCTIONS float get_fluid_thermal_conductivity() const
Definition rocky_sph_model_api.cpp:63
bool is_enabled() const
Definition rocky_sph_model_api.cpp:83
ROCKY_FUNCTIONS float get_fluid_specific_heat() const
Definition rocky_sph_model_api.cpp:68
ROCKY_FUNCTIONS float get_surface_tension() const
Definition rocky_sph_model_api.cpp:78
float get_element_mass() const
Definition rocky_sph_model_api.cpp:48

Connect with Ansys