![]() |
Computational Science Based on HPC
|
This file contains the implementation of the serial version of the oscillation simulation in 1D and 2D. More...
Go to the source code of this file.
Functions | |
| char * | _simulate_damped_os_serial (double max_amplitude, double length, double mass, double gravity, double k, double Ao, double Vo, double FI, double time_limit, double step_size, double damping_coefficent, int number_of_files) |
| This function simulates simple harmonic motion (Simple Spring Motion). | |
| char * | _execution_time_damped_os_serial (double max_amplitude, double length, double mass, double gravity, double k, double Ao, double Vo, double FI, double time_limit, double step_size, double damping_coefficent, int number_of_files) |
| This function calculates execution time of simulating simple harmonic motion (Simple Spring Motion). | |
| char * | _simulate_elastic_pendulum (double r, double length, double mass, double gravity, double k, double Ao, double Xo, double Yo, double Vo, double time_limit, double step_size, double damping_coefficent, int number_of_files) |
| This function simulates the motion of (elastic pendulum/2D-spring/spring pendulum) system. | |
| char * | _execution_time_elastic_pendulum (double r, double length, double mass, double gravity, double k, double Ao, double Xo, double Yo, double Vo, double time_limit, double step_size, double damping_coefficent, int number_of_files) |
| This function calculates the execution time of simulating the motion of (elastic pendulum/2D-spring/spring pendulum) system. | |
This file contains the implementation of the serial version of the oscillation simulation in 1D and 2D.
| char * _execution_time_damped_os_serial | ( | double | max_amplitude, |
| double | length, | ||
| double | mass, | ||
| double | gravity, | ||
| double | k, | ||
| double | Ao, | ||
| double | Vo, | ||
| double | FI, | ||
| double | time_limit, | ||
| double | step_size, | ||
| double | damping_coefficent, | ||
| int | number_of_files | ||
| ) |
This function calculates execution time of simulating simple harmonic motion (Simple Spring Motion).
using numerical solution of stepwise precision using equation (e^(-damping_coefficent / (2 * mass)) * t)*sin(wt+fi)), where this equation calculates the displacement of mass on y-axis, this function also calculates the acceleration and velocity in each time step. This function is implemented using serial algorithm.
| max_amplitude | starting position of the mass where the simulation will start |
| length | the maximum length of the spring (uncompressed spring) |
| mass | mass of bob |
| gravity | |
| k | stiffness of the spring |
| Ao | initial acceleration |
| Vo | initial velocity |
| FI | FI constant which will be added to the (wt) inside the sine calculation |
| time_limit | the time when the simulation will stop |
| step_size | how much the simulation will skip per iteration |
| damping_coefficent | damping factor affecting on the system |
| number_of_files |
| char * _execution_time_elastic_pendulum | ( | double | r, |
| double | length, | ||
| double | mass, | ||
| double | gravity, | ||
| double | k, | ||
| double | Ao, | ||
| double | Xo, | ||
| double | Yo, | ||
| double | Vo, | ||
| double | time_limit, | ||
| double | step_size, | ||
| double | damping_coefficent, | ||
| int | number_of_files | ||
| ) |
This function calculates the execution time of simulating the motion of (elastic pendulum/2D-spring/spring pendulum) system.
Using LaGrange mechanics to get the equation of motion of the whole system and solving the differential equation using Fourth order Runge-Kutta ODE to get the displacement of body suspended on spring at time t. This system's motion is chaotic motion so it can't be parallelized. This simulation prints the position of mass w.r.t X-Axis and Y-Axis.
| r | rest length of spring |
| length | max length of spring |
| mass | mass of bob suspended in spring |
| gravity | |
| k | stiffness of spring |
| Ao | initial acceleration |
| Xo | initial point on X-axis where simulation starts |
| Yo | initial point on Y-axis where simulation starts |
| Vo | initial velocity |
| time_limit | the time when the simulation will stop |
| step_size | how much the simulation will skip per iteration |
| damping_coefficent | damping factor affecting on the system |
| number_of_files |
| char * _simulate_damped_os_serial | ( | double | max_amplitude, |
| double | length, | ||
| double | mass, | ||
| double | gravity, | ||
| double | k, | ||
| double | Ao, | ||
| double | Vo, | ||
| double | FI, | ||
| double | time_limit, | ||
| double | step_size, | ||
| double | damping_coefficent, | ||
| int | number_of_files | ||
| ) |
This function simulates simple harmonic motion (Simple Spring Motion).
using numerical solution of stepwise precision using equation (e^(-damping_coefficent / (2 * mass)) * t)*sin(wt+fi)), where this equation calculates the displacement of mass on y-axis, this function also calculates the acceleration and velocity in each time step. This function is implemented using serial algorithm.
| max_amplitude | starting position of the mass where the simulation will start |
| length | the maximum length of the spring (uncompressed spring) |
| mass | mass of bob |
| gravity | |
| k | stiffness of the spring |
| Ao | initial acceleration |
| Vo | initial velocity |
| FI | FI constant which will be added to the (wt) inside the sine calculation |
| time_limit | the time when the simulation will stop |
| step_size | how much the simulation will skip per iteration |
| damping_coefficent | damping factor affecting on the system |
| number_of_files |
| char * _simulate_elastic_pendulum | ( | double | r, |
| double | length, | ||
| double | mass, | ||
| double | gravity, | ||
| double | k, | ||
| double | Ao, | ||
| double | Xo, | ||
| double | Yo, | ||
| double | Vo, | ||
| double | time_limit, | ||
| double | step_size, | ||
| double | damping_coefficent, | ||
| int | number_of_files | ||
| ) |
This function simulates the motion of (elastic pendulum/2D-spring/spring pendulum) system.
Using LaGrange mechanics to get the equation of motion of the whole system and solving the differential equation using Fourth order Runge-Kutta ODE to get the displacement of body suspended on spring at time t. This system's motion is chaotic motion so it can't be parallelized. This simulation prints the position of mass w.r.t X-Axis and Y-Axis.
| r | rest length of spring |
| length | max length of spring |
| mass | mass of bob suspended in spring |
| gravity | |
| k | stiffness of spring |
| Ao | initial acceleration |
| Xo | initial point on X-axis where simulation starts |
| Yo | initial point on Y-axis where simulation starts |
| Vo | initial velocity |
| time_limit | the time when the simulation will stop |
| step_size | how much the simulation will skip per iteration |
| damping_coefficent | damping factor affecting on the system |
| number_of_files |