Question
For the example of the concentration of tracer in a completely mixed reactor that we did in class, write a VBA program that will calculate
For the example of the concentration of tracer in a completely mixed reactor that we did in class, write a VBA program that will calculate both the exact analytical answer and approximate numerical answer using the values provided on the 1st worksheet ("Problem #1") in the indicated columns from t = 0 to t = 3 minutes. Read the values for V, Q, C0, C(t=0) and dt from the indicated cells on the worksheet.
Use functions to calculate:
the analytical value of c
the value of dc/dt
Remember that for the analytical solution, c = c0*(1 - e(-Q/V*t))
For the numerical solution, recall that
ci+1 = ci + dc/dt * dt
dc/dt = Q/V*c0 - Q/V*ci
You do NOT need to use any arrays or use a separate subroutine to output your results.
Try using different values for dt and see how smaller time steps affect the accuracy of the numerical solution.
Problem #2
Newton's law of cooling says that the temperature of an object changes at a rate proportional to the difference between its temperature and that of the surrounding medium (the ambient temperature). So the change in temperature of an object with respect to time can be written as:
dT/dt = -k(T - Ta)
where: T = the temperature of the object t = elapsed time k = the proportionality constant Ta = the ambient temperature
Use this relationship to numerically estimate the temperature of my cup of coffee cooling over time while sitting on my desk on the 2nd worksheet ("Problem #2") using the indicated values for T(t=0), k, Ta and dt from 0 to 10 minutes.
(Hint: you should be able to reuse your program from above without too much modification) BONUS POINT!
Show off your calculus skills to find the exact analytical solution to the above ODE, and output the exact answer from your program as well!
Problem #1 For the example of the concentration of tracer in a completely mixed reactor that we did in class, write a VBA program that will calculate both the exact analytical answer and approximate numerical answer using the values provided on the 1st worksheet ("Problem #1") in the indicated columns from t 0 to t = 3 minutes. Read the values for V, Q. CO, C(t=0) and dt from the indicated cells on the worksheet. Use functions to calculate: the analytical value of c . the value of dc/dt Remember that for the analytical solution, c co (1 eave) For the numerical solution, recall that Ci+1 Ci+ dc/dt dt You do NOT need to use any arrays or use a separate subroutine to output your results. Try using different values for dt and see how smaller time steps affect the accuracy of the numerical solution. Problem #2 Newton's law of cooling says that the temperature of an object changes at a rate proportional to the difference between its temperature and that of the surrounding medium (the ambient temperature). So the change in temperature of an object with respect to time can be written as: where: T-the temperature of the object t- elapsed time k- the proportionality constant Ta the ambient temperature Use this relationship to numerically estimate the temperature of my cup of coffee cooling over time while sitting on my desk on the 2nd worksheet ("Problem #2") using the indicated values for T(t=0), k, Ta and dt from 0 to 10 minutes. (Hint: you should be able to reuse your program from above without too much modifcation) BONUS POINT Show off your calculus skills to find the exact analytical solution to the above ODE, and output the exact answer from your program as wel! Problem #1 For the example of the concentration of tracer in a completely mixed reactor that we did in class, write a VBA program that will calculate both the exact analytical answer and approximate numerical answer using the values provided on the 1st worksheet ("Problem #1") in the indicated columns from t 0 to t = 3 minutes. Read the values for V, Q. CO, C(t=0) and dt from the indicated cells on the worksheet. Use functions to calculate: the analytical value of c . the value of dc/dt Remember that for the analytical solution, c co (1 eave) For the numerical solution, recall that Ci+1 Ci+ dc/dt dt You do NOT need to use any arrays or use a separate subroutine to output your results. Try using different values for dt and see how smaller time steps affect the accuracy of the numerical solution. Problem #2 Newton's law of cooling says that the temperature of an object changes at a rate proportional to the difference between its temperature and that of the surrounding medium (the ambient temperature). So the change in temperature of an object with respect to time can be written as: where: T-the temperature of the object t- elapsed time k- the proportionality constant Ta the ambient temperature Use this relationship to numerically estimate the temperature of my cup of coffee cooling over time while sitting on my desk on the 2nd worksheet ("Problem #2") using the indicated values for T(t=0), k, Ta and dt from 0 to 10 minutes. (Hint: you should be able to reuse your program from above without too much modifcation) BONUS POINT Show off your calculus skills to find the exact analytical solution to the above ODE, and output the exact answer from your program as welStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started