Program to solve shock-wave equation

Assignment Help Python Programming
Reference no: EM131687472

Learning Outcomes

In this assignment you will demonstrate your understanding of solving engineering problems using numerical computations and assessing particular algorithms. The objectives of this assignment are to program algorithms for root-finding, solving systems of linear algebraic equations, performing least-squares approximations and interpolations, regressing solutions and solving a transport equation using finite-difference discretization schemes.

Rootfinding

Imagine a wedge-shaped object flying through air at supersonic speeds (see Fig. 1). In compressible flow theory (covered in MCEN90008 Fluid Dynamics), it is known that an oblique shock wave forms at the front tip of this object under certain conditions

2.1 Analytical solution for θ = 0°

For θ = 0, i.e. the object would be a flat plate, show that two possible solutions for β are

βL = arcsin (1/M), βU = 90°.

βU and βL are usually called the strong shock and weak shock solutions, respectively. Even though we can mathematically obtain two possible solutions, in reality, or physically, only the weak shock solution occurs.

Graphical solution

Plot f(β) vs β for

a. M =1.5 and θ = 5°, 10° and 15°

b. M = 5.0 and θ =20°, 30° and 45°

Indicate how βU and βL change with θ and M. Can you identify from your plots the approximate value of θmax?

C program to solve shock-wave equation

Your task is to write a C code that solves Eq. (2) using the Newton-Raphson method to find the root of f (β), regarding θ and M as parameters and solving for β.

(a) Write your C program such that it uses the Newton-Raphson method to solve f (β) = 0. What values of βL and βU do you think might be appropriate to use as an initial guess? For M = 5.0 and θ =20°, you should find that βL =  29.80092...° , and βU =  84.55625...°

(b) Extend your C program to find βU and βL values for M = 5.0 and 0 ≤ θ ≤ θmax. Remember that for θ = 0, βL = arcsin(1) and βU= 90°. Plot values of θ on the horizontal axis and M corresponding values of β on the vertical axis. Your solution to this part of the assignment should look like Fig. 2. Note that you can plot your results obtained from your C code with your program of choice, e.g. Matlab, Excel, etc.

(c) Use your computer program to solve f (β) = 0 for M = 1.5, 3.0, 4.0, 5.0, 7.0, 8.0. Plot β vs θ for all the M's. This plot is called the θ-β- M diagram and you will find it very useful if you decide to do MCEN90008 Fluid Dynamics in the future.

Linear Algebraic Systems

Write a C code using the Thomas algorithm to solve the tri-diagonal system shown in Eq. 4. Since the tri-diagonal system is a banded matrix, you need not store all the zeros!

Regression

Write C code that uses both second-order Lagrange interpolating polynomials and cubic splines in order to estimate f (x). Estimate the value of f (x= 5) using both methods. You will implement both methods in interp0, reading in from the file in_interp.csv the values of x and f (x) and outputting the values of the interpolated value to out_interp.csv in the following format (up to 6 decimal places).

Differentiation, differential equations

Tasks

Run your code until a time of t =2.0 for different resolutions Δx, i.e. different number of grid points Nx. Your time steps need to satisfy the so-called Diffusion number, specifying that µΔt/(Δx)2 ≤ 1. You should investigate the effect of

- spatial resolution, i.e. Δx, determined by the number of points Nx used
- temporal resolution Δt (or, for a given Δx, variations of the Diffusion number µΔt/(Δx)2

- effect of time integration type (explicit vs implicit) on the maximum time step permitted on the accuracy of the solution. In particular, assess the error made in amplitude of the numerical solution compared with the solution obtained with Nx = 1,000 and Diffusion number 0.1, called grid-independent reference solution.

Project Report

Your project report need not be a full technical report but should state all approximations made and use figures of results to back up any conclusions. Be sure to include enough detail (using appendices as necessary) so that your results could be reproduced by another researcher (or yourself at a future date!) wishing to check or extend your findings. Your report will be primarily assessed on the completeness of the results, and the visual/logical effectiveness of the manner in which they are presented.

Attachment:- codes.zip

Reference no: EM131687472

Questions Cloud

How would you handle the given scenario described : How would you handle the scenario described above? First, apply rational decision-making to the scenario, and describe in detail what that plan would look like.
How does exercise impact hdls and ldls : In your list above of Deborah's risk factors, identify the risk factors that Deborah has that are considered modifiable risk factors.
What are make to stock strategy-assemble to order strategy : What are “make to stock strategy”, “assemble to order strategy”, and “make to order strategy”? Examples of how one operation went from one strategy to another?
What is the firm profit-maximizing : What is the firm's profit-maximizing (or lossminimizing) output level? What is the amount of its economic profits (or losses) at this output level?
Program to solve shock-wave equation : ENGR30003 - Write your C program such that it uses the Newton-Raphson method - demonstrate your understanding of solving engineering problems
Explain what are the limitations of financial ratios : After review of financial statements, managers can use basic financial ratio analysis tools to establish. Explain what are the limitations of financial ratios?
Discuss the implications of producing product or service : Think of a new or revised product or service that you would like to see on the market. Discuss the implications of producing that product or service.
Improve or worsen its position : Will Cuba's current "open" status improve or worsen its position (politically and economically) in the global supply chain?
What return can expect from investing with kec : A client, Marta Gomez has come to you. On the basis of an analysis of past returns and inflationary expectations, she feels that the expected return on stocks.

Reviews

len1687472

10/23/2017 5:35:20 AM

There are several ways for you to seek help with this assignment. First, check the Assignment 2 Frequently Asked Questions wiki in the LMS (subsection Assignments). It is likely that your question has been answered here already. You may also discuss the assignment on the “Assignment 2” discussion board.

len1687472

10/23/2017 5:35:11 AM

Remember to fill in your details in each file you write, such as the student name and student number. Key points about your code for this assignment you need to understand are as follows: • For the purposes of the report, you can output as many files or terminal outputs as you need. These outputs can be used to generate graphs/plots and values for the different tasks. • Once you have all information you need for the report, your code must be made submission worthy i.e. only output the outfiles described above (6 outfiles are expected). This means your code must not expect user input once you execute it, all inputs would come from the infiles or the terminal before execution. • You have to parse the command line arguments (all infiles and any command line values) i.e. no hardcoding the names of the infiles or the value for interpolation task. This is because we will be using our own infiles, with different filenames and different locations.

len1687472

10/23/2017 5:34:38 AM

The C codes are to be submitted on dimefox where they would be tested on different inputs from the ones you were provided to test your implementations. 7.2.1 Provided Code • main.c, where the parsing of data from command line is to be done and timing for each task implemented. • tasks.c, where you would implement four functions shockwave() (Question 2), linalgbsys() (Question 3), interp() (Question 5) and heateqn() (Question 6), for each task. • tasks.h, which acts as a header file to link the C file to the main file. You may edit this to add any struct’s or the input arguments to the functions.

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd