UH Department of Engineering Technology RET
During the summer of 2021, I participated in a Research Experience for Teachers sponsored by the University of Houston’s Department of Engineering Technology. I was assigned to a lab run by Dr. Weihang Zhu and worked under the direction of Arturo Haces-Garcia. Here you can see my research advisor Arturo Haces-Garcia and the bulk of the VR portion of the lab. Note the strange VR treadmill and multiple headsets.
Physics Playground with Unity and Steam VR
For example, Arturo created a ball cannon that can be launched by grabbing an object in the VR scene. We also had a bow and arrow and target. The pre-built bow and arrow obeyed video game physics but the algorithm was opaque.
For the ball cannon, I wanted to know how the speed and acceleration values were behaving so we wrote code to explicitly control the launched ball position and speed.
We added some VR graphical user interface components to this as well. About halfway through the six weeks, I decided the VR interface was actually hampering exploring the physics. Not to mention how hard it is to use the interface for making VR game scenes.
Unity Rigidbody Behavior
We created a non-VR experiment in our physics playground. When the scenes first “starts” there are 6 boxes with identical properties like size and mass and distance above the virtual ground. The Unity interface allows the designer to change the air resistance through a property in the inspector panel called simply ‘drag’. Unity depends the NVIDIA PhysX physics engine which implements air drag for objects labeled as ‘Rigidbody’ by exponentially decreasing the acceleration. The exact steps used here are not publicly available from NVIDIA in the documentation.
One thing was apparent immediately: changing the mass of the Rigidbody didn’t impact the drag force which is something one would expect in real-world physics.
Newton’s 2nd Law and Laminar Air Drag
As fluid flows around an object, the fluid can do one of two things. The flow can stay more or less intact as it runs into and around the object causing some drag, which we call a laminar flow. Or the flow can build up chaotic flow bits like eddy currents which increase the drag, which we call turbulent flow. In the visualization below, the flow shown in red above the cube is more or less laminar in nature, but the flow behind the cube seems more turbulent.As a fluid flows around an object, the fluid can do one of two things. The flow can stay more or less in tact as it run into and around the object causing some drag, which we call a laminar flow. Or the flow can build up chaotic flow bits like eddy currents which increase the drag, which we call turbulent flow. In the visualization below, the flow shown in red above the cube is more or less laminar in nature, but the flow behind the cube seems more turbulent.
Fluid Flow around a Cube from Schröder et al., 2020 For laminar air flow we can model air drag as a drag coefficient times the speed at that moment:
The drag coefficient, , is a dimensionless quantity dependant on the fluid properties and the object geometry. We will be using coefficients ranging from 0.2 to 1.0
Free Body Digram with Drag Force
The sum of the forces on the center of mass of the block is given by:
We can solve this expression by integration through separation of variables:
Evaluate both integrals noting the left hand side retains its limits of integration:
Manipulating the results of our integral, we get:
Exponentiate both sides of the expression and group all the terms except velocity on the right hand side:
After some time passes we will reach the terminal velocity:
This is the final expression for velocity as a function of time for an object experiencing laminar air drag from the time the object was dropped until it hits the ground:
Since the PhysX implementation was not impacted by the object mass, I decided to set out to compare the relationship between what PhysX calls the linear damping value for a Rigidbody and the terminal velocity.
For comparison, I decided to create a more realistic model of how terminal velocity depends on the drag coefficient of an object.
Unity vs p5jsJust from the game play, the air drag in unity didn’t seem to match the real world. I created a computer model of how air drag is normally described in the phyaics curriculum.
Flows can be modeled as laminar or turbulent. A more general treatment of air drag might be better described by the following (Wijaya et al., 2019):
Where for a laminar flow and for turbulent flow.
Modeling Physics with the Euler-Cromer MethodConsider these famous kinematics expressions:
We can model the motion of things with expressions like these in a computer if we use a modified version of something called Euler’s method. This is a technique from calculus that looks at the solution to a function in terms of Taylor series. Euler’s method of solving a differential equation was to do an integration manually by adding up what the function spits out when you start with a value and then add a tiny bit to the starting value.
Lots of techniques exist in computational modeling to make this technique work better under different circumstances. I decided to use the Euler-Cromer Method (ECM) for modeling the behavior of objects in the VR playground. The idea is use a computer program to do the math behind a given math function. Here we are using Newtonian mechanics to model the motion of an object.
Below is an excellent explanation of the Euler-Cromer Method using Python from the Let’s Code Physics YouTube channel.To figure out the position or speed or acceleration of an object at a given instant, take the previous values and update them using the correct mathemetical expression. Then the program will “iterate” or repeat the process. Since computers are good at fast and tedious tasks, ECM means the computer does the work once we set it all up. In ECM, you find the current speed before finding the current position (Cromer, 1981).
Let’s use the helpful STEMcoding platform as an example of ECM. Here is the “Accelerate the Blob” activity modified for simplicity (Orban & Teeling-Smith, 2020).
STEMcoding using a p5js library which updates the browser window automatically many times a second. For this example I had the framerate set to 30 frames per second (fps) which is good enough to make a smooth animation. The
draw()function is run once every frame so each time we update the speed, the position, and the time before we draw our blob.
Accelerate the Blob
Euler-Cromer Modeling with STEMcoding p5js
Experimental Control – Freefall
Curve Fitting Results
It is fair to say that Unity and PhysX do not enforce the drag value of a Rigidbody using the laminar flow model of fluid dynamics where .
Unity’s Rigibody objects using PhysX engine from NVIDIA appear to model drag with where is constant and is the parameter used for the drag of the Rigidbody. Note that the drag parameter is Unity can be any positive floating-point number greater than or equal to zero. According to the Unity documentation:
A low Drag value makes an object seem heavy. A high one makes it seem light. Typical values for Drag are between .001 (solid block of metal) and 10 (feather).
How the NVIDIA PhysX engine actually implements drag on Rigidbody objects seems to be a bit of a trade secret. However, it is clear that Rigidbody objects do not demonstrate air drag in either a laminar flow or turbulent flow model.
The biggest takeaway of this project has been that direct video measurement and data analysis can work with introductory physics knowledge such that students can explore video game physics veracity.
- Find or make a game video
- Perform DVM
- Reduce Data
- Analysis & Results
Computational Thinking in Physics
This activity is meant to be a novel way to include computational thinking in physics classes. The computational thinking framework laid out by Weintrop et al. (2016) has several components that can be leveraged with designing a physics classroom lesson using video game scene analysis. We can add a layer with student-created STEMcoding-based models for comparison. Below is a model of the CT framework with blue-colored elements in use in this activity.
See the Google Colab Notebook to see data & code!
Joint Meeting of APS and AAPT Texas Sections Poster
In October of 2021, I presented my RET research at the Joint Meeting of the American Physical Society and the American Association of Physics Teachers Fall meeting. I was thrilled when I was the recipient of the Outstanding Graduate Student Presentation Award.
Lab Activity Based on RET Work
In December 2021, my classes piloted a version of this activity using video data from coffee filters and a model they wrote themselves. You can see that notebook here.
This project was developed through the RET Site: High School Teacher Experience in Engineering Design and Manufacturing under the direction of the Department of Engineering Technology and the College of Education at the University of Houston (NSF Grant No. EEC-1855147 principal investigators Dr. W. Zhu and Dr. A. Reyes). Thanks also to doctoral student Arturo Haces-Garcia for help and support.
- Cromer, A. (1981). Stable solutions using the Euler approximation. American Journal of Physics, 49(5), 455–459. https://doi.org/10.1119/1.12478
- Hunter, J. D. (2007). Matplotlib: A 2D Graphics Environment. Computing in Science & Engineering, 9(3), 90–95. https://doi.org/10.1109/MCSE.2007.55
- Kluyver, T., Ragan-kelley, B., Pérez, F., Granger, B., Bussonnier, M., Frederic, J., Kelley, K., Hamrick, J., Grout, J., Corlay, S., Ivanov, P., Avila, D., Abdalla, S., & Willing, C. (2016). Jupyter Notebooks—a publishing format for reproducible computational workflows. Positioning and Power in Academic Publishing: Players, Agents and Agendas, 87–90. https://doi.org/10.3233/978-1-61499-649-1-87
- Let’s Code Physics. (n.d.). Home. [YouTube Channel]. Retrieved February 10, 2021, from https://www.youtube.com/c/LetsCodePhysics
- Orban, C. M., & Teeling-Smith, R. M. (2020). Computational Thinking in Introductory Physics. The Physics Teacher, 58(4), 247–251. https://doi.org/10.1119/1.5145470
- Reback, J., jbrockmendel, McKinney, W., Bossche, J. Van den, Augspurger, T., Cloud, P., Hawkins, S., gfyoung, Sinhrks, Roeschke, M., Klein, A., Petersen, T., Tratner, J., She, C., Ayd, W., Hoefler, P., Naveh, S., Garcia, M., Schendel, J., … Dong, K. (2021). pandas-dev/pandas: Pandas 1.3.0. https://doi.org/10.5281/ZENODO.5060318
- Schröder, A., Willert, C., Schanz, D., Geisler, R., Jahn, T., Gallas, Q., & Leclaire, B. (2020). The flow around a surface mounted cube: a characterization by time-resolved PIV, 3D Shake-The-Box and LBM simulation. Experiments in Fluids, 61(9), 1–22. https://doi.org/10.1007/s00348-020-03014-5
- Unity. (2021). Unity Manual. Retrieved July 27, 2021, from https://docs.unity3d.com/Manual/class-Rigidbody.html
- van der Walt, S., Colbert, S. C., & Varoquaux, G. (2011). The NumPy Array: A Structure for Efficient Numerical Computation. Computing in Science Engineering, 13(2), 22–30. https://doi.org/10.1109/MCSE.2011.37
- Virtanen, P., Gommers, R., Oliphant, T. E., Haberland, M., Reddy, T., Cournapeau, D., Burovski, E., Peterson, P., Weckesser, W., Bright, J., van der Walt, S. J., Brett, M., Wilson, J., Millman, K. J., Mayorov, N., Nelson, A. R. J., Jones, E., Kern, R., Larson, E., … van Mulbregt, P. (2020). SciPy 1.0: fundamental algorithms for scientific computing in Python. Nature Methods, 17(3), 261–272. https://doi.org/10.1038/s41592-019-0686-2
- Vonk, M., Bohacek, P., Militello, C., & Iverson, E. (2017). Developing model-making and model-breaking skills using direct measurement video-based activities. Physical Review Physics Education Research, 13(2), 1–12. https://doi.org/10.1103/PhysRevPhysEducRes.13.020106
- Weintrop, D., Beheshti, E., Horn, M., Orton, K., Jona, K., Trouille, L., & Wilensky, U. (2016). Defining Computational Thinking for Mathematics and Science Classrooms. Journal of Science Education and Technology, 25(1), 127–147. https://doi.org/10.1007/s10956-015-9581-5
- Wijaya, P. A., Fauzi, U., & Latief, F. D. E. (2019). A simple determination of air drag using video tracker and modifiable projectile launcher. Physics Education, 54(5). https://doi.org/10.1088/1361-6552/ab26eb