My Project
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Simulation Class Reference

#include <simulation.hpp>

Inheritance diagram for Simulation:
Inheritance graph
[legend]
Collaboration diagram for Simulation:
Collaboration graph
[legend]

Public Member Functions

 Simulation (string parameters_path)
 
 Simulation (string parameters_path, bool friction_parallelized)
 
void main ()
 

Protected Member Functions

void setupModelVectorsMatrices ()
 
void setupBlockMatrix ()
 
void setupBlockMatrixDerivative ()
 
void setupPadVector ()
 
void setupPadVectorDerivative ()
 
void setupSaveVectorsMatrices ()
 
void setupSliderSpeedMode ()
 
void setupConstants ()
 
double phi (double y)
 
void setSpeedAfterThreshold ()
 
void updateSliderSpeed (int time_step)
 
void function_u (const arma::mat &current_block_matrix, const arma::rowvec &current_pad_vector, arma::mat &current_block_matrix_derivative)
 
void function_x (const arma::mat &current_block_matrix, const arma::rowvec &current_pad_vector, arma::rowvec &current_pad_vector_derivative)
 
void function_x_odof (const arma::rowvec &current_pad_vector, arma::rowvec &current_pad_vector_derivative)
 
double calculatePadSupportDamper (arma::rowvec current_pad_vector)
 
double calculatePadFriction (arma::mat current_block_matrix, arma::rowvec current_pad_vector)
 
void midpointMethod (int time_step)
 
void oneDegreeOfFreedomMidpointMethod (int time_step)
 
void writeValuesToLoggers (const int &time_step)
 
void printMidPointMethod (arma::mat block_matrix, arma::rowvec pad_vector, string explanation_text="")
 
void runMidpointMethod ()
 
void saveToCsv (string filename, string result_path)
 
void midpointMethodParallel (int timestep, arma::mat &block_matrix_parallel, arma::rowvec &pad_vector_parallel, arma::mat block_matrix_derivative_parallel, arma::rowvec pad_vector_derivative_parallel)
 
void setupAndRunFrictionInParallel (int time_step, double slider_speed)
 
void calculateFrictionInParallel ()
 
void saveToCsvParallel (const arma::colvec &armadillo_vector, const string &result_path, const double &slider_speed)
 

Protected Attributes

string input_parameters_path
 
Parameters input_parameters
 
arma::mat block_matrix
 
arma::mat block_matrix_derivative
 
arma::rowvec pad_vector
 
arma::rowvec pad_vector_derivative
 
int number_of_time_steps
 
int number_of_save_steps
 
int number_of_interval_save_step
 
double m_u
 
double k_p
 
double m_c_crit
 
double c_p
 
double k_c
 
int updateSliderSpeedDtInterval
 
bool loggingSpecificBlocks = false
 
arma::uvec block_position_column_index = {0}
 
arma::uvec block_velocity_column_index = {1}
 
arma::mat block_position_to_file
 
arma::mat block_velocity_to_file
 
arma::colvec pad_position_to_file
 
arma::colvec pad_velocity_to_file
 
arma::colvec pad_friction_to_file
 
int index_pad_friction_to_file = 0
 
int index_to_file = 0
 
int friction_zero_counter = 0
 

Detailed Description

Definition at line 6 of file simulation.hpp.

Constructor & Destructor Documentation

◆ Simulation() [1/2]

Simulation::Simulation ( string  parameters_path)

Burridge-Knopoff-Pad model. $\begin{aligned} m_u \ddot{u}_j &= k_c(u_{j-1} - 2u_j + u_{j+1})-k_p(u_j - x) - m_u \phi(v + \dot{u_j}) \\ m_x \ddot{x}&= -c_p\dot{x} + k_p \sum_j(u_j -x) - k_{p0}x \end{aligned} $

Definition at line 13 of file simulation.cpp.

Here is the call graph for this function:

◆ Simulation() [2/2]

Simulation::Simulation ( string  parameters_path,
bool  friction_parallelized 
)

Definition at line 23 of file simulation.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ calculateFrictionInParallel()

void Simulation::calculateFrictionInParallel ( )
protected

Definition at line 570 of file simulation.cpp.

Here is the call graph for this function:

◆ calculatePadFriction()

double Simulation::calculatePadFriction ( arma::mat  current_block_matrix,
arma::rowvec  current_pad_vector 
)
protected

Definition at line 361 of file simulation.cpp.

◆ calculatePadSupportDamper()

double Simulation::calculatePadSupportDamper ( arma::rowvec  current_pad_vector)
protected

Definition at line 356 of file simulation.cpp.

◆ function_u()

void Simulation::function_u ( const arma::mat &  current_block_matrix,
const arma::rowvec &  current_pad_vector,
arma::mat &  current_block_matrix_derivative 
)
protected

