rose.model package

Submodules

rose.model.accumulation_model module

class rose.model.accumulation_model.AccumulationModel(accumulation_model: Varandas | LiSelig, steps: int = 1)

Bases: object

Accumulation model

Computation of the cumulative settlement. Currently the following models are supported: - Varandas [8] - Li & Selig [3]

Initialisation of the accumulation model

Parameters:
  • accumulation_model – Accumulation model

  • steps – step interval to save results

calculate_settlement(idx: list = None, reload: bool = False)

Computes the cumulative settlement

Parameters:
  • idx – (optional, default None) node to compute the calculations.

  • reload – (optional, default False) reload last stage

read_traffic(trains: dict, end_time: int, start_time: int = 0)

Reads the train traffic information

Parameters:
  • trains – Dictionary with train information

  • end_time – Time in days of the analysis

  • start_time – (optional, default 0) start time of analysis in days

write_results(file_name: str)

Writes results to binary pickle file

Parameters:

file_name – filename of the results

class rose.model.accumulation_model.LiSelig(soil_sos: List[dict], soil_idx: List[int], width_stress: float, lenght_stress: float, t_ini: int = 0, last_layer_depth: int = -20)

Bases: AccumulationModel

Accumulation model for soil layer. Based on Li and Selig [3]. Implementation based on Punetha et al. [6]. The model has been improved with [1].

Parameters:
  • soil_sos – SoS dictionary

  • soil_idx – ID of each node for soil SoS

  • width_stress – width of the stress distribution

  • lenght_stress – length of the stress distribution

  • t_ini – (optional, default 0) initial time from construction in years

  • last_layer_depth – (optional, default -20) last layer depth

settlement(train: ReadTrainInfo, nb_nodes: int, idx: list = None, reload=False)

Calculate the settlement

Parameters:
  • train – train information object

  • nb_nodes – number of nodes

  • idx – (optional, default None) node to compute the calculations. if None computes the calculations for all nodes

  • reload – (optional, default False) reload last stage

class rose.model.accumulation_model.ReadTrainInfo(trains: dict, start_time: int, end_time: int, steps: int = 1)

Bases: object

Read train info and parse it to data structure

Initialise the train information

Parameters:
  • trains – trains dictionary containing traffic information

  • start_time – start time of analysis in days

  • end_time – time of analysis in days

  • steps – step interval to save results

class rose.model.accumulation_model.Varandas(alpha: float = 0.6, beta: float = 0.82, gamma: float = 10, N0: float = 1000000.0, F0: float = 50)

Bases: AccumulationModel

Initialisation of the accumulation model of Varandas [8].

Parameters

param alpha:

(optional, default 0.6) dependency of settlement with loading amplitude

param beta:

(optional, default 0.82) controls progression of settlement with number of load cycles

param gamma:

(optional, default 10) accumulated settlement in reference test (with F0, N0)

param N0:

(optional, default 1e6) reference number of cycles

param F0:

(optional, default 50) reference load amplitude

settlement(train: ReadTrainInfo, nb_nodes: int, idx: list = None, reload=False)

Computes cumulative settlement following the methodology proposed by Varandas [8].

The settlement \(S\) of sleeper \(N\) follows:

\[S_{N} = \sum_{n=1}^{N} u_{p, n}\]

where \(u_{p, n}\) is:

\[u_{p, n} = \frac{\gamma}{M_{\alpha \beta}} \int_{0}^{\bar{F_{n}}} F^{\alpha} \left( \frac{1}{h(F) + 1} \right)^{\beta} dF\]

and \(M_{\alpha\beta}\):

\[M_{\alpha\beta} = \frac{F_{0}^{\alpha + 1}}{\alpha + 1} \sum_{n=1}^{N_{0}} \left(\frac{1}{n}\right)^{\beta}\]

\(h(F)\) corresponds to the load histogram.

Parameters

param train:

train information object

param nb_nodes:

number of nodes

param idx:

(optional, default None) node to compute the calculations. if None computes the calculations for all nodes

rose.model.boundary_conditions module

class rose.model.boundary_conditions.LineLoadCondition(x_disp_dof=False, y_disp_dof=False, z_rot_dof=False)

Bases: LoadCondition

Class which contains a line load boundary condition. This class bases from LoadCondition.

Attributes:
  • self.active_elements:

    Numpy array which contains non-zero values if line load condition is active at a certain node at a certain time [number of nodes, number of time steps]

  • self.contact_model_part:

    Element model part which is in contact with the line load condition at current time step

  • self.contact_model_parts:

    list of all Element model part which are in contact with the line load condition

  • self.node_indices:

    node indices of contact element at every time step

Parameters:
  • x_disp_dof – true if x displacement degree of freedom is active

  • y_disp_dof – true if y displacement degree of freedom is active

  • z_rot_dof – true if z rotation degree of freedom is active

validate()

Validates if each element in the line load condition contains 2 nodes. :return:

class rose.model.boundary_conditions.LoadCondition(x_disp_dof: bool = False, y_disp_dof: bool = False, z_rot_dof: bool = False)

Bases: ConditionModelPart

Class which contains a load boundary condition. This class bases from ConditionModelPart.

Attributes:
  • self.x_force:

    Force in x direction

  • self.y_force:

    Force in y direction

  • self.z_moment:

    Moment around z-axis

  • self.x_force_vector:

    nd-array of force in x direction at a time step

  • self.y_force_vector:

    nd-array of force in y direction at a time step

  • self.z_moment_vector:

    nd-array of moment around z-axis at a time step

  • self.x_force_matrix:

    Sparse matrix of force in x direction per time step

  • self.y_force_matrix:

    Sparse matrix of force in y direction per time step

  • self.z_moment_matrix:

    Sparse matrix of moment around z-axis per time step

  • self.time:

    array of each time step

  • self.initialisation_time:

    array of each time step where the force is gradually increase from 0 to the final value

Parameters:
  • x_disp_dof – true if x displacement degree of freedom is active

  • y_disp_dof – true if y displacement degree of freedom is active

  • z_rot_dof – true if z rotation degree of freedom is active

initialize()

Inititalises model parts. Calculates total number of degree of freedom and maps model part on each element

Returns:

initialize_matrices()

Initialises force matrices as sparse lil matrices with dimension [number of nodes, number of time steps], also initialises forces vectors as nd arrays with size [number of nodes]

Returns:

set_load_vector_as_function_of_time(load: float, build_up_idxs: int) ndarray

Creates a load as a function of time. During the first time steps with a length of the build_up_idxs the load is linearly increased from 0.

Parameters:
  • load – load value

  • build_up_idxs – number of indices where load is gradually increased from zero

Returns:

update_force(t)

Retrieves the force vectors from the force matrices at time t :param t: time index :return:

property x_disp_dof

True if x displacement degree of freedom is active :return:

property y_disp_dof

True if y displacement degree of freedom is active :return:

property z_rot_dof

True if z rotation degree of freedom is active :return:

class rose.model.boundary_conditions.MovingPointLoad(x_disp_dof=False, y_disp_dof=False, z_rot_dof=False, start_distance=None)

Bases: LineLoadCondition

Class which contains a moving point load boundary condition. This class bases from LineLoadCondition.

Attributes:
  • self.velocities:

    Numpy array of velocity per time step

  • self.time:

    Numpy array of each time step

  • self.start_distance:

    Initial distance of the moving point load relative to the first node in the condition

  • self.start_element_idx:

    Index of first element which is in contact with the moving load

  • self.cum_distances_force:

    Numpy array of cumulative distance of moving point load

  • self.cum_distances_nodes:

    Numpy array of cumulative distance of the nodes in current condition

  • self.local_distances:

    Numpy array of distances between first node in contact element and moving load at each time step

  • self.moving_coords:

    Numpy array of the coordinates at each time step of the moving load

  • self.moving_x_force:

    Numpy array of the force in x direction at each time step

  • self.moving_y_force:

    Numpy array of the force in y direction at each time step

  • self.moving_z_moment:

    Numpy array of the moment around the z-axis at each time step

  • self.model_part_at_t:

    Numpy array with of the contact model part at each time step

  • self.__normal_force_vector:

    Numpy array of the normal force vector at the nodes

  • self.__shear_force_vector:

    Numpy array of the shear force vector at the nodes

  • self.__z_moment_vector:

    Numpy array of the moment around z-axis vector at the nodes

Parameters:
  • x_disp_dof – true if x displacement degree of freedom is active

  • y_disp_dof – true if y displacement degree of freedom is active

  • z_rot_dof – true if z rotation degree of freedom is active

  • start_distance – initial distance of the moving point load relative to the first node in the condition

calculate_cumulative_distance_contact_nodes()

Calculate the cumulative distance of the contact nodes.

Returns:

calculate_cumulative_distance_moving_load()

Calculate the cumulative distance of the moving load :return:

calculate_moving_coords()

Calculates the coordinates of the moving load at each time step.

Returns:

filter_load_outside_range()

Filter normal load, vertical load an z rotation moment outside the geometry :return:

get_first_element_idx()

Gets first contact element index. This function assumes a sorted list of elements :return:

initialize()

Initialises moving point load :return:

initialize_matrices()

Initialises force vectors as sparse as numpy arrays with dimension [number of time steps]

Returns:

property moving_force_vector

Numpy array of moving x force, moving y force and moving z moment :return:

set_active_elements()

Gets element indices where point load is located for each time step.

Returns:

set_contact_model_part_as_function_of_time()

Sets the contact model part as a function of time. It is assumed that the contact model parts are spatially ordered. :return:

set_load_vectors_as_function_of_time()

Sets load vectors as a function of time. During initialisation time, the force is increased from 0 to the final value. The remaining time, the load vectors remain at a constant value. :return:

set_moving_point_load()

Sets a moving point load on the condition elements. :return:

update_force(t)

Calculates the force vectors of the moving load at time t :param t: time index :return:

rose.model.exceptions module

This module contains a set of Exception classes, which give the user more clarity, on what went wrong during calculation

exception rose.model.exceptions.ParameterNotDefinedException

Bases: Exception

Exception which indicates that a parameter is not defined. This class bases from Exception

exception rose.model.exceptions.SizeException

Bases: Exception

Exception which indicates that an element has an incorrect size

exception rose.model.exceptions.TimeException

Bases: Exception

Exception which indicates that there is a problem in the time discretisation. This class bases from Exception

rose.model.geometry module

class rose.model.geometry.Element(nodes)

Bases: object

Class which contains an Element.

Attributes:
  • self.index:

    index of the element within the mesh

  • self.nodes:

    All the nodes which belong to the element

  • self.self.model_parts:

    List of model parts which are connected to current element

  • self.force:

    Numpy array of force in the element over time for each degree of freedom

Parameters:

nodes – All the nodes which belong to the element

add_model_part(model_part)

Adds a model part to the current element, also adds the model part to the connected nodes.

Parameters:

model_part – model part

Returns:

assign_force(force, mask)

Assigns force results to the current element :param force: Force results in the element on all the active degrees of freedom :param mask: mask of the active degrees of freedom :return:

class rose.model.geometry.Mesh

Bases: object

Class which contains a Mesh.

Attributes:
  • self.nodes:

    All the nodes which belong to the mesh

  • self.elements:

    All the elements which belong to the mesh

add_unique_elements_to_mesh(elements)

Checks if element is unique and adds the element to the mesh if the element is unique.

Parameters:

elements – Elements to be added to the mesh, if unique.

Returns:

add_unique_nodes_to_mesh(nodes)

Checks if node is unique and adds the node to the mesh if the node is unique.

Parameters:

nodes – Nodes to be added to the mesh, if unique.

Returns:

fast_add_elements_to_mesh(elements)

Adds elements to the mesh without checking for uniqueness. Use with caution. This should only be used if it is guaranteed that the elements are unique.

Parameters:

elements – Elements to be added to the mesh.

fast_add_nodes_to_mesh(nodes)

Adds nodes to the mesh without checking for uniqueness. Use with caution. This should only be used if it is guaranteed that the nodes are unique.

Parameters:

nodes – Nodes to be added to the mesh.

reorder_element_ids()

Reorders the indexes of all the elements in the mesh. The index order is equal to the order of the elements in the self.elements array.

Returns:

reorder_node_ids()

Reorders the indexes of all the nodes in the mesh. The index order is equal to the order of the nodes in the self.nodes array.

Returns:

class rose.model.geometry.Node(x: float, y: float, z: float)

Bases: object

Class which contains a Node.

Attributes:
  • self.index:

    index of the node within the mesh

  • self.index_dof:

    numpy array of the degrees of freedom indices within the global system

  • self.coordinates:

    numpy array of the x,y and z coordinate of the node

  • self.x_disp_dof:

    Boolean which is true if displacement of node in x direction is permitted

  • self.y_disp_dof:

    Boolean which is true if displacement of node in y direction is permitted

  • self.z_rot_dof:

    Boolean which is true if rotation of node around z-axis is permitted

  • self.displacements:

    Numpy array of displacements of node over time for each degree of freedom

  • self.velocities:

    Numpy array of velocities of node over time for each degree of freedom

  • self.accelerations:

    Numpy array of accelerations of node over time for each degree of freedom

  • self.force:

    Numpy array of force in node over time for each degree of freedom

  • self.self.model_parts:

    List of model parts which are connected to current node

assign_result(displacements: ndarray, velocities: ndarray, accelerations: ndarray, force: ndarray = None)

