Git Product home page Git Product logo

patrickwelsh878 / binarybody Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 24.89 MB

An N-body simulation comparison application forming the basis of my final year Honours project for the BSc (Hons) Computing degree program.

License: MIT License

Python 96.73% Batchfile 0.01% Cython 0.42% C 2.02% C++ 0.45% Fortran 0.04% PowerShell 0.10% JavaScript 0.13% CSS 0.02% HTML 0.07%
python simulation bachelors-degree honours honours-project nbody-simulation

binarybody's Introduction

BinaryBodyLogo

BinaryBody

BinaryBody is an N-body simulation comparison application forming the basis of my final year Honours project. The application is built in Python 3.9, is CLI-based and allows the user to compare a naive Pairwise Interaction Algorithm and Barnes-Hut Quadtree against one another. The number of bodies can be entered by the user via a prompt. This applies to both simulations.

Getting Started

Run your first simulation

Run the following script:

main.py

If main.py is running into any issues regarding the libraries installed to the venv, you may need to re-install them from "requirements.txt". This can be done via the following:

Install libraries from requirements.txt

pip install -r requirements.txt

If this doesn't work, use this

pip3 install -r requirements.txt

Choose your simulation

When this is done, you can choose to run either the:
UNTHREADED Pairwise Algorithm simulation, by selection option "1"
THREADED Pairwise Algorithm simulation, by selection option "2"
UNTHREADED Barnes-Hut Quadtree simulation by selecting option "3"
THREADED Barnes-Hut Quadtree simulation by selecting option "4"

Virtual Environment (venv) Activation

Both simulations when executed will activate the virtual environment (venv) contained within:

venv/Scripts/activate.bat

Upon execution of the chosen simulation

When the Pairwise or Barnes-Hut simulations are executed, the venv will activate. The user will then be prompted to enter the number of bodies to insert into the simulation. The program will display how long it has taken that particular simulation to run in it's entirety, with the specified number of bodies, as well as how long it has spent on each section/function within that script. Once this has been done, the program will close.

Running a new simulation

If the user wishes to run another simulation, they will need to execute main.py again.

Deactivate virtual environment

Once the user is done, execute main.py again and select option "5" to deactivate the virtual environment (venv).

Things to note

While main.py needs to be executed every time the user wants to run a new simulation, which activates the virtual environment (venv), as well as when they want to deactivate the virtual environment (venv), this is to avoid using "while(1)" to keep the script active. This is because it is not advisable to use it in real-world scenarios because it increases the CPU usage while also potentially blocking the code.

binarybody's People

Contributors

patrickwelsh878 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.