#/usr/bin/perl use strict; use warnings; # Teapot warming with various splits of water from 10 to 200 ml # # wild assumptions: # pot and warming fraction are allowed to reach equilibrium temperature # pot heat loss between warmings is just a random guess # pot specific heat capacity is a wild guess # warming water is always 100 Celsius # entire pot is one temperature # temperatures handled in Celsius not Kelvin, assume this makes no odds # assumed heat capacities are linear # # heat capacity joules per Kelvin for 1 teapot or 1 gram water my %hc = ( pot => 1500, water => 4.2 ); my \$T_env = 20; # Celsius my \$T_water = 100; # Celsius my \$total_water = 1500; # ml my \$cool_factor = 0.05; { printf "********** the evil of an unwarmed pot ... "; my \$T_tea = warm_pot( \$T_env, \$total_water, ); printf "temp tea: %5.2fC ********** \n\n", \$T_tea; } for my \$warming_water ( 1 .. 10 ) { \$warming_water *= 10; my \$T_pot = \$T_env; # we split the water into various fractions my \$max_step = 4; for my \$split ( 1 .. \$max_step ) { my \$ml = \$warming_water / \$split; printf "warming with \$warming_water in %2i steps (%5.1f water each step) ", \$split, \$ml; for ( 1 .. \$split ) { \$T_pot = warm_pot( \$T_pot, \$ml ); print "."; } print " " x ( 1 + \$max_step - \$split ); printf "warmed pot: %5.2fC ", \$T_pot; \$T_pot = cools(\$T_pot); # now throw in 1500 ml hot water my \$T_tea = warm_pot( \$T_pot, \$total_water - \$warming_water, ); printf "temp tea: %5.2fC\n", \$T_tea; } print \$/; } sub warm_pot { my \$T_pot = shift; my \$ml_h2o = shift; my \$total_joules = \$T_pot * \$hc{pot} + \$ml_h2o * \$hc{water} * \$T_water; my \$total_heat_capacity = \$hc{pot} + \$ml_h2o * \$hc{water}; return \$total_joules / \$total_heat_capacity; } sub cools { my \$T_pot = shift; my \$delta_T = \$T_pot - \$T_env; return \$T_pot - ( \$delta_T * \$cool_factor ); }