RAMotionFrame
Last update: 17.07.2025class RAMotionFrame
Rocky PrePost Scripting wrapper for a motion frame.
The class contains methods to configure a motion frame and its motions. There are some options
to retrieve a specific RAMotionFrame in a project from a RAStudy, a
RAMotionFrameSource or another RAMotionFrame:
# From the RAStudy
motion_frame = study.GetElement('<motion frame name>')
# From the RAMotionFrameSource
frame_source = study.GetMotionFrameSource()
motion_frame = frame_source.GetMotionFrame('<motion frame name>')
# From a "parent" motion frame
frame_1 = study.GetElement('<frame name>')
frame_2 = frame_1.GetMotionFrame('<frame name>')
A motion frame comprises frame properties (relative position, rotation angle, free body limits,
etc) and a list of motions. The properties are manipulated via direct Get*() and Set*()
methods, while the motions are accessed separately via the list returned by GetMotions().
Motion frames can be created on the “root” of the project’s motion frames (the source returned
in RAStudy.GetMotionFrameSource()), or as a ‘child’ frame of a pre-existing motion frame:
frame_source = study.GetMotionFrameSource()
# Create a motion frame with no parent frame
frame_1 = frame_source.NewFrame()
# Configure this new frame frame_1
frame_1.SetRelativePosition(...)
frame_1.SetEnablePeriodicMotion(...)
# ... configure motions, etc.
# Create a new frame, as a child of `frame_1`
frame_2 = frame_1.NewFrame()
# Configure this new frame frame_2
frame_2.SetRelativePosition(...)
# ... configure motions, etc.
Methods:
| Name | Description |
|---|---|
AddCurve(curve_name, timesteps, values, unit) |
Add a curve to the element with a time-steps domain |
AddGridFunction(grid_function_name, ...[, ...]) |
Adds a grid function to the grid. |
AddPendulumMotion([start_time, stop_time, ...]) |
Adds a pendulum motion to the frame. |
AddRotationMotion([start_time, stop_time, ...]) |
Adds a rotation motion to the frame. |
AddTranslationMotion([start_time, ...]) |
Adds a translation motion to the frame. |
AddVibrationMotion([start_time, stop_time, ...]) |
Adds a vibration motion to the frame. |
ApplyTo(obj) |
Link this motion frame to the given geometry. |
CreateCurveOutputVariable(curve_name[, ...]) |
Used to create an output variable based on a curve which doesn't change at each new timestep (i.e.: a curve with a single value for each time). |
CreateGridFunction(values[, location, time_step]) |
Create a grid function from the given values, location and time-step. |
CreateGridFunctionArrayOnCells([time_step]) |
Creates a numpy array with the number of elements based on the cells and returns it. |
CreateGridFunctionStatisticOutputVariable(...) |
Used to create an output variable based on a grid function statistic (i.e.: will get a grid function, compute its statistic based on statistic_operation and then based on the statistic values will apply the operation to get a single scalar). |
CreateTransientCurveOutputVariable(curve_name) |
Used to create an output variable based on a curve for which there's a completely new representation for each time step -- such as Power : Impact X Belt Width (i.e.: will get the curve multiple times based on the time range, compute a value for each time based on the operation, to convert the multiple curves into a single curve and then will apply the time_operation to get a single scalar from those values). |
GetActivesArray([time_step]) |
Get an array representing the cells' "active" status. |
GetBoundingBox([unit, time_step]) |
Get the element's bounding box. |
GetCellAreaAsArray([time_step]) |
Get an array containing the area of each cell. |
GetCellCenterAsArray([time_step]) |
Get an array containing the center coordinates of each cell. |
GetCellDzAsArray([time_step]) |
Get an array containing the thickness (in Z) of each cell. |
GetCellFromIJK(i, j, k[, time_step]) |
Creates a grid cell handle from the current I, J, K indexes |
GetCellIJK(cell_handle[, time_step]) |
Converts the given cell handle to it's I, J, K indexes |
GetCellNumberOfVertices(cell[, time_step]) |
Get an array containing the number of vertices of each cell. |
GetCellPointsAsFunction([time_step]) |
Get a function for the points (vertices) of each cell. |
GetCellVolumeAsArray([time_step]) |
Get an array with the volume of each cell. |
GetCurve(curve_name[, simulation_name, ...]) |
Override base class method to check for a request of a grid function statistic. |
GetCurveNames([simulation_name]) |
@param simulation_name: unicode |
GetCurveNamesAssociation([simulation_name]) |
Get this element's curve names. |
GetElementCurve(element_name, curve_name[, ...]) |
Return the curves for the given element and name. |
GetEnableFbmAngularLimits() |
Get the value of "Enable Fbm Angular Limits". |
GetEnableFbmLinearLimits() |
Get the value of "Enable Fbm Linear Limits". |
GetEnablePeriodicMotion() |
Get the value of "Enable Periodic Motion". |
GetFbmMaxAngularLimits([unit]) |
Get the value of "Fbm Max Angular Limits". |
GetFbmMaxLinearLimits([unit]) |
Get the value of "Fbm Max Linear Limits". |
GetFbmMinAngularLimits([unit]) |
Get the value of "Fbm Min Angular Limits". |
GetFbmMinLinearLimits([unit]) |
Get the value of "Fbm Min Linear Limits". |
GetGeometryQuantity() |
Get the quantity corresponding to the grid's geometry. |
GetGeometryUnit() |
Get the grid's geometry's unit. |
GetGridFunction(grid_function_name[, ...]) |
Gets a grid function given its name. |
GetGridFunctionNames([translated, context]) |
Get a list of the available grid functions for this grid. |
GetKeepInPlace() |
Get the value of "Keep In Place". |
GetMeshColoring(window) |
Get the RAMeshColoring related to the current object and a window. |
GetMotionFrame(frame_name) |
Get a specific motion frame given its name. |
GetMotions() |
Get the list of motions in the motion frame. |
GetNumberOfCells([time_step]) |
Get the total number of cells. |
GetNumberOfNodes([time_step]) |
Get the total number of nodes (vertices). |
GetNumpyCurve(curve_name[, unit, realization]) |
Returns a curve as a tuple of numpy arrays (time, property) for the given element and name. |
GetOrientation([unit]) |
Get the orientation angles. |
GetOrientationFromAngleAndVector([unit]) |
Get the current orientation in the form of an angle and a vector. |
GetOrientationFromAngles([unit]) |
Get the current orientation in the form of angles. |
GetOrientationFromBasisVector() |
Get the current orientation in the form of three basis vectors. |
GetOutputVariableValue(variable_name) |
Get the value of a previously-created output variable. |
GetParentMotionFrame() |
Gets the parent motion frame. |
GetPeriodicMotionPeriod([unit]) |
Get the value of "Periodic Motion Period". |
GetPeriodicMotionStartTime([unit]) |
Get the value of "Periodic Motion Start Time". |
GetPeriodicMotionStopTime([unit]) |
Get the value of "Periodic Motion Stop Time". |
GetRelativePosition([unit]) |
Get the value of "Relative Position". |
GetRelativeRotationVector([unit]) |
Deprecated: Use GetOrientationFromAngleAndVector() instead. |
GetRotationAngle([unit]) |
Deprecated: Use GetOrientationFromAngleAndVector() instead. |
GetTimeSet() |
Get the list of time-steps associated to the grid. |
GetTimeStatistics() |
Get the object responsible for handling time-statistics grid functions for this process. |
GetTimeStep(time_step[, accept_global]) |
Get the timestep corresponding to the given time. |
GetTopologyShape([time_step]) |
Get the shape of the topology (similar to the shape of numpy arrays). |
HasGridFunction(grid_function_name) |
Whether the grid has the given grid function. |
IsCellActive(i, j, k[, time_step]) |
Checks if the given cell is active or not |
IterCellVertices(cell[, time_step]) |
Iterate on the vertices of active grid cells at the given time. |
IterCells([time_step]) |
Iterate on the active grid cells at the given time. |
IterMotionFrames() |
Iterates over all the motion frames available (recursively). |
Modified(*args, **kwargs) |
Resets all the cache information after a change in the subject being tracked. |
NewConeCrusherFrame() |
Creates a new cone crusher frame. |
NewFrame() |
Creates a new motion frame. |
RemoveFrame(motion_frame) |
Removes a previously-created motion frame. |
RemoveOutputVariable(variable_name) |
Removes some output variable. |
RemoveProcess() |
Removes the process from the project. |
SetCurrentTimeStep(time_step) |
Sets the current time step. |
SetEnableFbmAngularLimits(value) |
Set the value of "Enable Fbm Angular Limits". |
SetEnableFbmLinearLimits(value) |
Set the value of "Enable Fbm Linear Limits". |
SetEnablePeriodicMotion(value) |
Set the value of "Enable Periodic Motion". |
SetFbmMaxAngularLimits(values[, unit]) |
Set the values of "Fbm Max Angular Limits". |
SetFbmMaxLinearLimits(values[, unit]) |
Set the values of "Fbm Max Linear Limits". |
SetFbmMinAngularLimits(values[, unit]) |
Set the values of "Fbm Min Angular Limits". |
SetFbmMinLinearLimits(values[, unit]) |
Set the values of "Fbm Min Linear Limits". |
SetKeepInPlace(value) |
Set the value of "Keep In Place". |
SetOrientation(rotation[, unit]) |
The rotation is the angles in x, y and z of the rotation in the given unit. |
SetOrientationFromAngleAndVector(angle, vector) |
The rotation uses the angle and a vector, using unit and changes the orientation mode to Angle and Vector. |
SetOrientationFromAngles(rotation[, unit, ...]) |
The rotation is the angles in x, y and z of the rotation. |
SetOrientationFromBasisVector(vector_x, ...) |
Sets the rotation using three basis vector and changes the orientation mode to Basis Vector. |
SetPeriodicMotionPeriod(value[, unit]) |
Set the value of "Periodic Motion Period". |
SetPeriodicMotionStartTime(value[, unit]) |
Set the value of "Periodic Motion Start Time". |
SetPeriodicMotionStopTime(value[, unit]) |
Set the value of "Periodic Motion Stop Time". |
SetRelativePosition(values[, unit]) |
Set the values of "Relative Position". |
SetRelativeRotationVector(values[, unit]) |
Deprecated: Use SetOrientationFromAngleAndVector() instead. |
SetRotationAngle(value[, unit]) |
Deprecated: Use SetOrientationFromAngleAndVector() instead. |
AddCurve(curve_name, timesteps, values, unit, realization=None, timesteps_unit=None, initial_date=None)
Add a curve to the element with a time-steps domain
- Parameters:
- curve_name (unicode or SemanticAssociation) – The curve’s name or semantic association
- timesteps (list *(*TimeStep ) or list *(*float ) or TimeSet) – The list of time-steps, in such case a initial date can be provided The list of elapsed time as floats, in such case a timesteps_units can be provide or days will be used The curve’s TimeSet
- values (list *(*float )) – The list of curve image values
- unit (unicode or Quantity) – The curve image unit or quantity
- realization (unicode) – An additional keyword to identify the curve realization
- timesteps_units (unicode) – The elapsed time values unit It should be given if a list of floats is used to define the time-set If not given days are assumed
- initial_date (tuple *(*int , int , int , int , int , int ) or TimeStep) – The initial date for the time-steps given A tuple with the year, month, day, hour, minute and seconds Or a TimeStep
AddGridFunction(grid_function_name, grid_function, unit='', location='cell', realization='user_generated', time_step=None)
Adds a grid function to the grid.
- Parameters:
- grid_function_name (unicode or SemanticAssociation) – The name of the grid function to be stored in this grid or the semantic association representing the grid function.
- grid_function (list *(*double ) or numpy array) – The values of the grid function to be added.
- unit (unicode or IQuantity) – The unit (or quantity) in which the grid function is being given.
- location (unicode) – The location of the grid function (currently only ‘cell’ is accepted).
- realization (unicode) – The realization used to identify the grid function among other grid functions. If None, this information is ignored.
- time_step (None , unicode , ITimeStep or int) – if None if given a static grid function will be created otherwise a transient grid function is created and the given array associated with this time-step
SEE ALSO
KAContextDependentElement.GetTimeStep
AddPendulumMotion(start_time=(0.0, 's'), stop_time=(1000.0, 's'), initial_frequency=(0.0, 'Hz'), angular_initial_amplitude=(0.0, 'rad'), direction=((0.0, 0.0, 0.0), 'm'), angular_initial_phase=(0.0, 'rad'), frequency_variation=(0.0, 'Hz/s'), angular_amplitude_variation=(0.0, 'rad/s'))
Adds a pendulum motion to the frame.
- Parameters:
- start_time (float) – The start time for the motion.
- stop_time (float) – The end time for the motion.
- initial_frequency (float) – The initial frequency of the rotation (in Hz).
- angular_initial_amplitude (float) – The initial angular amplitude of the rotation (in rad).
- direction (list *(*float )) – The direction of the rotation (in m).
- angular_initial_phase (list *(*float )) – The initial angular phase of the rotation (in rad).
- frequency_variation (float) – The variation of the frequency (in Hz/s).
- angular_amplitude_variation (float) – The angular amplitude variation (in rad/s).
AddRotationMotion(start_time=(0.0, 's'), stop_time=(1000.0, 's'), angular_velocity=((0.0, 0.0, 0.0), 'rad/s'), angular_acceleration=((0.0, 0.0, 0.0), 'rad/s2'))
Adds a rotation motion to the frame.
- Parameters:
- start_time (float) – The start time for the motion.
- stop_time (float) – The end time for the motion.
- angular_velocity (list *(*float )) – The motion angular velocity (x, y, z).
- angular_acceleration (list *(*float )) – The motion angular acceleration (x, y, z).
- Return RAMotion: Returns the motion created.
AddTranslationMotion(start_time=(0.0, 's'), stop_time=(1000.0, 's'), velocity=((0.0, 0.0, 0.0), 'm/s'), acceleration=((0.0, 0.0, 0.0), 'm/s2'), define_as='fixed_velocity', final_velocity=((0.0, 0.0, 0.0), 'm/s'))
Adds a translation motion to the frame.
- Parameters:
-
start_time (float) – The start time for the motion.
-
stop_time (float) – The end time for the motion.
-
velocity (list *(*float *,*float *,*float )) – The motion velocity (x, y, z) in m/s.
-
acceleration (list *(*float *,*float *,*float )) – The motion acceleration (x, y, z) in m/s2
-
displace_geometry (bool) – Whether the geometry should be displaced with the movement or not.
-
define_as (unicode) –
How it should be defined. Valid values are: : ’fixed_velocity’ ‘initial_and_final_velocity’ ‘initial_velocity_and_acceleration’
-
final_velocity (list *(*float *,*float *,*float )) –
The final motion velocity (x, y, z) in m/2.
Used only if define_as == ‘initial_and_final_velocity’, in which case the initial velocity is given by the velocity parameter.
-
- Return RAMotion: Returns the motion created.
AddVibrationMotion(start_time=(0.0, 's'), stop_time=(1000.0, 's'), initial_frequency=(0.0, 'Hz'), initial_amplitude=(0.0, 'm'), direction=((0.0, 0.0, 0.0), 'm'), frequency_variation=(0.0, 'Hz/s'), amplitude_variation=(0.0, 'm/s'))
Adds a vibration motion to the frame.
- Parameters:
- start_time (float) – The start time for the motion.
- stop_time (float) – The end time for the motion.
- initial_frequency (float) – The initial frequency of the vibration (in Hz).
- initial_amplitude (float) – The initial amplitude of the vibration (in m).
- direction (list *(*float )) – The direction of the vibration (in m).
- frequency_variation (float) – The variation of the frequency (in Hz/s).
- amplitude_variation (float) – The amplitude variation (in m/s).
ApplyTo(obj)
Link this motion frame to the given geometry.
- Parameters: obj (Subject *|*ScriptingWrapper) – Either the actual object or the wrapper in the scripting for the object.
CreateCurveOutputVariable(curve_name: str, operation: str = 'max', time_range: str = 'all', initial_time_range: float = 0.0, final_time_range: float = 0.0)
Used to create an output variable based on a curve which doesn’t change at each new timestep (i.e.: a curve with a single value for each time).
- See: CreateTransientCurveOutputVariable for dealing with curves that are transient.
- Parameters:
-
curve_name – The name of the curve for which the output variable is wanted.
-
operation –
The operation we want to do to convert the curve into a single value.
Valid operations: : ’min’ ‘max’ ‘sum’ ‘sum_squared’ ‘average’ ‘variance’ ‘standard_deviation’
-
time_range –
Defines the time range for the curve to be gathered for creating the output variable (depending on which time range is chosen, the initial_time_range and the final_time_range may be used to get the actual times for computing the statistics).
Valid time ranges: : ’app_time_filter’: : Uses the application time filter to get the relevant times.
’all’ : Uses all the times in the simulation.
’last_output’ : Uses only the last time in the simulation.
’absolute’ : Defines a time range using the initial_time_range and final_time_range.
’single’ : Defines a single time to be used as the time range specified as the initial_time_range.
’absolute_only_start’ : Defines a time range using all the values after the given initial_time_range.
’relative_to_end’ : Uses all the values considering initial_time_range as a delta from the end of the simulation. -
initial_time_range – A value in seconds (whose actual meaning depends on the defined time_range).
-
final_time_range – A value in seconds (whose actual meaning depends on the defined time_range).
-
- Return type: str
- Returns: Returns the name of the variable to be used later on to reference the output variable.
CreateGridFunction(values, location='cell', time_step='current')
Create a grid function from the given values, location and time-step.
- Parameters:
- values (list *(*double ) or numpy array) – The values of the grid function to be added.
- time_step –
SEE ALSO
KAContextDependentElement.GetTimeStep
CreateGridFunctionArrayOnCells(time_step='current')
Creates a numpy array with the number of elements based on the cells and returns it. A different time may be specified to create the grid function based on a different time.
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to create the array or an int identifying the time step index to be used based on the global time set
- Return type: numpy.array
- Returns: Returns a numpy float32 array with the number of elements equal to the number of cells.
CreateGridFunctionStatisticOutputVariable(grid_function_name: str, operation: str = 'max', statistic_operation: str = 'max', time_range: str = 'last_output', initial_time_range: float = 0.0, final_time_range: float = 0.0)
Used to create an output variable based on a grid function statistic (i.e.: will get a grid function, compute its statistic based on statistic_operation and then based on the statistic values will apply the operation to get a single scalar).
- Parameters:
-
grid_function_name – The name of the grid function for which the output variable is wanted.
-
operation –
The operation used to select which value to get based on the statistic values obtained.
Valid operations: : ’min’ ‘max’ ‘sum’ ‘sum_squared’ ‘average’ ‘variance’ ‘standard_deviation’
-
statistic_operation –
The statistic operation which should be applied to the grid function for each time to obtain a single value for each time.
Valid operations: : ’min’ ‘max’ ‘sum’ ‘sum_squared’ ‘average’ ‘variance’ ‘standard_deviation’
-
time_range –
Defines the time range for the grid functions to be gathered for creating the output variable (depending on which time range is chosen, the initial_time_range and the final_time_range may be used to get the actual times for computing the statistics).
Valid time ranges: : ’app_time_filter’: : Uses the application time filter to get the relevant times.
’all’ : Uses all the times in the simulation.
’last_output’ : Uses only the last time in the simulation.
’absolute’ : Defines a time range using the initial_time_range and final_time_range.
’single’ : Defines a single time to be used as the time range specified as the initial_time_range.
’absolute_only_start’ : Defines a time range using all the values after the given initial_time_range.
’relative_to_end’ : Uses all the values considering initial_time_range as a delta from the end of the simulation. -
initial_time_range – A value in seconds (whose actual meaning depends on the defined time_range).
-
final_time_range – A value in seconds (whose actual meaning depends on the defined time_range).
-
- Returns: Returns the name of the variable to be used later on to reference the output variable.
CreateTransientCurveOutputVariable(curve_name: str, operation: str = 'max', time_operation: str = 'max', time_range: str = 'last_output', initial_time_range: float = 0.0, final_time_range: float = 0.0, domain_range: str = 'all', initial_domain_range: float = 0.0, final_domain_range: float = 0.0, domain_unit: Optional[str] = None)
Used to create an output variable based on a curve for which there’s a completely new representation for each time step – such as Power : Impact X Belt Width (i.e.: will get the curve multiple times based on the time range, compute a value for each time based on the operation, to convert the multiple curves into a single curve and then will apply the time_operation to get a single scalar from those values).
- Parameters:
-
curve_name – The name of the transient curve for which the output variable is wanted.
-
operation –
The operation we want to do at the curve in each time (i.e.: go from transient curve to a regular curve).
Valid operations: : ’min’ ‘max’ ‘sum’ ‘sum_squared’ ‘average’ ‘variance’ ‘standard_deviation’
-
time_operation –
The operation that we want to do at the curve when the curve is already converted to a regular time-based curve (by applying the ‘operation’ at each time).
Valid operations: : ’min’ ‘max’ ‘sum’ ‘sum_squared’ ‘average’ ‘variance’ ‘standard_deviation’
-
time_range –
Defines the time range for the curve to be gathered for creating the output variable (depending on which time range is chosen, the initial_time_range and the final_time_range may be used to get the actual times for computing the statistics).
Valid time ranges: : ’app_time_filter’: : Uses the application time filter to get the relevant times.
’all’ : Uses all the times in the simulation.
’last_output’ : Uses only the last time in the simulation.
’absolute’ : Defines a time range using the initial_time_range and final_time_range.
’single’ : Defines a single time to be used as the time range specified as the initial_time_range.
’absolute_only_start’ : Defines a time range using all the values after the given initial_time_range.
’relative_to_end’ : Uses all the values considering initial_time_range as a delta from the end of the simulation. -
initial_time_range – A value in seconds (whose actual meaning depends on the defined time_range).
-
final_time_range – A value in seconds (whose actual meaning depends on the defined time_range).
-
domain_range –
Define the domain range for the curve to create the output variable
Valid domain_range: : ’all’ : Uses all the domain in the simulation
’single’ : Defines a single time to be used as the time range specified as the initial_domain_range
’absolute’ : Defines a domain range using the initial_domain_range and final_domain_range. -
initial_domain_range – A value for the beginning of the domain (whose actual meaning depends on the defined domain_range).
-
final_domain_range – A value for the end of the domain (whose actual meaning depends on the defined domain_range).
-
domain_unit – A unit for the domain_range
-
- Return type: str
- Returns: Returns the name of the variable to be used later on to reference the output variable.
GetActivesArray(time_step='current')
Get an array representing the cells’ “active” status.
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the actives array or an int identifying the time step index to be used based on the global time set
- Return type: numpy array
- Returns: Returns a numpy array with booleans where True means the cell is active and False means it’s not active.
GetBoundingBox(unit=None, time_step='current')
Get the element’s bounding box.
- Parameters:
- unit (unicode) – The unit in which the bounding box should be gotten (by default it uses the same unit of the geometry).
- time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the bounding box or an int identifying the time step index to be used based on the global time set
- Return type: tuple(tuple(float, float, float), tuple(float, float, float))
- Returns: THe minimum and maximum geometry coordinates of the grid or None if the time step is not available at the requested time.
GetCellAreaAsArray(time_step='current')
Get an array containing the area of each cell.
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the cell volume or an int identifying the time step index to be used based on the global time set
- Return type: numpy.array
- Returns: An array with the cell area (the unit will be the geometry unit ** 2)
GetCellCenterAsArray(time_step='current')
Get an array containing the center coordinates of each cell.
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the cell center or an int identifying the time step index to be used based on the global time set
- Return type: numpy.array
- Returns: An array with the cell center coordinates (each element will be a point to the center of the cell).
GetCellDzAsArray(time_step='current')
Get an array containing the thickness (in Z) of each cell.
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the cell dz or an int identifying the time step index to be used based on the global time set
- Return type: numpy.array
- Returns: An array with cell thicknesses computed in the Z direction.
GetCellFromIJK(i, j, k, time_step='current')
Creates a grid cell handle from the current I, J, K indexes
- Parameters:
- i (int) – The topological I cell index
- j (int) – The topological J cell index
- k (int) – The topological K cell index
- time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the cell from the i, j, k or an int identifying the time step index to be used based on the global time set
- Return type: int or None
- Returns: Returns the cell handle to be used for the given I, J, K indexes. Or None if the given I, J and K indexes are invalid or refer to an inactive cell
- Raises: IndexError – An IndexError is raised if the cell is inactive or out of range.
GetCellIJK(cell_handle, time_step='current')
Converts the given cell handle to it’s I, J, K indexes
- Parameters:
- cell_handle (int) – The cell handle
- time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the i, j, k from the cell. or an int identifying the time step index to be used based on the global time set
- Return type: tuple( i, j, k )
- Returns: The cell I, J, K indexes
GetCellNumberOfVertices(cell, time_step='current')
Get an array containing the number of vertices of each cell.
- Parameters:
- cell_handle (int) – The cell handle
- time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the number of vertices for the given cell or an int identifying the time step index to be used based on the global time set
- Return type: int
- Returns: The total number of vertices on the given cell
GetCellPointsAsFunction(time_step='current')
Get a function for the points (vertices) of each cell.
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the cell points or an int identifying the time step index to be used based on the global time set
- Return type: PointsFunction
- Returns: A function that provides access to the points of a cell (i.e.: vertices).
NOTE
Each point from a cell must be accessed by a tuple(cell_handle, point_id). In a reservoir grid, the point id is a value from 0 to 7.
@usage:
#To get vertex 0 of a cell:
points_function = grid.GetCellPointsAsFunction()
cell = grid.GetCellFromIJK(0, 0, 0)
x, y, z = points_function[(cell, 0)]
#To iterate over all the vertices of a cell:
points_function = grid.GetCellPointsAsFunction()
cell = grid.GetCellFromIJK(0, 0, 0)
for vertex in grid.IterCellVertices(cell):
x, y, z = points_function[vertex]
GetCellVolumeAsArray(time_step='current')
Get an array with the volume of each cell.
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the cell volume or an int identifying the time step index to be used based on the global time set
- Return type: numpy.array
- Returns: An array with the cell volume (the unit will be the geometry unit ** 3)
GetCurve(curve_name, simulation_name=None, realization=None, time_step=None)
Override base class method to check for a request of a grid function statistic.
GetCurveNames(simulation_name=None)
@param simulation_name: unicode : An optional parameter for defining the simulation to get the curve from.
- Returns: list(str) The list of curve names
GetCurveNamesAssociation(simulation_name=None)
Get this element’s curve names.
- Parameters: simulation_name (unicode) – The name of the simulation to query the curve names If None is given the current element simulation will be used
- Return type: dict(unicode, ISemanticAssociation)
- Returns: The curve names for this element in the given simulation name
GetElementCurve(element_name, curve_name, simulation_name=None, realization=None, time_step=None)
Return the curves for the given element and name.
- Parameters:
- element_name (unicode) – The name of the element
- curve_name (unicode) – The name of the curve
- simulation_name (unicode) – An optional parameter for defining the simulation to get the curve from.
- realization (unicode) – An additional keyword to identify the curve realization
- time_step (TimeStep) – For transient curves a time-step must be given.
GetEnableFbmAngularLimits()
Get the value of “Enable Fbm Angular Limits”.
GetEnableFbmLinearLimits()
Get the value of “Enable Fbm Linear Limits”.
GetEnablePeriodicMotion()
Get the value of “Enable Periodic Motion”.
GetFbmMaxAngularLimits(unit: Optional[str] = None)
Get the value of “Fbm Max Angular Limits”.
- Parameters: unit – The unit for the returned values. If no unit is provided, the returned values will be in “dega”.
GetFbmMaxLinearLimits(unit: Optional[str] = None)
Get the value of “Fbm Max Linear Limits”.
- Parameters: unit – The unit for the returned values. If no unit is provided, the returned values will be in “m”.
GetFbmMinAngularLimits(unit: Optional[str] = None)
Get the value of “Fbm Min Angular Limits”.
- Parameters: unit – The unit for the returned values. If no unit is provided, the returned values will be in “dega”.
GetFbmMinLinearLimits(unit: Optional[str] = None)
Get the value of “Fbm Min Linear Limits”.
- Parameters: unit – The unit for the returned values. If no unit is provided, the returned values will be in “m”.
GetGeometryQuantity()
Get the quantity corresponding to the grid’s geometry.
- Return type: IQuantity
- Returns: The grid geometry quantity
GetGeometryUnit()
Get the grid’s geometry’s unit.
- Return type: unicode
- Returns: The unit for the grid geometry
GetGridFunction(grid_function_name, simulation_name=None, translated=False)
Gets a grid function given its name. It provides a representation that’s valid for all times, so, one can do: grid.GetGridFunction(‘Pressure’).GetMax()
To get the values of a given time, use:
time_set = grid.GetTimeSet()
grid.GetGridFunction('Temperature').GetArray(unit='degC', time_step=time_set[10])
NOTE
if it’s used without a time parameter, it’ll get the array at the current application time.
- Parameters:
- grid_function_name (unicode) – The name of the grid function to be gotten in this grid.
- simulation_name (unicode) – An optional parameter for defining the simulation to get the grid function from.
- translated (bool) – If False, the internal names of the grid functions will be returned, otherwise, the name returned will be the translated name (based on the settings chosen on how to see grid functions – i.e.: Cognitive, ECLIPSE, IMEX).
- Return type: KAGridFunction
- Returns: The grid function found
- Raises: ValueError – if the grid function is not found.
GetGridFunctionNames(translated=False, context=None)
Get a list of the available grid functions for this grid.
- Parameters:
- translated (bool) – If False, the internal names of the grid functions will be returned, otherwise, the name returned will be the translated name (based on the settings chosen on how to see grid functions – i.e.: Cognitive, ECLIPSE, IMEX).
- context ( 'all' , 'static' or 'transient') – Which names should be returned ‘all’ all grid function names ‘static’ only the static grid function names ‘transient’ only the transient grid function names
- Return type: list(unicode)
- Returns: Returns a list with the grid functions available.
GetKeepInPlace()
Get the value of “Keep In Place”.
GetMeshColoring(window: str | type['KAWorkspaceWindow'])
Get the RAMeshColoring related to the current object and a window.
- Parameters: window – The window that the coloring is acting. The window must be a str of the name of the window or a KAWorkspaceWindow.
- Raises: RockyApiError – If window is not a str or KAWorkspaceWindow. Additionally, raises an error if no window is found or no coloring for the given item exists.
GetMotionFrame(frame_name)
Get a specific motion frame given its name.
- Parameters: frame_name (unicode) –
- Return type: RAMotionFrame
GetMotions()
Get the list of motions in the motion frame.
- Returns: Returns a list with the motions configured.
GetNumberOfCells(time_step='current')
Get the total number of cells.
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the number of cells or an int identifying the time step index to be used based on the global time set
- Return type: int
- Returns: The total number of cells
GetNumberOfNodes(time_step='current')
Get the total number of nodes (vertices).
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the number of cells or an int identifying the time step index to be used based on the global time set
- Return type: int
- Returns: The total number of nodes/vertices
GetNumpyCurve(curve_name, unit=None, realization=None)
Returns a curve as a tuple of numpy arrays (time, property) for the given element and name.
GetOrientation(unit: str = 'dega')
Get the orientation angles. For more specific cases, see: “GetOrientationFromAngles”, “GetOrientationFromAngleAndVector” and “GetOrientationFromBasisVector”.
GetOrientationFromAngleAndVector(unit: str = 'dega')
Get the current orientation in the form of an angle and a vector.
GetOrientationFromAngles(unit: str = 'dega')
Get the current orientation in the form of angles.
GetOrientationFromBasisVector()
Get the current orientation in the form of three basis vectors.
GetOutputVariableValue(variable_name: str)
Get the value of a previously-created output variable.
- Parameters: variable_name (unicode) – The variable name whose value we want.
- Returns: Returns a scalar with the value and unit for the given variable_name or None if no variable was found with the given name or if it couldn’t be computed.
GetParentMotionFrame()
Gets the parent motion frame. If the Motion Frame is a RAMotionFrameSource it returns None.
- Return type: RAMotionFrame
GetPeriodicMotionPeriod(unit: Optional[str] = None)
Get the value of “Periodic Motion Period”.
- Parameters: unit – The unit for the returned value. If no unit is provided, the returned value will be in “s”.
GetPeriodicMotionStartTime(unit: Optional[str] = None)
Get the value of “Periodic Motion Start Time”.
- Parameters: unit – The unit for the returned value. If no unit is provided, the returned value will be in “s”.
GetPeriodicMotionStopTime(unit: Optional[str] = None)
Get the value of “Periodic Motion Stop Time”.
- Parameters: unit – The unit for the returned value. If no unit is provided, the returned value will be in “s”.
GetRelativePosition(unit: Optional[str] = None)
Get the value of “Relative Position”.
- Parameters: unit – The unit for the returned values. If no unit is provided, the returned values will be in “m”.
GetRelativeRotationVector(unit: str | None = None)
Deprecated: Use GetOrientationFromAngleAndVector() instead.
- Parameters: unit – The unit for the returned values. If no unit is provided, the returned values will be in “m”.
GetRotationAngle(unit: str | None = None)
Deprecated: Use GetOrientationFromAngleAndVector() instead.
- Parameters: unit – The unit for the returned value. If no unit is provided, the returned value will be in “dega”.
GetTimeSet()
Get the list of time-steps associated to the grid.
- Return type: ITimeSet
- Returns: The list of time-steps associated to the grid
GetTimeStatistics()
Get the object responsible for handling time-statistics grid functions for this process. This call will return None if the process doesn’t support time statistics.
GetTimeStep(time_step, accept_global=False)
Get the timestep corresponding to the given time.
- Parameters:
-
time_step (unicode , ITimeStep or int) –
Either a string with : ’current’ identifying the current time step ‘global’ identifying that the global limits should be gotten (note that if accept_global=False and ‘global’ is passed, an error is raised).
or an ITimeStep identifying the time to get the limits
or an int identifying the time step index to be used based on the global time set
-
accept_global (bool) – If True, a global time step is accepted (and returns None), otherwise, an error is raised if ‘global’ is passed.
-
- Return type: ITimeStep
- Returns: Returns the time step to be used or None if accept_global == True and the time step passed is ‘global’.
GetTopologyShape(time_step='current')
Get the shape of the topology (similar to the shape of numpy arrays).
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get the topology shape or an int identifying the time step index to be used based on the global time set
- Return type: tuple of ints
- Returns: The grid shape as a tuple of the grid size in each topological dimension.
HasGridFunction(grid_function_name)
Whether the grid has the given grid function.
- Parameters: grid_function_name (unicode) – The name of the grid function to be checked.
- Return type: bool
- Returns: Returns True if the grid function exists and False otherwise.
IsCellActive(i, j, k, time_step='current')
Checks if the given cell is active or not
@param i, j, k: int : The cell i, j, k
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to get if the cell is active or an int identifying the time step index to be used based on the global time set
- Return type: bool
- Returns: True if the cell is active
IterCellVertices(cell, time_step='current')
Iterate on the vertices of active grid cells at the given time.
- Parameters:
- cell_handle (int) – The cell handle
- time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to iterate the vertices of a cell or an int identifying the time step index to be used based on the global time set
- Return type: vertex_handle
- Returns: The iterator over all the cell’s vertices.
IterCells(time_step='current')
Iterate on the active grid cells at the given time.
- Parameters: time_step (unicode , ITimeStep or int) – Either a ‘current’ string with meaning the current time step or an ITimeStep identifying the time to iterate the cells or an int identifying the time step index to be used based on the global time set
- Return type: iterator
- Returns: The iterator over all the active grid cells for the given time.
IterMotionFrames()
Iterates over all the motion frames available (recursively).
- Return iter(RAMotionFrame):
Modified(*args, **kwargs)
Resets all the cache information after a change in the subject being tracked.
NewConeCrusherFrame()
Creates a new cone crusher frame.
- Return type: RAConeCrusherFrame
NewFrame()
Creates a new motion frame.
RemoveFrame(motion_frame)
Removes a previously-created motion frame.
- Parameters: motion_frame (RAMotionFrame or RAConeCrusherFrame) –
RemoveOutputVariable(variable_name: str)
Removes some output variable.
- Parameters: variable_name – The name of the variable to be removed.
RemoveProcess()
Removes the process from the project.
SetCurrentTimeStep(time_step)
Sets the current time step.
- Parameters: time_step (ITimeStep) – The time step to be considered the ‘current’ time step.
SetEnableFbmAngularLimits(value: bool)
Set the value of “Enable Fbm Angular Limits”.
- Parameters: value – The value to set.
SetEnableFbmLinearLimits(value: bool)
Set the value of “Enable Fbm Linear Limits”.
- Parameters: value – The value to set.
SetEnablePeriodicMotion(value: bool)
Set the value of “Enable Periodic Motion”.
- Parameters: value – The value to set.
SetFbmMaxAngularLimits(values: Sequence[Union[str, float]], unit: Optional[str] = None)
Set the values of “Fbm Max Angular Limits”.
- Parameters:
- values – The values to set. The values can be heterogeneous, the element of values can be an expression with input variables or a float. Must have exactly 3 elements.
- unit – The unit for values. If no unit is provided, values is assumed to be in “dega”.
- Raises: RockyApiError – If values doesn’t have exactly 3 elements.
SetFbmMaxLinearLimits(values: Sequence[Union[str, float]], unit: Optional[str] = None)
Set the values of “Fbm Max Linear Limits”.
- Parameters:
- values – The values to set. The values can be heterogeneous, the element of values can be an expression with input variables or a float. Must have exactly 3 elements.
- unit – The unit for values. If no unit is provided, values is assumed to be in “m”.
- Raises: RockyApiError – If values doesn’t have exactly 3 elements.
SetFbmMinAngularLimits(values: Sequence[Union[str, float]], unit: Optional[str] = None)
Set the values of “Fbm Min Angular Limits”.
- Parameters:
- values – The values to set. The values can be heterogeneous, the element of values can be an expression with input variables or a float. Must have exactly 3 elements.
- unit – The unit for values. If no unit is provided, values is assumed to be in “dega”.
- Raises: RockyApiError – If values doesn’t have exactly 3 elements.
SetFbmMinLinearLimits(values: Sequence[Union[str, float]], unit: Optional[str] = None)
Set the values of “Fbm Min Linear Limits”.
- Parameters:
- values – The values to set. The values can be heterogeneous, the element of values can be an expression with input variables or a float. Must have exactly 3 elements.
- unit – The unit for values. If no unit is provided, values is assumed to be in “m”.
- Raises: RockyApiError – If values doesn’t have exactly 3 elements.
SetKeepInPlace(value: Union[str, int])
Set the value of “Keep In Place”.
- Parameters: value – The value to set. This value can be an expression with input variables or int type.
SetOrientation(rotation: tuple[float, float, float], unit: str = 'dega')
The rotation is the angles in x, y and z of the rotation in the given unit. For more specific methods, see: “SetOrientationFromAngles”, “SetOrientationFromAngleAndVector” and “SetOrientationFromBasisVector”.
SetOrientationFromAngleAndVector(angle: float, vector: tuple[float, float, float], unit: str = 'dega')
The rotation uses the angle and a vector, using unit and changes the orientation mode to Angle and Vector.
SetOrientationFromAngles(rotation: tuple[float, float, float], unit: str = 'dega', local_angles: bool = True, order: str = 'XYZ')
The rotation is the angles in x, y and z of the rotation. The default unit is dega. Additionally, local_angles can be used as well an order of the values via kwargs.
SetOrientationFromBasisVector(vector_x: tuple[float, float, float], vector_y: tuple[float, float, float], vector_z: tuple[float, float, float])
Sets the rotation using three basis vector and changes the orientation mode to Basis Vector.
SetPeriodicMotionPeriod(value: Union[str, float], unit: Optional[str] = None)
Set the value of “Periodic Motion Period”.
- Parameters:
- value – The value to set. This value can be an expression with input variables or float type.
- unit – The unit for value. If no unit is provided, value is assumed to be in “s”.
SetPeriodicMotionStartTime(value: Union[str, float], unit: Optional[str] = None)
Set the value of “Periodic Motion Start Time”.
- Parameters:
- value – The value to set. This value can be an expression with input variables or float type.
- unit – The unit for value. If no unit is provided, value is assumed to be in “s”.
SetPeriodicMotionStopTime(value: Union[str, float], unit: Optional[str] = None)
Set the value of “Periodic Motion Stop Time”.
- Parameters:
- value – The value to set. This value can be an expression with input variables or float type.
- unit – The unit for value. If no unit is provided, value is assumed to be in “s”.
SetRelativePosition(values: Sequence[Union[str, float]], unit: Optional[str] = None)
Set the values of “Relative Position”.
- Parameters:
- values – The values to set. The values can be heterogeneous, the element of values can be an expression with input variables or a float. Must have exactly 3 elements.
- unit – The unit for values. If no unit is provided, values is assumed to be in “m”.
- Raises: RockyApiError – If values doesn’t have exactly 3 elements.
SetRelativeRotationVector(values: Sequence[str | float], unit: str | None = None)
Deprecated: Use SetOrientationFromAngleAndVector() instead.
SetRotationAngle(value: str | float, unit: str | None = None)
Deprecated: Use SetOrientationFromAngleAndVector() instead.