Scripted Liquid (internal force)

Post here anything related to RealFlow that doesn't specifically belong in any of the forums below
Post Reply
duke3d
Posts: 18
Joined: Wed Aug 24, 2016 12:15 am

Scripted Liquid (internal force)

Post by duke3d » Fri Mar 16, 2018 2:13 am

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

Thomas Schlick
Posts: 178
Joined: Tue Aug 29, 2017 12:35 pm

Re: Scripted Liquid (internal force)

Post by Thomas Schlick » Fri Mar 16, 2018 10:13 am

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.

duke3d
Posts: 18
Joined: Wed Aug 24, 2016 12:15 am

Re: Scripted Liquid (internal force)

Post by duke3d » Tue Mar 20, 2018 12:54 am

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

Thomas Schlick
Posts: 178
Joined: Tue Aug 29, 2017 12:35 pm

Re: Scripted Liquid (internal force)

Post by Thomas Schlick » Sun Apr 01, 2018 5:35 pm

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.

Post Reply