Skip to main content

Rocky Solver SDK 2024 R2

rocky_sph_model

Last update: 17.07.2025
1#pragma once
2
3// Includes =======================================================================================
4#include <rocky20/device/device_model.hpp>
5#include <rocky20/sph/sph_data.h>
6
7// ================================================================================================
8// RockySPHDeviceModel
9// ================================================================================================
10
11struct RockySPHDeviceModel
12{
13 inline ROCKY_FUNCTIONS float get_timestep() const
14 {
15 return (float)this->gen_sph->dt_sph;
16 }
17
18 inline ROCKY_FUNCTIONS float get_mass() const
19 {
20 return this->mass;
21 }
22
23 //TODO refinement
24 inline ROCKY_FUNCTIONS float get_kernel(float distance) const
25 {
26 return this->gen_sph->get_kernel_single(distance);
27
28 }
29
30 //TODO refinement
31 inline ROCKY_FUNCTIONS float get_kernel_derivative(float distance) const
32 {
33 return this->gen_sph->get_kernel_derivative(distance);
34
35 }
36
37 inline ROCKY_FUNCTIONS ESPHKernelType get_kernel_type() const
38 {
39 return this->gen_sph->kern_type;
40 }
41
42 //TODO refinement
43 inline ROCKY_FUNCTIONS float get_base_kernel() const
44 {
45 return this->gen_sph->get_kern_base_single();
46
47 }
48
49 inline ROCKY_FUNCTIONS float get_minimum_distance() const
50 {
51 return this->minimum_distance;
52 }
53
54 inline ROCKY_FUNCTIONS float get_minimum_distance_squared() const
55 {
56 return this->minimum_distance_squared;
57 }
58
59 inline ROCKY_FUNCTIONS float get_general_viscosity() const
60 {
61 return this->gen_sph->visc;
62 }
63
64
65 inline ROCKY_FUNCTIONS float get_general_size() const
66 {
67 return this->gen_sph->dist_init;
68
69 }
70
71 inline ROCKY_FUNCTIONS float get_general_density() const
72 {
73 return this->gen_sph->dens;
74 }
75
76 inline ROCKY_FUNCTIONS float get_general_thermal_conductivity() const
77 {
78 return this->gen_sph->thermal_conductivity;
79 }
80
81 inline ROCKY_FUNCTIONS float get_general_specific_heat() const
82 {
83 return this->gen_sph->specific_heat;
84 }
85
86 inline ROCKY_FUNCTIONS float get_turbulent_prandtl_number() const
87 {
88 return this->gen_sph->turbulent_prandtl;
89 }
90
91 inline ROCKY_FUNCTIONS float get_speed_of_sound() const
92 {
93 return this->gen_sph->c;
94 }
95
96 inline ROCKY_FUNCTIONS float get_surface_tension() const
97 {
98 return this->gen_sph->stens_coeff;
99 }
100
101 inline ROCKY_FUNCTIONS float get_damping_coefficient() const
102 {
103 return this->boundary_dissipation_factor;
104 }
105
106 inline ROCKY_FUNCTIONS float get_stiffness() const
107 {
108 return this->stiffness;
109 }
110
111 // Viscosity
112 inline ROCKY_FUNCTIONS float get_cleary_viscosity_factor() const
113 {
114 return this->gen_sph->cleary_visc_factor;
115 }
116
117 // LES Turbulence
118 inline ROCKY_FUNCTIONS float get_les_smagorinsky_constant() const
119 {
120 return this->gen_sph->c_s;
121 }
122
123 inline ROCKY_FUNCTIONS float get_les_distance_factor() const
124 {
125 return this->gen_sph->turb_distance_fraction;
126 }
127
128 // Stabilization force
129 inline ROCKY_FUNCTIONS float get_stabilization_positive_factor() const
130 {
131 return this->gen_sph->stab_factor_pos;
132 }
133
134 inline ROCKY_FUNCTIONS float get_stabilization_negative_factor() const
135 {
136 return this->gen_sph->stab_factor_neg;
137 }
138
139 inline ROCKY_FUNCTIONS float get_stabilization_degree() const
140 {
141 return this->gen_sph->stab_deg;
142 }
143
144 // Boundary factors
145 inline ROCKY_FUNCTIONS float get_boundary_distance_normal_factor() const
146 {
147 return this->gen_sph->bnd_dist_factor_norm;
148 }
149
150 inline ROCKY_FUNCTIONS float get_boundary_distance_tangential_factor() const
151 {
152 return this->gen_sph->bnd_dist_factor_tang;
153 }
154
155 inline ROCKY_FUNCTIONS ESPHBoundaryType get_boundary_condition_type (int geometry_index) const
156 {
157 return this->device_model->wall_boundary_conditions[geometry_index];
158 }
159
160 //TODO Refinement
161 inline ROCKY_FUNCTIONS float get_wall_turbulent_thermal_conductance(float v_tang, float dst_wall) const
162 {
163 return this->gen_sph->get_wall_turbulent_thermal_conductance(v_tang, dst_wall);
164
165 }
166
167 //TODO Refinement
168 ROCKY_FUNCTIONS RockySPHDeviceModel(cuda_general_sph* _gen_sph, SPHDeviceModel* _sph_model)
169 : gen_sph(_gen_sph)
170 , mass(_gen_sph->get_mass())
171 , minimum_distance(_gen_sph->get_min_dist_single())
172 , minimum_distance_squared(_gen_sph->get_min_dist_single_squared())
173 , boundary_dissipation_factor(_gen_sph->get_diss())
174 , stiffness(_gen_sph->get_stiff())
175 , device_model(_sph_model)
176 {
177 }
178
179 SPHDeviceModel* device_model;
180 cuda_general_sph* gen_sph;
181 const float mass, minimum_distance, minimum_distance_squared, boundary_dissipation_factor,
182 stiffness;
183};

Connect with Ansys