ChEn Programing Project

The project is due Saturday, December 2, 2018 at midnight.


The purpose of this assignment is to help you integrate the individual programming skills that you have learned this semester to solve engineering problems.

You will be graded not only on the ability of the program to give the correct output, but also on good programming practices such as ease of use, code readability and simplicity, modular programming, and adequate, useful comments. Just remember that comments, indentation, and modular programming can really help others when assessing your project.


You will work in a team, which you can choose by editing the link that was emailed to you.

  • Our alumni from industry have strongly encouraged our department to help develop leadership qualities in our students.
  • Leadership qualities of a BYU Chemical Engineer:
    • Is reliable and can be counted on to accomplish tasks in a manner that exceeds expectations.
    • Takes initiative rather than waits for assignments.
    • Develops a vision in his/her scope of responsibility.
    • Identifies problems and solutions.
    • Understands the personality traits of self and others and can work with others in accomplishing tasks.
    • Is culturally sensitive and works effectively with people from diverse backgrounds.
    • Takes time to evaluate personal performance as a team member and improves when needed.
    • Gives honest feedback to others and helps them succeed in their responsibilities.
    • Receives criticism and makes changes where appropriate.
    • Follows as well as leads.
    • Demonstrates a good attitude on life and is pleasant to work with.

In case it is not obvious, there is no outsourcing of the project, it must be completed by your group members and you cannot look at, discuss, or use other group’s code. You may not consult with any other students except the TAs and instructor. You can use internet resources, and books for programming, physical properties, or heat exchanger basics. Just do your own work.

Problem: Shell-and-tube Heat Exchanger Design


Heat exchangers are all around us (car radiator, central air, refrigerator, etc.). They are especially important to chemical engineers in reactor design, operating a refinery or chemical process plant, and in many other situations where you need to transfer heat from one stream to another. One of the most commonly used heat exchangers is the Shell-and- tube heat exchanger as shown below.

Heat Exchangers exchange heat from a hot fluid to a cooler fluid to either heat up or cool down a stream. In designing our chemical plant, bioreactor, oil refinery, etc. we can determine the fluid temperature conditions that are necessary for optimal performance of our process. The next step is to determine what type of heat exchanger we could buy or if we should make a custom heat exchanger to do the job. Your project assignment is to create a program in which you supply the temperature conditions, the flow rates and the fluid types and it will tell you how large of a heat exchanger to build and how much it will cost.

We will be using the log mean temperature difference method (LMTD) to determine the size (surface area of pipe between fluids) of heat exchanger needed. This is an L3 competency that is commonly missed on the L3 exam (need to pass to graduate). The necessary equations are given below which we will discuss in more detail in your ChE 376 class.

$$q = \dot{m}_hc_{p,h}(T_{h,i}-T_{h,o}),$$ $$q = \dot{m}_cc_{p,c}(T_{c,o}-T_{c,i}),$$ $$q = FUA\Delta T_{lm},$$ where $$\Delta T_{lm} = \frac{\Delta T_2 - \Delta T_1}{\ln(\Delta T_2/\Delta T_1)},$$ and $$\Delta T_1 = T_{h,i}-T_{c,o},$$ $$\Delta T_2 = T_{h,o}-T_{c,i}.$$ Also, $$F = \left(\frac{\sqrt{R^2+1}}{R-1}\right)\frac{\ln[(1-P)/(1-PR)]} {\ln\left[\frac{2-P(R+1-\sqrt{R^2+1})}{2-P(R+1+\sqrt{R^2+1})}\right]},$$ where $$R = (T_{h,i}-T_{h,o})/(T_{c,o}-T_{c,i}),$$ $$P = (T_{c,o}-T_{c,i})/(T_{h,i}-T_{c,i}).$$

Variable definitions

  • $q$ is the total heat transfer rate in the heat exchanger (J/s).
  • $T$ is the temperature of the fluid (subscripts: h=hot fluid, c=cold fluid, i=inlet, o=outlet).
  • $\dot{m}$ is the flow rate of the fluid.
  • $c_p$ is the heat capacity of the fluid. This is a function of temperature. For simplicity, we take the average of the inlet and outlet temperatures of a given stream when computing the heat capacity of that stream.
  • $U$ is the overall heat transfer coefficient ($J/(m^2sK)$), a measure of how well heat transfers between the streams. This accounts for fouling due to buildup in the exhcnager which inhibits heat transfer.
  • $A$ is the surface area between the streams. The larger $A$, the larger the heat transfer rate.
  • $\Delta T_{lm}$ is the log-mean tempeature difference.
  • $\Delta T_1$ and $\Delta T_2$ are the differences in temperature between the streams at one end or the other of the heat exchanger. Because the shell and tube heat exchanger is a counterflow heat exchanger, the outlet of the hot stream is by the inlet of the cold stream, and vice-versa.
  • $F$ is an empirically-determined correction factor.


Write a program that can be used to determine the most economical shell and tube heat exchanger. Your program should do the following:

  • Determine the surface area (A) needed and the cost associated with constructing our custom heat exchanger if the fluid inlet temperatures ($T_{c,i}$, $T_{h,i}$), one fluid outlet temp ($T_{c,o}$, or $T_{h,o}$), mass flow rates ($\dot{m}$), overall heat transfer coefficient ($U$), and fluid substances are specified. Deliverables of the program to be presented to the user are Surface Area (A), Cost, and the unspecified outlet temp ($T_{h,o}$, or $T_{c,o}$). Note it costs $1,000 per m$^2$ of surface area to have a heat exchanger custom built.

  • For user input, use a yaml file called “input.yaml”. If you want to get creative, you can use Jupyter widgets that allow drop-down boxes, radio or check boxes, input boxes, etc. (Please don’t use the “input” function.)

  • The user should specify:

    • AES or SI units for inputs. Use SI units for output.
    • the liquid type in the hot and cold streams (water, gasoline, or R134a),
      • take gasoline = 2,2,4-trimethylpentane
      • take R134a = 1,1,1,2-Tetrafluoroethane
    • the overall heat transfer coefficient $U$,
    • Inlet temperatures $T_{h,i}$ and $T_{c,i}$.
    • Flow rates $\dot{m}_h$, $\dot{m}_c$.
    • And one of the outlet temperatures $T_{h,o}$ or $T_{c,o}$
  • If negative numbers are entered for the mass flow rate or overall heat transfer coefficient, warn the user that the variables have an error and end the program.

  • Notify the user in some way if the inlet or outlet temperatures are invalid (i.e. solid or gas). You can assume it operates at 1 atm.

  • The following fluid properties are provided. These were obtained from the BYU DIPPR database.

Component MW (kg/kmol) Melting point (K) Boiling point (K)
water 18.01528 273.15 373.15
R134a 102.03089 172.00 247.08
gasoline 114.22852 165.777 372.388
ethanol 46.06844 159.05 351.44
  • The following heat capacity data is provided. Use the following equation for heat capacity, $J/(kmol*K)$, with temperature in $K$: $$c_p = A + BT + CT^2 + DT^3 + ET^4.$$
Component A B C D E
water 2.7637E+05 -2.0901E+03 8.1250E+00 -1.4116E-02 9.3701E-06
R134a 6.5108E+05 -9.5057E+03 6.2835E+01 -1.8264E-01 2.0031E-04
ethanol 1.0264E+05 -1.3963E+02 -3.0341E-02 2.0386E-03 0.0000E+00
gasoline 9.5275E+04 6.9670E+02 -1.3765E+00 2.1734E-03 0.0000E+00