Skip to main content
#include <rocky_sph_element_api.hpp> IRockySPHElement is the code representation of an individual SPH element, which is the basic unit for representing the fluid flow in a SPH model. It has several methods to access the values of physical properties carried by the SPH elements, as well as _ SPH element scalars_, which are special variables that store custom property values per SPH element that are preserved between time iterations. Inherited by:

Members

Public functions

Function get_linked_dem_particle

Returns: An IRockyParticle object representing the DEM particle linked to the SPH particle, if the latter is actually a DEM-coupled SPH element. Parameters: Return type: ROCKY_FUNCTIONS IRockyParticle

Function add_force

This method adds a new force to the set of acting forces over the SPH element.: Parameters:
  • force: The added force vector, expressed in Cartesian coordinates.
Parameters:
  • const float3 & force
Return type: ROCKY_FUNCTIONS void

Function add_acceleration

This method adds an acceleration component caused by an external force to the SPH element’s: acceleration internally calculated by Rocky. Parameters:
  • acceleration: The added acceleration vector, expressed in Cartesian coordinates.
Parameters:
  • const float3 & acceleration
Return type: ROCKY_FUNCTIONS void

Function is_enabled

Returns: True if the SPH element is enabled. False, otherwise. Return type: ROCKY_FUNCTIONS bool

Function set_frozen

This method sets the frozen state of a SPH element. When the frozen state of an element: is set to true, the solution of the motion equations for it is skipped. Parameters:
  • frozen: True if the particle should be frozen. False, otherwise.
Parameters:
  • bool frozen
Return type: ROCKY_FUNCTIONS void

Function is_frozen

Returns: True if the SPH element is frozen. False, otherwise. Return type: ROCKY_FUNCTIONS bool

Function is_dem_coupled

Returns: True, 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. Return type: ROCKY_FUNCTIONS bool

Function get_density

Returns: The current value of density calculated for the SPH element. Return type: ROCKY_FUNCTIONS float

Function get_pressure

Returns: The current value of the pressure at the location coincident with the SPH element. Return type: ROCKY_FUNCTIONS float

Function get_temperature

Returns: The current value of the temperature of the SPH element. Return type: ROCKY_FUNCTIONS float

Function get_release_time

Returns: The time at which the SPH element entered into the simulation. Return type: ROCKY_FUNCTIONS float

Function get_position

Returns: The Cartesian coordinates of the point at which the SPH element is currently located. Return type: ROCKY_FUNCTIONS float3

Function get_velocity

Returns: The velocity vector at which the SPH element is currently moving, expressed in Cartesian coordinates. Return type: ROCKY_FUNCTIONS float3

Function get_normal

Returns: An 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. Return type: ROCKY_FUNCTIONS float3

Function get_force

Returns: The 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. Return type: ROCKY_FUNCTIONS float3

Function get_acceleration

Returns: The 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. Return type: ROCKY_FUNCTIONS float3

Function get_kernel

Returns: The value of the kernel function evaluated at a point located at a given distance of the SPH element from which this method is called. The smoothing length considered is an average of the smoothing lengths of the pair formed by that element and a neighbor one. Parameters:
  • distance: The distance from the SPH element to the point at which the kernel function will be evaluated.
  • near_element: The near element used to calculate the average smoothing length.
Parameters: Return type: ROCKY_FUNCTIONS float

Function get_kernel_derivative

Returns: The value of the derivative of the kernel function evaluated at a point located at a given distance of the SPH element from which this method is called. The smoothing length considered is an average of the smoothing lengths of the pair formed by that element and a neighbor one. Parameters:
  • distance: The distance from the SPH element to the point at which the kernel function will be evaluated.
  • near_element: The near element used to calculate the average smoothing length.
Parameters: Return type: ROCKY_FUNCTIONS float

Function get_mass

Returns: The mass associated to the given SPH element. Return type: ROCKY_FUNCTIONS float

Function get_smoothing_length

Returns: The value of the smoothing length based on the size of the given SPH element. The radius of the support region of the kernel function is normally an integer multiple of the smoothing length. Return type: ROCKY_FUNCTIONS float

Function get_size

Returns: The spacing between SPH elements when they enter into the simulation. This is a characteristic length considered in several expressions in the SPH model. Return type: ROCKY_FUNCTIONS float

Function get_scalars

Returns: An IRockySPHElementScalars object that gives access to all SPH element scalars variables defined in the project. Return type: ROCKY_FUNCTIONS IRockySPHElementScalars

Function get_strain_rate_tensor

Returns: A 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. Return type: ROCKY_FUNCTIONS SymmetricTensor< float >

Function get_molecular_viscosity

Returns: The value of the molecular viscosity attributed to a given SPH element. Return type: ROCKY_FUNCTIONS float

Function set_molecular_viscosity

This method sets the value of the molecular viscosity attributed to a given SPH element.: Parameters:
  • const float molecular_viscosity
Return type: ROCKY_FUNCTIONS void

Function get_refinement_count

This the value of the refinement count of an element, which gives how many of the finest: element are represented are represented by the current element Return type: ROCKY_FUNCTIONS int

Function set_marked_for_refinement

This method marks the current element to be refined or not on the next refinement cycle: Parameters:
  • bool mark_for_refinement = true
Return type: ROCKY_FUNCTIONS void

Function set_skip_for_coarsening

This method marks the current element to be skipped on the next coarsening cycle. All the: elements that are not marked to be skipped can be candidates for coarsening. Parameters:
  • bool skip_for_coarsening = true
Return type: ROCKY_FUNCTIONS void