Skip to main content

Rocky Solver SDK 2025 R2

rocky_sph_model

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/device/device_model.hpp>
6#include <rocky20/sph/sph_model.h>
7
8// ================================================================================================
9// RockySPHDeviceModel
10// ================================================================================================
11
12struct RockySPHDeviceModel
13{
14 inline ROCKY_FUNCTIONS float get_timestep() const
15 {
16 return (float)this->gen_sph->dt_sph;
17 }
18
19 inline ROCKY_FUNCTIONS float get_mass() const
20 {
21 return this->mass;
22 }
23
24 inline ROCKY_FUNCTIONS ESPHKernelType get_kernel_type() const
25 {
26 return this->gen_sph->kern_type;
27 }
28
29 inline ROCKY_FUNCTIONS float get_minimum_distance() const
30 {
31 return this->minimum_distance;
32 }
33
34 inline ROCKY_FUNCTIONS float get_minimum_distance_squared() const
35 {
36 return this->minimum_distance_squared;
37 }
38
39 inline ROCKY_FUNCTIONS float get_general_viscosity() const
40 {
41 return this->gen_sph->visc;
42 }
43
44
45 inline ROCKY_FUNCTIONS float get_general_size() const
46 {
47 return this->gen_sph->dist_init;
48
49 }
50
51 inline ROCKY_FUNCTIONS float get_general_density() const
52 {
53 return this->gen_sph->dens;
54 }
55
56 inline ROCKY_FUNCTIONS float get_general_thermal_conductivity() const
57 {
58 return this->gen_sph->thermal_conductivity;
59 }
60
61 inline ROCKY_FUNCTIONS float get_general_specific_heat() const
62 {
63 return this->gen_sph->specific_heat;
64 }
65
66 inline ROCKY_FUNCTIONS float get_turbulent_prandtl_number() const
67 {
68 return this->gen_sph->turbulent_prandtl;
69 }
70
71 inline ROCKY_FUNCTIONS float get_speed_of_sound() const
72 {
73 return this->gen_sph->c;
74 }
75
76 inline ROCKY_FUNCTIONS float get_surface_tension() const
77 {
78 return this->gen_sph->stens_coeff;
79 }
80
81 inline ROCKY_FUNCTIONS float get_damping_coefficient() const
82 {
83 return this->boundary_dissipation_factor;
84 }
85
86 inline ROCKY_FUNCTIONS float get_stiffness() const
87 {
88 return this->stiffness;
89 }
90
91 // Viscosity
92 inline ROCKY_FUNCTIONS float get_cleary_viscosity_factor() const
93 {
94 return this->gen_sph->cleary_visc_factor;
95 }
96
97 // LES Turbulence
98 inline ROCKY_FUNCTIONS float get_les_smagorinsky_constant() const
99 {
100 return this->gen_sph->c_s;
101 }
102
103 inline ROCKY_FUNCTIONS float get_les_distance_factor() const
104 {
105 return this->gen_sph->turb_distance_fraction;
106 }
107
108 // Stabilization force
109 inline ROCKY_FUNCTIONS float get_stabilization_positive_factor() const
110 {
111 return this->gen_sph->stab_factor_pos;
112 }
113
114 inline ROCKY_FUNCTIONS float get_stabilization_negative_factor() const
115 {
116 return this->gen_sph->stab_factor_neg;
117 }
118
119 inline ROCKY_FUNCTIONS float get_stabilization_degree() const
120 {
121 return this->gen_sph->stab_deg;
122 }
123
124 // Boundary factors
125 inline ROCKY_FUNCTIONS float get_boundary_distance_normal_factor() const
126 {
127 return this->gen_sph->bnd_dist_factor_norm;
128 }
129
130 inline ROCKY_FUNCTIONS float get_boundary_distance_tangential_factor() const
131 {
132 return this->gen_sph->bnd_dist_factor_tang;
133 }
134
135 inline ROCKY_FUNCTIONS ESPHBoundaryType get_boundary_condition_type (int geometry_index) const
136 {
137 return this->device_model->sph_boundary_data[geometry_index].wall_boundary_condition;
138 }
139
140 ROCKY_FUNCTIONS RockySPHDeviceModel(cuda_general_sph* _gen_sph, SPHDeviceModel* _sph_model)
141 : gen_sph(_gen_sph)
142 , mass(_gen_sph->get_mass())
143 , minimum_distance(_gen_sph->get_minimum_distance())
144 , minimum_distance_squared(_gen_sph->get_minimum_distance_squared())
145 , boundary_dissipation_factor(_gen_sph->get_diss())
146 , stiffness(_gen_sph->get_stiff())
147 , device_model(_sph_model)
148 {
149 }
150
151 SPHDeviceModel* device_model;
152 cuda_general_sph* gen_sph;
153 const float mass, minimum_distance, minimum_distance_squared, boundary_dissipation_factor,
154 stiffness;
155};

Connect with Ansys