All Projects → nepluno → apic2d

nepluno / apic2d

Licence: Apache-2.0 license
Affine Particle-in-Cell Water Simulation in 2D

Programming Languages

C++
36643 projects - #6 most used programming language
Cuda
1817 projects

Projects that are alternatives of or similar to apic2d

Torque
2d 纯计算高性能刚体物理引擎
Stars: ✭ 62 (-21.52%)
Mutual labels:  physics-simulation, physics-2d
RaiSimUnity
A visualizer for RaiSim based on Unity
Stars: ✭ 31 (-60.76%)
Mutual labels:  physics-simulation
btogre
Now in the main repository as Component
Stars: ✭ 13 (-83.54%)
Mutual labels:  physics-simulation
Py3ODE
Port of PyODE for Python 3
Stars: ✭ 29 (-63.29%)
Mutual labels:  physics-simulation
GateContrib
User-oriented public repository of Gate (macros, examples and user contributions)
Stars: ✭ 57 (-27.85%)
Mutual labels:  physics-simulation
creative-coding-notebooks
🎨 An authorial collection of fundamental recipes on Creative Coding and Recreational Programming.
Stars: ✭ 17 (-78.48%)
Mutual labels:  physics-simulation
balldrop
An experimental musical instrument, made with Godot 3.1.
Stars: ✭ 29 (-63.29%)
Mutual labels:  physics-simulation
SpinMC.jl
Classical Monte Carlo simulations for lattice spin systems
Stars: ✭ 18 (-77.22%)
Mutual labels:  physics-simulation
Libbulletjme
A JNI interface to Bullet Physics and V-HACD
Stars: ✭ 55 (-30.38%)
Mutual labels:  physics-simulation
ispd2021
This the contains the test examples and validator tool for the ISPD2021 Wafer-Scale Physics Modeling contest.
Stars: ✭ 16 (-79.75%)
Mutual labels:  physics-simulation
mdgrad
Pytorch differentiable molecular dynamics
Stars: ✭ 127 (+60.76%)
Mutual labels:  physics-simulation
Messier87
A realtime raytracing blackhole renderer
Stars: ✭ 53 (-32.91%)
Mutual labels:  physics-simulation
spritekit-water-node
🌊 Custom SpriteKit node that allows to simulate 2D water with respect to physics. The app demonstrates Flocking behaviour using GameplayKit, key-frame animation and custom fragment shader chaining (GLSL) 🤯
Stars: ✭ 82 (+3.8%)
Mutual labels:  water-simulation
gopem
GUI for OPEM library
Stars: ✭ 20 (-74.68%)
Mutual labels:  physics-simulation
ipc-toolkit
A set of reusable functions to integrate IPC into an existing simulation.
Stars: ✭ 84 (+6.33%)
Mutual labels:  physics-simulation
2050
2048, but round!
Stars: ✭ 20 (-74.68%)
Mutual labels:  physics-simulation
Ockero
Ockero: Kotlin OpenGl Game Engine
Stars: ✭ 67 (-15.19%)
Mutual labels:  physics-2d
d3-force-surface
A multi-surface elastic collision force type for the d3-force simulation engine
Stars: ✭ 19 (-75.95%)
Mutual labels:  physics-simulation
SolidStateDetectors.jl
Solid state detector field and charge drift simulation in Julia
Stars: ✭ 51 (-35.44%)
Mutual labels:  poisson-equation
Natrix
Fast fluid simulation in Python 🐍
Stars: ✭ 25 (-68.35%)
Mutual labels:  navier-stokes

Affine Particle in Cell in 2D

Screenshot APIC2D is an educational project to illustrate the affine-particle-in-cell algorithm in 2D for water simulation. The code can be compiled and run on Windows, Mac OS X (either Intel or Apple Silicon), Linux, and webpage (through WASM, or WebAssembly). It is well-optimized. For the default setting, the simulation runs in real-time on an iPad mini 6.

The papers implemented here include:

Jiang, Chenfanfu, et al. "The affine particle-in-cell method." ACM Transactions on Graphics (TOG) 34.4 (2015): 51.

Batty, Christopher, Florence Bertails, and Robert Bridson. "A fast variational framework for accurate solid-fluid coupling." ACM Transactions on Graphics (TOG). Vol. 26. No. 3. ACM, 2007.

Ando, Ryoichi, Nils Thurey, and Reiji Tsuruno. "Preserving fluid sheets with adaptively sampled anisotropic particles." IEEE transactions on visualization and computer graphics 18.8 (2012): 1202-1214.

Brackbill, Jeremiah U., and Hans M. Ruppel. "FLIP: A method for adaptively zoned, particle-in-cell calculations of fluid flows in two dimensions." Journal of Computational physics 65.2 (1986): 314-343.

Fei, Yun (Raymond), et al. "Revisiting Integration in the Material Point Method: A Scheme for Easier Separation and Less Dissipation." ACM Transactions on Graphics (TOG) 40.4 (2021): 109.

It contains multiple integrators that you may switch and compare through changing the integration_scheme variable in the code. Its value can be one of the following:

IT_PIC: original particle-in-cell (PIC)
IT_FLIP: original fluid-implicit-particle (FLIP)
IT_RPIC: rotational particle-in-cell (RPIC)
IT_APIC: affine particle-in-cell (APIC)
IT_AFLIP: affine fluid-implicit-particle (AFLIP)
IT_ASFLIP: affine separable fluid-implicit-particle (ASFLIP)

It also supports using different orders for velocity evaluation, where one may change the velocity_order variable in the code. Its value can be one of the following:

VO_EULER: first order evaluation
VO_RA2: Ralston's second order evaluation
VO_RK3: Runge Kutta's 3rd-order method
VO_RK4: Runge Kutta's 4rd-order method

Dependencies

APIC2D depends on the Eigen libraries (included), TBB (optional but provides the best performance), and GLUT/FreeGLUT for simple visualization.

For Windows or WASM, CMake should automatically handle the dependencies. For Mac OS X, TBB needs to be installed, which can be done with Homebrew. For Ubuntu Linux, you may use the APT package handling utility to install these dependencies.

Compilation

To compile APIC2D, you'll need CMake or CMake-GUI (https://cmake.org). Additionally, for WASM, please follow the documentation of Emscripten SDK.

CMake:

  1. make a directory, say, build, with mkdir build
  2. enter the build directory. For Desktop, type cmake .. (or cmake -G Xcode .. to generate Xcode project files on Mac; for Windows please use cmake -G <generator> .. to use the specific generators, or simply type cmake -G to list all the available generators). For WASM type emcmake cmake ...
  3. Optionally you can adjust the options with ccmake .
  4. type make to compile the code. You may use make -j to speed up the compilation process.

CMake-GUI:

  1. open CMake-GUI, enter the correct directory for source code, and build. Then click Configure, choose the generator (for Windows, select the installed version of the Microsoft Visual Studio).
  2. CMake should automatically find all the dependencies. If not, check the Advanced box and locate those missing libraries manually. On Windows, please make sure you have picked the libraries corresponding to the architecture you have selected (say, 32-bit libraries for x86 and 64-bit libraries for x64).
  3. click generate after fixing all missing variables.
  4. open the solution (for Visual Studio or Xcode) and compile the code.

User Interface

Press <LMB> (or finger touch on a mobile device) and drag directly on the simulated region to paint velocities.

Press <shift> with mouse buttons to move the camera.

  1. Pan: <shift>+<LMB>
  2. Zoom-in (drag to mark the region): <shift>+<MMB>
  3. Zoom-out: <shift>+<RMB>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].