rlguy / gridfluidsim3d Goto Github PK
View Code? Open in Web Editor NEWA PIC/FLIP fluid simulation based on the methods found in Robert Bridson's "Fluid Simulation for Computer Graphics"
License: zlib License
A PIC/FLIP fluid simulation based on the methods found in Robert Bridson's "Fluid Simulation for Computer Graphics"
License: zlib License
I built the project with VS2015 x64, when running the basic example (image1) it crashed, error shows that the vector subscript out of range. I watched the stack it shows that the error is acurred by the function of what I showed in image2 and seems it caused by the variable buffer.pointDataH[0] since the size of the pointDataH is 0. I don't know how to fix it, could you help me?
image1 code of basic example code
image2 error loaction
hey when trying to make i get this
Documents/GridFluidSim3D/build master ✗ 850d ◒ ▶ make Scanning dependencies of target objects [ 2%] Building CXX object CMakeFiles/objects.dir/src/aabb.cpp.o [ 4%] Building CXX object CMakeFiles/objects.dir/src/anisotropicparticlemesher.cpp.o [ 6%] Building CXX object CMakeFiles/objects.dir/src/c_bindings/cbindings.cpp.o [ 9%] Building CXX object CMakeFiles/objects.dir/src/c_bindings/config_c.cpp.o [ 11%] Building CXX object CMakeFiles/objects.dir/src/c_bindings/cuboidfluidsource_c.cpp.o [ 13%] Building CXX object CMakeFiles/objects.dir/src/c_bindings/fluidsimulation_c.cpp.o In file included from /home/jacos/Documents/GridFluidSim3D/src/c_bindings/../clscalarfield.h:37, from /home/jacos/Documents/GridFluidSim3D/src/c_bindings/../fluidsimulation.h:32, from /home/jacos/Documents/GridFluidSim3D/src/c_bindings/fluidsimulation_c.cpp:1: /opt/cuda/include/CL/cl.hpp:5085:28: warning: ignoring attributes on template argument ‘cl_int’ {aka ‘int’} [-Wignored-attributes] 5085 | VECTOR_CLASS<cl_int>* binaryStatus = NULL, | ^ In file included from /home/jacos/Documents/GridFluidSim3D/src/c_bindings/../clscalarfield.h:56, from /home/jacos/Documents/GridFluidSim3D/src/c_bindings/../fluidsimulation.h:32, from /home/jacos/Documents/GridFluidSim3D/src/c_bindings/fluidsimulation_c.cpp:1: /home/jacos/Documents/GridFluidSim3D/src/c_bindings/../arrayview3d.h: In member function ‘void ArrayView3d<T>::getViewAsArray3d(Array3d<T>&)’: /home/jacos/Documents/GridFluidSim3D/src/c_bindings/../arrayview3d.h:192:16: error: return-statement with a value, in function returning ‘void’ [-fpermissive] 192 | return view; | ^~~~ make[2]: *** [CMakeFiles/objects.dir/build.make:128: CMakeFiles/objects.dir/src/c_bindings/fluidsimulation_c.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:107: CMakeFiles/objects.dir/all] Error 2 make: *** [Makefile:84: all] Error 2
I suggest to reuse a higher level build system than your current small make file so that powerful checks for software features will become easier.
Hello Ryan,
I compiled successfully, but when I run I get the following error:
Frame: 0
StepTime: 0.0333
Update Fluid Cells: 0
Num Fluid Cells: 95767
Num Marker Particles: 735903
Reconstruct Fluid Surface: 0
Update Level set: 0
Reconstruct Output Surface: 0
ERROR: Creating position data buffer (-37)
fluidsim: src/clscalarfield.cpp:423: void CLScalarField::_checkError(cl_int, const char*): Assertion `err == 0' failed.
Aborted (core dumped)
I compiled on Ubuntu 15.10 with nvidia opencl 352
Unfortunately that is all the info I can give.
Hi
Can you please give any hints on resolving the issue below while running make.
I'm using Fedora 22 64 bit, l have nvidia cuda installed, as well as the intel OpenCLSDK installed.
Had this same issue/stuck error on Ubuntu.
Thanks
Stephen
g++ -O3 -std=c++11 -Wall -c -o src/fluidsimulationsavestate.o src/fluidsimulationsavestate.cpp
g++ -O3 -std=c++11 -Wall -c -o src/fluidsource.o src/fluidsource.cpp
g++ -O3 -std=c++11 -Wall -c -o src/gridindexkeymap.o src/gridindexkeymap.cpp
g++ -O3 -std=c++11 -Wall -c -o src/gridindexvector.o src/gridindexvector.cpp
g++ -O3 -std=c++11 -Wall -c -o src/implicitpointprimitive.o src/implicitpointprimitive.cpp
g++ -O3 -std=c++11 -Wall -c -o src/implicitsurfacescalarfield.o src/implicitsurfacescalarfield.cpp
g++ -O3 -std=c++11 -Wall -c -o src/interpolation.o src/interpolation.cpp
g++ -O3 -std=c++11 -Wall -c -o src/isotropicparticlemesher.o src/isotropicparticlemesher.cpp
In file included from src/isotropicparticlemesher.h:28:0,
from src/isotropicparticlemesher.cpp:20:
src/fragmentedvector.h: In instantiation of ‘bool FragmentedVector::_isLastNode(int) [with T = vmath::vec3]’:
src/fragmentedvector.h:104:19: required from ‘void FragmentedVector::push_back(T) [with T = vmath::vec3]’
src/isotropicparticlemesher.cpp:217:56: required from here
src/fragmentedvector.h:305:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
return i == _nodes.size() - 1;
^
g++ -O3 -std=c++11 -Wall -c -o src/levelset.o src/levelset.cpp
g++ -O3 -std=c++11 -Wall -c -o src/logfile.o src/logfile.cpp
g++ -O3 -std=c++11 -Wall -c -o src/macvelocityfield.o src/macvelocityfield.cpp
g++ -O3 -std=c++11 -Wall -c -o src/main.o src/main.cpp
g++ -O3 -std=c++11 -Wall -c -o src/particleadvector.o src/particleadvector.cpp
g++ -O3 -std=c++11 -Wall -c -o src/polygonizer3d.o src/polygonizer3d.cpp
g++ -O3 -std=c++11 -Wall -c -o src/pressuresolver.o src/pressuresolver.cpp
g++ -O3 -std=c++11 -Wall -c -o src/spatialpointgrid.o src/spatialpointgrid.cpp
g++ -O3 -std=c++11 -Wall -c -o src/sphericalfluidsource.o src/sphericalfluidsource.cpp
g++ -O3 -std=c++11 -Wall -c -o src/stopwatch.o src/stopwatch.cpp
g++ -O3 -std=c++11 -Wall -c -o src/trianglemesh.o src/trianglemesh.cpp
g++ -O3 -std=c++11 -Wall -c -o src/turbulencefield.o src/turbulencefield.cpp
g++ -O3 -std=c++11 -Wall -c -o src/vmath.o src/vmath.cpp
g++ src/aabb.o src/anisotropicparticlemesher.o src/clscalarfield.o src/collision.o src/cuboidfluidsource.o src/diffuseparticlesimulation.o src/fluidbrickgrid.o src/fluidbrickgridsavestate.o src/fluidmaterialgrid.o src/fluidsimulation.o src/fluidsimulationsavestate.o src/fluidsource.o src/gridindexkeymap.o src/gridindexvector.o src/implicitpointprimitive.o src/implicitsurfacescalarfield.o src/interpolation.o src/isotropicparticlemesher.o src/levelset.o src/logfile.o src/macvelocityfield.o src/main.o src/particleadvector.o src/polygonizer3d.o src/pressuresolver.o src/spatialpointgrid.o src/sphericalfluidsource.o src/stopwatch.o src/trianglemesh.o src/turbulencefield.o src/vmath.o -lOpenCL -o fluidsim
/usr/bin/ld: cannot find -lOpenCL
collect2: error: ld returned 1 exit status
Makefile:59: recipe for target 'fluidsim' failed
make: *** [fluidsim] Error 1
[steve@localhost GFSM]$
my path below
[steve@localhost GFSM]$ $PATH
bash: /etc/OpenCL:/usr/lib64:/usr/local/cuda-7.5/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/steve/.local/bin:/home/steve/bin: No such file or directory
[steve@localhost GFSM]$
Hello there! I'm trying to create a similar project to yours and am trying to test out your project for inspiration!
I am having trouble building for windows. The program itself builds but the bakefiles of the frames only contain the headers, not the actual mesh information. Is this anything you've run into? Is the latest push to github working properly? Thank you for any insights, would love to try and recreate your effect for use in Blender! :)
Looking at the code and doing some printouts shows that the meshes have 0 vertices in them, implying something has gone awry. Testing using NVIDIA graphics card (GeForce RTX 2080 SUPER) and CUDA toolkit for openCL library and header.
Gorgeous work! Hopefully creating an issue here doesn't bug you too much.
Here is a printout when trying to run the lego dambreak:
26-Mar-2021 11h33m37s
Initializing Simulation Grids:
Grid Dimensions: 128 x 128 x 128
Cell Size: 0.0625
Constructing MACVelocityField: 0.125
Constructing FluidMaterialGrid: 0.031
Constructing LevelSet: 0.0629
26-Mar-2021 11h33m37s disableIsotropicSurfaceReconstruction
26-Mar-2021 11h33m37s enableBrickOutput: 0.1875 0.225 0.1875
26-Mar-2021 11h33m37s addImplicitFluidPoint: 4 4 4 5
26-Mar-2021 11h33m37s addFluidCuboid: 0 0 0 8 1 8
26-Mar-2021 11h33m37s addBodyForce: 0 -25 0
26-Mar-2021 11h33m37s initialize
Initializing Simulation:
Initializing Solid Cells: 0
Initializing Fluid Material: 1.5629
Initializing OpenCL Objects: 1.359
OpenCL ParticleAdvector Device Info:
CL_DEVICE_NAME: Intel(R) UHD Graphics 630
CL_DEVICE_VENDOR: Intel(R) Corporation
CL_DEVICE_VERSION: OpenCL 2.1 NEO
CL_DRIVER_VERSION: 27.20.100.8681
CL_DEVICE_OPENCL_C_VERSION: OpenCL C 2.0
CL_DEVICE_TYPE: GPU
CL_DEVICE_MAX_CLOCK_FREQUENCY: 1200MHz
CL_DEVICE_GLOBAL_MEM_SIZE: 1717985280
CL_DEVICE_LOCAL_MEM_SIZE: 65536
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 858992640
CL_DEVICE_MAX_WORK_GROUP_SIZE: 256
CL_DEVICE_MAX_WORK_ITEM_SIZES: 256 x 256 x 256
OpenCL ParticleAdvector Kernel Info:
CL_KERNEL_FUNCTION_NAME: tricubic_interpolate_kernel
CL_KERNEL_ATTRIBUTES:
CL_KERNEL_NUM_ARGS: 3611970751797657605
CL_KERNEL_WORK_GROUP_SIZE: 256
CL_KERNEL_LOCAL_MEM_SIZE: 0
CL_KERNEL_PRIVATE_MEM_SIZE: 0
CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: 8
OpenCL CLScalarField Device Info:
CL_DEVICE_NAME: Intel(R) UHD Graphics 630
CL_DEVICE_VENDOR: Intel(R) Corporation
CL_DEVICE_VERSION: OpenCL 2.1 NEO
CL_DRIVER_VERSION: 27.20.100.8681
CL_DEVICE_OPENCL_C_VERSION: OpenCL C 2.0
CL_DEVICE_TYPE: GPU
CL_DEVICE_MAX_CLOCK_FREQUENCY: 1200MHz
CL_DEVICE_GLOBAL_MEM_SIZE: 1717985280
CL_DEVICE_LOCAL_MEM_SIZE: 65536
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 858992640
CL_DEVICE_MAX_WORK_GROUP_SIZE: 256
CL_DEVICE_MAX_WORK_ITEM_SIZES: 256 x 256 x 256
OpenCL CLScalarField Kernel Info:
CL_KERNEL_FUNCTION_NAME: compute_scalar_field_points
CL_KERNEL_ATTRIBUTES:
CL_KERNEL_NUM_ARGS: 3611970751797657608
CL_KERNEL_WORK_GROUP_SIZE: 256
CL_KERNEL_LOCAL_MEM_SIZE: 0
CL_KERNEL_PRIVATE_MEM_SIZE: 0
CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: 32
CL_KERNEL_FUNCTION_NAME: compute_scalar_field_point_values
CL_KERNEL_ATTRIBUTES:
CL_KERNEL_NUM_ARGS: 3611970751797657608
CL_KERNEL_WORK_GROUP_SIZE: 256
CL_KERNEL_LOCAL_MEM_SIZE: 0
CL_KERNEL_PRIVATE_MEM_SIZE: 0
CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: 32
CL_KERNEL_FUNCTION_NAME: compute_scalar_weight_field_point_values
CL_KERNEL_ATTRIBUTES:
CL_KERNEL_NUM_ARGS: 3611970751797657608
CL_KERNEL_WORK_GROUP_SIZE: 256
CL_KERNEL_LOCAL_MEM_SIZE: 0
CL_KERNEL_PRIVATE_MEM_SIZE: 0
CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: 32
I expect that exception handling is usually supported by a C++ program. I wonder why your function "main" does not contain corresponding try and catch instructions so far.
How do you think about recommendations by Matthew Wilson in an article?
Would you like to adjust the implementation if you consider effects for uncaught/unhandled exceptions like they are described by Danny Kalev?
Sorry, total noob here. I'm really exited to use the program (I use blender a lot and the ancient lattice-Boltzmann fluid simulator built in leaves much to be desired). Can you please help me build and run this on OS X? I hope you can turn this into a blender plugin in the future. The results look really great. Does it use open VDB?
Hello,
I just discovered this repository, and I was curious about its capabilities.
I design reactor for organic synthesis in plastic (https://www.youtube.com/watch?v=0Uc76tzNmtM&feature=youtu.be)
These reactors are 3D printed from a STL file (so I could probably get a mesh object from that).
Is it possible to use GridFluidSim3D to simulate a fluid inside these reactors ? I'm not looking for accurate simulations, just a basic one.
You can see in the first part of the video some sort of cartoon (made with lightwave). I'd like to achieve that, but I'd like to get something that looks like a fluid inside.
DO you think it's possible ?
I tried to run this simulation, but I have no knowledge of C and compiling. I tried copy paste the pyfluid folder into Blender and load it inside Blender, but it gives me error.
How to actually run this sims?
I have been working on Lego particle maps and am wondering if this could output that instead of a mesh. That is, my meshes are already created and I position them based on particle maps. The particle maps just have an xyz coordinate for each particle. I don't know if this makes sense but this simulator should already have that data internally, so it's just a matter of saving that instead of the 3d mesh data.
Can anyone give me some insight, why I receive the 'unable to load library" error ?
I followed the instructions for installing fluidsim. However, I'm missing the "lib" directory under "pyfluid".
Might this be the reason, and if so, how come the "lib" directory isn't there although the build was successful ?
Many thanks in advance !
h:\python27\python example_hello_world.py ../../../../build2/fluidsim/
Traceback (most recent call last):
File "example_hello_world.py", line 30, in
import pyfluid
File "H:\GridFluidSim3D-master\build2\fluidsim\pyfluid_init_.py", line 1, in
from .aabb import AABB, AABB_t
File "H:\GridFluidSim3D-master\build2\fluidsim\pyfluid\aabb.py", line 3, in
from . import method_decorators as decorators
File "H:\GridFluidSim3D-master\build2\fluidsim\pyfluid\method_decorators.py", line 3, in
from .fluidsimulationsavestate import FluidSimulationSaveState
File "H:\GridFluidSim3D-master\build2\fluidsim\pyfluid\fluidsimulationsavestate.py", line 4, in
from .pyfluid import pyfluid as lib
File "H:\GridFluidSim3D-master\build2\fluidsim\pyfluid\pyfluid.py", line 45, in
pyfluid = __load_library("pyfluid")
File "H:\GridFluidSim3D-master\build2\fluidsim\pyfluid\pyfluid.py", line 26, in __load_library
raise LibraryLoadError("Unable to load library: " + name)
pyfluid.pyfluid.LibraryLoadError: 'Unable to load library: pyfluid'
Hi, I am trying to simulating fluid on a surface with up and down hill, seems it is no need to initalize the simulation domain to be a box, it will be of more efficient to use the surface to initialize the buttom of the box, since it will decline the number of grid. Then how could we do that if it supported?
(The above figure shows the case that the yellow box is the initalized simulation domain, while the black grids should not be used since the fluid is flow on the surface, if use the origal box, it will require more computation for the simulation, we should and how to decline the initalized domain? )
Hello! Sorry if this is inapropriate place to ask
i've built your code with mingw64 on windows7
Application starts fine, and it's baking .ply files in bake folder, but what is it baking?
How can i create my own scene and bake it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.