# A formula to calculate the partial volume of a capsule or tank?

1,804

Let $H$ be the height and $R$ be the radius of the cylinder, and assume that the tank is filled up to height $h$, $0\leq h\leq 2R$. In the case of a capsule the volume of fluid consists of a segment of the cylinder and a segment of of a sphere, the latter coming in two separated halves. The volume of a sphere segment is computed exactly by Kepler's formula. One obtains $$V_{\rm sph}(h)={\pi h^2\over3} (3R-h)\ .\tag{1}$$ The volume of the cylinder segment is $H$ times the area of a circle segment of height $h$. One obtains $$V_{\rm cyl}(h)=H\left(R^2\left({\pi\over2}+\arcsin{h-R\over R}\right)+(h-R)\sqrt{h(2R-h)}\right)\ .$$ Equivalently, $$V_{\rm cyl}(h)=H\left(R^2\left(\arccos{R-h\over R}\right)+(h-R)\sqrt{h(2R-h)}\right)\ .$$ When instead of a sphere we have an ellipsoid with semiaxes $R$, $R$, and $C$ then $V_{\rm sph}(h)$ is multiplied by a factor ${C\over R}$, so that $(1)$ has to be replaced by $$V'_{\rm sph}(h)={\pi C h^2\over3R} (3R-h)\ .$$ Responding to a comment: Given $h$, we now have $$V_{\rm tank}(h)=V_{\rm cyl}(h)+V'_{\rm sph}(h)\ .$$ The expression on the right hand side contains algebraic terms in the variable $h$, as well as an $\arcsin$-term. Therefore it is impossible to express the inverse function $V\mapsto h(V)$ in terms of elementary functions.

Share:
1,804

Author by

### Tito Piezas III

Updated on August 02, 2020

• Tito Piezas III over 3 years

We are trying to ascertain the correct formula discussed in this post.

The volume formula for a capsule (a cylinder with a hemisphere at both ends) is,

$$V_c = \pi r^2 H + \frac{4}{3}\pi r^3\tag1$$

while that of a tank (a cylinder with a hemi-oblate spheroid at both ends) is,

$$V_t = \pi r^2 H + \frac{4}{3}\pi c r^2\tag2$$

with the capsule being the special case $c = r$.

For example, in this tank volume calculator diagram, with $H = 192$, $c = 18$, $r=36$, (in inches) the total fill volume is

$$V_t = 879444.88\;\text{in}^3 = 3807.12\; \text{US gallons}$$

and easily computed from $(2)$.

Question: Using the same diagram, what is the volume of water $V_p$ in a partially filled tank with water depth $h$?

P.S. Using $h=48\;\text{in}$, the website author claims that,

$$V_p = 2710\; \text{US gallons}$$

However, one cannot arrive at this value using the formula given by the author in the linked post so it is either wrong, or has some missing assumptions.

• marshal craft over 8 years
Thanks, I think $1$ is erroneous and maybe needs to be discarded but because it probably came from something deterministic maybe it is not far off. I think the tank needs to be modeled in $\Bbb R^3$ as a cylinder with half of the oblate spheroids at the end. Integrated over those ranges and a plane like $z=48$ to calculate the volume inside the tank.
• Tito Piezas III over 8 years
@marshalcraft: I assume you mean eq $(1)$ in the other post?
• marshal craft over 8 years
Yes. I'm working on this one now. I think tripple integral in cylindrical coordinates.
• Tito Piezas III over 8 years
@marshalcraft: Blatter has found the correct formula how to arrive at the value $2710$. See answer below.
• marshal craft over 8 years
That expression does not appear to correspond to $1$ from the other question which would make sense being as we already knew $1$ failed to describe the tank.
• Tito Piezas III over 8 years
If $H = 192, h = 48, R = 36$ and I assume $C = c = 18$, then I find the volume of water in the partially-filled tank as, \begin{aligned}V_p &= V_{\rm cyl} + V_{\rm sph}'\\ &=553627.04+72382.29\\&=626009.33\;\text{in}^3 = \color{blue}{2710}\;\text{US gallons}\end{aligned} the same as in the website. Great! Thanks.
• Tito Piezas III over 8 years
Now that we have the correct formula, the essence of the other post is given,$$V_p = H\left(R^2\left( \arccos{R - h\over R}\right) + (h - R)\sqrt{h(2R - h)}\right)+{\pi C h^2\over3R} (3R - h)$$ where we know $V_p$, is there a way to isolate the depth $h$ and express it in terms of the other variables?
• marshal craft over 8 years
@ Tito Piezas III No. Assuming $V_p$ can be put into some form $acos^{-1}(x)+bx$ where $a$ and $b$ are constants of any form, algebraic or even transcendental just assuming it's possible to isolate some factor $\frac{R-h}{R}=x$. Then $V_p=acos^{-1}(x)+bx$. $cos(V_p)=cos(acos^{-1}(x)+bx)=cos(acos^{-1}(x))cos(bx)-sin(acos^{-1}(x))sin(bx)$. If we divide get rid of the $a$ then we have $cos(\frac{V_p}{a})=xcos(\frac{b}{a}x)-\sqrt{1-x^2}sin(\frac{b}{a}x)$
• marshal craft over 8 years
Due to the complexity of the expression initially, and because I think originally it was asked how to program it. It may not be computationally over bearing to just use numerical methods in the first place. But Newton's method I do not think will work well in present form cause of square root and arc cosine. $V_p$ has a restricted domain and so if the initial guess is not close, Newton's method may "point" to a value outside of it. Basically I think you would have to have a pretty close value to begin with then it could converge on the exact value but because it has to be so close it is not
• marshal craft over 8 years
Newton's method actually seems to work well for this. I will revise my answer in the other question for your new formula for the volume.