Assigns results to the node

Parameters:
  • displacements – numpy array of displacements over time

  • velocities – numpy array of velocities over time

  • accelerations – numpy array of accelerations over time

  • force – numpy array of forces over time

Returns:

property ndof

Number of active degrees of freedom at node.

Returns:

set_dof(dof_idx, is_active)

Sets a degree of freedom of the node on active or inactive

Parameters:
  • dof_idx – index of the degree of freedom, 0 => x disp; 1 => y disp; 2 => z rot

  • is_active – Boolean which is true if nodal degree of freedom should be active

Returns:

rose.model.global_system module

class rose.model.global_system.GlobalSystem

Bases: object

Class which the global system, with this system the following formula van be calculated: K·u + C·v + M·a = F.

The class includes the mesh, the global matrices and vectors, the solver, the time discretisation, the model parts and the calculated displacements, velocities and accelerations of the system

Attributes:
  • self.mesh:

    The mesh within the system

  • self.global_mass_matrix:

    The global mass matrix M of the system

  • self.global_stiffness_matrix:

    The global stiffness matrix K of the system

  • self.global_damping_matrix:

    The global damping matrix C of the system

  • self.global_force_vector:

    The global force vector F of the system

  • self.solver:

    The solver which is used to solve the system

  • self.model_parts:

    List of model parts which are present within the model

  • self.total_n_dof:

    Total number of degrees of freedom in the while system

  • self.time:

    The time discretisation

  • self.initialisation_time:

    The time discretisation, in which the external force is gradually applied

  • self.stage_time_ids:

    The time indices in which the time step size changes

  • self.time_out:

    The time discretisation which is used for the output

  • self.displacements_out:

    The output displacement results for each node in the system

  • self.velocities_out:

    The output velocity results for each node in the system

  • self.accelerations_out:

    The output acceleration results for each node in the system

  • self.g:

    Gravity constant

  • self.is_rayleigh_damping:

    Boolean which is true if rayleigh damping is taken into account

  • self.damping_ratio:

    Rayleigh damping ratio

  • self.radial_frequency_one:

    First rayleigh radial frequency

  • self.radial_frequency_two:

    Second rayleigh radial frequency

add_model_parts_to_global_matrices()

Adds data from model parts to the global matrices

Returns:

assign_results_to_nodes()

Assigns all solver results to all nodes in the mesh

Returns:

calculate_force_in_elements()

Calculates force in each element. The force is calculate by multiplying the local stiffness matrix of the element with the displacements in the nodes of the element. The result on the nodes is then averaged to calculate the force in the element.

Returns:

calculate_initial_displacement()

Calculates initial displacement of the system :return:

calculate_rayleigh_damping()

Calculates the rayleigh damping matrix and adds it to the global damping matrix. Rayleigh damping is calculated with the following formula:

\[ \begin{align}\begin{aligned}C = a0 \cdot M + a1 \cdot K \\a0 = \omega 1 * \omega 2 * a1 \\a1 = 2 * \xi / (\omega 1 * \omega 2) \end{aligned}\end{align} \]

Where C is the rayleigh damping matrix

M is the global mass matrix

K is the global stiffness matrix

\({\omega}1\) and \({\omega}2\) are the first and second radial frequency

\({\xi}\) is the rayleigh damping factor

Returns:

calculate_stage(start_time_id, end_time_id)

Calculates a stage of the global system

Parameters:
  • start_time_id – first time index of the stage

  • end_time_id – final time index of the stage

Returns:

finalise()

Finalises calculation. Forces in the elements are calculated, furthermore, output displacements, velocities and accelerations are assigned. :return:

initialise()

Initialises model parts, degrees of freedom, global matrices, stages and solver.

Returns:

initialise_global_matrices()

Inititialises all the global matrices and global force vector as empty sparse matrices

Returns:

initialise_model_parts()

Initialises all model parts :return:

initialise_ndof()

Initialise total number of degrees of freedom in the global system and sets nodal dof index in the global matrices.

Returns:

main()

Main function of the class. Input is validated, then the system is initialised. Each stage is calculated and the system is finalised.

Returns:

static print_end_message()

Prints message which is to be shown at the end of the calculation

Returns:

static print_initial_message()

Prints message which is to be shown at the start of the calculation

Returns:

recalculate_dof(removed_indices: array)

Recalculates the total number of degree of freedoms and the index of the nodal dof in the global matrices

Parameters:

removed_indices – indices which are removed from the global system

Returns:

set_stage_time_ids()

Find indices of unique time step sizes, this indices represent the division between different stages.

Returns:

trim_all_global_matrices()

Checks which degrees of freedom are obsolete and removes from global matrices

Returns:

trim_global_matrices_on_indices(row_indices: List, col_indices: List)

Removes items in global stiffness, mass, damping and force vector on row and column indices

Parameters:
  • row_indices – row indices which are to be removed

  • col_indices – column indices which are to be removed

Returns:

update(start_time_id, end_time_id)

Updates model parts and solver

Parameters:
  • start_time_id – first time index of the stage

  • end_time_id – final time index of the stage

Returns:

update_model_parts()

Updates all model parts :return:

update_time_step_rhs(t, **kwargs)

Updates the rhs at time step t

Parameters:
  • t – time index

  • kwargs – key word arguments, this is required, as this whole function is added to the solver

Returns:

validate_input()

Validates input and adds errors to the logger :return:

rose.model.irregularities module

class rose.model.irregularities.RailDefect(x_track: ndarray, wheel_diameter: float, local_defect_geometry_coordinates: Sequence[Sequence[float]], start_position: float)

Bases: object

Class containing a rail defect following the trajectory of the centre of the wheel rolling over the rail defect.

Attributes:
  • self.irregularities:

    np array of the irregularities at each position

Creates an array with a rail defect. The irregularity is following the trajectory of the centre of the wheel rolling over the rail defect defined by local_defect_geometry_coordinates. Based on the wheel trajectory description for wheel flats from [4] adopted for the rail defect.

Parameters:
  • x_track – global x coordinates of the track where the irregularity should be calculated [m]

  • wheel_diameter – diameter of the wheel [m]

  • local_defect_geometry_coordinates – the local geometry coordinates of the defect, where the first column is the local position [m] and the second column is the defect height [m]

  • start_position – global starting position of the defect [m]

class rose.model.irregularities.RailIrregularities(x: ndarray, f_min: float = 2, f_max: float = 500, N: int = 2000, Av: float = 2.095e-05, omega_c: float = 0.8242, seed=99)

Bases: object

Class containing rail unevenness following [9].

Attributes:
  • self.Av:

    Vertical track irregularity parameter

  • self.omega_c:

    critical wave angular frequency

  • self.omega:

    wave angular frequency

  • self.irregularities:

    np array of the irregularities at each position

Creates rail unevenness following [9].

A summary of default values can be found in [5].

Parameters

param x:

position of the node

param f_min:

(default 2 Hz) minimum frequency for the PSD of the unevenness

param f_max:

(default 500 Hz) maximum frequency for the PSD of the unevenness

param N:

(default 2000) number of frequency increments

param Av:

(default 0.00002095 m2 rad/m) vertical track irregularity parameters

param omega_c:

(default 0.8242 rad/m) critical wave number

param seed:

(default 99) seed for random generator

spectral(omega)

Computes spectral unevenness

Parameters:

omega – angular frequency rad/s

Returns:

class rose.model.irregularities.WheelFlat(x: ndarray, wheel_diameter: float, flatness_length: float, start_position=None, seed=14)

Bases: object

Class containing a wheel flat.

Attributes:
  • self.irregularities:

    np array of the irregularities at each position

Creates an array with a wheel flat. where every circumference of the wheel, the wheel is indented. Adapted from [7].

Parameters:
  • x – position of the node [m]

  • wheel_diameter – diameter of the wheel [m]

  • flatness_length – total flat length of the wheel [m]

  • start_position – optional starting position of where a wheel flat is known

  • seed – (default 14) seed for random generator

rose.model.model_part module

class rose.model.model_part.ConditionModelPart

Bases: ModelPart

Condition model part class. This class is the base for each boundary condition model part type. This class bases from ModelPart.

class rose.model.model_part.ConstraintModelPart(x_disp_dof=False, y_disp_dof=False, z_rot_dof=False)

Bases: ConditionModelPart

Constraint model part class. This class is a model part which indicates rotational or translational constraints. This class bases from ConditionModelPart.

set_constraint_condition()

Sets the constraint boundary condition on the nodes. :return:

property x_disp_dof
Returns:

is degree of freedom in x direction activated

property y_disp_dof
Returns:

is degree of freedom in y direction activated

property z_rot_dof
Returns:

is degree of freedom around z axis activated

class rose.model.model_part.ElementModelPart

Bases: ModelPart

Element model part class. This class is the base for each element model part type. The model part has to consist of the same element types. This class bases from ModelPart. #todo extend for 2d/3d elements.

Attributes:
  • self.aux_stiffness_matrix:

    auxiliary local stiffness matrix

  • self.aux_damping_matrix:

    auxiliary local damping matrix

  • self.aux_mass_matrix:

    auxiliary local mass matrix

  • self.static_force_vector:

    local static force vector within the element

abstract calculate_strain(x, u)

Calculates strain in the element. This function is meant as an abstract method :return:

initialize()

Initialises model part. Local stiffness, mass and damping matrices are initialised. :return:

property normal_shape_functions

Shape functions for the local normal axis :return:

property rotation_matrix

Rotation matrix which is used to rotate from the local to the global system.

Returns:

abstract set_aux_damping_matrix()

Sets the local auxiliary damping matrix. This function is meant as an abstract method :return:

abstract set_aux_mass_matrix()

Sets the local auxiliary mass matrix. This function is meant as an abstract method :return:

abstract set_aux_stiffness_matrix()

Sets the local auxiliary stiffness matrix. This function is meant as an abstract method :return:

set_normal_shape_functions(x)

Sets the local normal shape functions at distance x. This function is meant as an abstract method

Parameters:

x – local distance from the first node to the desired locatin within the element

Returns:

set_rotation_matrix(rotation, dim)

Sets the rotation matrix. This function is meant as an abstract method

Parameters:
  • rotation – rotation of the element

  • dim – dimensions of the element

Returns:

set_y_shape_functions(x)

Sets the local shear shape functions at distance x. This function is meant as an abstract method

Parameters:

x – local distance from the first node to the desired locatin within the element

Returns:

set_z_rot_shape_functions(x)

Sets the rotation around the z-axis shape functions at distance x. This function is meant as an abstract method

Parameters:

x – local distance from the first node to the desired location within the element

Returns:

property y_shape_functions

Shape functions for the local shear axis :return:

property z_rot_shape_functions

Shape functions for the local rotation around the z-axis :return:

class rose.model.model_part.Material

Bases: object

This class contains the material of the rail.

Attributes:
  • self.youngs_modulus:

    youngs modulus of the material [N/m2]

  • self.poisson_ratio:

    poisson ratio of the material [-]

  • self.density:

    density of the material [kg/m3]

property shear_modulus

Shear modulus of the material [N/m2]

\[G = E/(2 \cdot (1+\nu))\]
validate_input()

Validates material input. Checks if youngs modulus, poisson ratio and density are defined. :return:

class rose.model.model_part.ModelPart

Bases: object

Base model part class. This class is the base for boundary conditions and element model parts. The model part has to consist of the same element types.

Attributes:
  • self.name:

    name of the model part [-]

  • self.nodes:

    all nodes within the model part [-]

  • self.elements:

    all elements within the model part [-]

  • self.total_n_dof:

    total number of degree of freedoms within the model part [-]

calculate_total_n_dof()

Calculates total number of degree of freedom. Number of nodes times number of degree of freedom per node. :return:

initialize()

Inititalises model parts. Calculates total number of degree of freedom and maps model part on each element

Returns:

set_aux_force_vector()
set_geometry()
update()
update_dof_indices()

Updates the array of active degrees of freedom indices within the global system. It is checked if the displacement in the x and y direction and rotation around z-axis are active and not None. :return:

validate_input()

Validates model part input. Checks if nodes and elements are defined in a list or np array :return:

property x_disp_dof
Returns:

is normal degree of freedom activated

property x_rot_dof
Returns:

is rotation around local x axis activated

property y_disp_dof
Returns:

is y degree of freedom activated

property y_rot_dof
Returns:

is rotation around local y axis activated

property z_disp_dof
Returns:

is z degree of freedom activated

property z_rot_dof
Returns:

is rotation around local z axis activated

class rose.model.model_part.RodElementModelPart

Bases: ElementModelPart

Rod element model part class. This class bases from ElementModelPart. A rod element only interacts in normal direction.

Attributes:
  • self.mass:

    mass of the rod element

  • self.stiffness:

    stiffness of the rod element

  • :self.damping : of the rod element

  • self.length_element:

    length of the rod element

initialize_shape_functions()

Initialises normal shape functions for the rod element. :return:

property rotation_matrix

Rotation matrix which is used to rotate from the local to the global system.

Returns:

set_aux_damping_matrix()

Sets the local auxiliary damping matrix for the rod element. Only if the rod contains a damping value. :return:

set_aux_mass_matrix()

Sets the local auxiliary mass matrix for the rod element. Only if the rod contains a mass value :return:

set_aux_stiffness_matrix()

