2 ! -----------------------------------------------------------------------
3 ! Variables and constants used in the BEM module
4 ! -----------------------------------------------------------------------
6 real emins !emissivity of the internal walls
8 real albins !albedo of the internal walls
9 !! parameter (albins=0.5)
10 parameter (albins=0.3)
12 real thickwin !thickness of the window [m]
13 parameter (thickwin=0.006)
14 real cswin !Specific heat of the windows [J/(m3.K)]
15 parameter(cswin= 2.268e+06)
17 real temp_rat !power of the A.C. heating/cooling the indoor air [K/s]
18 parameter(temp_rat=0.001)
20 real hum_rat !power of the A.C. drying/moistening the indoor air [(Kg/kg)/s]
21 parameter(hum_rat=1.e-06)
26 !====6================================================================72
27 !====6================================================================72
29 subroutine BEM(nzcanm,nlev,nhourday,dt,bw,bl,dzlev, &
30 nwal,nflo,nrof,ngrd,hswalout,gswal, &
31 hswinout,hsrof,gsrof, &
32 latent,sigma,albwal,albwin,albrof, &
33 emrof,emwal,emwin,rswal,rlwal,rair,cp, &
34 rhoout,tout,humout,press, &
35 rs,rl,dzwal,cswal,kwal,pwin,cop,beta,sw_cond, &
36 timeon,timeoff,targtemp,gaptemp,targhum,gaphum, &
37 perflo,hsesf,hsequip,dzflo, &
38 csflo,kflo,dzgrd,csgrd,kgrd,dzrof,csrof, &
39 krof,tlev,shumlev,twal,twin,tflo,tgrd,trof, &
40 hsout,hlout,consump,hsvent,hlvent)
43 ! ---------------------------------------------------------------------
46 ! ---------------------------------------------------------------------
48 ! ---------------------
49 ! ! ----------------- !--->roof (-) : level number
50 ! ! ! ! ! rem: the windows are given
51 ! ! !---------------! ! with respect to the
52 ! ! !---------------! ! vertical walls-->win(2)
54 ! ! !---------------! ! 2D vision of the building
55 ! WEST ! !-------4-------! ! EAST
56 ! I ! ! 1 ilev 2! ! II ^
57 ! ! !-------3--------! ! !
58 ! ! !---------------! !--->floor 1 !
61 ! ! ----------------- ! <--------------(n)
62 ! ------------------------>ground ------------(1)
67 ! /| /| 3D vision of a room
85 !-----------------------------------------------------------------------
91 real dt !time step [s]
93 integer nzcanm !Maximum number of vertical levels in the urban grid
94 integer nlev !number of floors in the building
95 integer nwal !number of levels inside the wall
96 integer nrof !number of levels inside the roof
97 integer nflo !number of levels inside the floor
98 integer ngrd !number of levels inside the ground
99 real dzlev !vertical grid resolution [m]
100 real bl !Building length [m]
101 real bw !Building width [m]
103 real albwal !albedo of the walls
104 real albwin !albedo of the windows
105 real albrof !albedo of the roof
107 real emwal !emissivity of the walls
109 real emrof !emissivity of the roof
110 real emwin !emissivity of the windows
112 real pwin !window proportion
113 real, intent(in) :: cop !Coefficient of performance of the A/C systems
114 real, intent(in) :: beta !Thermal efficiency of the heat exchanger
115 integer, intent(in) :: sw_cond ! Air Conditioning switch
116 real, intent(in) :: timeon ! Initial local time of A/C systems
117 real, intent(in) :: timeoff ! Ending local time of A/C systems
118 real, intent(in) :: targtemp ! Target temperature of A/C systems
119 real, intent(in) :: gaptemp ! Comfort range of indoor temperature
120 real, intent(in) :: targhum ! Target humidity of A/C systems
121 real, intent(in) :: gaphum ! Comfort range of specific humidity
122 real, intent(in) :: perflo ! Peak number of occupants per unit floor area
123 real, intent(in) :: hsesf !
124 real, intent(in) :: hsequip(24) !
126 real cswal(nwal) !Specific heat of the wall [J/(m3.K)]
128 real csflo(nflo) !Specific heat of the floor [J/(m3.K)]
129 real csrof(nrof) !Specific heat of the roof [J/(m3.K)]
130 real csgrd(ngrd) !Specific heat of the ground [J/(m3.K)]
132 real kwal(nwal+1) !Thermal conductivity in each layers of the walls (face) [W/(m.K)]
133 real kflo(nflo+1) !Thermal diffusivity in each layers of the floors (face) [W/(m.K)]
134 real krof(nrof+1) !Thermal diffusivity in each layers of the roof (face) [W/(m.K)]
135 real kgrd(ngrd+1) !Thermal diffusivity in each layers of the ground (face) [W/(m.K)]
137 real dzwal(nwal) !Layer sizes of walls [m]
138 real dzflo(nflo) !Layer sizes of floors [m]
139 real dzrof(nrof) !Layer sizes of roof [m]
140 real dzgrd(ngrd) !Layer sizes of ground [m]
142 real latent !latent heat of evaporation [J/Kg]
145 real rs !external short wave radiation [W/m2]
146 real rl !external long wave radiation [W/m2]
147 real rswal(4,nzcanm) !short wave radiation reaching the exterior walls [W/m2]
148 real rlwal(4,nzcanm) !long wave radiation reaching the walls [W/m2]
149 real rhoout(nzcanm) !exterior air density [kg/m3]
150 real tout(nzcanm) !external temperature [K]
151 real humout(nzcanm) !absolute humidity [Kgwater/Kgair]
152 real press(nzcanm) !external air pressure [Pa]
154 real hswalout(4,nzcanm) !outside walls sensible heat flux [W/m2]
155 real hswinout(4,nzcanm) !outside window sensible heat flux [W/m2]
156 real hsrof !Sensible heat flux at the roof [W/m2]
158 real rair !ideal gas constant [J.kg-1.K-1]
159 real sigma !parameter (wall is not black body) [W/m2.K4]
160 real cp !specific heat of air [J/kg.K]
165 real tlev(nzcanm) !temperature of the floors [K]
166 real shumlev(nzcanm) !specific humidity of the floor [kg/kg]
167 real twal(4,nwal,nzcanm) !walls temperatures [K]
168 real twin(4,nzcanm) !windows temperatures [K]
169 real tflo(nflo,nzcanm-1) !floor temperatures [K]
170 real tgrd(ngrd) !ground temperature [K]
171 real trof(nrof) !roof temperature [K]
172 real hsout(nzcanm) !sensible heat emitted outside the floor [W]
173 real hlout(nzcanm) !latent heat emitted outside the floor [W]
174 real consump(nzcanm) !Consumption for the a.c. in each floor [W]
175 real hsvent(nzcanm) !sensible heat generated by natural ventilation [W]
176 real hlvent(nzcanm) !latent heat generated by natural ventilation [W]
177 real gsrof !heat flux flowing inside the roof [W/m²]
178 real gswal(4,nzcanm) !heat flux flowing inside the floors [W/m²]
182 integer swwal !swich for the physical coefficients calculation
183 integer ilev !index for rooms
184 integer iwal !index for walls
185 integer iflo !index for floors
186 integer ivw !index for vertical walls
187 integer igrd !index for ground
188 integer irof !index for roof
189 real hseqocc(nzcanm) !sensible heat generated by equipments and occupants [W]
190 real hleqocc(nzcanm) !latent heat generated by occupants [W]
191 real hscond(nzcanm) !sensible heat generated by wall conduction [W]
192 real hslev(nzcanm) !sensible heat flux generated inside the room [W]
193 real hllev(nzcanm) !latent heat flux generatd inside the room [W]
194 real surwal(6,nzcanm) !Surface of the walls [m2]
195 real surwal1D(6) !wall surfaces of a generic room [m2]
196 real rsint(6) !short wave radiation reaching the indoor walls[W/m2]
197 real rswalins(6,nzcanm) !internal short wave radiation for the building [W/m2]
198 real twin1D(4) !temperature of windows for a particular room [K]
199 real twal_int(6) !temperature of the first internal layers of a room [K]
200 real rlint(6) !internal wall long wave radiation [w/m2]
201 real rlwalins(6,nzcanm) !internal long wave radiation for the building [W/m2]
202 real hrwalout(4,nzcanm) !external radiative flux to the walls [W/m2]
203 real hrwalins(6,nzcanm) !inside radiative flux to the walls [W/m2]
204 real hrwinout(4,nzcanm) !external radiative flux to the window [W/m2]
205 real hrwinins(4,nzcanm) !inside radiative flux to the window [W/m2]
206 real hrrof !external radiative flux to the roof [W/m2]
208 real hsneed(nzcanm) !sensible heat needed by the room [W]
209 real hlneed(nzcanm) !latent heat needed by the room [W]
210 real hswalins(6,nzcanm) !inside walls sensible heat flux [W/m2]
212 real hswinins(4,nzcanm) !inside window sensible heat flux [W/m2]
214 real htot(2) !total heat flux at the wall [W/m2]
220 real Qb !Overall heat capacity of the indoor air [J/K]
221 real vollev !volume of the room [m3]
222 real rhoint !density of the internal air [Kg/m3]
223 real cpint !specific heat of the internal air [J/kg.K]
224 real humdry !specific humidiy of dry air [kg water/kg dry air]
225 real radflux !Function to compute the total radiation budget
226 real consumpbuild !Energetic consumption for the entire building [KWh/s]
227 real hsoutbuild !Total sensible heat ejected into the atmosphere[W]
228 !by the air conditioning system and per building
229 real nhourday !number of hours from midnight, local time
230 !--------------------------------------------
232 !--------------------------------------------
242 !Calculation of the surfaces of the building
243 !--------------------------------------------
248 surwal(ivw,ilev)=1. !initialisation
254 surwal(ivw,ilev)=dzlev*bw
257 surwal(ivw,ilev)=dzlev*bl
260 surwal(ivw,ilev)=bw*bl
265 ! Calculation of the short wave radiations at the internal walls
266 ! ---------------------------------------------------------------
272 rswal1D(ivw)=rswal(ivw,ilev)
276 surwal1D(ivw)=surwal(ivw,ilev)
279 call int_rsrad(albwin,albins,pwin,rswal1D,&
280 surwal1D,bw,bl,dzlev,rsint)
283 rswalins(ivw,ilev)=rsint(ivw)
290 ! Calculation of the long wave radiation at the internal walls
291 !-------------------------------------------------------------
300 twin1D(ivw)=twin(ivw,ilev)
301 twal_int(ivw)=twal(ivw,1,ilev)
304 twal_int(5)=tflo(nflo,ilev-1)
305 twal_int(6)=tflo(1,ilev)
307 call int_rlrad(emins,emwin,sigma,twal_int,twin1D,&
308 pwin,bw,bl,dzlev,rlint)
312 rlwalins(ivw,ilev)=rlint(ivw)
324 twin1D(ivw)=twin(ivw,1)
325 twal_int(ivw)=twal(ivw,1,1)
328 twal_int(5)=tgrd(ngrd)
329 twal_int(6)=tflo(1,1)
332 call int_rlrad(emins,emwin,sigma,twal_int,twin1D,&
333 pwin,bw,bl,dzlev,rlint)
336 rlwalins(ivw,1)=rlint(ivw)
342 twin1D(ivw)=twin(ivw,nlev)
343 twal_int(ivw)=twal(ivw,1,nlev)
346 twal_int(5)=tflo(nflo,nlev-1)
350 call int_rlrad(emins,emwin,sigma,twal_int,twin1D,&
351 pwin,bw,bl,dzlev,rlint)
354 rlwalins(ivw,nlev)=rlint(ivw)
357 else !Top <---> Bottom
360 twin1D(ivw)=twin(ivw,1)
361 twal_int(ivw)=twal(ivw,1,1)
364 twal_int(5)=tgrd(ngrd)
367 call int_rlrad(emins,emwin,sigma,twal_int,twin1D, &
368 pwin,bw,bl,dzlev,rlint)
371 rlwalins(ivw,1)=rlint(ivw)
377 ! Calculation of the radiative fluxes
378 ! -----------------------------------
380 !External vertical walls and windows
384 call radfluxs(radflux,albwal,rswal(ivw,ilev), &
385 emwal,rlwal(ivw,ilev),sigma, &
388 hrwalout(ivw,ilev)=radflux
390 hrwinout(ivw,ilev)=emwin*rlwal(ivw,ilev)- &
391 emwin*sigma*(twin(ivw,ilev)**4)
399 call radfluxs(radflux,albrof,rs,emrof,rl,sigma,trof(nrof))
403 !Internal walls for intermediate rooms
410 call radfluxs(radflux,albins,rswalins(ivw,ilev), &
411 emins,rlwalins(ivw,ilev),sigma, &
414 hrwalins(ivw,ilev)=radflux
418 call radfluxs(radflux,albins,rswalins(5,ilev), &
419 emins,rlwalins(5,ilev),sigma,&
422 hrwalins(5,ilev)=radflux
424 call radfluxs(radflux,albins,rswalins(6,ilev), &
425 emins,rlwalins(6,ilev),sigma,&
427 hrwalins(6,ilev)=radflux
434 !Internal walls for the bottom and the top room
442 call radfluxs(radflux,albins,rswalins(ivw,1), &
443 emins,rlwalins(ivw,1),sigma, &
446 hrwalins(ivw,1)=radflux
451 call radfluxs(radflux,albins,rswalins(5,1),&
452 emins,rlwalins(5,1),sigma,& !bottom
455 hrwalins(5,1)=radflux
458 call radfluxs(radflux,albins,rswalins(6,1),&
459 emins,rlwalins(6,1),sigma,&
462 hrwalins(6,1)=radflux
468 call radfluxs(radflux,albins,rswalins(ivw,nlev), &
469 emins,rlwalins(ivw,nlev),sigma,&
472 hrwalins(ivw,nlev)=radflux
477 call radfluxs(radflux,albins,rswalins(5,nlev), &
478 emins,rlwalins(5,nlev),sigma,&
481 hrwalins(5,nlev)=radflux
483 call radfluxs(radflux,albins,rswalins(6,nlev), &
484 emins,rlwalins(6,nlev),sigma,&
487 hrwalins(6,nlev)=radflux
489 else ! Top <---> Bottom room
493 call radfluxs(radflux,albins,rswalins(ivw,1),&
494 emins,rlwalins(ivw,1),sigma, &
497 hrwalins(ivw,1)=radflux
501 call radfluxs(radflux,albins,rswalins(5,1),&
502 emins,rlwalins(5,1),sigma, &
505 hrwalins(5,1)=radflux
507 call radfluxs(radflux,albins,rswalins(6,nlev), &
508 emins,rlwalins(6,nlev),sigma,&
510 hrwalins(6,1)=radflux
519 hrwinins(ivw,ilev)=emwin*rlwalins(ivw,ilev)- &
520 emwin*sigma*(twin(ivw,ilev)**4)
525 ! Calculation of the sensible heat fluxes
526 ! ---------------------------------------
528 !Vertical fluxes for walls
533 call hsinsflux (2,2,tlev(ilev),twal(ivw,1,ilev),hs)
535 hswalins(ivw,ilev)=hs
541 !Vertical fluxes for windows
547 call hsinsflux (2,1,tlev(ilev),twin(ivw,ilev),hs)
549 hswinins(ivw,ilev)=hs
561 call hsinsflux (1,2,tlev(ilev),tflo(nflo,ilev-1),hs)
565 call hsinsflux (1,2,tlev(ilev),tflo(1,ilev),hs)
575 call hsinsflux (1,2,tlev(1),tgrd(ngrd),hs)
577 hswalins(5,1)=hs !Bottom room
579 call hsinsflux (1,2,tlev(1),tflo(1,1),hs)
583 call hsinsflux (1,2,tlev(nlev),tflo(nflo,nlev-1),hs)
585 hswalins(5,nlev)=hs !Top room
587 call hsinsflux (1,2,tlev(nlev),trof(1),hs)
591 else ! Bottom<--->Top
593 call hsinsflux (1,2,tlev(1),tgrd(ngrd),hs)
597 call hsinsflux (1,2,tlev(nlev),trof(1),hs)
604 !Calculation of the temperature for the different surfaces
605 ! --------------------------------------------------------
613 htot(1)=hswalins(ivw,ilev)+hrwalins(ivw,ilev)
614 htot(2)=hswalout(ivw,ilev)+hrwalout(ivw,ilev)
615 gswal(ivw,ilev)=htot(2)
618 twal1D(iwal)=twal(ivw,iwal,ilev)
621 call wall(swwal,nwal,dt,dzwal,kwal,cswal,htot,twal1D)
624 twal(ivw,iwal,ilev)=twal1D(iwal)
635 htot(1)=hswinins(ivw,ilev)+hrwinins(ivw,ilev)
636 htot(2)=hswinout(ivw,ilev)+hrwinout(ivw,ilev)
638 twin(ivw,ilev)=twin(ivw,ilev)+(dt/(cswin*thickwin))* &
651 htot(1)=hrwalins(6,ilev)+hswalins(6,ilev)
652 htot(2)=hrwalins(5,ilev+1)+hswalins(5,ilev+1)
655 tflo1D(iflo)=tflo(iflo,ilev)
658 call wall(swwal,nflo,dt,dzflo,kflo,csflo,htot,tflo1D)
661 tflo(iflo,ilev)=tflo1D(iflo)
672 htot(1)=0. !Diriclet b.c. at the internal boundary
673 htot(2)=hswalins(5,1)+hrwalins(5,1)
676 tgrd1D(igrd)=tgrd(igrd)
679 call wall(swwal,ngrd,dt,dzgrd,kgrd,csgrd,htot,tgrd1D)
682 tgrd(igrd)=tgrd1D(igrd)
690 htot(1)=hswalins(6,nlev)+hrwalins(6,nlev)
695 trof1D(irof)=trof(irof)
698 call wall(swwal,nrof,dt,dzrof,krof,csrof,htot,trof1D)
701 trof(irof)=trof1D(irof)
704 ! Calculation of the heat fluxes and of the temperature of the rooms
705 ! ------------------------------------------------------------------
709 !Calculation of the heat generated by equipments and occupants
711 call fluxeqocc(nhourday,bw,bl,perflo,hsesf,hsequip,hseqocc(ilev),hleqocc(ilev))
713 !Calculation of the heat generated by natural ventilation
716 humdry=shumlev(ilev)/(1.-shumlev(ilev))
717 rhoint=(press(ilev))/(rair*(1.+0.61*humdry)*tlev(ilev))
718 cpint=cp*(1.+0.84*humdry)
721 call fluxvent(cpint,rhoint,vollev,tlev(ilev),tout(ilev), &
722 latent,humout(ilev),rhoout(ilev),shumlev(ilev),&
723 beta,hsvent(ilev),hlvent(ilev))
725 !Calculation of the heat generated by conduction
728 hswalins1D(iwal)=hswalins(iwal,ilev)
729 surwal1D(iwal)=surwal(iwal,ilev)
733 hswinins1D(iwal)=hswinins(iwal,ilev)
736 call fluxcond(hswalins1D,hswinins1D,surwal1D,pwin,&
739 !Calculation of the heat generated inside the room
741 call fluxroo(hseqocc(ilev),hleqocc(ilev),hsvent(ilev), &
742 hlvent(ilev),hscond(ilev),hslev(ilev),hllev(ilev))
745 !Evolution of the temperature and of the specific humidity
747 Qb=rhoint*cpint*vollev
749 ! temperature regulation
751 call regtemp(sw_cond,nhourday,dt,Qb,hslev(ilev), &
752 tlev(ilev),timeon,timeoff,targtemp,gaptemp,hsneed(ilev))
754 ! humidity regulation
756 call reghum(sw_cond,nhourday,dt,vollev,rhoint,latent, &
757 hllev(ilev),shumlev(ilev),timeon,timeoff,&
758 targhum,gaphum,hlneed(ilev))
760 !performance of the air conditioning system for the test
763 call air_cond(hsneed(ilev),hlneed(ilev),dt, &
764 hsout(ilev),hlout(ilev),consump(ilev), cop)
766 tlev(ilev)=tlev(ilev)+(dt/Qb)*(hslev(ilev)-hsneed(ilev))
768 shumlev(ilev)=shumlev(ilev)+(dt/(vollev*rhoint*latent))* &
769 (hllev(ilev)-hlneed(ilev))
773 call consump_total(nzcanm,nlev,consumpbuild,hsoutbuild, &
779 !====6=8===============================================================72
780 !====6=8===============================================================72
782 subroutine wall(swwall,nz,dt,dz,k,cs,flux,temp)
784 !______________________________________________________________________
786 !The aim of this subroutine is to solve the 1D heat fiffusion equation
787 !for roof, walls and streets:
789 ! dT/dt=d/dz[K*dT/dz] where:
791 ! -T is the surface temperature(wall, street, roof)
792 ! -Kz is the heat diffusivity inside the material.
794 !The resolution is done implicitly with a FV discretisation along the
795 !different layers of the material:
797 ! ____________________________
801 ! ____________________________
804 ! ____________________________
806 ! I ==> [T(I,n+1)-T(I,n)]/DT=
807 ! ____________________________ [F(i+1)-F(i)]/DZI
809 ! I-1 ==> A*T(n+1)=B where:
810 ! ____________________________
811 ! i-1 * * A is a TRIDIAGONAL matrix.
812 ! * * B=T(n)+S takes into account the sources.
814 ! 1 ____________________________
816 !________________________________________________________________
822 integer nz !Number of layers inside the material
824 real dz(nz) !Layer sizes [m]
825 real cs(nz) !Specific heat of the material [J/(m3.K)]
826 real k(nz+1) !Thermal conductivity in each layers (face) [W/(m.K)]
827 real flux(2) !Internal and external flux terms.
832 integer swwall !swich for the physical coefficients calculation
833 real temp(nz) !Temperature at each layer
838 real a(-1:1,nz) ! a(-1,*) lower diagonal A(i,i-1)
839 ! a(0,*) principal diagonal A(i,i)
840 ! a(1,*) upper diagonal A(i,i+1).
842 real b(nz) !Coefficients of the second term.
849 !________________________________________________________________
851 !Calculation of the coefficients
853 if (swwall.eq.1) then
856 write(*,*) 'number of layers in the walls/roofs too big ',nz
857 write(*,*) 'please decrease under of',20
861 call wall_coeff(nz,dt,dz,cs,k,k1,k2,kc)
866 !Computation of the first value (iz=1) of A and B:
872 b(1)=temp(1)+flux(1)*kc(1)
875 !!We can fixed the internal temperature
883 !Computation of the internal values (iz=2,...,n-1) of A and B:
887 a(0,iz)=1+k1(iz)+k2(iz)
892 !Computation of the external value (iz=n) of A and B:
898 b(nz)=temp(nz)+flux(2)*kc(nz)
900 !Resolution of the system A*T(n+1)=B
902 call tridia(nz,a,b,temp)
907 !====6=8===============================================================72
908 !====6=8===============================================================72
910 subroutine wall_coeff(nz,dt,dz,cs,k,k1,k2,kc)
914 !---------------------------------------------------------------------
917 integer nz !Number of layers inside the material
919 real dz(nz) !Layer sizes [m]
920 real cs(nz) !Specific heat of the material [J/(m3.K)]
921 real k(nz+1) !Thermal diffusivity in each layers (face) [W/(m.K)]
927 real flux(2) !Internal and external flux terms.
941 !------------------------------------------------------------------
944 kc(iz)=dt/(dz(iz)*cs(iz))
945 kf(iz)=2*k(iz)/(dz(iz)+dz(iz-1))
948 kc(1)=dt/(dz(1)*cs(1))
956 k2(iz)=kc(iz)*kf(iz+1)*cs(iz)/cs(iz+1)
960 end subroutine wall_coeff
962 !====6=8===============================================================72
963 !====6=8===============================================================72
964 subroutine hsinsflux(swsurf,swwin,tin,tw,hsins)
968 ! --------------------------------------------------------------------
969 ! This routine computes the internal sensible heat flux.
970 ! The swsurf, makes rhe difference between a vertical and a
971 ! horizontal surface.
972 ! The values of the heat conduction coefficients hc are obtained from the book
973 ! "Energy Simulation in Building Design". J.A. Clarke.
974 ! Adam Hilger, Bristol, 362 pp.
975 ! --------------------------------------------------------------------
978 integer swsurf !swich for the type of surface (horizontal/vertical)
979 integer swwin !swich for the type of surface (window/wall)
980 real tin !Inside temperature [K]
981 real tw !Internal wall temperature [K]
986 real hsins !internal sensible heat flux [W/m2]
989 real hc !heat conduction coefficient [W/°C.m2]
990 !--------------------------------------------------------------------
992 if (swsurf.eq.2) then !vertical surface
994 hc=5.678*0.99 !window surface (smooth surface)
996 hc=5.678*1.09 !wall surface (rough surface)
1001 if (swsurf.eq.1) then !horizontal surface
1002 if (swwin.eq.1) then
1003 hc=5.678*0.99 !window surface (smooth surface)
1005 hc=5.678*1.09 !wall surface (rough surface)
1011 end subroutine hsinsflux
1012 !====6=8===============================================================72
1013 !====6=8===============================================================72
1015 subroutine int_rsrad(albwin,albwal,pwin,rswal,&
1016 surwal,bw,bl,zw,rsint)
1018 ! ------------------------------------------------------------------
1020 ! ------------------------------------------------------------------
1024 real albwin !albedo of the windows
1025 real albwal !albedo of the internal wall
1026 real rswal(4) !incoming short wave radiation [W/m2]
1027 real surwal(6) !surface of the indoor walls [m2]
1028 real bw,bl !width of the walls [m]
1029 real zw !height of the wall [m]
1030 real pwin !window proportion
1034 real rsint(6) !internal walls short wave radiation [W/m2]
1038 real transmit !transmittance of the direct/diffused radiation
1039 real rstr !solar radiation transmitted through the windows
1040 real surtotwal !total indoor surface of the walls in the room
1042 real b(6) !second member for the system
1043 real a(6,6) !matrix for the system
1045 !-------------------------------------------------------------------
1048 ! Calculation of the solar radiation transmitted through windows
1053 rstr = rstr+(surwal(iw)*pwin)*(transmit*rswal(iw))
1056 !We suppose that the radiation is spread isotropically within the
1057 !room when it passes through the windows, so the flux [W/m²] in every
1062 surtotwal=surtotwal+surwal(iw)
1067 !Computation of the short wave radiation reaching the internal walls
1069 call algebra_short(rstr,albwal,albwin,bw,bl,zw,pwin,a,b)
1071 call gaussjbem(a,6,b,6)
1078 end subroutine int_rsrad
1080 !====6=8===============================================================72
1081 !====6=8===============================================================72
1083 subroutine int_rlrad(emwal,emwin,sigma,twal_int,twin,&
1084 pwin,bw,bl,zw,rlint)
1086 ! ------------------------------------------------------------------
1088 ! ------------------------------------------------------------------
1093 real emwal !emissivity of the internal walls
1094 real emwin !emissivity of the window
1095 real sigma !Stefan-Boltzmann constant [W/m2.K4]
1096 real twal_int(6)!temperature of the first internal layers of a room [K]
1097 real twin(4) !temperature of the windows [K]
1098 real bw !width of the wall
1099 real bl !length of the wall
1100 real zw !height of the wall
1101 real pwin !window proportion
1106 real rlint(6) !internal walls long wave radiation [W/m2]
1111 real b(6) !second member vector for the system
1112 real a(6,6) !matrix for the system
1114 !----------------------------------------------------------------
1116 !Compute the long wave radiation reachs the internal walls
1118 call algebra_long(emwal,emwin,sigma,twal_int,twin,pwin,&
1121 call gaussjbem(a,6,b,6)
1128 end subroutine int_rlrad
1130 !====6=8===============================================================72
1131 !====6=8===============================================================72
1133 subroutine algebra_short(rstr,albwal,albwin,aw,bw,zw,pwin,a,b)
1135 !--------------------------------------------------------------------
1136 !This routine calculates the algebraic system that will be solved for
1137 !the computation of the total shortwave radiation that reachs every
1138 !indoor wall in a floor.
1139 !Write the matrix system ax=b to solve
1141 ! -Rs(1)+a(1,2)Rs(2)+.................+a(1,6)Rs(6)=-Rs=b(1)
1142 !a(2,1)Rs(1)- Rs(2)+.................+a(2,6)Rs(6)=-Rs=b(2)
1143 !a(3,1)Rs(1)+a(3,2)Rs(3)-Rs(3)+...........+a(3,6)Rs(6)=-Rs=b(3)
1144 !a(4,1)Rs(1)+.................-Rs(4)+.....+a(4,6)Rs(6)=-Rs=b(4)
1145 !a(5,1)Rs(1)+.......................-Rs(5)+a(5,6)Rs(6)=-Rs=b(5)
1146 !a(6,1)Rs(1)+....................................-R(6)=-Rs=b(6)
1148 !This version suppose the albedo of the indoor walls is the same.
1149 !--------------------------------------------------------------------
1151 !--------------------------------------------------------------------
1155 real rstr !solar radiation transmitted through the windows
1156 real albwal !albedo of the internal walls
1157 real albwin !albedo of the windows.
1158 real bw !length of the wall
1159 real aw !width of the wall
1160 real zw !height of the wall
1161 real fprl_int !view factor
1162 real fnrm_int !view factor
1163 real pwin !window proportion
1166 real a(6,6) !Matrix for the system
1167 real b(6) !Second member for the system
1171 real albm !averaged albedo
1172 !----------------------------------------------------------------
1174 !Initialise the variables
1183 !Calculation of the second member b
1189 !Calculation of the averaged albedo
1191 albm=pwin*albwin+(1-pwin)*albwal
1193 !Calculation of the matrix a
1197 call fprl_ints(fprl_int,aw/bw,zw/bw)
1199 a(1,2)=albm*fprl_int
1201 call fnrm_ints(fnrm_int,aw/zw,bw/zw,(aw*aw+bw*bw)/(zw*zw))
1203 a(1,3)=albm*(bw/aw)*fnrm_int
1207 call fnrm_ints(fnrm_int,zw/aw,bw/aw,(bw*bw+zw*zw)/(aw*aw))
1209 a(1,5)=albwal*(bw/zw)*fnrm_int
1222 call fnrm_ints(fnrm_int,bw/zw,aw/zw,(bw*bw+aw*aw)/(zw*zw))
1224 a(3,1)=albm*(aw/bw)*fnrm_int
1228 call fprl_ints(fprl_int,zw/aw,bw/aw)
1230 a(3,4)=albm*fprl_int
1232 call fnrm_ints(fnrm_int,zw/bw,aw/bw,(aw*aw+zw*zw)/(bw*bw))
1234 a(3,5)=albwal*(aw/zw)*fnrm_int
1245 call fnrm_ints(fnrm_int,bw/aw,zw/aw,(bw*bw+zw*zw)/(aw*aw))
1247 a(5,1)=albm*(zw/bw)*fnrm_int
1251 call fnrm_ints(fnrm_int,aw/bw,zw/bw,(aw*aw+zw*zw)/(bw*bw))
1253 a(5,3)=albm*(zw/aw)*fnrm_int
1258 call fprl_ints(fprl_int,aw/zw,bw/zw)
1260 a(5,6)=albwal*fprl_int
1271 end subroutine algebra_short
1273 !====6=8===============================================================72
1274 !====6=8===============================================================72
1276 subroutine algebra_long(emwal,emwin,sigma,twalint,twinint,&
1279 !--------------------------------------------------------------------
1280 !This routine computes the algebraic system that will be solved to
1281 !compute the longwave radiation that reachs the indoor
1283 !Write the matrix system ax=b to solve
1285 !a(1,1)Rl(1)+.............................+Rl(6)=b(1)
1286 !a(2,1)Rl(1)+.................+Rl(5)+a(2,6)Rl(6)=b(2)
1287 !a(3,1)Rl(1)+.....+Rl(3)+...........+a(3,6)Rl(6)=b(3)
1288 !a(4,1)Rl(1)+...........+Rl(4)+.....+a(4,6)Rl(6)=b(4)
1289 ! Rl(1)+.......................+a(5,6)Rl(6)=b(5)
1290 !a(6,1)Rl(1)+Rl(2)+.................+a(6,6)Rl(6)=b(6)
1292 !--------------------------------------------------------------------
1295 !--------------------------------------------------------------------
1300 real pwin !window proportion
1301 real emwal !emissivity of the internal walls
1302 real emwin !emissivity of the window
1303 real sigma !Stefan-Boltzmann constant [W/m2.K4]
1304 real twalint(6) !temperature of the first internal layers of a room [K]
1305 real twinint(4) !temperature of the windows [K]
1306 real aw !width of the wall
1307 real bw !length of the wall
1308 real zw !height of the wall
1309 real fprl_int !view factor
1310 real fnrm_int !view factor
1311 real fnrm_intx !view factor
1312 real fnrm_inty !view factor
1316 real b(6) !second member vector for the system
1317 real a(6,6) !matrix for the system
1323 real emwal_av !averadge emissivity of the wall
1324 real emwin_av !averadge emissivity of the window
1325 real em_av !averadge emissivity
1326 real twal_int(6) !twalint
1327 real twin(4) !twinint
1328 !------------------------------------------------------------------
1330 !Initialise the variables
1331 !-------------------------
1343 twal_int(iw)=twalint(iw)
1347 twin(iw)=twinint(iw)
1350 !Calculation of the averadge emissivities
1351 !-----------------------------------------
1353 emwal_av=(1-pwin)*emwal
1355 em_av=emwal_av+emwin_av
1357 !Calculation of the second term for the walls
1358 !-------------------------------------------
1360 call fprl_ints(fprl_int,aw/zw,bw/zw)
1361 call fnrm_ints(fnrm_intx,aw/bw,zw/bw,(aw*aw+zw*zw)/(bw*bw))
1362 call fnrm_ints(fnrm_inty,bw/aw,zw/aw,(bw*bw+zw*zw)/(aw*aw))
1364 b_wall(1)=(emwal*sigma*(twal_int(5)**4)* &
1366 (sigma*(emwal_av*(twal_int(3)**4)+ &
1367 emwal_av*(twal_int(4)**4))* &
1368 (zw/aw)*fnrm_intx)+ &
1369 (sigma*(emwal_av*(twal_int(1)**4)+ &
1370 emwal_av*(twal_int(2)**4))* &
1373 call fprl_ints(fprl_int,aw/zw,bw/zw)
1374 call fnrm_ints(fnrm_intx,aw/bw,zw/bw,(aw*aw+zw*zw)/(bw*bw))
1375 call fnrm_ints(fnrm_inty,bw/aw,zw/aw,(bw*bw+zw*zw)/(aw*aw))
1377 b_wall(2)=(emwal*sigma*(twal_int(6)**4)* &
1379 (sigma*(emwal_av*(twal_int(3)**4)+ &
1380 emwal_av*(twal_int(4)**4))* &
1381 (zw/aw)*fnrm_intx)+ &
1382 (sigma*(emwal_av*(twal_int(1)**4)+ &
1383 emwal_av*(twal_int(2)**4))* &
1386 call fprl_ints(fprl_int,zw/aw,bw/aw)
1387 call fnrm_ints(fnrm_intx,bw/zw,aw/zw,(bw*bw+aw*aw)/(zw*zw))
1388 call fnrm_ints(fnrm_inty,zw/bw,aw/bw,(aw*aw+zw*zw)/(bw*bw))
1390 b_wall(3)=(emwal_av*sigma*(twal_int(4)**4)* &
1392 (sigma*(emwal_av*(twal_int(2)**4)+ &
1393 emwal_av*(twal_int(1)**4))* &
1394 (aw/bw)*fnrm_intx)+ &
1395 (sigma*(emwal*(twal_int(5)**4)+ &
1396 emwal*(twal_int(6)**4))* &
1399 call fprl_ints(fprl_int,zw/aw,bw/aw)
1400 call fnrm_ints(fnrm_intx,bw/zw,aw/zw,(bw*bw+aw*aw)/(zw*zw))
1401 call fnrm_ints(fnrm_inty,zw/bw,aw/bw,(aw*aw+zw*zw)/(bw*bw))
1403 b_wall(4)=(emwal_av*sigma*(twal_int(3)**4)* &
1405 (sigma*(emwal_av*(twal_int(2)**4)+ &
1406 emwal_av*(twal_int(1)**4))* &
1407 (aw/bw)*fnrm_intx)+ &
1408 (sigma*(emwal*(twal_int(5)**4)+ &
1409 emwal*(twal_int(6)**4))* &
1412 call fprl_ints(fprl_int,aw/bw,zw/bw)
1413 call fnrm_ints(fnrm_intx,aw/zw,bw/zw,(aw*aw+bw*bw)/(zw*zw))
1414 call fnrm_ints(fnrm_inty,zw/aw,bw/aw,(bw*bw+zw*zw)/(aw*aw))
1416 b_wall(5)=(emwal_av*sigma*(twal_int(2)**4)* &
1418 (sigma*(emwal_av*(twal_int(3)**4)+ &
1419 emwal_av*(twal_int(4)**4))* &
1420 (bw/aw)*fnrm_intx)+ &
1421 (sigma*(emwal*(twal_int(5)**4)+ &
1422 emwal*(twal_int(6)**4))* &
1425 call fprl_ints(fprl_int,aw/bw,zw/bw)
1426 call fnrm_ints(fnrm_intx,aw/zw,bw/zw,(aw*aw+bw*bw)/(zw*zw))
1427 call fnrm_ints(fnrm_inty,zw/aw,bw/aw,(bw*bw+zw*zw)/(aw*aw))
1429 b_wall(6)=(emwal_av*sigma*(twal_int(1)**4)* &
1431 (sigma*(emwal_av*(twal_int(3)**4)+ &
1432 emwal_av*(twal_int(4)**4))* &
1433 (bw/aw)*fnrm_intx)+ &
1434 (sigma*(emwal*(twal_int(5)**4)+ &
1435 emwal*(twal_int(6)**4))* &
1438 !Calculation of the second term for the windows
1439 !---------------------------------------------
1440 call fnrm_ints(fnrm_intx,aw/bw,zw/bw,(aw*aw+zw*zw)/(bw*bw))
1441 call fnrm_ints(fnrm_inty,bw/aw,zw/aw,(bw*bw+zw*zw)/(aw*aw))
1443 b_wind(1)=(sigma*(emwin_av*(twin(3)**4)+ &
1444 emwin_av*(twin(4)**4))* &
1445 (zw/aw)*fnrm_intx)+ &
1446 (sigma*(emwin_av*(twin(1)**4)+ &
1447 emwin_av*(twin(2)**4))* &
1450 call fnrm_ints(fnrm_intx,aw/bw,zw/bw,(aw*aw+zw*zw)/(bw*bw))
1451 call fnrm_ints(fnrm_inty,bw/aw,zw/aw,(bw*bw+zw*zw)/(aw*aw))
1453 b_wind(2)=(sigma*(emwin_av*(twin(3)**4)+ &
1454 emwin_av*(twin(4)**4))* &
1455 (zw/aw)*fnrm_intx)+ &
1456 (sigma*(emwin_av*(twin(1)**4)+ &
1457 emwin_av*(twin(2)**4))* &
1460 call fprl_ints(fprl_int,zw/aw,bw/aw)
1461 call fnrm_ints(fnrm_int,bw/zw,aw/zw,(bw*bw+aw*aw)/(zw*zw))
1463 b_wind(3)=emwin_av*sigma*(twin(4)**4)* &
1464 fprl_int+(sigma*(emwin_av* &
1465 (twin(2)**4)+emwin_av*(twin(1)**4))* &
1468 call fprl_ints(fprl_int,zw/aw,bw/aw)
1469 call fnrm_ints(fnrm_int,bw/zw,aw/zw,(bw*bw+aw*aw)/(zw*zw))
1471 b_wind(4)=emwin_av*sigma*(twin(3)**4)* &
1472 fprl_int+(sigma*(emwin_av* &
1473 (twin(2)**4)+emwin_av*(twin(1)**4))* &
1476 call fprl_ints(fprl_int,aw/bw,zw/bw)
1477 call fnrm_ints(fnrm_int,aw/zw,bw/zw,(aw*aw+bw*bw)/(zw*zw))
1479 b_wind(5)=emwin_av*sigma*(twin(2)**4)* &
1480 fprl_int+(sigma*(emwin_av* &
1481 (twin(3)**4)+emwin_av*(twin(4)**4))* &
1484 call fprl_ints(fprl_int,aw/bw,zw/bw)
1485 call fnrm_ints(fnrm_int,aw/zw,bw/zw,(aw*aw+bw*bw)/(zw*zw))
1487 b_wind(6)=emwin_av*sigma*(twin(1)**4)* &
1488 fprl_int+(sigma*(emwin_av* &
1489 (twin(3)**4)+emwin_av*(twin(4)**4))* &
1492 !Calculation of the total b term
1493 !-------------------------------
1496 b(iw)=b_wall(iw)+b_wind(iw)
1500 !Calculation of the matrix of the system
1501 !----------------------------------------
1503 call fnrm_ints(fnrm_int,bw/aw,zw/aw,(bw*bw+zw*zw)/(aw*aw))
1505 a(1,1)=(em_av-1.)*(zw/bw)*fnrm_int
1509 call fnrm_ints(fnrm_int,aw/bw,zw/bw,(aw*aw+zw*zw)/(bw*bw))
1511 a(1,3)=(em_av-1.)*(zw/aw)*fnrm_int
1515 call fprl_ints(fprl_int,aw/zw,bw/zw)
1517 a(1,5)=(emwal-1.)*fprl_int
1527 call fnrm_ints(fnrm_int,bw/zw,aw/zw,(bw*bw+aw*aw)/(zw*zw))
1529 a(3,1)=(em_av-1.)*(aw/bw)*fnrm_int
1534 call fprl_ints(fprl_int,zw/aw,bw/aw)
1536 a(3,4)=(em_av-1.)*fprl_int
1538 call fnrm_ints(fnrm_int,zw/bw,aw/bw,(aw*aw+zw*zw)/(bw*bw))
1540 a(3,5)=(emwal-1.)*(aw/zw)*fnrm_int
1553 call fprl_ints(fprl_int,aw/bw,zw/bw)
1555 a(5,2)=(em_av-1.)*fprl_int
1557 call fnrm_ints(fnrm_int,aw/zw,bw/zw,(aw*aw+bw*bw)/(zw*zw))
1559 a(5,3)=(em_av-1.)*(bw/aw)*fnrm_int
1563 call fnrm_ints(fnrm_int,zw/aw,bw/aw,(bw*bw+zw*zw)/(aw*aw))
1565 a(5,5)=(emwal-1.)*(bw/zw)*fnrm_int
1577 end subroutine algebra_long
1579 !====6=8===============================================================72
1580 !====6=8===============================================================72
1583 subroutine fluxroo(hseqocc,hleqocc,hsvent,hlvent, &
1586 !-----------------------------------------------------------------------
1587 !This routine calculates the heat flux generated inside the room
1588 !and the heat ejected to the atmosphere.
1589 !----------------------------------------------------------------------
1593 !-----------------------------------------------------------------------
1597 real hseqocc !sensible heat generated by equipments and occupants [W]
1598 real hleqocc !latent heat generated by occupants [W]
1599 real hsvent !sensible heat generated by natural ventilation [W]
1600 real hlvent !latent heat generated by natural ventilation [W]
1601 real hscond !sensible heat generated by wall conduction
1605 real hslev !sensible heat flux generated inside the room [W]
1606 real hllev !latent heat flux generatd inside the room
1609 !Calculation of the total sensible heat generated inside the room
1611 hslev=hseqocc+hsvent+hscond
1613 !Calculation of the total latent heat generated inside the room
1615 hllev=hleqocc+hlvent
1618 end subroutine fluxroo
1620 !====6=8===============================================================72
1621 !====6=8===============================================================72
1623 subroutine phirat(nhourday,rocc)
1625 !----------------------------------------------------------------------
1626 !This routine calculates the occupation ratio of a floor
1627 !By now we suppose a constant value
1628 !----------------------------------------------------------------------
1635 real nhourday ! number of hours from midnight (local time)
1639 real rocc !value between 0 and 1
1645 end subroutine phirat
1647 !====6=8===============================================================72
1648 !====6=8===============================================================72
1650 subroutine phiequ(nhourday,hsesf,hsequip,hsequ)
1652 !----------------------------------------------------------------------
1653 !This routine calculates the sensible heat gain from equipments
1654 !----------------------------------------------------------------------
1659 real nhourday ! number of hours from midnight, Local time
1660 real, intent(in) :: hsesf
1661 real, intent(in), dimension(24) :: hsequip
1665 real hsequ !sensible heat gain from equipment [Wm¯2]
1667 !---------------------------------------------------------------------
1669 hsequ = hsequip(int(nhourday)+1) * hsesf
1671 end subroutine phiequ
1672 !====6=8===============================================================72
1673 !====6=8===============================================================72
1675 subroutine fluxeqocc(nhourday,bw,bl,perflo,hsesf,hsequip,hseqocc,hleqocc)
1679 !---------------------------------------------------------------------
1680 !This routine calculates the sensible and the latent heat flux
1681 !generated by equipments and occupants
1682 !---------------------------------------------------------------------
1686 real bw !Room width [m]
1687 real bl !Room lengzh [m]
1688 real nhourday !number of hours from the beginning of the day
1689 real, intent(in) :: perflo ! Peak number of occupants per unit floor area
1690 real, intent(in) :: hsesf
1691 real, intent(in), dimension(24) :: hsequip
1695 real hseqocc !sensible heat generated by equipments and occupants [W]
1696 real hleqocc !latent heat generated by occupants [W]
1699 real Af !Air conditioned floor area [m2]
1700 real rocc !Occupation ratio of the floor [0,1]
1701 real hsequ !Heat generated from equipments
1703 real hsocc !Sensible heat generated by a person [W/Person]
1704 !Source Boundary Layer Climates,page 195 (book)
1705 parameter (hsocc=160.)
1707 real hlocc !Latent heat generated by a person [W/Person]
1708 !Source Boundary Layer Climates,page 225 (book)
1709 parameter (hlocc=1.96e6/86400.)
1711 !------------------------------------------------------------------
1712 ! Sensible heat flux
1713 ! ------------------
1717 call phirat(nhourday,rocc)
1719 call phiequ(nhourday,hsesf,hsequip,hsequ)
1721 hseqocc=Af*rocc*perflo*hsocc+Af*hsequ
1728 hleqocc=Af*rocc*perflo*hlocc
1731 end subroutine fluxeqocc
1733 !====6=8===============================================================72
1734 !====6=8===============================================================72
1736 subroutine fluxvent(cpint,rhoint,vollev,tlev,tout,latent,&
1737 humout,rhoout,humlev,beta,hsvent,hlvent)
1741 !---------------------------------------------------------------------
1742 !This routine calculates the sensible and the latent heat flux
1743 !generated by natural ventilation
1744 !---------------------------------------------------------------------
1748 real cpint !specific heat of the indoor air [J/kg.K]
1749 real rhoint !density of the indoor air [Kg/m3]
1750 real vollev !volume of the room [m3]
1751 real tlev !Room temperature [K]
1752 real tout !outside air temperature [K]
1753 real latent !latent heat of evaporation [J/Kg]
1754 real humout !outside absolute humidity [Kgwater/Kgair]
1755 real rhoout !air density [kg/m3]
1756 real humlev !Specific humidity of the indoor air [Kgwater/Kgair]
1757 real, intent(in) :: beta!Thermal efficiency of the heat exchanger
1761 real hsvent !sensible heat generated by natural ventilation [W]
1762 real hlvent !latent heat generated by natural ventilation [W]
1767 !----------------------------------------------------------------------
1769 ! Sensible heat flux
1770 ! ------------------
1772 hsvent=(1.-beta)*cpint*rhoint*(vollev/3600.)* &
1778 hlvent=(1.-beta)*latent*rhoint*(vollev/3600.)* &
1783 end subroutine fluxvent
1785 !====6=8===============================================================72
1786 !====6=8===============================================================72
1788 subroutine fluxcond(hswalins,hswinins,surwal,pwin,hscond)
1792 !---------------------------------------------------------------------
1793 !This routine calculates the sensible heat flux generated by
1795 !---------------------------------------------------------------------
1799 real hswalins(6) !sensible heat at the internal layers of the wall [W/m2]
1800 real hswinins(4) !internal window sensible heat flux [W/m2]
1801 real surwal(6) !surfaces of the room walls [m2]
1802 real pwin !window proportion
1808 real hscond !sensible heat generated by wall conduction [W]
1815 !----------------------------------------------------------------------
1820 hscond=hscond+surwal(ivw)*(1-pwin)*hswalins(ivw)+ &
1821 surwal(ivw)*pwin*hswinins(ivw)
1825 hscond=hscond+surwal(ivw)*hswalins(ivw)
1828 !Finally we must change the sign in hscond to be proportional
1829 !to the difference (Twall-Tindoor).
1834 end subroutine fluxcond
1836 !====6=8===============================================================72
1837 !====6=8===============================================================72
1839 subroutine regtemp(swcond,nhourday,dt,Qb,hsroo, &
1840 tlev,timeon,timeoff,targtemp,gaptemp,hsneed)
1844 !---------------------------------------------------------------------
1845 !This routine calculates the sensible heat fluxes,
1846 !after anthropogenic regulation (air conditioning)
1847 !---------------------------------------------------------------------
1851 integer swcond !swich air conditioning
1852 real nhourday !number of hours from the beginning of the day real
1853 real dt !time step [s]
1854 real Qb !overall heat capacity of the indoor air [J/K]
1855 real hsroo !sensible heat flux generated inside the room [W]
1856 real tlev !room air temperature [K]
1857 real, intent(in) :: timeon ! Initial local time of A/C systems
1858 real, intent(in) :: timeoff ! Ending local time of A/C systems
1859 real, intent(in) :: targtemp! Target temperature of A/C systems
1860 real, intent(in) :: gaptemp ! Comfort range of indoor temperature
1866 real templev !hipotetical room air temperature [K]
1867 real alpha !variable to control the heating/cooling of
1868 !the air conditining system
1871 real hsneed !sensible heat extracted to the indoor air [W]
1872 !---------------------------------------------------------------------
1873 !initialize variables
1874 !---------------------
1878 if (swcond.eq.0) then ! there is not air conditioning in the floor
1882 if ((nhourday.ge.timeon).and.(nhourday.le.timeoff)) then
1883 templev=tlev+(dt/Qb)*hsroo
1886 hsneed = 0. ! air conditioning is switched off
1893 if (abs(templev-targtemp).le.gaptemp) then
1896 if (templev.gt.(targtemp+gaptemp)) then
1897 hsneed=hsroo-(Qb/dt)*(targtemp+gaptemp-tlev)
1898 alpha=(abs(hsneed-hsroo)/Qb)
1899 if (alpha.gt.temp_rat) then
1900 hsneed=hsroo+temp_rat*Qb
1906 hsneed=hsroo-(Qb/dt)*(targtemp-gaptemp-tlev)
1907 alpha=(abs(hsneed-hsroo)/Qb)
1908 if (alpha.gt.temp_rat) then
1909 hsneed=hsroo-temp_rat*Qb
1919 end subroutine regtemp
1921 !====6=8==============================================================72
1922 !====6=8==============================================================72
1924 subroutine reghum(swcond,nhourday,dt,volroo,rhoint,latent, &
1925 hlroo,shumroo,timeon,timeoff,targhum,gaphum,hlneed)
1929 !---------------------------------------------------------------------
1930 !This routine calculates the latent heat fluxes,
1931 !after anthropogenic regulation (air conditioning)
1932 !---------------------------------------------------------------------
1936 integer swcond !swich air conditioning
1937 real nhourday !number of hours from the beginning of the day real[h]
1938 real dt !time step [s]
1939 real volroo !volume of the room [m3]
1940 real rhoint !density of the internal air [Kg/m3]
1941 real latent !latent heat of evaporation [J/Kg]
1942 real hlroo !latent heat flux generated inside the room [W]
1943 real shumroo !specific humidity of the indoor air [kg/kg]
1944 real, intent(in) :: timeon ! Initial local time of A/C systems
1945 real, intent(in) :: timeoff ! Ending local time of A/C systems
1946 real, intent(in) :: targhum ! Target humidity of the A/C systems
1947 real, intent(in) :: gaphum ! comfort range of the specific humidity
1952 real humlev !hipotetical specific humidity of the indoor [kg/kg]
1953 real betha !variable to control the drying/moistening of
1954 !the air conditioning system
1957 real hlneed !latent heat extracted to the indoor air [W]
1958 !------------------------------------------------------------------------
1959 !initialize variables
1960 !---------------------
1964 if (swcond.eq.0) then ! there is not air conditioning in the floor
1968 if ((nhourday.ge.timeon).and.(nhourday.le.timeoff)) then
1969 humlev=shumroo+(dt/(latent*rhoint*volroo))*hlroo
1972 hlneed = 0. ! air conditioning is switched off
1979 if (abs(humlev-targhum).le.gaphum) then
1982 if (humlev.gt.(targhum+gaphum)) then
1983 hlneed=hlroo-((latent*rhoint*volroo)/dt)* &
1984 (targhum+gaphum-shumroo)
1985 betha=abs(hlneed-hlroo)/(latent*rhoint*volroo)
1986 if (betha.gt.hum_rat) then
1987 hlneed=hlroo+hum_rat*(latent*rhoint*volroo)
1993 hlneed=hlroo-((latent*rhoint*volroo)/dt)* &
1994 (targhum-gaphum-shumroo)
1995 betha=abs(hlneed-hlroo)/(latent*rhoint*volroo)
1996 if (betha.gt.hum_rat) then
1997 hlneed=hlroo-hum_rat*(latent*rhoint*volroo)
2007 end subroutine reghum
2009 !====6=8==============================================================72
2010 !====6=8==============================================================72
2012 subroutine air_cond(hsneed,hlneed,dt,hsout,hlout,consump,cop)
2017 !Performance of the air conditioning system
2019 !INPUT/OUTPUT VARIABLES
2020 real, intent(in) :: cop
2022 !INPUT/OUTPUT VARIABLES
2024 real hsneed !sensible heat that is necessary for cooling/heating
2025 !the indoor air temperature [W]
2026 real hlneed !latent heat that is necessary for controling
2027 !the humidity of the indoor air [W]
2028 real dt !time step [s]
2032 real hsout !sensible heat pumped out into the atmosphere [W]
2033 real hlout !latent heat pumped out into the atmosphere [W]
2034 real consump !Electrical consumption of the air conditioning system [W]
2038 !Performance of the air conditioning system
2040 if (hsneed.gt.0) then ! air conditioning is cooling
2041 ! and the heat is pumped out into the atmosphere
2042 hsout=(1/cop)*(abs(hsneed)+abs(hlneed))+hsneed
2044 consump=(1./cop)*(abs(hsneed)+abs(hlneed))
2048 else if(hsneed.eq.0.) then !air conditioning is not working to regulate the indoor temperature
2049 hlneed=0. !no humidity regulation is considered
2050 hsout=0. !no output into the atmosphere (sensible heat)
2051 hlout=0. !no output into the atmosphere (latent heat)
2052 consump=0. !no electrical consumption
2054 else !! hsneed < 0. !air conditioning is heating
2055 hlneed=0. !no humidity regulation is considered
2056 hlout=0. !no output into the atmosphere (latent heat)
2057 consump=(1./cop)*(abs(hsneed)+abs(hlneed))
2059 !!We have two possibilities
2061 !! hsout=(1./cop)*(abs(hsneed)+abs(hlneed)) !output into the atmosphere
2062 hsout=0. !no output into the atmosphere
2066 end subroutine air_cond
2068 !====6=8==============================================================72
2069 !====6=8==============================================================72
2071 subroutine consump_total(nzcanm,nlev,consumpbuild,hsoutbuild, &
2076 !-----------------------------------------------------------------------
2077 !Compute the total consumption in kWh/s (1kWh=3.6e+6 J) and sensible heat
2078 !ejected into the atmosphere per building
2079 !------------------------------------------------------------------------
2084 integer nzcanm !Maximum number of vertical levels in the urban grid
2085 real hsout(nzcanm) !sensible heat emitted outside the room [W]
2086 real consump(nzcanm) !Electricity consumption for the a.c. in each floor[W]
2090 real consumpbuild !Energetic consumption for the entire building[kWh/s]
2091 real hsoutbuild !Total sensible heat ejected into the atmosphere
2092 !by the air conditioning systems per building [W]
2104 !INITIALIZE VARIABLES
2110 consumpbuild=consumpbuild+consump(ilev)
2111 hsoutbuild=hsoutbuild+hsout(ilev)
2114 consumpbuild=consumpbuild/(3.6e+06)
2117 end subroutine consump_total
2118 !====6=8==============================================================72
2119 !====6=8==============================================================72
2120 subroutine tridia(n,a,b,x)
2122 ! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2123 ! + by A. Clappier, EPFL, CH 1015 Lausanne +
2124 ! + phone: ++41-(0)21-693-61-60 +
2125 ! + email:alain.clappier@epfl.ch +
2126 ! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2128 ! ----------------------------------------------------------------------
2129 ! Resolution of a * x = b where a is a tridiagonal matrix
2131 ! ----------------------------------------------------------------------
2137 real a(-1:1,n) ! a(-1,*) lower diagonal A(i,i-1)
2138 ! a(0,*) principal diagonal A(i,i)
2139 ! a(1,*) upper diagonal A(i,i+1)
2148 ! ----------------------------------------------------------------------
2151 b(i)=b(i)-a(1,i)*b(i+1)/a(0,i+1)
2152 a(0,i)=a(0,i)-a(1,i)*a(-1,i+1)/a(0,i+1)
2156 b(i)=b(i)-a(-1,i)*b(i-1)/a(0,i-1)
2164 end subroutine tridia
2165 !====6=8===============================================================72
2166 !====6=8===============================================================72
2168 subroutine gaussjbem(a,n,b,np)
2170 ! ----------------------------------------------------------------------
2171 ! This routine solve a linear system of n equations of the form
2173 ! where A is a matrix a(i,j)
2174 ! B a vector and X the solution
2175 ! In output b is replaced by the solution
2176 ! ----------------------------------------------------------------------
2180 ! ----------------------------------------------------------------------
2182 ! ----------------------------------------------------------------------
2186 ! ----------------------------------------------------------------------
2188 ! ----------------------------------------------------------------------
2191 ! ----------------------------------------------------------------------
2193 ! ----------------------------------------------------------------------
2195 parameter (nmax=150)
2203 ! ----------------------------------------------------------------------
2204 ! END VARIABLES DEFINITIONS
2205 ! ----------------------------------------------------------------------
2214 if(ipiv(j).ne.1)then
2216 if(ipiv(k).eq.0)then
2217 if(abs(a(j,k)).ge.big)then
2222 elseif(ipiv(k).gt.1)then
2223 pause 'singular matrix in gaussjbem'
2229 ipiv(icol)=ipiv(icol)+1
2231 if(irow.ne.icol)then
2244 if(a(icol,icol).eq.0)pause 'singular matrix in gaussjbem'
2246 pivinv=1./a(icol,icol)
2250 a(icol,l)=a(icol,l)*pivinv
2253 b(icol)=b(icol)*pivinv
2260 a(ll,l)=a(ll,l)-a(icol,l)*dum
2263 b(ll)=b(ll)-b(icol)*dum
2270 end subroutine gaussjbem
2272 !====6=8===============================================================72
2273 !====6=8===============================================================72
2275 subroutine radfluxs(radflux,alb,rs,em,rl,sigma,twal)
2278 !-------------------------------------------------------------------
2279 !This function calculates the radiative fluxe at a surface
2280 !-------------------------------------------------------------------
2283 real alb !albedo of the surface
2284 real rs !shor wave radiation
2285 real em !emissivity of the surface
2286 real rl !lon wave radiation
2287 real sigma !parameter (wall is not black body) [W/m2.K4]
2288 real twal !wall temperature [K]
2291 radflux=(1.-alb)*rs+em*rl-em*sigma*twal**4
2294 end subroutine radfluxs
2296 !====6=8==============================================================72
2297 !====6=8==============================================================72
2299 ! we define the view factors fprl and fnrm, which are the angle
2300 ! factors between two equal and parallel planes, fprl, and two
2301 ! equal and orthogonal planes, fnrm, respectively
2303 subroutine fprl_ints(fprl_int,vx,vy)
2310 fprl_int=(2./(3.141592653*vx*vy))* &
2311 (log(sqrt((1.+vx*vx)*(1.+vy*vy)/(1.+vx*vx+vy*vy)))+ &
2312 (vy*sqrt(1.+vx*vx)*atan(vy/sqrt(1.+vx*vx)))+ &
2313 (vx*sqrt(1.+vy*vy)*atan(vx/sqrt(1.+vy*vy)))- &
2314 vy*atan(vy)-vx*atan(vx))
2317 end subroutine fprl_ints
2319 !====6=8==============================================================72
2320 !====6=8==============================================================72
2322 ! we define the view factors fprl and fnrm, which are the angle
2323 ! factors between two equal and parallel planes, fprl, and two
2324 ! equal and orthogonal planes, fnrm, respectively
2327 subroutine fnrm_ints(fnrm_int,wx,wy,wz)
2334 fnrm_int=(1./(3.141592653*wy))*(wy*atan(1./wy)+wx*atan(1./wx)- &
2335 (sqrt(wz)*atan(1./sqrt(wz)))+ &
2336 (1./4.)*(log((1.+wx*wx)*(1.+wy*wy)/(1.+wz))+ &
2337 wy*wy*log(wy*wy*(1.+wz)/(wz*(1.+wy*wy)))+ &
2338 wx*wx*log(wx*wx*(1.+wz)/(wz*(1.+wx*wx)))))
2341 end subroutine fnrm_ints
2343 !====6=8==============================================================72
2344 !====6=8==============================================================72
2345 END MODULE module_sf_bem