291-homework5_soln

291-homework5_soln - CEE 291 Problem Solving Using Computer...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CEE 291 Problem Solving Using Computer Tools Homework 5: Matlab Assigned: 2/15/2010 Due: 2/22/2010 5:00pm in the ECOW2 drop box and in class on Monday. 1.) This problem assumes you are familiar with the background information given in hmwk 2 #1. Given the two governing equations for steady, one dimensional concentration of waste (L) and Oxygen Deficit (D) are given below. In this problem, we would like to write a function that numerically integrates these equations and then use this function in a program that optimizes the location of treatment plants given an initial set of conditions. Governing Equations L k x L U r - = ) ( L k D k x D U d a - - = Analytical Solution U x k r e L L - = 0 - - + = - - - U x k U x k r a d U x k a r a e e k k L k e D D 0 0 Numerical Technique We will use the Euler explicit forward difference method to numerically integrate our governing equations. Forward difference means we use dependant variable values at the previous step to approximate the value at the current stop. In our case, we will use L and D at the previous x location to calculate L and D at the next x location. This procedure is commonly written as:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1 1 - - + - = - = i i r i r L x U L k L U L k x L 1 1 1 - - - + - - = i i d i a i D U L k D k x D NOTE: *The subscript “i” represents the current x location and “i-1” is the x location previous. * i was chosen here because the most common looping variable in Matlab is i. Numerical solutions are often written with other variables. *Everything is constant except L and D, which have indices *In order to start, we need initial conditions *Use constants U = 1,500 m/day, k a = 0.6 days -1 , k r = 1.2 days -1 , k d = 1.0 days -1 a.) Write a function in matlab that numerically integrates the governing equations. Your top line should look like: function [L,D,x] = BOD_num_sol(deltaX, final_x, L_init, D_init, U, ka, kd, kr) The function should take as input : 1.) deltaX - the x spacing in meters 2.) final_x - distance of concern in m 3.) L_init - initial L values 4.) D_init - initial D value 5.) U, ka, kd, kr – constants: River velocity, re-aeration rate, BOD degradation rate, BOD settling rate The function should give as ouput : 1.) L - array of BOD concentrations mg/L 2.) D - array of oxygen deficit mg/L 3.) x – array of x locations (for plotting) ****These should include the initial values as well.**** The body of the function should make use of a “for” loop to calculate the L and D values at each x location.
Background image of page 2
Turn in – Copy your function to word Sol - function [L,D,x] = BOD_num_sol(deltaX, start_x, final_x, L_init, D_init, U,
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

291-homework5_soln - CEE 291 Problem Solving Using Computer...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online