SUEWS API Site
Documentation of SUEWS source code
Functions/Subroutines
estm_module Module Reference

Functions/Subroutines

subroutine suews_getestmdata (lunit)
 
subroutine estm_initials
 
subroutine load_gridlayout (gridiv, multiplelayoutfiles, diagnose)
 
subroutine estm_ehc_initialise
 
subroutine estm_ehc_finalise
 
subroutine estm_translate (gridiv)
 
subroutine estm (gridiv, tstep, avkdn, avu1, temp_c, zenith_deg, avrh, press_hpa, ldown, bldgh, ts5mindata_ir, tair_av, dataoutlineestm, qs)
 
elemental real(kind(1d0)) function set_nan (x)
 

Function/Subroutine Documentation

◆ estm()

subroutine estm_module::estm ( integer, intent(in) gridiv,
integer, intent(in) tstep,
real(kind(1d0)), intent(in) avkdn,
real(kind(1d0)), intent(in) avu1,
real(kind(1d0)), intent(in) temp_c,
real(kind(1d0)), intent(in) zenith_deg,
real(kind(1d0)), intent(in) avrh,
real(kind(1d0)), intent(in) press_hpa,
real(kind(1d0)), intent(in) ldown,
real(kind(1d0)), intent(in) bldgh,
real(kind(1d0)), dimension(ncolsestmdata), intent(in) ts5mindata_ir,
real(kind(1d0)), intent(in) tair_av,
real(kind(1d0)), dimension(27), intent(out) dataoutlineestm,
real(kind(1d0)), intent(out) qs )

Definition at line 1667 of file suews_phys_estm.f95.

