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

  Develop and test a python program

Develop and test a Python program that displays the day of the week that the following holidays fall on for a year entered by the user New Year's Eve

  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.

  Identify the top three comments made in given survey

Identify the top three comments made in survey years 2015 and 2016. Report the top three most common comments based on their relative frequency.

  Write the portion of the app that deals with hamburger sales

He has assembled a team of fellow students to help write the app. Your job is to write the portion of the app that deals with hamburger sales.

  Create an inheritance relationship between two classes

For this assignment you will create a simple class hierarchy. You will create an inheritance relationship between two classes -- a Friend class and a Person class - Friend will inherit Person

  Create mini-python projects or programs

Your assignment is to create mini-Python projects or programs and to run them in the Python-IDLE environment

  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.

  Create a cheat commands in the game

Create a cheat commands in the game so player can pick up any item he wants from any location in the map - Display all possible actions you can carry out in game.

  Write a program that produces a comparison of the balance

Write a program that produces a comparison of the balance of a bank account over time between simple, monthly and daily methods of compounding interest.

  What good are movie ids and ratings

Implement a function called topRated(). The function will take a file name as a parameter and return a sorted list - What good are movie IDs and ratings? You want to know the actual title of the movie! Implement a function called getTitles(). The fu..

  Modify your code to ask the user for the id of a restaurant

Copy check1.py to check2.py and continue to work on check2.py. Modify your code to ask the user for the id of a restaurant between 1 and 155 (humans don't need to know about list ids starting at 0).

  Specializes in solving the equations ax=b by doolittle''s dec

Write a  program that specializes in solving the equations Ax=b by Doolittle's decomposition method, where a is the HIbber matrix of arbitrary size nxn

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