controler12
Enthusiast
I am taking an online C++ class with my local college, but im i have fallen behind due to all my junior stuff for high school, can someone give me some pointers on how to set up this program? I understand how to load in the variables from a file but part b has me a bit confused. The rest is pretty easy for me. I will rep anyone who helps.
When the space shuttle reenters the earth's atmosphere, air friction generates a large amount of heat at the leading edges of the ship. An energy balance on the shuttle's surface yields the following equation:
( v / b ) ^2sin(alpha)= kr * Ts^4 +Uc *Ts -q
where:
v............reentry velocity in miles per hour
alpha....reentry angle in degrees (90 degrees when reentry is perpendicular to the earth's surface)
T[sub]s[/sub] .........shuttle outside surface temperature (K)
b........... a constant = 17,000 miles per hour
k[sub]r[/sub]...........radiation heat transfer constant = 1.1e[sup]− 12[/sup] (1/K)[sup]4[/sup]
u[sub]c[/sub]..........convective heat transfer coefficient = 0.002 1/K
q............a dimensionless constant = 2.5
Note: k[sub]r[/sub], u[sub]c[/sub], q, and b are all constants read in from a text file, shuttle.txt.
To solve this equation using a root-finding method, you must first set the equation equal to zero by subtracting the (v/b)[sup]2[/sup] sin (alpha) term from both sides.
Your task is to solve this equation for various reentry conditions (alpha and v) to determine: (1) whether the reentry surface temperature is safe, and (2) which set of alpha and v give the minimum and maximum values for T[sub]s[/sub].
Program specifics:
Write a C++ program that does the following:
a. Reads the heat transfer parameters (k[sub]r[/sub], u[sub]c[/sub], q, and b) from the file shuttle.txt, found by clicking here. (You must use this exact file.)
b. Using the secant method, solves for the shuttle surface temperature (T[sub]s[/sub]) for the 20 combinations of five reentry angles (10, 25, 40, 55, and 70 degrees) and four reentry velocities (16,000, 16500, 17,000, and 17,50 mph). Use a void function called secant, which calls a single assignment function called fx to solve for T[sub]s[/sub] for each combination of v and alpha.
c. Determines whether the surface temperature is below 1000 K (safety limit) for each combination of conditions.
d. Determines the combination of v and alpha that cause both the maximum and minimum temperature conditions.
e. Writes a well-formatted table (20 rows by 4 columns) to the screen and to a file called results.txt. The title of the table must clearly indicate what the table shows, and the heat transfer parameters (kr, uc, b, and q) employed, including their units. The heading of the table must indicate the property listed in each column and its units. Each column lists, respectively, the angle, the velocity, the resultant surface temperature, and the word "safe" if the temperature is below 1000 K, or "unsafe" if it exceeds 1000 K.
f. Following the table, the program must list, clearly labeled, the maximum and minimum temperatures and the combination of conditions (velocity and angle) for which they would be achieved.
Here is an example output of a similar program.
When the space shuttle reenters the earth's atmosphere, air friction generates a large amount of heat at the leading edges of the ship. An energy balance on the shuttle's surface yields the following equation:
( v / b ) ^2sin(alpha)= kr * Ts^4 +Uc *Ts -q
where:
v............reentry velocity in miles per hour
alpha....reentry angle in degrees (90 degrees when reentry is perpendicular to the earth's surface)
T[sub]s[/sub] .........shuttle outside surface temperature (K)
b........... a constant = 17,000 miles per hour
k[sub]r[/sub]...........radiation heat transfer constant = 1.1e[sup]− 12[/sup] (1/K)[sup]4[/sup]
u[sub]c[/sub]..........convective heat transfer coefficient = 0.002 1/K
q............a dimensionless constant = 2.5
Note: k[sub]r[/sub], u[sub]c[/sub], q, and b are all constants read in from a text file, shuttle.txt.
To solve this equation using a root-finding method, you must first set the equation equal to zero by subtracting the (v/b)[sup]2[/sup] sin (alpha) term from both sides.
Your task is to solve this equation for various reentry conditions (alpha and v) to determine: (1) whether the reentry surface temperature is safe, and (2) which set of alpha and v give the minimum and maximum values for T[sub]s[/sub].
Program specifics:
Write a C++ program that does the following:
a. Reads the heat transfer parameters (k[sub]r[/sub], u[sub]c[/sub], q, and b) from the file shuttle.txt, found by clicking here. (You must use this exact file.)
b. Using the secant method, solves for the shuttle surface temperature (T[sub]s[/sub]) for the 20 combinations of five reentry angles (10, 25, 40, 55, and 70 degrees) and four reentry velocities (16,000, 16500, 17,000, and 17,50 mph). Use a void function called secant, which calls a single assignment function called fx to solve for T[sub]s[/sub] for each combination of v and alpha.
c. Determines whether the surface temperature is below 1000 K (safety limit) for each combination of conditions.
d. Determines the combination of v and alpha that cause both the maximum and minimum temperature conditions.
e. Writes a well-formatted table (20 rows by 4 columns) to the screen and to a file called results.txt. The title of the table must clearly indicate what the table shows, and the heat transfer parameters (kr, uc, b, and q) employed, including their units. The heading of the table must indicate the property listed in each column and its units. Each column lists, respectively, the angle, the velocity, the resultant surface temperature, and the word "safe" if the temperature is below 1000 K, or "unsafe" if it exceeds 1000 K.
f. Following the table, the program must list, clearly labeled, the maximum and minimum temperatures and the combination of conditions (velocity and angle) for which they would be achieved.
Here is an example output of a similar program.