Sets the local auxiliary stiffness matrix for the rod element. Only if the rod contains a stiffness value. :return:

set_normal_shape_functions(x)

Sets the local normal shape functions for the rod element at distance x.

Parameters:

x – local distance from the first node to the desired location within the element

Returns:

set_rotation_matrix(rotation, dim)

Sets 2D rotation matrix

Parameters:
  • rotation – rotation in the global system

  • dim – dimension of the work space

Returns:

validate_input()

Validates input. Checks if rod model part contains a stiffness, elements and nodes :return:

property x_disp_dof
Returns:

is normal degree of freedom activated

class rose.model.model_part.Section

Bases: object

This class contains the cross section of the rail.

Attributes:
  • self.area:

    section area [m^2]

  • self.sec_moment_of_inertia:

    second moment of inertia [m^4]

  • self.shear_factor:

    shear factor (kr=0 - Euler-Bernoulli beam, kr>0 - Timoshenko beam)

validate_input()
class rose.model.model_part.TimoshenkoBeamElementModelPart

Bases: ElementModelPart

Timoshenko beam element model part class. This class bases from ElementModelPart. This class can be used as an euler beam, if a timoshenko factor of 0 is used.

Attributes:
  • self.material:

    material of the timoshenko beam

  • self.section:

    cross section of the timoshenko beam

  • self.length_element:

    length of the timoshenko beam element

  • self.nodal_ndof:

    number of nodal degrees of freedom in the timoshenko beam (3 in a 2D space)

  • self.mass:

    mass of the timoshenko beam element

calculate_local_forces_at_x(x, u)

Calculates local internal forces at local x coordinate :param x: local x coordinate on beam :param u: displacement vector with 6 DOFS in local coordinate system :return:

calculate_mass()

Calculates the mass per meter of the Timoshenko beam from the cross section and the material density.

Returns:

calculate_strain(x, u)

Calculates strain on any point in beam

Parameters:
  • x – local coordinate on beam

  • u – displacement vector with 6 DOFS in local coordinate system

Returns:

calculate_timoshenko_factor()

Calculates the ratio of the beam bending to shear stiffness.

Returns:

initialize()

Initialises timoshenko beam model part. Calculates the timoshenko factor; calculates the mass of the beam; initialises shape functions; initialises parent class. :return:

initialize_shape_functions()

Initialises timoshenko beam shape functions as numpy arrays. :return:

property rotation_matrix

Rotation matrix which is used to rotate from the local to the global system.

Returns:

set_aux_damping_matrix()

Timoshenko straight beam auxiliary damping matrix :return:

set_aux_mass_matrix()

Timoshenko straight beam auxiliar mass matrix. If timoshenko factor is equal to 0, no rotational part of the mass matrix is added. This is equivalent to an euler beam. :return:

set_aux_stiffness_matrix()

Timoshenko straight beam auxiliary stiffness matrix :return:

set_normal_shape_functions(x)

Sets the local normal shape functions for the timoshenko beam element at distance x.

Parameters:

x – local distance from the first node to the desired location within the element

Returns:

set_rotation_matrix(rotation, dim)

Sets 2D rotation matrix of the timoshenko beam :param rotation: rotation in the global system :param dim: dimension of the workspace :return:

set_y_shape_functions(x)

|Sets y shape functions of the Timoshenko beam element

Based on [2] (Chapter 3)

Parameters:

x – local coordinate of the element [m]

Returns:

set_z_rot_shape_functions(x)

Sets the rotation around the z-axis shape functions at distance x. This function is meant as an abstract method

Parameters:

x – local distance from the first node to the desired location within the element

Returns:

property timoshenko_factor

Ratio of beam bending to shear stiffness.

Returns:

validate_input()

Validates Timoshenko beam model part. Validates material, validates cross section. Checks if model part contains nodes and elements. :return:

property x_disp_dof
Returns:

is normal degree of freedom activated

property y_disp_dof
Returns:

is y degree of freedom activated

property z_rot_dof
Returns:

is rotation around z-axis degree of freedom activated

rose.model.soil module

This module contains all soil element model parts

class rose.model.soil.Soil

Bases: RodElementModelPart

Soil element model part class. This class bases from RodElementModelPart. A soil element only interacts in normal direction.

Attributes:

Initialises Soil model part and its base

rose.model.track module

This module contains all model parts which are part of the track. I.e. the rail, sleeper and rail pads

class rose.model.track.Hinge

Bases: ElementModelPart

Hinge element model part class. This model part can only be used together with a beam model part. This class bases from ElementModelPart. This model part is a point which contains a mass and fixity factor which indicates the degree of fixation on the connected beam element.

Attributes:
  • self.mass:

    mass of the hinge

  • self.fixity_factor:

    Factor which indicates the degree of fixation of the hinge, ranging from 0-1 (free-fixed) [-]

  • self.connected_beam:

    Beam model part which is connected to the hinge

calculate_hinge_stiffness()

Calculates rotational stiffness [Nm] based on fixity factor of hinge, Youngs modulus, second moment of area and length of the connected beam element.

Returns:

set_aux_damping_matrix()

Sets auxiliary damping matrix of sleeper as zero

Returns:

set_aux_mass_matrix()

Sets auxiliary mass matrix of sleeper as sleeper mass

Returns:

set_aux_stiffness_matrix()

Sets auxiliary stiffness matrix of hinge as zero

Returns:

property y_disp_dof

Displacement in y direction degree of freedom is set on true for the hinge model part

Returns:

exception rose.model.track.InvalidRailException(message)

Bases: Exception

Invalid Rail Exception class. This class bases from Exception. This Exception class indicates that the rail is invalid

Attributes:

Initialises InvalidRailException and logs an error message :param message: message to be logged

class rose.model.track.Rail

Bases: TimoshenkoBeamElementModelPart

Rail element model part class. This class bases from TimoshenkoBeamElementModelPart.

Attributes:

Initialises the rail model part and its base

calculate_length_rail()

Calculates the length of the rail elements. It is required that all element within the model part have an equal size. :return:

initialize()

Initialises rail model part. Input is validated and the length of the rail is calculated :return:

class rose.model.track.RailPad

Bases: RodElementModelPart

Rail pad element model part class. This class bases from RodElementModelPart.

Attributes:

Initialises rail pad model part and its base

class rose.model.track.Sleeper

Bases: ElementModelPart

Sleeper element model part class. This class bases from ElementModelPart. This model part is a point which contains a mass.

Attributes:
  • self.mass:

    mass of the sleeper

set_aux_damping_matrix()

Sets auxiliary damping matrix of sleeper as zero

Returns:

set_aux_mass_matrix()

Sets auxiliary mass matrix of sleeper as sleeper mass

Returns:

set_aux_stiffness_matrix()

Sets auxiliary stiffness matrix of sleeper as zero

Returns:

