Code Monkey home page Code Monkey logo

3d_particle_simulator's Introduction

3D particle simulator

Introduction

This is a software package that can be used to simulate particles' movement within a cube. Considered forces include:

  1. Gravity force
  2. Spring force
  3. Drag force

API

Tunable parameters include:

  1. number of particles (should be an integer's cubic, int)
  2. number of step (number of total step of Verlet integration, int)
  3. filename (output filename, recommend to store inside the prebuilt results directory, str)
  4. test (initial configuration you want to test, including 'equil', 'shift' and 'moving', str)
  5. l (length of the cubic side, double)
  6. time (total time you want to simulate, double)

*Illustration about 3 test configurations: 'equil' means that all the particles are placed uniformly, no change of position should happen. 'shift' means that all the particles are shift towards the positive x direction for half of the equil spacing. ' moving' means that all the particles have the initial velocity towards the positive x direction.

Build instructions

  • In this directory, you can build your main executable with:
g++ --std=c++11 -Iinclude src/*.cpp -o ./run.exe; 
./run.exe -n 27 -nstep 10000 -f results/test1.txt -test shift -l 2 -time 2;

Please store your result.txt under the diectory results.

  • To build and run all the tests:
cd test
g++ --std=c++11 -DTEST -I../include *.cpp -o run_tests.exe; 
./run_tests.exe;
  • To visualize the results
cd util;
conda activate [your_python_environment];
jupyter notebook 3D_Visualization.ipynb

In the 3rd block of 3D_Visualization.ipynb, please specify the filename of your results in the results directory and cbrtN which is the number of particle in each dimension(including the fixed ones). Then run the whole code and you can see the results at the bottom of this file.

3d_particle_simulator's People

Contributors

chrizzhuang 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.