/* ---------------------------------------------------------------------------- ** Figure 23.5: The heat transfer module, heat.c ** ** A pipe of radius p is to be insulated with a material having a conductivity ** k. A heat transfer analysis gives the following equation for the radius of ** the outer insulation layer for a specified heat loss per unit length: ** ** (1/k)*ln(r/p) + 1/r = 2.0/p ** ** Find the solution of this equation (the radius r) to within ~.01% error. ** ----------------------------------------------------------------------------- */ #include "tools.h" #include "ffam.h" /* These variables are global within this module but hidden from other modules. */ static double conductivity; /* thermal conductivity */ static double pipe; /* radius of pipe (feet) */ /* --------set up parameters for the heat transfer equation------------------ */ void setup( void ) { printf( "\n Thermal conductivity of insulation (BTU/h ft F): " ); scanf( "%lg", &conductivity ); printf( "\n Enter radius of pipe (feet): " ); scanf( "%lg", &pipe ); } /* --------- function to compute heat transfer discrepency ------------------ */ double f( double r ) { if (r < pipe) fatal( " Error--radius received is inside pipe dimensions." ); return log( r/pipe ) / conductivity + 1.0/r - 2.0/pipe; }