Skip to main content

Rocky Solver SDK 2024 R2

rocky_sph_model_api

Last update: 17.07.2025
1#pragma once
2
3// Includes =======================================================================================
4#include "rocky20/api/rocky_particle_api.hpp"
5#include "rocky20/api/rocky_point_cloud_api.hpp"
6
7#include "rocky_sph_element_scalars.hpp"
8#include "rocky_sph_element_api.hpp"
9#include "rocky_sph_model.hpp"
10
11// ================================================================================================
12// IRockySPHModel
13// ================================================================================================
14
21{
30
36
42
48
55
63 ESPHKernelType get_kernel_type() const;
64
69 float get_initial_element_spacing() const;
70
76 float get_smoothing_length() const;
77
81 float get_element_mass() const;
82
86 ROCKY_FUNCTIONS float get_fluid_viscosity() const;
87
91 ROCKY_FUNCTIONS float get_fluid_density() const;
92
96 ROCKY_FUNCTIONS float get_fluid_thermal_conductivity() const;
97
101 ROCKY_FUNCTIONS float get_fluid_specific_heat() const;
102
106 ROCKY_FUNCTIONS float get_speed_of_sound() const;
107
111 ROCKY_FUNCTIONS float get_surface_tension() const;
112
116 bool is_enabled() const;
117
120 ROCKY_FUNCTIONS IRockySPHModel(SPHModel* impl, const std::vector<int>& device_ids);
121
122 SPHModel* _impl;
123 const std::vector<int>& _device_ids;
124
126};
127
128inline ROCKY_FUNCTIONS IRockySPHModel::IRockySPHModel(
129 SPHModel* impl, const std::vector<int>& device_ids)
130 : _impl(impl)
131 , _device_ids(device_ids)
132{
133}
134
135// ================================================================================================
136// IRockySPHDeviceModel
137// ================================================================================================
138
146{
150 ROCKY_FUNCTIONS float get_sph_timestep() const;
151
155 ROCKY_FUNCTIONS float get_element_mass() const;
156
161 ROCKY_FUNCTIONS float get_initial_element_spacing() const;
162
170 ROCKY_FUNCTIONS ESPHKernelType get_kernel_type() const;
171
179 ROCKY_FUNCTIONS float get_kernel_weight(float distance) const;
180
188 ROCKY_FUNCTIONS float get_kernel_derivative(float distance) const;
189
195 ROCKY_FUNCTIONS float get_smoothing_length() const;
196
201 ROCKY_FUNCTIONS float get_minimum_distance() const;
202
207 ROCKY_FUNCTIONS float get_minimum_distance_squared() const;
208
212 ROCKY_FUNCTIONS float get_fluid_viscosity() const;
213
217 ROCKY_FUNCTIONS float get_fluid_density() const;
218
222 ROCKY_FUNCTIONS float get_fluid_thermal_conductivity() const;
223
227 ROCKY_FUNCTIONS float get_fluid_specific_heat() const;
228
234 ROCKY_FUNCTIONS float get_turbulent_prandtl_number() const;
235
239 ROCKY_FUNCTIONS float get_speed_of_sound() const;
240
244 ROCKY_FUNCTIONS float get_surface_tension() const;
245
250 ROCKY_FUNCTIONS float get_stiffness() const;
251
256 ROCKY_FUNCTIONS float get_damping_coefficient() const;
257
268 ROCKY_FUNCTIONS ESPHBoundaryType get_boundary_condition_type (int geometry_index) const;
269
280 ROCKY_FUNCTIONS float get_wall_turbulent_thermal_conductance(
281 float velocity, float distance) const;
282
298 ROCKY_FUNCTIONS IRockyCloudPoint
299 get_element_cloud_point(int point_cloud_index, const IRockySPHElement& element);
300
304 ROCKY_FUNCTIONS bool has_turbulence_modeling() const;
305
306
309 [[deprecated("Use get_element_mass() instead.")]]
310 ROCKY_FUNCTIONS float get_mass() const;
311
312 // (ROCKY - 15509) : candidates for removing from the API
313 // reason: they are model-specific parameters, they are not general
314
315 ROCKY_FUNCTIONS float get_les_smagorinsky_constant() const;
316
317 ROCKY_FUNCTIONS float get_les_distance_factor() const;
318
319 ROCKY_FUNCTIONS float get_stabilization_positive_factor() const;
320
321 ROCKY_FUNCTIONS float get_stabilization_negative_factor() const;
322
323 ROCKY_FUNCTIONS float get_stabilization_degree() const;
324
325 ROCKY_FUNCTIONS float get_boundary_distance_normal_factor() const;
326
327 ROCKY_FUNCTIONS float get_boundary_distance_tangential_factor() const;
328
329 ROCKY_FUNCTIONS IRockySPHDeviceModel(
330 SDeviceModel* model, cuda_general_sph* _gen_sph, SPHDeviceModel* _sph_model);
331
332 RockySPHDeviceModel _impl;
333 SDeviceModel* device_model;
334
336};
337
338inline ROCKY_FUNCTIONS IRockySPHDeviceModel::IRockySPHDeviceModel(
339 SDeviceModel* model, cuda_general_sph* _gen_sph, SPHDeviceModel* _sph_model)
340 : device_model(model)
341 , _impl(_gen_sph, _sph_model)
342{
343}
344
345inline ROCKY_FUNCTIONS ESPHKernelType IRockySPHDeviceModel::get_kernel_type() const
346{
347 return this->_impl.get_kernel_type();
348}
349
350inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_sph_timestep() const
351{
352 return this->_impl.get_timestep();
353}
354
355inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_mass() const
356{
357 return this->_impl.get_mass();
358}
359
360inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_element_mass() const
361{
362 return this->_impl.get_mass();
363}
364
365inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_initial_element_spacing() const
366{
367 return this->_impl.get_general_size();
368}
369
370inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_kernel_weight(float distance) const
371{
372 return this->_impl.get_kernel(distance);
373}
374
375inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_kernel_derivative(float distance) const
376{
377 return this->_impl.get_kernel_derivative(distance);
378}
379
380inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_smoothing_length() const
381{
382 return this->_impl.get_base_kernel();
383}
384
385inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_minimum_distance() const
386{
387 return this->_impl.get_minimum_distance();
388}
389
390inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_minimum_distance_squared() const
391{
392 return this->_impl.get_minimum_distance_squared();
393}
394
395inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_fluid_viscosity() const
396{
397 return this->_impl.get_general_viscosity();
398}
399
400inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_fluid_density() const
401{
402 return this->_impl.get_general_density();
403}
404
406{
407 return this->_impl.get_general_thermal_conductivity();
408}
409
410inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_fluid_specific_heat() const
411{
412 return this->_impl.get_general_specific_heat();
413}
414
415inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_turbulent_prandtl_number() const
416{
417 return this->_impl.get_turbulent_prandtl_number();
418}
419
420inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_speed_of_sound() const
421{
422 return this->_impl.get_speed_of_sound();
423}
424
425inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_surface_tension() const
426{
427 return this->_impl.get_surface_tension();
428}
429
430inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_damping_coefficient() const
431{
432 return this->_impl.get_damping_coefficient();
433}
434
435inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_stiffness() const
436{
437 return this->_impl.get_stiffness();
438}
439
440inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_les_smagorinsky_constant() const
441{
442 return this->_impl.get_les_smagorinsky_constant();
443}
444
445inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_les_distance_factor() const
446{
447 return this->_impl.get_les_distance_factor();
448}
449
450inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_stabilization_positive_factor() const
451{
452 return this->_impl.get_stabilization_positive_factor();
453}
454
455inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_stabilization_negative_factor() const
456{
457 return this->_impl.get_stabilization_negative_factor();
458}
459
460inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_stabilization_degree() const
461{
462 return this->_impl.get_stabilization_degree();
463}
464
465inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_boundary_distance_normal_factor() const
466{
467 return this->_impl.get_boundary_distance_normal_factor();
468}
469
470inline ROCKY_FUNCTIONS float IRockySPHDeviceModel::get_boundary_distance_tangential_factor() const
471{
472 return this->_impl.get_boundary_distance_tangential_factor();
473}
474
475inline ROCKY_FUNCTIONS ESPHBoundaryType IRockySPHDeviceModel::get_boundary_condition_type(int geometry_index) const
476{
477 return this->_impl.get_boundary_condition_type(geometry_index);
478}
479
480//TODO Refinement
482 float velocity, float distance) const
483{
484 return this->_impl.get_wall_turbulent_thermal_conductance(velocity, distance);
485}
486
488 int point_cloud_index, const IRockySPHElement& element)
489{
490 auto point_cloud = this->device_model->point_clouds + point_cloud_index;
491 int point_index = this->_impl.device_model->sph_particle_scalars->get_scalar<int>(
492 point_cloud->sph_scalars_index, element._impl.element_index);
493 return IRockyCloudPoint(point_cloud, point_index);
494}
495
496inline ROCKY_FUNCTIONS bool IRockySPHDeviceModel::has_turbulence_modeling() const
497{
498 return this->_impl.gen_sph->turb_type != ttLaminar;
499}
Definition rocky_point_cloud_api.hpp:15
Definition rocky_sph_model_api.hpp:146
ROCKY_FUNCTIONS float get_minimum_distance_squared() const
Definition rocky_sph_model_api.hpp:390
ROCKY_FUNCTIONS float get_smoothing_length() const
Definition rocky_sph_model_api.hpp:380
ROCKY_FUNCTIONS float get_turbulent_prandtl_number() const
Definition rocky_sph_model_api.hpp:415
ROCKY_FUNCTIONS float get_fluid_viscosity() const
Definition rocky_sph_model_api.hpp:395
ROCKY_FUNCTIONS float get_minimum_distance() const
Definition rocky_sph_model_api.hpp:385
ROCKY_FUNCTIONS float get_sph_timestep() const
Definition rocky_sph_model_api.hpp:350
ROCKY_FUNCTIONS ESPHKernelType get_kernel_type() const
Definition rocky_sph_model_api.hpp:345
ROCKY_FUNCTIONS float get_element_mass() const
Definition rocky_sph_model_api.hpp:360
ROCKY_FUNCTIONS float get_fluid_density() const
Definition rocky_sph_model_api.hpp:400
ROCKY_FUNCTIONS float get_fluid_specific_heat() const
Definition rocky_sph_model_api.hpp:410
ROCKY_FUNCTIONS float get_speed_of_sound() const
Definition rocky_sph_model_api.hpp:420
ROCKY_FUNCTIONS float get_fluid_thermal_conductivity() const
Definition rocky_sph_model_api.hpp:405
ROCKY_FUNCTIONS IRockyCloudPoint get_element_cloud_point(int point_cloud_index, const IRockySPHElement &element)
Definition rocky_sph_model_api.hpp:487
ROCKY_FUNCTIONS float get_damping_coefficient() const
Definition rocky_sph_model_api.hpp:430
ROCKY_FUNCTIONS float get_kernel_derivative(float distance) const
Definition rocky_sph_model_api.hpp:375
ROCKY_FUNCTIONS float get_wall_turbulent_thermal_conductance(float velocity, float distance) const
Definition rocky_sph_model_api.hpp:481
ROCKY_FUNCTIONS ESPHBoundaryType get_boundary_condition_type(int geometry_index) const
Definition rocky_sph_model_api.hpp:475
ROCKY_FUNCTIONS float get_initial_element_spacing() const
Definition rocky_sph_model_api.hpp:365
ROCKY_FUNCTIONS float get_stiffness() const
Definition rocky_sph_model_api.hpp:435
ROCKY_FUNCTIONS float get_kernel_weight(float distance) const
Definition rocky_sph_model_api.hpp:370
ROCKY_FUNCTIONS float get_surface_tension() const
Definition rocky_sph_model_api.hpp:425
ROCKY_FUNCTIONS bool has_turbulence_modeling() const
Definition rocky_sph_model_api.hpp:496
Definition rocky_sph_element_scalars.hpp:29
Definition rocky_sph_element_api.hpp:106
Definition rocky_sph_model_api.hpp:21
ROCKY_FUNCTIONS float get_fluid_density() const
Definition rocky_sph_model_api.cpp:56
float get_initial_element_spacing() const
Definition rocky_sph_model_api.cpp:36
ROCKY_FUNCTIONS float get_speed_of_sound() const
Definition rocky_sph_model_api.cpp:71
float get_smoothing_length() const
Definition rocky_sph_model_api.cpp:41
ESPHKernelType get_kernel_type() const
Definition rocky_sph_model_api.cpp:31
int get_number_of_active_sph_elements() const
Definition rocky_sph_model_api.cpp:16
int get_number_of_sph_elements() const
Definition rocky_sph_model_api.cpp:11
int get_number_of_active_free_sph_elements() const
Definition rocky_sph_model_api.cpp:26
IRockySPHElementScalarsModel get_sph_element_scalars() const
Definition rocky_sph_model_api.cpp:4
int get_number_of_active_linked_sph_elements() const
Definition rocky_sph_model_api.cpp:21
ROCKY_FUNCTIONS float get_fluid_viscosity() const
Definition rocky_sph_model_api.cpp:51
ROCKY_FUNCTIONS float get_fluid_thermal_conductivity() const
Definition rocky_sph_model_api.cpp:61
bool is_enabled() const
Definition rocky_sph_model_api.cpp:81
ROCKY_FUNCTIONS float get_fluid_specific_heat() const
Definition rocky_sph_model_api.cpp:66
ROCKY_FUNCTIONS float get_surface_tension() const
Definition rocky_sph_model_api.cpp:76
float get_element_mass() const
Definition rocky_sph_model_api.cpp:46

Connect with Ansys