Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very slow fluid simulation #52

Closed
PavelBlend opened this issue Dec 13, 2019 · 4 comments
Closed

Very slow fluid simulation #52

PavelBlend opened this issue Dec 13, 2019 · 4 comments

Comments

@PavelBlend
Copy link

PavelBlend commented Dec 13, 2019

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?

@janbender
Copy link
Member

What do you mean with "long time"?
Since you use a fixed small time step size, the simulation will be rather slow. You also use very small values for maxError and maxErrorV, which will increase the number of required pressure solver iterations significantly. A simulation with an implicit viscosity is always slower since a linear system for the viscosity has to be solved. Finally, you enabled the vorticity solver which has not much effect since a highly viscous fluid is typically not turbulent.

@PavelBlend
Copy link
Author

And how long did it take to calculate this simulation? And on which processor?
https://youtu.be/elZieJNBYqk?t=160

@janbender
Copy link
Member

I think the simulation took a few hours on two Xeon processors.

However, you cannot compare FLIP particles with SPH particles. SPH solves the Navier-Stokes equations on the particle discretization while FLIP solves it on a fixed grid and only uses the particles to transport the quantities. It is easy to simulate millions of FLIP particles even in real-time. Take a grid with just one cell and put all inside. However, this gives you no more details. So you should compare the number of cells with the number of SPH particles.

That said SPlisHSPlasH is typically not that slow. Did you build the library in "Release" mode? Does it run in parallel. Can you give me some simulation times?

@mskr
Copy link

mskr commented Feb 21, 2020

Release Mode makes a huge difference here.

image
(with the second option you can still debug, set breakpoints etc.)

For example, simulating until t=0.01 in DamBreakModel.json took 12.573 s in Debug Mode and 0.584 s in Release With Debug Info Mode, so you get 21.5x speedup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants