Question

In: Physics

Liquids are often stored in elliptical storage tanks.. To measure the volume of liquid in the...

Liquids are often stored in elliptical storage tanks..

To measure the volume of liquid in the tank, a depth gauge (measuring stick) can be used. It is inserted into an opening at the top and the level the liquid reaches on the gauge can be used to determine the amount of liquid in the tank.

The tank has width w, height h and length len (all in meters). In the example output shown below, we take w=8, h=4 and len=7. Your programs should work for any values of w, h and len, not just these specific values.

The assignment is divided into two parts.

Part 1:

In the first part of the assignment we look at inserting a measuring stick that is already calibrated in units of 10 centimeters. This measuring gauge can be inserted into an opening at the top of the tank and used to measure the depth of the liquid in the tank.

Your task will be to write a Matlab script to produce a table of values showing the volume of liquid in the tank for each of the points on the gauge.

The output of your program (for the example above) should look like:\

Depth 10 cm : Volume 1.19 cubic meters

Depth 20 cm : Volume 3.34 cubic meters

Depth 30 cm : Volume 5.99 cubic meters

. . .

Depth 380 cm : Volume 172.55 cubic meters

Depth 390 cm : Volume 174.66 cubic meters

Depth 400 cm : Volume 175.74 cubic meters

Methodology for Part 1:

If the tank has width W and height H (in centimeters), the focal radii of the cross section are A = W/2 and B = H/2. Then the equation of the ellipse is:

X2/A2 + Y2/B2 = 1

To find the volume at given depth you should compute the cross-sectional area of the tank for each given depth using a numerical integration

algorithm such as the trapezoidal method. Then multiply this by the length of the tank.

You must use a general integration function and apply it to this particular function. Do not write an integration function that is specific to this problem. Do not use an analytic solution to integrate the function.

Hint: It is probably easier to imagine the tank on its side so that the depth gauge is inserted horizontally. If you do this you must express the equation as a function of y and integrate that function.

Part 2

The second part of the assignment is a variation on this. In this case the stick is not calibrated. We would like to calibrate it. Rather than calibrate it by equidistant markings, we calibrate it to show the level at which the tank contains a certain volume of the liquid.

You are to write a Matlab script that determines where the gauge should be marked (to the nearest millimeter) corresponding to volumes of 5, 10, 15, … cubic meters (up to the total volume of the tank).

The output of your program (for the example above) should look like:

Volume 5: Depth 26.54 cm

Volume 10: Depth 42.48 cm

Volume 15: Depth 56.08 cm

. . .

Volume 165: Depth 355.12 cm

Volume 170: Depth 370.52 cm

Volume 175: Depth 392.03 cm

Methodology for Part 2:

If we view the volume as a function of the position y, this problem reduces to the problem of finding a root of the equation V(y) = depth, for the various depths. While the function V(y) is not given by a simple formula, it can be determined for any y by using numerical integration as defined in part 1.

Write a program to determine the roots of this equation for each depth by using a root finding algorithm such as the bisection method. Again, you must use a general root finding function and apply it to this particular function. Do not use an analytic solution to solve this problem. Each function evaluation will have to be done using an integration algorithm such as the trapezoidal method.

Requirements

Your code must meet these requirements:

 The program must be written in Matlab

Solutions

Expert Solution

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
double WIDTH;
double HEIGHT;
double LENGTH;
// DEFINE Function:
typedef double (*Define) (double);
double f(double x)
{
double a = HEIGHT / 2.0;
double b = WIDTH / 2.0;
double y = (b / a) * sqrt (a * a - x * x);
return y;
}
// the defining area function by the trapezoidal method.
double trape(Define f, double a, double b, int n)
{ double x, dx, sm = 0.0;
int i = 0;
dx = (b - a) / n;
sm = (f(a) + f(b)) / 2;
for (i = 1, x = a + dx; i < n; i++, x += dx)
sm += f(x);
return 2.0 * sm * dx;
}
// part 2 defining function by Bisection Method
typedef double (*Define) (double);
double rootfinding (Define f, double z1, double z2 , double tol){
double midval;
for (;;) {
midval = (z1 + z2) / 2.0; // for taking middle
if (fabs(midval –z1) < tol)
return midval;
else if (f(midval) * f(z1) < 0.0)
z2 = midval;
else
z1 = midval;
}
}
//Here main function and work for all values instead of those specific values.
int main()
{ double Vol , Area, a, b = 0;
a = 0;
int i:
printf("Enter the width of the tank(in m):\n");
scanf("%lf", &Width);
printf("Enter the heigth of the tank(in m):\n");
scanf("%lf", &Height);
printf("Enter the length of the tank (in m):\n");
scanf("%lf", &Length);
printf("\n");
for (i = 0; i <= Height * 100; i = i + 10)
{
Define def­­_func = &f;
// Converting value from cm to m
b = i / 100;
Area = trape(def­­_func, a, b, 100);
Vol = Area * Length;
double root = rootfinding (&f, HEIGHT / 2 - b, HEIGHT / 2,0.005);
printf("Depth %.0lf cm: Volume %.6lf cubic metres", i, Vol);
}
return 0;

}


Related Solutions

Cryogenic liquids (liquid N2, He, etc) are typically stored in Dewar flasks (fancy thermos bottles) that...
Cryogenic liquids (liquid N2, He, etc) are typically stored in Dewar flasks (fancy thermos bottles) that consist of mirrored glass walls (to reduce radiative heating) separated by vacuum (a cylinder within a cylinder). How long would a liter sample of liquid argon last in a flat bottomed cylindrical Dewar with an inner radius of 5cm and height of 20cm and an outer radius of 10cm and height of 25 cm assuming that the only energy transfer that occurs is radiative...
Two fuel storage tanks will be placed at an oil refinery near Bakersfield. The tanks are...
Two fuel storage tanks will be placed at an oil refinery near Bakersfield. The tanks are 10 m in diameter, are spaced center-to-center at 15 m, and contain fuel that has a Gs=0.95. The height of the fuel in the tanks is 4 m. Determine the stress change in the soil below the tanks at 4 locations: a) beneath the centerline between the tanks, b) beneath the edge closest to the other tank, c) beneath the center of one tank,...
Octane is to be pumped in a piping system that is routed from storage tanks to...
Octane is to be pumped in a piping system that is routed from storage tanks to the main pump by a number of smaller pumps. One such arrangement is shown below. This pump must supply 0.4 m3 /s of octane to the main pump. All fittings are flanged; the pipe is wrought iron, schedule 80, 2 nominal, with L=65 m. The absolute pressure at section 2 is 282.5 kPa. Determine the power required to be transferred to the liquid. Assuming...
Recording Asset Retirement Obligation BPP Company maintains underground storage tanks for its operations. A new storage...
Recording Asset Retirement Obligation BPP Company maintains underground storage tanks for its operations. A new storage tank was installed and made ready for use at a cost of $400,000 on January 1, 2020. The useful life is estimated at 15 years, at which time the company is legally required to remove the tank and restore the area at an estimated cost of $40,000. The appropriate discount rate for the company is 12%. Answer the following questions, rounding your answers to...
If you mixed two liquids, will their apparent volume be different than the total volume of...
If you mixed two liquids, will their apparent volume be different than the total volume of unmixed pure components? Why?
Weaver Industries produces storage tanks for the oil and gas industry. Maria Jones, the corporate controller,...
Weaver Industries produces storage tanks for the oil and gas industry. Maria Jones, the corporate controller, is not satisfied with the standard costing system of the organization. The standard cost information given below was derived from consultants hired by Weaver Industries in the prior year. Jones has been observing operations and believes the standard costs are not accurate as the factory workers have a lot of idle time and she seldom observes material unfavorable variances. Budgeted direct material and labor...
Weaver Industries produces storage tanks for the oil and gas industry. Maria Jones, the corporate controller,...
Weaver Industries produces storage tanks for the oil and gas industry. Maria Jones, the corporate controller, is not satisfied with the standard costing system of the organization. The standard cost information given below was derived from consultants hired by Weaver Industries in the prior year. Jones has been observing operations and believes the standard costs are not accurate as the factory workers have a lot of idle time and she seldom observes material unfavorable variances. Budgeted direct material and labor...
A branching pipe connects two storage tanks as shown in Figure Q3 below. Figure Q3 (a)...
A branching pipe connects two storage tanks as shown in Figure Q3 below. Figure Q3 (a) Write down the continuity equation as it applies to flows in the pipes 1, 2 and 3. [1 mark] (b) Write down the energy equation in terms of energy heads at A and at B and quantities relating to flow in the pipes in between. [2 marks] (c) What can be said about the energy loss in pipe 2 relative to that in pipe...
For storage options a, b, and c, what volume of storage tank for hydrogen would be...
For storage options a, b, and c, what volume of storage tank for hydrogen would be needed for a hydrogen fuel cell car to have the same delivered transport energy (that is, total vehicle-km of travel) as a conventional car with a full 50 litre petrol tank (note that the actual volume of the tank is more than 50 litre). a- If the hydrogen is stored as compressed gas at a pressure of 350 bar (1 bar = 101 kPa)...
Many techniques exist to measure the surface energy between a liquid and a liquid or a...
Many techniques exist to measure the surface energy between a liquid and a liquid or a liquid and a gas (see e.g. the wiki page). Methods to measure the surface energy between a solid and a fluid are rare, but still there is a method developed by Zisman (see e.g. here) that allows you to at least estimate it by extrapolation for solid/gas or solid/liquid, depending on the environment that you use in your experiment What I wonder: is there...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT