    

 ## On this page

  

 

 # IRockySPHElementHost Struct Reference

 Last update: 17.07.2025 

`#include <<a class="el" href="rocky__sph__element__api_8hpp_source.xhtml">rocky_sph_element_api.hpp</a>>`

Inherits [IRockySPHElement](structIRockySPHElement.xhtml).

## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

[IRockyParticleHost](structIRockyParticleHost.xhtml) [get\_linked\_dem\_particle](structIRockySPHElementHost.xhtml#ac189516559b776a629f56aead8ac886b) ([IRockyModel](structIRockyModel.xhtml) &amp;model) const bool [is\_dem\_coupled](structIRockySPHElementHost.xhtml#abe5925c0999262fc7128da90d3a3f401) () const float [get\_density](structIRockySPHElementHost.xhtml#a246b2e85d4b1568d8db488e0f212a358) () const float [get\_pressure](structIRockySPHElementHost.xhtml#a1e02d98c42706aad00a15f84090046b7) () const float [get\_release\_time](structIRockySPHElementHost.xhtml#a300c46b79175d050ec9e96c736732b98) () const float3 [get\_position](structIRockySPHElementHost.xhtml#a518652c4c9aaba36c6e2137c3ff60f70) () const float3 [get\_velocity](structIRockySPHElementHost.xhtml#a1d9f8648a1c0ac0b575c9361ca5b9b96) () const float3 [get\_normal](structIRockySPHElementHost.xhtml#a9cae6ab2f89fc02fd3e944a5f1059d2d) () const float3 [get\_force](structIRockySPHElementHost.xhtml#aa1c7a1c2190108886098cf3918d29588) () const float3 [get\_acceleration](structIRockySPHElementHost.xhtml#a9118b2d9c4e8d7f185d453503bfbb04f) () const [IRockySPHElementScalars](structIRockySPHElementScalars.xhtml) [get\_scalars](structIRockySPHElementHost.xhtml#a333bb7196556fbe6da90abe079747071) () ROCKY\_FUNCTIONS SymmetricTensor&lt; float &gt; [get\_strain\_rate\_tensor](structIRockySPHElementHost.xhtml#a0540a21d1483e3848494d71a7145d8ff) () ![-](/sites/default/files/migrate-content/rocky_solver_sdk_2025_r1_1/closed.png) Public Member Functions inherited from [IRockySPHElement](structIRockySPHElement.xhtml)ROCKY\_FUNCTIONS [IRockyParticle](structIRockyParticle.xhtml) [get\_linked\_dem\_particle](structIRockySPHElement.xhtml#a82b39eaf0e1f5b9f09367fcb994af3d9) ([IRockyDeviceModel](structIRockyDeviceModel.xhtml) &amp;model) const ROCKY\_FUNCTIONS void [add\_force](structIRockySPHElement.xhtml#a0d51cf017a85bd175db6d18538c9d2e0) (const float3 &amp;force) ROCKY\_FUNCTIONS void [add\_acceleration](structIRockySPHElement.xhtml#a2f90b3a2980c2fa73cd53e72ea277f76) (const float3 &amp;acceleration) ROCKY\_FUNCTIONS bool [is\_enabled](structIRockySPHElement.xhtml#af514a8db990dff91c80abef70c29d604) () const ROCKY\_FUNCTIONS void [set\_frozen](structIRockySPHElement.xhtml#a258ae430ddd628d1b3375680774fd748) (bool frozen) ROCKY\_FUNCTIONS bool [is\_frozen](structIRockySPHElement.xhtml#a8a513f4cacbb94a272332beb8c8a371c) () const ROCKY\_FUNCTIONS bool [is\_dem\_coupled](structIRockySPHElement.xhtml#a3cd85ecace2e2784572a2e01397237f3) () const ROCKY\_FUNCTIONS float [get\_density](structIRockySPHElement.xhtml#a630d5e1aaea6b7c2f8f51c30089e07cd) () const ROCKY\_FUNCTIONS float [get\_pressure](structIRockySPHElement.xhtml#a52f9c9ca275229c97e0fee6c2962e65f) () const ROCKY\_FUNCTIONS float [get\_release\_time](structIRockySPHElement.xhtml#a9be557e2ec8056dd05338a651f5da171) () const ROCKY\_FUNCTIONS float3 [get\_position](structIRockySPHElement.xhtml#a7bd5a61c05ac4a77a61d3a0fc09597c5) () const ROCKY\_FUNCTIONS float3 [get\_velocity](structIRockySPHElement.xhtml#ab57e961ebc05e415bacc7c2236749428) () const ROCKY\_FUNCTIONS float3 [get\_normal](structIRockySPHElement.xhtml#af2f5b34f666646f5d1f19207bac5cb2d) () const ROCKY\_FUNCTIONS float3 [get\_force](structIRockySPHElement.xhtml#ab81b9afbefc503f46027274878703a3c) () const ROCKY\_FUNCTIONS float3 [get\_acceleration](structIRockySPHElement.xhtml#a9bbac7594cfc7a8dd14fee220a59cc0d) () const ROCKY\_FUNCTIONS [IRockySPHElementScalars](structIRockySPHElementScalars.xhtml) [get\_scalars](structIRockySPHElement.xhtml#a326bd60795936f9c4b77a9e000b1fa99) () ROCKY\_FUNCTIONS SymmetricTensor&lt; float &gt; [get\_strain\_rate\_tensor](structIRockySPHElement.xhtml#ac28f2f31caf98235f3281c9c9f417474) () <a id="details" name="details"></a>## Detailed Description

`<a class="el" href="structIRockySPHElementHost.xhtml">IRockySPHElementHost</a>` is the host counterpart of `<a class="el" href="structIRockySPHElement.xhtml">IRockySPHElement</a>`. Both share the same data, the main difference between them is that the data of `<a class="el" href="structIRockySPHElementHost.xhtml">IRockySPHElementHost</a>` resides within the host memory; therefore, it is used exclusively within initialization hooks, which are executed always in the host.

AttentionThis class is deprecated in favor of [IRockySPHElement](structIRockySPHElement.xhtml) and will be removed in Rocky version 25.2 

## Member Function Documentation

<a id="a9118b2d9c4e8d7f185d453503bfbb04f" name="a9118b2d9c4e8d7f185d453503bfbb04f"></a>## [◆ ](#a9118b2d9c4e8d7f185d453503bfbb04f)get\_acceleration()

 float3 IRockySPHElementHost::get\_acceleration  ( )  const

ReturnsThe current acceleration resultant vector of the SPH element, expressed in Cartesian coordinates. If this method is called before the stage of force calculation, a zero vector will be returned. 



<a id="a246b2e85d4b1568d8db488e0f212a358" name="a246b2e85d4b1568d8db488e0f212a358"></a>## [◆ ](#a246b2e85d4b1568d8db488e0f212a358)get\_density()

 float IRockySPHElementHost::get\_density  ( )  const

ReturnsThe current value of density calculated for the SPH element. 



<a id="aa1c7a1c2190108886098cf3918d29588" name="aa1c7a1c2190108886098cf3918d29588"></a>## [◆ ](#aa1c7a1c2190108886098cf3918d29588)get\_force()

 float3 IRockySPHElementHost::get\_force  ( )  const

ReturnsThe resultant of the forces currently acting over the SPH element, expressed in Cartesian coordinates. If this method is called before the stage of force calculation, a zero vector will be returned. 



<a id="ac189516559b776a629f56aead8ac886b" name="ac189516559b776a629f56aead8ac886b"></a>## [◆ ](#ac189516559b776a629f56aead8ac886b)get\_linked\_dem\_particle()

 [IRockyParticleHost](structIRockyParticleHost.xhtml) IRockySPHElementHost::get\_linked\_dem\_particle  ( [IRockyModel](structIRockyModel.xhtml) &amp;  *model*)  const

ReturnsAn `<a class="el" href="structIRockyParticleHost.xhtml">IRockyParticleHost</a>` object representing the DEM particle linked to the SPH particle, if the latter is actually a DEM-coupled SPH element. 



<a id="a9cae6ab2f89fc02fd3e944a5f1059d2d" name="a9cae6ab2f89fc02fd3e944a5f1059d2d"></a>## [◆ ](#a9cae6ab2f89fc02fd3e944a5f1059d2d)get\_normal()

 float3 IRockySPHElementHost::get\_normal  ( )  const

ReturnsAn approximation of the normal vector to a free surface, if the SPH element is located near one, for use on the implementation of custom surface tension models. This vector is obtained by using the standard continuum approximation of interfaces, which is based on the gradient of the so called color function. In this approximation, an interface has a finite thickness over which the color function varies smoothly between zero and one. Because of this, a normal vector is calculated for every SPH element in the solution domain. However, only elements located near a free surface will have a normal vector with length significantly different from zero. It is worth noting that this vector is not normalized, therefore, its length will vary from one element to another. Moreover, these normal vectors are calculated internally only if a surface tension model is active in the simulation, therefore, a runtime error will be generated if this method is used otherwise. 



<a id="a518652c4c9aaba36c6e2137c3ff60f70" name="a518652c4c9aaba36c6e2137c3ff60f70"></a>## [◆ ](#a518652c4c9aaba36c6e2137c3ff60f70)get\_position()

 float3 IRockySPHElementHost::get\_position  ( )  const

ReturnsThe Cartesian coordinates of the point at which the SPH element is currently located. 



<a id="a1e02d98c42706aad00a15f84090046b7" name="a1e02d98c42706aad00a15f84090046b7"></a>## [◆ ](#a1e02d98c42706aad00a15f84090046b7)get\_pressure()

 float IRockySPHElementHost::get\_pressure  ( )  const

ReturnsThe current value of the pressure at the location coincident with the SPH element. 



<a id="a300c46b79175d050ec9e96c736732b98" name="a300c46b79175d050ec9e96c736732b98"></a>## [◆ ](#a300c46b79175d050ec9e96c736732b98)get\_release\_time()

 float IRockySPHElementHost::get\_release\_time  ( )  const

ReturnsThe time at which the SPH element entered into the simulation. 



<a id="a333bb7196556fbe6da90abe079747071" name="a333bb7196556fbe6da90abe079747071"></a>## [◆ ](#a333bb7196556fbe6da90abe079747071)get\_scalars()

 [IRockySPHElementScalars](structIRockySPHElementScalars.xhtml) IRockySPHElementHost::get\_scalars  ( ) 

ReturnsAn `<a class="el" href="structIRockySPHElementScalars.xhtml">IRockySPHElementScalars</a>` object that gives access to all SPH element scalars variables defined in the project. 



<a id="a0540a21d1483e3848494d71a7145d8ff" name="a0540a21d1483e3848494d71a7145d8ff"></a>## [◆ ](#a0540a21d1483e3848494d71a7145d8ff)get\_strain\_rate\_tensor()

 ROCKY\_FUNCTIONS SymmetricTensor&lt; float &gt; IRockySPHElementHost::get\_strain\_rate\_tensor  ( ) 

ReturnsA `SymmetricTensor<float>` object that represents the strain rate tensor of the element. To get strain rate, please enable the Gradient Velocity Scalars by calling `IRockySPHElementScalarsModel::enable_gradient_velocity()` at setup hook. 



<a id="a1d9f8648a1c0ac0b575c9361ca5b9b96" name="a1d9f8648a1c0ac0b575c9361ca5b9b96"></a>## [◆ ](#a1d9f8648a1c0ac0b575c9361ca5b9b96)get\_velocity()

 float3 IRockySPHElementHost::get\_velocity  ( )  const

ReturnsThe velocity vector at which the SPH element is currently moving, expressed in Cartesian coordinates. 



<a id="abe5925c0999262fc7128da90d3a3f401" name="abe5925c0999262fc7128da90d3a3f401"></a>## [◆ ](#abe5925c0999262fc7128da90d3a3f401)is\_dem\_coupled()

 bool IRockySPHElementHost::is\_dem\_coupled  ( )  const

ReturnsTrue, if the SPH element is placed inside a DEM particle in order to model the interaction between the fluid flow and the DEM particles. False, otherwise.