Please Help

profileTrivolution
ComputingProject2Contact-Curve.pdf

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. In essence, we will model a par- ticle bouncing off of a curved surface.

Each time the particle encounters the constraint sur- face, a contact/impact computation is done to (1) de- tect the contact, (2) interpolate the find the exact time of contact, and (3) resolve the contact by changing the velocity of the particle in accord with conservation of momentum and a model for energy loss in the normal direction (using the coefficient of restitution).

One of the cases we will explore is shown in the figure at right. The particle (which starts at the black dot and ends at the red one) is constrained to move within an ellipsoidal container. The particle has an initial position and velocity and the motion evolves in accord with projectile motion (including fluid drag). The problem is defined in a two-dimensional region (i.e., there is no z component of the motion in or out of the page). This restriction will make visualization easier.

The geometry of the constrained region 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 surface that the particle will bounce off of). The other feature of the function g(x,y) is that on one side g(x,y) > 0 (the side where the particle is) and on the other side g(x,y) < 0 (the side where the particle cannot go). 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 program Contact_Plane.m, which contains the MATLAB function CP2_plane.m, is available on the CANVAS website. This code does projectile motion with

-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  

drag and includes the logic to do 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. First, understand the code Contact_Plane.m and the function CP2_plane.m (which is located at the end of Contact_Plane.m) completely (the theory is in the CP Notes for this computing project). It is really important to know what every line of code does before you start writing your own code for CP 1. In particular, you need to understand how the contact detection works, how the interpolation of the state to get the exact point of contact is done, and how the contact is resolved. Run the code. Change the inputs. Run it again. Ask questions about it.

2. Create a code that does the impact problem for a curved surface.

a. Add additional surface functions g(x,y) to the function CP2_plane.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. For example, use the variable type to establish which curve to use from the function CP2_plane.m. Within the function CP2_plane.m you can use a ‘switch’ statement and have the code associated with each different curve there as a ‘case’ in the ‘switch’ statement. Then, when you call CP2_plane.m you can pass in type and the function will execute the case you have asked for. That will save you from having multiple functions or from needing to ‘comment out’ lines of code if you want to do a differ- ent case.

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

   

     

 

         

   

-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  

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. Note where that is done in Contact_Plane.m (in the graphics section after the computations are complete). Again, note that you can use type to distinguish between the various cases your code can do.

3. Verify the code. Make sure that your code hits the published benchmark result prior to the in-class code check. Note that the benchmark is not sufficient as a code ver- ification (see Evaluation of Computing Projects). Look some other ways to prove that your code works in all situations it was designed for and document them.

4. Explore and discover. Use the code to explore the problem. The following explo- rations steps are required (to qualify for satisfactory rating):

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.

The purpose of exploration is to use your code to learn something about the phe- nomenon you are studying. What else can you observe? What does this system do? What other surfaces can you implement? How to the initial conditions affect the response? Pick out what you want to explore and try to do a systematic study that involves changing the inputs and seeing what happens. Look for trends.

5. 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.