This page provides a tutorial for using Initial Liquid Fill with any container.
Filling up a cup or glass using fluid dynamics can be time-consuming and sometimes unstable. This tutorial will guide you in creating an initial fill state for any type of container.
This guide covers creating a simple scene from scratch and setting up the simulation.
Create the Container
Begin with a new scene. To create the glass geometry, we will use the lathe modifier. Start by creating a Line and drawing the profile curve in an orthographic view. Make sure the starting and end vertices are positioned on the revolving axis.
Next, add the Lathe modifier by selecting it from the Modifier List. This will create the cup geometry.
Add the STL Check from the Modifier List. Enable the Check option and view the Status to ensure the model is watertight and free from errors.
Finally, smooth out the glass geometry using the TurboSmooth modifier.
Create the Liquid Geometry
Create a simple Box with its Length, Width and Height Segs set to 1.0. Adjust the box size to cover where you want the liquid to be. It should extend beyond the bowl bottom and into the stem for complete coverage.
With the box selected, go to the Geometry category of the Create panel and select Compound Objects > ProBoolean.
In the Parameters rollout, set Operation to Intersection. In the Pick Boolean rollout, set the type to Copy, then click the Start Picking button and select the glass cup geometry.
In the Modify panel, right click the ProBoolean modifier and convert it to an Editable Poly.
Switch the Selection to Element. Select the part of the box outside the glass and delete it.
You will be left with this solid geometry which can be used for liquid in the glass. Rename it to "filled geometry".
If the boolean operation did not perform as shown below, you may need to Flip Normals for the glass. The purpose is to have the Glass geometry normals pointing towards the liquid volume, and the filled geometry normals should point outwards towards the glass. If you need any additional helper geometries for the process, make sure they are excluded from the simulation from the Scene Interaction rollout.
Adjust the filled geometry by adding a Push modifier with a Push Value of about -0.9 cm. This will add a small amount of space between the meshes so they do not intersect.
Set Up the Liquid Simulation
With filled geometry selected, right click and select Object Properties. In the Display Properties, enable Display as Box. In the Rendering Control section, disable Renderable, then select OK.
With the filled geometry object selected, right click and select Phoenix FD Properties. Enable Initial Liquid Fill. This will fill the geometry with liquid at the very beginning of the simulation.
Start the simulation. The liquid will fill the glass from the start and then may settle. To view the simulation as a mesh, navigate to the Preview rollout, enable View as Mesh and disable Particles.
If the simulation did not fill the glass and only appeared along the edges, check that the geometry normals are correct. You may need to use a Normal modifier to Flip Normals for the glass.
Using a boolean for creating the liquid geometry is especially handy when you have a tilted container cup and you want the liquid filled and stabilized at the very beginning. This method can save a lot of time because you don't need to pre-run the simulation.