Skip to content

Commit bec2729

Browse files
authored
Merge pull request #1034 from olyson/fixbuildenergy
Building energy fix (issue #803).
2 parents 3029203 + 964e05c commit bec2729

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

src/biogeophys/UrbBuildTempOleson2015Mod.F90

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
229229
integer, parameter :: neq = 5 ! number of equation/unknowns
230230
integer :: fc,fl,c,l ! indices
231231
real(r8) :: dtime ! land model time step (s)
232+
real(r8) :: building_hwr(bounds%begl:bounds%endl) ! building height to building width ratio (-)
232233
real(r8) :: t_roof_inner_bef(bounds%begl:bounds%endl) ! roof inside surface temperature at previous time step (K)
233234
real(r8) :: t_sunw_inner_bef(bounds%begl:bounds%endl) ! sunwall inside surface temperature at previous time step (K)
234235
real(r8) :: t_shdw_inner_bef(bounds%begl:bounds%endl) ! shadewall inside surface temperature at previous time step (K)
@@ -341,6 +342,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
341342
! See clm_varcon.F90
342343
! 3. Set inner surface emissivities (Bueno et al. 2012, GMD).
343344
! 4. Set concrete floor properties (Salamanca et al. 2010, TAC).
345+
! 5. Calculate building height to building width ratio
344346
do fl = 1,num_urbanl
345347
l = filter_urbanl(fl)
346348
if (urbpoi(l)) then
@@ -373,13 +375,15 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
373375
cv_floori(l) = (dz_floori(l) * cp_floori(l)) / dtime
374376
! Density of dry air at standard pressure and t_building (kg m-3)
375377
rho_dair(l) = pstd / (rair*t_building_bef(l))
378+
! Building height to building width ratio
379+
building_hwr(l) = canyon_hwr(l)*(1._r8-wtlunit_roof(l))/wtlunit_roof(l)
376380
end if
377381
end do
378382

379383
! Get terms from soil temperature equations to compute conduction flux
380384
! Negative is toward surface - heat added
381385
! Note that the conduction flux here is in W m-2 wall area but for purposes of solving the set of
382-
! simultaneous equations this must be converted to W m-2 ground area. This is done below when
386+
! simultaneous equations this must be converted to W m-2 floor area. This is done below when
383387
! setting up the equation coefficients.
384388

385389
do fc = 1,num_nolakec
@@ -413,14 +417,14 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
413417
l = filter_urbanl(fl)
414418
if (urbpoi(l)) then
415419

416-
vf_rf(l) = sqrt(1._r8 + canyon_hwr(l)**2._r8) - canyon_hwr(l)
420+
vf_rf(l) = sqrt(1._r8 + building_hwr(l)**2._r8) - building_hwr(l)
417421
vf_fr(l) = vf_rf(l)
418422

419423
! This view factor implicitly converts from per unit wall area to per unit floor area
420424
vf_wf(l) = 0.5_r8*(1._r8 - vf_rf(l))
421425

422426
! This view factor implicitly converts from per unit floor area to per unit wall area
423-
vf_fw(l) = vf_wf(l) / canyon_hwr(l)
427+
vf_fw(l) = vf_wf(l) / building_hwr(l)
424428

425429
! This view factor implicitly converts from per unit roof area to per unit wall area
426430
vf_rw(l) = vf_fw(l)
@@ -515,8 +519,8 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
515519
- 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_ww(l) &
516520
- 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l)
517521

518-
a(2,2) = 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) &
519-
+ 0.5_r8*tk_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*canyon_hwr(l) &
522+
a(2,2) = 0.5_r8*hcv_sunwi(l)*building_hwr(l) &
523+
+ 0.5_r8*tk_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*building_hwr(l) &
520524
+ 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8 &
521525
- 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) &
522526
- 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_ww(l) &
@@ -529,11 +533,11 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
529533
a(2,4) = - 4._r8*em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l) &
530534
- 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) &
531535
- 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l)
532-
a(2,5) = - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l)
536+
a(2,5) = - 0.5_r8*hcv_sunwi(l)*building_hwr(l)
533537

534-
result(2) = 0.5_r8*tk_sunw_innerl(l)*t_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*canyon_hwr(l) &
538+
result(2) = 0.5_r8*tk_sunw_innerl(l)*t_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*building_hwr(l) &
535539
- 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner_bef(l)-t_sunw_innerl_bef(l))/(zi_sunw_innerl(l) &
536-
- z_sunw_innerl(l))*canyon_hwr(l) &
540+
- z_sunw_innerl(l))*building_hwr(l) &
537541
- 3._r8*em_sunwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) &
538542
- 3._r8*em_sunwi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l) &
539543
- 3._r8*em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) &
@@ -547,7 +551,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
547551
- 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) &
548552
- 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) &
549553
- 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l) &
550-
- 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l)
554+
- 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*building_hwr(l)
551555

552556
! SHADEWALL
553557
a(3,1) = - 4._r8*em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l) &
@@ -558,8 +562,8 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
558562
- 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) &
559563
- 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l)
560564

561-
a(3,3) = 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) &
562-
+ 0.5_r8*tk_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*canyon_hwr(l) &
565+
a(3,3) = 0.5_r8*hcv_shdwi(l)*building_hwr(l) &
566+
+ 0.5_r8*tk_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*building_hwr(l) &
563567
+ 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8 &
564568
- 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) &
565569
- 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_ww(l) &
@@ -569,11 +573,11 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
569573
- 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) &
570574
- 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l)
571575

572-
a(3,5) = - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l)
576+
a(3,5) = - 0.5_r8*hcv_shdwi(l)*building_hwr(l)
573577

574-
result(3) = 0.5_r8*tk_shdw_innerl(l)*t_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*canyon_hwr(l) &
578+
result(3) = 0.5_r8*tk_shdw_innerl(l)*t_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*building_hwr(l) &
575579
- 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner_bef(l)-t_shdw_innerl_bef(l))/(zi_shdw_innerl(l) &
576-
- z_shdw_innerl(l))*canyon_hwr(l) &
580+
- z_shdw_innerl(l))*building_hwr(l) &
577581
- 3._r8*em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) &
578582
- 3._r8*em_shdwi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l) &
579583
- 3._r8*em_shdwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) &
@@ -587,7 +591,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
587591
- 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) &
588592
- 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) &
589593
- 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l) &
590-
- 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l)
594+
- 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*building_hwr(l)
591595

592596
! FLOOR
593597
a(4,1) = - 4._r8*em_floori(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l) &
@@ -628,24 +632,24 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
628632

629633
! Building air temperature
630634
a(5,1) = - 0.5_r8*hcv_roofi(l)
631-
a(5,2) = - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l)
635+
a(5,2) = - 0.5_r8*hcv_sunwi(l)*building_hwr(l)
632636

633-
a(5,3) = - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l)
637+
a(5,3) = - 0.5_r8*hcv_shdwi(l)*building_hwr(l)
634638

635639
a(5,4) = - 0.5_r8*hcv_floori(l)
636640

637641
a(5,5) = ((ht_roof(l)*rho_dair(l)*cpair)/dtime) + &
638642
((ht_roof(l)*vent_ach)/3600._r8)*rho_dair(l)*cpair + &
639643
0.5_r8*hcv_roofi(l) + &
640-
0.5_r8*hcv_sunwi(l)*canyon_hwr(l) + &
641-
0.5_r8*hcv_shdwi(l)*canyon_hwr(l) + &
644+
0.5_r8*hcv_sunwi(l)*building_hwr(l) + &
645+
0.5_r8*hcv_shdwi(l)*building_hwr(l) + &
642646
0.5_r8*hcv_floori(l)
643647

644648
result(5) = (ht_roof(l)*rho_dair(l)*cpair/dtime)*t_building_bef(l) &
645649
+ ((ht_roof(l)*vent_ach)/3600._r8)*rho_dair(l)*cpair*taf(l) &
646650
+ 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) - t_building_bef(l)) &
647-
+ 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) &
648-
+ 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) &
651+
+ 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*building_hwr(l) &
652+
+ 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*building_hwr(l) &
649653
+ 0.5_r8*hcv_floori(l)*(t_floor_bef(l) - t_building_bef(l))
650654

651655
! Solve equations
@@ -826,7 +830,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
826830
+ em_floori(l)*sb*t_floor_bef(l)**4._r8 &
827831
+ 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*(t_floor(l) - t_floor_bef(l))
828832

829-
qrd_building(l) = qrd_roof(l) + canyon_hwr(l)*(qrd_sunw(l) + qrd_shdw(l)) + qrd_floor(l)
833+
qrd_building(l) = qrd_roof(l) + building_hwr(l)*(qrd_sunw(l) + qrd_shdw(l)) + qrd_floor(l)
830834

831835
if (abs(qrd_building(l)) > .10_r8 ) then
832836
write (iulog,*) 'urban inside building net longwave radiation balance error ',qrd_building(l)
@@ -851,7 +855,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
851855
qcd_sunw(l) = 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner(l) - t_sunw_innerl(l))/(zi_sunw_innerl(l) - z_sunw_innerl(l)) &
852856
+ 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner_bef(l) - t_sunw_innerl_bef(l))/(zi_sunw_innerl(l) &
853857
- z_sunw_innerl(l))
854-
enrgy_bal_sunw(l) = qrd_sunw(l) + qcv_sunw(l)*canyon_hwr(l) + qcd_sunw(l)*canyon_hwr(l)
858+
enrgy_bal_sunw(l) = qrd_sunw(l) + qcv_sunw(l)*building_hwr(l) + qcd_sunw(l)*building_hwr(l)
855859
if (abs(enrgy_bal_sunw(l)) > .10_r8 ) then
856860
write (iulog,*) 'urban inside sunwall energy balance error ',enrgy_bal_sunw(l)
857861
write (iulog,*) 'clm model is stopping'
@@ -863,7 +867,7 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
863867
qcd_shdw(l) = 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner(l) - t_shdw_innerl(l))/(zi_shdw_innerl(l) - z_shdw_innerl(l)) &
864868
+ 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner_bef(l) - t_shdw_innerl_bef(l))/(zi_shdw_innerl(l) &
865869
- z_shdw_innerl(l))
866-
enrgy_bal_shdw(l) = qrd_shdw(l) + qcv_shdw(l)*canyon_hwr(l) + qcd_shdw(l)*canyon_hwr(l)
870+
enrgy_bal_shdw(l) = qrd_shdw(l) + qcv_shdw(l)*building_hwr(l) + qcd_shdw(l)*building_hwr(l)
867871
if (abs(enrgy_bal_shdw(l)) > .10_r8 ) then
868872
write (iulog,*) 'urban inside shadewall energy balance error ',enrgy_bal_shdw(l)
869873
write (iulog,*) 'clm model is stopping'
@@ -884,10 +888,10 @@ subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec,
884888
- ht_roof(l)*(vent_ach/3600._r8)*rho_dair(l)*cpair*(taf(l) - t_building(l)) &
885889
- 0.5_r8*hcv_roofi(l)*(t_roof_inner(l) - t_building(l)) &
886890
- 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) - t_building_bef(l)) &
887-
- 0.5_r8*hcv_sunwi(l)*(t_sunw_inner(l) - t_building(l))*canyon_hwr(l) &
888-
- 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) &
889-
- 0.5_r8*hcv_shdwi(l)*(t_shdw_inner(l) - t_building(l))*canyon_hwr(l) &
890-
- 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) &
891+
- 0.5_r8*hcv_sunwi(l)*(t_sunw_inner(l) - t_building(l))*building_hwr(l) &
892+
- 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*building_hwr(l) &
893+
- 0.5_r8*hcv_shdwi(l)*(t_shdw_inner(l) - t_building(l))*building_hwr(l) &
894+
- 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*building_hwr(l) &
891895
- 0.5_r8*hcv_floori(l)*(t_floor(l) - t_building(l)) &
892896
- 0.5_r8*hcv_floori(l)*(t_floor_bef(l) - t_building_bef(l))
893897
if (abs(enrgy_bal_buildair(l)) > .10_r8 ) then

0 commit comments

Comments
 (0)