|
Hands-On, Minds-On Meteorology
Description
| Programming | Operation
3D
Collisions
Description
This will detail the theory put into the code for 3 dimensional collisions.
The need for such programming came from needing to be able to predict
a 3D angle and speed for two particles
Programming
Theory
When two particles contact each other, the force between the molecules
is directed along an imaginary line that connects their centers. If
you rotate your frame of reference so this center-line is aong the
x-axis, this is simply a 1-D collision problem, where in an elastic
collision, the forces acting upon each other are just switched (in
equal mass cases -- this code does mass-weight the vector switching
for colliders with unequal masses, which is not reflected in the equations).
The steps used in this case are as follows:
- Determine the 3D angle between the two colliders.
- Calculate the colliders' force vectors towards each other.
- Decompose this vector into x'-y'-z' components, where x'
is aligned with the center-line.
- Before switching the colliders' force vectors, determine
the force vector normal to the center-line so we can recompose
the new collision.
- Switch the colliders' force vectors.
- Compose the new vectors into a new velocity.
|
Colliders at impact
|
Step 1: Determine the 3D angle between the two colliders.
Step 2: Calculate the colliders' force vectors towards each
other.
Step 3: Decompose this vector into x'-y'-z' components, where
x' is aligned with the center-line.
|
Component of velocity directed from one collider to the other
is calculated.
|
Step 4: Before switching the colliders' force vectors, determine
the force vector normal to the center-line so we can recompose
the new collision.
|
Component of velocity perpendicular to center-line is calculated. |
Step 4: Switch the colliders' force vectors.
|
The colliders' velocity vectors that are parallel to the center-line
are switched. (Mass-weighting applied if different masses) |
Step 5: Compose the new vectors into a new velocity.
|
New velocity is calculated by reconstructing new vectors. |
Assumptions
1) All collisions are elastic.
2) All particles are perfect spheres.
3) That the objects can come closer than the sum of the radii of the
two particles.
4) Only two particles can collide at a time. If three technically
hit together, the particle with the lowest array index will collide
with the second lowest, then separately with the next lowest. Then,
if the second is still close enough to the third, a third collision
will result.
Equations
All equations can be found in the theory.
Other
--
Operation
Running the Program
The following programs use the 3D Collisoions in their code. ParcelSet*
code.
Program
|
Name of program's main file
|
Name of file with 3D Collisons included
(referred by main program file)
|
Condensation
|
Cond.java
|
ParceSetCond.java
|
Evaporation
|
Evap.java
|
ParcelSetEvap.java
|
Lifting Air (Dry)
|
Ad1.java
|
ParcelSetAd1.java
|
Lifting Air (Moist)
|
Ad2.java
|
ParcelSetAd2.java
|
Lifting Air (Moist w/Sounding)
|
Ad3.java
|
ParcelSetAd3.java
|
Temperature
|
Temp.java
|
ParcelSetTemp.java
|
Temperature (Large)
|
Temp800.java
|
ParcelSetTemp800.java
|
|
Department of Atmospheric Sciences
University of Illinois at Urbana Champaign
Created by Dan Bramer: Last Modified 07/27/2004
send questions/comments to bramer@atmos.uiuc.edu
|
|