Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having a lot trouble with this practice senario and would really appreciate someone's guidance. Oxygen is the most well-established indicator of water quality.

I am having a lot trouble with this practice senario and would really appreciate someone's guidance.

Oxygen is the most well-established indicator of water quality. Dissolved oxygen is in fact essential for the survival of all aquatic organisms. Moreover, oxygen affects a vast number of other water indicators, not only biochemical indicators but aesthetic ones like odor, clarity, and taste. When a pollutant is added to a river, then the oxygen level declines, that is, the river is in oxygen deficit. The dissolved oxygen deficit is modelled by: image text in transcribed Values for the parameters in Eq. (1) and Eq. (2) are found in the file PollutionData.txt. These parameter values are for the Cedar River and are in the order listed below (all double numbers). D0 - Initial dissolved oxygen deficit (mg/l) L0 - Initial concentration of pollutant added as a bolus at the point of discharge (mg/l) S - Diffusivity of oxygen in water (cm2/s) H - Depth of flow of river (ft) V - Average velocity of river (ft/s) kd - Oxygen use rate by natural pollution removal processes (hr-1) The goal of this practice challenge is to estimate how long it takes the oxygen level to return to baseline after a bolus injection of a pollutant is added to the river stream. The model that you will use to perform these estimates are Eq. (1) and Eq. (2). Your specific goal is to simulate for 250 hours, every half hour, the effects on oxygen deficit, for each half hour, at the point of discharge. You must do the following (all calculations should be in double precision; be very careful to make sure that the units are consistent): 1) Open the file PollutionData.txt and read the six data values. (see below) 2) Create a function called reaeration to estimate the reaeration constant kr in Eq. (2). The function should have three input parameters and return the reaeration constant as a double. 3) Create a void function called deOxygen to simulate dissolved oxygen deficit given in Eq. (1). The input arguments to this function should be a result array that will contain the estimated deficit as a function of time, an input array containing the six parameter values found in the file PollutionData.txt, an input array containing the times at which Eq. (1) should be solved, and an input scalar indicating the number of time intervals in the simulation. 4) Report at what time (in hours) the oxygen deficit returns to the initial deficit level. Report this value to the console. 5) Write a file called results.txt that consists of time t (column one) and deficit D(t) (column two). The two columns are to be separated by a space. The file should have 501 rows, with the values for time t ranging from 0 hours, 0.5 hours, , to 250 hours. 6) Plot the result of solving Eq. (1) as a function of time as illustrated in Figure 1. image text in transcribed

The PollutionData.txt file contains the following numbers:

5.0

1.0

0.0000197

20.0

0.055

0.2

Here is my code so far. I am using code::blocks with the gcc gnu compiler. I would like to keep the standard library.

#include #include #include

using namespace std; double reaeration (double, double, double);

double kr; int main() { double data[6]; int i; double disOxygen; double inPollutant; double diffusivity = diffusivity * 0.001076; double flowDepth; double avgVelocity; double kd; double kr = kr * 3600; // double time[]; // double oxDeficit;

ifstream FileData; FileData.open ("PollutionData.txt"); if(FileData.fail()){ cerr

for (i=0; i> data[i]; }

data[0] = disOxygen; data[1] = inPollutant; data[2] = diffusivity; data[3] = flowDepth; data[4] = avgVelocity; data[5] = kd;

double reaeration (double avgVelocity, double diffusivity, double flowDepth);

cout

return 0; }

double reaeration (double avgVelocity, double diffusivity, double flowDepth) { kr = ((pow(avgVelocity *diffusivity ,0.5))/(pow(flowDepth,1.5))); return kr; } // void deOxygen()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago