Computational Science Based on HPC
Functions
physics.h File Reference

This file contains collection of all simulations calls. More...

Go to the source code of this file.

Functions

char * 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)
 function simulates simple harmonic motion (Simple Spring Motion).
 
char * damped_os_parallel_v1 (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).
 
char * damped_os_parallel_v2 (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 * 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)
 function simulates the motion of (elastic pendulum/2D-spring/spring pendulum) system.
 
double damped_os_parallel_execution_time_v1 (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).
 
double damped_os_parallel_execution_time_v2 (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 execution time simulating simple harmonic motion (Simple Spring Motion).
 
double damped_os_parallel_execution_time_v3 (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).
 
char * damped_os_serial_execution (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 * elastic_pendulum_execution (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.
 
int heat_equation_1D_P1_MPI (double time_step, double time_limit, double space_step, long long precision)
 This is a function that simulates the heat transfer in 1D object as wire, and each core writes the result to a separate file.
 
int heat_equation_1D_P1_OPENMP (double time_step, double time_limit, double space_step, long long precision)
 This is a function that simulates the heat transfer in 1D object as wire, and writes the result to a file.
 
int heat_equation_2D_P1_MPI (double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
 This is a function that simulates the heat transfer in 2D object, and each core writes the result to a separate file.
 
int heat_equation_2D_P1_OPENMP (double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
 This is a function that simulates the heat transfer in 2D object, and each core writes the result to a separate file.
 
char * heat_equation_1D_serial (double time_step, double time_limit, double space_step, long long precision)
 This is a function that simulates the heat transfer in 1D object as wire, and write the result to a file.
 
char * heat_equation_2D_serial (double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
 This is a function that simulates the heat transfer in 2D object, and write the result to a file.
 
double heat_equation_execution_time_1D_P1_MPI (double time_step, double time_limit, double space_step, long long precision)
 This is a function that simulates the heat transfer in 1D object as wire, and return the execution time without I/O.
 
double heat_equation_execution_time_1D_P1_OPENMP (double time_step, double time_limit, double space_step, long long precision)
 This is a function that simulates the heat transfer in 1D object as wire, and return the execution time without I/O.
 
double heat_equation_execution_time_2D_P1_MPI (double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
 This is a function that simulates the heat transfer in 2D object, and return the execution time without I/O.
 
double heat_equation_execution_time_2D_P1_OPENMP (double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
 This is a function that simulates the heat transfer in 2D object, and return the execution time without I/O.
 
double heat_equation_execution_time_1D_serial (double time_step, double time_limit, double space_step, long long precision)
 This is a function that simulates the heat transfer in 1D object as wire, and return the execution time without I/O.
 
double heat_equation_execution_time_2D_serial (double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
 This is a function that simulates the heat transfer in 2D object, and return the execution time without I/O.
 
void finalize ()
 finalize the MPI and de-allocate the resources.
 

Detailed Description

This file contains collection of all simulations calls.

Function Documentation

◆ damped_os_parallel_execution_time_v1()

double damped_os_parallel_execution_time_v1 ( 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

Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravitygravity of the system
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_fileswill be removed in next update
Returns
Example:
#include "physics.h"
int main(void) {
damped_os_parallel_execution_time_v1(10.0, 14.0, 1.0, 9.8, 1.0, -1.0, 0.0,-0.1, 40000000, 0.01, 0.1, 3);
return 0;
}
This file contains collection of all simulations calls.
double damped_os_parallel_execution_time_v1(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...

◆ damped_os_parallel_execution_time_v2()

double damped_os_parallel_execution_time_v2 ( 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 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.

Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravitygravity of the system
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_fileswill be removed in next update
Returns
Example:
#include "physics.h"
int main(void) {
damped_os_parallel_execution_time_v2(10.0, 14.0, 1.0, 9.8, 1.0, -1.0, 0.0,-0.1, 40000000, 0.01, 0.1, 3);
return 0;
}
double damped_os_parallel_execution_time_v2(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 execution time simulating simple harmonic motion (Simple Spring Motion).

◆ damped_os_parallel_execution_time_v3()

double damped_os_parallel_execution_time_v3 ( 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
Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravitygravity of the system
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_fileswill be removed in next update
num_of_threadsnumber of threads needed to execute the code
Returns
Example:
#include "physics.h"
int main(void) {
damped_os_parallel_execution_time_v3(10.0, 14.0, 1.0, 9.8, 1.0, -1.0, 0.0,-0.1, 40000000, 0.01, 0.1, 3);
return 0;
}
double damped_os_parallel_execution_time_v3(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).

◆ damped_os_parallel_v1()

char * damped_os_parallel_v1 ( 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

Output of this simulation will be resulted in file named "PROCESS-RANK_damped_os_parallel_v1_displacement_YYYY-MM-DD HH:MM:SS.txt"

Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravitygravity of the system
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_fileswill be removed in next update
Returns
Example:
#include "physics.h"
int main(void) {
damped_os_parallel_v1(10.0, 14.0, 1.0, 9.8, 1.0, -1.0, 0.0,-0.1, 40000000, 0.01, 0.1, 3);
return 0;
}
char * damped_os_parallel_v1(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).

◆ damped_os_parallel_v2()

char * damped_os_parallel_v2 ( 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.

Output of this simulation will be resulted in file named "PROCESS-RANK_damped_os_parallel_v2_displacement_YYYY-MM-DD HH:MM:SS.txt"

Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravitygravity of the system
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_fileswill be removed in next update
Returns
Example:
#include "physics.h"
int main(void) {
damped_os_parallel_v2(10.0, 14.0, 1.0, 9.8, 1.0, -1.0, 0.0,-0.1, 40000000, 0.01, 0.1, 3);
return 0;
}
char * damped_os_parallel_v2(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).

◆ damped_os_serial()

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

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

Output of this simulation will be resulted in file named "damped_os_serial_displacement_YYYY-MM-DD HH:MM:SS.txt"

Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravitygravity of the system
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_fileswill be removed in next update
Returns

Example:

#include "physics.h"
int main(void) {
damped_os_serial(10.0, 14.0, 1.0, 9.8, 1.0, -1.0, 0.0,-0.1, 40000000, 0.01, 0.1, 3);
return 0;
}
char * 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)
function simulates simple harmonic motion (Simple Spring Motion).

◆ damped_os_serial_execution()

char * damped_os_serial_execution ( 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

Parameters
max_amplitudestarting position of the mass where the simulation will start
lengththe maximum length of the spring (uncompressed spring)
massmass of bob
gravitygravity of the system
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_fileswill be removed in next update
Returns
Example:
#include "physics.h"
int main(void) {
damped_os_serial_execution(10.0, 14.0, 1.0, 9.8, 1.0, -1.0, 0.0,-0.1, 40000000, 0.01, 0.1, 3);
return 0;
}
char * damped_os_serial_execution(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).

◆ elastic_pendulum()

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

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.

Output of this simulation will be resulted in file named "elastic_pendulum_x_YYYY-MM-DD HH:MM:SS.txt" and "elastic_pendulum_y_YYYY-MM-DD HH:MM:SS.txt"

Parameters
rrest length of spring
lengthmax length of spring
massmass of bob suspended in spring
gravitygravity of the system
kstiffness of spring
Aoinitial acceleration
Xoinitial point on X-axis where simulation starts
Yoinitial point on Y-axis where simulation starts
Voinitial velocity
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_fileswill be removed in next update
Returns
Example:
#include "physics.h"
int main(void) {
elastic_pendulum(2.0, 5.0, 0.5, 9.81, 0.005, 0, 2.0, 0.0, 0, 100000, 0.01, 0, 3)
return 0;
}
char * 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)
function simulates the motion of (elastic pendulum/2D-spring/spring pendulum) system.

◆ elastic_pendulum_execution()

char * elastic_pendulum_execution ( 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.

Parameters
rrest length of spring
lengthmax length of spring
massmass of bob suspended in spring
gravitygravity of the system
kstiffness of spring
Aoinitial acceleration
Xoinitial point on X-axis where simulation starts
Yoinitial point on Y-axis where simulation starts
Voinitial velocity
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_fileswill be removed in next update
Returns
Example:
#include "physics.h"
int main(void) {
elastic_pendulum_execution(2.0, 5.0, 0.5, 9.81, 0.005, 0, 2.0, 0.0, 0, 100000, 0.01, 0, 3)
return 0;
}
char * elastic_pendulum_execution(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/s...

◆ finalize()

void finalize ( )

finalize the MPI and de-allocate the resources.

Warning
This function must be called after using any collection of MPI based functions

Example:

#include "physics.h"
int main(void) {
damped_os_parallel_execution_time_v2(10.0, 14.0, 1.0, 9.8, 1.0, -1.0, 0.0,-0.1, 40000000, 0.01, 0.1, 3);
damped_os_parallel_execution_time_v1(10.0, 14.0, 1.0, 9.8, 1.0, -1.0, 0.0,-0.1, 40000000, 0.01, 0.1, 3);
damped_os_parallel_execution_time_v3(10.0, 14.0, 1.0, 9.8, 1.0, -1.0, 0.0,-0.1, 40000000, 0.01, 0.1, 3);
return 0;
}
void finalize()
finalize the MPI and de-allocate the resources.

◆ heat_equation_1D_P1_MPI()

int heat_equation_1D_P1_MPI ( double  time_step,
double  time_limit,
double  space_step,
long long  precision 
)

This is a function that simulates the heat transfer in 1D object as wire, and each core writes the result to a separate file.

In this simulation, we simulate heat propagation in 1D object as wire and the change in its tempreture over time using fourier transform. Then we parallelize the function using MPI, as we divide the object into equal parts and each core calculates the temperature of its part.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_stepThe rate of change of the space.
precisionThe number of vectors we use in the calculations.
Returns
0 if there is no error happened interrupted the calculations, each core writes the output to text file named simulate_heat_transfer_1D_MPI_"core num"_ + current time, the row represent the time, and the column represent the temperature at this point at that time.

Example:

#include "physics.h"
int main(void) {
heat_equation_1D_P1_MPI(0.01, 0.5, 0.05, 50);
return 0;
}
int heat_equation_1D_P1_MPI(double time_step, double time_limit, double space_step, long long precision)
This is a function that simulates the heat transfer in 1D object as wire, and each core writes the re...

◆ heat_equation_1D_P1_OPENMP()

int heat_equation_1D_P1_OPENMP ( double  time_step,
double  time_limit,
double  space_step,
long long  precision 
)

This is a function that simulates the heat transfer in 1D object as wire, and writes the result to a file.

In this simulation, we simulate heat propagation in 1D object as wire and the change in its tempreture over time using fourier transform. Then, we parallelize the function using OPENMP, as we provide specific number of threads and make the iterations of the loop are divided into equal-sized chunks, and each chunk is assigned to a thread. Then, we write the result to a file.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_stepThe rate of change of the space.
precisionThe number of vectors we use in the calculations.
Returns
0 if there is no error happened interrupted the calculations, writes the output to text file named simulate_heat_transfer_1D_OPENMP_ + current time, the row represent the time, and the column represent the temperature at this point at that time.

Example:

#include "physics.h"
int main(void) {
heat_equation_1D_P1_OPENMP(0.01, 0.5, 0.05, 50);
return 0;
}
int heat_equation_1D_P1_OPENMP(double time_step, double time_limit, double space_step, long long precision)
This is a function that simulates the heat transfer in 1D object as wire, and writes the result to a ...

◆ heat_equation_1D_serial()

char * heat_equation_1D_serial ( double  time_step,
double  time_limit,
double  space_step,
long long  precision 
)

This is a function that simulates the heat transfer in 1D object as wire, and write the result to a file.

In this simulation, we simulate heat propagation in 1D object as wire and the change in its tempreture over time using fourier transform.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_stepThe rate of change of the space.
precisionThe number of vectors we use in the calculations.
Returns
0 if there is no error happened interrupted the calculations, and write the output to text file named simulate_heat_transfer_1D_serial_ + current time, the row represent the time, and the column represent the temperature at this point at that time. Example:
#include "physics.h"
int main(void) {
heat_equation_1D_serial(0.01, 0.5, 0.05,50);
return 0;
}
char * heat_equation_1D_serial(double time_step, double time_limit, double space_step, long long precision)
This is a function that simulates the heat transfer in 1D object as wire, and write the result to a f...

◆ heat_equation_2D_P1_MPI()

int heat_equation_2D_P1_MPI ( double  time_step,
double  time_limit,
double  spaceX_step,
double  spaceY_step,
long long  precision 
)

This is a function that simulates the heat transfer in 2D object, and each core writes the result to a separate file.

In this simulation, we simulate heat propagation in 2D object as square or rectangle and the change in its tempreture over time using fourier transform. Then we parallelize the function using MPI, as we divide the object into equal parts and each core calculates the temperature of its part.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_step_xThe rate of change of the space in x-axis.
space_step_yThe rate of change of the space in y-axis.
precisionThe number of vectors we use in the calculations.
Returns
0 if there is no error happened interrupted the calculations, and write the output to text file named simulate_heat_transfer_2D_MPI_"core num"_ + current time, the output file contains paragraphs each one represent the time slot, each row represent the temperature at this point of the 2D object on x-axis (length), and the column represent the temperature at this point at that time on y-axis (width). The number of rows in each paragraph (time slot) equals length* space_step_x, and the number of columns equals width* space_step_y.

Example:

#include "physics.h"
int main(void) {
heat_equation_2D_P1_MPI(0.1, 5, 0.1, 0.1, 50);
return 0;
}
int heat_equation_2D_P1_MPI(double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
This is a function that simulates the heat transfer in 2D object, and each core writes the result to ...

◆ heat_equation_2D_P1_OPENMP()

int heat_equation_2D_P1_OPENMP ( double  time_step,
double  time_limit,
double  spaceX_step,
double  spaceY_step,
long long  precision 
)

This is a function that simulates the heat transfer in 2D object, and each core writes the result to a separate file.

In this simulation, we simulate heat propagation in 2D object as square or rectangle and the change in its tempreture over time using fourier transform. Then, we parallelize the function using OPENMP, as we provide specific number of threads and make the iterations of the loop are divided into equal-sized chunks, and each chunk is assigned to a thread. Then, we write the result to a file.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_step_xThe rate of change of the space in x-axis.
space_step_yThe rate of change of the space in y-axis.
precisionThe number of vectors we use in the calculations.
Returns
0 if there is no error happened interrupted the calculations, and write the output to text file named simulate_heat_transfer_2D_OPENMP_ + current time, the output file contains paragraphs each one represent the time slot, each row represent the temperature at this point of the 2D object on x-axis (length), and the column represent the temperature at this point at that time on y-axis (width). The number of rows in each paragraph (time slot) equals length* space_step_x, and the number of columns equals width* space_step_y.

Example:

#include "physics.h"
int main(void) {
heat_equation_2D_P1_OPENMP(0.1, 5, 0.1, 0.1, 50);
return 0;
}
int heat_equation_2D_P1_OPENMP(double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
This is a function that simulates the heat transfer in 2D object, and each core writes the result to ...

◆ heat_equation_2D_serial()

char * heat_equation_2D_serial ( double  time_step,
double  time_limit,
double  spaceX_step,
double  spaceY_step,
long long  precision 
)

This is a function that simulates the heat transfer in 2D object, and write the result to a file.

In this simulation, we simulate heat propagation in 2D object as square or rectangle and the change in its tempreture over time using fourier transform.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_step_xThe rate of change of the space in x-axis.
space_step_yThe rate of change of the space in y-axis.
precisionThe number of vectors we use in the calculations.
Returns
0 if there is no error happened interrupted the calculations, and write the output to text file named simulate_heat_transfer_2D_serial_ + current time, the output file contains paragraphs each one represent the time slot, each row represent the temperature at this point of the 2D object on x-axis (length), and the column represent the temperature at this point at that time on y-axis (width). The number of rows in each paragraph (time slot) equals length* space_step_x, and the number of columns equals width* space_step_y.

Example:

#include "physics.h"
int main(void) {
heat_equation_2D_serial(0.1, 5, 0.1, 0.1,50);
return 0;
}
char * heat_equation_2D_serial(double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
This is a function that simulates the heat transfer in 2D object, and write the result to a file.

◆ heat_equation_execution_time_1D_P1_MPI()

double heat_equation_execution_time_1D_P1_MPI ( double  time_step,
double  time_limit,
double  space_step,
long long  precision 
)

This is a function that simulates the heat transfer in 1D object as wire, and return the execution time without I/O.

In this simulation, we simulate heat propagation in 1D object as wire and the change in its tempreture over time using fourier transform. Then we parallelize the function using MPI, as we divide the object into equal parts and each core calculates the temperature of its part. Then, we return the execution time without I/O.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_stepThe rate of change of the space.
precisionThe number of vectors we use in the calculations.
Returns
execution time without I/O.

Example:

#include "physics.h"
int main(void) {
return 0;
}
double heat_equation_execution_time_1D_P1_MPI(double time_step, double time_limit, double space_step, long long precision)
This is a function that simulates the heat transfer in 1D object as wire, and return the execution ti...

◆ heat_equation_execution_time_1D_P1_OPENMP()

double heat_equation_execution_time_1D_P1_OPENMP ( double  time_step,
double  time_limit,
double  space_step,
long long  precision 
)

This is a function that simulates the heat transfer in 1D object as wire, and return the execution time without I/O.

In this simulation, we simulate heat propagation in 1D object as wire and the change in its tempreture over time using fourier transform. Then, we parallelize the function using OPENMP, as we provide specific number of threads and make the iterations of the loop are divided into equal-sized chunks, and each chunk is assigned to a thread. Then, return the execution time without I/O.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_stepThe rate of change of the space.
precisionThe number of vectors we use in the calculations.
Returns
execution time without I/O. Example:
#include "physics.h"
int main(void) {
return 0;
}
double heat_equation_execution_time_1D_P1_OPENMP(double time_step, double time_limit, double space_step, long long precision)
This is a function that simulates the heat transfer in 1D object as wire, and return the execution ti...

◆ heat_equation_execution_time_1D_serial()

double heat_equation_execution_time_1D_serial ( double  time_step,
double  time_limit,
double  space_step,
long long  precision 
)

This is a function that simulates the heat transfer in 1D object as wire, and return the execution time without I/O.

In this simulation, we simulate heat propagation in 1D object as wire and the change in its tempreture over time using fourier transform.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_stepThe rate of change of the space.
precisionThe number of vectors we use in the calculations.
Returns
execution time without I/O if there is no error happened interrupted the calculations.

Example:

#include "physics.h"
int main(void) {
return 0;
}
double heat_equation_execution_time_1D_serial(double time_step, double time_limit, double space_step, long long precision)
This is a function that simulates the heat transfer in 1D object as wire, and return the execution ti...

◆ heat_equation_execution_time_2D_P1_MPI()

double heat_equation_execution_time_2D_P1_MPI ( double  time_step,
double  time_limit,
double  spaceX_step,
double  spaceY_step,
long long  precision 
)

This is a function that simulates the heat transfer in 2D object, and return the execution time without I/O.

In this simulation, we simulate heat propagation in 2D object as square or rectangle and the change in its tempreture over time using fourier transform. Then we parallelize the function using MPI, as we divide the object into equal parts and each core calculates the temperature of its part. Then, we return the execution time without I/O.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_step_xThe rate of change of the space in x-axis.
space_step_yThe rate of change of the space in y-axis.
precisionThe number of vectors we use in the calculations.
Returns
execution time without I/O.

Example:

#include "physics.h"
int main(void) {
return 0;
}
double heat_equation_execution_time_2D_P1_MPI(double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
This is a function that simulates the heat transfer in 2D object, and return the execution time witho...

◆ heat_equation_execution_time_2D_P1_OPENMP()

double heat_equation_execution_time_2D_P1_OPENMP ( double  time_step,
double  time_limit,
double  spaceX_step,
double  spaceY_step,
long long  precision 
)

This is a function that simulates the heat transfer in 2D object, and return the execution time without I/O.

In this simulation, we simulate heat propagation in 2D object as square or rectangle and the change in its tempreture over time using fourier transform. Then, we parallelize the function using OPENMP, as we provide specific number of threads and make the iterations of the loop are divided into equal-sized chunks, and each chunk is assigned to a thread. Then, return the execution time without I/O.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_step_xThe rate of change of the space in x-axis.
space_step_yThe rate of change of the space in y-axis.
precisionThe number of vectors we use in the calculations.
Returns
the execution time without I/O. Example:
#include "physics.h"
int main(void) {
return 0;
}
double heat_equation_execution_time_2D_P1_OPENMP(double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
This is a function that simulates the heat transfer in 2D object, and return the execution time witho...

◆ heat_equation_execution_time_2D_serial()

double heat_equation_execution_time_2D_serial ( double  time_step,
double  time_limit,
double  spaceX_step,
double  spaceY_step,
long long  precision 
)

This is a function that simulates the heat transfer in 2D object, and return the execution time without I/O.

In this simulation, we simulate heat propagation in 2D object as square or rectangle and the change in its tempreture over time using fourier transform.

Parameters
time_stepThe rate of change of the time.
time_limitThe time that we want to measure the temperature of the object after.
space_step_xThe rate of change of the space in x-axis.
space_step_yThe rate of change of the space in y-axis.
precisionThe number of vectors we use in the calculations.
Returns
execution time without I/O if there is no error happened interrupted the calculations.

Example:

#include "physics.h"
int main(void) {
return 0;
}
double heat_equation_execution_time_2D_serial(double time_step, double time_limit, double spaceX_step, double spaceY_step, long long precision)
This is a function that simulates the heat transfer in 2D object, and return the execution time witho...