3 **Description:** In short this code do all parts of the simulation regarding the
4 BK-Pad model. It uses a self implemented 2nd order Runge-Kutta to solve the
5 differential equations. The input from user is stored in a YAML file *parameters.yaml** in "doc/yaml". All functions are attempted described below, if this is
6 unsatisfactory, feel free to ask me. (Assuming you know who I am if you are
11 * Constructor(Simulation)
13 * setupModelVectorsMatrices
23 ### setupModelVectorsMatrices
25 Simulation::setupModelVectorsMatrices()
26 Simulation::setupModelVectorsMatrices()
28 This is a bigger setup method. In rough lines it sets up
29 * A 2x*N* matrix for the values of the blocks position and velocity where *N* is the number of blocks
30 * Initialize the block matrix with random values that are either
31 - Positive between 0.0 and 1.0 (debug_negative_initial_values, debug_only_negative_initial set to false)
32 - Negative between -1.0 and 0.0 (debug_negative_initial_values false, debug_only_negative_initial true)
33 - Positive and negative values between -1.0 and 1.0 (debug_negative_initial_values true)
34 - This is controlled by **parameters.yaml** in "doc/yaml".
35 * A 2x*N* matrix for the the derivative of the block matrix
36 * Initialize the derivative block matrix with 1.0
37 * A 2x1 vector for the values of the pads position and velocity
38 * Initialize the pad vector with zeros
39 * A 2x1 vector for the derivative of the pad vector
40 * Initialize the derivative pad vector with zeros
41 * Setting up save mechanism
42 * Calculating total number of time steps based the input parameters in **parameters.yaml**
43 * Checking if all block should be logged
44 - See if the number of blocks specified to be logged is smaller than the number of blocks used for the model
45 - If it is only the specified blocks is saved to file
46 - This reduce the amount of output data, which can get quite high
47 - Setting up vectors to log pads position and velocity
51 This is method sets up constants derived from input parameters in **parameters.yaml**.
55 Returns value of friction law used based on input value.
59 Calculate the value of the derivative block matrix based on the equation given in the class documentation. The calculation is done step wise in order
60 to be able to disable parts of the equation and make it more clear.
64 Calculate the value of the derivative pad vector based on the equation in the class documentation. The calculation is done step wise in order to be
65 able to disable parts of the equation and make it more clear.
69 Control the steps in the midpoint method. It is a numeric method that works similar to the Euler's method. It used the derivative to calculate the next value of the simulation. Different from the Euler's method, it first calculates halfway to the next time step which promises higher precision. It also logs the position and velocity of the pad and blocks that are logged to be saved at some point.
71 ### printMidPointMethod
73 Print block matrix and pad vector which has to be given as input.
77 Runs the midpoint method, uses a for-loop and controls saving of the file.
81 Saves the logged block and pad position and velocity to files in the "results" folder.