Skip to main content
#include <rocky_api.h> IRockyModel includes auxiliary functions for setting up a custom module. Most of the preprocessing methods (such as ROCKY_PLUGIN_SETUP, ROCKY_PLUGIN_INITIALIZE, ROCKY_PLUGIN_NON_DIMENSIONALIZE, etc) provide an IRockyModel object as an argument.

Members

Public functions

Function get_gravity

This functions returns the current gravity acceleration: in the simulation. Returns: A double3 value representing the current gravity acceleration vector in Cartesian Coordinates. Return type: double3

Function set_gravity

This function sets the gravity acceleration to be used: globally in the simulation from that time onward. Parameters:
  • gravity: A double3 value representing the gravity acceleration vector in Cartesian Coordinates.
Parameters:
  • const double3 & gravity
Return type: void

Function get_softening_factor

Returns: The value of the numerical softening factor, which is a global reduction factor that multiplies all stiffness values computed throughout a simulation. This factor is commonly used to increase the timestep and, therefore, speed up the execution of simulations. Return type: double

Function get_timestep

Returns: The current value of the simulation timestep. Return type: double

Function trigger_update_timestep

When called, enable the timestep update calculation at the beginning of the next iteration. If the module implements the ROCKY_PLUGIN_COMPUTE_TIMESTEP method it will be called during the update process, changing the solver timestep if the new computed timestep is smaller than the current one. !> Attention
If timestep is set using the advanced parameters, the update timestep calculation will be ignored.
Return type: void

Function is_thermal_simulation

Returns: True if the thermal option is enabled in the current Rocky project, false otherwise. Return type: bool

Function has_adhesion

Returns: True if the current Rocky project has enabled some adhesion model. Adhesive contacts will exist in a simulation only if that condition is met. Return type: bool

Function set_adhesive_distance

This method sets a value of the adhesive distance per material interaction,: for a custom adhesive force model. Whenever a new value set for an adhesive distance is greater than the previous maximum adhesive distance among all material interactions, a new neighbors search operation will be triggered. For this reason, if adhesive distances are increased too frequently, the simulation performance can be compromised. Parameters:
  • home_index: The index of the first material in the material interaction.
  • near_index: The index of the second material in the material interaction.
  • adhesive_distance: The value of the adhesive distance for contacts involving entities with the specified combination of materials.
Parameters:
  • int home_index
  • int near_index
  • double adhesive_distance
Return type: void

Function set_minimum_restitution_coefficient

This method is intended to be used by a module implementing a variable restitution: coefficient model. It allows the module to set the minimum expected value of the restitution coefficient associated to a given material interaction. The Rocky solver will use these values to calculate the stable timestep for the simulation. Every time the value of the minimum restitution coefficient of any material interaction is changed, a timestep calculation will be triggered. For this reason, if the restitution coefficient changes too frequently, the simulation performance can be compromised. The timestep will be changed only if the new calculated timestep is smaller than the previous one. Parameters:
  • home_index: The index of the first material in the material interaction.
  • near_index: The index of the second material in the material interaction.
  • minimum_restitution: The minimum expected value for the restitution coefficient in a collision involving entities with the specified combination of materials.
Parameters:
  • int home_index
  • int near_index
  • double minimum_restitution
Return type: void

Function get_interactions_data

Returns: An IRockyInteractionCalculationsData object, which can be used to access data and methods related to materials, materials interactions and particle groups. !> Attention
This method iterates over all particles in the simulation, which may introduce significant overhead to the execution time if called frequently.
Return type: IRockyInteractionCalculationsData

Function get_contact_data_recorder

Returns: An IRockyContactDataRecorder object which allows a module to configure which physical magnitudes the internal contact data recorder will record for use in statistics processing later on. Return type: IRockyContactDataRecorder

Function get_number_of_particle_groups

Returns: The total number of particle groups defined in the Rocky project. A particle group is a category of particles of the same shape and material. Return type: int

Function get_number_of_particles

Returns: The total number of individual particles in a whole simulation. Return type: int

Function get_number_of_geometries

Returns: The total number of boundaries defined in the Rocky project. Return type: int

Function get_number_of_materials

Returns: The total number of materials defined in the Rocky project. Return type: int

Function get_number_of_material_interactions

Returns: The total number of material interactions that it is possible to define with the current materials defined in the Rocky project. Return type: int

Function get_geometry_name

Returns: The name given in the Rocky UI the geometry identified by geometry_index. Parameters:
  • int geometry_index
Return type: std::string

Function get_particle_group_name

Returns: The name given in the Rocky UI the particle group identified by particle_group_index. Parameters:
  • int particle_group_index
Return type: std::string

Function get_simulation_variables

Returns: An IRockySimulationVariables object, which allows users to add new simulation variables during the setup of a module or access existing ones. Return type: IRockySimulationVariables

Function get_particle_scalars

Returns: An IRockyParticleScalarsModel object, which allows users to add new particle scalars or activate particle scalars known to Rocky during the setup of a module. Particle scalars are special variables attached to particles that are able to store values per particle that are preserved between time iterations. Return type: IRockyParticleScalarsModel

Function get_particle_transfer_scalars

Returns: An IRockyParticleTransferScalarsModel object, which allows users to add new particle transfer scalars or activate particle transfer scalars known to Rocky during the setup of a module. Particle transfer scalars are special particle scalars whose values are reset automatically to zero at the beginning of a new time iteration. Their typical use is the accumulation of values from all contacts or joints associated to a particle or an element at a given time iteration. Return type: IRockyParticleTransferScalarsModel

Function get_particle_breakage_scalars