property y_disp_dof

Displacement in y direction degree of freedom is set on true for the sleeper model part

Returns:

rose.model.train_model module

class rose.model.train_model.Bogie

Bases: ElementModelPart

Bogie model part class. This class bases from ElementModelPart. A bogie is a mass which can translate and rotate. The bogie is connected to a number of wheels which are located at a certain distance from the middle of the bogie.

Attributes:
  • self.wheels:

    all wheels which are connected to the bogie

  • self.wheel_distances:

    List of distance of each connected wheel to the centre of the bogie, including sign

  • :self.distribution_factor List of factors which indicate how big of a part of stiffness and damping between

    wheels and bogie is taken into account. This is important in case of shared bogies default is 1

  • self.mass:

    Mass of the bogie

  • self.inertia:

    Moment of inertia of the bogie

  • self.stiffness:

    Stiffness of the spring between the wheels and the bogie

  • self.damping:

    Damping of the dampers between the wheels and the bogie

  • self.length:

    Length of the bogie

  • self.total_static_load:

    Total static load of the bogie plus static external load

  • self.distances:

    Distance from the zero coordinate to the bogie centre at every time step

  • self.active_n_dof:

    Number of active degrees of freedom of the bogie + connected wheels

calculate_active_n_dof(index_dof)

Calculates the amount and indices of active degrees of freedom of the bogie. This includes the active degrees of freedom of the connected wheels.

Parameters:

index_dof – index of the degree of freedom in the global system

Returns:

calculate_total_static_load(external_load, static_force_vector)

Calculates the total static load on the bogie and on the wheels, this includes the static load of the bogie itself + static external force :param external_load: external static load which works on the centre of the bogie :return:

distribute_static_load()

# distribute the total static load on the bogie over the amount of connected wheels :return:

fill_damping_matrix(damping_matrix)
fill_mass_matrix(mass_matrix)

Fills global mass matrix with the bogie contribution

Parameters:

mass_matrix – global mass matrix

Returns:

fill_static_force_vector(static_force_vector)

Calculates the static load of the bogie and wheels and adds to the static force vector. Static load is calculated as -mass * gravity constant :return:

fill_stiffness_matrix(stiffness_matrix)

Fills global stiffness matrix with the bogie contribution

Parameters:

stiffness_matrix – global stiffness matrix

Returns:

reset_mesh(mesh)

Resets mesh of the bogie and underlying wheels. :param mesh: global mesh :return:

set_mesh(mesh, y=1, z=0)

Sets the initial mesh of the bogie and wheels and adds the mesh to the train mesh.

Parameters:
  • mesh – train mesh

  • y – initial y coordinate of the bogie centre

  • z – initial z coordinate of the bogie centre

Returns:

property y_disp_dof
Returns:

is y degree of freedom activated

property z_rot_dof
Returns:

is rotation around local z axis activated

class rose.model.train_model.Cart

Bases: ElementModelPart

Cart model part class. This class bases from ElementModelPart. A cart is a mass which can translate and rotate. The cart is connected to a number of bogies which are located at a certain distance from the middle of the cart.

Attributes:
  • self.bogies:

    all bogies which are connected to the cart

  • self.bogie_distances:

    List of distance of each connected bogie to the centre of the cart, including sign

  • self.distribution_factor:

    List of factors which indicate how big of a part of stiffness and damping between carts and bogie is taken into account. This is important in case of shared carts default is 1

  • self.mass:

    Mass of the cart

  • self.inertia:

    Moment of inertia of the cart

  • self.stiffness:

    Stiffness of the spring between the bogies and the cart

  • self.damping:

    Damping of the dampers between the bogies and the cart

  • self.length:

    Length of the cart

  • self.total_static_load:

    Total static load of the cart plus static external load

  • self.distances:

    Distance from the zero coordinate to the cart centre at every time step

  • self.active_n_dof:

    Number of active degrees of freedom of the cart + connected bogies

calculate_active_n_dof(index_dof)

Calculates the amount and indices of active degrees of freedom of the cart. This includes the active degrees of freedom of the connected bogies.

Parameters:

index_dof – index of the degree of freedom in the global system

Returns:

calculate_total_static_load(external_load, static_force_vector)

Calculates the total static load on the cart and on the bogies, this includes the static load of the cart itself + static external force :param external_load: external static load which works on the centre of the cart :return:

fill_damping_matrix(damping_matrix)

Fills global damping matrix with cart contribution

Parameters:

damping_matrix – global damping matrix of the train

Returns:

fill_mass_matrix(mass_matrix)

Fills global mass matrix with cart contribution

Parameters:

mass_matrix – global mass matrix of the train

Returns:

fill_static_force_vector(static_force_vector)

Fills global static force vector with static force in carts

Parameters:

static_force_vector – global vector of the static force in the train model

Returns:

fill_stiffness_matrix(stiffness_matrix)

Fills global stiffness matrix with cart contribution

Parameters:

stiffness_matrix – global stiffness matrix of the train

Returns:

reset_mesh(mesh)

Resets mesh of the cart and underlying bogies.

Parameters:

mesh – global mesh of the train

Returns:

set_mesh(mesh, y=2, z=0)

Sets the initial mesh of the cart and bogies and adds the mesh to the train mesh.

Parameters:
  • mesh – train mesh

  • y – initial y coordinate of the bogie centre

  • z – initial z coordinate of the bogie centre

Returns:

property y_disp_dof
Returns:

is y degree of freedom activated

property z_rot_dof
Returns:

is rotation around local z axis activated

class rose.model.train_model.TrainModel

Bases: GlobalSystem

Train model part class. This class bases from GlobalSystem. This class contains all the attributes, and functions which are exclusively related to the train model. The class contains the mesh and model parts of all the train elements.

Attributes:
  • self.carts:

    all carts which are connected to the train

  • self.cart_distances:

    list of distances between the [0,0] coordinate to the middle of each cart

  • self.static_force_vector:

    Global force vector of only the static load of the train.

  • self.velocities:

    np array of the velocity of the train at each time step

  • self.time:

    time discretisation

  • self.irregularities_at_wheels:

    np array of irregularities at the wheels at each time step

  • self.total_static_load:

    Total static load working on the carts

  • self.contact_dofs:

    global degree of freedom indices which are in contact with the surface (rail)

property bogies

All bogies which are part of the train

Returns:

calculate_distances()

Calculate the distance of each element of the train for each time step. :return:

calculate_initial_displacement(wheel_displacements, shift_in_ndof=0)

Calculates the initial displacement of the train

Parameters:
  • wheel_displacements – displacement of track below initial location of the wheels

  • shift_in_ndof – shift in number degree of freedom, relevant in coupled systems, default is set at 0

Returns:

calculate_total_static_load(external_load=0)

