/*CoolSum total cooling from all entries into cooling stack */ #include "cddefines.h" #include #include "coolants.h" #include "heating.h" #include "taulines.h" #include "tcool.h" #include "heat.h" #include "chmax.h" #include "coolsum.h" void CoolSum(double *total) { long int i; # ifdef DEBUG_FUN fputs( "<+>CoolSum()\n", debug_fp ); # endif /* routine to add together all line heating and cooling */ *total = 0.; tcool.coolheat = 0.; /* this is sum of agents that should be coolants * coolheat will be coolants that came out as heat */ for( i=0; i < Coolants.ncltot; i++ ) { *total += Coolants.cooling[i]; tcool.coolheat += Coolants.heatnt[i]; } HeatingCom.heating[12][0] = tcool.coolheat; /* make comment if negative cooling ever significant */ if( heat.htot > 0. ) { if( tcool.coolheat/heat.htot > 0.01 ) { /* CoolHeatMax was set to zero at start of calc, we want very biggest */ for( i=0; i < Coolants.ncltot; i++ ) { if( Coolants.heatnt[i]/heat.htot > CHMax.CoolHeatMax ) { CHMax.CoolHeatMax = (float)(Coolants.heatnt[i]/heat.htot); CHMax.ipCoolHeatMax = Coolants.collam[i]; strcpy( CHMax.chCoolHeatMax, chCoolants.chClntLab[i] ); } } } } /* this sum of lines that were heat sources - this * part was not counted as heating in call to cooling add routine * since level 2 and level 3 separate this out - this does * NOT double count line heating */ tcool.heatl = 0.; for( i=0; i < nWindLine; i++ ) { tcool.heatl += TauLine2[i].heat; } for( i=1; i <= nLevel1; i++ ) { tcool.heatl += TauLines[i].heat; } /* line heating added in following, only here */ HeatingCom.heating[22][0] = tcool.heatl; /*begin sanity check */ if( *total <= 0. ) { fprintf( ioQQQ, " CoolSum finds cooling <= 0%10.2e\n", *total ); } if( tcool.heatl/tcool.ctot < -1e-15 ) { fprintf( ioQQQ, " CoolSum finds negative heating %10.2e %10.2e\n", tcool.heatl, tcool.ctot ); /* write(qq,'('' dump went to fort.66'')') * write(66,'(1p,12e10.1)') (heatnt(i),i=1,ncltot) */ } /*end sanity check * */ # ifdef DEBUG_FUN fputs( " <->CoolSum()\n", debug_fp ); # endif return; }