Matlab CP 2 CEE 212
Arizona State University The Mechanics Project CEE 212—Dynamics CP 2—Contact
1
Computing Project 2 Contact
Introduction
The second computing project is called Contact. The concept is to subject projectile motion to live within a constrained surface. Each time the particle comes in contact with a constraint surface a contact/impact computation is done to change the velocity of the par- ticle based upon conservation of momentum and a model for energy loss in the normal direction. One ex- ample is shown in the figure at right. The particle (which starts at the black dot and ends at the red one) is constrained within an ellipsoidal boundary. The par- ticle has an initial position and velocity and the motion evolves in accord with projectile motion (with fluid drag). The problem will be defined in a two-dimen- sional region (i.e., there is no z component of the mo- tion). This restriction will make visualization easier.
The geometry of the constrained space is defined by a function g(x,y) for which the equa- tion g(x,y) = 0 defines the boundary of the region (i.e., the walls). The other feature of the function g(x,y) is that on one side g(x,y) > 0 (the side the particle can be moving) and on the other side g(x,y) < 0 (the particle cannot go there). The main task of this project is to write the logic for describing the constraint function, checking for contact, and resolving the contact using the impulse/momentum calculation.
When the projectile is not at a contact event it moves freely, subjected to gravity and the drag forces of the fluid. Hence, the time-stepping part of this problem is very similar to CP 1. More information on the background for this project can be found in the CP Notes for the project. Also, lots of information on the particle with drag problem can be found in the Course Notes entitled Numerical Methods.
What you need to do
The basic MATLAB programs Contact_Plane.m and the MATLAB function plane.m are available on Bb. This code does projectile motion with drag and includes contact with a flat plane. You can use this code as a template for CP 2. You will need to add different kinds of constraint functions.
The specific tasks you will need to do include the following:
1. Create a code that does the impact problem for a curved surface.
-10 -5 0 5 10
-20
-15
-10
-5
0
5
10
15
20
x y
Arizona State University The Mechanics Project CEE 212—Dynamics CP 2—Contact
2
a. Add additional surface functions g(x,y) to the function curve.m so that you can do (in addition to a flat plane) a parabolic surface, an ellipse, and a corrugated surface. Include a simple way of changing from one to the other (e.g., use the variable type to establish which curve to use from the func- tion curve.m.
The functions for the three required surfaces are
2
2 2
( , ) parabola
( , ) cos corrugated
( , ) 1 ellipse
g x y y ax bx c
x g x y y a
b
x y g x y
a b
b. Develop a means of drawing the outline of the constraint function for the various different types of constraints so you can see the particle bouncing off of the surface.
c. Implement the code feature in which you calculate the exact time, position, velocity, and acceleration of the impact and adjust to capture that instant (this is just an interpolation between the last step, which was not pene- trated, and the next step, which is penetrated). See the CP 2 Notes.
2. Explore and discover. Use the code to explore the problem. Some suggestions
a. Plot the energy vs. time. Why is more energy lost in some contact than in others? Does the angle of impact matter?
b. What happens when the normal energy is exhausted but the ‘in-plane’ ve- locity is not? Does the particle slide on the surface or does it stop?
c. You might notice that when the particle stops bouncing, when most of the energy is exhausted, it can ‘fall through’ the surface. Why does this hap- pen? Can you fix the code to avoid this numerical problem?
d. Implement some other surfaces and explore their behavior.
e. What else can you observe?
-15 -10 -5 0 5 10 15
2
4
6
8
10
12
14
16
18
20
x
y
-30 -25 -20 -15 -10 -5 0 5 10 15 20
0
5
10
15
20
x
y
Arizona State University The Mechanics Project CEE 212—Dynamics CP 2—Contact
3
3. Write a report documenting your work and the results (in accord with the specifi- cation given in the document Guidelines for Doing Computing Projects). Post it to the Critviz website prior to the deadline. As usual, consult the document Evalua- tion of Computing Projects to see how your project will be evaluated to make sure that you can get full marks. All projects will be subject to the peer review process.