Coverage for docs\source\examples\water_tank.py: 0%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"Minimizes cylindrical tank surface area for a particular volume."
2from gpkit import Variable, VectorVariable, Model
4M = Variable("M", 100, "kg", "Mass of Water in the Tank")
5rho = Variable("\\rho", 1000, "kg/m^3", "Density of Water in the Tank")
6A = Variable("A", "m^2", "Surface Area of the Tank")
7V = Variable("V", "m^3", "Volume of the Tank")
8d = VectorVariable(3, "d", "m", "Dimension Vector")
10# because its units are incorrect the line below will print a warning
11bad_monomial_equality = (M == V)
13constraints = (A >= 2*(d[0]*d[1] + d[0]*d[2] + d[1]*d[2]),
14 V == d[0]*d[1]*d[2],
15 M == V*rho)
17m = Model(A, constraints)
18sol = m.solve(verbosity=0)
19print(sol.summary())