Computational Science Based on HPC
Functions
oscpara.h File Reference

This file contains the implementation of the parallel versions of the oscillation simulation in 1D and 2D. More...

Go to the source code of this file.

Functions

char * _simulate_damped_os_parallel_mpi_omp (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)
 function simulates simple harmonic motion (Simple Spring Motion).
 
int _execution_time_damped_os_parallel_mpi_omp (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 calculate the execution time of simulating simple harmonic motion (Simple Spring Motion).
 
char * _simulate_damped_os_parallel_mpi (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).
 
int _execution_time_damped_os_parallel_mpi (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)
 function calculate execution time simulating simple harmonic motion (Simple Spring Motion).
 
double _execution_time_damped_os_parallel_omp (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, int num_of_threads)
 This function calculate execution time simulating simple harmonic motion (Simple Spring Motion).
 

Detailed Description

This file contains the implementation of the parallel versions of the oscillation simulation in 1D and 2D.

Function Documentation

◆ _execution_time_damped_os_parallel_mpi()

int _execution_time_damped_os_parallel_mpi ( 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 
)

function calculate execution time 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 MPI, The Number of iteration are divided upon number of processes using MPI.

Warning
don't set gravity less than 0.
if max_amplitude is greater than the length the max_amplitude automatically set to the length value
mass can't be negative
length can't be negative
damping_coefficent can't be negative
step_size can't be negative
stiffness can't be negative
time_limit can't be negative
Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravity
kstiffness of the spring
Aoinitial acceleration
Voinitial velocity
FIFI constant which will be added to the (wt) inside the sine calculation
time_limitthe time when the simulation will stop
step_sizehow much the simulation will skip per iteration
damping_coefficentdamping factor affecting on the system
number_of_files
Returns

◆ _execution_time_damped_os_parallel_mpi_omp()

int _execution_time_damped_os_parallel_mpi_omp ( 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 calculate the 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 MPI and Openmp together, The Number of iteration are divided upon number of processes using MPI, while each processes is calculating its values Openmp used to run the calculations per process in parallel way

Warning
don't set gravity less than 0.
if max_amplitude is greater than the length the max_amplitude automatically set to the length value
mass can't be negative
length can't be negative
damping_coefficent can't be negative
step_size can't be negative
stiffness can't be negative
time_limit can't be negative
Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravity
kstiffness of the spring
Aoinitial acceleration
Voinitial velocity
FIFI constant which will be added to the (wt) inside the sine calculation
time_limitthe time when the simulation will stop
step_sizehow much the simulation will skip per iteration
damping_coefficentdamping factor affecting on the system
number_of_files
Returns

◆ _execution_time_damped_os_parallel_omp()

double _execution_time_damped_os_parallel_omp ( 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,
int  num_of_threads 
)

This function calculate execution time 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 Openmp, The for loop is divided upon multiple threads.

Note
tried using sections pragma ended up applying more overhead in the code so performance decreased
Warning
don't set gravity less than 0.
if max_amplitude is greater than the length the max_amplitude automatically set to the length value
mass can't be negative
length can't be negative
damping_coefficent can't be negative
step_size can't be negative
stiffness can't be negative
time_limit can't be negative
Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravity
kstiffness of the spring
Aoinitial acceleration
Voinitial velocity
FIFI constant which will be added to the (wt) inside the sine calculation
time_limitthe time when the simulation will stop
step_sizehow much the simulation will skip per iteration
damping_coefficentdamping factor affecting on the system
number_of_files
num_of_threadsnumber of threads needed to execute the code
Returns

◆ _simulate_damped_os_parallel_mpi()

char * _simulate_damped_os_parallel_mpi ( 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 MPI, The Number of iteration are divided upon number of processes using MPI.

Warning
don't set gravity less than 0.
if max_amplitude is greater than the length the max_amplitude automatically set to the length value
mass can't be negative
length can't be negative
damping_coefficent can't be negative
step_size can't be negative
stiffness can't be negative
time_limit can't be negative
Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravity
kstiffness of the spring
Aoinitial acceleration
Voinitial velocity
FIFI constant which will be added to the (wt) inside the sine calculation
time_limitthe time when the simulation will stop
step_sizehow much the simulation will skip per iteration
damping_coefficentdamping factor affecting on the system
number_of_files
Returns

◆ _simulate_damped_os_parallel_mpi_omp()

char * _simulate_damped_os_parallel_mpi_omp ( 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 
)

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 MPI and Openmp together, The Number of iteration are divided upon number of processes using MPI, while each processes is calculating its values Openmp used to run the calculations per process in parallel way

Warning
don't set gravity less than 0.
if max_amplitude is greater than the length the max_amplitude automatically set to the length value
mass can't be negative
length can't be negative
damping_coefficent can't be negative
step_size can't be negative
stiffness can't be negative
time_limit can't be negative
Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravity
kstiffness of the spring
Aoinitial acceleration
Voinitial velocity
FIFI constant which will be added to the (wt) inside the sine calculation
time_limitthe time when the simulation will stop
step_sizehow much the simulation will skip per iteration
damping_coefficentdamping factor affecting on the system
number_of_files
Returns
integer value 0 if the program executes without any errors -1 if there is an error occurred during calculations