InteractiveComputerGraphics / SPlisHSPlasH

SPlisHSPlasH is an open-source library for the physically-based simulation of fluids.
https://splishsplash.physics-simulation.org/
MIT License
1.58k stars 284 forks source link

How to change Viscosity value for certain locations and times to simulate liquid freezing? #85

Closed uljad closed 3 years ago

uljad commented 4 years ago

What is the best way to change the viscosity level of the particles in time. I want to change it for the particles as a function of their time after their emission without affecting the rest of the system i.e particles.

e.g Particles freeze after being emitted to simulate additive manufacturing.

I canot find a functon to do that, how would I write one?

janbender commented 3 years ago

Currently all particles have the same viscosity value. So you would have to extend the framework and add a field which stores the viscosity coefficient per particle. This is quite simple:

uljad commented 3 years ago

How do I populate the vector and then how do I know which index to increase the viscosity of (say I want particles in the bottom to freeze)? How do I know which index is for each particle for example? How many elements are pushed per step size?

janbender commented 3 years ago

You can take a look at the file SurfaceTension_He2014.h and how the field std::vector m_color; is used there. To identify the particle you can use its ID or its position.