Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写



这是一篇来自澳洲的关于为潜在流量分配PART I的程序代写



  • Assignment to be handed in by 23:59 on Sunday 18th September 2022.
  • This assignment should be done in groups of 2 students. Both students in the group will get the same mark for this assignment. If you choose to do the assignment alone, no concession will be given. Your assignment will be marked the same as an assignment done by two students.
  • Please choose your group partner carefully.
  • Only hand in one assignment per group.
  • You can use any programming language to complete this assignment. If you should decide to write your computer program in MATLAB, you are not allowed to use the streamline, odexx or similar functions in MATLAB i.e. you need to write the program to solve the ordinary difffferential equations yourself and not simply use the functions in MATLAB. Also do not merely use the contour function of ψ to visualise streamlines. The aim of this assignment is for you to produce a set of tools to enable you compute the coordinates of pathlines. The same rules apply if you use other languages.
  • When you submit your assignment, please include

– Copies of all computer programs appended as pdf fifiles.

– Written documentation with computer generated graphs and sketches.

This documentation must contain all discussions and all the exercises that you were asked to do in the main part of this assignment.

  • Marks will be deducted for incorrect or absent axis labels.
  • Unless stated otherwise, please use equal scaling along each axis (this is achieved by setting daspect([1 1 1]) In Matlab).

Part I

For the fifirst part of this assignment, you will write codes to accurately plot pathlines – which for steady flflows are the same as streamlines – from given starting positions. Make sure you get this question right.

For the later parts of this assignment you will build on the computer program which you have written here to study much more complex flflows.

  1. (Total marks for question = 27) In order to write a computer code to sketch streamlines, it is best to fifirst start by writing a computer program to solve a simple problem.

(a) Write down the analytical solution to the following ordinary difffferential equation (ODE)

dx/dt = 5x (1)

with the initial condition

x = 1 at t = 0 (2) (1 Mark)

(b) Write a computer program to solve Eq. (1) using Euler’s (EU) and the 4th order Runge Kutta(RK-4) method (see the appendix for more information on EU and RK-4). Solve the equation from 0 ≤ t ≤ tf where tf = 0.2, 0.4, 0.6, 0.8 and 1.0. Perform your computations with various step sizes, (h = 0.1, 0.01, 0.001), and tabulate your results in the table shown below (show 4 decimal places).

EU RK-4 tf

Analytical answer

h = 0.1 h = 0.01 h = 0.001

h = 0.1 h = 0.01 h = 0.001






The output from your computer program must approach the analytical answer as h gets

smaller. Plot the analytical solution (x vs t) along with the EU and the RK4 solution for

h = 0.01 and 0 < t < 1. Use the axis limits axis([0 1 0 150]) and daspect([1 150 1]).

Which is the more accurate numerical method? EU or RK-4?

(8 Marks)

(c) Write down the analytical solution (write them as equations of the form x = f(t) and y = f(t)) to the following set of coupled ODE

dx/dt= x − 2y (3)

dy/dt= x − y (4)

You are given that at time, t = 0

 x y  =  −03  . (5)

(3 Marks)

(d) Extend your program from part (1b) so that it can solve the set of equations given by Eq.

(4) for 0 ≤ t ≤ tf . Check your program by completing the table below for both x and y for various tf and time-steps h. To save time in future questions, you should try to write your program such that you can easily change the set of equations f(x, y) and g(x, y) as defifined in the Appendix.

Which is the more accurate numerical method? Use the more accurate numerical method in ALL subsequent parts of this assignment.

(e) Plot y vs x for h = 0.1, h = 0.01 and h = 0.001 for both EU and RK-4 with tf = 2π. Plot the EU and RK4 calculations on separate fifigures. Should the lines join up? Do the lines join up?

(4 Marks)

(f) Use your computer program to plot the streamline pattern for the flflow described by Eq. (4)i.e. plot y vs x for a set of initial conditions, where tf = 10 and h = 0.01. You should modify your program such that you can pass it a number of starting positions xs and ys, the time step h and total time of integration tf . In matlab, this could be achieved by writing your program as a function where you pass the variables xs and ys (which could be vectors) and tf and h.

This function would then be used as follows,[xr yr] = my_streamline_function(xs, ys, tf, h)

where xr and yr are the returned coordinates (matrices) of the streamline and xs and ys are the start locations,

xs = [-1 -2 -3];

ys = [0 0 0];

For non-Matlabers, your program could read an input fifile where the fifirst line contains the number of streamlines, Nl , the time of integration tf and the time step h. The subsequent Nl

lines in the input fifile should contain the location of the initial points of the streamlines, (x0i y0i). For example, the input fifile to draw three solution trajectories that start from (0, −1),(0, −2) and (0, −3) with h = 0.01 and 0 < t < 10 will look something like,

3 10 0.01

-1.0 0

-2.0 0

-3.0 0

(3 Marks)

  1. (Total marks for question = 23) Consider the scenario shown in the fifigure 1 below. Some people are contaminated, and they are stood in a uniform flflow of strength U∞ from right to left.

Containment is attempted via an extraction fan in the location shown. We will model this scenario as a source of strength Qc representing the contaminant release, a sink of strength Qe = RQc,representing the extraction fan, and a uniform flflow from left to right. The ratio of the strength of the contaminant release Qc to the extraction fan strength Qe is given by R(≡ Qe/Qc).