Page 1 of 1

Scripted Liquid (internal force)

Posted: Fri Mar 16, 2018 2:13 am
by duke3d
Hi,
I keep playing with scripting :)) I tried scripted liquid (Standard Particles/type: script) and found something confusing. There is a "def computeInternalForces( emitter ):" section in a Script editor. So, I compute internal forces there, but how I suppose to utilize them? I mean there is only setExternalForce() function which is obviously for External forces. What should I do to apply calculated force to a particle? Should I just calculate velocity and new position from a new internal force and apply them to a particle via setVelocity() and setPosition()? Or, there is a way to apply internal force to each particle?

PC: it would be nice to have some simple tutorials about scripted particles :)

thanks,
Andrey

Re: Scripted Liquid (internal force)

Posted: Fri Mar 16, 2018 10:13 am
by Thomas Schlick
Or, there is a way to apply internal force to each particle?
Yes, that's possible and to use it you have to change the standard emitter's fluid type: Node Params > Particles > Type > Script. Then you click on the "Edit" button below to open the associated scripting editor.

It works in the same way as setExternalForce: you loop through the particles and apply the internal force. There used to be an example for internal forces somewhere, but I couldn't find it anymore. I know there's a C++ source code in RF's program folder (sdk > examples > surface_tension > src > surface_tension.cpp). Maybe this will help you.

Re: Scripted Liquid (internal force)

Posted: Tue Mar 20, 2018 12:54 am
by duke3d
Yes, that is how I do it ;) Thank you for mentioning C++ source code. It was really helpful. Now I see that there is a function setInternalForce(), which is somehow not presented in a list of Python's functions in the Help documentation.
Now I have another question :))) Well, I'm a C++ guy (mostly I worked on EM simulations last few years), so working in C++ is preferable for me. How can I use C++ in Realflow?

My apologies for late response. I'm very busy nowadays.
Thank you,
Andrey

Re: Scripted Liquid (internal force)

Posted: Sun Apr 01, 2018 5:35 pm
by Thomas Schlick
Sorry for my late reply, but I've simply overseen your answer.

There's a C++ manual under C:\Program Files\Next Limit\RealFlow 10\sdk\doc\manual. It contains how to use C++ with RF, build a developement environment, create and compile the different plugin types, and place them inside RF to make them work.