$ \vec{u_{j}}= \begin{bmatrix} u_{j} \\ \dot{u_{j}} \end{bmatrix} \quad \dot{\vec{u_{j}}} = f(\vec{u_{j}}) = \begin{bmatrix} \dot{u_{j}} \\ \frac{1}{m_{u}}[k_c(u_{j-1} - 2u_j + u_{j+1})-k_p(u_j - x) - m_u \phi(v + \dot{u_j})] \end{bmatrix} $

Definition at line 240 of file simulation.cpp.

Here is the call graph for this function:

◆ function_x()

void Simulation::function_x ( const arma::mat &  current_block_matrix,
const arma::rowvec &  current_pad_vector,
arma::rowvec &  current_pad_vector_derivative 
)
protected

$\vec{x}= \begin{bmatrix} x \\ \dot{x} \end{bmatrix} \quad \dot{\vec{x}} = f(\vec{x}) = \begin{bmatrix} \dot{x} \\ \frac{1}{m_{x}}[-c_p\dot{x} + k_p \sum_j(u_j -x) - k_{p0}x] \end{bmatrix} $

Definition at line 289 of file simulation.cpp.

Here is the call graph for this function:

◆ function_x_odof()

void Simulation::function_x_odof ( const arma::rowvec &  current_pad_vector,
arma::rowvec &  current_pad_vector_derivative 
)
protected

$\vec{x}= \begin{bmatrix} x \\ \dot{x} \end{bmatrix} \quad \dot{\vec{x}} = f(\vec{x}) = \begin{bmatrix} \dot{x} \\ \frac{1}{m_{x}}[-c_p\dot{x} - \phi(\dot{x} - v_{0}) - k_{p0}x] \end{bmatrix} $

Definition at line 333 of file simulation.cpp.

Here is the call graph for this function:

◆ main()

void Simulation::main ( )

Definition at line 592 of file simulation.cpp.

Here is the call graph for this function:

◆ midpointMethod()

void Simulation::midpointMethod ( int  time_step)
protected

$\begin{aligned} y^{*} &= y^{n} + \frac{\Delta t}{2} f(y^{n}),\\ y^{n+1} &= y^{n} + \Delta t f(y^{*}) \end{aligned} $ $\vec{y}= \begin{bmatrix} y \\ \dot{y} \end{bmatrix} \quad \dot{\vec{y}} = f(\vec{y}) = \begin{bmatrix} \dot{y} \\ \ddot{y} \end{bmatrix} $

Definition at line 386 of file simulation.cpp.

Here is the call graph for this function:

◆ midpointMethodParallel()

void Simulation::midpointMethodParallel ( int  timestep,
arma::mat &  block_matrix_parallel,
arma::rowvec &  pad_vector_parallel,
arma::mat  block_matrix_derivative_parallel,
arma::rowvec  pad_vector_derivative_parallel 
)
protected

Definition at line 493 of file simulation.cpp.

Here is the call graph for this function:

◆ oneDegreeOfFreedomMidpointMethod()

void Simulation::oneDegreeOfFreedomMidpointMethod ( int  time_step)
protected

Definition at line 409 of file simulation.cpp.

Here is the call graph for this function:

◆ phi()

double Simulation::phi ( double  y)
protected

$\phi(y) = \begin{cases} \begin{aligned} &F_{0}[-1,1], \quad &y = 0\\ &F_{0}\frac{1-\sigma}{1+\frac{|y|}{1-\sigma}}sign(y), \quad &y \neq 0 \end{aligned} \end{cases}$

Definition at line 178 of file simulation.cpp.

◆ printMidPointMethod()

void Simulation::printMidPointMethod ( arma::mat  block_matrix,
arma::rowvec  pad_vector,
string  explanation_text = "" 
)
protected

Definition at line 449 of file simulation.cpp.

◆ runMidpointMethod()

void Simulation::runMidpointMethod ( )
protected

Definition at line 455 of file simulation.cpp.

Here is the call graph for this function:

◆ saveToCsv()

void Simulation::saveToCsv ( string  filename,
string  result_path = "results/" 
)
protected

Definition at line 476 of file simulation.cpp.

◆ saveToCsvParallel()

void Simulation::saveToCsvParallel ( const arma::colvec &  armadillo_vector,
const string &  result_path,
const double &  slider_speed 
)
protected

Definition at line 561 of file simulation.cpp.

◆ setSpeedAfterThreshold()

void Simulation::setSpeedAfterThreshold ( )
protected

Definition at line 191 of file simulation.cpp.

◆ setupAndRunFrictionInParallel()

void Simulation::setupAndRunFrictionInParallel ( int  time_step,
double  slider_speed 
)
protected

Definition at line 520 of file simulation.cpp.

Here is the call graph for this function:

◆ setupBlockMatrix()

void Simulation::setupBlockMatrix ( )
protected

Definition at line 57 of file simulation.cpp.

◆ setupBlockMatrixDerivative()

void Simulation::setupBlockMatrixDerivative ( )
protected

Definition at line 75 of file simulation.cpp.

◆ setupConstants()

void Simulation::setupConstants ( )
protected

Definition at line 153 of file simulation.cpp.

Here is the call graph for this function:

◆ setupModelVectorsMatrices()

void Simulation::setupModelVectorsMatrices ( )
protected

Definition at line 44 of file simulation.cpp.

Here is the call graph for this function:

◆ setupPadVector()

void Simulation::setupPadVector ( )
protected

Definition at line 81 of file simulation.cpp.

◆ setupPadVectorDerivative()

void Simulation::setupPadVectorDerivative ( )
protected

Definition at line 86 of file simulation.cpp.

◆ setupSaveVectorsMatrices()

void Simulation::setupSaveVectorsMatrices ( )
protected

Definition at line 91 of file simulation.cpp.

◆ setupSliderSpeedMode()

void Simulation::setupSliderSpeedMode ( )
protected

Definition at line 127 of file simulation.cpp.

◆ updateSliderSpeed()

void Simulation::updateSliderSpeed ( int  time_step)
protected

Definition at line 200 of file simulation.cpp.

Here is the call graph for this function:

◆ writeValuesToLoggers()

void Simulation::writeValuesToLoggers ( const int &  time_step)
protected

Definition at line 429 of file simulation.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ block_matrix

arma::mat Simulation::block_matrix
protected

Definition at line 98 of file simulation.hpp.

◆ block_matrix_derivative

arma::mat Simulation::block_matrix_derivative
protected

Definition at line 99 of file simulation.hpp.

◆ block_position_column_index

arma::uvec Simulation::block_position_column_index = {0}
protected

Definition at line 117 of file simulation.hpp.

◆ block_position_to_file

arma::mat Simulation::block_position_to_file
protected

Definition at line 120 of file simulation.hpp.

◆ block_velocity_column_index

arma::uvec Simulation::block_velocity_column_index = {1}
protected

Definition at line 118 of file simulation.hpp.

◆ block_velocity_to_file

arma::mat Simulation::block_velocity_to_file
protected

Definition at line 121 of file simulation.hpp.

◆ c_p

double Simulation::c_p
protected

Definition at line 111 of file simulation.hpp.

◆ friction_zero_counter

int Simulation::friction_zero_counter = 0
protected

Definition at line 129 of file simulation.hpp.

◆ index_pad_friction_to_file

int Simulation::index_pad_friction_to_file = 0
protected

Definition at line 126 of file simulation.hpp.

◆ index_to_file

int Simulation::index_to_file = 0
protected

Definition at line 127 of file simulation.hpp.

◆ input_parameters

Parameters Simulation::input_parameters
protected

Definition at line 96 of file simulation.hpp.

◆ input_parameters_path

string Simulation::input_parameters_path
protected

Definition at line 94 of file simulation.hpp.

◆ k_c

double Simulation::k_c
protected

Definition at line 112 of file simulation.hpp.

◆ k_p

double Simulation::k_p
protected

Definition at line 109 of file simulation.hpp.

◆ loggingSpecificBlocks

bool Simulation::loggingSpecificBlocks = false
protected

Definition at line 116 of file simulation.hpp.

◆ m_c_crit

double Simulation::m_c_crit
protected

Definition at line 110 of file simulation.hpp.

◆ m_u

double Simulation::m_u
protected

Definition at line 108 of file simulation.hpp.

◆ number_of_interval_save_step

int Simulation::number_of_interval_save_step
protected

Definition at line 106 of file simulation.hpp.

◆ number_of_save_steps

int Simulation::number_of_save_steps
protected

Definition at line 105 of file simulation.hpp.

◆ number_of_time_steps

int Simulation::number_of_time_steps
protected

Definition at line 104 of file simulation.hpp.

◆ pad_friction_to_file

arma::colvec Simulation::pad_friction_to_file
protected

Definition at line 124 of file simulation.hpp.

◆ pad_position_to_file

arma::colvec Simulation::pad_position_to_file
protected

Definition at line 122 of file simulation.hpp.

◆ pad_vector

arma::rowvec Simulation::pad_vector
protected

Definition at line 101 of file simulation.hpp.

◆ pad_vector_derivative

arma::rowvec Simulation::pad_vector_derivative
protected

Definition at line 102 of file simulation.hpp.

◆ pad_velocity_to_file

arma::colvec Simulation::pad_velocity_to_file
protected

Definition at line 123 of file simulation.hpp.

◆ updateSliderSpeedDtInterval

int Simulation::updateSliderSpeedDtInterval
protected

Definition at line 114 of file simulation.hpp.


The documentation for this class was generated from the following files: