Volume/Height relationship in wells with square cross-section

The width of the well at the bottom is 2.67 mm. and at the top (height, $H$, of 11.43 mm.) is 3.63 mm.

At a height, $H$, the cross section is a square of size $2.67 + (3.63 - 2.67)H/11.43$ mm.


In [1]:
using Polynomials, DataFrames, Gadfly
plen = Poly([2.67, 0.96 / 11.43])  # polynomial representing size of square


┌ Info: Loading DataFrames support into Gadfly.jl
└ @ Gadfly /home/bates/.julia/packages/Gadfly/09PWZ/src/mapping.jl:228
Out[1]:
2.67 + 0.08398950131233596∙x

In [2]:
parea = plen * plen


Out[2]:
7.1289 + 0.448503937007874∙x + 0.007054236330694883∙x^2

The volume will be the integral from $0$ to $H$ of parea


In [3]:
pvol = polyint(parea)


Out[3]:
7.1289∙x + 0.224251968503937∙x^2 + 0.002351412110231628∙x^3

A plot of this function is


In [4]:
H = 0.:0.01:11.43;
d = DataFrame(H=H);
d[:V] = polyval(pvol,d[:H]);
first(d, 6)


┌ Warning: `head(df::AbstractDataFrame)` is deprecated, use `first(df, 6)` instead.
│   caller = top-level scope at In[4]:4
└ @ Core In[4]:4
Out[4]:

6 rows × 2 columns

HV
Float64Float64
10.00.0
20.010.0713114
30.020.142668
40.030.214069
50.040.285515
60.050.357006

In [5]:
last(d, 6)


Out[5]:

6 rows × 2 columns

HV
Float64Float64
111.38113.634
211.39113.765
311.4113.897
411.41114.029
511.42114.16
611.43114.292

In [6]:
plot(d,x="H",y="V",Geom.line)


Out[6]:
H -20 -15 -10 -5 0 5 10 15 20 25 30 35 -15.0 -14.5 -14.0 -13.5 -13.0 -12.5 -12.0 -11.5 -11.0 -10.5 -10.0 -9.5 -9.0 -8.5 -8.0 -7.5 -7.0 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 15.5 16.0 16.5 17.0 17.5 18.0 18.5 19.0 19.5 20.0 20.5 21.0 21.5 22.0 22.5 23.0 23.5 24.0 24.5 25.0 25.5 26.0 26.5 27.0 27.5 28.0 28.5 29.0 29.5 30.0 -20 0 20 40 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -200 -150 -100 -50 0 50 100 150 200 250 300 350 -150 -145 -140 -135 -130 -125 -120 -115 -110 -105 -100 -95 -90 -85 -80 -75 -70 -65 -60 -55 -50 -45 -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125 130 135 140 145 150 155 160 165 170 175 180 185 190 195 200 205 210 215 220 225 230 235 240 245 250 255 260 265 270 275 280 285 290 295 300 -200 0 200 400 -150 -140 -130 -120 -110 -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 V

In [7]:
real(roots(pvol - 10.)[1])


Out[7]:
-48.357046148247086

In [8]:
real(roots(pvol -12.)[1])


Out[8]:
-48.48516975908005

In [9]:
real(roots(pvol - 20.)[1])


Out[9]:
-48.97899098468442

Calculations for a cylindrical well

The cylindrical wells have a depth of 11.47 mm and a diameter (top/bottom) of 5.0/4.5 mm., corresponding to a radius of 2.5/2.25 mm.

The radius $r$ at a height $H$ will be $2.25 + (0.25)*H/11.47$ mm


In [10]:
pradius = Poly([2.25, (0.25)/(11.47)])


Out[10]:
2.25 + 0.021795989537925022∙x

Just to make sure that I got that right.


In [11]:
polyval(pradius,[0.,11.47])


Out[11]:
2-element Array{Float64,1}:
 2.25
 2.5 

In [12]:
parea = π * pradius * pradius


Out[12]:
15.904312808798327 + 0.3081335427452936∙x + 0.001492461216435598∙x^2

In [13]:
polyval(parea,[0.,11.47])


Out[13]:
2-element Array{Float64,1}:
 15.904312808798327
 19.634954084936208

In [14]:
pvol = polyint(parea)


Out[14]:
15.904312808798327∙x + 0.1540667713726468∙x^2 + 0.0004974870721451993∙x^3

In [15]:
H = collect(0.:0.01:12.);

In [16]:
plot(x=H,y=polyval(pvol,H),Geom.line,
Guide.XLabel("Height above well bottom (mm)"),
Guide.YLabel("Volume (cubic mm)"))


Out[16]:
Height above well bottom (mm) -14 -12 -10 -8 -6 -4 -2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 -12.0 -11.5 -11.0 -10.5 -10.0 -9.5 -9.0 -8.5 -8.0 -7.5 -7.0 -6.5 -6.0 -5.5 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 15.5 16.0 16.5 17.0 17.5 18.0 18.5 19.0 19.5 20.0 20.5 21.0 21.5 22.0 22.5 23.0 23.5 24.0 -20 0 20 40 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? -300 -250 -200 -150 -100 -50 0 50 100 150 200 250 300 350 400 450 500 550 -250 -240 -230 -220 -210 -200 -190 -180 -170 -160 -150 -140 -130 -120 -110 -100 -90 -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 500 -250 0 250 500 -260 -240 -220 -200 -180 -160 -140 -120 -100 -80 -60 -40 -20 0 20 40 60 80 100 120 140 160 180 200 220 240 260 280 300 320 340 360 380 400 420 440 460 480 500 Volume (cubic mm)

In [17]:
real(roots(pvol - 50.)[1])


Out[17]:
-156.37132054994754

In [18]:
real(roots(pvol - 100.)[1])


Out[18]:
-157.81466509468657

In [19]:
real(roots(pvol - 150.)[1])


Out[19]:
-159.18546710697348

As a table


In [21]:
H = 0.0:0.1:12.0;
[H polyval(pvol,H)]


Out[21]:
121×2 Array{Float64,2}:
  0.0    0.0    
  0.1    1.59197
  0.2    3.18703
  0.3    4.78517
  0.4    6.38641
  0.5    7.99074
  0.6    9.59816
  0.7   11.2087 
  0.8   12.8223 
  0.9   14.439  
  1.0   16.0589 
  1.1   17.6818 
  1.2   19.3079 
  ⋮             
 10.9  192.306  
 11.0  194.252  
 11.1  196.201  
 11.2  198.153  
 11.3  200.109  
 11.4  202.069  
 11.5  204.032  
 11.6  205.998  
 11.7  207.967  
 11.8  209.941  
 11.9  211.917  
 12.0  213.897