Giter VIP home page Giter VIP logo

interactivecomputergraphics / splishsplash Goto Github PK

View Code? Open in Web Editor NEW
1.5K 69.0 277.0 17.72 MB

SPlisHSPlasH is an open-source library for the physically-based simulation of fluids.

Home Page: https://splishsplash.physics-simulation.org/

License: MIT License

CMake 1.49% C++ 93.71% GLSL 0.19% C 1.77% Python 2.83%
sph fluids sph-fluids smoothed-particle-hydrodynamics fluid-simulation fluid-dynamics multiphase-flow viscous-fluids deformable-solids simulation

splishsplash's People

Contributors

digitalillusions avatar gileoo avatar gnastacast avatar janbender avatar judgebc avatar simonaltrogge avatar weilermarcel avatar zhehaoli1999 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

splishsplash's Issues

How do you consider foam when meshing the particles with marching cubes?

Hi!

I just built SPlisHSPlasH, and it's impressive! Anyway, I really need to mesh the particles, and, since you said in a closed issue that the marching cubes tool you used is no longer available, I might try to write my own. But there's one thing I don't know how to manage: foam. In your meshed videos, foam is rendered. How does the mesher detect foam from just the particles positions? And then, how does it generate a mesh that has foam? With a shader that has some scalar field for some color property? What shaders do you use for liquids and foam? Thanks!

Segfault in DynamicBoundarySimulation 2.5.0 Release

Hello,
I get a Segmentation Fault when running the DynamicBoundarySimulatior based on the 2.5.0 Release.

It prints Type mismatch in setValue! to stderr and crashes. This happens with the default DoubleDamBreak Scene. I tested different Scenes and get the same result.

Happens with the StaticBoundarySimulation, too, but without the Type mismatch output.

I could narrow it down and it seems the bug was introduced in commit
ee26ef3

I'm running Ubuntu 19.04 and built SPlisHSPlasH with gcc version 6.

Thanks for looking into this!
Yannic

GPU porting / Performance improvements

Hello,

I have been using SPlisHSPlasH in interaction with the gazebo robotics simulator which is in turn interfacing with the ODE, bullet, SimBody physics engines. So far everything seems to be running well, but the simulation is quite slow, and the bottleneck is on the fluid simulation side. Do you have any tips on how I could try to accelerate the simulation (other than just using a more powerful machine), and more importantly, are there any plans to port SPlisHSPlasH to the GPU? If not, is there a specific reason for this? Maybe the simulation methods don't scale well on the GPU?

Simulation takes a long time to run

Hello, I am running a simulation with the following .json

{
	"Configuration": 
	{
		"timeStepSize": 0.001,
		"numberOfStepsPerRenderUpdate": 2,
		"particleRadius": 0.005, 
		"density0": 1000, 
		"simulationMethod": 3,
		"gravitation": [0,-9.81,0], 
		"cflMethod": 0, 
		"cflFactor": 1,
		"cflMaxTimeStepSize": 0.005,
		"maxIterations": 100,
		"maxError": 0.01,
		"maxIterationsV": 100,
		"maxErrorV": 0.1,		
		"stiffness": 50000,
		"exponent": 7,
		"velocityUpdateMethod": 0,
		"enableDivergenceSolver": true
	},

	"RigidBodies": [
		{
			"geometryFile": "../models/UnitBox1.obj",
			"translation": [0,0.25,0],
			"rotationAxis": [1, 0, 0],
			"rotationAngle": 0,
			"scale": [0.5, 0.5, 0.5],
			"color": [0.5, 0.5, 0.5, 1.0], 
			"isDynamic": false,
			"restitution" : 0.6,
			"friction" : 0.0,
			"collisionObjectType": 2,
			"collisionObjectScale": [0.5, 0.5, 0.5],	
			"isWall": true,
			"invertSDF": true
		}
	],
	"FluidBlocks": [
		{
			"denseMode": 0,
			"start": [ -0.25,0.0, -0.25],
			"end": [ 0.25, 0.5,0.25]
		}
	]

}

By replacing the DoubleDamBreak.json with this one and running the StaticBoundaryDemo. I let it run for 20 hours with 8 mpi cores, and it only simulated 0.43 seconds. The output from the run:

./bin/StaticBoundaryDemo
Load scene file: /home/manos/Dev/SPlisHSPlasH/data/Scenes/DoubleDamBreakWithSphere.json
OpenGL version 4.6
Using GLEW 1.12.0
Vendor: NVIDIA Corporation
Renderer: GeForce GT 730M/PCIe/SSE2
Version: 4.6.0 NVIDIA 396.54
Initialize fluid particles
Number of fluid particles: 117649
Loading /home/manos/Dev/SPlisHSPlasH/data/models/UnitBox1.obj
Number of triangles: 10
Number of vertices: 8
Loaded cached boundary sampling: /home/manos/Dev/SPlisHSPlasH/data/Scenes/Cache/UnitBox1_sbd_0.005000_0.500000_0.500000_0.500000.bgeo
Initialize boundary psi
Number of boundary particles: 30790
Initialize boundary psi
---------------------------------------------------------------------------

Initialize boundary psi
Average time SimStep: 142832 ms
Average time pressureSolve: 123316 ms
Average time predictAdvection: 10080.7 ms
Average time neighborhood_search: 407.426 ms
Average time computeNonPressureForces: 4648.83 ms
---------------------------------------------------------------------------

Time sum SimStep: 7.88435e+07 ms
Time sum pressureSolve: 6.80704e+07 ms
Time sum predictAdvection: 5.56457e+06 ms
Time sum neighborhood_search: 224899 ms
Time sum computeNonPressureForces: 2.56616e+06 ms
---------------------------------------------------------------------------

---------------------------------------------------------------------------

---------------------------------------------------------------------------

Sum of emitted particles: 0
Sum of reused particles: 0

It seems a bit weird that the timing calculations are done twice, and it takes super long to complete just 0.43 secs of simulation. I am trying to simulate a pool of water with resting particles. Am I doing something wrong or is this normal behaviour?

Best,
Manos

Very slow fluid simulation

Question: Why is the simulator so slow? On my system, I simulate 15,000 particles for a long time.
Using the FLIP Fluids simulator on my system, I can simulate millions of particles. But with the help of splish slpash it turns out to simulate tens of thousands of particles.
Maybe I'm not correctly specifying the simulation parameters?
Here are the parameters of my simulation:

{
    "Configuration":
    {
        "pause": true,
        "timeStepSize": 0.0005,
        "numberOfStepsPerRenderUpdate": 2,
        "particleRadius": 0.01, 
        "density0": 1000, 
        "simulationMethod": 4,		
        "gravitation": [0.1,-9.81,0], 
        "cflMethod": 0, 
        "cflFactor": 0.05,
        "cflMaxTimeStepSize": 0.005,
        "maxIterations": 100,
        "maxError": 0.0001,
        "maxIterationsV": 1000,
        "maxErrorV": 0.001,		
        "stiffness": 50000,
        "exponent": 7,
        "velocityUpdateMethod": 0,
        "enableDivergenceSolver": true,
        "boundaryHandlingMethod": 2,
        "enablePartioExport": true,
        "dataExportFPS": 60
    },

    "Fluid":
    {
        "density0": 1000, 
        "colorField": "velocity",
        "colorMapType": 1,
        "renderMinValue": 0.0,
        "renderMaxValue": 5.0,
        "surfaceTension": 1.0,
        "surfaceTensionMethod": 0,		
        "viscosity": 3000.0,
        "viscosityMethod": 7, 
        "viscosityBoundary": 3000.0,
        "vorticityMethod": 1,
        "vorticity": 0.15,
        "viscosityOmega": 0.05,
        "inertiaInverse": 0.5,
        "maxEmitterParticles": 100000,
        "emitterReuseParticles": false,
        "emitterBoxMin": [-4.0,-1.0,-4.0],
        "emitterBoxMax": [0.0,4,4.0]
    },

    "Emitters": [
        {
            "width": 14,
            "height": 2,
            "translation": [0.0, 0.0, 0.0],
            "rotationAxis": [0, 0, 1],
            "rotationAngle": -1.57,
            "velocity": 3,
            "emitStartTime": 0,
            "type": 0
        }
    ],

    "RigidBodies": [
        {
            "geometryFile": "collision.obj",
            "color": [0.1, 0.4, 0.6, 1.0], 
            "isDynamic": false,
            "isWall": true,
            "mapInvert": false, 
            "mapThickness": 0.0,
            "mapResolution": [20,20,20],
            "samplingMode": 1
        }
    ]
}

And one more question:

How do you position your splishsplash simulator?
Does this simulator belong to the category of 3D graphics or to the category of scientific programs for calculations?
That is, is splishsplash the same fluid simulator like realflow, houdini, blender elbeem, blender mantaflow, blender flip fluids?
Or all the same, the goals of this simulator differ from those listed above?

Partio export

I am fairly new to animation and I was wondering about the export format of the simulations. I see that the individual frames are saved to .bgeo files, but I am having trouble figuring out what to do with those. I see that they are viewable with the PartioViewer, but I have only been able to view the individual frames that way. I was wondering how to view the files created by the simulations as a video.

Explosion when rigid body immersed in fluid at initialization time

Hello,

I'm currently trying to simulate some fluids interaction with rigidbodies, and the subject was a fan immersed into gases.
But when I put any rigidbody inside the fluid (even a simple sphere) and start the simulation, it just explodes (After troubleshooting a little, I found out that fluids particles are spawned inside and just at the skin of the rigidbody (they are spawned uniformly regardless of rigid bodies due to the initialization order) and then are ejected at the first frame, making the simulation highly unstable).

I took some print screens of a ball immerged into a fluid :

This is time 0 :
image

This is time t = 0.00600 (the next frame)
image

And other questions about what SplishSplash could do :

  • SplishSplash is made for fluids, but actually I never saw anyone using it for simulating gases like air interactions with solids (even though gases are fluids too). Is SplishSplash able to handle those kind of interaction or is it especially made for liquids ?

  • What are the physical units of constants you use to initialize Splishplash parameters ? Is it the one that we find in the tutorial SplishSplash is linked to ? (https://interactivecomputergraphics.github.io/SPH-Tutorial/)

  • Then, if it is the case, then why is the viscosity coefficient 10 time higher than water (I suppose, from its density, that it is water you wanted to simulate, isn't it) ?

Thanks

Implement rotating objects

You showed an impressive animation of a rotating dough hook (Eurographics 2018).
Could you please explain how to implement an object rotating with a fixed speed (the hook)?
Some example lines of code would be very helpful.

zoom in demos

I really want to play around with the demos more to test my own model but my dimensions are scaled differently. without scaling and translating I want to be able to zoom in and out, and pan in demo viewer.

can you point me in the direction to figure that out I am not very familiar with glut/opengl etc?

Is it easy to compute the previous frame from the current one?

Hi, I'm asking this question for SPlisHSPlasH, but I'm actually also interested in this question for your PositionBasedDynamics library as well.

Is it possible to run the simulation backwards instead of forward? I'm asking this because I'd like to be able to jump to any frame in the simulation without having to store all the positions for each frame (that would be overkill in memory consumption), and without having to run the simulation from the beginning every time.

If that's possible, I would add two arrows in my GUI: one arrow for "step backwards" and another for "step forward" (in addition to the play/pause button).

As I said, I'm interested in this question for PositionBasedDynamics as well.

Thanks!!

How to run a scene with turbulence and vortex ?

Hello,
I just built the project, it's really a big project, the paper and project are awesome. I'm a newcomer in sph, and I want to observe your effect in the vortex project. So I just changed the "m_sceneFile" in "SimulatorBase::init" function, from "DoubleDamBreak.json" to "CoilingModel_Bender2017.json". Then run the project. Like this.
2
The result seems strange, like that.
1
I think I do something wrong. What other models or emitters do I need to prepare?
Thank you for your help.

Why the particles fly away but not rolling along the surface?

Hi, I am totally a newcomer to Fluid Simulation, I built the project and generated the scene file based on the example of ViscousBunny expecting to see the particles rolling along the surface, while it comes out that particles were fly away as the image illustrates
pic1
Is the configurations are not suitable for my case?
the scene files are in the attachment.
scnee.zip

Users list for doubts.

Thanks for making such software open to use.

Is there users group, where we can ask questions related to code base.

Thanks.

Build fails

Building different targets with make after running cmake generates a myriad of different error messages. Some are compiler related, e.g. #error due to lacking c++11 support, and some are related to library specific function calls, e.g. omp_get_max_threads due to not linking with -fopenmp. None of these errors are justified however, as the target system does provide support for the error messages just mentioned. Below is a selection of make commands and some of their related error messages that I get on the target system: Linux x86_64, 4.4.0-135-generic, Ubuntu 16.04, g++ 5.4.0.

Error: make

error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

Error: make StaticBoundaryDemo

error: ‘omp_get_max_threads’ was not declared in this scope

Error: make DynamicBoundaryDemo

error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

Error: make SPlisHSPlasH

error: ‘omp_get_max_threads’ was not declared in this scope

These are purely build related, as the support is there, the build system just don't detect the required tools.

A pointer (no pun intended) in the right direction would be much appreciated.

Could NOT find GLUT (missing: GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)

Hi, I am interested in this project but I am not familiar with CMake. when I compiled the code with CMake in Ubuntu, I got the error message as follows.

The C compiler identification is GNU 5.4.0
The CXX compiler identification is GNU 5.4.0
Check for working C compiler: /usr/bin/cc
Check for working C compiler: /usr/bin/cc -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: /usr/bin/c++
Check for working CXX compiler: /usr/bin/c++ -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Found OpenMP_C: -fopenmp (found version "4.0")
Found OpenMP_CXX: -fopenmp (found version "4.0")
Found OpenMP: TRUE (found version "4.0")
Build type:
CMake Error at /home/huali/Desktop/cmake-3.16.4-Linux-x86_64/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find GLUT (missing: GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
Call Stack (most recent call first):
/home/huali/Desktop/cmake-3.16.4-Linux-x86_64/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/home/huali/Desktop/cmake-3.16.4-Linux-x86_64/share/cmake-3.16/Modules/FindGLUT.cmake:130 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
Simulators/DynamicBoundarySimulator/CMakeLists.txt:9 (find_package)

Configuring incomplete, errors occurred!
it seems that it can't find the GLUT. I think it should install GLUT automatically rather than I install by hand. Could you tell me what I should do? thank you.

Cannot build in Ubuntu 18.04.1

Steps to reproduce:

  1. git clone version 2.3.0
  2. cmake .
  3. make

I would assume it has something to do with OpenMP but i just cannot seem to figure out where the error happens.
The output of make is:

[ 85%] Building CXX object Simulators/DynamicBoundarySimulator/CMakeFiles/DynamicBoundarySimulator.dir/main.cpp.o
<command-line>:0:0: warning: "PBD_DATA_PATH" redefined
<command-line>:0:0: note: this is the location of the previous definition
In file included from /usr/include/c++/7/parallel/algorithmfwd.h:34:0,
                 from /usr/include/c++/7/parallel/algorithm:35,
                 from /home/john/fluid_sim/SPlisHSPlasH/extern/install/CompactNSearch/include/Config.h:18,
                 from /home/john/fluid_sim/SPlisHSPlasH/extern/install/CompactNSearch/include/CompactNSearch.h:3,
                 from /home/john/fluid_sim/SPlisHSPlasH/SPlisHSPlasH/Simulation.h:8,
                 from /home/john/fluid_sim/SPlisHSPlasH/Simulators/DynamicBoundarySimulator/main.cpp:19:
/usr/include/c++/7/parallel/tags.h: In member function ‘__gnu_parallel::_ThreadIndex __gnu_parallel::parallel_tag::__get_num_threads()’:
/usr/include/c++/7/parallel/tags.h:66:18: error: ‘omp_get_max_threads’ was not declared in this scope
           return omp_get_max_threads();
                  ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/parallel/tags.h:66:18: note: suggested alternative:
In file included from /home/john/fluid_sim/SPlisHSPlasH/extern/install/PositionBasedDynamics/include/Simulation/kdTree.inl:4:0,
                 from /home/john/fluid_sim/SPlisHSPlasH/extern/install/PositionBasedDynamics/include/Simulation/kdTree.h:95,
                 from /home/john/fluid_sim/SPlisHSPlasH/extern/install/PositionBasedDynamics/include/Simulation/BoundingSphereHierarchy.h:6,
                 from /home/john/fluid_sim/SPlisHSPlasH/extern/install/PositionBasedDynamics/include/Simulation/DistanceFieldCollisionDetection.h:7,
                 from /home/john/fluid_sim/SPlisHSPlasH/extern/install/PositionBasedDynamics/include/Simulation/CubicSDFCollisionDetection.h:5,
                 from /home/john/fluid_sim/SPlisHSPlasH/Simulators/DynamicBoundarySimulator/PositionBasedDynamicsWrapper/PBDWrapper.h:10,
                 from /home/john/fluid_sim/SPlisHSPlasH/Simulators/DynamicBoundarySimulator/main.cpp:13:
/usr/lib/gcc/x86_64-linux-gnu/7/include/omp.h:88:12: note:   ‘PBD::omp_get_max_threads’
 extern int omp_get_max_threads (void) __GOMP_NOTHROW;
 gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1) 

Realtime?

is there any chance to integrate a fluid solver like this into blender game engine fork - upbge?

BF_blender?

Question about 2D simulations

Hi,

I run the 2D simulations and find strange phenomena.

When I choose PBF/IISPH/DFSPH/ProjectiveFluids as the simulation mehtod, the energy of the fluid is too sufficient. DFSPH even creates vortices.

When I choose PCISPH as the simulation mehtod, the fluid will explode.

Do you see these phenomenon?

Cheers

Cmake error

Hello I have never used Cmake before. When I'm trying to compile, Cmake returns this error:

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/ExternalProject.cmake:1757 (message):
error: could not find git for clone of
ExternalProject_PositionBasedDynamics
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/ExternalProject.cmake:2459 (_ep_add_download_command)
CMakeLists.txt:36 (ExternalProject_Add)

I'm using VS2015, Windows 10 64-bit and CMake 3.5.2.
Can anyone help me to solve this ?

Question

Hello. Is it possible to replace AntTweakBar with windows forms, or it's not ?

Cmake error

Hi,

I get the following error when configuring Cmake with Visual Studio 14 2015 selected.

The C compiler identification is MSVC 19.0.24210.0
The CXX compiler identification is MSVC 19.0.24210.0
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/ExternalProject.cmake:1811 (message):
error: could not find git for clone of
ExternalProject_PositionBasedDynamics
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.9/Modules/ExternalProject.cmake:2565 (_ep_add_download_command)
CMakeLists.txt:38 (ExternalProject_Add)

Configuring incomplete, errors occurred!

Any ideas how to solve this?

Validation of the viscosity models

Hi,

I am working on simulation of non-newtonion fluids flows using SPH. I really appreciate all the effort you have put in implementing so many viscosity models in the solver. I just want to know if it is possible to validate the results obtained by SPLISHSPLASH with analytical ones for simple couette and poiseuille flows. (I have a fair understanding that Computer Graphics community is more concerned with having better looking flows rather physically correct ones)
Thanks!

Rigid bodies in paraview

Hello,

i try to analyse some simulation results with rigid bodies in paraview.
The export (and import) of VTK files for the particles works fine.
How do handle the rigid bodies?
I'm not able to import the binary files in the rigid_bodies folder into paraview (file format?).
Is there a feature to also export this data into VTK file format?

Best,
Ralf

Option to build libraries as shared and not static

Hello,

I have been using SPlisHSPlasH with a robotics simulator (gazebo), and the way that the two codes are linked is through gazebo plugins which are plugged into gazebo as dynamically loaded libraries. However all the SPlisHSPlasH related libraries are compiled as static libraries, which prevents any external code that uses SPlisHSPlasH to be compiled as a shared library. The solution would be to add a cmake option to give users the option to choose the output of the compilation to be either shared or static libraries. I have tested the compilation as shared libraries and it works in linux, I would suppose that it works for other OSs as it would just change the add_library options in cmake. If you think that this would be a useful addition I could raise a PR about it.

Best,
Manos

make fails

This is what I am getting.
Compiler version is gcc 4.9
OS linux mint 17.2

In file included from Viscosity/Viscosity_Peer2015.h:7:0,
from TimeStep.cpp:12:
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:47:10: error: ‘Product’ in namespace ‘Eigen’ does not name a template type
Eigen::Product<MatrixReplacement, Rhs, Eigen::AliasFreeProduct> operator*(const Eigen::MatrixBase& x) const
^
In file included from Viscosity/Viscosity_Peer2015.h:7:0,
from TimeStep.cpp:12:
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:69:38: error: ‘StorageIndex’ in ‘using SystemMatrixType = class Eigen::SparseMatrix {aka class Eigen::SparseMatrix}’ does not name a type
typedef typename SystemMatrixType::StorageIndex StorageIndex;
^
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:84:10: error: ‘Index’ in namespace ‘Eigen’ does not name a type
Eigen::Index rows() const { return m_dim; }
^
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:85:10: error: ‘Index’ in namespace ‘Eigen’ does not name a type
Eigen::Index cols() const { return m_dim; }
^
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:119:23: error: ‘Solve’ in namespace ‘Eigen’ does not name a template type
inline const Eigen::Solve<JacobiPreconditioner, Rhs> solve(const Eigen::MatrixBase& b) const
^
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:141:10: error: ‘generic_product_impl’ is not a class template
struct generic_product_impl<MatrixReplacement, Rhs, SparseShape, DenseShape, GemvProduct> // GEMV stands for generic matrix-vector
^
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:141:55: error: ‘SparseShape’ was not declared in this scope
struct generic_product_impl<MatrixReplacement, Rhs, SparseShape, DenseShape, GemvProduct> // GEMV stands for generic matrix-vector
^
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:141:68: error: ‘DenseShape’ was not declared in this scope
struct generic_product_impl<MatrixReplacement, Rhs, SparseShape, DenseShape, GemvProduct> // GEMV stands for generic matrix-vector
^
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:142:31: error: expected template-name before ‘<’ token
: generic_product_impl_base<MatrixReplacement, Rhs, generic_product_impl<MatrixReplacement, Rhs> >
^
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:142:31: error: expected ‘{’ before ‘<’ token
../SPlisHSPlasH/Utilities/MatrixFreeSolver.h:142:31: error: expected unqualified-id before ‘<’ token
make[2]: *** [SPlisHSPlasH/CMakeFiles/SPlisHSPlasH.dir/TimeStep.cpp.o] Error 1
make[1]: *** [SPlisHSPlasH/CMakeFiles/SPlisHSPlasH.dir/all] Error 2
make: *** [all] Error 2

Record or save simulations

Is there any way to save or record the simulations? As we did not find any option on the gui to do the same, we were wondering if there is an option in the code where this can be enabled.

Getting started

Greetings,

I was redirected to this SPH code when I was on the CFD online forums, I am in need of SPH codes that can simulate blood flow (initially simple cylinders with static walls).

I personally have very little experience with Cmake or SPH, so I was wondering whether some tutorials were available to get used to the code? Or perhaps I could receive some useful tips on how to get started.

Kind regards,
Dominykas

can't compile in ubuntu 18.04 It warns "always_inline function might not be inlinable"

I try to compile the code in ubuntu 18.04 in virtual machine on my Mac. I use g++7.4 gcc7.4 make4.1 cmake 3.16 . when I use Make to compile, many warning is about always_inline function might not be inlinable. besides,it shows "PBD-DATA-PATH" redefined when bulld target DynamicBoundarysimulator. In the end,
90% Linking Cxx executable../../../bin/DynamicBoundaySimulator.
93% Linking Cxx executable../../../bin/StaticBoundaySimulator.
96% Linking Cxx executable../../../bin/PartioViewer.
97% Linking Cxx executable../../../bin/SurfaceSampling
98% Linking Cxx executable../../../bin/VolumeSampling
99% Linking Cxx executable../../../bin/partio2vtk
100% Linking Cxx executable../../../bin/KernelTests

I am not sure that if the warning"always-inline function might not be inlinable" is the main issue. the library can't be complied fully. and The executable link aren't be built totally. could you help me figure out how to fix it? it seems that it's close to the success. Thank you.

Very sensitive movement in 3D space

It was more convenient if the sensitivity of camera movement in 3D space was lower. When I pull Shift and LMB, the camera in 3D space moves very quickly. Need to make moving slower.

Question about the input fluid model

Hi,
I meet a question how to get or generate the inputfile of the bgeo fluid model.

I had searched "bgeo" on the Internet, and found it may be the file of houdini. Then I dowmload the newest houdini and generate a bgeo file. But the SPlisHSPlasH project read nothing form it.
Cheers

Dynamic boundary demo fails with error

The build is successful, after adding an entry in the CMakeLists that explicitly finds openMP, but when I try to run the DynamicBoundaryDemo it crashes with

./DynamicBoundaryDemo
Load scene file: /home/manos/Dev/spl/SPlisHSPlasH/data/Scenes/DoubleDamBreak.json
OpenGL version 4.6
Using GLEW 1.12.0
Vendor: NVIDIA Corporation
Renderer: GeForce GT 730M/PCIe/SSE2
Version: 4.6.0 NVIDIA 396.54
Load scene file: /home/manos/Dev/spl/SPlisHSPlasH/data/Scenes/DoubleDamBreak.json
DynamicBoundaryDemo: /home/manos/Dev/spl/SPlisHSPlasH/extern/json/json.hpp:927: void nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType>::assert_invariant() const [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator]: Assertion `m_type != value_t::array or m_value.array != nullptr' failed.
Aborted (core dumped)

System :
Ubuntu 16.04
gcc (Ubuntu 6.5.0-2ubuntu1~16.04) 6.5.0 20181026

VS2017 make fails

I have set the 64-bit target in CMake but it seemed doesn't work. Does this library support to be generated by VS2017?

A question about density in WCSPH

Hi,

I found a line of code in WCSPH to limit the minimum density.
density = max(density, density0);

I never found it in other SPH code. Can you tell me what it does?

And if I delete it, the fluid will shrink at the beginning of the 2D experiment. The follow-up performance will be bad, too. I'm curious about why.

Cheers

GPU neigbourhood search not building

Hi,

I am having a problem building SPlisHSPlasH with the gpu neighbourhood search. When I try to build by invoking cmake like this

cmake .. -DUSE_GPU_NEIGHBORHOOD_SEARCH=ON

I get the following error

build.txt

When I try to build the cuNSearch library standalone, everything works fine though, and I can run the demo. The cudart.so library is existing in my system and the symbols that gcc is complaining about can be found with

nm -D libcudart.so.9.0.176

It seems like the problem is limited to the Demos of SPlisHSPlasH. Any ideas on what might be causing the issue?

The output of cmake

cmake.txt

The version of CUDA can be seen in the output of the cmake of cuNSearch
cuNSearch.txt

Best,
Robert

DFSPH Pressure and Divergence Solver are Identical?

I was looking through TimeStepDFSPH::pressureSolve() and TimeStepDFSPH::divergenceSolve() and noticed that they calculate the exact same velocity delta. Looking at the paper it's based on I assumed there would be some differences.

In pressureSolve it uses computeDensityAdv which calculates the exact same thing as computeDensityChange (which is used in divergenceSolve) without subtracting the rest density and a multiplication by the inverse step size. In pressureSolve anywhere it uses densityAdv it subtracts the rest density and multiplies by factor which includes the inverse step size. So the calculated values end up being the same unless I'm missing something.

Relevant chunk of pressureSolve:

const unsigned int neighborIndex = m_model->getNeighbor(0, i, j);
const Real b_j = m_simulationData.getDensityAdv(neighborIndex) - density0;
const Real kj = b_j*m_simulationData.getFactor(neighborIndex);
const Real kSum = (ki + kj);
if (fabs(kSum) > m_eps)
{
	const Vector3r &xj = m_model->getPosition(0, neighborIndex);
	const Vector3r grad_p_j = -m_model->getMass(neighborIndex) * m_model->gradW(xi - xj);

	// Directly update velocities instead of storing pressure accelerations
	v_i -= h * kSum * grad_p_j;			// ki, kj already contain inverse density						
}

Relevant chunk of divergnceSolve:

const unsigned int neighborIndex = m_model->getNeighbor(0, i, j);					
const Real b_j = m_simulationData.getDensityAdv(neighborIndex);
const Real kj = b_j*m_simulationData.getFactor(neighborIndex);
const Real kSum = (ki + kj);
if (fabs(kSum) > m_eps)
{
	const Vector3r &xj = m_model->getPosition(0, neighborIndex);
	const Vector3r grad_p_j = -m_model->getMass(neighborIndex) * m_model->gradW(xi - xj);
	v_i -= h * kSum * grad_p_j;			// ki, kj already contain inverse density
}

(I also don't get how ki and kj contain inverse density, since their calculation doesn't use the density at all, but that's a different issue)

vtk export

Hello!
When I run a simulation with vtk export enabled, I just can see the particles made with fluid blocks in Paraview. Particles from an emitter are just represented by an single point in Paraview. This also happens, when I use partio2vtk.
In PartioViewer everything looks fine.

Best regards

Tutorial, code usage examples

Hello, is there maybe a plan to publish some tutorials on the usage of the library, setting up a minimal example, some code snippets to help users get started? Alternatively, any plans for a workshop on SPlisHSPlash?

PartioViewer export bug in Linux

On my Ubuntu 18.04 machine, the render to Video function of PartioViewer refuses to work with the '--renderVideo' option set, failing with the error 'Cannot open pipe to ffmpeg'.

Looking into it, the culprit seems to be in line 527 (or thereabouts) of ./Tools/PartioViewer/main.cpp, where the second argument of the popen library function is called with the invalid argument "wb" instead of just "w". Seems that the only guarantees from the Open Group are that 'r' and 'w' are supported and that anything else is undefined. The Linux manpage only gives 'w' 'r' and an optional 'e' suffix

I fixed it by changing the offending line from
if (!(ffmpegPipe = popen(sstm.str().c_str(), "wb")))
to
if (!(ffmpegPipe = popen(sstm.str().c_str(), "w")))

in the fallback case, and I suspect that falling back to the guaranteed case in the spec is the Right Thing to do. If there's a non-WIN32 machine that uses the 'wb' type, it should probably be handled in another #elif clause.

Compile error

I'm getting the following error when attempting to compile SPlisHSPlasH. I'm compiling on Xubuntu 16.04 using cmake 3.5.2 and gcc 6.2.0. Any ideas what is going wrong?

/home/andy/Programs/SPlisHSPlasH/Utilities/FileSystem.cpp: In static member function ‘static std::__cxx11::string SPH::FileSystem::getProgramPath()’: /home/andy/Programs/SPlisHSPlasH/Utilities/FileSystem.cpp:171:40: error: ‘getpid’ was not declared in this scope sprintf(szTmp, "/proc/%d/exe", getpid()); ^ /home/andy/Programs/SPlisHSPlasH/Utilities/FileSystem.cpp:172:57: error: ‘readlink’ was not declared in this scope int bytes = std::min((int) readlink(szTmp, buffer, 1000), 999); ^ make[2]: *** [Utilities/CMakeFiles/Utilities.dir/FileSystem.cpp.o] Error 1 make[1]: *** [Utilities/CMakeFiles/Utilities.dir/all] Error 2 make: *** [all] Error 2

Animation of all simulation parameters

Implement the ability to change parameters over time. For example, position, rotation, scale emitters and obstacles. It is also possible to change the parameter viscosity, surface tension and other parameters.

Boundary Volume Calculation

Hi,
in the Boundary Volume calculation, only the boundary-boundary interaction is consired or also the boundary-fluid interaction is considered?

Cheers

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.