Calculates the total static load working on the complete train :param external_load: Optional external load working on the train :return:

check_distribution_factors()

Checks if distribution factors are present in each cart and each bogie. If the factors are not present, initialise the distribution factors as ones. Distribution factors indicate the ratio of how much force which is located on the train part, is transmitted to the train part

Returns:

get_contact_dofs()

Gets the indices of the train degrees of freedom which are in contact with the surface (rail) :return:

get_train_parts()

Collect all bogies and wheels which are connected to the train :return:

impose_displacement(K, F, imposed_displacement, imposed_dofs)

Calculate force due to an imposed displacement

Parameters:
  • K – Global stiffness matrix

  • F – Global force vector

  • imposed_displacement – array of imposed displacement per DOF

  • imposed_dofs – degrees of freedom indices of the imposed displacement

Returns:

initialise()

Initialise train. Set geometry, set degrees of freedom, initialises global matrices and vectors, stages and solver.

Returns:

initialise_global_matrices()

Inititalise each global train matrix. I.e. mass matrix, damping matrix, stiffness matrix, force vector.

Returns:

initialise_irregularities_at_wheels()

Initialise irregularities at the train wheels. If the irregularities are not initialised by the user, the irregularities at the wheels are set at 0. :return:

initialise_ndof()

Initialise all indices of the degrees of freedom within the train. Also calculates total number of degrees of freedom :return:

initialize_force_vector()

Initialise global force vector of the train :return:

main()

Main function of the class. The system is initialised. Each stage is calculated.

Returns:

reset_mesh()

Resets mesh of the train. A new instance of mesh is created and is filled with existing nodes of the carts, bogies and wheels

Returns:

set_global_damping_matrix()

Set global damping matrix of train :return:

set_global_mass_matrix()

Set global mass matrix of train :return:

set_global_stiffness_matrix()

Set global stiffness matrix of train :return:

set_mesh()

Sets the mesh of the complete train :return:

set_static_force_vector()

Set static force vector of train :return:

trim_global_matrices()

Removed obsolete indices from global matrices :return:

update(start_time_id, end_time_id)

Updates solver

Parameters:
  • start_time_id – first time index of the stage

  • end_time_id – final time index of the stage

Returns:

property wheels

All wheels which are part of the train

Returns:

class rose.model.train_model.Wheel

Bases: ElementModelPart

Wheel model part class.This class bases from ElementModelPart.

Attributes:
  • self.mass:

    wheel mass

  • self.total_static_load:

    total static load of the wheel

  • self.distances:

    Distance from the zero coordinate to the wheel at every time step

  • self.active_n_dof:

    Number of active degrees of freedom of the wheel

calculate_active_n_dof(index_dof)

Calculates the amount and indices of active degrees of freedom of the wheel.

Parameters:

index_dof – index of the degree of freedom in the global system

Returns:

calculate_total_static_load(external_load)

Calculates the total static load on the wheel, this includes the static load of the wheel itself + static external force :param external_load: external static load which works on the wheel :return:

fill_mass_matrix(mass_matrix)

Fills global mass matrix with the wheel contribution

Parameters:

mass_matrix – global mass matrix

Returns:

fill_static_force_vector(static_force_vector)

Fills global static force vector with the wheel contribution

Parameters:

static_force_vector – global static force vector

Returns:

reset_mesh(mesh)

Sets the initial mesh of the wheel and adds the mesh to the train mesh.

Parameters:
  • mesh – train mesh

  • y – initial y coordinate of the wheel

  • z – initial z coordinate of the wheel

Returns:

set_mesh(mesh, y=0, z=0)

Sets the initial mesh of the wheel and adds the mesh to the train mesh.

Parameters:
  • mesh – train mesh

  • y – initial y coordinate of the wheel

  • z – initial z coordinate of the wheel

Returns:

property y_disp_dof
Returns:

is y degree of freedom activated

rose.model.train_track_interaction module

class rose.model.train_track_interaction.CoupledTrainTrack

Bases: GlobalSystem

Class which contains a coupled system of a track and a train. This class bases from GlobalSystem.

Attributes:
  • self.train:

    The complete train system (carts, bogies, wheels)

  • self.track:

    The complete track system (rail, sleepers, dampers, soil, boundary conditions)

  • self.rail:

    Model part of the track which is in contact with the train

  • self.hertzian_contact_coef:

    Coefficient used in Hertzian contact theory

  • self.hertzian_power:

    Power used in Hertzian contact theory

  • self.wheel_loads:

    List of moving load model parts at the location of the train wheels

  • self.static_contact_deformation:

    Static deformation at contact following Hertzian theory

  • self.track_elements:

    Contact track elements at each time step for each contact force

  • self.track_global_indices:

    Indices of the nodal degrees of freedom of the contact track elements

  • self.wheel_distances:

    Distance from [0,0] coordinate of each wheel at each time step

  • self.wheel_node_dist:

    Distance of each wheel to first node of contact element at each time step

  • self.y_shape_factors:

    Vertical load shape vectors for each contact element at each time step

assign_results_to_nodes()

Assigns all solver results to all nodes in the mesh :return:

calculate_distance_wheels_track_nodes()

Calculates distance of the wheels to the first node of the element which the wheel is in contact with

Returns:

calculate_initial_displacement_track()

Calculates initial displacement of track :return:

calculate_initial_displacement_train(wheel_displacements)

Calculates initial displacement of the train

Parameters:

wheel_displacements – displacement of track below initial location of the wheels

Returns:

calculate_initial_state()

Calculates initial state of coupled track and train system :return:

calculate_stage(start_time_id, end_time_id)

Calculates stage and sets track global force vector to csc sparse matrix :param start_time_id: start time index :param end_time_id: end time index :return:

calculate_static_contact_deformation()

Calculates static contact deformation at each wheel based on Hertzian contact theory. Note that there is no loss of contact. :return:

calculate_wheel_rail_contact_force(t: int, du_wheels: ndarray) ndarray

Calculate contact force between wheels and rail based on Hertzian contact theory. Note that there is no loss of contact.

Parameters:
  • t – time index

  • du_wheels – differential displacement wheels at time t

Returns:

calculate_y_shape_factors_rail()

Calculate y-shape factors for the contact rail elements at each time step :return:

clean_model()

Cleans model, this is required if multiple calculations are performed with the same model. - Resets degrees of freedom. - Clears model parts from nodes and elements. - Resets train mesh. :return:

combine_global_matrices()

Combines global matrices of the train and the track

Returns:

combine_rhs()

Combines right hand side of the track and the train in the global force vector :return:

finalise()

Finalises calculation. Calculate force in the track elements and assign results to the nodes. :return:

get_disp_track_at_wheels(t: int, u: ndarray) ndarray

Get displacement of the track at the location of the wheels at time t

Parameters:
  • t – time index

  • u – displacements at time t

Returns:

get_interaction_forces_history() ndarray

Gets interaction forces history between wheels and track. Interaction forces are the external forces acting on the wheels minus the gravitational forces acting on the wheels.

initialise()

Initialises train, track, train-track interaction, stages and the solver. :return:

initialise_ndof()

Initialises number of the degree of freedom for the train and track :return:

initialise_track()

Initialises track system and adds wheel loads to track :return:

initialise_track_wheel_interaction()
Initialises interaction between wheel and track. And vectorises relevant arrays for performance purpose.

Finds elements which are in contact with the wheels at time t Calculates distance between wheel and node 1 of contact track element at time t Calculates y-shape factors of the track elements at time t

Returns:

initialise_train()

Initialises train system :return:

initialize_track_elements()

Finds track elements and degree of freedom indices in the global system which are in contact with each wheel on each time step.

# ToDo currently track global indices are the y disp index and z-rot index, make this more general such that it works for an inclined track :return:

initialize_wheel_loads()

Initialises wheel loads on track

Returns:

main()

Performs main procedure. Validate input, initialise input, calculate the initial state, calculate each stage and finalise the calculation :return:

set_wheel_load_on_track(wheel_loads: ndarray, t: int) ndarray

Sets vertical wheel load on track element which is in contact with the wheels at time t

Parameters:
  • wheel_loads – vertical wheel load of each wheel at time t

  • t – time index

Returns:

update_force_vector(t: int, u: ndarray) ndarray

Updates the complete force vector at time t

Parameters:
  • u – displacements at time t

  • t – time index

Return F:

Force vector at time t

update_force_vector_contact(u: ndarray, t: int, F: ndarray) ndarray

Updates the complete force vector due to wheel-rail contact forces

Parameters:
  • u – displacements at time t

  • t – time index

  • F – Force vector at time t

Return F:

Force vector at time t

update_non_linear_iteration(t: int, u: ndarray)

Updates global system at a non-linear iteration. Currently only the rhs is updated

Parameters:
  • t – time index

  • u – displacement vector

Returns:

update_time_step_rhs(t, **kwargs)

Updates rhs at time step t

Parameters:
  • t – time index

  • kwargs – key word arguments, this is required, as this whole function is added to the solver

Returns:

rose.model.utils module

rose.model.utils.add_aux_matrix_to_global(global_matrix: lil_matrix, aux_matrix, elements: List[Element], model_part, nodes: List[Node] = None) lil_matrix

Adds auxiliary matrix to the global matrix

Parameters:
  • global_matrix – sparse global matrix

  • aux_matrix – auxiliary matrix to be added

  • elements – list of elements in current model part

  • model_part – current model part of which the auxiliary matrix is to be added to the global matrix

  • nodes – list of nodes in current model part

Returns:

sparse global matrix with auxiliary matrix added

rose.model.utils.calculate_cum_distance_from_velocity(time, velocities)

Calculate cumulative distance by multiplying the time steps by the velocities

Parameters:
  • time – time discretisation

  • velocities – array of velocity each time step

Returns:

rose.model.utils.calculate_point_rotation(coord1: ndarray, coord2: ndarray)

Calculates rotation between 2 points

Parameters:
  • coord1 – coordinates point 1

  • coord2 – coordinates point 2

Returns:

rose.model.utils.calculate_rotation(coord1: ndarray, coord2: ndarray)

Calculates rotation between 2 coordinate arrays in a 2d space.

Parameters:
  • coord1 – first coordinate array

  • coord2 – second coordinate array

Returns:

rose.model.utils.delete_from_lil(mat: lil_matrix, row_indices=[], col_indices=[])

Remove the rows and columns from the lil sparse matrix

WARNING: Indices of altered axes are reset in the returned matrix

Parameters:
  • mat – matrix to be trimmed

  • row_indices – row indices to be removed

  • col_indices – column indices to be removed

Returns:

rose.model.utils.distance_np(coordinates_array1: array, coordinates_array2: array, axis=0)

Calculate distance between 2 coordinate numpy arrays

Parameters:
  • coordinates_array1

  • coordinates_array2

  • axis

Returns:

rose.model.utils.filer_location(locations: array, lower_limit: float, upper_limit: float)

Filter location array which is outside lower and upper limit. If location is outside limits, it is set to the corresponding limit

Parameters:
  • locations – location array to be filtered

  • lower_limit – lower limit of location array

  • upper_limit – upper limit of location array

Returns:

rose.model.utils.filter_data_outside_range(data: array, locations: array, lower_limit: float, upper_limit: float)

Filters data outside upper and lower location limits

Parameters:
  • data – data array to be filtered

  • locations – location array to ben checked for limits

  • lower_limit – lower limit of location array

  • upper_limit – upper limit of location array

Returns:

rose.model.utils.generate_rail_irregularities(wheels: List, time, **kwargs)

Generates rail irregularities at all wheels in a list

Parameters:
  • wheels – list of wheels if the train

  • time – all time steps

  • kwargs – key word arguments for RailIrregularities

Returns:

rose.model.utils.interpolate_cumulative_distance_on_nodes(cumulative_distances: array, coordinates: array, new_cumulative_distances: array)

Interpolate cumulative distances on coordinates

Parameters:
  • cumulative_distances – cumulative distance array of the nodes

  • coordinates – nodal coordinates

  • new_cumulative_distances – new cumulative distance array to be interpolated with

Returns:

rose.model.utils.reshape_aux_matrix(n_nodes_element: int, dofs: list, aux_matrix: ndarray) ndarray

Reshapes aux matrix of the model part based on the total possible degrees of freedom (active and inactive). This function is required to easily fill the global matrices

Parameters:
  • n_nodes_element – number of nodes per element

  • dofs – list of all possible degrees of freedoms per element

  • aux_matrix – current auxiliary matrix

Returns:

rose.model.utils.rotate_aux_matrix(element: Element, model_part, aux_matrix: array)

Rotates aux matrix based on rotation of element

Parameters:
  • element – elements within current model part

  • model_part – current model part of which the auxiliary matrix is to be rotated

  • aux_matrix – auxiliary matrix to be rotated

Returns:

rose.model.utils.rotate_force_vector(element: Element, contact_model_part, force_vector: array)

Rotates force vector based on rotation of element, currently only works on 2 noded elements.

Parameters:
  • element – elements within current model part

  • contact_model_part – model part on which the force vector is located

  • force_vector – force vector to be rotated

Returns:

rose.model.utils.rotate_point_around_z_axis(rotation: ndarray, point_vector: ndarray)

Rotates a point around the z-axis

Parameters:
  • rotation – rotation array in radians

  • point_vector – vector of global values [x-direction, y-direction, z-rotation] to be rotated

Returns:

Module contents