Submitted:
24 January 2025
Posted:
27 January 2025
You are already at the latest version
Abstract
Hellenic Open University has developed Onlabs, a virtual biology laboratory designed to safely and effectively prepare its students for hands-on work in the university’s on-site labs. This platform simulates key experimental processes, such as 10x TBE solution preparation, agarose gel preparation and electrophoresis, which involve liquid transfers between bottles. However, accurately depicting liquid volumes and their flow within complex-shaped laboratory vessels, such as Erlenmeyer flasks and burettes, remains a challenge. This paper addresses this limitation by introducing a unified parametric framework for modeling circular cross-section pipes, including straight pipes with constant diameter, curved pipes with constant diameter and straight conical pipes. Analytical expressions are developed to define the position and orientation of points along a pipe's central axis, as well as the surface geometry of composite pipes formed by combining these elements in planar configurations. Moreover, the process of surface discretization with finite triangular elements is analyzed with the aim of optimizing their representation during the algorithmic implementation. The functions of the current length with respect to the volume of each considered container shape are developed. Finally, the methodology for handling and combining the analytical expressions during the filling or emptying of a composite pipe is explained, the filling of certain characteristic bottles is implemented, and the results of the implementations are presented. The primary goal is to enable the precise algorithmic generation of 3D graphics representing the surfaces of liquids within various laboratory vessels and subsequently the simulation of their flow. By leveraging these parametric models, liquid volumes can be accurately visualized, reflecting the vessels’ geometries and improving the realism of simulations, and the filling of various vessels can be realistically simulated.
Keywords:
1. Introduction
1.1. About Onlabs Virtual Lab
1.2. Liquid Simulation in Onlabs
2. Background & Related Work
3. Materials and Methods
3.1. Description of Pipes and Bottles with Circular Cross-Sections and Liquid Volume Representation
- Liquid flow through a tube, bottle emptying, and volumetric tube filling with free-flow during the filling of the automatic burette's volumetric tube.
- Liquid flow through a tube and bottle refilling with free-flow from the automatic burette during the zeroing of the volumetric tube's measurement.
- Emptying of the volumetric tube with liquid flow into the spout tube of the automatic burette's measurement tap.
3.1.1. Types and Classification of Liquid Movement
- Steady liquid flow in a tube
- Transient liquid flow in a tube
- Filling and emptying of a bottle
3.1.2. Simplifying Assumptions
- Pipes and bottles are assumed to have circular cross-sections only.
- A single parameter, s, is used along the entire length of the composite pipe to represent the current length of the line formed by the centers of the circular cross-sections (central line).
- The diameter is continuous along each pipe/bottle segment and remains consistent during transitions between segments (i.e., the diameter at the end of one segment equals the diameter at the start of the next).
- The slope of the central line relative to the horizontal plane is continuous at every point along the pipe and during transitions between segments.
- The diameter of an individual pipe/bottle remains constant or varies linearly as a function of its length.
- For pipes, the liquid surface level is considered perpendicular to the central line at every point.
- Only vertical bottles are considered.
- A common curvature parameter, κ, is used for each pipe segment.
- The radius of curvature of the central line must be greater than or at least equal to the pipe's cross-sectional radius.
- The central line of the composite pipe lies within a plane.
3.1.3. Central Line Coordinate Equations for Curved Pipes with Constant Diameter and Straight Pipes with Constant or Linearly Varying Diameter
3.1.4. Geometric and Mathematical Description of the Coordinates of the Perimeter of a Pipe or Vessel with an Inclined Circular Cross-Section
3.2. Discretization of Pipes and Bottles’ Cross-Sections
3.2.1. Definition of Triangular Surface Finite Elements Using Cross-Section Points
- Triangles with one edge in the previous cross-section.
- Triangles with one edge in the last cross-section.
- Triangles with edges in different cross-sections.
3.2.2. Mathematical Handling and Implementation Specifics of Triangles Between Cross-Sections
- Assuming a sufficiently small step length for the central line and incrementally increasing the current length in a loop.
- Calculating the coordinates of the central line point corresponding to the current length at each iteration.
- Based on the above coordinates, iteratively calculating the discretization points of the cross-section's perimeter using angular intervals (as determined by the chosen resolution). These points are recorded sequentially in a one-dimensional array.
- Using the discretization points of the previous and current cross-sections, triangular surface finite elements are created by recording the sequential numbers of each point in the previous array. Each set of three points, in order, forms a triangular element. The two arrays are assigned as corresponding vertex and edge attributes in a mesh structure.



3.3. Simulation of Dynamic Flow and Liquid Level Variation in Bottles and Tubes
3.3.1. Geometric and Mathematical Description of Bottle Levels with Respect to a Known Liquid Flow Rate
3.3.2. Key Points and Implementation Examples for Bottle Filling in Unity
- coordinates of the central line point of the initial cross-section
- slope of the initial cross-section
- diameter of the initial cross-section
- The current volume V of liquid in the bottle,
- The cumulative volume Vtot,i that each segment of the bottle can contain.
4. Results







- The conical flask is filled from the 3rd to the 26th second, a duration of 23 seconds, which aligns approximately with the calculation in Table 1.
- The graduated cylinder is filled from the 1st to the 14th second, a duration of 13 seconds, which also matches the calculation in Table 1.
- The wide-necked conical flask is filled from the 2nd to the 32nd second, a duration of 30 seconds, again consistent with the calculation in Table 1.

5. Discussions
- Implementing the simulation of flask emptying (the same expressions apply, but adjustments would be needed in handling, such as the surface mesh).
- Accurate modeling of filling and emptying flasks with varying diameters using other analytical functions of the pipe length, apart from the linear function.
- Combining energy conservation equations, mass conservation, loss calculations, and the ideal gas law for air to derive an analytical solution for the liquid-air interface velocity.
- Extending the modeling equations to describe the same types of tubes in space rather than only in the plane.
- Utilizing the PISO algorithm with exact dynamic flow equations for real-time implementation.
- Further extending the tube shapes to other analytical functions of circular cross-section diameter beyond the linearly varying and constant ones.
- Modeling the coordinates and slopes of each point of a tube’s central line.
- Identifying the type of tube through analytical expressions for cross-section diameter variation and generating surface point meshes.
- Creating finite triangles and representing the surface using them.
Funding
Acknowledgments
Conflicts of Interest
References
- de Levie, R. A General Simulator for Acid-Base Titrations. J. Chem. Educ. 1999, 76, 987. [CrossRef]
- Zafeiropoulos, V.; Kalles, D. Quantitative Liquid Simulation in an Interactive 3D Virtual Laboratory. In Proceedings of the Proceedings of the 22Nd Pan-Hellenic Conference on Informatics; ACM: Athens, Greece, November 2018; pp. 219–224.
- Foster, N.; Metaxas, D. Realistic Animation of Liquids. Graphical Models and Image Processing 1996, 58, 471–483. [CrossRef]
- Harlow, F.H.; Welch, J.E. Numerical Calculation of Time-Dependent Viscous Incompressible Flow of Fluid with Free Surface. The Physics of Fluids 1965, 8, 2182–2189. [CrossRef]
- Stam, J. Stable Fluids. In Proceedings of the Proceedings of the 26th annual conference on Computer graphics and interactive techniques; ACM Press/Addison-Wesley Publishing Co.: USA, July 1 1999; pp. 121–128.
- Stam, J. Real-Time Fluid Dynamics for Games 2003.
- Reeves, W.T. Particle Systems - A Technique for Modeling a Class of Fuzzy Objects. ACM Trans. Graph. 1983, 2, 91–108. [CrossRef]
- Clavet, S.; Beaudoin, P.; Poulin, P. Particle-Based Viscoelastic Fluid Simulation. In Proceedings of the Proceedings of the 2005 ACM SIGGRAPH/Eurographics symposium on Computer animation; Association for Computing Machinery: New York, NY, USA, July 29 2005; pp. 219–228.
- Medvecký-Heretik, J. Real-Time Water Simulation in Game Environment, Masaryk University, Faculty of Informatics, 2018.
- Hass, J.R.; Heil, C.E.; Weir, M.D. Thomas’ Calculus: Early Transcendentals in SI Units; 14th ed.; Pearson, 2019; ISBN 978-1-292-25311-4.
- Creating a Mesh Available online: https://catlikecoding.com/unity/tutorials/procedural-meshes/creating-a-mesh/ (accessed on 13 January 2025).
- Jewell, T. How to Improve Reaction Time: Tips for Gaming and Other Sports Available online: https://www.healthline.com/health/how-to-improve-reaction-time (accessed on 13 January 2025).
| 1 | We remind that according to our assumption, the cross-section of a pipe with the horizontal level is always circular. |


















| Vessel Type | Diameter dα (mm) | Diameter dτ (mm) | Length l (mm) | Volume V (mm3) | Flow rate Q (mm3/sec) | Filling time t (sec) |
| Conical Bottle 200ml | 78 | 16 | 112 | 22491.7805 | 10000 | 22.24917805 |
| 16 | 19 | 27 | 6510.165376 | 10000 | 0.651016538 | |
| Total | 22.90019459 | |||||
| Volumetric Tube 100ml | 27.5 | 27.5 | 225 | 133640.4062 | 10000 | 13.36404062 |
| Wide-Necked Conical Tube 250ml | 82 | 31 | 100 | 257742.2339 | 10000 | 26.77422339 |
| 31 | 31 | 45 | 33964.54358 | 10000 | 3.396454358 | |
| Total | 30.17067775 | |||||
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).