- QQ：99515681
- 郵箱：[email protected]
- 工作時間：8:00-23:00
- 微信：codinghelp

MCD4140 Assignment 1 of 8

MCD 4140: Computing for Engineers

Assignment

Trimester 1, 2019

Status: Individual

Hurdle: There is no hurdle on assignment

Weighting: 10%

Word limit: No limit

Due date: By 12.00pm on Monday 6/05/2019 via Moodle (Week 10).

INSTRUCTIONS

This assignment should be completed INDIVIDUALLY. Plagiarism will result in a mark of zero. Plagiarism

includes letting others copy your work and using code without citing the source. If a part of your code is

written in collaboration with classmates, say so in your comments and clearly state the contributions of each

person.

NOTE: Your MATLAB code will be checked for plagiarism – DON’T RISK LOSING ALL 10 MARKS BY COPYING

SOMEONE ELSE’S CODE (OR BY ALLOWING SOMEONE ELSE TO COPY YOURS).

Download the assignment template files from Moodle and update the m-files named Q1a.m, Q1b.m, etc…

with your assignment code. DO NOT rename the m-files in the template or modify run_all.m. Check your

solutions to Q1 and Q2 by running run_all.m and ensuring all questions are answered as required. Do not

use close all, clear all, clc in any individual mfiles.

SUBMITTING YOUR ASSIGNMENT

Submit your assignment online using Moodle. Read the “Assignment upload instructions.pdf” to prepare

your ZIP file for submission. Your ZIP file (not .rar or any other format) must include the following

attachments:

a. Solution m-files for assignment tasks (e.g. run_all, Q1a.m, Q1b.m, etc.)

b. Any additional function files required by your m-files (e.g. heun.m, falseposition.m, etc.)

c. All data files needed to run the code including the input data provided to you (e.g. data1.txt,

data2.csv, etc.)

d. A completed cover sheet

Your assignment will be marked in your usual computer lab session during Week 11. YOU MUST ATTEND TO

HAVE IT MARKED. IF YOU DO NOT ATTEND, YOUR ASSIGNMENT MARK WILL BE ZERO. YOUR ZIP FILE WILL

BE DOWNLOADED FROM MOODLE DURING WEEK 10 AND ONLY THESE FILES WILL BE MARKED. We will

extract (unzip) your ZIP file and mark you based on the output of run_all.m on a Windows-based system. It is

your responsibility to ensure that everything needed to run your solution is included in your ZIP file. It is also

your responsibility to ensure that everything runs seamlessly on a Windows-based system (especially if you

have used MATLAB on a Mac OS or Linux system). Windows OS computers are available in the computer labs

on campus for testing. The assignment will not be downloaded to your individual laptops for marking.

MARKING SCHEME

This assignment is worth 10% (1 Mark = 1%) of the unit mark. Your assignment will be graded using the

following criteria:

MCD4140 Assignment 2 of 8

1) run_all.m produces results automatically (additional user interaction only if asked explicitly)

2) Your code produces correct results (printed values, plots, etc…) and is well written.

3) Coding interview performance

CODING INTERVIEW RUBRIC

As part of the marking process, your demonstrator will spend a few minutes interviewing you to gauge your

understanding of the assignment code. The purpose of this is to ensure that you have contributed to the

assignment and understand the code.

You will be assigned a score based on your interview and your code mark will be penalized if you are unable

to explain your submission.

Category Description Penalty

No understanding The student has not prepared, cannot answer even the most basic

questions and likely has not even seen the code before. 100%

Trivial

understanding

The student may have seen the code before and can answer something

partially relevant or correct to a question but they clearly can’t engage in a

serious discussion of the code

30%

Selective

understanding

The student gives answers that are partially correct or can answer

questions about one area correctly but another not at all. The student has

not prepared sufficiently

20%

Good understanding

The student is reasonably well prepared and can consistently provide

answers that are mostly correct, possibly with some prompting. The

student may lack confidence or speed in answering.

10%

Complete

understanding

The student has clearly prepared and understands the code. They can

answer questions correctly and concisely with little to no prompting. 0%

ASSIGNMENT HELP

1) You can use function files you've written in your labs

2) You can ask questions in the Discussion Board on Moodle

3) Hints and additional instructions are provided as comments in the assignment template m-files

4) Hints may also be provided during lectures

5) The questions have been split into sub-questions. It is important to understand how each sub-question

contributes to the whole, but each sub-question is effectively a stand-alone task that does part of the

problem. Each can be tackled individually.

6) It is recommended that you break down each sub-question into smaller parts too, and figure out what

needs to be done step-by-step. Then you can begin to put things together again to complete the whole.

7) The m-file templates contain comments and sections only as a guide. You do not need to follow its

structure.

8) Bold text has been used to emphasize important aspects of each task. This does not mean that you should

ignore all other text.

MCD4140 Assignment 3 of 8

QUESTION 1 [6 MARKS]

Background:

Flows around cylinders of various cross-sections continue to engender a significant amount of engineering

research interest due to its ubiquitous nature in society. Examples include bridge spans and pylons, high-rise

buildings, pipelines, heat exchangers and oil platforms. When fluid (such as air or water) flows around such

bodies, a wake develops which may become unstable and lead to a development of vortex streets. An

example of the vortex street formed by clouds flowing past an island is illustrated in Figure 1. Additional

information including images and animations can be found here.

Figure 1. Kármán vortex street caused by wind flowing around the Juan Fernández Islands off the Chilean

coast.1

The vortices that develop are capable of containing large amounts of energy which can cause damage to

neighbouring structures on impact. Therefore, engineers and scientists study the wake dynamics behind these

bodies with the aim of suppressing the vortex shedding. There are some cases where vortex shedding is

encouraged as to dissipate heat from a heated wall for example. Thus, it is crucial to determine when these

flows transition from a laminar state to vortex-shedding state.

A non-dimensional parameter commonly used to characterise such flows is given by the Reynolds number, Re.

The Reynolds number describes the ratio between inertial to viscous forces. That is, a small Reynolds number

flow is typically laminar as it is dominated by viscous forces. Higher Reynolds number flows become

susceptible to vortex shedding and ultimately turbulence.

Brief:

You, the engineer, have performed experiments in a water channel involving flow past a circular cylinder. All

flows are started from Re = 60 and then impulsively changed to either Re = 40, 45, 50, 55 or 65. The lift force

on the cylinder is measured as soon as Re is changed (i.e. at time equal zero) and this is recorded in the text

files fy_re<X>.dat where <X> represents the Re value. Each file contains:

1. [column 1] Time, t

2. [column 2] Lift force, Fy

It is clear from the flow visualisation in Figure 2 that the flow transitions from a laminar flow to a vortexshedding

state somewhere between Re = 40 and Re = 65. The lift force information can be used to predict the

critical Reynolds number, which describes the point of transition from laminar to vortex-shedding flow. You

are to complete the following tasks to determine the critical Reynolds number.

1 https://en.wikipedia.org/wiki/K%C3%A1rm%C3%A1n_vortex_street

MCD4140 Assignment 4 of 8

Figure 2. Axial vorticity contours of flow past a circular cylinder for Re=40 (top) and Re=65 (bottom).

Q1a

In the Q1a.m file, read in the data for Re = 40, 45, 50, 55 and 65 and store it into a 3D matrix using a for loop.

Be aware that there is header information.

A 3D matrix can be thought of as multiple 2D matrix planes stacked in the 3rd dimension. Consider matrix M

which is a 3-by-3-by-6 matrix. An illustration of its decomposition into six 2D matrix planes is shown below:

Plane 1:

M(1,1,1) M(1,2,1) M(1,3,1)

M(2,1,1) M(2,2,1) M(2,3,1)

M(3,1,1) M(3,2,1) M(3,3,1)

Plane 2:

M(1,1,2) M(1,2,2) M(1,3,2)

M(2,1,2) M(2,2,2) M(2,3,2)

M(3,1,2) M(3,2,2) M(3,3,2)

Plane 3:

M(1,1,3) M(1,2,3) M(1,3,3)

M(2,1,3) M(2,2,3) M(2,3,3)

M(3,1,3) M(3,2,3) M(3,3,3)

Plane 4:

M(1,1,4) M(1,2,4) M(1,3,4)

M(2,1,4) M(2,2,4) M(2,3,4)

M(3,1,4) M(3,2,4) M(3,3,4)

Plane 5:

M(1,1,5) M(1,2,5) M(1,3,5)

M(2,1,5) M(2,2,5) M(2,3,5)

M(3,1,5) M(3,2,5) M(3,3,5)

Plane 6:

M(1,1,6) M(1,2,6) M(1,3,6)

M(2,1,6) M(2,2,6) M(2,3,6)

M(3,1,6) M(3,2,6) M(3,3,6)

Examples of matrix addressing is provided below:

M(2,2,1) will address element corresponding to row 2, column 2, plane 1.

M(1,3,4) will address element corresponding to row 1, column 3, plane 4.

M(:,2,6) will address elements corresponding to all rows, column 2, plane 6.

M(:,:,3) will address elements corresponding to all rows, all columns, in plane 3.

MCD4140 Assignment 5 of 8

In figure(1)2

, plot the lift force against time on linear axes for each Re in a 3-by-2 subplot arrangement as

follows:

[panel 1] Re = 40 [panel 2] Re = 45

[panel 3] Re = 50 [panel 4] Re = 55

[panel 5 + 6] Re = 65

The plot characteristics for all subplot panels are black continuous lines. The title of your subplot windows

should correspond to the Re of the data.

*You should have one figure window by the end of this task.

Hint: Use sprintf() to import data and to title the subplots.

Q1b

In the maxima.m file, complete the function to determine a specified number of maxima turning points in the

data that is supplied to the function.

Q1c

In the Q1c.m file, use the function you wrote in Q1b to determine the first 350 maxima turning points in the

lift force data for each Re. The maxima turning points represent the amplitude measure of the flow. In

figure(2), plot the amplitude against time on logarithmic axes for each Re in a 3-by-2 subplot arrangement

as follows:

[panel 1] Re = 40 [panel 2] Re = 45

[panel 3] Re = 50 [panel 4] Re = 55

[panel 5 + 6] Re = 65

The plot characteristics for all subplot panels are red continuous lines with circles. The title of your subplot

windows should correspond to the Re of the data. A legend is not required.

*You should have two figure windows by the end of this task.

Q1d

In reviewing the plots (on logarithmic scales) created in Q1c, you notice that the initial trend of the amplitude

against time data is relatively linear. This suggests that the data follows the power model

where α and β are coefficients.

In the Q1d.m file, you are required to identify the timespan (starting from 0) where the amplitude data for all

Re illustrates a linear trend. A SINGLE timespan should be used for all Re. You are to determine this timespan

through observation. On the existing plots of figure(2), plot the linear segments of the amplitude against time

data using red circles with a continuous line for each Re.

*You should still have two figure windows by the end of this task.

2 Note that figure(H) makes H the current figure, forces it to become visible, and raises it above all other figures on the

screen. If Figure H does not exist, and H is an integer, a new figure is created with handle H.

MCD4140 Assignment 6 of 8

Q1e

It turns out that the β coefficient represents the growth rate of the flow. That is, a negative β coefficient

represents a laminar flow whereas a positive β coefficient represents a vortex-shedding flow.

In the Q1e.m file, curve fit the linear segments using a power model to determine the coefficients α and β

for each Re. In figure(3), plot β against Re using black diamonds and turn on the grid.

*You should have three figure windows by the end of this task.

Q1f

In the Q1f.m file, fit polynomials of order 1 to 5 to β against Re. Plot these polynomials as continuous lines in

figure(3) using colour specifications 'rbkgm'. Additionally, determine the critical Re value for each polynomial

fit and plot these as diamonds in figure(3) using colour specifications 'rbkgm'. Use any appropriate rootfinding

method to determine the critical Re. The legend may contain duplicate entries (as provided in the mfile).

Lastly, use fprintf() to print a list of values similar to the following:

Polynomial Re_c

*You should still have three figure windows by the end of this task.

MCD4140 Assignment 7 of 8

QUESTION 2 [4 MARKS]

The rate of change of temperature of an object is directly proportional to the difference in temperature

between the object and its surrounding, such that it is described by:

where T represents the temperature, t represents the time, Ts represents the surrounding temperature and k

is a constant.

Q2a

In the Q2a.m file, calculate the temperature of an object from t=0 to t=60 units, assuming T(0) = 0.3, k=0.5

and Ts = 2. Do this using Euler's method and Heun's method with a time step of 3.5 units.

In figure(4), plot the temperature against time solutions – Euler as a blue line and Huen's as a red line. Use

fprintf() to describe why the solution using Euler's method differs greatly to Heun's method.

Q2b

In the Q2b.m file, calculate the temperature of a point on the plate from t=0 to t=60 units for k=[0.1, 0.5, 1, 2],

assuming T(0) = 0.3 and Ts = 2. Do this using the midpoint method with a time step of 1 unit.

In figure(5), plot temperature against time for each k value. Use the RGB values defined in the 'colourmap'

variable as provided in the m-file to colour solutions from the smallest k to the largest k (top row to the

bottom row).

Q2c

The temperature profile on a plate that is 17m long

(∈ [7,10]) and 9m wide ( ∈ [1,8]) is illustrated in

the figure on the right. The temperature profile on the

plate is described by:

The average temperature of the plate can be calculated

through:

In the Q2c.m file, calculate the average temperature of the plate using the composite Simpson's 1/3 rule

using 99 points in each direction (x and y). Start by evaluating the inner integral along the x dimension for

each value of y. The resulting values can be integrated along the y dimension. Use fprintf() to print a

statement containing the average temperature to 4 decimal places.

*You should still have three figure windows by the end of this task.

MCD4140 Assignment 8 of 8

Hint: You may want to create a function file for the composite Simpson's 1/3 rule that accepts vectors. i.e. the

function header declaration may be: I = comp_simp13_vector(a,b), where I is the integral and (a,b) are

the points you are integrating.

Poor Programming Practices [-2 Marks]

(Includes, but is not limited to, poor coding style or insufficient comments or

unlabeled figures, etc.)

(END OF ASSIGNMENT)

版權所有：留學生編程輔導網 2018 All Rights Reserved 聯系方式：QQ:99515681 電子信箱：[email protected]

免責聲明：本站部分內容從網絡整理而來，只供參考！如有版權問題可聯系本站刪除。