def urbflux(UCM, UBL, BEM, forc, parameter, simTime, RSM):
T_can = UCM.canTemp<EOL>Cp = parameter.cp<EOL>UCM.Q_roof = <NUM_LIT:0.><EOL>sigma = <NUM_LIT>         <EOL>UCM.roofTemp = <NUM_LIT:0.>       <EOL>UCM.wallTemp = <NUM_LIT:0.>       <EOL>for j in range(len(BEM)):<EOL><INDENT>BEM[j].building.BEMCalc(UCM, BEM[j], forc, parameter, simTime)<EOL>BEM[j].ElecTotal = BEM[j].building.ElecTotal * BEM[j].fl_area <EOL>e_roof = BEM[j].roof.emissivity<EOL>T_roof = BEM[j].roof.layerTemp[<NUM_LIT:0>]<EOL>BEM[j].roof.infra = e_roof * (forc.infra - sigma * T_roof**<NUM_LIT>)<EOL>e_wall = BEM[j].wall.emissivity<EOL>T_wall = BEM[j].wall.layerTemp[<NUM_LIT:0>]<EOL>_infra_road_, BEM[j].wall.infra = infracalcs(UCM, forc, UCM.road.emissivity, e_wall, UCM.roadTemp, T_wall)<EOL>BEM[j].mass.layerTemp = BEM[j].mass.Conduction(simTime.dt, BEM[j].building.fluxMass,<NUM_LIT:1.>,<NUM_LIT:0.>,BEM[j].building.fluxMass)<EOL>BEM[j].roof.SurfFlux(forc,parameter,simTime,UCM.canHum,T_can,max(forc.wind,UCM.canWind),<NUM_LIT:1.>,BEM[j].building.fluxRoof)<EOL>BEM[j].wall.SurfFlux(forc,parameter,simTime,UCM.canHum,T_can,UCM.canWind,<NUM_LIT:1.>,BEM[j].building.fluxWall)<EOL>UCM.wallTemp = UCM.wallTemp + BEM[j].frac*BEM[j].wall.layerTemp[<NUM_LIT:0>]<EOL>UCM.roofTemp = UCM.roofTemp + BEM[j].frac*BEM[j].roof.layerTemp[<NUM_LIT:0>]<EOL><DEDENT>UCM.road.infra, _wall_infra = infracalcs(UCM,forc,UCM.road.emissivity,e_wall,UCM.roadTemp,UCM.wallTemp)<EOL>UCM.road.SurfFlux(forc,parameter,simTime,UCM.canHum,T_can,UCM.canWind,<NUM_LIT>,<NUM_LIT:0.>)<EOL>UCM.roadTemp = UCM.road.layerTemp[<NUM_LIT:0>]<EOL>if UCM.latHeat != None:<EOL><INDENT>UCM.latHeat = UCM.latHeat + UCM.latAnthrop + UCM.treeLatHeat + UCM.road.lat*(<NUM_LIT:1.>-UCM.bldDensity)<EOL><DEDENT>forDens = <NUM_LIT:0.0><EOL>intAdv1 = <NUM_LIT:0.0><EOL>intAdv2 = <NUM_LIT:0.0><EOL>c1 = <NUM_LIT:0.0><EOL>c2 = <NUM_LIT:0.0><EOL>c3 = <NUM_LIT:0.0><EOL>for iz in range(RSM.nzfor):<EOL><INDENT>y = RSM.densityProfC[iz]*RSM.dz[iz]/(RSM.z[RSM.nzfor-<NUM_LIT:1>] + RSM.dz[RSM.nzfor-<NUM_LIT:1>]/<NUM_LIT>)<EOL>t = forDens + y<EOL>c1 += (t - forDens) - y<EOL>forDens = t<EOL>y = RSM.windProf[iz]*RSM.tempProf[iz]*RSM.dz[iz]<EOL>t = intAdv1 + y<EOL>c2 += (t - intAdv1) - y<EOL>intAdv1 = t<EOL>y = RSM.windProf[iz]*RSM.dz[iz]<EOL>t = intAdv2 + y<EOL>c3 += (t - intAdv2) - y<EOL>intAdv2 = t<EOL><DEDENT>forDens -= c1<EOL>intAdv1 -= c2<EOL>intAdv2 -= c3<EOL>UBL.advHeat = UBL.paralLength*Cp*forDens*(intAdv1-(UBL.ublTemp*intAdv2))/UBL.urbArea<EOL>zrUrb = <NUM_LIT:2>*UCM.bldHeight<EOL>zref = RSM.z[RSM.nzref-<NUM_LIT:1>]    <EOL>windUrb = forc.wind*log(zref/RSM.z0r)/log(parameter.windHeight/RSM.z0r)*log(zrUrb/UCM.z0u)/log(zref/UCM.z0u)<EOL>dens = forc.pres/(<NUM_LIT:1000>*<NUM_LIT>*T_can*(<NUM_LIT:1.>+<NUM_LIT>*UCM.canHum))<EOL>UCM.ustar = parameter.vk*windUrb/log((zrUrb-UCM.l_disp)/UCM.z0u)<EOL>wstar = (parameter.g*max(UCM.sensHeat,<NUM_LIT:0.0>)*zref/dens/Cp/T_can)**(<NUM_LIT:1>/<NUM_LIT>)<EOL>UCM.ustarMod = max(UCM.ustar,wstar)        <EOL>UCM.uExch = parameter.exCoeff*UCM.ustarMod <EOL>UCM.canWind = UCM.ustarMod*(UCM.verToHor/<NUM_LIT>)**(-<NUM_LIT:1>/<NUM_LIT>)<EOL>UCM.turbU = <NUM_LIT>*UCM.ustarMod<EOL>UCM.turbV = <NUM_LIT>*UCM.ustarMod<EOL>UCM.turbW = <NUM_LIT>*UCM.ustarMod<EOL>for iz in range(RSM.nzref):<EOL><INDENT>UCM.windProf.append(UCM.ustar/parameter.vk*log((RSM.z[iz]+UCM.bldHeight-UCM.l_disp)/UCM.z0u))<EOL><DEDENT>return UCM,UBL,BEM<EOL>
Calculate the surface heat fluxes
Output: [UCM,UBL,BEM]