Returns: An IRockyParticleBreakageScalarsModel object, which allows users to add new particle breakage scalars or activate particle breakage scalars known to Rocky during the setup of a module. Particle breakage scalars are special particle scalars used in conjunction with instantaneous breakage models, in order to transfer values calculated at a breakage event to the point at which the fragments size distribution is determined. Return type: IRockyParticleBreakageScalarsModel

Function get_joint_scalars

Returns: An IRockyJointScalarsModel object, which allows users to add new joint scalars during a setup of a module. Joint scalars are special variables attached to joints in flexible particles that are able to store values that are preserved between time iterations. Return type: IRockyJointScalarsModel

Function get_pair_scalars

Returns: An IRockyPairScalarsModel object, which allows users to add new pair scalars during a setup of a module. Pair scalars are special variables that associate values to all combinations of particle groups and combinations of particle groups and geometries within a project. Return type: IRockyPairScalarsModel

Function get_geometry_scalars

Returns: An IRockyGeometryScalarsModel object, which allows users to add new boundary scalars during a setup of a module. Boundary scalars are special variables that associate values to all geometries within a project. Return type: IRockyGeometryScalarsModel

Function get_triangle_scalars

Returns: An IRockyTriangleScalarsModel object, which allows users to add new triangle scalars during a setup of a module. Triangle scalars are special variables attached to geometry triangles that are able to store values that are preserved between time iterations. Return type: IRockyTriangleScalarsModel

Function get_particle_contact_scalars

Returns: An IRockyContactScalarsModel object, which allows users to add new (particle-to-particle) contact scalars during the setup phase of a module. Contact scalars are special variables attached to contacts that are able to store values that are preserved between time iterations.
For handling scalars related to particle-to-triangle contacts, please consult the
IRockyModel::get_triangle_contact_scalars method.
Return type: IRockyContactScalarsModel

Function get_triangle_contact_scalars

Returns: An IRockyContactScalarsModel object, which allows users to add new (particle-to-triangle) contact scalars during the setup phase of a module. Contact scalars are special variables attached to contacts that are able to store values that are preserved between time iterations.
For handling scalars for particle-to-particle contacts, please consult the
IRockyModel::get_particle_contact_scalars method.
Return type: IRockyContactScalarsModel

Function get_current_time

Returns: The value of the current simulation time. Return type: double

Function get_output_interval

Returns: The value of the simulation output interval. Return type: double

Function get_number_of_active_particles

Returns: The current number of active particles in the simulation. This number can vary throughout a simulation because new particles are injected and/or some particles leave the solution domain. Return type: int

Function get_number_of_active_triangles

Returns: The current number of active triangles in the simulation. This number can vary throughout a simulation because the active particle region changes due to particles moving, which will active or de-active triangles that are inside or outside the active region. Return type: int

Function get_number_of_processes

Returns: The number of allowed parallel processes when the simulation runs in CPU. Return type: int

Function get_number_of_devices

Returns: The number of devices set to run the simulation when using multi-GPU. Return type: int

Function get_device_id

Returns: The index that identifies a given device when running a simulation in multi-GPU. Parameters:
  • int device_index
Return type: int

Function find_point_cloud

This method searches for a point cloud dataset in the project, by name.: Parameters:
  • name: The name given to the point cloud in the Rocky UI.
Returns: The index that uniquely identifies the wanted point cloud, if it was actually found. It returns -1 otherwise. Parameters:
  • const std::string & name
Return type: int

Function find_point_cloud_property

**This method searches for a specific property name in a point cloud dataset **: imported into Rocky. Parameters:
  • point_cloud_index: The index that uniquely identifies the point cloud.
  • property_name: The name given to the property in the file defining the point cloud.
Returns: The index that uniquely identifies the wanted point cloud property, if it was actually found. It returns -1 otherwise. Parameters:
  • int point_cloud_index
  • const std::string & property_name
Return type: int

Function set_point_cloud_property_dimension

The purpose of this method is to associate a dimensional factor: to a point cloud property. This factor will be used to nondimensionalize all the associated values. For instance, if the property represents a force, a force dimensional factor must be associated through this method. Dimensional factors for the fundamental magnitudes are provided by functions of an IRockyModel object. Parameters:
  • point_cloud_index: The index that uniquely identifies the point cloud.
  • property_index: The index that uniquely identifies the point cloud property.
  • dimension: The appropriate dimensional factor for the point cloud property.
Parameters:
  • int point_cloud_index
  • int property_index
  • double dimension
Return type: void

Function get_curve_collections

Returns: An IRockyCurveCollectionData object which allows to create and manage custom time curves and/or custom cross-plot curves that can be displayed in the Rocky UI. Return type: IRockyCurveCollectionData

Function get_length_factor

Returns: The length factor in meters, used to nondimensionalize length parameters. Return type: double

Function get_mass_factor

Returns: The length factor in kilograms, used to nondimensionalize mass parameters. Return type: double

Function get_time_factor

Returns: The time factor in seconds, used to nondimensionalize time parameters. Return type: double

Function get_viscosity_factor

Returns: The viscosity factor in Pa.s, used to nondimensionalize viscosity parameters. Return type: double

Function get_temperature_factor

Returns: The temperature factor in Kelvin, used to nondimensionalize temperature parameters. Return type: double

Function get_force_factor

Returns: The force factor in Newton, used to nondimensionalize force parameters. Return type: double

Function get_pressure_factor

Returns: The pressure factor in Pascal, used to nondimensionalize pressure parameters. Return type: double

Function get_energy_factor

Returns: The energy factor in Joule, used to nondimensionalize energy parameters. Return type: double

Function get_power_factor

Returns: The energy factor in Watts, used to nondimensionalize power parameters. Return type: double