1674 ! NB: HCW Questions:
1675 ! - should TFloor be set in namelist instead of hard-coded here?
1676 ! - zref used for radiation calculation and fair is set to 2*BldgH here. For compatibility with the rest of the
1677 ! SUEWS model, should this be the (wind speed) measurement height z specified in RunControl.nml?
1678 ! - In SUEWS_translate, fwall=AreaWall/SurfaceArea. Is this correct?
1679 ! - If froof=1 (i.e. whole grid is building), is HW=0 correct?
1680 ! - Then is an IF(Fground ==0) option needed?
1681 ! - alb_wall=0.23 and em_wall=0.9 are set in LUMPS_module_constants. Shouldn't these be provided as input?
1682 ! - Do the LUP calculations here need to be compatible with those in LUMPS_NARP?
1683 ! - File opening rewritten using existing error handling in SUEWS - can delete mod_error module from SUEWS_ESTM_functions
1684 ! - In SUEWS_ESTM_v2016, the first row is set to -999. This may be acceptable at the
1685 ! start of the run but should be handled properly between blocks of met data? - need to check what's actually happening here.
1686 ! - Many duplicate functions in SUEWS_ESTM_functions need changing to the existing SUEWS versions.
1687 ! - Are the following correctly initialised? T0_ibld, T0_ground, T0_wall, T0_roof, TN_wall, TN_roof, Tground, Twall, Troof, Tibld
1688 ! - What are Nalb, sumalb, Nemis and Sumemis for? Are they used correctly?
1689 !
1690
1691 !SUEWS_ESTM_v2016
1692 ! revision:
1693 ! HCW 14 Jun 2016
1694 ! HCW 27 Jun 2016 Corrected iESTMcount bug - now increases for all grids together
1695 ! HCW 30 Jun 2016 Major changes to handle grids and met blocks
1696 ! TS 09 Oct 2017 Added explicit interface
1697
1698 !Contains calculation for each time step
1699 !Calculate local scale heat storage from single building and surroundings observations
1700 !OFferle, May 2003
1701 !
1702 !MODIFICATION HISTORY
1703 ! 15 DECEMBER 2003
1704 ! (1) CHANGED AIR EXCHANGE RATE TO ALSO BE DEPENDENT ON OUTSIDE AIR TEMPERATURE
1705 ! (2) ADDED SPECIFIC HEAT CALCULATION FOR AIR
1706 ! (3) RH ADDED AS VAR(14) IN INPUT FILE
1707 ! 12 JANUARY 2004
1708 ! (1) ADDED ESTIMATED AVG NADIR LOOKING EXTERNAL SURFACE TEMPERATURE TO OUTPUT
1709 ! WEIGHTED BY SURFACE FRACTION AND SVF. SVF_ROOF=1, SVF_WALLS = 1-SVF_ground
1710 ! (2) ADDED NET RADIATION (RN) CALCULATIONS FOR ALL SURFACES AND AVG RN TO OUTPUT BASED ON
1711 ! RADIOMETER VIEW FROM ZREF
1712 ! 14 JANUARY 2004
1713 ! (1) MOVED GRID SPECIFIC PARAMETERS OUT OF NAMELIST, INTO PARAMETER FILE E.G. ALB,EM,F
1714 ! T0 MAKE CHANGES IN LOCATIONS EASIER.
1715 !
1716 ! 23 JANUARY 2004 - Version 2
1717 ! (1) PUT ALL TEMPERATURES INTO K
1718 ! (2) added interpolation routine to run on shorter timesteps.
1719 ! tested so that it doesn't change solution for forced temperatures.
1720 ! however in version 2 the energy balance at the surface isn't correctly solved
1721 !
1722 ! 25 JANUARY 2004 - Version 3
1723 ! (1) added solution to energy balance at surface
1724 ! (2) removed some extraneous code
1725 ! (3) added vegetation fractions for future development
1726 ! (4) some changes to input namelist.
1727 ! (5) need to add wind speed dependence for exchange coefficients
1728 ! (6) changed the way Rn_net is calculated. also radiometer view factor relationships
1729 ! (7) added a calculation for heat loss/gain to outside air (that going into building mass is storage)
1730 ! this is labelled QFBLD which it is in a sense.
1731 ! 6 FEBRUARY 2004
1732 ! (1) ADDED INTERNAL VIEW FACTOR FILE FOR INTERNAL GEOMETRY, INCLUDING FIXED FLOOR TEMPERATURE
1733 ! (2) added MeanU, MinWS to config, and U to ILOC.
1734 !
1735 ! 11 FEBRUARY 2004
1736 ! (1) added site lat, long, elevation to inputs
1737 ! (2) need zenith angle for wall direct radiation interception
1738 !
1739 ! 15 JUNE 2004
1740 ! (1) CORRECTED OUTPUT OF T0 FOR FORCED SURFACE TEMPERATURES
1741 ! (2) MADE SOME CHANGES TO RADIATION, COMPUTATION OF AVERAGE ALBEDO, ADDED AVERAGE EMISSIVITY
1742 ! (3) ADDED OUTPUT FILE FOR RADIATION COMPONENTS
1743 ! (4) CHANGED INPUT CONFIG SO CONVECTIVE EXCHANGE COEFFS ARE NOT USER SELECTABLE
1744 ! (5) MAY STILL BE PROBLEMS WITH WALL RADIATIVE EXCHANGE AND AVERAGE ALBEDO
1745 ! (6) CHANGED THE WAY HEAT STORAGE IS COMPUTED IN HEATCONDUCTION MODULE BUT THIS SHOULD NOT CHANGE RESULTS
1746 !
1747 ! 16 NOVEMBER 2004
1748 ! (1) CHANGED AIR EXCHANGE RATE TO BE BASES ON DAILY TEMPERATURE CHANGES.
1749 ! (2) WRITES OUT FINAL LAYER TEMPERATURES AND INCLUDES OPTION TO READ AT BEGINNING.
1750 !
1751 !DESCRIPTION: uses explicit time differencing to compute heat conduction through roof, walls,
1752 ! internal mass, and grounds (elements). Air heat storage is computed from average air temperature
1753 ! Boundary conditions are determined by measured surface temperature(s) or computed
1754 ! from energy balance at the surface.
1755 ! Internal air temperature can either be fixed or allowed to evolve in response
1756 ! to air mass exchanges and convective heating from internal surfaces.
1757 !
1758 !INPUT:
1759 !FORCING DATA: DTIME,KDOWN,LDOWN,TSURF,TAIR_OUT,TAIR_IN,TROOF,TWALL_AVG,TWALL_N,TWALL_E,TWALL_S,TWALL_W,Tground,RH,U
1760 !NAMELIST : HEATSTORAGE_vFO.NML
1761 ! &config
1762 ! ifile=FORCING DATA
1763 ! ofile=OUTPUT FILE
1764 ! pfile=HEAT STORAGE PARAMETER FILE
1765 ! Nibld = INTERNAL MASS LAYERS
1766 ! Nwall = EXTERNAL WALL LAYERS
1767 ! Nroof = ROOF LAYERS
1768 ! Nground = ground/SOIL LAYERS
1769 ! LBC_soil = LOWER BOUNDARY CONDITION FOR ground/SOIL
1770 ! iloc= INPUT COLUMNS IN DATA FILE
1771 ! evolveTibld= USE DIAGNOSTIC VALUE FOR INTERNAL BUILDING TEMPERATURE
1772 ! 0: don't use, use measured
1773 ! 1: TURN ON USE when temp goess ABOVE TINT_ON, off when temp is below TINT_OFF
1774 ! 2: always use diagnostic
1775 ! THEAT_ON= TEMPERATURE AT WHICH HEAT CONTROL IS TURNED ON
1776 ! THEAT_OFF= TEMPERATURE AT WHICH HEAT CONTROL IS TURNED OFF
1777 ! THEAT_FIX = Fixed internal temperature for climate control
1778 ! oneTsurf= USE SINGLE SURFACE TEMPERATURE TO DRIVE ALL LAYERS
1779 ! radforce= USE RADIATIVE ENERGY BALANCE TO DRIVE EXTERNAL TEMPERATURES
1780 ! maxtimestep=302, maximum time step in s for filling data gaps.
1781 ! Alt = STATION HEIGHT (m) FOR PRESSURE CALCULATION
1782 ! SPINUP = NUMBER OF LINES TO USE FOR SPINUP (REPEATS THESE LINES BUT ONLY OUTPUTS THE 2ND TIME)
1783 ! INITTEMP = if TRUE INITIALIZES TEMPERATURES TO THOSE IN FINALTEMP.TXT FILE
1784 ! CH_ibld = INTERNAL BUILDING CONVECTIVE EXCHANGE COEFFICIENT
1785 ! **** THESE SHOULD DEPEND ON WIND SPEED BUT CURRENTLY DO NOT ****
1786 ! CHAIR = CONVECTIVE EXCHANGE COEFFICIENT FOR ROOF
1787 ! chair_ground = ... FOR ground
1788 ! chair_wall = ... FOR WALL
1789 ! /
1790 ! ***************** PARAMETER FILE VARIABLES
1791 ! fveg = FRACTION OF ground SURFACE COVERED WITH VEG
1792 ! zveg = VEGETATION HEIGHT
1793 ! alb_veg = VEGETATION ALBEDO
1794 ! em_veg = VEGETATION EMISSIVITY
1795 ! ZREF = REFERENCE HEIGHT FOR FLUX CALCULATION
1796 ! BldgH = mean building height
1797 ! HW = CANYON ASPECT RATION
1798 ! f_X = FRACTION OF X WHERE X IS INTERNAL, WALL, ROOF, ground
1799 ! Alb_x = ALBEDO OF X
1800 ! em_ibld = EMISSIVITY OF X
1801 ! TX = INITIAL LAYER TEMPERATURES
1802 ! zX = LAYER THICKNESS
1803 ! kX = LAYER THERMAL CONDUCTIVITY
1804 ! ribld = LAYER VOLUMETRIC HEAT CAPACITY
1805 !
1806 !****************** INTERNAL VIEW FACTOR FILE
1807 !OUTPUT: fixed format text with single header, heatstorage for all elements, and temperatures
1808 ! for each element-layer.
1809 !===============================================================================
1810
1811 USE meteo, ONLY: pi, heatcapacity_air
1812 USE mod_solver, ONLY: newtonpolynomial
1813 ! USE modSolarCalc !!FO!! :modsolarcalc.f95
1814 ! USE MathConstants !!FO!! :MathConstants_module.f95
1815 USE physconstants, ONLY: c2k, sbconst
1816 USE heatflux, ONLY: heatcond1d
1817 USE estm_data
1818
1819 IMPLICIT NONE
1820 INTEGER, PARAMETER :: ncolsESTMdata = 13
1821 ! INTEGER, PARAMETER:: ncolumnsDataOutESTM=32
1822 INTEGER, PARAMETER :: cTs_Tiair = 5
1823 INTEGER, PARAMETER :: cTs_Tsurf = 6
1824 INTEGER, PARAMETER :: cTs_Troof = 7
1825 INTEGER, PARAMETER :: cTs_Troad = 8
1826 INTEGER, PARAMETER :: cTs_Twall = 9
1827 INTEGER, PARAMETER :: cTs_Twall_n = 10
1828 INTEGER, PARAMETER :: cTs_Twall_e = 11
1829 INTEGER, PARAMETER :: cTs_Twall_s = 12
1830 INTEGER, PARAMETER :: cTs_Twall_w = 13
1831 REAL(KIND(1D0)), PARAMETER :: NAN = -999
1832
1833 INTEGER, INTENT(in) :: Gridiv
1834 INTEGER, INTENT(in) :: tstep
1835 ! INTEGER,INTENT(in)::iy !Year
1836 ! INTEGER,INTENT(in)::id !Day of year
1837 ! INTEGER,INTENT(in)::it !Hour
1838 ! INTEGER,INTENT(in)::imin !Minutes
1839
1840 REAL(KIND(1D0)), INTENT(in) :: avkdn
1841 REAL(KIND(1D0)), INTENT(in) :: avu1
1842 REAL(KIND(1D0)), INTENT(in) :: temp_c
1843 REAL(KIND(1D0)), INTENT(in) :: zenith_deg
1844 REAL(KIND(1D0)), INTENT(in) :: avrh
1845 REAL(KIND(1D0)), INTENT(in) :: press_hpa
1846 REAL(KIND(1D0)), INTENT(in) :: ldown
1847 REAL(KIND(1D0)), INTENT(in) :: bldgh
1848 ! REAL(KIND(1d0)),INTENT(in):: dectime !Decimal time
1849 REAL(KIND(1D0)), DIMENSION(ncolsESTMdata), INTENT(in) :: Ts5mindata_ir !surface temperature input data
1850 REAL(KIND(1D0)), INTENT(in) :: Tair_av ! mean air temperature of past 24hr
1851
1852 REAL(KIND(1D0)), DIMENSION(27), INTENT(out) :: dataOutLineESTM
1853 !Output to SUEWS
1854 REAL(KIND(1D0)), INTENT(out) :: QS
1855 !Input from SUEWS, corrected as Gridiv by TS 09 Jun 2016
1856
1857 !Use only in this subroutine
1858 INTEGER :: i, ii
1859 INTEGER :: Tair2Set = 0
1860 REAL(KIND(1D0)) :: AIREXHR, AIREXDT
1861 REAL(KIND(1D0)), DIMENSION(2) :: bc
1862 REAL(KIND(1D0)) :: chair_ground, chair_wall
1863 REAL(KIND(1D0)) :: EM_EQUIV
1864 REAL(KIND(1D0)) :: kdz
1865 REAL(KIND(1D0)) :: kup_estm, LUP_net, kdn_estm
1866 REAL(KIND(1D0)) :: QHestm
1867 REAL(KIND(1D0)) :: QFBld !Anthropogenic heat from HVAC
1868 REAL(KIND(1D0)) :: shc_airbld
1869 REAL(KIND(1D0)) :: sw_hor, sw_vert
1870 REAL(KIND(1D0)) :: T0
1871 REAL(KIND(1D0)) :: Tinternal, Tsurf_all, Troof_in, Troad, Twall_all, Tw_n, Tw_e, Tw_s, Tw_w
1872 REAL(KIND(1D0)) :: Twallout(5), Troofout(5), Tibldout(5), Tgroundout(5)
1873 REAL(KIND(1D0)) :: Tadd, Tveg
1874 REAL(KIND(1D0)) :: Tairmix
1875 REAL(KIND(1D0)) :: RN
1876 REAL(KIND(1D0)) :: Rs_roof, Rl_roof, RN_ROOF
1877 REAL(KIND(1D0)) :: Rs_wall, Rl_wall, RN_WALL
1878 REAL(KIND(1D0)) :: Rs_ground, Rl_ground, RN_ground
1879 REAL(KIND(1D0)) :: Rs_ibld, Rl_ibld
1880 REAL(KIND(1D0)) :: Rs_iroof, Rl_iroof
1881 REAL(KIND(1D0)) :: Rs_iwall, Rl_iwall
1882 REAL(KIND(1D0)) :: zenith_rad
1883 REAL(KIND(1D0)) :: dum(50)
1884 REAL(KIND(1D0)) :: bldgHX ! local bldgHX=max(bldgH,0.001)
1885 REAL(KIND(1D0)), PARAMETER :: WSmin = 0.1 ! Check why there is this condition. S.O.
1886 LOGICAL :: radforce, groundradforce
1887
1888 radforce = .false.
1889 groundradforce = .false. !Close the radiation scheme in original ESTM S.O.O.
1890
1891 bldghx = max(bldgh, 0.001) ! this is to prevent zero building height
1892
1893 ! Set -999s for first row
1894 ! dum=(/-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,&
1895 ! -999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,&
1896 ! -999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,&
1897 ! -999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,&
1898 ! -999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999.,-999./)
1899 dum = [(-999, i=1, 50)]
1900
1901 !External bulk exchange coefficients - set these somewhere more sensible***
1902 chr = 0.005
1903 chair = chr
1904 chair_ground = chair
1905 chair_wall = chair
1906
1907 !Get met data for use in ESTM subroutine
1908 kdn_estm = avkdn
1909 ws = avu1
1910 IF (ws < wsmin) ws = wsmin
1911 tair1 = temp_c + c2k
1912 ! Set initial value of Tair2 to air temp
1913 IF (gridiv == 1) tair2set = tair2set + 1
1914 IF (tair2set == 1) THEN
1915 tair2 = temp_c + c2k
1916 ELSE
1917 tair2 = tair2_grids(gridiv)
1918 ! Also get other variables for this grid
1919 tievolve = tievolve_grids(gridiv)
1921 lup_wall = lup_wall_grids(gridiv)
1922 lup_roof = lup_roof_grids(gridiv)
1923 t0_ibld = t0_ibld_grids(gridiv)
1924 t0_ground = t0_ground_grids(gridiv)
1925 t0_wall = t0_wall_grids(gridiv)
1926 t0_roof = t0_roof_grids(gridiv)
1927 tn_wall = tn_wall_grids(gridiv)
1928 tn_roof = tn_roof_grids(gridiv)
1929 tground(:) = tground_grids(:, gridiv)
1930 twall(:) = twall_grids(:, gridiv)
1931 troof(:) = troof_grids(:, gridiv)
1932 tibld(:) = tibld_grids(:, gridiv)
1933 tw_4 = tw_4_grids(:, :, gridiv)
1934
1935 END IF
1936
1937 ! Get Ts from Ts5min data array
1938 ! Tinternal = Ts5mindata(ir,cTs_Tiair)
1939 ! Tsurf_all = Ts5mindata(ir,cTs_Tsurf)
1940 ! Troof_in = Ts5mindata(ir,cTs_Troof)
1941 ! Troad = Ts5mindata(ir,cTs_Troad)
1942 ! Twall_all = Ts5mindata(ir,cTs_Twall)
1943 !
1944 ! Tw_n = Ts5mindata(ir,cTs_Twall_n)
1945 ! Tw_e = Ts5mindata(ir,cTs_Twall_e)
1946 ! Tw_s = Ts5mindata(ir,cTs_Twall_s)
1947 ! Tw_w = Ts5mindata(ir,cTs_Twall_w)
1948 tinternal = ts5mindata_ir(cts_tiair)
1949 tsurf_all = ts5mindata_ir(cts_tsurf)
1950 troof_in = ts5mindata_ir(cts_troof)
1951 troad = ts5mindata_ir(cts_troad)
1952 twall_all = ts5mindata_ir(cts_twall)
1953
1954 tw_n = ts5mindata_ir(cts_twall_n)
1955 tw_e = ts5mindata_ir(cts_twall_e)
1956 tw_s = ts5mindata_ir(cts_twall_s)
1957 tw_w = ts5mindata_ir(cts_twall_w)
1958
1959 ! if (any(isnan(Ts5mindata))) then !!FO!! can't use data when time gap is too big (or neg.) or data is NaN
1960 ! if (spindone) then !!FO!! writes a line of NaNs
1961 ! write(20,'(1F8.4,I6,100f10.1)') dectime,it,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,&
1962 ! -0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,&
1963 ! -0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,&
1964 ! -0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.,-0./0.
1965 ! endif
1966 ! return ! changed from cycle !!FO!! returns to beginning of do-loop, i.e. doesn't make any heat calculations
1967 ! endif
1968 !!FO!! this loop is used to run through the calculations (SPINUP number of times) to achieve better numerical stability
1969 !!FO!! when if condition is met the program starts over from the beginning of the input file and the calculations are performed
1970 !!FO!! ...once again, but this time saved to the output file
1971 !!FO!! it's because of this if statement arrangement that the output result starts at input time #2 (if not SPINUP=0 as originally in heatstorage_vFO.nml)
1972 ! IF (NLINESREAD>datalines.AND..NOT.SPINDONE) THEN !!FO!! at this stage spindone = .false.
1973 ! NLINESREAD=0
1974 ! SPINDONE=.TRUE.
1975 !PRINT*, "SPUNUP"
1976 ! return ! changed from cycle
1977 ! ENDIF
1978
1979 !! Write first row of each met block as -999
1980 !IF (first) THEN !Set to true in ESTM_initials
1981 !! !Tair2=Temp_C+C2K !This is now set in SUEWS_translate for ir=0 only
1982 !! ! first=.FALSE.
1983 ! IF(Gridiv == NumberOfGrids) first=.FALSE. !Set to false only after all grids have run
1984 ! dataOutESTM(ir,1:32,Gridiv)=(/REAL(iy,KIND(1D0)),REAL(id,KIND(1D0)),&
1985 ! REAL(it,KIND(1D0)),REAL(imin,KIND(1D0)),dectime,(dum(ii),ii=1,27)/)
1986 ! RETURN
1987 !ENDIF
1988
1989 ! What are these constants? - Need defining somewhere
1990 zenith_rad = zenith_deg/180*pi
1991 IF (zenith_rad > 0 .AND. zenith_rad < pi/2.-hw) THEN !ZENITH MUST BE HIGHER THAN BUILDINGS FOR DIRECT INTERCEPTION
1992 tanzenith = min(tan(zenith_rad), 5.67) !LIMITS TO ANGLES LESS THAN 80 EVEN FOR LOW HW
1993 tanzenith = tanzenith*kdn_estm/(1370*cos(zenith_rad)) !REDUCTION FACTOR FOR MAXIMUM
1994 ELSE
1995 tanzenith = 0.
1996 END IF
1997
1998 shc_air = heatcapacity_air(tair1, avrh, press_hpa) ! Use SUEWS version
1999
2000 !Evolution of building temperature from heat added by convection
2001 SELECT CASE (evolvetibld) !EvolveTiBld specifies which internal building temperature approach to use
2002 CASE (0)
2003 diagnoseti = .false.
2004 hvac = .false. !use data in file !!FO!! use measured indoor temperature (Tref in Lodz2002HS.txt)
2005 CASE (1) !!FO!! use of HVAC to counteract T changes
2006 diagnoseti = .true.
2007 IF (tievolve > theat_off) THEN !THEAT_OFF now converted to Kelvin in ESTM_initials - HCW 15 Jun 2016
2008 !IF (Tievolve>THEAT_OFF+C2K) THEN
2009 hvac = .false.
2010 ELSEIF (tievolve < theat_on) THEN !THEAT_OFF now converted to Kelvin in ESTM_initials - HCW 15 Jun 2016
2011 !ELSEIF (Tievolve<THEAT_ON+C2K) THEN
2012 hvac = .true.
2013 END IF
2014 CASE (2)
2015 diagnoseti = .true. !!FO!! convection between ibld and inside of external walls(?)
2016 END SELECT
2017
2018 !ASSUME AIR MIXES IN PROPORTION TO # OF EXCHANGES
2019 IF (tair_av > 20.+c2k .AND. tievolve > 25.+c2k .AND. tair1 < tievolve .AND. .NOT. hvac) THEN
2020 airexhr = 2.0 !Windows or exterior doors on 3 sides (ASHRAE 1981 22.8)
2021 ELSEIF (tair_av < 17.+c2k .OR. hvac) THEN
2022 airexhr = 0.5 !No window or exterior doors, storm sash or weathertripped (ASHRAE 1981 22.8)
2023 ELSE
2024 airexhr = 1.0
2025 END IF
2026
2027 airexdt = airexhr*(tstep/3600.0)
2028 shc_airbld = max(heatcapacity_air(tievolve, avrh, press_hpa), 0.00001) ! to avoid zero-division scenario TS 21 Oct 2017
2029 IF (shc_airbld < minshc_airbld) minshc_airbld = shc_airbld
2030
2031 !internal convective exchange coefficients !!FO!! ibldCHmod = 0 originally
2032 !iBldCHmod specifies method for convective exchange coeffs
2033 IF (ibldchmod == 1) THEN !ASHRAE 2001
2034 ch_ibld = 1.31*(abs(t0_ibld - tievolve))**0.25/shc_airbld
2035 ch_iwall = 1.31*(abs(tn_wall - tievolve))**0.25/shc_airbld
2036 ch_iroof = 1.52*(abs(tn_roof - tievolve))**0.25/shc_airbld
2037 IF (abs(tn_roof - tievolve) > 0) ch_iroof = ch_iroof*0.39 !effect of convection is weaker downward
2038 ELSEIF (ibldchmod == 2) THEN !Awbi, H.B. 1998, Energy and Buildings 28: 219-227
2039 ch_ibld = 1.823*(abs(t0_ibld - tievolve))**0.293/shc_airbld
2040 ch_iwall = 1.823*(abs(tn_wall - tievolve))**0.293/shc_airbld
2041 ch_iroof = 2.175*(abs(tn_roof - tievolve))**0.308/shc_airbld
2042 IF (abs(tn_roof - tievolve) > 0) ch_iroof = 0.704*(abs(tn_roof - tievolve))**0.133/shc_airbld !effect of convection is weaker downward
2043 END IF
2044
2045 !Evolving T = (Previous Temp + dT from Sensible heat flux) mixed with outside air
2046 !ASSUMES THE CH_BLD INCLUDES THE EFFECT OF VENTILATION RATE IN m/s (e.g. if a normal CH is .005 and
2047 !the value here is .003 the assumed ventilation is 0.6 m/s !!FO!! CH_ibld=0.0015 from heatstorage_Barbican.nml => ventilation=0.3 m/s
2048 tairmix = (tievolve + tair1*airexdt)/(1.0 + airexdt)
2049 qfbld = froof*(tievolve - tairmix)*shc_airbld*bldghx/tstep !heat added or lost, requires cooling or heating if HVAC on
2050
2051 !!FO!! CH_xxxx has unit [m/s] !!**HCW what is going on with tstep here??
2052 tievolve = tairmix + tstep/bldghx/finternal & !!FO!! finternal(=froof+fibld+fwall) => normalisation of fractions
2055 + ch_iwall*fwall*(tn_wall - tievolve)) !!FO!! [K] = [K] + [s/m]*([m/s]*([K]))
2056
2057 IF (.NOT. diagnoseti) tievolve = tinternal + c2k
2058 IF (hvac) THEN !Run up/down to set point +/- 1 degree with adjustment of 90% per hour
2059 tadd = (sign(-1.0d0, theat_fix - tievolve) + theat_fix - tievolve)*min(4.*tstep/3600.0, 0.9) !!**HCW check??
2060 tievolve = tievolve + tadd
2061 END IF
2062
2063 !========>RADIATION<================
2064 IF (kdn_estm < 0) kdn_estm = 0. !set non-zero shortwave to zero !Should this be moved up to line 183/4?
2065
2066 !external components, no diffuse
2067 !for reflections complete absorption is assumed
2068 !for shortwave these are net values
2069 !for longwave these are incoming only
2070 !MUST DIVIDE SHORTWAVE INTO DIRECT AND DIFFUSE
2071 sw_hor = kdn_estm !incoming solar on horizontal surface
2072 sw_vert = kdn_estm*tanzenith !incoming solar on vertical surface = kdown(obs)*sin(zenith)/cos(zenith)
2073
2074 rs_roof = svf_roof*(1.0 - alb_roof_estm)*sw_hor
2075 rl_roof = svf_roof*em_roof_estm*ldown
2076
2077 rs_ground = svf_ground*(1.-alb_ground_estm)*sw_hor + &
2080
2082
2083 rs_wall = svf_wall*(1.-alb_wall_fix)*sw_vert + &
2087
2088 !wall to wall exchange handled simultaneously with seb calc
2089 rl_wall = svf_wall*ldown*em_wall_fix + zvf_wall*svf_wall*ldown*(1 - em_wall_fix)*em_wall_fix + &
2091
2092 !DIFFICULT TO DETERMINE WHAT THIS IS EXACTLY, DONT INCLUDE WALLS
2093 kup_estm = kdn_estm - rvf_roof*rs_roof - (rvf_ground + rvf_wall)*rs_ground/svf_ground - rvf_veg*alb_veg_estm*kdn_estm
2094 IF (kdn_estm > 10 .AND. kup_estm > 0) THEN
2095 alb_avg = kup_estm/kdn_estm
2097 nalb = nalb + 1
2098 END IF
2099
2100 !internal components
2101 rs_ibld = 0 ! This could change if there are windows (need solar angles or wall svf * fraction glazing * transmissivity)
2102 !internal incoming longwave terms do not include the view factors for its own surface e.g. for ibld and walls
2103 !added floor view factors
2104 rl_ibld = sbconst*(ivf_iw*em_w*tn_wall**4 + &
2105 ivf_ir*em_r*tn_roof**4 + &
2106 ivf_if*em_f*tfloor**4)
2107 rs_iwall = 0
2108 rl_iwall = sbconst*(ivf_wi*em_i*t0_ibld**4 + &
2109 ivf_wr*em_r*tn_roof**4 + &
2110 ivf_wf*em_f*tfloor**4)
2111 rs_iroof = 0
2112 rl_iroof = sbconst*(ivf_ri*em_i*t0_ibld**4 + &
2113 ivf_rw*em_w*tn_wall**4 + &
2114 ivf_rf*em_f*tfloor**4)
2115
2116 !========>INTERNAL<================
2117 bctype = .false.
2118 kdz = 2*kibld(1)/zibld(1)
2119 pcoeff = (/em_ibld*sbconst*(1 - ivf_ii*em_ibld), 0.0d0, 0.0d0, kdz + shc_airbld*ch_ibld, &
2120 -kdz*tibld(1) - shc_airbld*ch_ibld*tievolve - rs_ibld - rl_ibld/)
2122
2123 !!FO!! this leads to Tibld(1) = Tibld(3) , i.e. ...
2124 bc(1) = t0_ibld
2125
2126 !!FO!! temperature equal on both sides of inside wall
2127 bc(2) = bc(1)
2128
2129 ! print*,'ESTM Qsibld cal before',Qsibld,Tibld,zibld(1:Nibld)
2131 REAL(Tstep, KIND(1D0)), kibld(1:Ndepth_ibld), &
2132 ribld(1:ndepth_ibld), bc, bctype)
2133
2134 ! print*,'ESTM Qsibld cal after',Qsibld,Tibld
2135
2136 !========>WALLS<================
2137 bctype = .false.
2139 pcoeff = (/em_ibld*sbconst*(1 - ivf_ww*em_ibld), 0.0d0, 0.0d0, kdz + shc_airbld*ch_iwall, &
2140 -kdz*twall(ndepth_wall) - shc_airbld*ch_iwall*tievolve - rs_iwall - rl_iwall/)
2142 bc(2) = tn_wall !!FO!! boundary condition #2 = inner surface Twall, originally from lodz_parms_ltm.txt or finaltemp.txt
2143
2144 IF (tsurfchoice < 2 .OR. radforce) THEN
2145 IF (radforce) THEN !!FO!! 1st prio: radforce
2146 kdz = 2*kwall(1)/zwall(1)
2147 pcoeff = (/em_wall_fix*sbconst*(1 - zvf_wall*em_wall_fix), 0.0d0, 0.0d0, kdz + shc_air*chair_wall*ws, &
2148 -kdz*twall(1) - shc_air*chair_wall*ws*tair1 - rs_wall - rl_wall/)
2150 bc(1) = t0_wall !!FO!! boundary condition #1 = outer surface Twall, originally from lodz_parms_ltm.txt or finaltemp.txt
2151 ELSEIF (tsurfchoice == 0) THEN
2152 bc(1) = tsurf_all + c2k; t0_wall = bc(1)
2153 ELSEIF (tsurfchoice == 1) THEN
2154 bc(1) = twall_all + c2k; t0_wall = bc(1)
2155 END IF !!FO!! Tsoil in Lodz2002HS.txt NB => Lodz2002HS.txt doesn't work with onewall = TRUE
2156
2157 CALL heatcond1d(twall, qswall, zwall(1:ndepth_wall), real(tstep, kind(1d0)), &
2158 kwall(1:ndepth_wall), rwall(1:ndepth_wall), bc, bctype) !!FO!! new set of Twalls are calculated from heat conduction through wall
2159
2160 ELSEIF (tsurfchoice == 2) THEN !SPECIAL FOR 4 WALLS
2161 t0_wall = 0.
2162 DO i = 1, 4 !do 4 walls
2163 bc(1) = tw_n + tw_e + tw_s + tw_w + c2k; t0_wall = t0_wall + bc(1)
2164 CALL heatcond1d(tw_4(:, i), qs_4(i), zwall(1:ndepth_wall), real(tstep, kind(1d0)), &
2166 END DO
2167 !Take average of 4 wall values
2168 t0_wall = t0_wall/4.
2169 qswall = sum(qs_4)/4.
2170 twall = sum(tw_4, 2)/4.
2171 END IF
2172
2173 !========>ROOF<================
2174 bctype = .false.
2176 pcoeff = (/em_ibld*sbconst, 0.0d0, 0.0d0, kdz + shc_airbld*ch_iroof, &
2177 -kdz*troof(ndepth_roof) - shc_airbld*ch_iroof*tievolve - rs_iroof - rl_iroof/)
2179 bc(2) = tn_roof
2180
2181 IF (radforce) THEN
2182 kdz = 2*kroof(1)/zroof(1)
2183 pcoeff = (/em_roof_estm*sbconst, 0.0d0, 0.0d0, kdz + shc_air*chair*ws, &
2184 -kdz*troof(1) - shc_air*chair*ws*tair1 - rs_roof - rl_roof/)
2186 bc(1) = t0_roof
2187 ELSEIF (tsurfchoice == 0) THEN
2188 bc(1) = tsurf_all + c2k; t0_roof = bc(1)
2189 ELSE
2190 bc(1) = troof_in + c2k; t0_roof = bc(1)
2191 END IF
2192
2193 CALL heatcond1d(troof, qsroof, zroof(1:ndepth_roof), real(tstep, kind(1d0)), &
2195
2196 !========>ground<================
2197 bctype = .false.
2198 kdz = 2*kground(1)/zground(1)
2199
2200 IF (radforce .OR. groundradforce) THEN
2201 pcoeff = (/em_ground_estm*sbconst, 0.0d0, 0.0d0, kdz + shc_air*chair_ground*ws, &
2202 -kdz*tground(1) - shc_air*chair_ground*ws*tair1 - rs_ground - rl_ground/)
2204 bc(1) = t0_ground
2205 ELSEIF (tsurfchoice == 0) THEN
2206 bc(1) = tsurf_all + c2k; t0_ground = bc(1)
2207 ELSE
2208 bc(1) = troad + c2k; t0_ground = bc(1)
2209 END IF
2210
2211 bc(2) = lbc_soil + c2k
2212 ! bc(2)=0.; bctype(2)=.t.
2213
2214 IF (fground /= 0.) THEN ! check fground==0 scenario to avoid division-by-zero error, TS 21 Jul 2016
2216 REAL(Tstep, KIND(1D0)), kground(1:Ndepth_ground), rground(1:Ndepth_ground), bc, bctype)
2217 ELSE
2218 qsground = nan
2219 END IF
2220
2221 qsair = fair*shc_air*(tair1 - tair2)/tstep
2226 qs = qsibld + qswall + qsroof + qsground !!FO!! QSair not included; called QS in output file (column #10)
2227
2228 ! print*,'ESTM QS',qs,Qsibld,Qswall,Qsroof ,Qsground
2229 ! print*,'ESTM Qsibld',Qsibld,fibld
2230 !write(*,*) Qsair, QSibld, Qswall, Qsroof, Qsground, QS
2231
2232 !========>Radiation<================
2233 !note that the LUP for individual components does not include reflected
2237 tveg = tair1
2238 lup_veg = sbconst*em_veg_estm*tveg**4
2241 em_equiv = lup_net/(sbconst*t0**4) !!FO!! apparent emissivity of the atmosphere [cloudless sky: >� Ldown from gases in the lowest 100 m] calculated from surface at T0
2242 rn_ground = rs_ground + rl_ground - lup_ground
2243 rn_roof = rs_roof + rl_roof - lup_roof
2244 rn_wall = rs_wall + rl_wall - lup_wall*(1 - zvf_wall*em_wall_fix)
2245 rn = kdn_estm - kup_estm + ldown*em_equiv - lup_net !!FO!! average net radiation (at z > zref ????) = shortwave down - shortwave up + [longwave down * apparent emissivity] - longwave up
2246 qhestm = (t0 - tair1)*chair*shc_air*ws
2247 sumemis = sumemis + em_equiv
2248 nemis = nemis + 1
2249
2250 ! IF (SPINDONE) THEN !!FO!! only the last set of values in the time interpolation loop is written to file
2251
2252 IF (ndepth_wall < 5) THEN
2253 twallout = (/twall, (dum(ii), ii=1, (5 - ndepth_wall))/)
2254 ELSE
2255 twallout = twall
2256 END IF
2257
2258 IF (ndepth_roof < 5) THEN
2259 troofout = (/troof, (dum(ii), ii=1, (5 - ndepth_roof))/)
2260 ELSE
2261 troofout = troof
2262 END IF
2263
2264 IF (ndepth_ground < 5) THEN
2265 tgroundout = (/tground, (dum(ii), ii=1, (5 - ndepth_ground))/)
2266 ELSE
2267 tgroundout = tground
2268 END IF
2269
2270 IF (ndepth_ibld < 5) THEN
2271 tibldout = (/tibld, (dum(ii), ii=1, (5 - ndepth_ibld))/)
2272 ELSE
2273 tibldout = tibld
2274 END IF
2275
2276 ! dataOutESTM(ir,1:ncolumnsDataOutESTM,Gridiv)=[&
2277 ! REAL(iy,KIND(1D0)),REAL(id,KIND(1D0)),REAL(it,KIND(1D0)),REAL(imin,KIND(1D0)), dectime,&!5
2278 ! QS,Qsair,Qswall,Qsroof,Qsground,Qsibld,&!11
2279 ! Twallout,Troofout,Tgroundout,Tibldout,Tievolve]!32 !NB. These all have 5 elements except Tievolve (1).
2280 dataoutlineestm = [ &
2281 qs, qsair, qswall, qsroof, qsground, qsibld, & !6
2282 twallout, troofout, tgroundout, tibldout, tievolve] !27 !NB. These all have 5 elements except Tievolve (1).
2283 ! set invalid values to nan
2284 dataoutlineestm = set_nan(dataoutlineestm)
2285 ! call r8vec_print(ncolumnsDataOutESTM-5,dataOutESTM(ir,6:ncolumnsDataOutESTM,Gridiv),'dataOutESTM')
2286
2287 tair2 = tair1
2288
2289 ! Save variables for this grid
2290 tair2_grids(gridiv) = tair1
2292 lup_wall_grids(gridiv) = lup_wall
2293 lup_roof_grids(gridiv) = lup_roof
2294 tievolve_grids(gridiv) = tievolve
2295 t0_ibld_grids(gridiv) = t0_ibld
2296 t0_ground_grids(gridiv) = t0_ground
2297 t0_wall_grids(gridiv) = t0_wall
2298 t0_roof_grids(gridiv) = t0_roof
2299 tn_wall_grids(gridiv) = tn_wall
2300 tn_roof_grids(gridiv) = tn_roof
2301 tground_grids(:, gridiv) = tground(:)
2302 twall_grids(:, gridiv) = twall(:)
2303 troof_grids(:, gridiv) = troof(:)
2304 tibld_grids(:, gridiv) = tibld(:)
2305 tw_4_grids(:, :, gridiv) = tw_4(:, :)
2306
integer tsurfchoice
real(kind(1d0)), dimension(:), allocatable lup_roof_grids
real(kind(1d0)) em_r
real(kind(1d0)) lbc_soil
real(kind(1d0)) theat_fix
real(kind(1d0)), dimension(:), allocatable t0_wall_grids
real(kind(1d0)), dimension(5) zground
real(kind(1d0)) em_roof_estm
real(kind(1d0)) ivf_ii
real(kind(1d0)) ivf_wf
integer ndepth_roof
real(kind(1d0)), dimension(:), allocatable t0_ground_grids
real(kind(1d0)) ivf_ri
real(kind(1d0)) froof
real(kind(1d0)) theat_off
real(kind(1d0)) lup_ground
real(kind(1d0)) t0_ground
real(kind(1d0)), dimension(:), allocatable tground
real(kind(1d0)) ivf_rf
real(kind(1d0)) rvf_roof
real(kind(1d0)) fair
real(kind(1d0)) zvf_ground
real(kind(1d0)) t0_ibld
real(kind(1d0)) ch_iwall
integer ndepth_ibld
real(kind(1d0)) minshc_airbld
real(kind(1d0)), dimension(5) kwall
real(kind(1d0)) alb_ground_estm
real(kind(1d0)) tair1
real(kind(1d0)), dimension(:), allocatable twall
real(kind(1d0)) chr
real(kind(1d0)), dimension(5) kroof
real(kind(1d0)), dimension(5) kground
real(kind(1d0)) t0_roof
real(kind(1d0)) tn_roof
real(kind(1d0)) lup_roof
real(kind(1d0)) alb_veg_estm
integer ndepth_wall
real(kind(1d0)) tn_wall
real(kind(1d0)), dimension(:), allocatable tn_wall_grids
real(kind(1d0)) em_w
real(kind(1d0)), dimension(5) zibld
real(kind(1d0)), dimension(:), allocatable troof
real(kind(1d0)) tievolve
real(kind(1d0)) zvf_wall
real(kind(1d0)), dimension(4) qs_4
real(kind(1d0)) tanzenith
real(kind(1d0)), dimension(:), allocatable t0_ibld_grids
real(kind(1d0)), dimension(:), allocatable tair2_grids
real(kind(1d0)), dimension(5) rwall
real(kind(1d0)), dimension(:), allocatable t0_roof_grids
real(kind(1d0)) shc_air
real(kind(1d0)) fibld
real(kind(1d0)), dimension(:, :), allocatable tw_4
real(kind(1d0)), dimension(5) pcoeff
real(kind(1d0)) fwall
real(kind(1d0)) alb_roof_estm
real(kind(1d0)) em_i
real(kind(1d0)) qsibld
real(kind(1d0)) rvf_ground
real(kind(1d0)) lup_veg
real(kind(1d0)), dimension(:, :, :), allocatable tw_4_grids
real(kind(1d0)) lup_wall
real(kind(1d0)), dimension(:), allocatable lup_ground_grids
real(kind(1d0)) ch_ibld
real(kind(1d0)) fground
real(kind(1d0)) ivf_wi
real(kind(1d0)), dimension(:, :), allocatable twall_grids
real(kind(1d0)) qsroof
real(kind(1d0)) ivf_if
real(kind(1d0)) chair
real(kind(1d0)) tfloor
real(kind(1d0)) em_ibld
real(kind(1d0)) ch_iroof
real(kind(1d0)), dimension(5) rroof
real(kind(1d0)), dimension(:), allocatable lup_wall_grids
real(kind(1d0)) ivf_ww
real(kind(1d0)) qswall
real(kind(1d0)) qsground
real(kind(1d0)) finternal
real(kind(1d0)) ivf_ir
real(kind(1d0)) sumemis
real(kind(1d0)) rvf_veg
real(kind(1d0)) em_f
real(kind(1d0)) tair2
real(kind(1d0)) svf_wall
real(kind(1d0)), dimension(:), allocatable tibld
integer ibldchmod
real(kind(1d0)) ivf_iw
real(kind(1d0)), dimension(:), allocatable tn_roof_grids
integer evolvetibld
real(kind(1d0)) ivf_rw
real(kind(1d0)), parameter alb_wall_fix
real(kind(1d0)), dimension(5) kibld
real(kind(1d0)) em_veg_estm
integer ndepth_ground
real(kind(1d0)) em_ground_estm
real(kind(1d0)), parameter em_wall_fix
real(kind(1d0)), dimension(5) zwall
real(kind(1d0)), dimension(:, :), allocatable tibld_grids
real(kind(1d0)), parameter conv
real(kind(1d0)) hw
real(kind(1d0)) ivf_wr
real(kind(1d0)) alb_avg
real(kind(1d0)) svf_roof
real(kind(1d0)) qsair
real(kind(1d0)), dimension(:, :), allocatable troof_grids
real(kind(1d0)), dimension(:), allocatable tievolve_grids
real(kind(1d0)) xvf_wall
real(kind(1d0)) t0_wall
real(kind(1d0)), dimension(5) ribld
integer, parameter maxiter
real(kind(1d0)) sumalb
real(kind(1d0)), dimension(5) zroof
logical, dimension(2) bctype
real(kind(1d0)) ws
real(kind(1d0)) theat_on
real(kind(1d0)) svf_ground
real(kind(1d0)) rvf_wall
real(kind(1d0)), dimension(:, :), allocatable tground_grids
subroutine heatcond1d(t, qs, dx, dt, k, rhocp, bc, bctype)
real(kind(1d0)) function heatcapacity_air(tk, rh, p)
real(kind(1d0)) function newtonpolynomial(x0, pcoeff, conv, maxiter)
real(kind(1d0)), parameter c2k
real(kind(1d0)), parameter sbconst

References estm_data::alb_avg, estm_data::alb_ground_estm, estm_data::alb_roof_estm, estm_data::alb_veg_estm, estm_data::alb_wall_fix, estm_data::bctype, physconstants::c2k, estm_data::ch_ibld, estm_data::ch_iroof, estm_data::ch_iwall, estm_data::chair, estm_data::chr, estm_data::conv, estm_data::diagnoseti, estm_data::em_f, estm_data::em_ground_estm, estm_data::em_i, estm_data::em_ibld, estm_data::em_r, estm_data::em_roof_estm, estm_data::em_veg_estm, estm_data::em_w, estm_data::em_wall_fix, estm_data::evolvetibld, estm_data::fair, estm_data::fground, estm_data::fibld, estm_data::finternal, estm_data::froof, estm_data::fwall, meteo::heatcapacity_air(), heatflux::heatcond1d(), estm_data::hvac, estm_data::hw, estm_data::ibldchmod, estm_data::ivf_if, estm_data::ivf_ii, estm_data::ivf_ir, estm_data::ivf_iw, estm_data::ivf_rf, estm_data::ivf_ri, estm_data::ivf_rw, estm_data::ivf_wf, estm_data::ivf_wi, estm_data::ivf_wr, estm_data::ivf_ww, estm_data::kground, estm_data::kibld, estm_data::kroof, estm_data::kwall, estm_data::lbc_soil, estm_data::lup_ground, estm_data::lup_ground_grids, estm_data::lup_roof, estm_data::lup_roof_grids, estm_data::lup_veg, estm_data::lup_wall, estm_data::lup_wall_grids, estm_data::maxiter, estm_data::minshc_airbld, estm_data::nalb, estm_data::ndepth_ground, estm_data::ndepth_ibld, estm_data::ndepth_roof, estm_data::ndepth_wall, estm_data::nemis, mod_solver::newtonpolynomial(), estm_data::pcoeff, estm_data::qs_4, estm_data::qsair, estm_data::qsground, estm_data::qsibld, estm_data::qsroof, estm_data::qswall, estm_data::rroof, estm_data::rvf_ground, estm_data::rvf_roof, estm_data::rvf_veg, estm_data::rvf_wall, estm_data::rwall, physconstants::sbconst, set_nan(), estm_data::shc_air, estm_data::sumalb, estm_data::sumemis, estm_data::svf_ground, estm_data::svf_roof, estm_data::svf_wall, estm_data::t0_ground, estm_data::t0_ground_grids, estm_data::t0_ibld, estm_data::t0_ibld_grids, estm_data::t0_roof, estm_data::t0_roof_grids, estm_data::t0_wall, estm_data::t0_wall_grids, estm_data::tair1, estm_data::tair2, estm_data::tair2_grids, estm_data::tanzenith, estm_data::tfloor, estm_data::tground, estm_data::tground_grids, estm_data::theat_fix, estm_data::theat_off, estm_data::theat_on, estm_data::tibld, estm_data::tibld_grids, estm_data::tievolve, estm_data::tievolve_grids, estm_data::tn_roof, estm_data::tn_roof_grids, estm_data::tn_wall, estm_data::tn_wall_grids, estm_data::troof, estm_data::troof_grids, estm_data::tsurfchoice, estm_data::tw_4, estm_data::tw_4_grids, estm_data::twall, estm_data::twall_grids, estm_data::ws, estm_data::xvf_wall, estm_data::zground, estm_data::zibld, estm_data::zroof, estm_data::zvf_ground, estm_data::zvf_wall, and estm_data::zwall.

Referenced by suews_driver::suews_cal_qs(), and suews_driver::suews_cal_qs_dts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ estm_ehc_finalise()

subroutine estm_module::estm_ehc_finalise

Definition at line 1279 of file suews_phys_estm.f95.

1280 USE allocatearray
1281 IMPLICIT NONE
1282
1283 IF (ALLOCATED(nlayer_grids)) DEALLOCATE (nlayer_grids)
1284
1285 IF (ALLOCATED(height_grids)) DEALLOCATE (height_grids)
1286 IF (ALLOCATED(building_frac_grids)) DEALLOCATE (building_frac_grids)
1287 IF (ALLOCATED(veg_frac_grids)) DEALLOCATE (veg_frac_grids)
1288 IF (ALLOCATED(building_scale_grids)) DEALLOCATE (building_scale_grids)
1289 IF (ALLOCATED(veg_scale_grids)) DEALLOCATE (veg_scale_grids)
1290
1291 IF (ALLOCATED(sfr_roof_grids)) DEALLOCATE (sfr_roof_grids)
1292 IF (ALLOCATED(alb_roof_grids)) DEALLOCATE (alb_roof_grids)
1293 IF (ALLOCATED(emis_roof_grids)) DEALLOCATE (emis_roof_grids)
1294 IF (ALLOCATED(k_roof_grids)) DEALLOCATE (k_roof_grids)
1295 IF (ALLOCATED(cp_roof_grids)) DEALLOCATE (cp_roof_grids)
1296 IF (ALLOCATED(dz_roof_grids)) DEALLOCATE (dz_roof_grids)
1297 IF (ALLOCATED(tin_roof_grids)) DEALLOCATE (tin_roof_grids)
1298 IF (ALLOCATED(temp_roof_grids)) DEALLOCATE (temp_roof_grids)
1299 IF (ALLOCATED(state_roof_grids)) DEALLOCATE (state_roof_grids)
1300 IF (ALLOCATED(statelimit_roof_grids)) DEALLOCATE (statelimit_roof_grids)
1301 IF (ALLOCATED(wetthresh_roof_grids)) DEALLOCATE (wetthresh_roof_grids)
1302 IF (ALLOCATED(soilstore_roof_grids)) DEALLOCATE (soilstore_roof_grids)
1303 IF (ALLOCATED(soilstorecap_roof_grids)) DEALLOCATE (soilstorecap_roof_grids)
1305
1306 IF (ALLOCATED(sfr_wall_grids)) DEALLOCATE (sfr_wall_grids)
1307 IF (ALLOCATED(alb_wall_grids)) DEALLOCATE (alb_wall_grids)
1308 IF (ALLOCATED(emis_wall_grids)) DEALLOCATE (emis_wall_grids)
1309 IF (ALLOCATED(k_wall_grids)) DEALLOCATE (k_wall_grids)
1310 IF (ALLOCATED(cp_wall_grids)) DEALLOCATE (cp_wall_grids)
1311 IF (ALLOCATED(dz_wall_grids)) DEALLOCATE (dz_wall_grids)
1312 IF (ALLOCATED(tin_wall_grids)) DEALLOCATE (tin_wall_grids)
1313 IF (ALLOCATED(temp_wall_grids)) DEALLOCATE (temp_wall_grids)
1314 IF (ALLOCATED(state_wall_grids)) DEALLOCATE (state_wall_grids)
1315 IF (ALLOCATED(statelimit_wall_grids)) DEALLOCATE (statelimit_wall_grids)
1316 IF (ALLOCATED(wetthresh_wall_grids)) DEALLOCATE (wetthresh_wall_grids)
1317 IF (ALLOCATED(soilstore_wall_grids)) DEALLOCATE (soilstore_wall_grids)
1318 IF (ALLOCATED(soilstorecap_wall_grids)) DEALLOCATE (soilstorecap_wall_grids)
1319 IF (ALLOCATED(wall_specular_frac_grids)) DEALLOCATE (wall_specular_frac_grids)
1320
1321 IF (ALLOCATED(k_surf_grids)) DEALLOCATE (k_surf_grids)
1322 IF (ALLOCATED(cp_surf_grids)) DEALLOCATE (cp_surf_grids)
1323 IF (ALLOCATED(dz_surf_grids)) DEALLOCATE (dz_surf_grids)
1324 ! IF (ALLOCATED(tin_surf_grids)) DEALLOCATE (tin_surf_grids)
1325 IF (ALLOCATED(temp_surf_grids)) DEALLOCATE (temp_surf_grids)
1326
real(kind(1d0)), dimension(:, :), allocatable soilstorecap_wall_grids
real(kind(1d0)), dimension(:, :), allocatable soilstore_wall_grids
real(kind(1d0)), dimension(:, :, :), allocatable cp_wall_grids
real(kind(1d0)), dimension(:, :), allocatable emis_wall_grids
real(kind(1d0)), dimension(:, :, :), allocatable temp_surf_grids
real(kind(1d0)), dimension(:, :), allocatable tin_roof_grids
real(kind(1d0)), dimension(:, :), allocatable building_frac_grids
real(kind(1d0)), dimension(:, :, :), allocatable temp_wall_grids
real(kind(1d0)), dimension(:, :), allocatable tin_wall_grids
integer, dimension(:), allocatable nlayer_grids
real(kind(1d0)), dimension(:, :), allocatable alb_wall_grids
real(kind(1d0)), dimension(:, :, :), allocatable cp_surf_grids
real(kind(1d0)), dimension(:, :, :), allocatable wall_specular_frac_grids
real(kind(1d0)), dimension(:, :), allocatable alb_roof_grids
real(kind(1d0)), dimension(:, :, :), allocatable k_wall_grids
real(kind(1d0)), dimension(:, :), allocatable emis_roof_grids
real(kind(1d0)), dimension(:, :, :), allocatable temp_roof_grids
real(kind(1d0)), dimension(:, :, :), allocatable cp_roof_grids
real(kind(1d0)), dimension(:, :), allocatable sfr_wall_grids
real(kind(1d0)), dimension(:, :), allocatable state_wall_grids
real(kind(1d0)), dimension(:, :), allocatable building_scale_grids
real(kind(1d0)), dimension(:, :, :), allocatable dz_surf_grids
real(kind(1d0)), dimension(:, :), allocatable soilstore_roof_grids
real(kind(1d0)), dimension(:, :, :), allocatable k_roof_grids
real(kind(1d0)), dimension(:, :), allocatable statelimit_wall_grids
real(kind(1d0)), dimension(:, :), allocatable wetthresh_roof_grids
real(kind(1d0)), dimension(:, :), allocatable soilstorecap_roof_grids
real(kind(1d0)), dimension(:, :, :), allocatable dz_roof_grids
real(kind(1d0)), dimension(:, :, :), allocatable roof_albedo_dir_mult_fact_grids
real(kind(1d0)), dimension(:, :), allocatable height_grids
real(kind(1d0)), dimension(:, :), allocatable veg_scale_grids
real(kind(1d0)), dimension(:, :, :), allocatable k_surf_grids
real(kind(1d0)), dimension(:, :), allocatable veg_frac_grids
real(kind(1d0)), dimension(:, :), allocatable state_roof_grids
real(kind(1d0)), dimension(:, :), allocatable statelimit_roof_grids
real(kind(1d0)), dimension(:, :), allocatable sfr_roof_grids
real(kind(1d0)), dimension(:, :, :), allocatable dz_wall_grids
real(kind(1d0)), dimension(:, :), allocatable wetthresh_wall_grids

References allocatearray::alb_roof_grids, allocatearray::alb_wall_grids, allocatearray::building_frac_grids, allocatearray::building_scale_grids, allocatearray::cp_roof_grids, allocatearray::cp_surf_grids, allocatearray::cp_wall_grids, allocatearray::dz_roof_grids, allocatearray::dz_surf_grids, allocatearray::dz_wall_grids, allocatearray::emis_roof_grids, allocatearray::emis_wall_grids, allocatearray::height_grids, allocatearray::k_roof_grids, allocatearray::k_surf_grids, allocatearray::k_wall_grids, allocatearray::nlayer_grids, allocatearray::roof_albedo_dir_mult_fact_grids, allocatearray::sfr_roof_grids, allocatearray::sfr_wall_grids, allocatearray::soilstore_roof_grids, allocatearray::soilstore_wall_grids, allocatearray::soilstorecap_roof_grids, allocatearray::soilstorecap_wall_grids, allocatearray::state_roof_grids, allocatearray::state_wall_grids, allocatearray::statelimit_roof_grids, allocatearray::statelimit_wall_grids, allocatearray::temp_roof_grids, allocatearray::temp_surf_grids, allocatearray::temp_wall_grids, allocatearray::tin_roof_grids, allocatearray::tin_wall_grids, allocatearray::veg_frac_grids, allocatearray::veg_scale_grids, allocatearray::wall_specular_frac_grids, allocatearray::wetthresh_roof_grids, and allocatearray::wetthresh_wall_grids.

◆ estm_ehc_initialise()

subroutine estm_module::estm_ehc_initialise

Definition at line 1199 of file suews_phys_estm.f95.

1200
1201 ! Last modified HCW 30 Jun 2016 - reading in now done by SUEWS_GetESTMData subroutine.
1202 ! ESTM_initials now only runs once per run at the very start.
1203 ! Last modified HCW 15 Jun 2016 - code now reads in 5-min file (interpolation done beforehand, outside of SUEWS itself)
1204
1205 ! USE defaultNotUsed
1206 USE physconstants, ONLY: c2k
1207 ! USE ESTM_data
1208 USE allocatearray
1210 USE initial, ONLY: numberofgrids
1211
1212 IMPLICIT NONE
1213 LOGICAL :: flag_mutiple_layout_files
1214 INTEGER :: i_grid
1215
1216 IF (multiplelayoutfiles == 0) THEN
1217 flag_mutiple_layout_files = .false.
1218 ELSE IF (multiplelayoutfiles == 1) THEN
1219 flag_mutiple_layout_files = .true.
1220 END IF
1221
1222 ALLOCATE (nlayer_grids(numberofgrids))
1223
1229
1230 ! allocate roof variables
1246
1247 ! allocate wall variables
1263
1264 ! allocate surf variables
1265 ! ALLOCATE (tsfc_surf_grids(NumberOfGrids, nsurf))
1271
1272 DO i_grid = 1, numberofgrids
1273 print *, 'Reading layout data for grid ', i_grid
1274 CALL load_gridlayout(i_grid, flag_mutiple_layout_files, diagnose)
1275 END DO
1276
real(kind(1d0)), dimension(:, :), allocatable tsfc_wall_grids
real(kind(1d0)), dimension(:, :), allocatable tin_surf_grids
real(kind(1d0)), dimension(:, :), allocatable tsfc_roof_grids
integer, parameter nspec
integer, parameter nsurf
integer, parameter ndepth
integer, parameter nlayer_max
integer multiplelayoutfiles
integer numberofgrids

References allocatearray::alb_roof_grids, allocatearray::alb_wall_grids, allocatearray::building_frac_grids, allocatearray::building_scale_grids, physconstants::c2k, allocatearray::cp_roof_grids, allocatearray::cp_surf_grids, allocatearray::cp_wall_grids, data_in::diagnose, allocatearray::dz_roof_grids, allocatearray::dz_surf_grids, allocatearray::dz_wall_grids, allocatearray::emis_roof_grids, allocatearray::emis_wall_grids, allocatearray::height_grids, allocatearray::k_roof_grids, allocatearray::k_surf_grids, allocatearray::k_wall_grids, load_gridlayout(), data_in::multiplelayoutfiles, allocatearray::ndepth, allocatearray::nlayer_grids, allocatearray::nlayer_max, allocatearray::nspec, allocatearray::nsurf, initial::numberofgrids, allocatearray::roof_albedo_dir_mult_fact_grids, allocatearray::sfr_roof_grids, allocatearray::sfr_wall_grids, allocatearray::soilstore_roof_grids, allocatearray::soilstore_wall_grids, allocatearray::soilstorecap_roof_grids, allocatearray::soilstorecap_wall_grids, allocatearray::state_roof_grids, allocatearray::state_wall_grids, allocatearray::statelimit_roof_grids, allocatearray::statelimit_wall_grids, allocatearray::temp_roof_grids, allocatearray::temp_surf_grids, allocatearray::temp_wall_grids, allocatearray::tin_roof_grids, allocatearray::tin_surf_grids, allocatearray::tin_wall_grids, allocatearray::tsfc_roof_grids, allocatearray::tsfc_wall_grids, allocatearray::veg_frac_grids, allocatearray::veg_scale_grids, allocatearray::wall_specular_frac_grids, allocatearray::wetthresh_roof_grids, and allocatearray::wetthresh_wall_grids.

Here is the call graph for this function:

◆ estm_initials()

subroutine estm_module::estm_initials

Definition at line 781 of file suews_phys_estm.f95.

782
783 ! Last modified HCW 30 Jun 2016 - reading in now done by SUEWS_GetESTMData subroutine.
784 ! ESTM_initials now only runs once per run at the very start.
785 ! Last modified HCW 15 Jun 2016 - code now reads in 5-min file (interpolation done beforehand, outside of SUEWS itself)
786
788 USE physconstants, ONLY: c2k
789 USE estm_data
790 USE allocatearray
791 USE data_in, ONLY: fileinputpath
792 USE initial, ONLY: numberofgrids
793
794 IMPLICIT NONE
795
796 !=====Read ESTMinput.nml================================
797 namelist /estminput/ tsurfchoice, &
798 evolvetibld, &
799 ibldchmod, &
800 lbc_soil, &
801 theat_on, &
802 theat_off, &
804
805 OPEN (511, file=trim(fileinputpath)//'ESTMinput.nml', status='old')
806 READ (511, nml=estminput)
807 CLOSE (511)
808
809 !Convert specified temperatures to Kelvin
813
814 ALLOCATE (tair2_grids(numberofgrids))
816 ALLOCATE (lup_wall_grids(numberofgrids))
817 ALLOCATE (lup_roof_grids(numberofgrids))
818 ALLOCATE (tievolve_grids(numberofgrids))
819 ALLOCATE (t0_ibld_grids(numberofgrids))
821 ALLOCATE (t0_wall_grids(numberofgrids))
822 ALLOCATE (t0_roof_grids(numberofgrids))
823 ALLOCATE (tn_wall_grids(numberofgrids))
824 ALLOCATE (tn_roof_grids(numberofgrids))
825
character(len=150) fileinputpath

References physconstants::c2k, estm_data::evolvetibld, data_in::fileinputpath, estm_data::ibldchmod, estm_data::lbc_soil, estm_data::lup_ground_grids, estm_data::lup_roof_grids, estm_data::lup_wall_grids, initial::numberofgrids, estm_data::t0_ground_grids, estm_data::t0_ibld_grids, estm_data::t0_roof_grids, estm_data::t0_wall_grids, estm_data::tair2_grids, estm_data::theat_fix, estm_data::theat_off, estm_data::theat_on, estm_data::tievolve_grids, estm_data::tn_roof_grids, estm_data::tn_wall_grids, and estm_data::tsurfchoice.

◆ estm_translate()

subroutine estm_module::estm_translate ( integer gridiv)

Definition at line 1330 of file suews_phys_estm.f95.

1331 ! HCW 30 Jun 2016
1332
1333 USE defaultnotused, ONLY: nan
1334 USE physconstants, ONLY: c2k, sbconst
1335 USE estm_data
1336 USE allocatearray
1337 USE gis_data, ONLY: bldgh
1338 USE initial, ONLY: numberofgrids
1339
1340 IMPLICIT NONE
1341 INTEGER :: i
1342 !REAL(KIND(1d0)) :: CFLval
1343 !REAL(KIND(1d0)) :: t5min
1344 REAL(KIND(1D0)) :: W, WB
1345 !CHARACTER (len=20)::FileCodeX
1346 !CHARACTER (len=150):: FileFinalTemp
1347 !LOGICAL:: inittemps=.FALSE.
1348 INTEGER :: ESTMStart = 0
1349 INTEGER :: Gridiv
1350
1351 !Set initial values at the start of each run for each grid
1352 ! the initiliastion part is problematic:
1353 ! cannot be initialised under a multi-grid scenario
1354 IF (gridiv == 1) estmstart = estmstart + 1
1355 ! print *, 'gridiv in ESTM',gridiv,'ESTMStart',ESTMStart
1356 IF (estmstart == 1) THEN
1357
1358 ! write(*,*) ' ESTMStart: ',ESTMStart, 'initialising ESTM for grid no. ', Gridiv
1359
1360 tfloor = 20.0 ! This is used only when radforce =T !TODO: should be put in the namelist
1361 tfloor = tfloor + c2k
1362
1363 ! Initial values
1364 tievolve = 20.0 + c2k
1365 shc_air = 1230.0
1366 minshc_airbld = 1300
1367
1368 ! ---- Internal view factors ----
1369 !constant now but should be calculated in the future
1370 ivf_iw = 0.100000
1371 ivf_ir = 0.000000
1372 ivf_ii = 0.900000
1373 ivf_if = 0.000000
1374 ivf_ww = 0.050000
1375 ivf_wr = 0.000000
1376 ivf_wi = 0.950000
1377 ivf_wf = 0.000000
1378 ivf_rw = 0.050000
1379 ivf_ri = 0.950000
1380 ivf_rf = 0.000000
1381 ivf_fw = 0.050000
1382 ivf_fr = 0.000000
1383 ivf_fi = 0.950000
1384
1385 tair24hr = c2k
1386
1387 !Ts5mindata(1,ncolsESTMdata) = -999
1388 ! !Fill Ts5mindata for current grid and met block - this is done in SUEWS_translate
1390
1391 ! ---- Initialization of variables and parameters for first row of run for each grid ----
1392 ! N layers are calculated in SUEWS_translate
1393 IF (.NOT. ALLOCATED(tibld)) THEN
1394 ! print *, "Nibld", Nibld
1395 ! print *, "Nwall", Nwall
1396 ! print *, "Nroof", Nroof
1397 ! print *, "Nground", Nground
1404 END IF
1405
1406 ! Transfer variables from Ts5mindata to variable names
1407 ! N.B. column numbers here for the following file format - need to change if input columns change!
1408 ! dectime iy id it imin Tiair Tsurf Troof Troad Twall Twall_n Twall_e Twall_s Twall_w
1409 ! 1 2 3 4 5 6 7 8 9 10 11 12 13 !new
1410 !
1411 ! Calculate temperature of each layer in Kelvin
1412 ! QUESTION: what if (Nground/Nwall/Nroof-1)==0? TS 21 Oct 2017
1413 DO i = 1, ndepth_ground
1414 tground(i) = (lbc_soil - ts5mindata(1, cts_troad))*(i - 1)/(ndepth_ground - 1) + ts5mindata(1, cts_troad) + c2k
1415 END DO
1416 DO i = 1, ndepth_wall
1417 twall(i) = &
1418 (ts5mindata(1, cts_tiair) - ts5mindata(1, cts_twall))*(i - 1)/(ndepth_wall - 1) + ts5mindata(1, cts_twall) &
1419 + c2k
1420 END DO
1421 DO i = 1, ndepth_roof
1422 troof(i) = &
1423 (ts5mindata(1, cts_tiair) - ts5mindata(1, cts_troof))*(i - 1)/(ndepth_roof - 1) + ts5mindata(1, cts_troof) &
1424 + c2k
1425 END DO
1427
1428 END IF !End of loop run only at start (for each grid)
1429
1430 ! ---- Parameters related to land surface characteristics ----
1431 ! QUESTION: Would Zref=z be more appropriate?
1432 zref = 2.0*bldgh !!FO!! BldgH: mean bulding hight, zref: local scale reference height (local: ~ 10^2 x 10^2 -- 10^3 x 10^3 m^2)
1433
1434 svf_ground = 1.0
1435 svf_roof = 1.0
1436
1437 ! ==== roof (i.e. Bldgs)
1438 !froof=sfr_surf(BldgSurf) ! Moved to SUEWS_translate HCW 16 Jun 2016
1441
1442 ! ==== vegetation (i.e. EveTr, DecTr, Grass)
1443 !fveg=sfr_surf(ConifSurf)+sfr_surf(DecidSurf)+sfr_surf(GrassSurf) ! Moved to SUEWS_translate HCW 16 Jun 2016
1444 IF (fveg /= 0) THEN
1447 ELSE ! check fveg==0 scenario to avoid division-by-zero error, TS 21 Oct 2017
1450 END IF
1451
1452 ! ==== ground (i.e. Paved, EveTr, DecTr, Grass, BSoil, Water - all except Bldgs)
1453 !fground=sfr_surf(ConifSurf)+sfr_surf(DecidSurf)+sfr_surf(GrassSurf)+sfr_surf(PavSurf)+sfr_surf(BsoilSurf)+sfr_surf(WaterSurf) ! Moved to SUEWS_translate HCW 16 Jun 2016
1454 IF (fground /= 0) THEN
1461 ELSE ! check fground==0 scenario to avoid division-by-zero error, TS 21 Jul 2016
1464 END IF
1465
1466 IF (froof < 1.0) THEN
1467 hw = fwall/(2.0*(1.0 - froof))
1468 ELSE
1469 ! HW=0 !HCW if only roof, no ground
1470 hw = 0.00001 ! to avoid zero-HW scenario TS 21 Oct 2017
1471
1472 END IF
1473 hw = max(0.00001, hw) ! to avoid zero-HW scenario TS 27 Oct 2017
1474
1475 IF (fground == 1.0) THEN !!FO!! if only ground, i.e. no houses
1476 w = 1
1477 wb = 0
1478 svf_ground = 1.
1479 zvf_wall = 0.
1480 svf_wall = 0.
1481 svf_roof = 1.
1482 zvf_ground = 0.
1483 xvf_wall = 0.
1484 rvf_canyon = 1.
1485 rvf_ground = 1.-fveg
1486 rvf_roof = 0
1487 rvf_wall = 0
1488 rvf_veg = fveg
1489 ELSE IF (fground == 0.0) THEN !check fground==0 (or HW==0) scenario to avoid division-by-zero error, TS 21 Jul 2016
1490 ! the following values are calculated given HW=0
1491 w = 0
1492 wb = 1
1493 zvf_wall = 0 !COS(ATAN(2/HW)) when HW=0 !!FO!! wall view factor for wall
1494 hw = 0
1495 svf_ground = max(cos(atan(2*hw)), 0.00001) !!FO!! sky view factor for ground ! to avoid zero-division scenario TS 21 Oct 2017
1496 svf_wall = (1 - zvf_wall)/2 !!FO!! sky view factor for wall
1497 zvf_ground = 1 - svf_ground !!FO!! wall view factor for ground
1498 xvf_wall = svf_wall !!FO!! ground view factor
1499 ! RVF_CANYON=COS(ATAN(2*ZREF/W))
1500 ! RVF_ROOF=1-RVF_CANYON
1501 ! RVF_WALL=(COS(ATAN(2*(ZREF-BldgH)/W))-RVF_CANYON)*RVF_CANYON
1502 ! RVF_ground=RVF_CANYON-RVF_WALL
1505 rvf_roof = froof
1507 ELSE
1508 w = bldgh/hw !What about if HW = 0, need to add IF(Fground ==0) option ! fixed by setting a small number, TS 21 Oct 2017
1509 wb = w*sqrt(froof/fground)
1510 svf_ground = cos(atan(2*hw)) !!FO!! sky view factor for ground
1511 zvf_wall = cos(atan(2/hw)) !!FO!! wall view factor for wall
1512 svf_wall = (1 - zvf_wall)/2 !!FO!! sky view factor for wall
1513 zvf_ground = 1 - svf_ground !!FO!! wall view factor for ground
1514 xvf_wall = svf_wall !!FO!! ground view factor
1515 ! RVF_CANYON=COS(ATAN(2*ZREF/W))
1516 ! RVF_ROOF=1-RVF_CANYON
1517 ! RVF_WALL=(COS(ATAN(2*(ZREF-BldgH)/W))-RVF_CANYON)*RVF_CANYON
1518 ! RVF_ground=RVF_CANYON-RVF_WALL
1521 rvf_roof = froof
1523 END IF
1524
1526
1527 sumalb = 0.; nalb = 0
1528 sumemis = 0.; nemis = 0
1529
1530 !set emissivity for ceiling, wall and floor inside of buildings
1532
1533 !internal elements
1534 IF (nroom == 0) THEN
1535 fibld = (floor(bldgh/3.1 - 0.5) - 1)*froof
1536 ELSE
1537 fibld = (2.-2./nroom)*fwall + (floor(bldgh/3.1 - 0.5) - 1)*froof
1538 END IF
1539
1540 IF (fibld == 0) fibld = 0.00001 !this just ensures a solution to radiation
1542 IF (finternal == 0) finternal = 0.00001 ! to avoid zero-devision error TS 21 Oct 2017
1543 fair = zref - bldgh*froof
1544 IF (fair == 0) fair = 0.00001 ! to avoid zero-devision error TS 21 Oct 2017
1545 !ivf_ii=1.-ivf_iw-ivf_ir-ivf_if !S.O. I do not know these are should be calculated or read from input files
1546 !ivf_ww=1.-ivf_wi-ivf_wr-ivf_wf
1547 !ivf_rw=1.-ivf_ri-ivf_rf;
1548 !ivf_fr=ivf_rf;
1549
1550 IF ((ivf_ii + ivf_iw + ivf_ir + ivf_if > 1.0001) .OR. &
1551 (ivf_wi + ivf_ww + ivf_wr + ivf_wf > 1.0001) .OR. &
1552 (ivf_ri + ivf_rw + ivf_rf > 1.0001) .OR. &
1553 (ivf_fi + ivf_fw + ivf_fr > 1.0001) .OR. &
1554 (ivf_ii + ivf_iw + ivf_ir + ivf_if < 0.9999) .OR. &
1555 (ivf_wi + ivf_ww + ivf_wr + ivf_wf < 0.9999) .OR. &
1556 (ivf_ri + ivf_rw + ivf_rf < 0.9999) .OR. &
1557 (ivf_fi + ivf_fw + ivf_fr < 0.9999)) THEN
1558 print *, "At least one internal view factor <> 1. Check ivf in ESTMinput.nml"
1559 END IF
1560
1561 !=======Initial setting==============================================
1562 !! Rewritten by HCW 15 Jun 2016 to use existing SUEWS error handling
1563 !IF(inittemps) THEN
1564 ! write(*,*) 'inittemps:',inittemps
1565 ! FileFinalTemp=TRIM(FileOutputPath)//TRIM(FileCodeX)//'_ESTM_finaltemp.txt'
1566 ! OPEN(99,file=TRIM(FileFinalTemp),status='old',err=316) ! Program stopped if error opening file
1567 ! READ(99,*) Twall,Troof,Tground,Tibld ! Twall, Troof, Tground & Tibld get new values
1568 ! CLOSE(99)
1569 !ENDIF
1570 !
1571 !!IF (inittemps) THEN !!FO!! inittemps=.true. set in nml file
1572 !! OPEN(99,file='outputfiles/finaltemp.txt',status='old',iostat=ios) !!FO!! has to exist
1573 !!
1574 !! IF (ios/=0) CALL error('outputfiles/finaltemp.txt',ios,1) !!FO!! calls mod_error.f95, writes that the opening failed and stops prg
1575 !! IF (ios/=0) THEN
1576 !! Twall = (/273., 285., 291./)
1577 !! Troof = (/273., 285., 291./)
1578 !! Tground = (/273., 275., 280., 290./)
1579 !! Tibld = (/293., 293., 293./)
1580 !! ELSE
1581 !! READ(99,*) Twall,Troof,Tground,Tibld !!FO!! if finaltemp.txt exists Twall[3], Troof[3], Tground[4] & Tibld[3] get new values
1582 !! CLOSE(99)
1583 !! ENDIF
1584 !!ENDIF
1585
1586 !where (isnan(Twall))
1587 ! Twall = 273
1588 !endwhere
1589 !where (isnan(Troof))
1590 ! Troof = 273
1591 !endwhere
1592 !where (isnan(Tground))
1593 ! Tground = 281
1594 !endwhere
1595 !where (isnan(Tibld))
1596 ! Tibld = 293
1597 !endwhere
1598
1599 IF (estmstart == 1) THEN
1600 DO i = 1, 4
1601 tw_4(:, i) = twall !!FO!! Tw_4 holds three differnet temp:s for each wall layer but the same set for all points of the compass
1602 END DO
1603
1604 !initialize surface temperatures
1605 t0_ground = tground(1)
1606 t0_wall = twall(1)
1607 t0_roof = troof(1)
1608 t0_ibld = tibld(1)
1611
1612 !initialize outgoing longwave !QUESTION: HCW - Are these calculations compatible with those in LUMPS_NARP?
1616
1617 ! PRINT*,"W,WB= ",W,WB
1618 ! PRINT*,'SVF_ground ','SVF_WALL ','zvf_WALL ','HW '
1619 ! PRINT*,SVF_ground,SVF_WALL,zvf_WALL,HW
1620 ! PRINT*,'RVF_ground ','RVF_WALL ','RVF_ROOF ','RVF_VEG'
1621 ! PRINT*,RVF_ground,RVF_WALL,RVF_ROOF,RVF_VEG
1622 ! print*,'Alb_avg (VF)=',alb_avg
1623 ! print*,'z0m, Zd', z0m, ZD
1624
1625 END IF
1626
1627 first = .true.
1628
1629 !======Courant-Friedrichs-Lewy condition=================================
1630 !This is comment out by S.O. for now
1631 ! NB: should be recovered for calculation stability, FO and TS, 11 Oct 2017
1632 ! CFLval = minval(0.5*zibld*zibld*ribld/kibld) !!FO!! z*z*r/k => unit [s]
1633 ! if (Tstep>CFLval) then !CFL condition !!FO!! CFL condition: Courant�Friedrichs�Lewy condition is a necessary condition for convergence while solving
1634 ! write(*,*) "IBLD: CFL condition: Tstep=",Tstep,">",CFLval !!FO!! certain partial differential equations numerically by the method of finite differences (like eq 5 in Offerle et al.,2005)
1635 ! CFLfail=.TRUE.
1636 ! endif
1637 ! CFLval = minval(0.5*zroof*zroof*rroof/kroof)
1638 ! if (Tstep>CFLval) then !CFL condition
1639 ! write(*,*) "ROOF: CFL condition: Tstep=",Tstep,">",CFLval
1640 ! CFLfail=.TRUE.
1641 ! endif
1642 ! CFLval = minval(0.5*zwall*zwall*rwall/kwall)
1643 ! if (Tstep>CFLval) then !CFL condition
1644 ! write(*,*) "WALL: CFL condition: Tstep=",Tstep,">",CFLval
1645 ! CFLfail=.TRUE.
1646 ! endif
1647 ! CFLval = minval(0.5*zground*zground*rground/kground)
1648 ! if (Tstep>CFLval) then !CFL condition
1649 ! write(*,*) "ground: CFL condition: Tstep=",Tstep,">",CFLval
1650 ! CFLfail=.TRUE.
1651 ! endif
1652 ! if (CFLfail) then
1653 ! write(*,*) "Increase dX or decrease maxtimestep. Hit any key to continue"
1654 ! read (*,*)
1655 ! endif
1656
1657 ! Tiaircyc = (1+(LondonQSJune_Barbican.Tair-Tiair)./(5*Tiair)).*(Tiair + 0.4*sin(LondonQSJune_Barbican.HOUR*2*pi/24-10/24*2*pi)) !!FO!! outdoor temp affected
1658
1659 RETURN
1660
1661 ! 315 CALL errorHint(11,TRIM(fileESTMTs),notUsed,notUsed,NotUsedI)
1662 ! 316 CALL errorHint(11,TRIM(fileFinalTemp),notUsed,notUsed,NotUsedI)
1663
integer, parameter bldgsurf
real(kind(1d0)), dimension(:, :), allocatable ts5mindata
integer, parameter ncolsestmdata
integer, parameter conifsurf
integer, parameter cts_twall
integer, parameter cts_troad
real(kind(1d0)), dimension(nsurf) sfr_surf
real(kind(1d0)), dimension(nsurf) emis
real(kind(1d0)), dimension(:), allocatable tair24hr
integer, parameter watersurf
integer, parameter grasssurf
integer, parameter bsoilsurf
integer, parameter pavsurf
real(kind(1d0)), dimension(nsurf) alb
integer, parameter cts_tiair
real(kind(1d0)), dimension(:, :, :), allocatable estmforcingdata
integer, parameter decidsurf
integer, parameter cts_troof
real(kind(1d0)) nan
real(kind(1d0)) ivf_fr
real(kind(1d0)) nroom
real(kind(1d0)) zref
real(kind(1d0)) ivf_fw
real(kind(1d0)) ivf_fi
real(kind(1d0)) fveg
real(kind(1d0)) rvf_canyon
real(kind(1d0)) bldgh

References allocatearray::alb, estm_data::alb_avg, estm_data::alb_ground_estm, estm_data::alb_roof_estm, estm_data::alb_veg_estm, estm_data::alb_wall_fix, gis_data::bldgh, allocatearray::bldgsurf, allocatearray::bsoilsurf, physconstants::c2k, allocatearray::conifsurf, allocatearray::cts_tiair, allocatearray::cts_troad, allocatearray::cts_troof, allocatearray::cts_twall, allocatearray::decidsurf, estm_data::em_f, estm_data::em_ground_estm, estm_data::em_i, estm_data::em_ibld, estm_data::em_r, estm_data::em_roof_estm, estm_data::em_veg_estm, estm_data::em_w, estm_data::em_wall_fix, allocatearray::emis, allocatearray::estmforcingdata, estm_data::fair, estm_data::fground, estm_data::fibld, estm_data::finternal, estm_data::first, estm_data::froof, estm_data::fveg, estm_data::fwall, allocatearray::grasssurf, estm_data::hw, estm_data::ivf_fi, estm_data::ivf_fr, estm_data::ivf_fw, estm_data::ivf_if, estm_data::ivf_ii, estm_data::ivf_ir, estm_data::ivf_iw, estm_data::ivf_rf, estm_data::ivf_ri, estm_data::ivf_rw, estm_data::ivf_wf, estm_data::ivf_wi, estm_data::ivf_wr, estm_data::ivf_ww, estm_data::lbc_soil, estm_data::lup_ground, estm_data::lup_roof, estm_data::lup_wall, estm_data::minshc_airbld, estm_data::nalb, defaultnotused::nan, allocatearray::ncolsestmdata, estm_data::ndepth_ground, estm_data::ndepth_ibld, estm_data::ndepth_roof, estm_data::ndepth_wall, estm_data::nemis, estm_data::nroom, initial::numberofgrids, allocatearray::pavsurf, estm_data::rvf_canyon, estm_data::rvf_ground, estm_data::rvf_roof, estm_data::rvf_veg, estm_data::rvf_wall, physconstants::sbconst, allocatearray::sfr_surf, estm_data::shc_air, estm_data::sumalb, estm_data::sumemis, estm_data::svf_ground, estm_data::svf_roof, estm_data::svf_wall, estm_data::t0_ground, estm_data::t0_ibld, estm_data::t0_roof, estm_data::t0_wall, allocatearray::tair24hr, estm_data::tfloor, estm_data::tground, estm_data::tground_grids, estm_data::tibld, estm_data::tibld_grids, estm_data::tievolve, estm_data::tn_roof, estm_data::tn_wall, estm_data::troof, estm_data::troof_grids, allocatearray::ts5mindata, estm_data::tw_4, estm_data::tw_4_grids, estm_data::twall, estm_data::twall_grids, allocatearray::watersurf, estm_data::xvf_wall, estm_data::zref, estm_data::zvf_ground, and estm_data::zvf_wall.

◆ load_gridlayout()

subroutine estm_module::load_gridlayout ( integer, intent(in) gridiv,
logical, intent(in) multiplelayoutfiles,
integer, intent(in) diagnose )

Definition at line 828 of file suews_phys_estm.f95.

829 USE allocatearray, ONLY: &
830 ndepth, &
865 nsurf, &
870 nspec
871 USE data_in, ONLY: fileinputpath, filecode
872 USE strings, ONLY: writenum
873 IMPLICIT NONE
874 INTEGER, INTENT(IN) :: gridIV
875 INTEGER, INTENT(IN) :: diagnose
876 LOGICAL, INTENT(IN) :: MultipleLayoutFiles
877 CHARACTER(len=100) :: FileLayout, str_gridIV
878 INTEGER :: istat, iunit, ERROR_UNIT, i
879 INTEGER :: igroup, ilayer, idepth
880 CHARACTER(len=1000) :: line
881 REAL(KIND(1D0)) :: k, dz
882
883 namelist &
884 ! basic dimension info
885 /dim/ &
886 nlayer, &
887 /geom/ &
888 height, &
890 veg_frac, &
892 veg_scale, &
893 ! read in roof part
894 /roof/ &
895 sfr_roof, &
897 tin_roof, &
898 alb_roof, &
899 emis_roof, &
900 state_roof, &
905 dz_roof, &
906 k_roof, &
907 cp_roof &
908 ! read in wall part
909 /wall/ &
910 sfr_wall, &
912 tin_wall, &
913 alb_wall, &
914 emis_wall, &
915 state_wall, &
920 dz_wall, &
921 k_wall, &
922 cp_wall, &
923 /surf/ &
924 tin_surf, &
925 dz_surf, &
926 k_surf, &
927 cp_surf
928
929 IF (multiplelayoutfiles) THEN
930 CALL writenum(gridiv, str_gridiv, 'i4')
931 filelayout = 'GridLayout'//trim(filecode)//trim(str_gridiv)//'.nml'
932 ELSE
933 filelayout = 'GridLayout'//trim(filecode)//'.nml'
934 END IF
935
936 IF (diagnose == 1) print *, 'Reading layout file: ', trim(fileinputpath)//filelayout
937 iunit = 212
938 OPEN (iunit, file=trim(fileinputpath)//trim(filelayout), status='old')
939 IF (diagnose == 1) print *, 'Read dim info of GridLayout'
940 READ (iunit, nml=dim, iostat=istat)
941 IF (diagnose == 1) print *, 'Number of layers to read: ', nlayer
942
943 IF (istat /= 0) THEN
944 backspace(iunit)
945 READ (iunit, fmt='(A)') line
946 error_unit = 119
947 WRITE (error_unit, '(A)') &
948 'Invalid line in namelist: '//trim(line)
949 END IF
950 CLOSE (iunit)
951
952 ALLOCATE (height(nlayer + 1))
953 ALLOCATE (building_frac(nlayer))
954 ALLOCATE (veg_frac(nlayer))
955 ALLOCATE (building_scale(nlayer))
956 ALLOCATE (veg_scale(nlayer))
957
958 ALLOCATE (sfr_roof(nlayer))
959 ALLOCATE (dz_roof(nlayer, ndepth))
960 ALLOCATE (k_roof(nlayer, ndepth))
961 ALLOCATE (cp_roof(nlayer, ndepth))
962 ALLOCATE (tin_roof(nlayer))
963 ALLOCATE (alb_roof(nlayer))
964 ALLOCATE (emis_roof(nlayer))
965 ALLOCATE (state_roof(nlayer))
966 ALLOCATE (statelimit_roof(nlayer))
967 ALLOCATE (wetthresh_roof(nlayer))
968 ALLOCATE (soilstore_roof(nlayer))
969 ALLOCATE (soilstorecap_roof(nlayer))
971
972 ALLOCATE (sfr_wall(nlayer))
973 ALLOCATE (dz_wall(nlayer, ndepth))
974 ALLOCATE (k_wall(nlayer, ndepth))
975 ALLOCATE (cp_wall(nlayer, ndepth))
976 ALLOCATE (tin_wall(nlayer))
977 ALLOCATE (alb_wall(nlayer))
978 ALLOCATE (emis_wall(nlayer))
979 ALLOCATE (state_wall(nlayer))
980 ALLOCATE (statelimit_wall(nlayer))
981 ALLOCATE (wetthresh_wall(nlayer))
982 ALLOCATE (soilstore_wall(nlayer))
983 ALLOCATE (soilstorecap_wall(nlayer))
984 ALLOCATE (wall_specular_frac(nspec, nlayer))
985
986 ALLOCATE (dz_surf(nsurf, ndepth))
987 ALLOCATE (k_surf(nsurf, ndepth))
988 ALLOCATE (cp_surf(nsurf, ndepth))
989 ALLOCATE (tin_surf(nsurf))
990
991 OPEN (iunit, file=trim(fileinputpath)//trim(filelayout), status='old')
992 IF (diagnose == 1) print *, 'Read geometry part of GridLayout'
993 READ (iunit, nml=geom, iostat=istat)
994 IF (diagnose == 1) print *, 'height', height
995 IF (diagnose == 1) print *, 'building_frac', building_frac
996 IF (diagnose == 1) print *, 'veg_frac', veg_frac
997 IF (diagnose == 1) print *, 'building_scale', building_scale
998 IF (diagnose == 1) print *, 'veg_scale', veg_scale
999
1000 IF (diagnose == 1) print *, 'Read roof part of GridLayout'
1001 READ (iunit, nml=roof, iostat=istat)
1002 IF (diagnose == 1) print *, 'sfr_roof', sfr_roof
1003 IF (diagnose == 1) print *, 'dz_roof', dz_roof
1004 IF (diagnose == 1) print *, 'k_roof', k_roof
1005 IF (diagnose == 1) print *, 'cp_roof', cp_roof
1006 IF (diagnose == 1) print *, 'tin_roof', tin_roof
1007 IF (diagnose == 1) print *, 'alb_roof', alb_roof
1008 IF (diagnose == 1) print *, 'emis_roof', emis_roof
1009 IF (diagnose == 1) print *, 'state_roof', state_roof
1010 IF (diagnose == 1) print *, 'statelimit_roof', statelimit_roof
1011 IF (diagnose == 1) print *, 'wetthresh_roof', wetthresh_roof
1012 IF (diagnose == 1) print *, 'soilstore_roof', soilstore_roof
1013 IF (diagnose == 1) print *, 'soilstorecap_roof', soilstorecap_roof
1014
1015 IF (diagnose == 1) print *, 'Read wall part of GridLayout'
1016 READ (iunit, nml=wall, iostat=istat)
1017 IF (diagnose == 1) print *, 'sfr_wall', sfr_wall
1018 IF (diagnose == 1) print *, 'dz_wall', dz_wall
1019 IF (diagnose == 1) print *, 'k_wall', k_wall
1020 IF (diagnose == 1) print *, 'cp_wall', cp_wall
1021 IF (diagnose == 1) print *, 'tin_wall', tin_wall
1022 IF (diagnose == 1) print *, 'alb_wall', alb_wall
1023 IF (diagnose == 1) print *, 'emis_wall', emis_wall
1024 IF (diagnose == 1) print *, 'state_wall', state_wall
1025 IF (diagnose == 1) print *, 'statelimit_wall', statelimit_wall
1026 IF (diagnose == 1) print *, 'wetthresh_wall', wetthresh_wall
1027 IF (diagnose == 1) print *, 'soilstore_wall', soilstore_wall
1028 IF (diagnose == 1) print *, 'soilstorecap_wall', soilstorecap_wall
1029
1030 ! PRINT *, 'Read surf part of GridLayout'
1031 READ (iunit, nml=surf, iostat=istat)
1032 IF (istat /= 0) THEN
1033 backspace(iunit)
1034 READ (iunit, fmt='(A)') line
1035 error_unit = 119
1036 WRITE (error_unit, '(A)') &
1037 'Invalid line in namelist: '//trim(line)
1038 END IF
1039 CLOSE (iunit)
1040
1041 IF (diagnose == 1) print *, 'Read GridLayout'
1042 IF (diagnose == 1) print *, 'sfr_roof in load_GridLayout', sfr_roof
1043 IF (diagnose == 1) print *, 'sfr_wall in load_GridLayout', sfr_wall
1044 IF (diagnose == 1) print *, 'tin_surf in load_GridLayout', tin_surf
1045 IF (diagnose == 1) print *, 'dz_surf(1,:) in load_GridLayout', dz_surf(1, :)
1046 IF (diagnose == 1) print *, 'k_surf(1,:) in load_GridLayout', k_surf(1, :)
1047 IF (diagnose == 1) print *, 'dz_roof in load_GridLayout', dz_roof(1:nlayer, :ndepth)
1048 ! PRINT *, 'dz_roof in load_GridLayout', dz_roof(1, :ndepth)
1049
1050 ! assign values to the grid container
1051 nlayer_grids(gridiv) = nlayer
1052 height_grids(gridiv, 1:nlayer + 1) = height(1:nlayer + 1)
1054 veg_frac_grids(gridiv, 1:nlayer) = veg_frac(1:nlayer)
1056 veg_scale_grids(gridiv, 1:nlayer) = veg_scale(1:nlayer)
1057
1058 ! roof
1059 sfr_roof_grids(gridiv, 1:nlayer) = sfr_roof
1060 tin_roof_grids(gridiv, 1:nlayer) = tin_roof
1061 DO i = 1, nlayer
1062 temp_roof_grids(gridiv, i, :) = tin_roof(i)
1063 END DO
1064 dz_roof_grids(gridiv, 1:nlayer, 1:ndepth) = dz_roof(1:nlayer, 1:ndepth)
1065 k_roof_grids(gridiv, 1:nlayer, 1:ndepth) = k_roof(1:nlayer, 1:ndepth)
1066 cp_roof_grids(gridiv, 1:nlayer, 1:ndepth) = cp_roof(1:nlayer, 1:ndepth)
1067 alb_roof_grids(gridiv, 1:nlayer) = alb_roof(1:nlayer)
1068 emis_roof_grids(gridiv, 1:nlayer) = emis_roof(1:nlayer)
1075 ! PRINT *, 'dz_roof_grids in loading', dz_roof_grids(Gridiv, 1:nroof, 1:ndepth)
1076 ! PRINT *, 'dz_roof_grids(1,1) in loading', dz_roof_grids(Gridiv, 1, 1:ndepth)
1077 ! tsfc_roof_grids(gridIV) = tsfc_roof
1078 ! tin_roof_grids(gridIV) = temp_in_roof
1079
1080 ! wall
1081 sfr_wall_grids(gridiv, 1:nlayer) = sfr_wall
1082 tin_wall_grids(gridiv, 1:nlayer) = tin_wall
1083 DO i = 1, nlayer
1084 temp_wall_grids(gridiv, i, :) = tin_wall(i)
1085 END DO
1086 dz_wall_grids(gridiv, 1:nlayer, 1:ndepth) = dz_wall(1:nlayer, 1:ndepth)
1087 k_wall_grids(gridiv, 1:nlayer, 1:ndepth) = k_wall(1:nlayer, 1:ndepth)
1088 cp_wall_grids(gridiv, 1:nlayer, 1:ndepth) = cp_wall(1:nlayer, 1:ndepth)
1089 alb_wall_grids(gridiv, 1:nlayer) = alb_wall(1:nlayer)
1090 emis_wall_grids(gridiv, 1:nlayer) = emis_wall(1:nlayer)
1097 ! PRINT *, 'dz_wall_grids in loading', dz_wall_grids(Gridiv, 1:nwall, 1:ndepth)
1098 ! PRINT *, 'dz_wall_grids(1,1) in loading', dz_wall_grids(Gridiv, 1, 1:ndepth)
1099 ! tsfc_wall_grids(gridIV) = tsfc_wall
1100 ! tin_wall_grids(gridIV) = temp_in_wall
1101
1102 ! generic surfaces
1103 tin_surf_grids(gridiv, 1:nsurf) = tin_surf
1104 ! DO i = 1, nsurf
1105 ! tin_surf_grids(gridIV, i, :) = tin_surf(i)
1106 ! END DO
1107 dz_surf_grids(gridiv, 1:nsurf, 1:ndepth) = dz_surf(1:nsurf, 1:ndepth)
1108 k_surf_grids(gridiv, 1:nsurf, 1:ndepth) = k_surf(1:nsurf, 1:ndepth)
1109 cp_surf_grids(gridiv, 1:nsurf, 1:ndepth) = cp_surf(1:nsurf, 1:ndepth)
1110
1111 ! ! check if CFL condition is met
1112 ! DO igroup = 1, 3
1113 ! DO ilayer = 1, merge(nlayer,7,igroup<3)
1114 ! idepth = 1
1115 ! ! DO idepth = 1, ndepth
1116 ! IF (igroup == 1) THEN
1117 ! k = k_roof_grids(gridIV, ilayer, idepth)
1118 ! dz = dz_roof_grids(gridIV, ilayer, idepth)
1119 ! str_igroup='roof'
1120 ! ELSE IF (igroup == 2) THEN
1121 ! k = k_wall_grids(gridIV, ilayer, idepth)
1122 ! dz = dz_wall_grids(gridIV, ilayer, idepth)
1123 ! str_igroup='wall'
1124 ! ELSE IF (igroup == 3) THEN
1125 ! k = k_surf_grids(gridIV, ilayer, idepth)
1126 ! dz = dz_surf_grids(gridIV, ilayer, idepth)
1127 ! str_igroup='surf'
1128 ! END IF
1129
1130 ! IF (dz/k > 0.02) THEN
1131 ! PRINT *, 'CFL condition, dz/k < 0.02, is not met for top layer of:'
1132 ! PRINT *, 'grid', gridIV
1133
1134 ! PRINT *, 'group: ', str_igroup
1135 ! PRINT *, 'layer', ilayer
1136 ! PRINT *, 'dz/k=', dz/k
1137 ! PRINT *, 'dz=', dz
1138 ! PRINT *, 'k=', k
1139 ! PRINT *, ''
1140 ! WRITE (str_gridIV, '(I5.5)') gridIV
1141 ! ! WRITE (str_igroup, '(I5.5)') igroup
1142 ! WRITE (str_idepth, '(I5.5)') idepth
1143 ! WRITE (str_ilayer, '(I5.5)') ilayer
1144
1145 ! CALL ErrorHint(77, 'CFL condition is not met for '// &
1146 ! 'grid: '//TRIM(str_gridIV)// &
1147 ! ', group: '//TRIM(str_igroup)// &
1148 ! ', layer: '//TRIM(str_ilayer)// &
1149 ! ', depth: '//TRIM(str_idepth) &
1150 ! , dz/k, idepth*1.D0, ilayer)
1151 ! END IF
1152 ! ! END DO
1153 ! END DO
1154
1155 ! END DO
1156
1157 DEALLOCATE (height)
1158 DEALLOCATE (building_frac)
1159 DEALLOCATE (veg_frac)
1160 DEALLOCATE (building_scale)
1161 DEALLOCATE (veg_scale)
1162
1163 DEALLOCATE (sfr_roof)
1164 DEALLOCATE (alb_roof)
1165 DEALLOCATE (emis_roof)
1166 DEALLOCATE (state_roof)
1167 DEALLOCATE (statelimit_roof)
1168 DEALLOCATE (wetthresh_roof)
1169 DEALLOCATE (soilstore_roof)
1170 DEALLOCATE (soilstorecap_roof)
1171 DEALLOCATE (dz_roof)
1172 DEALLOCATE (k_roof)
1173 DEALLOCATE (cp_roof)
1174 DEALLOCATE (tin_roof)
1175 DEALLOCATE (roof_albedo_dir_mult_fact)
1176
1177 DEALLOCATE (sfr_wall)
1178 DEALLOCATE (alb_wall)
1179 DEALLOCATE (emis_wall)
1180 DEALLOCATE (state_wall)
1181 DEALLOCATE (statelimit_wall)
1182 DEALLOCATE (wetthresh_wall)
1183 DEALLOCATE (soilstore_wall)
1184 DEALLOCATE (soilstorecap_wall)
1185 DEALLOCATE (dz_wall)
1186 DEALLOCATE (k_wall)
1187 DEALLOCATE (cp_wall)
1188 DEALLOCATE (tin_wall)
1189 DEALLOCATE (wall_specular_frac)
1190
1191 DEALLOCATE (tin_surf)
1192 DEALLOCATE (dz_surf)
1193 DEALLOCATE (k_surf)
1194 DEALLOCATE (cp_surf)
1195
real(kind(1d0)), dimension(:), allocatable statelimit_wall
real(kind(1d0)), dimension(:, :), allocatable dz_wall
real(kind(1d0)), dimension(:), allocatable soilstorecap_wall
real(kind(1d0)), dimension(:), allocatable alb_roof
real(kind(1d0)), dimension(:), allocatable state_wall
real(kind(1d0)), dimension(:), allocatable wetthresh_wall
real(kind(1d0)), dimension(:), allocatable state_roof
real(kind(1d0)), dimension(:, :), allocatable dz_surf
real(kind(1d0)), dimension(:), allocatable sfr_roof
real(kind(1d0)), dimension(:), allocatable building_scale
real(kind(1d0)), dimension(:), allocatable soilstore_roof
real(kind(1d0)), dimension(:), allocatable height
real(kind(1d0)), dimension(:, :), allocatable cp_wall
real(kind(1d0)), dimension(:), allocatable emis_roof
real(kind(1d0)), dimension(:, :), allocatable cp_surf
real(kind(1d0)), dimension(:, :), allocatable k_roof
real(kind(1d0)), dimension(:), allocatable wetthresh_roof
real(kind(1d0)), dimension(:), allocatable soilstorecap_roof
real(kind(1d0)), dimension(:), allocatable veg_frac
real(kind(1d0)), dimension(:, :), allocatable k_surf
real(kind(1d0)), dimension(:, :), allocatable roof_albedo_dir_mult_fact
real(kind(1d0)), dimension(:), allocatable tin_surf
real(kind(1d0)), dimension(:), allocatable tin_wall
real(kind(1d0)), dimension(:), allocatable statelimit_roof
real(kind(1d0)), dimension(:), allocatable alb_wall
real(kind(1d0)), dimension(:, :), allocatable wall_specular_frac
real(kind(1d0)), dimension(:, :), allocatable dz_roof
real(kind(1d0)), dimension(:), allocatable emis_wall
real(kind(1d0)), dimension(:, :), allocatable cp_roof
real(kind(1d0)), dimension(:), allocatable building_frac
real(kind(1d0)), dimension(:, :), allocatable k_wall
real(kind(1d0)), dimension(:), allocatable sfr_wall
real(kind(1d0)), dimension(:), allocatable veg_scale
real(kind(1d0)), dimension(:), allocatable tin_roof
real(kind(1d0)), dimension(:), allocatable soilstore_wall
character(len=20) filecode

References allocatearray::alb_roof, allocatearray::alb_roof_grids, allocatearray::alb_wall, allocatearray::alb_wall_grids, allocatearray::building_frac, allocatearray::building_frac_grids, allocatearray::building_scale, allocatearray::building_scale_grids, allocatearray::cp_roof, allocatearray::cp_roof_grids, allocatearray::cp_surf, allocatearray::cp_surf_grids, allocatearray::cp_wall, allocatearray::cp_wall_grids, allocatearray::dz_roof, allocatearray::dz_roof_grids, allocatearray::dz_surf, allocatearray::dz_surf_grids, allocatearray::dz_wall, allocatearray::dz_wall_grids, allocatearray::emis_roof, allocatearray::emis_roof_grids, allocatearray::emis_wall, allocatearray::emis_wall_grids, data_in::filecode, data_in::fileinputpath, allocatearray::height, allocatearray::height_grids, allocatearray::k_roof, allocatearray::k_roof_grids, allocatearray::k_surf, allocatearray::k_surf_grids, allocatearray::k_wall, allocatearray::k_wall_grids, allocatearray::ndepth, allocatearray::nlayer, allocatearray::nlayer_grids, allocatearray::nspec, allocatearray::nsurf, allocatearray::roof_albedo_dir_mult_fact, allocatearray::roof_albedo_dir_mult_fact_grids, allocatearray::sfr_roof, allocatearray::sfr_roof_grids, allocatearray::sfr_wall, allocatearray::sfr_wall_grids, allocatearray::soilstore_roof, allocatearray::soilstore_roof_grids, allocatearray::soilstore_wall, allocatearray::soilstore_wall_grids, allocatearray::soilstorecap_roof, allocatearray::soilstorecap_roof_grids, allocatearray::soilstorecap_wall, allocatearray::soilstorecap_wall_grids, allocatearray::state_roof, allocatearray::state_roof_grids, allocatearray::state_wall, allocatearray::state_wall_grids, allocatearray::statelimit_roof, allocatearray::statelimit_roof_grids, allocatearray::statelimit_wall, allocatearray::statelimit_wall_grids, allocatearray::temp_roof_grids, allocatearray::temp_wall_grids, allocatearray::tin_roof, allocatearray::tin_roof_grids, allocatearray::tin_surf, allocatearray::tin_surf_grids, allocatearray::tin_wall, allocatearray::tin_wall_grids, allocatearray::veg_frac, allocatearray::veg_frac_grids, allocatearray::veg_scale, allocatearray::veg_scale_grids, allocatearray::wall_specular_frac, allocatearray::wall_specular_frac_grids, allocatearray::wetthresh_roof, allocatearray::wetthresh_roof_grids, allocatearray::wetthresh_wall, and allocatearray::wetthresh_wall_grids.

Referenced by estm_ehc_initialise().

Here is the caller graph for this function:

◆ set_nan()

elemental real(kind(1d0)) function estm_module::set_nan ( real(kind(1d0)), intent(in) x)

Definition at line 2663 of file suews_phys_estm.f95.

2664 IMPLICIT NONE
2665 REAL(KIND(1D0)), PARAMETER :: pNAN = 9999
2666 REAL(KIND(1D0)), PARAMETER :: NAN = -999
2667 REAL(KIND(1D0)), INTENT(in) :: x
2668 REAL(KIND(1D0)) :: xx
2669
2670 IF (abs(x) > pnan) THEN
2671 xx = nan
2672 ELSE
2673 xx = x
2674 END IF
2675

Referenced by estm().

Here is the caller graph for this function:

◆ suews_getestmdata()

subroutine estm_module::suews_getestmdata ( integer, intent(in) lunit)

Definition at line 719 of file suews_phys_estm.f95.

722 USE sues_data, ONLY: tstep_real, tstep
723 USE defaultnotused, ONLY: notused, ios_out
725
726 IMPLICIT NONE
727
728 INTEGER, INTENT(in) :: lunit
729 INTEGER :: i, iyy !,RunNumber,NSHcounter
730 INTEGER :: iostat_var
731 REAL(KIND(1D0)), DIMENSION(ncolsESTMdata) :: ESTMArray
732 REAL(KIND(1D0)) :: imin_prev, ih_prev, iday_prev, tstep_estm !For checks on temporal resolution of estm data
733
734 ! initialise
735 imin_prev = 0
736 ih_prev = 0
737 iday_prev = 0
738
739 !---------------------------------------------------------------
740
741 !Open the file for reading and read the actual data
742 !write(*,*) FileESTMTs
743 OPEN (lunit, file=trim(fileestmts), status='old', err=315)
744 CALL skipheader(lunit, skipheadermet)
745
746 ! Skip to the right place in the ESTM file, depending on how many chunks have been read already
747 IF (skippedlines > 0) THEN
748 DO iyy = 1, skippedlines
749 READ (lunit, *)
750 END DO
751 END IF
752
753 ! Read in next chunk of ESTM data and fill ESTMForcingData array with data for every timestep
754 DO i = 1, readlinesmetdata
755 READ (lunit, *, iostat=iostat_var) estmarray
756 estmforcingdata(i, 1:ncolsestmdata, gridcounter) = estmarray
757 ! Check timestamp of met data file matches TSTEP specified in RunControl
758 IF (i == 1) THEN
759 imin_prev = estmarray(4)
760 ih_prev = estmarray(3)
761 iday_prev = estmarray(2)
762 ELSEIF (i == 2) THEN
763 tstep_estm = ((estmarray(4) + 60*estmarray(3)) - (imin_prev + 60*ih_prev))*60 !tstep in seconds
764 IF (tstep_estm /= tstep_real .AND. estmarray(2) == iday_prev) THEN
765 CALL errorhint(39, 'TSTEP in RunControl does not match TSTEP of ESTM data (DOY).', &
766 REAL(tstep, KIND(1D0)), tstep_estm, INT(ESTMArray(2)))
767 END IF
768 END IF
769 END DO
770
771 CLOSE (lunit)
772
773 RETURN
774
775315 CALL errorhint(11, trim(fileestmts), notused, notused, ios_out)
776
character(len=150) fileestmts
integer skipheadermet
real(kind(1d0)) notused
integer readlinesmetdata
integer gridcounter
integer skippedlines
real(kind(1d0)) tstep_real
subroutine errorhint(errh, problemfile, value, value2, valuei)
subroutine skipheader(lfn, skip)

References errorhint(), allocatearray::estmforcingdata, data_in::fileestmts, initial::gridcounter, defaultnotused::ios_out, allocatearray::ncolsestmdata, defaultnotused::notused, initial::readlinesmetdata, skipheader(), data_in::skipheadermet, initial::skippedlines, sues_data::tstep, and sues_data::tstep_real.

Here is the call graph for this function: