|
ANU College of Engineering and Computer Science
Research School of Computer Science
|
||
COMP3320/COMP6464 Cloth Dyanmics Project
Due by 17:00 on Friday 25 May 2012
This assignment is worth 20% of your total course mark.
This project extends the concepts introduced in assignment 1 to build a simulation of a cloth falling under gravity on a stationary spherical object. The cloth is modelled as a 2-D rectangular network, where node (x,y) (x and y are integers) in an (N*N) square network interacts with all other nodes (x+delta,y+delta) where delta is some (low value) integer. Thus if delta=1 a typical node will interact with 8 neigbouring nodes, while if delta=2 there are 24 interactions to consider. When a node is located on the cloth there may be fewer interactions. Thus in contrast to the MD simulation each node in the network interacts with a finite number of other nodes, making evaluation of the total interaction potential O(n), where n is the number of nodes.
Between each pair of nodes we define an interaction given by
Hooke's law. Where K is the force constant determining how stiff the spring is, R12 is the Euclidean distance between the two nodes and Eq12 is the equilibrium distance between these two nodes. For example if node (1,1) and node (1,2) have Eq12=1*d then node (1,1) and node (2,2) have Eq12=sqrt(2)*d. Each node we will assign a mass, noting that the force and accelaration are related by F=ma. The cloth is initially positioned in the xz plane and subjected to a gravitational force g in the y direction. As a consequence the cloth will slowly fall under gravity. Positioned below the cloth is a ball of radius r, such that the centre of the cloth is located 1+r units above the centre of the ball. The cloth is allowed to fall under gravity until it collides with the ball. You follow the motions of the nodes using the same velocity verlet algorithm that you used for the MD. The difference arises when a node in the cloth hits the ball. You detect this by noticing that the updated position of the node is within the radius of the ball. At this point you move the node to the nearest point on the surface of the ball.
STEP 1: Cloth simulation in Python (1 mark)
As discussed in lectures, something is not quite right! If you inspect the code you will see that if the new coordinates for the cloth are within the ball, then that node of the cloth is moved back to the surface of the ball. This happens here for node in nodes: dist = node.pos-vector(myball.x,myball.y,myball.z) if dist.mag < myball.radius: fvector=dist/dist.mag*myball.radius node.pos=vector(myball.x,myball.y,myball.z)+fvectorA problem arises in that the velocity of the node remains the same. In this step modify the code such that the component of the velocity that is in the direction of fvector above is set to zero. In other words only the component of the velocity that is tangential to the surface is allowed to be non-zero following a collision of a cloth node with the ball. The objective of this step is to modify the Python code to solve this problem in the velocity computation. Step 1 Submission Requirements You are required to submit the modified cloth1.py code.
The marks for this step will be given based on the following:
STEP 2: C and OpenGL implementation (8 marks)
Step 2 Submission Requirements Put your C code into the provided cloth.c file. Submit it together with the other files provided in the above mentiond package. The marks for this step will be given based on the following: STEP 3: Parallelising the cloth simulation and benchmarking(11 marks)
Run your OpenMP code on both partch and Xe. Provide a detailed comparison of the parallel performance on XE and on Partch. Step 3 Submission Requirements You are required to provide a single makefile for all versions of C source code that will build and run the cloth simulation on both XE and Partch for cloth_omp.c. The only difference between the two machines should be the instructions to make, eg make cloth_xe, or make cloth_partch, which shall generate exexutable files cloth_xe and cloth_partch. For non-parallelised version of the pure C code cloth_c.c, the makefile shall run as make cloth_c, and generate cloth_c (You can use difference compiling options for cloth_c.c on Partch and Xe. If you do so, please explain it in the README file). This details should be explained in your README file. Please note that running of your code shall accept command line input options as listed in opengl_stuff.c, and output per-iteration potential energy. The submission shall include a report titled Step3_Report.pdf (up to 4 A4 pages), which include performance analysis and comparison on the following topics The marks for this step will be given based on the following: STEP 4: (COMP6464 ONLY): SSE Implemention
Step 4 Submission Requirements Name your SSE version of the C code as cloth_sse.c. Submit it together with a makefile that can make it in XE System. You should write a report named Step4_Report.pdf(up to 2 A4 pages) to describe what you have done and compare the performance of the code before and after SSE has been applied. The marks for this step will be given based on the following: BONUS STEP: Only if you complete the above steps to high standard
Your task here is to implement a concept of the cloth ripping based on the OpenGL/C code. To do this add another input parameter -R that reads in a floating point number greater than 1.0 that indicates how much one of the springs can extend before they break. Give this parameter a default value of 1.5. Here we assume that the level of interaction is 1. You have to define a data structure that stores the connectivity of neighboring nodes. Augment your code to render the simulation process, and print out the number of broken springs (along with the potential energy) if run in verbose mode. The visualisation can be implemented in two options: MARKING AND SUBMISSIONSubmission Details
All your submitted code should include this header at the top: Name: Student Number: Course: Assignment Number: Name of this file: Lab Group: I declare that the material I am submitting in this file is entirely my own work. I have not collaborated with anyone to produce it, nor have I copied it, in part or in full, from work produced by someone else. I have not given access to this material to any other student in this course. You are required to submit a tar file using the submit tool on one of the student computers:
submit comp3320 cloth_project cloth.tar
or if you are a COMP6464 student
submit comp6464 cloth_project cloth.tar
The tar file should expand to give the following:
|
|
Please direct all enquiries to: comp3320@cs.anu.edu.au Page authorised by: Director of Research School, RSCS |
| The Australian National University — CRICOS Provider Number 00120C |