Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Every afternoon I produce tea for the local barbarians (Dutch, Belgium). Of course this involves warming the pot. The other day I had an extra guest for tea so I could not use as much water as usual for warming. What warming water I could spare I used in two steps claiming this would be more efficient. The Dutch dissented so I did what any sane monk would do and wrote a script ...

#/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 tempera +ture # 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 o +dds # 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_w +ater; 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 ); }

Here are some results

********** the evil of an unwarmed pot ... initial temp tea: 84.62C ** +******** using 10ml in 1 steps 10.0 water each . warmed pot: 22.18C temp te +a: 84.93C using 10ml in 2 steps 5.0 water each .. warmed pot: 24.21C temp te +a: 85.30C using 10ml in 3 steps 3.3 water each ... warmed pot: 26.09C temp te +a: 85.65C using 10ml in 4 steps 2.5 water each .... warmed pot: 27.82C temp te +a: 85.97C . . . using 60ml in 1 steps 60.0 water each . warmed pot: 31.51C temp te +a: 86.27C using 60ml in 2 steps 30.0 water each .. warmed pot: 41.22C temp te +a: 88.11C using 60ml in 3 steps 20.0 water each ... warmed pot: 49.18C temp te +a: 89.61C using 60ml in 4 steps 15.0 water each .... warmed pot: 55.66C temp te +a: 90.83C using 70ml in 1 steps 70.0 water each . warmed pot: 33.11C temp te +a: 86.50C using 70ml in 2 steps 35.0 water each .. warmed pot: 43.97C temp te +a: 88.56C using 70ml in 3 steps 23.3 water each ... warmed pot: 52.67C temp te +a: 90.22C using 70ml in 4 steps 17.5 water each .... warmed pot: 59.56C temp te +a: 91.52C using 80ml in 1 steps 80.0 water each . warmed pot: 34.64C temp te +a: 86.72C using 80ml in 2 steps 40.0 water each .. warmed pot: 46.55C temp te +a: 88.99C using 80ml in 3 steps 26.7 water each ... warmed pot: 55.87C temp te +a: 90.77C using 80ml in 4 steps 20.0 water each .... warmed pot: 63.07C temp te +a: 92.15C using 90ml in 1 steps 90.0 water each . warmed pot: 36.10C temp te +a: 86.92C using 90ml in 2 steps 45.0 water each .. warmed pot: 48.97C temp te +a: 89.39C using 90ml in 3 steps 30.0 water each ... warmed pot: 58.80C temp te +a: 91.28C using 90ml in 4 steps 22.5 water each .... warmed pot: 66.21C temp te +a: 92.70C using 100ml in 1 steps 100.0 water each . warmed pot: 37.50C temp t +ea: 87.12C using 100ml in 2 steps 50.0 water each .. warmed pot: 51.23C temp t +ea: 89.77C using 100ml in 3 steps 33.3 water each ... warmed pot: 61.49C temp t +ea: 91.75C using 100ml in 4 steps 25.0 water each .... warmed pot: 69.04C temp t +ea: 93.21C using 110ml in 1 steps 110.0 water each . warmed pot: 38.84C temp t +ea: 87.30C using 110ml in 2 steps 55.0 water each .. warmed pot: 53.37C temp t +ea: 90.13C using 110ml in 3 steps 36.7 water each ... warmed pot: 63.97C temp t +ea: 92.19C using 110ml in 4 steps 27.5 water each .... warmed pot: 71.59C temp t +ea: 93.66C using 120ml in 1 steps 120.0 water each . warmed pot: 40.12C temp t +ea: 87.48C using 120ml in 2 steps 60.0 water each .. warmed pot: 55.37C temp t +ea: 90.46C using 120ml in 3 steps 40.0 water each ... warmed pot: 66.26C temp t +ea: 92.59C using 120ml in 4 steps 30.0 water each .... warmed pot: 73.89C temp t +ea: 94.08C . . . using 200ml in 1 steps 200.0 water each . warmed pot: 48.72C temp t +ea: 88.64C using 200ml in 2 steps 100.0 water each .. warmed pot: 67.82C temp t +ea: 92.55C using 200ml in 3 steps 66.7 water each ... warmed pot: 79.31C temp t +ea: 94.90C using 200ml in 4 steps 50.0 water each .... warmed pot: 86.00C temp t +ea: 96.27C . . . using 300ml in 1 steps 300.0 water each . warmed pot: 56.52C temp t +ea: 89.61C using 300ml in 2 steps 150.0 water each .. warmed pot: 77.53C temp t +ea: 94.19C using 300ml in 3 steps 100.0 water each ... warmed pot: 87.91C temp t +ea: 96.45C using 300ml in 4 steps 75.0 water each .... warmed pot: 92.78C temp t +ea: 97.51C

The physics model sucks so the numbers are not true but I think the broad conclusion is valid. Now can anyone suggest a nice 3 axis plotting module so I can plot the pot warming space ?

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!

In reply to Warming the pot by Random_Walk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (9)
    As of 2014-12-27 18:50 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (177 votes), past polls