Skip to content

Instantly share code, notes, and snippets.

Created November 19, 2009 02:17
Show Gist options
  • Save anonymous/238479 to your computer and use it in GitHub Desktop.
Save anonymous/238479 to your computer and use it in GitHub Desktop.
Programming Project PA4 Fall 2009
Euler's method and the baking-oven problem
Your file must include a UBEAS230 box as described in the Guidelines. The name of your .cpp file must include your UBIT name and the assignment abbreviation (PA4) (for example: hstengerPA4.cpp). Upload your file before 5:00pm on the due date using the dropbox found on the front page of the website.
Problem statement:
The fuselage of the V-22/Osprey is made by Boeing Helicopter in Philadelphia. It is made from several large pieces of carbon fiber composite that must be baked in a pressurized oven. The heat-up time of the oven must be carefully controlled so that curing of the composite occurs evenly. Your assignment is to calculate the heat-up time for various fuselage parts, and to determine if they meet a given criteria. This program will use material covered through Chapter 2 and Section 4.9.
For more pictures of the V-22 Osprey click here.
The differential equation you will solve for the temperature change is:
Here:
T = part temperature (oC)
t = time (min)
m = mass of the part (kg) [given in the case data file]
Tf = furnace temperature (oC) [given in the case data file]
k = a constant for the oven = 998 kcal/min/oC
Cp = heat capacity of the part (kcal/kg/oC)
and
a = 14.5 (kcal/kg/oC)
b = 0.156 (kcal/kg/(oC)2)
c = 0.000025 (kcal/kg/(oC)3)
You are to assess five different parts to determine if they will be within 4oC of the furnace temperature after they are heated in the furnace between 100 and 110 minutes. A data file heatdata.txt (click here for the file) lists the mass of the part and the temperature of the furnace it is to be heated in.
Program specifics:
Write a C++ program that does the following:
a. Reads the data from the heatdata.txt file just as it appears. You must use getline to skip over the text in the first line. Place the data into two arrays—one for the mass of the part and one for the furnace temperature.
b. Requests from the user (through the keyboard and screen) the size of the time step to be used in an Euler's-method solution of the differential equation listed above.
c. Calls a void function to solve the differential equation (dT/dt) and check whether the temperature of the part is within 4oC of the furnace temperature after heating between 100 and 110 minutes.
For example: If the furnace temperature is 250oC, did the part reach 246oC after 100 minutes, but before 110 minutes? Assume the initial temperature of the part is 25oC.
d. Prints to the screen, and to a file named results.txt, a well-formatted statement block for each of the five cases. The statement block should include all the relevant parameters, including their units (this includes the part mass, furnace temperature, final temperature reached, and the step size used), and a statement whether the temperature criterion was met.
Make sure your answer is not dependent upon step size. Vary the step size until you are sure your answer is not changing just because you change the step size.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment