SUEWS API Site
Documentation of SUEWS source code
Functions/Subroutines
suews_ctrl_init.f95 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine overallruncontrol
 
subroutine readcoeff (FileName, nlines, ncolumns, HeaderFile, Coeff)
 
subroutine numberrows (FileN, SkipHeaderLines)
 
subroutine initializesurfacecharacteristics (Gridiv, rr)
 
subroutine initialstate (GridName, year_int, Gridiv, NumberOfGrids)
 
real(kind(1d0)) function normalizevegchar (VegCol, Gridiv)
 
subroutine nextinitial (GridName, year_int)
 
subroutine suews_initializemetdata (lunit)
 
subroutine checkinitial
 

Function/Subroutine Documentation

◆ checkinitial()

subroutine checkinitial ( )

Definition at line 2297 of file suews_ctrl_init.f95.

References allocatearray::bldgsurf, allocatearray::bsoilsurf, allocatearray::conifsurf, snowmod::crwmax, allocatearray::decidsurf, errorhint(), allocatearray::grasssurf, time::id, initialcond::laiinitialdectr, initialcond::laiinitialevetr, initialcond::laiinitialgrass, allocatearray::laimax, allocatearray::laimin, data_in::lat, defaultnotused::notusedi, allocatearray::pavsurf, initialcond::snowpackbldgs, initialcond::snowpackbsoil, initialcond::snowpackdectr, initialcond::snowpackevetr, initialcond::snowpackgrass, initialcond::snowpackpaved, data_in::snowuse, initialcond::snowwaterbldgsstate, initialcond::snowwaterbsoilstate, initialcond::snowwaterdectrstate, initialcond::snowwaterevetrstate, initialcond::snowwatergrassstate, initialcond::snowwaterpavedstate, initialcond::soilstorebldgsstate, initialcond::soilstorebsoilstate, allocatearray::soilstorecap, initialcond::soilstoredectrstate, initialcond::soilstoreevetrstate, initialcond::soilstoregrassstate, initialcond::soilstorepavedstate, data_in::temp_c, and initialcond::temp_c0.

Referenced by suews_translate().

2297  !Check the parameters in InitialConditions file.
2298  !Modified by HCW 04 Mar 2014, changed soilstore_id(is) checks to use names given in InitialConditions
2299  !Added by LJ in 8/2/2013
2300 
2301  USE allocatearray
2302  USE data_in
2303  USE defaultnotused
2304  USE initialcond
2305  USE snowmod
2306  USE time
2307 
2308  IMPLICIT NONE
2309 
2310  !real(kind(1d0)):: pTol !Precision tolerance for range checks
2311 
2312  IF (temp_c0 < (temp_c - 10) .OR. temp_c0 > (temp_c + 10)) THEN
2313  CALL errorhint(37, 'Temp_C0 very different to Tair.', temp_c0, temp_c, notusedi)
2314  ENDIF
2315 
2316  !Check more thoroughly if LAI values are OK. Need to treat different hemispheres as well as tropics separately.
2317  IF (lat > 40) THEN
2318  IF ((laiinitialevetr > laimin(conifsurf - 2) + 1 .AND. (id < 60 .OR. id > 330)) .OR. &
2319  (laiinitialevetr < laimax(conifsurf - 2) - 1 .AND. (id > 130 .AND. id < 244))) THEN
2320  CALL errorhint(37, 'Check LAIinitialEveTr in InitialConditions file', laiinitialevetr, laimin(conifsurf - 2), notusedi)
2321  ENDIF
2322  IF ((laiinitialdectr > laimin(decidsurf - 2) + 1 .AND. (id < 60 .OR. id > 330)) .OR. &
2323  (laiinitialdectr < laimax(decidsurf - 2) - 1 .AND. (id > 130 .AND. id < 244))) THEN
2324  CALL errorhint(37, 'Check LAIinitialDecTr in InitialConditions file', laiinitialdectr, laimin(decidsurf - 2), notusedi)
2325  ENDIF
2326  IF ((laiinitialgrass > laimin(grasssurf - 2) + 1 .AND. (id < 60 .OR. id > 330)) .OR. &
2327  (laiinitialgrass < laimax(grasssurf - 2) - 1 .AND. (id > 130 .AND. id < 244))) THEN
2328  CALL errorhint(37, 'Check LAIinitialGrass in InitialConditions file', laiinitialgrass, laimin(grasssurf - 2), notusedi)
2329  ENDIF
2330 
2331  ELSEIF (lat < -40) THEN
2332  IF ((laiinitialevetr < laimax(conifsurf - 2) - 1 .AND. (id < 60 .OR. id > 330)) .OR. &
2333  (laiinitialevetr > laimin(conifsurf - 2) + 1 .AND. (id > 130 .AND. id < 244))) THEN
2334  CALL errorhint(37, 'Check LAIinitialEveTr in InitialConditions file', laiinitialevetr, laimax(conifsurf - 2), notusedi)
2335  ENDIF
2336  IF ((laiinitialdectr > laimax(decidsurf - 2) - 1 .AND. (id < 60 .OR. id > 330)) .OR. &
2337  (laiinitialdectr > laimin(decidsurf - 2) + 1 .AND. (id > 130 .AND. id < 244))) THEN
2338  CALL errorhint(37, 'Check LAIinitialDecTr in InitialConditions file', laiinitialdectr, laimax(decidsurf - 2), notusedi)
2339  ENDIF
2340  IF ((laiinitialgrass < laimax(grasssurf - 2) - 1 .AND. (id < 60 .OR. id > 330)) .OR. &
2341  (laiinitialgrass > laimin(grasssurf - 2) + 1 .AND. (id > 130 .AND. id < 244))) THEN
2342  CALL errorhint(37, 'Check LAIinitialGrass in InitialConditions file', laiinitialgrass, laimax(grasssurf - 2), notusedi)
2343  ENDIF
2344 
2345  ELSEIF (lat < 10 .AND. lat > -10) THEN
2346 
2347  IF (laiinitialevetr < laimax(conifsurf - 2) - 0.5) THEN
2348  CALL errorhint(37, 'Check LAIinitialEveTr in InitialConditions file', laiinitialevetr, laimax(conifsurf - 2), notusedi)
2349  ENDIF
2350  IF (laiinitialdectr < laimax(decidsurf - 2) - 0.5) THEN
2351  CALL errorhint(37, 'Check LAIinitialDecTr in InitialConditions file', laiinitialdectr, laimax(decidsurf - 2), notusedi)
2352  ENDIF
2353  IF (laiinitialgrass < laimax(grasssurf - 2) - 0.5) THEN
2354  CALL errorhint(37, 'Check LAIinitialGrass in InitialConditions file', laiinitialgrass, laimax(grasssurf - 2), notusedi)
2355  ENDIF
2356 
2357  ENDIF
2358 
2359  !Soilstore check
2361  CALL errorhint(37, 'InitialCond: Check initial condition of building soil store.', &
2363  ENDIF
2365  CALL errorhint(37, 'InitialCond: Check initial condition of paved soil store.', &
2367  ENDIF
2369  CALL errorhint(37, 'InitialCond: Check initial condition of conif soil store.', &
2371  ENDIF
2373  CALL errorhint(37, 'InitialCond: Check initial condition of deciduous soil store.', &
2375  ENDIF
2377  CALL errorhint(37, 'InitialCond: Check initial condition of bare soil soil store.', &
2379  ENDIF
2381  CALL errorhint(37, 'InitialCond: Check initial condition of grass soil store.', &
2383  ENDIF
2384 
2385  !Snow stuff
2386  IF (snowuse == 1) THEN
2388  CALL errorhint(37, 'InitialCond: SnowWaterBldgsState', snowwaterbldgsstate, snowpackbldgs, notusedi)
2389  ENDIF
2391  CALL errorhint(37, 'InitialCond: SnowWaterPavedState', snowwaterpavedstate, snowpackpaved, notusedi)
2392  ENDIF
2394  CALL errorhint(37, 'InitialCond: SnowWaterEveTrstate', snowwaterevetrstate, snowpackevetr, notusedi)
2395  ENDIF
2397  CALL errorhint(37, 'InitialCond: SnowWaterDecTrState', snowwaterdectrstate, snowpackdectr, notusedi)
2398  ENDIF
2400  CALL errorhint(37, 'InitialCond: SnowWaterGrassState', snowwatergrassstate, snowpackgrass, notusedi)
2401  ENDIF
2403  CALL errorhint(37, 'InitialCond: SnowWaterGrassUnirState', snowwaterbsoilstate, snowpackbsoil, notusedi)
2404  ENDIF
2405  ENDIF
2406 
real(kind(1d0)) soilstorebldgsstate
real(kind(1d0)) snowpackbsoil
real(kind(1d0)), dimension(nvegsurf) laimax
integer, parameter bsoilsurf
real(kind(1d0)) temp_c
real(kind(1d0)) temp_c0
integer snowuse
real(kind(1d0)) snowwaterbldgsstate
real(kind(1d0)) soilstorepavedstate
real(kind(1d0)) snowpackdectr
real(kind(1d0)) soilstoregrassstate
real(kind(1d0)) snowwatergrassstate
real(kind(1d0)), dimension(nsurf) soilstorecap
real(kind(1d0)) snowpackbldgs
real(kind(1d0)) snowwaterbsoilstate
integer, parameter conifsurf
integer id
real(kind(1d0)) snowwaterevetrstate
real(kind(1d0)) laiinitialdectr
real(kind(1d0)) lat
integer, parameter grasssurf
real(kind(1d0)) snowpackpaved
real(kind(1d0)) snowpackgrass
real(kind(1d0)), dimension(nvegsurf) laimin
real(kind(1d0)) soilstorebsoilstate
real(kind(1d0)) snowpackevetr
real(kind(1d0)) snowwaterpavedstate
real(kind(1d0)) laiinitialevetr
real(kind(1d0)) soilstoredectrstate
real(kind(1d0)) laiinitialgrass
real(kind(1d0)) snowwaterdectrstate
integer, parameter decidsurf
integer, parameter pavsurf
real(kind(1d0)) soilstoreevetrstate
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
integer, parameter bldgsurf
real(kind(1d0)) crwmax
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializesurfacecharacteristics()

subroutine initializesurfacecharacteristics ( integer  Gridiv,
integer  rr 
)

Definition at line 454 of file suews_ctrl_init.f95.

References allocatearray::anthropogenic_coeff, allocatearray::biogen_coeff, allocatearray::bldgsurf, allocatearray::bsoilsurf, allocatearray::c_a1_sdry, allocatearray::c_a1_swet, allocatearray::c_a1_wdry, allocatearray::c_a1_wwet, allocatearray::c_a2_sdry, allocatearray::c_a2_swet, allocatearray::c_a2_wdry, allocatearray::c_a2_wwet, allocatearray::c_a3_sdry, allocatearray::c_a3_swet, allocatearray::c_a3_wdry, allocatearray::c_a3_wwet, allocatearray::c_ahmin_wd, allocatearray::c_ahmin_we, allocatearray::c_ahslopecooling_wd, allocatearray::c_ahslopecooling_we, allocatearray::c_ahslopeheating_wd, allocatearray::c_ahslopeheating_we, allocatearray::c_alb_ibld, allocatearray::c_alb_ibld_bldgs, allocatearray::c_albmax, allocatearray::c_albmin, allocatearray::c_alpha_bioco2, allocatearray::c_alpha_enh_bioco2, allocatearray::c_baset, allocatearray::c_basete, allocatearray::c_basethdd, allocatearray::c_beta_bioco2, allocatearray::c_beta_enh_bioco2, allocatearray::c_biogenco2code, colnamesinputfiles::c_bldgscode, colnamesinputfiles::c_bsoilcode, allocatearray::c_ch_ibld, allocatearray::c_ch_ibld_bldgs, allocatearray::c_ch_iroof, allocatearray::c_ch_iroof_bldgs, allocatearray::c_ch_iwall, allocatearray::c_ch_iwall_bldgs, allocatearray::c_chanohm, allocatearray::c_co2mwd, allocatearray::c_co2mwe, allocatearray::c_co2pointsource, colnamesinputfiles::c_condcode, allocatearray::c_cpanohm, allocatearray::c_daywat, allocatearray::c_daywatper, colnamesinputfiles::c_dectrcode, allocatearray::c_drcoef1, allocatearray::c_drcoef2, allocatearray::c_dreq, allocatearray::c_ef_umolco2perj, allocatearray::c_em_ibld, allocatearray::c_em_ibld_bldgs, allocatearray::c_emis, allocatearray::c_enef_v_jkm, allocatearray::c_enprofwd, allocatearray::c_enprofwe, allocatearray::c_estmcode, colnamesinputfiles::c_evetrcode, allocatearray::c_faut, allocatearray::c_fcef_v_kgkmwd, allocatearray::c_fcef_v_kgkmwe, allocatearray::c_frfossilfuel_heat, allocatearray::c_frfossilfuel_nonheat, allocatearray::c_frpddwe, allocatearray::c_gddfull, colnamesinputfiles::c_grasscode, allocatearray::c_gsg1, allocatearray::c_gsg2, allocatearray::c_gsg3, allocatearray::c_gsg4, allocatearray::c_gsg5, allocatearray::c_gsg6, allocatearray::c_gskmax, allocatearray::c_gsmax, allocatearray::c_gsmodel, allocatearray::c_gss1, allocatearray::c_gss2, allocatearray::c_gsth, allocatearray::c_gstl, allocatearray::c_hrprofenusewd, allocatearray::c_hrprofenusewe, allocatearray::c_hrprofhumactivitywd, allocatearray::c_hrprofhumactivitywe, allocatearray::c_hrprofpopwd, allocatearray::c_hrprofpopwe, allocatearray::c_hrprofsnowcwd, allocatearray::c_hrprofsnowcwe, allocatearray::c_hrproftraffwd, allocatearray::c_hrproftraffwe, allocatearray::c_hrprofwuautowd, allocatearray::c_hrprofwuautowe, allocatearray::c_hrprofwumanuwd, allocatearray::c_hrprofwumanuwe, allocatearray::c_ie_a, allocatearray::c_ie_m, allocatearray::c_ieend, allocatearray::c_iestart, allocatearray::c_internal_k1, allocatearray::c_internal_k1_bldgs, allocatearray::c_internal_k2, allocatearray::c_internal_k2_bldgs, allocatearray::c_internal_k3, allocatearray::c_internal_k3_bldgs, allocatearray::c_internal_k4, allocatearray::c_internal_k4_bldgs, allocatearray::c_internal_k5, allocatearray::c_internal_k5_bldgs, allocatearray::c_internal_rhocp1, allocatearray::c_internal_rhocp1_bldgs, allocatearray::c_internal_rhocp2, allocatearray::c_internal_rhocp2_bldgs, allocatearray::c_internal_rhocp3, allocatearray::c_internal_rhocp3_bldgs, allocatearray::c_internal_rhocp4, allocatearray::c_internal_rhocp4_bldgs, allocatearray::c_internal_rhocp5, allocatearray::c_internal_rhocp5_bldgs, allocatearray::c_internal_thick1, allocatearray::c_internal_thick1_bldgs, allocatearray::c_internal_thick2, allocatearray::c_internal_thick2_bldgs, allocatearray::c_internal_thick3, allocatearray::c_internal_thick3_bldgs, allocatearray::c_internal_thick4, allocatearray::c_internal_thick4_bldgs, allocatearray::c_internal_thick5, allocatearray::c_internal_thick5_bldgs, allocatearray::c_intwu, colnamesinputfiles::c_irrcode, allocatearray::c_kkanohm, allocatearray::c_ksat, allocatearray::c_laieq, allocatearray::c_laimax, allocatearray::c_laimin, allocatearray::c_leafgp1, allocatearray::c_leafgp2, allocatearray::c_leafop1, allocatearray::c_leafop2, allocatearray::c_maxfcmetab, allocatearray::c_maxqfmetab, allocatearray::c_min_res_bioco2, allocatearray::c_minfcmetab, allocatearray::c_minqfmetab, allocatearray::c_nroom, allocatearray::c_nroom_bldgs, allocatearray::c_obssmdepth, allocatearray::c_obssmmax, allocatearray::c_obssnrfrac, allocatearray::c_ohmcode_sdry, allocatearray::c_ohmcode_swet, allocatearray::c_ohmcode_wdry, allocatearray::c_ohmcode_wwet, allocatearray::c_ohmthresh_sw, allocatearray::c_ohmthresh_wd, colnamesinputfiles::c_pavedcode, allocatearray::c_popprofwd, allocatearray::c_popprofwe, allocatearray::c_porositymax, allocatearray::c_porositymin, allocatearray::c_qf_a1, allocatearray::c_qf_a2, allocatearray::c_qf_b1, allocatearray::c_qf_b2, allocatearray::c_qf_c1, allocatearray::c_qf_c2, colnamesinputfiles::c_qfcode, allocatearray::c_resp_a, allocatearray::c_resp_b, allocatearray::c_sddfull, allocatearray::c_snowalbmax, allocatearray::c_snowalbmin, colnamesinputfiles::c_snowcode, allocatearray::c_snowcrwmax, allocatearray::c_snowcrwmin, allocatearray::c_snowemis, allocatearray::c_snowlimpat, allocatearray::c_snowlimrem, allocatearray::c_snowplimalb, allocatearray::c_snowplimsnow, colnamesinputfiles::c_snowprofwd, colnamesinputfiles::c_snowprofwe, allocatearray::c_snowrmfactor, allocatearray::c_snowsdmax, allocatearray::c_snowsdmin, allocatearray::c_snowtau_a, allocatearray::c_snowtau_f, allocatearray::c_snowtau_r, allocatearray::c_snowtmfactor, allocatearray::c_soildens, allocatearray::c_soildepth, allocatearray::c_soilinfrate, allocatearray::c_soilstcap, allocatearray::c_soiltcode, allocatearray::c_statelimit, allocatearray::c_stormax, allocatearray::c_stormin, allocatearray::c_surf_k1, allocatearray::c_surf_k1_bldgs, allocatearray::c_surf_k1_paved, allocatearray::c_surf_k2, allocatearray::c_surf_k2_bldgs, allocatearray::c_surf_k2_paved, allocatearray::c_surf_k3, allocatearray::c_surf_k3_bldgs, allocatearray::c_surf_k3_paved, allocatearray::c_surf_k4, allocatearray::c_surf_k4_bldgs, allocatearray::c_surf_k4_paved, allocatearray::c_surf_k5, allocatearray::c_surf_k5_bldgs, allocatearray::c_surf_k5_paved, allocatearray::c_surf_rhocp1, allocatearray::c_surf_rhocp1_bldgs, allocatearray::c_surf_rhocp1_paved, allocatearray::c_surf_rhocp2, allocatearray::c_surf_rhocp2_bldgs, allocatearray::c_surf_rhocp2_paved, allocatearray::c_surf_rhocp3, allocatearray::c_surf_rhocp3_bldgs, allocatearray::c_surf_rhocp3_paved, allocatearray::c_surf_rhocp4, allocatearray::c_surf_rhocp4_bldgs, allocatearray::c_surf_rhocp4_paved, allocatearray::c_surf_rhocp5, allocatearray::c_surf_rhocp5_bldgs, allocatearray::c_surf_rhocp5_paved, allocatearray::c_surf_thick1, allocatearray::c_surf_thick1_bldgs, allocatearray::c_surf_thick1_paved, allocatearray::c_surf_thick2, allocatearray::c_surf_thick2_bldgs, allocatearray::c_surf_thick2_paved, allocatearray::c_surf_thick3, allocatearray::c_surf_thick3_bldgs, allocatearray::c_surf_thick3_paved, allocatearray::c_surf_thick4, allocatearray::c_surf_thick4_bldgs, allocatearray::c_surf_thick4_paved, allocatearray::c_surf_thick5, allocatearray::c_surf_thick5_bldgs, allocatearray::c_surf_thick5_paved, allocatearray::c_tcriticcooling_wd, allocatearray::c_tcriticcooling_we, allocatearray::c_tcriticheating_wd, allocatearray::c_tcriticheating_we, allocatearray::c_theta_bioco2, allocatearray::c_trafficunits, allocatearray::c_traffprofwd, allocatearray::c_traffprofwe, allocatearray::c_wall_k1, allocatearray::c_wall_k1_bldgs, allocatearray::c_wall_k2, allocatearray::c_wall_k2_bldgs, allocatearray::c_wall_k3, allocatearray::c_wall_k3_bldgs, allocatearray::c_wall_k4, allocatearray::c_wall_k4_bldgs, allocatearray::c_wall_k5, allocatearray::c_wall_k5_bldgs, allocatearray::c_wall_rhocp1, allocatearray::c_wall_rhocp1_bldgs, allocatearray::c_wall_rhocp2, allocatearray::c_wall_rhocp2_bldgs, allocatearray::c_wall_rhocp3, allocatearray::c_wall_rhocp3_bldgs, allocatearray::c_wall_rhocp4, allocatearray::c_wall_rhocp4_bldgs, allocatearray::c_wall_rhocp5, allocatearray::c_wall_rhocp5_bldgs, allocatearray::c_wall_thick1, allocatearray::c_wall_thick1_bldgs, allocatearray::c_wall_thick2, allocatearray::c_wall_thick2_bldgs, allocatearray::c_wall_thick3, allocatearray::c_wall_thick3_bldgs, allocatearray::c_wall_thick4, allocatearray::c_wall_thick4_bldgs, allocatearray::c_wall_thick5, allocatearray::c_wall_thick5_bldgs, colnamesinputfiles::c_watercode, allocatearray::c_waterdepth, allocatearray::c_wetthresh, colnamesinputfiles::c_wgbldgscode, colnamesinputfiles::c_wgbsoilcode, colnamesinputfiles::c_wgdectrcode, colnamesinputfiles::c_wgevetrcode, colnamesinputfiles::c_wggrasscode, colnamesinputfiles::c_wgpavedcode, allocatearray::c_wgtobldgs, allocatearray::c_wgtobsoil, allocatearray::c_wgtodectr, allocatearray::c_wgtoevetr, allocatearray::c_wgtograss, allocatearray::c_wgtopaved, allocatearray::c_wgtorunoff, allocatearray::c_wgtosoilstore, allocatearray::c_wgtowater, colnamesinputfiles::c_wgwatercode, colnamesinputfiles::c_wprofautowd, colnamesinputfiles::c_wprofautowe, colnamesinputfiles::c_wprofmanuwd, colnamesinputfiles::c_wprofmanuwe, colnamesinputfiles::ca_ahmin_wd, colnamesinputfiles::ca_ahmin_we, colnamesinputfiles::ca_ahslopecooling_wd, colnamesinputfiles::ca_ahslopecooling_we, colnamesinputfiles::ca_ahslopeheating_wd, colnamesinputfiles::ca_ahslopeheating_we, colnamesinputfiles::ca_basethdd, colnamesinputfiles::ca_co2mwd, colnamesinputfiles::ca_co2mwe, colnamesinputfiles::ca_co2pointsource, colnamesinputfiles::ca_ef_umolco2perj, colnamesinputfiles::ca_enef_v_jkm, colnamesinputfiles::ca_enprofwd, colnamesinputfiles::ca_enprofwe, colnamesinputfiles::ca_fcef_v_kgkmwd, colnamesinputfiles::ca_fcef_v_kgkmwe, colnamesinputfiles::ca_frfossilfuel_heat, colnamesinputfiles::ca_frfossilfuel_nonheat, colnamesinputfiles::ca_frpddwe, colnamesinputfiles::ca_maxfcmetab, colnamesinputfiles::ca_maxqfmetab, colnamesinputfiles::ca_minfcmetab, colnamesinputfiles::ca_minqfmetab, colnamesinputfiles::ca_popprofwd, colnamesinputfiles::ca_popprofwe, colnamesinputfiles::ca_qf_a1, colnamesinputfiles::ca_qf_a2, colnamesinputfiles::ca_qf_b1, colnamesinputfiles::ca_qf_b2, colnamesinputfiles::ca_qf_c1, colnamesinputfiles::ca_qf_c2, colnamesinputfiles::ca_tcriticcooling_wd, colnamesinputfiles::ca_tcriticcooling_we, colnamesinputfiles::ca_tcriticheating_wd, colnamesinputfiles::ca_tcriticheating_we, colnamesinputfiles::ca_trafficunits, colnamesinputfiles::ca_traffprofwd, colnamesinputfiles::ca_traffprofwe, colnamesinputfiles::cb_alpha, colnamesinputfiles::cb_alpha_enh, colnamesinputfiles::cb_beta, colnamesinputfiles::cb_min_r, colnamesinputfiles::cb_resp_a, colnamesinputfiles::cb_resp_b, colnamesinputfiles::cb_theta, colnamesinputfiles::cc_gsg1, colnamesinputfiles::cc_gsg2, colnamesinputfiles::cc_gsg3, colnamesinputfiles::cc_gsg4, colnamesinputfiles::cc_gsg5, colnamesinputfiles::cc_gsg6, colnamesinputfiles::cc_gskmax, colnamesinputfiles::cc_gsmodel, colnamesinputfiles::cc_gss1, colnamesinputfiles::cc_gss2, colnamesinputfiles::cc_gsth, colnamesinputfiles::cc_gstl, colnamesinputfiles::ce_alb_ibld, colnamesinputfiles::ce_ch_ibld, colnamesinputfiles::ce_ch_iroof, colnamesinputfiles::ce_ch_iwall, colnamesinputfiles::ce_em_ibld, colnamesinputfiles::ce_internal_k1, colnamesinputfiles::ce_internal_k2, colnamesinputfiles::ce_internal_k3, colnamesinputfiles::ce_internal_k4, colnamesinputfiles::ce_internal_k5, colnamesinputfiles::ce_internal_rhocp1, colnamesinputfiles::ce_internal_rhocp2, colnamesinputfiles::ce_internal_rhocp3, colnamesinputfiles::ce_internal_rhocp4, colnamesinputfiles::ce_internal_rhocp5, colnamesinputfiles::ce_internal_thick1, colnamesinputfiles::ce_internal_thick2, colnamesinputfiles::ce_internal_thick3, colnamesinputfiles::ce_internal_thick4, colnamesinputfiles::ce_internal_thick5, colnamesinputfiles::ce_nroom, colnamesinputfiles::ce_surf_k1, colnamesinputfiles::ce_surf_k2, colnamesinputfiles::ce_surf_k3, colnamesinputfiles::ce_surf_k4, colnamesinputfiles::ce_surf_k5, colnamesinputfiles::ce_surf_rhocp1, colnamesinputfiles::ce_surf_rhocp2, colnamesinputfiles::ce_surf_rhocp3, colnamesinputfiles::ce_surf_rhocp4, colnamesinputfiles::ce_surf_rhocp5, colnamesinputfiles::ce_surf_thick1, colnamesinputfiles::ce_surf_thick2, colnamesinputfiles::ce_surf_thick3, colnamesinputfiles::ce_surf_thick4, colnamesinputfiles::ce_surf_thick5, colnamesinputfiles::ce_wall_k1, colnamesinputfiles::ce_wall_k2, colnamesinputfiles::ce_wall_k3, colnamesinputfiles::ce_wall_k4, colnamesinputfiles::ce_wall_k5, colnamesinputfiles::ce_wall_rhocp1, colnamesinputfiles::ce_wall_rhocp2, colnamesinputfiles::ce_wall_rhocp3, colnamesinputfiles::ce_wall_rhocp4, colnamesinputfiles::ce_wall_rhocp5, colnamesinputfiles::ce_wall_thick1, colnamesinputfiles::ce_wall_thick2, colnamesinputfiles::ce_wall_thick3, colnamesinputfiles::ce_wall_thick4, colnamesinputfiles::ce_wall_thick5, colnamesinputfiles::ci_albmax, colnamesinputfiles::ci_albmin, colnamesinputfiles::ci_chanohm, colnamesinputfiles::ci_cpanohm, colnamesinputfiles::ci_drcoef1, colnamesinputfiles::ci_drcoef2, colnamesinputfiles::ci_dreq, colnamesinputfiles::ci_emis, colnamesinputfiles::ci_estmcode, colnamesinputfiles::ci_kkanohm, colnamesinputfiles::ci_ohmcode_sdry, colnamesinputfiles::ci_ohmcode_swet, colnamesinputfiles::ci_ohmcode_wdry, colnamesinputfiles::ci_ohmcode_wwet, colnamesinputfiles::ci_ohmthresh_sw, colnamesinputfiles::ci_ohmthresh_wd, colnamesinputfiles::ci_snowlimpat, colnamesinputfiles::ci_snowlimrem, colnamesinputfiles::ci_soiltcode, colnamesinputfiles::ci_statelimit, colnamesinputfiles::ci_stormax, colnamesinputfiles::ci_stormin, colnamesinputfiles::ci_wetthresh, colnamesinputfiles::cir_daywat1, colnamesinputfiles::cir_daywat7, colnamesinputfiles::cir_daywatper1, colnamesinputfiles::cir_daywatper7, colnamesinputfiles::cir_faut, colnamesinputfiles::cir_ie_a1, colnamesinputfiles::cir_ie_a3, colnamesinputfiles::cir_ie_m1, colnamesinputfiles::cir_ie_m3, colnamesinputfiles::cir_ieend, colnamesinputfiles::cir_iestart, colnamesinputfiles::cir_intwu, colnamesinputfiles::co_a1, colnamesinputfiles::co_a2, colnamesinputfiles::co_a3, codematchanthropogenic(), codematchbiogen(), codematchconductance(), codematchdist(), codematchestm(), codematchestm_class(), codematchirrigation(), codematchnonveg(), codematchohm(), codematchprof(), codematchsnow(), codematchsoil(), codematchveg(), codematchwater(), allocatearray::conductance_coeff, allocatearray::conifsurf, colnamesinputfiles::cp_albmax, colnamesinputfiles::cp_albmin, colnamesinputfiles::cp_baset, colnamesinputfiles::cp_basete, colnamesinputfiles::cp_biogenco2code, colnamesinputfiles::cp_chanohm, colnamesinputfiles::cp_cpanohm, colnamesinputfiles::cp_drcoef1, colnamesinputfiles::cp_drcoef2, colnamesinputfiles::cp_dreq, colnamesinputfiles::cp_emis, colnamesinputfiles::cp_estmcode, colnamesinputfiles::cp_gddfull, colnamesinputfiles::cp_gsmax, colnamesinputfiles::cp_kkanohm, colnamesinputfiles::cp_laieq, colnamesinputfiles::cp_laimax, colnamesinputfiles::cp_laimin, colnamesinputfiles::cp_leafgp1, colnamesinputfiles::cp_leafgp2, colnamesinputfiles::cp_leafop1, colnamesinputfiles::cp_leafop2, colnamesinputfiles::cp_ohmcode_sdry, colnamesinputfiles::cp_ohmcode_swet, colnamesinputfiles::cp_ohmcode_wdry, colnamesinputfiles::cp_ohmcode_wwet, colnamesinputfiles::cp_ohmthresh_sw, colnamesinputfiles::cp_ohmthresh_wd, colnamesinputfiles::cp_porositymax, colnamesinputfiles::cp_porositymin, colnamesinputfiles::cp_sddfull, colnamesinputfiles::cp_snowlimpat, colnamesinputfiles::cp_soiltcode, colnamesinputfiles::cp_statelimit, colnamesinputfiles::cp_stormax, colnamesinputfiles::cp_stormin, colnamesinputfiles::cp_wetthresh, colnamesinputfiles::cpr_hours, colnamesinputfiles::cs_estmcode, colnamesinputfiles::cs_ohmcode_sdry, colnamesinputfiles::cs_ohmcode_swet, colnamesinputfiles::cs_ohmcode_wdry, colnamesinputfiles::cs_ohmcode_wwet, colnamesinputfiles::cs_ohmthresh_sw, colnamesinputfiles::cs_ohmthresh_wd, colnamesinputfiles::cs_snowalbmax, colnamesinputfiles::cs_snowalbmin, colnamesinputfiles::cs_snowcrwmax, colnamesinputfiles::cs_snowcrwmin, colnamesinputfiles::cs_snowemis, colnamesinputfiles::cs_snowplimalb, colnamesinputfiles::cs_snowplimsnow, colnamesinputfiles::cs_snowrmfactor, colnamesinputfiles::cs_snowsdmax, colnamesinputfiles::cs_snowsdmin, colnamesinputfiles::cs_snowtau_a, colnamesinputfiles::cs_snowtau_f, colnamesinputfiles::cs_snowtau_r, colnamesinputfiles::cs_snowtmfactor, colnamesinputfiles::cso_ksat, colnamesinputfiles::cso_obssmdepth, colnamesinputfiles::cso_obssmmax, colnamesinputfiles::cso_obssnrfrac, colnamesinputfiles::cso_soildens, colnamesinputfiles::cso_soildepth, colnamesinputfiles::cso_soilinfrate, colnamesinputfiles::cso_soilstcap, colnamesinputfiles::cw_albmax, colnamesinputfiles::cw_albmin, colnamesinputfiles::cw_chanohm, colnamesinputfiles::cw_cpanohm, colnamesinputfiles::cw_drcoef1, colnamesinputfiles::cw_drcoef2, colnamesinputfiles::cw_dreq, colnamesinputfiles::cw_emis, colnamesinputfiles::cw_estmcode, colnamesinputfiles::cw_kkanohm, colnamesinputfiles::cw_ohmcode_sdry, colnamesinputfiles::cw_ohmcode_swet, colnamesinputfiles::cw_ohmcode_wdry, colnamesinputfiles::cw_ohmcode_wwet, colnamesinputfiles::cw_ohmthresh_sw, colnamesinputfiles::cw_ohmthresh_wd, colnamesinputfiles::cw_statelimit, colnamesinputfiles::cw_stormax, colnamesinputfiles::cw_stormin, colnamesinputfiles::cw_waterdepth, colnamesinputfiles::cw_wetthresh, colnamesinputfiles::cwg_tobldgs, colnamesinputfiles::cwg_tobsoil, colnamesinputfiles::cwg_todectr, colnamesinputfiles::cwg_toevetr, colnamesinputfiles::cwg_tograss, colnamesinputfiles::cwg_topaved, colnamesinputfiles::cwg_torunoff, colnamesinputfiles::cwg_tosoilstore, colnamesinputfiles::cwg_towater, allocatearray::decidsurf, allocatearray::estmcoefficients_coeff, allocatearray::grasssurf, allocatearray::irrigation_coeff, initial::iv5, allocatearray::ivconif, allocatearray::ivdecid, allocatearray::ivgrass, allocatearray::ncolumnssiteselect, allocatearray::nonveg_coeff, allocatearray::nsurf, allocatearray::ohmcoefficients_coeff, allocatearray::pavsurf, allocatearray::profiles_coeff, allocatearray::siteselect, allocatearray::snow_coeff, allocatearray::soil_coeff, allocatearray::surfacechar, allocatearray::veg_coeff, allocatearray::water_coeff, allocatearray::watersurf, and allocatearray::wgwaterdist_coeff.

Referenced by suews_program().

454 
455  USE allocatearray
457  USE data_in
458  USE defaultnotused
459  USE initial
460  USE sues_data
461 
462  IMPLICIT NONE
463 
464  INTEGER:: gridiv, & !Row of SurfaceChar where input information will be stored
465  rr !Row of SiteSelect that matches current grid and year
466  INTEGER:: iii, &
467  ii
468 
469  !-------------------------------------------------------------------------------------------
470 
471  ! Initialise row of SurfaceChar
472  surfacechar(gridiv, :) = -999
473 
474  ! Transfer data in SiteSelect to SurfaceChar
475  surfacechar(gridiv, 1:ncolumnssiteselect) = siteselect(rr, 1:ncolumnssiteselect) !Cols in same order as in SiteSelect.txt
476 
477  ! ======== Retrieve information from other input files via codes ========
478 
479  ! ---- Find code for Paved surface (Impervious) ----
480  CALL codematchnonveg(rr, c_pavedcode)
481  ! Transfer characteristics to SurfaceChar for Paved surface
502  surfacechar(gridiv, c_cpanohm(pavsurf)) = nonveg_coeff(iv5, ci_cpanohm) ! heat capacity, AnOHM TS
503  surfacechar(gridiv, c_kkanohm(pavsurf)) = nonveg_coeff(iv5, ci_kkanohm) ! heat conductivity, AnOHM TS
504  surfacechar(gridiv, c_chanohm(pavsurf)) = nonveg_coeff(iv5, ci_chanohm) ! bulk transfer coef., AnOHM TS
505 
506  ! Use SoilCode for Paved to find code for soil characteristics
507  CALL codematchsoil(gridiv, c_soiltcode(pavsurf))
508  ! Transfer soil characteristics to SurfaceChar
517 
518  ! Get OHM characteristics for Paved
519  CALL codematchohm(gridiv, pavsurf, 'SWet') !Summer wet
520  ! Transfer OHM characteristics to SurfaceChar
524  CALL codematchohm(gridiv, pavsurf, 'SDry') !Summer dry
525  ! Transfer OHM characteristics to SurfaceChar
529  CALL codematchohm(gridiv, pavsurf, 'WWet') !Winter wet
530  ! Transfer OHM characteristics to SurfaceChar
534  CALL codematchohm(gridiv, pavsurf, 'WDry') !Winter dry
535  ! Transfer OHM characteristics to SurfaceChar
539 
540  ! Get water distribution (within grid) for Paved
542  ! Transfer distribution to SurfaceChar
552 
553  ! ---- Find code for Bldgs surface (Impervious) ----
554  CALL codematchnonveg(rr, c_bldgscode)
555  ! Transfer characteristics to SurfaceChar for Bldgs surface
576  surfacechar(gridiv, c_cpanohm(bldgsurf)) = nonveg_coeff(iv5, ci_cpanohm) ! heat capacity, AnOHM TS
577  surfacechar(gridiv, c_kkanohm(bldgsurf)) = nonveg_coeff(iv5, ci_kkanohm) ! heat conductivity, AnOHM TS
578  surfacechar(gridiv, c_chanohm(bldgsurf)) = nonveg_coeff(iv5, ci_chanohm) ! bulk transfer coef., AnOHM TS
579 
580  ! Use SoilCode for Bldgs to find code for soil characteristics
581  CALL codematchsoil(gridiv, c_soiltcode(bldgsurf))
582  ! Transfer soil characteristics to SurfaceChar
591  !Get OHM characteristics for Bldgs
592  CALL codematchohm(gridiv, bldgsurf, 'SWet') !Summer wet
593  ! Transfer OHM characteristics to SurfaceChar
597  CALL codematchohm(gridiv, bldgsurf, 'SDry') !Summer dry
598  ! Transfer OHM characteristics to SurfaceChar
602  CALL codematchohm(gridiv, bldgsurf, 'WWet') !Winter wet
603  ! Transfer OHM characteristics to SurfaceChar
607  CALL codematchohm(gridiv, bldgsurf, 'WDry') !Winter dry
608  ! Transfer OHM characteristics to SurfaceChar
612 
613  ! Get water distribution (within grid) for Bldgs
615  ! Transfer distribution to SurfaceChar
625 
626  ! ---- Find code for EveTr surface (Pervious) ----
627  CALL codematchveg(rr, c_evetrcode)
628  ! Transfer characteristics to SurfaceChar for EveTr surface
629  ! All surfaces (1-nsurf)
642  ! Veg surfaces only (1-nvegsurf)
657  ! OHM codes
664  ! ESTM code
666  ! AnOHM TS
667  surfacechar(gridiv, c_cpanohm(conifsurf)) = veg_coeff(iv5, cp_cpanohm) ! heat capacity, AnOHM TS
668  surfacechar(gridiv, c_kkanohm(conifsurf)) = veg_coeff(iv5, cp_kkanohm) ! heat conductivity, AnOHM TS
669  surfacechar(gridiv, c_chanohm(conifsurf)) = veg_coeff(iv5, cp_chanohm) ! bulk transfer coef., AnOHM TS
670 
672 
673  ! ---- Find code for Biogenic CO2 Method ----
675  ! Transfer Biogenic CO2 characteristics to SurfaceChar
684 
685  ! Use SoilCode for EveTr to find code for soil characteristics
686  CALL codematchsoil(gridiv, c_soiltcode(conifsurf))
687  ! Transfer soil characteristics to SurfaceChar
696  !Get OHM characteristics for Conif
697  CALL codematchohm(gridiv, conifsurf, 'SWet') !Summer wet
698  ! Transfer OHM characteristics to SurfaceChar
702  CALL codematchohm(gridiv, conifsurf, 'SDry') !Summer dry
703  ! Transfer OHM characteristics to SurfaceChar
707  CALL codematchohm(gridiv, conifsurf, 'WWet') !Winter wet
708  ! Transfer OHM characteristics to SurfaceChar
712  CALL codematchohm(gridiv, conifsurf, 'WDry') !Winter dry
713  ! Transfer OHM characteristics to SurfaceChar
717 
718  ! Get water distribution (within grid) for EveTr
720  ! Transfer distribution to SurfaceChar
730 
731  ! ---- Find code for DecTr surface (Pervious) ----
732  CALL codematchveg(rr, c_dectrcode)
733  ! Transfer characteristics to SurfaceChar for DecTr surface
734  ! All surfaces (1-nsurf)
747  ! Veg surfaces only (1-nvegsurf)
762  ! OHM codes
769  ! ESTM code
771  ! AnOHM TS
772  surfacechar(gridiv, c_cpanohm(decidsurf)) = veg_coeff(iv5, cp_cpanohm) ! heat capacity, AnOHM TS
773  surfacechar(gridiv, c_kkanohm(decidsurf)) = veg_coeff(iv5, cp_kkanohm) ! heat conductivity, AnOHM TS
774  surfacechar(gridiv, c_chanohm(decidsurf)) = veg_coeff(iv5, cp_chanohm) ! bulk transfer coef., AnOHM TS
775 
777 
778  ! ---- Find code for Biogenic CO2 Method ----
780  ! Transfer Biogenic CO2 characteristics to SurfaceChar
789 
790  ! Use SoilCode for DecTr to find code for soil characteristics
791  CALL codematchsoil(gridiv, c_soiltcode(decidsurf))
792  ! Transfer soil characteristics to SurfaceChar
801  !Get OHM characteristics for Decid
802  CALL codematchohm(gridiv, decidsurf, 'SWet') !Summer wet
803  ! Transfer OHM characteristics to SurfaceChar
807  CALL codematchohm(gridiv, decidsurf, 'SDry') !Summer dry
808  ! Transfer OHM characteristics to SurfaceChar
812  CALL codematchohm(gridiv, decidsurf, 'WWet') !Winter wet
813  ! Transfer OHM characteristics to SurfaceChar
817  CALL codematchohm(gridiv, decidsurf, 'WDry') !Winter dry
818  ! Transfer OHM characteristics to SurfaceChar
822 
823  ! Get water distribution (within grid) for DecTr
825  ! Transfer distribution to SurfaceChar
835 
836  ! ---- Find code for Grass surface (Pervious) ----
837  CALL codematchveg(rr, c_grasscode)
838  ! Transfer characteristics to SurfaceChar for Grass surface
839  ! All surfaces (1-nsurf)
852  ! Veg surfaces only (1-nvegsurf)
867  ! OHM codes
874  ! ESTM code
876  ! AnOHM TS
877  surfacechar(gridiv, c_cpanohm(grasssurf)) = veg_coeff(iv5, cp_cpanohm) ! heat capacity, AnOHM TS
878  surfacechar(gridiv, c_kkanohm(grasssurf)) = veg_coeff(iv5, cp_kkanohm) ! heat conductivity, AnOHM TS
879  surfacechar(gridiv, c_chanohm(grasssurf)) = veg_coeff(iv5, cp_chanohm) ! bulk transfer coef., AnOHM TS
880 
882 
883  ! ---- Find code for Biogenic CO2 Method ----
885  ! Transfer Biogenic CO2 characteristics to SurfaceChar
894 
895  ! Use SoilCode for Grass to find code for soil characteristics
896  CALL codematchsoil(gridiv, c_soiltcode(grasssurf))
897  ! Transfer soil characteristics to SurfaceChar
906  !Get OHM characteristics for Grass
907  CALL codematchohm(gridiv, grasssurf, 'SWet') !Summer wet
908  ! Transfer OHM characteristics to SurfaceChar
912  CALL codematchohm(gridiv, grasssurf, 'SDry') !Summer dry
913  ! Transfer OHM characteristics to SurfaceChar
917  CALL codematchohm(gridiv, grasssurf, 'WWet') !Winter wet
918  ! Transfer OHM characteristics to SurfaceChar
922  CALL codematchohm(gridiv, grasssurf, 'WDry') !Winter dry
923  ! Transfer OHM characteristics to SurfaceChar
927 
928  ! Get water distribution (within grid) for Grass
930  ! Transfer distribution to SurfaceChar
940 
941  ! ---- Find code for BSoil surface (Impervious) ----
942  CALL codematchnonveg(rr, c_bsoilcode)
943  ! Transfer characteristics to SurfaceChar for BSoil surface
944  ! All surfaces (1-nsurf)
965  surfacechar(gridiv, c_cpanohm(bsoilsurf)) = nonveg_coeff(iv5, ci_cpanohm) ! heat capacity, AnOHM TS
966  surfacechar(gridiv, c_kkanohm(bsoilsurf)) = nonveg_coeff(iv5, ci_kkanohm) ! heat conductivity, AnOHM TS
967  surfacechar(gridiv, c_chanohm(bsoilsurf)) = nonveg_coeff(iv5, ci_chanohm) ! bulk transfer coef., AnOHM TS
968 
969  ! Use SoilCode for BSoil to find code for soil characteristics
970  CALL codematchsoil(gridiv, c_soiltcode(bsoilsurf))
971  ! Transfer soil characteristics to SurfaceChar
980 
981  ! Get OHM characteristics for BSoil
982  CALL codematchohm(gridiv, bsoilsurf, 'SWet') !Summer wet
983  ! Transfer OHM characteristics to SurfaceChar
987  CALL codematchohm(gridiv, bsoilsurf, 'SDry') !Summer dry
988  ! Transfer OHM characteristics to SurfaceChar
992  CALL codematchohm(gridiv, bsoilsurf, 'WWet') !Winter wet
993  ! Transfer OHM characteristics to SurfaceChar
997  CALL codematchohm(gridiv, bsoilsurf, 'WDry') !Winter dry
998  ! Transfer OHM characteristics to SurfaceChar
1002 
1003  ! Get water distribution (within grid) for Bare soil
1005  ! Transfer distribution to SurfaceChar
1015 
1016  ! ---- Find code for Water surface (Water) ----
1017  CALL codematchwater(rr, c_watercode)
1018  ! Transfer characteristics to SurfaceChar for Water surface
1019  ! All surfaces (1-nsurf)
1030  ! Water surface only
1032  ! OHM codes
1039  ! ESTM code
1041  ! AnOHM TS
1042  surfacechar(gridiv, c_cpanohm(watersurf)) = water_coeff(iv5, cw_cpanohm) ! heat capacity, AnOHM TS
1043  surfacechar(gridiv, c_kkanohm(watersurf)) = water_coeff(iv5, cw_kkanohm) ! heat conductivity, AnOHM TS
1044  surfacechar(gridiv, c_chanohm(watersurf)) = water_coeff(iv5, cw_chanohm) ! bulk transfer coef., AnOHM TS
1045  ! Get OHM characteristics for Water
1046  CALL codematchohm(gridiv, watersurf, 'SWet') !Summer wet
1047  ! Transfer OHM characteristics to SurfaceChar
1051  CALL codematchohm(gridiv, watersurf, 'SDry') !Summer dry
1052  ! Transfer OHM characteristics to SurfaceChar
1056  CALL codematchohm(gridiv, watersurf, 'WWet') !Winter wet
1057  ! Transfer OHM characteristics to SurfaceChar
1061  CALL codematchohm(gridiv, watersurf, 'WDry') !Winter dry
1062  ! Transfer OHM characteristics to SurfaceChar
1066 
1067  ! Get water distribution (within grid) for Water
1069  ! Transfer distribution to SurfaceChar
1079 
1080  ! ---- Find code for Snow surface (Snow) ----
1081  CALL codematchsnow(rr, c_snowcode)
1082  ! Transfer characteristics to SurfaceChar for Snow surface
1087  !SurfaceChar(gridiv,c_SnowAlb) = Snow_Coeff(iv5,cs_SnowAlb)
1104 
1105  ! ESTM code
1107  ! SurfaceChar(Gridiv,c_CpAnOHM(nsurf+1)) = Snow_Coeff(iv5,cs_CpAnOHM) ! heat capacity, AnOHM TS
1108  ! SurfaceChar(Gridiv,c_KkAnOHM(nsurf+1)) = Snow_Coeff(iv5,cs_KkAnOHM) ! heat conductivity, AnOHM TS
1109  ! SurfaceChar(Gridiv,c_ChAnOHM(nsurf+1)) = Snow_Coeff(iv5,cs_ChAnOHM) ! bulk transfer coef., AnOHM TS
1110  ! Get OHM characteristics for Snow
1111  CALL codematchohm(gridiv, (nsurf + 1), 'SWet') !Summer wet
1112  ! Transfer OHM characteristics to SurfaceChar
1116  CALL codematchohm(gridiv, (nsurf + 1), 'SDry') !Summer dry
1117  ! Transfer OHM characteristics to SurfaceChar
1121  CALL codematchohm(gridiv, (nsurf + 1), 'WWet') !Winter wet
1122  ! Transfer OHM characteristics to SurfaceChar
1126  CALL codematchohm(gridiv, (nsurf + 1), 'WDry') !Winter dry
1127  ! Transfer OHM characteristics to SurfaceChar
1131 
1132  !Transfer ESTM characteristics to SurfaceChar
1133  DO iii = 1, (nsurf + 1)
1134  IF (surfacechar(gridiv, c_estmcode(iii)) /= 0) THEN !If ESTM Code not equal to zero, use code as normal
1135  CALL codematchestm(gridiv, iii)
1151  !Extra characteristics for Bldg surfaces
1152  IF (iii == bldgsurf) THEN
1189  ENDIF
1190  !If ESTM Code equals zero, use codes and surface fractions from SiteSelect.txt for Paved and Bldgs
1191  ELSEIF (iii == pavsurf .AND. surfacechar(gridiv, c_estmcode(iii)) == 0) THEN
1192  DO ii = 1, 3 !for the 3x Paved ESTM classes
1193  CALL codematchestm_class(gridiv, iii, ii)
1209  ENDDO
1210  ELSEIF (iii == bldgsurf .AND. surfacechar(gridiv, c_estmcode(iii)) == 0) THEN
1211  DO ii = 1, 5 !for the 5x Bldgs ESTM classes
1212  CALL codematchestm_class(gridiv, iii, ii)
1228  !Extra characteristics for Bldgs surface
1265  ENDDO
1266  ENDIF
1267  ENDDO
1268 
1269  ! ---- Find code for Surface conductances ----
1271  ! Transfer conductance characteristics to SurfaceChar
1284 
1285  ! ---- Find code for Anthropogenic heat ----
1287  ! Transfer Anthropogenic heat characteristics to SurfaceChar
1326 
1327  ! ---- Find code for Irrigation ----
1328  CALL codematchirrigation(rr, c_irrcode)
1329  ! Transfer Irrigation characteristics to SurfaceChar
1338 
1339  ! ---- Find code for Hourly Profiles ----
1340  ! Energy use (weekdays)
1341  CALL codematchprof(gridiv, c_enprofwd)
1343  ! Energy use (weekends)
1344  CALL codematchprof(gridiv, c_enprofwe)
1346  ! Water use profile (manual, weekdays)
1347  CALL codematchprof(gridiv, c_wprofmanuwd)
1349  ! Water use profile (manual, weekends)
1350  CALL codematchprof(gridiv, c_wprofmanuwe)
1352  ! Water use profile (automatic, weekdays)
1353  CALL codematchprof(gridiv, c_wprofautowd)
1355  ! Water use profile (automatic, weekends)
1356  CALL codematchprof(gridiv, c_wprofautowe)
1358  ! Snow clearing profile (weekdays)
1359  CALL codematchprof(gridiv, c_snowprofwd)
1361  ! Snow clearing profile (weekends)
1362  CALL codematchprof(gridiv, c_snowprofwe)
1364  !Human activity (weekdays)
1365  CALL codematchprof(gridiv, c_co2mwd)
1367  !Human activity (weekends)
1368  CALL codematchprof(gridiv, c_co2mwe)
1370  !Traffic (weekdays)
1371  CALL codematchprof(gridiv, c_traffprofwd)
1373  !Traffic (weekends)
1374  CALL codematchprof(gridiv, c_traffprofwe)
1376  !Population (weekdays)
1377  CALL codematchprof(gridiv, c_popprofwd)
1379  !Population (weekends)
1380  CALL codematchprof(gridiv, c_popprofwe)
1382 
1383  ! TS 05 Jul 2018: No longer needed as interpolation is done through specific subroutines at each required instant
1384  ! the below is commented out by TS 05 Jul 2018
1385  ! ! ---- Interpolate Hourly Profiles to model timestep and normalise
1386  ! TstepProfiles(Gridiv,:,:) = -999 !Initialise TstepProfiles
1387  ! ! Energy use
1388  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_EnUseWD,c_HrProfEnUseWD)
1389  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_EnUseWE,c_HrProfEnUseWE)
1390  !
1391  ! ! For energy use, normalise so the AVERAGE of the multipliers is equal to 1
1392  ! TstepProfiles(Gridiv,cTP_EnUseWD,:) = TstepProfiles(Gridiv,cTP_EnUseWD,:) / SUM(TstepProfiles(Gridiv,cTP_EnUseWD,:))*24*nsh_real
1393  ! TstepProfiles(Gridiv,cTP_EnUseWE,:) = TstepProfiles(Gridiv,cTP_EnUseWE,:) / SUM(TstepProfiles(Gridiv,cTP_EnUseWE,:))*24*nsh_real
1394  !
1395  ! ! Water use
1396  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_WUManuWD,c_HrProfWUManuWD)
1397  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_WUManuWE,c_HrProfWUManuWE)
1398  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_WUAutoWD,c_HrProfWUAutoWD)
1399  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_WUAutoWE,c_HrProfWUAutoWE)
1400  ! ! For water use, normalise so the SUM of the multipliers is equal to 1 (profile is multiplied by daily water use)
1401  ! TstepProfiles(Gridiv,cTP_WUManuWD,:) = TstepProfiles(Gridiv,cTP_WUManuWD,:) / SUM(TstepProfiles(Gridiv,cTP_WUManuWD,:))
1402  ! TstepProfiles(Gridiv,cTP_WUManuWE,:) = TstepProfiles(Gridiv,cTP_WUManuWE,:) / SUM(TstepProfiles(Gridiv,cTP_WUManuWE,:))
1403  ! TstepProfiles(Gridiv,cTP_WUAutoWD,:) = TstepProfiles(Gridiv,cTP_WUAutoWD,:) / SUM(TstepProfiles(Gridiv,cTP_WUAutoWD,:))
1404  ! TstepProfiles(Gridiv,cTP_WUAutoWE,:) = TstepProfiles(Gridiv,cTP_WUAutoWE,:) / SUM(TstepProfiles(Gridiv,cTP_WUAutoWE,:))
1405  !
1406  ! ! Human activity for CO2 calculations
1407  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_HumActivityWD,c_HrProfHumActivityWD)
1408  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_HumActivityWE,c_HrProfHumActivityWE)
1409  !
1410  ! ! For human activity, check values are between 1 (night) and 2 (day)
1411  ! IF(ANY(TstepProfiles(Gridiv,cTP_HumActivityWD,:) < 1 .OR. TstepProfiles(Gridiv,cTP_HumActivityWD,:) > 2)) THEN
1412  ! CALL ErrorHint(70,'Profile value for human activity (WD) exceeds allowed range 1-2.',NotUsed,NotUsed,notUsedI)
1413  ! ENDIF
1414  ! IF(ANY(TstepProfiles(Gridiv,cTP_HumActivityWE,:) < 1 .OR. TstepProfiles(Gridiv,cTP_HumActivityWE,:) > 2)) THEN
1415  ! CALL ErrorHint(70,'Profile value for human activity (WE) exceeds allowed range 1-2.',NotUsed,NotUsed,notUsedI)
1416  ! ENDIF
1417  !
1418  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_TraffProfWD,c_HrProfTraffWD)
1419  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_TraffProfWE,c_HrProfTraffWE)
1420  ! ! For traffic, normalise so the AVERAGE of the multipliers is equal to 1
1421  ! TstepProfiles(Gridiv,cTP_TraffProfWD,:) = TstepProfiles(Gridiv,cTP_TraffProfWD,:) &
1422  ! / SUM(TstepProfiles(Gridiv,cTP_TraffProfWD,:))*24*nsh_real
1423  ! TstepProfiles(Gridiv,cTP_TraffProfWE,:) = TstepProfiles(Gridiv,cTP_TraffProfWE,:) &
1424  ! / SUM(TstepProfiles(Gridiv,cTP_TraffProfWE,:))*24*nsh_real
1425  !
1426  ! ! Population for CO2 calculations
1427  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_PopProfWD,c_HrProfPopWD)
1428  ! CALL SUEWS_InterpHourlyProfiles(Gridiv,cTP_PopProfWE,c_HrProfPopWE)
1429 
integer, dimension(5) c_internal_rhocp2_bldgs
integer, dimension(nsurfincsnow) c_surf_thick2
integer, dimension(nsurf) c_soiltcode
integer, dimension(5) c_surf_k4_bldgs
subroutine codematchdist(rr, CodeCol, codeColSameSurf)
integer, dimension(nvegsurf) c_theta_bioco2
integer, dimension(nvegsurf) c_resp_b
integer, dimension(3) c_ie_a
integer, dimension(5) c_wall_k5_bldgs
integer, dimension(nsurfincsnow) c_ohmcode_swet
integer, dimension(nsurfincsnow) c_a3_swet
integer, parameter ncolumnssiteselect
integer, dimension(nvegsurf) c_leafgp2
integer, dimension(nsurf) c_dreq
real(kind(1d0)), dimension(:, :), allocatable water_coeff
integer, dimension(5) c_internal_thick2_bldgs
subroutine codematchprof(Gridiv, SurfaceCharCodeCol)
integer, dimension(nsurfincsnow) c_a2_sdry
integer, dimension(nsurf) c_snowlimpat
integer, dimension(nvegsurf) c_alpha_bioco2
subroutine codematchnonveg(rr, CodeCol)
integer, dimension(nvegsurf) c_leafop2
integer, dimension(5) c_alb_ibld_bldgs
integer, dimension(nsurf) c_wgtosoilstore
integer, dimension(nsurfincsnow) c_surf_k2
integer, dimension(nsurf) c_wgtowater
integer, dimension(nsurf) c_soilinfrate
integer, parameter ivgrass
integer, dimension(nsurf) c_wetthresh
integer, dimension(5) c_wall_thick3_bldgs
real(kind(1d0)), dimension(:, :), allocatable irrigation_coeff
integer, dimension(nsurf) c_soildepth
integer, dimension(3) c_surf_rhocp5_paved
integer, dimension(nsurf) c_snowlimrem
integer, dimension(nsurf) c_obssmdepth
integer, dimension(3) c_ie_m
real(kind(1d0)), dimension(:, :), allocatable soil_coeff
integer, dimension(nsurfincsnow) c_a3_wdry
integer, dimension(3) c_surf_rhocp2_paved
subroutine codematchbiogen(Gridiv, SurfaceCharCodeCol)
integer, dimension(5) c_internal_thick4_bldgs
integer, dimension(nsurfincsnow) c_surf_rhocp5
integer, dimension(nvegsurf) c_beta_enh_bioco2
integer, dimension(5) c_wall_rhocp4_bldgs
integer, dimension(5) c_surf_thick1_bldgs
integer, parameter bsoilsurf
integer, dimension(nsurfincsnow) c_surf_thick3
integer, dimension(24) c_hrproftraffwe
integer, dimension(24) c_hrproftraffwd
real(kind(1d0)), dimension(:, :), allocatable estmcoefficients_coeff
integer c_tcriticheating_we
integer, dimension(nsurfincsnow) c_a2_swet
integer, dimension(3) c_surf_thick4_paved
real(kind(1d0)), dimension(:, :), allocatable snow_coeff
integer, dimension(nvegsurf) c_sddfull
subroutine codematchconductance(rr, CodeCol)
integer, dimension(5) c_surf_thick4_bldgs
integer, dimension(nsurf) c_albmin
integer, dimension(nsurfincsnow) c_ohmcode_wwet
integer, dimension(5) c_internal_k4_bldgs
integer, dimension(24) cpr_hours
integer, dimension(nsurfincsnow) c_surf_thick4
integer, dimension(5) c_ch_ibld_bldgs
integer, dimension(nsurfincsnow) c_surf_rhocp2
integer, parameter nsurf
integer, dimension(nsurfincsnow) c_estmcode
integer, dimension(nsurfincsnow) c_a2_wwet
integer, dimension(nsurfincsnow) c_ohmcode_wdry
integer, dimension(nvegsurf) c_porositymin
integer c_frfossilfuel_heat
integer, dimension(5) c_wall_thick4_bldgs
subroutine codematchestm(Gridiv, is)
integer, dimension(5) c_internal_rhocp3_bldgs
real(kind(1d0)), dimension(:, :), allocatable surfacechar
integer, dimension(nvegsurf) c_porositymax
integer, dimension(nvegsurf) c_laimax
integer, dimension(nsurf) c_drcoef2
integer, dimension(nsurf) c_obssmmax
subroutine codematchveg(rr, CodeCol)
integer, dimension(5) c_wall_rhocp5_bldgs
integer, dimension(5) c_internal_k3_bldgs
integer, parameter conifsurf
integer, dimension(7) c_daywat
integer, dimension(5) c_surf_k3_bldgs
integer, dimension(nsurfincsnow) c_a1_sdry
integer, dimension(24) c_hrprofsnowcwd
integer, dimension(nsurfincsnow) c_a1_wdry
integer, dimension(nsurfincsnow) c_a2_wdry
integer, dimension(nvegsurf) c_leafgp1
integer, dimension(5) c_wall_k2_bldgs
integer, dimension(24) c_hrprofwumanuwd
integer, dimension(5) c_internal_rhocp5_bldgs
integer, dimension(3) c_surf_k2_paved
integer, dimension(24) c_hrprofwumanuwe
subroutine codematchohm(Gridiv, is, SWWD)
integer, dimension(5) c_internal_k5_bldgs
integer, dimension(5) c_em_ibld_bldgs
integer, dimension(nsurf) c_wgtopaved
integer, dimension(nsurf) c_ksat
integer, dimension(24) c_hrprofsnowcwe
integer, dimension(7) c_daywatper
integer, dimension(nsurf) c_soildens
integer, dimension(5) c_surf_rhocp5_bldgs
integer, dimension(nsurfincsnow) c_surf_rhocp1
integer, dimension(24) c_hrprofpopwd
subroutine codematchsoil(Gridiv, SurfaceCharCodeCol)
integer, dimension(5) c_wall_rhocp2_bldgs
integer, dimension(nsurfincsnow) c_surf_k4
real(kind(1d0)), dimension(:, :), allocatable siteselect
integer, dimension(24) c_hrprofhumactivitywe
integer, parameter grasssurf
real(kind(1d0)), dimension(:, :), allocatable ohmcoefficients_coeff
integer c_ahslopeheating_wd
subroutine codematchanthropogenic(rr, CodeCol)
integer, dimension(nvegsurf) c_laimin
real(kind(1d0)), dimension(:, :), allocatable anthropogenic_coeff
integer, dimension(nsurfincsnow) c_surf_rhocp3
integer c_ahslopecooling_wd
integer c_frfossilfuel_nonheat
integer, dimension(3) c_surf_thick2_paved
integer, dimension(nvegsurf) c_laieq
integer, dimension(3) c_surf_k1_paved
integer, dimension(nsurfincsnow) c_ohmthresh_wd
subroutine codematchsnow(rr, CodeCol)
integer, dimension(5) c_wall_rhocp3_bldgs
integer, parameter ivconif
integer, dimension(5) c_surf_rhocp3_bldgs
integer, dimension(nvegsurf) c_min_res_bioco2
integer, dimension(nsurf) c_wgtograss
integer, dimension(nsurf) c_stormin
integer, dimension(24) c_hrprofhumactivitywd
integer, dimension(nsurf) c_soilstcap
integer, dimension(5) c_internal_rhocp4_bldgs
integer, dimension(5) c_surf_thick2_bldgs
real(kind(1d0)), dimension(:, :), allocatable biogen_coeff
integer, dimension(nsurf) c_wgtorunoff
integer, dimension(nsurf) c_chanohm
integer, dimension(5) c_nroom_bldgs
integer, dimension(5) c_surf_rhocp4_bldgs
integer, dimension(nsurf) c_obssnrfrac
integer, dimension(nsurfincsnow) c_surf_thick5
integer, dimension(nsurf) c_cpanohm
integer c_tcriticcooling_we
integer, dimension(nsurf) c_albmax
integer, dimension(24) c_hrprofwuautowd
integer, dimension(5) c_surf_rhocp1_bldgs
integer, dimension(5) c_surf_k2_bldgs
integer, dimension(3) c_surf_rhocp4_paved
real(kind(1d0)), dimension(:, :), allocatable wgwaterdist_coeff
integer, dimension(3) c_surf_thick1_paved
integer, dimension(3) c_surf_k5_paved
integer, dimension(5) c_internal_thick3_bldgs
integer, dimension(nsurf) c_wgtodectr
integer, dimension(nsurf) c_stormax
integer, dimension(nvegsurf) c_gsmax
integer, dimension(nsurfincsnow) c_surf_k5
integer, dimension(nsurf) c_statelimit
real(kind(1d0)), dimension(:, :), allocatable veg_coeff
integer c_tcriticheating_wd
integer, dimension(24) c_hrprofenusewd
integer, dimension(5) c_surf_k1_bldgs
integer, dimension(nvegsurf) c_leafop1
integer, dimension(nvegsurf) c_resp_a
integer, dimension(nsurfincsnow) c_a3_sdry
integer, dimension(nsurfincsnow) c_a1_wwet
integer, dimension(5) c_wall_thick5_bldgs
integer, dimension(nvegsurf) c_biogenco2code
integer, dimension(nsurfincsnow) c_ohmcode_sdry
integer, dimension(nvegsurf) c_basete
integer, dimension(nvegsurf) c_alpha_enh_bioco2
integer, dimension(5) c_internal_thick5_bldgs
integer, dimension(nsurfincsnow) c_a1_swet
integer, dimension(3) c_surf_thick3_paved
integer, dimension(5) c_wall_k1_bldgs
subroutine codematchestm_class(Gridiv, is, ii)
integer, dimension(5) c_surf_rhocp2_bldgs
real(kind(1d0)), dimension(:, :), allocatable nonveg_coeff
integer, dimension(nsurfincsnow) c_a3_wwet
integer, dimension(nsurfincsnow) c_surf_k1
integer, dimension(nvegsurf) c_beta_bioco2
integer c_ahslopeheating_we
integer, dimension(nsurf) c_wgtobldgs
integer, dimension(nsurf) c_wgtobsoil
integer, dimension(3) c_surf_rhocp1_paved
integer, dimension(3) c_surf_k3_paved
integer, dimension(nsurfincsnow) c_surf_thick1
real(kind(1d0)), dimension(:, :), allocatable conductance_coeff
integer, dimension(5) c_wall_k4_bldgs
integer, dimension(24) c_hrprofwuautowe
integer c_ahslopecooling_we
integer, dimension(5) c_internal_k1_bldgs
integer, parameter decidsurf
integer, dimension(5) c_ch_iroof_bldgs
integer, dimension(5) c_surf_thick5_bldgs
integer, parameter pavsurf
integer, dimension(nsurf) c_wgtoevetr
integer, dimension(nsurf) c_kkanohm
integer, dimension(5) c_internal_k2_bldgs
integer, dimension(nvegsurf) c_baset
integer, dimension(3) c_surf_rhocp3_paved
integer, dimension(24) c_hrprofenusewe
integer, dimension(5) c_wall_thick1_bldgs
integer, dimension(5) c_surf_k5_bldgs
integer, dimension(5) c_wall_k3_bldgs
integer, parameter bldgsurf
integer, parameter watersurf
integer, dimension(nsurf) c_drcoef1
integer, dimension(5) c_wall_thick2_bldgs
integer, dimension(nvegsurf) c_gddfull
real(kind(1d0)), dimension(:, :), allocatable profiles_coeff
integer, dimension(5) c_internal_rhocp1_bldgs
integer, dimension(24) c_hrprofpopwe
integer, dimension(nsurf) c_emis
integer, dimension(nsurfincsnow) c_surf_k3
integer, dimension(5) c_ch_iwall_bldgs
integer, dimension(nsurfincsnow) c_ohmthresh_sw
integer, dimension(nsurfincsnow) c_surf_rhocp4
subroutine codematchwater(rr, CodeCol)
integer c_tcriticcooling_wd
subroutine codematchirrigation(rr, CodeCol)
integer, dimension(5) c_wall_rhocp1_bldgs
integer, dimension(5) c_surf_thick3_bldgs
integer, dimension(3) c_surf_k4_paved
integer, parameter ivdecid
integer, dimension(5) c_internal_thick1_bldgs
integer, dimension(3) c_surf_thick5_paved
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialstate()

subroutine initialstate ( character(len=20)  GridName,
integer  year_int,
integer  Gridiv,
integer  NumberOfGrids 
)

Definition at line 1442 of file suews_ctrl_init.f95.

References initialcond::albdectr0, initialcond::albevetr0, initialcond::albgrass0, data_in::basethdd, gis_data::bldgh, allocatearray::bldgsurf, allocatearray::bsoilsurf, allocatearray::c_albmax, allocatearray::c_albmin, allocatearray::c_basethdd, allocatearray::c_gddfull, allocatearray::c_laimax, allocatearray::c_laimin, allocatearray::c_porositymax, allocatearray::c_porositymin, allocatearray::c_sddfull, allocatearray::c_stormax, allocatearray::c_stormin, allocatearray::c_waterdepth, colnamesmodeldailystate::cmds_albdectr, colnamesmodeldailystate::cmds_albevetr, colnamesmodeldailystate::cmds_albgrass, colnamesmodeldailystate::cmds_dayssincerain, colnamesmodeldailystate::cmds_decidcap, colnamesmodeldailystate::cmds_gdd1_0, colnamesmodeldailystate::cmds_gdd2_0, colnamesmodeldailystate::cmds_gddmax, colnamesmodeldailystate::cmds_gddmin, colnamesmodeldailystate::cmds_hdd1, colnamesmodeldailystate::cmds_hdd2, colnamesmodeldailystate::cmds_id_prev, colnamesmodeldailystate::cmds_laiinitialdectr, colnamesmodeldailystate::cmds_laiinitialevetr, colnamesmodeldailystate::cmds_laiinitialgrass, colnamesmodeldailystate::cmds_porosity, colnamesmodeldailystate::cmds_snowalb, allocatearray::cmds_snowdens, colnamesmodeldailystate::cmds_snowfallcum, colnamesmodeldailystate::cmds_tempc, colnamesmodeldailystate::cmds_tempcold1, colnamesmodeldailystate::cmds_tempcold2, colnamesmodeldailystate::cmds_tempcold3, allocatearray::cmod_snowfrac, allocatearray::cmod_snowpack, allocatearray::cmod_snowwaterstate, allocatearray::cmod_soilstate, allocatearray::cmod_state, allocatearray::conifsurf, day2month(), day_of_week(), sues_data::daywat, sues_data::daywatper, initialcond::decidcap0, allocatearray::decidsurf, gis_data::dectreeh, data_in::diagnose, time::dls, data_in::emissionsmethod, data_in::enddls, errorhint(), gis_data::evetreeh, gis_data::faibldg, gis_data::faidectree, gis_data::faievetree, sues_data::faut, data_in::filechoices, data_in::filecode, data_in::fileinputpath, data_in::fileoutputpath, initialcond::gdd_1_0, initialcond::gdd_2_0, allocatearray::grasssurf, allocatearray::hdd_id, allocatearray::icefrac, time::id, initialcond::id_prev, sues_data::ie_a, sues_data::ie_end, sues_data::ie_m, sues_data::ie_start, defaultnotused::ios_out, allocatearray::ivconif, allocatearray::ivdecid, allocatearray::ivgrass, time::iy, initialcond::laiinitialdectr, initialcond::laiinitialevetr, initialcond::laiinitialgrass, data_in::lat, leapyearcalc(), allocatearray::metforcingdata, allocatearray::modeldailystate, allocatearray::modeloutputdata, data_in::multipleinitfiles, defaultnotused::nan, time::nofdaysthisyear, defaultnotused::notused, defaultnotused::notusedi, sues_data::nsh, allocatearray::pavsurf, sues_data::planf, initialcond::porosity0, allocatearray::porosity_id, data_in::roughlenmommethod, allocatearray::sfr, initialcond::snowalb0, initialcond::snowpackbldgs, initialcond::snowpackbsoil, initialcond::snowpackdectr, initialcond::snowpackevetr, initialcond::snowpackgrass, initialcond::snowpackpaved, initialcond::snowpackwater, data_in::snowuse, initialcond::snowwaterbldgsstate, initialcond::snowwaterbsoilstate, initialcond::snowwaterdectrstate, initialcond::snowwaterevetrstate, initialcond::snowwatergrassstate, initialcond::snowwaterpavedstate, initialcond::snowwaterwaterstate, initialcond::soilstorebldgsstate, initialcond::soilstorebsoilstate, initialcond::soilstoredectrstate, initialcond::soilstoreevetrstate, initialcond::soilstoregrassstate, initialcond::soilstorepavedstate, data_in::startdls, resist_module::suews_cal_roughnessparameters(), suews_cal_weekday(), suews_translate(), allocatearray::surfacechar, initialcond::temp_c0, dailystate_module::update_wateruse(), allocatearray::watersurf, data_in::waterusemethod, allocatearray::wuday_id, mod_z::z, mod_z::z0m, mod_z::z0m_in, mod_z::zdm, mod_z::zdm_in, sues_data::zh, and mod_z::zzd.

Referenced by suews_program().

1442  ! Last modified HCW 13 Jan 2017 - Major changes to InitialConditions file
1443  ! Last modified HCW 24 May 2016 - Removed unused argument year_txt
1444  ! Last modified HCW 03 Jul 2015 - Added initial conditions albEveTr0 and albGrass0
1445  ! Last modified HCW 03 Dec 2014
1446  !------------------------------------------------------------------------
1447 
1448  USE allocatearray
1449  USE data_in
1451  USE defaultnotused
1452  USE filename
1453  USE gis_data
1454  USE initialcond
1455  USE mod_z
1456  USE resist
1457  USE snowmod
1458  USE sues_data
1459  USE time
1460  USE initialcond
1463 
1464  IMPLICIT NONE
1465 
1466  CHARACTER(len=20):: gridname !Name of the evaluated grid
1467  CHARACTER(len=4):: year_txt
1468  INTEGER:: numberofgrids
1469 
1470  CHARACTER(len=150):: fileinit !Initial conditions filename
1471  INTEGER::dayssincerain, gridiv, & !number of days since rain, grid number,
1472  gamma1, gamma2 !switches related to cooling and heating degree days
1473  INTEGER::wd, seas, date, mb, & !weekday information, season, date, month
1474  year_int, switch = 0, & !year as an integer, switch related to previous day
1475  id_next !next day,counter in irrigation calculations
1476 
1477  REAL(KIND(1d0))::pavedstate, bldgsstate, evetrstate, dectrstate, grassstate, bsoilstate, waterstate, &
1478  snowfracpaved, snowfracbldgs, snowfracevetr, snowfracdectr, &
1479  snowfracgrass, snowfracbsoil, snowfracwater, &
1480  snowdenspaved, snowdensbldgs, snowdensevetr, snowdensdectr, &
1481  snowdensgrass, snowdensbsoil, snowdenswater
1482 
1483  INTEGER:: leavesoutinitially !Allows for quick setting of veg-related initial conditions for full leaf-out (1) or leaf-off (0)
1484  INTEGER:: snowinitially !Allows for quick setting of snow-related initial conditions for no snow initially (0)
1485 
1486  INTEGER:: gridsinitialised = 0 ! Number of grids initialised at start of model run
1487  INTEGER:: yearsinitialised = 0 ! Number of years initialised at start of model run
1488  INTEGER:: dayofweek_id(3)
1489  REAL(KIND(1d0)):: normalizevegchar !Function
1490 
1491  ! Define InitialConditions namelist ---------------------------------------
1492  namelist /initialconditions/ dayssincerain, &
1493  temp_c0, &
1494  !ID_Prev,& !Now calculated from met forcing file
1495  leavesoutinitially, &
1496  gdd_1_0, &
1497  gdd_2_0, &
1498  laiinitialevetr, &
1499  laiinitialdectr, &
1500  laiinitialgrass, &
1501  albevetr0, &
1502  albdectr0, &
1503  albgrass0, &
1504  decidcap0, &
1505  porosity0, &
1506  pavedstate, &
1507  bldgsstate, &
1508  evetrstate, &
1509  dectrstate, &
1510  grassstate, &
1511  bsoilstate, &
1512  waterstate, &
1519  snowinitially, &
1527  snowpackpaved, &
1528  snowpackbldgs, &
1529  snowpackevetr, &
1530  snowpackdectr, &
1531  snowpackgrass, &
1532  snowpackbsoil, &
1533  snowpackwater, &
1534  snowfracpaved, &
1535  snowfracbldgs, &
1536  snowfracevetr, &
1537  snowfracdectr, &
1538  snowfracgrass, &
1539  snowfracbsoil, &
1540  snowfracwater, &
1541  snowdenspaved, &
1542  snowdensbldgs, &
1543  snowdensevetr, &
1544  snowdensdectr, &
1545  snowdensgrass, &
1546  snowdensbsoil, &
1547  snowdenswater, &
1548  snowalb0!,&
1549  ! BoInit ! removed as no longer needed by AnOHM
1550 
1551  ! Initialise namelist to NAN ----------------------------------------------
1552  dayssincerain = int(nan)
1553  temp_c0 = nan
1554  leavesoutinitially = int(nan)
1555  gdd_1_0 = nan
1556  gdd_2_0 = nan
1560  albevetr0 = nan
1561  albdectr0 = nan
1562  albgrass0 = nan
1563  decidcap0 = nan
1564  porosity0 = nan
1565  pavedstate = nan
1566  bldgsstate = nan
1567  evetrstate = nan
1568  dectrstate = nan
1569  grassstate = nan
1570  bsoilstate = nan
1571  waterstate = nan
1578  snowinitially = int(nan)
1586  snowpackpaved = nan
1587  snowpackbldgs = nan
1588  snowpackevetr = nan
1589  snowpackdectr = nan
1590  snowpackgrass = nan
1591  snowpackbsoil = nan
1592  snowpackwater = nan
1593  snowfracpaved = nan
1594  snowfracbldgs = nan
1595  snowfracevetr = nan
1596  snowfracdectr = nan
1597  snowfracgrass = nan
1598  snowfracbsoil = nan
1599  snowfracwater = nan
1600  snowdenspaved = nan
1601  snowdensbldgs = nan
1602  snowdensevetr = nan
1603  snowdensdectr = nan
1604  snowdensgrass = nan
1605  snowdensbsoil = nan
1606  snowdenswater = nan
1607  snowalb0 = nan
1608  ! BoInit=NAN
1609 
1610  WRITE (year_txt, '(I4)') year_int !Get year as a text string
1611 
1612  ! Define InitialConditions file -------------------------------------------
1613  fileinit = trim(fileinputpath)//trim("InitialConditions")//trim(gridname)//'.nml'
1614  ! On very first InitialConditions for each grid, can use one initial conditions file specified for all grids
1615  IF (multipleinitfiles == 0 .AND. yearsinitialised == 0) THEN
1616  fileinit = trim(fileinputpath)//trim("InitialConditions")//trim(filecode)//'_'//trim(year_txt)//'.nml'
1617  gridsinitialised = gridsinitialised + 1
1618  IF (gridsinitialised == numberofgrids) THEN
1619  yearsinitialised = yearsinitialised + 1
1620  gridsinitialised = 0 !reset GridsInitialised
1621  ENDIF
1622  ENDIF
1623  !write(*,*) TRIM(FileInit)
1624 
1625  ! Open, read and close InitialConditions file -----------------------------
1626  OPEN (56, file=trim(fileinit), err=600, status='old')
1627  READ (56, iostat=ios_out, nml=initialconditions, err=601)
1628  CLOSE (56)
1629 
1630  ! Write InitialConditions to FileChoices ----------------------------------
1631  filechoices = trim(fileoutputpath)//trim(filecode)//'_FileChoices.txt'
1632  OPEN (12, file=filechoices, position='append')
1633  WRITE (12, *) '----- '//trim("InitialConditions")//trim(gridname)//'.nml'//' -----'
1634  WRITE (12, nml=initialconditions)
1635  CLOSE (12)
1636 
1637  !--------------------------------------------------------------------------
1638  ! Check initial conditions and assign values if not provided --------------
1639 
1640  ! Calculate previous day --------------------------------------------------
1641  id_prev = int(metforcingdata(1, 2, gridiv)) - 1
1642 
1643  ! If no. days since rainfall unknown, set to zero -------------------------
1644  IF (dayssincerain == int(nan)) dayssincerain = 0
1645 
1646  ! If average temperature for previous day unknown, use average of first day
1647  IF (temp_c0 == nan) temp_c0 = sum(metforcingdata(1:(24*nsh), 12, gridiv))/(24*nsh)
1648 
1649  ! Set vegetation-related initial conditions -------------------------------
1650  ! If LeavesOutInitially is -999, don't use and check all required conditions have been provided
1651  IF (leavesoutinitially == int(nan)) THEN
1652  IF (gdd_1_0 == nan .OR. gdd_2_0 == nan) THEN
1653  CALL errorhint(36, 'Specify values for GDD_1_0 and GDD_2_0.', notused, notused, notusedi)
1654  ENDIF
1655  IF (laiinitialevetr == nan .OR. laiinitialdectr == nan .OR. laiinitialgrass == nan) THEN
1656  CALL errorhint(36, 'Specify initial values for LAI for all vegetated surface types.', notused, notused, notusedi)
1657  ENDIF
1658  IF (albevetr0 == nan .OR. albdectr0 == nan .OR. albgrass0 == nan) THEN
1659  CALL errorhint(36, 'Specify initial values for albedo for all vegetated surface types.', notused, notused, notusedi)
1660  ENDIF
1661  IF (decidcap0 == nan) THEN
1662  CALL errorhint(36, 'Specify DecidCap0.', notused, notused, notusedi)
1663  ENDIF
1664  IF (porosity0 == nan) THEN
1665  CALL errorhint(36, 'Specify Porosity0.', notused, notused, notusedi)
1666  ENDIF
1667  ELSEIF (leavesoutinitially == 1) THEN !If leaves out, set to summertime values using SUEWS_Veg.txt
1669  gdd_2_0 = 0
1670  laiinitialevetr = surfacechar(gridiv, c_laimax(ivconif)) !Max LAI
1673  albevetr0 = surfacechar(gridiv, c_albmax(conifsurf)) !Max albedo
1676  decidcap0 = surfacechar(gridiv, c_stormax(decidsurf)) !Max storage capacity (DecTr only)
1677  porosity0 = surfacechar(gridiv, c_porositymin(ivdecid)) !Min porosity (DecTr only)
1678  ELSEIF (leavesoutinitially == 0) THEN !If leaves off, set to wintertime values using SUEWS_Veg.txt
1679  gdd_1_0 = 0
1681  laiinitialevetr = surfacechar(gridiv, c_laimin(ivconif)) !Min LAI
1684  albevetr0 = surfacechar(gridiv, c_albmin(conifsurf)) !Min albedo
1687  decidcap0 = surfacechar(gridiv, c_stormin(decidsurf)) !Min storage capacity (DecTr only)
1688  porosity0 = surfacechar(gridiv, c_porositymax(ivdecid)) !Max porosity (DecTr only)
1689  ELSE
1690  CALL errorhint(36, 'LeavesOutInitially must be 0, 1, or -999 (or omitted from InitialConditions namelist)', &
1692  ENDIF
1693 
1694  ! If surface wetness states unknown, set to zero --------------------------
1695  IF (pavedstate == nan) pavedstate = 0
1696  IF (bldgsstate == nan) bldgsstate = 0
1697  IF (evetrstate == nan) evetrstate = 0
1698  IF (dectrstate == nan) dectrstate = 0
1699  IF (grassstate == nan) grassstate = 0
1700  IF (bsoilstate == nan) bsoilstate = 0
1701  ! except for water surface - set using WaterDepth in SUEWS_Water.txt
1702  IF (waterstate == nan) waterstate = surfacechar(gridiv, c_waterdepth)
1703 
1704  ! Check initial soil moisture states are provided -------------------------
1707  CALL errorhint(36, 'Initial soil moisture must be provided for all surface types except water.', notused, notused, notusedi)
1708  ENDIF
1709 
1710  ! Set snow-related initial conditions -------------------------------
1711  ! If snow part not used, or no snow initially, set all snow-related initial conditions to zero
1712  IF (snowuse == 0 .OR. snowinitially == 0) THEN
1720  snowpackpaved = 0
1721  snowpackbldgs = 0
1722  snowpackevetr = 0
1723  snowpackdectr = 0
1724  snowpackgrass = 0
1725  snowpackbsoil = 0
1726  snowpackwater = 0
1727  snowfracpaved = 0
1728  snowfracbldgs = 0
1729  snowfracevetr = 0
1730  snowfracdectr = 0
1731  snowfracgrass = 0
1732  snowfracbsoil = 0
1733  snowfracwater = 0
1734  snowdenspaved = 0
1735  snowdensbldgs = 0
1736  snowdensevetr = 0
1737  snowdensdectr = 0
1738  snowdensgrass = 0
1739  snowdensbsoil = 0
1740  snowdenswater = 0
1741  snowalb0 = 0
1742  ELSEIF (snowinitially == int(nan)) THEN !Check all required snow-related conditions are provided
1745  snowwaterwaterstate == nan) THEN
1746  CALL errorhint(36, 'Specify SnowWater state for all 7 surface types.', notused, notused, notusedi)
1747  ENDIF
1748  IF (snowpackpaved == nan .OR. snowpackbldgs == nan .OR. snowpackevetr == nan .OR. &
1749  snowpackdectr == nan .OR. snowpackgrass == nan .OR. snowpackbsoil == nan .OR. &
1750  snowpackwater == nan) THEN
1751  CALL errorhint(36, 'Specify SnowPack for all 7 surface types.', notused, notused, notusedi)
1752  ENDIF
1753  IF (snowfracpaved == nan .OR. snowfracbldgs == nan .OR. snowfracevetr == nan .OR. &
1754  snowfracdectr == nan .OR. snowfracgrass == nan .OR. snowfracbsoil == nan .OR. &
1755  snowfracwater == nan) THEN
1756  CALL errorhint(36, 'Specify SnowFrac for all 7 surface types.', notused, notused, notusedi)
1757  ENDIF
1758  IF (snowdenspaved == nan .OR. snowdensbldgs == nan .OR. snowdensevetr == nan .OR. &
1759  snowdensdectr == nan .OR. snowdensgrass == nan .OR. snowdensbsoil == nan .OR. &
1760  snowdenswater == nan) THEN
1761  CALL errorhint(36, 'Specify SnowDens for all 7 surface types.', notused, notused, notusedi)
1762  ENDIF
1763  IF (snowalb0 == nan) THEN
1764  CALL errorhint(36, 'Specify SnowAlb0.', notused, notused, notusedi)
1765  ENDIF
1766  ELSE
1767  CALL errorhint(36, 'SnowInitially must be 0 or -999 (or omitted from InitialConditions namelist)', &
1769  ENDIF
1770 
1771  ! removed as no longer needed, TS 30 Jan 2018
1772  ! ! If AnOHM option selected, check initial Bowen ratio is provided ---------
1773  ! IF(StorageHeatMethod==3 .AND. BoInit == NAN) THEN
1774  ! CALL ErrorHint(36,'Specify BoInit for AnOHM calculations.', notUsed,notUsed,notUsedI)
1775  ! ENDIF
1776 
1777  ! -------------------------------------------------------------------------
1778  ! -------------------------------------------------------------------------
1779 
1780  ! Previous day DOY number (needed in file allocations)
1781  IF (id_prev >= 364) id_prev = 0 !If previous day is larger than 364, set this to zero
1782 
1783  ! Save initial conditions to ModelDailyState array ------------------------
1790  modeldailystate(gridiv, cmds_gddmin) = 90 !QUESTION: Going to check for minimum GDD
1791  modeldailystate(gridiv, cmds_gddmax) = -90 !QUESTION: Going to check for maximum GDD
1797 
1798  modeldailystate(gridiv, cmds_snowfallcum) = 0 !!Check this
1799 
1800  modeldailystate(gridiv, cmds_dayssincerain) = REAL(dayssincerain, kind(1d0))
1802  ! Assume that the temperature has been the same for the previous days
1806 
1807  ! -- Anthropogenic heat flux initializations --
1808  ! Need to get BaseTHDD from SurfaceChar, as info not transferred until SUEWS_Translate called
1809  basethdd = surfacechar(gridiv, c_basethdd)
1810 
1811  IF (emissionsmethod >= 0) THEN
1812  !Calculations related to heating and cooling degree days (BaseT is used always)
1813  IF ((temp_c0 - basethdd) >= 0) THEN !Cooling
1814  gamma2 = 1
1815  ELSE
1816  gamma2 = 0
1817  ENDIF
1818  IF ((basethdd - temp_c0) >= 0) THEN !Heating
1819  gamma1 = 1
1820  ELSE
1821  gamma1 = 0
1822  ENDIF
1823  modeldailystate(gridiv, cmds_hdd1) = gamma1*(basethdd - temp_c0) ! Heating
1824  modeldailystate(gridiv, cmds_hdd2) = gamma2*(temp_c0 - basethdd) ! Cooling
1825  ENDIF
1826 
1827  ! -- Save snow density and snow albedo info in InitialConditions to ModelDailyState array --
1828  modeldailystate(gridiv, cmds_snowdens(pavsurf)) = snowdenspaved
1829  modeldailystate(gridiv, cmds_snowdens(bldgsurf)) = snowdensbldgs
1830  modeldailystate(gridiv, cmds_snowdens(conifsurf)) = snowdensevetr
1831  modeldailystate(gridiv, cmds_snowdens(decidsurf)) = snowdensdectr
1832  modeldailystate(gridiv, cmds_snowdens(grasssurf)) = snowdensgrass
1833  modeldailystate(gridiv, cmds_snowdens(bsoilsurf)) = snowdensbsoil
1834  modeldailystate(gridiv, cmds_snowdens(watersurf)) = snowdenswater
1835 
1837 
1838  ! -------------------------------------------------------------------------
1839 
1840  ! Saving to ModelOutputData array -----------------------------------------
1841 
1842  ! -- Initial wetness status of each surface (above ground) --
1843  modeloutputdata(0, cmod_state(pavsurf), gridiv) = pavedstate
1844  modeloutputdata(0, cmod_state(bldgsurf), gridiv) = bldgsstate
1845  modeloutputdata(0, cmod_state(conifsurf), gridiv) = evetrstate
1846  modeloutputdata(0, cmod_state(decidsurf), gridiv) = dectrstate
1847  modeloutputdata(0, cmod_state(grasssurf), gridiv) = grassstate
1848  modeloutputdata(0, cmod_state(bsoilsurf), gridiv) = bsoilstate
1849  modeloutputdata(0, cmod_state(watersurf), gridiv) = waterstate
1850 
1851  ! -- Initial soil stores for each surface (below ground) --
1858  modeloutputdata(0, cmod_soilstate(watersurf), gridiv) = 0 ! No soil layer for water surface
1859 
1860  ! -- Initial liquid (melted) water for each surface --
1868 
1869  ! -- Initial snow water equivalent for each surface --
1877 
1878  ! -- Initial fraction of snow on each surface --
1879  modeloutputdata(0, cmod_snowfrac(pavsurf), gridiv) = snowfracpaved
1880  modeloutputdata(0, cmod_snowfrac(bldgsurf), gridiv) = snowfracbldgs
1881  modeloutputdata(0, cmod_snowfrac(conifsurf), gridiv) = snowfracevetr
1882  modeloutputdata(0, cmod_snowfrac(decidsurf), gridiv) = snowfracdectr
1883  modeloutputdata(0, cmod_snowfrac(grasssurf), gridiv) = snowfracgrass
1884  modeloutputdata(0, cmod_snowfrac(bsoilsurf), gridiv) = snowfracbsoil
1885  modeloutputdata(0, cmod_snowfrac(watersurf), gridiv) = snowfracwater
1886 
1887  icefrac = 0.2 !Estimated fraction of ice. Should be improved in the future
1888 
1889  ! At this point translate arrays to variables (needed for SUEWS_cal_RoughnessParameters)
1890  CALL suews_translate(gridiv, 0, 0)
1891 
1892  !Calculation of roughness parameters (N.B. uses porosity)
1893  IF (diagnose == 1) print *, 'calling in initial state: SUEWS_cal_RoughnessParameters'
1895  roughlenmommethod, sfr, &!input
1896  bldgh, evetreeh, dectreeh, &
1898  z0m_in, zdm_in, z, &
1899  planf, &!output
1900  zh, z0m, zdm, zzd)
1901 
1902  !=============================================================================
1903  ! If the run start day is at previous year, then calculate the number of days
1904  ! in that year.
1905 
1906  !First we need to know if the previous day given in initial conditions (id_prev) is
1907  !on previous year as this is needed in the initialization of DayofWeek matrix.
1908  !In this case switch is set to one for date calculations.
1909  IF (id_prev == 0) THEN !If id_prev = 0, means that the first modelled day is 1 Jan
1910  year_int = year_int - 1 !1) find the number of days on that year
1911  CALL leapyearcalc(year_int, id_prev) !2) set switch to 1 so that the code knows to change back to current year (switch=0)
1912  switch = 1
1913  ENDIF
1914 
1915  CALL day2month(id_prev, mb, date, seas, year_int, lat) !Calculate date information (mb = month, date = day,...)
1916  CALL day_of_week(date, mb, year_int, wd) !Calculate weekday of the previous day (wd) (1=Sun, ..., 7=Sat)
1917 
1918  !After the day in previous year switch is changed back to zero:
1919  ! ie not previous day anymore
1920  !Also the size of DayofWeek is from 0:NdaysinYear meaning
1921  !that in zero slot is the previous day information
1922  IF (switch == 1) THEN
1923  year_int = year_int + 1
1924  id_prev = 0
1925  switch = 0
1926  ENDIF
1927 
1928  ! DayofWeek(id_prev,1)=wd ! day of week
1929  ! DayofWeek(id_prev,2)=mb ! month
1930  ! DayofWeek(id_prev,3)=seas ! season (summer=1, winter=2) needed for accumulation
1931 
1932  ! in case next day goes to next year calculate again the date information for DayofWeek matrix.
1933  id_next = id_prev + 1
1934  IF (id_next > nofdaysthisyear) THEN
1935  id_next = 1
1936  year_int = year_int + 1
1937  switch = 1
1938  CALL errorhint(43, 'switch- years', notused, notused, notusedi)
1939  ENDIF
1940 
1941  CALL day2month(id_next, mb, date, seas, year_int, lat) !Calculate real date from doy
1942  CALL day_of_week(date, mb, year_int, wd) !Calculate weekday (1=Sun, ..., 7=Sat)
1943 
1944  IF (switch == 1) THEN
1945  iy = iy - 1
1946  switch = 0
1947  ENDIF
1948 
1949  ! DayofWeek(id_next,1)=wd ! day of week
1950  ! DayofWeek(id_next,2)=mb ! month
1951  ! DayofWeek(id_next,3)=seas ! season
1952 
1953  !=============================================================================
1954 
1955  !id=id_prev
1956  !it= 23 !!LastTimeOfDay
1957  IF (id_prev >= startdls .AND. id_prev <= enddls) THEN !Summertime
1958  dls = 1
1959  ELSE
1960  dls = 0
1961  ENDIF
1962 
1963  ! -----------------------------------------------------------------------
1964  ! Calculate daily water use if modelled (i.e. if WaterUseMethod = 0).
1965  ! Calculated from previous day information given in InitialConditions file
1966  CALL suews_cal_weekday( &
1967  iy, id, lat, & !input
1968  dayofweek_id) !output
1969 
1970  CALL update_wateruse( &
1971  id, waterusemethod, dayofweek_id, lat, faut, hdd_id, &!input
1973  wuday_id) !output
1974 
1975  ! WUDay_id=0 !Initialize WUDay
1976  ! IF (WaterUseMethod==0) THEN !Model water use
1977  ! calc=0
1978  !
1979  ! IF (DayWat(wd)==1.0) THEN !if DayWat(wd)=1.0 (irrigation occurs on this day)
1980  ! IF (lat>=0) THEN !Northern Hemisphere
1981  ! IF (id>=Ie_start.AND.id<=Ie_end) calc=1 !if day between irrigation period
1982  ! ELSE !Southern Hemisphere
1983  ! calc=1
1984  ! IF (id>=Ie_end.AND.id<=Ie_start) calc=0 !if day between irrigation period
1985  ! ENDIF
1986  ! IF(calc==1) THEN
1987  ! ! Model daily water use based on HDD_id(6)(days since rain) and HDD_id(3)(average temp)
1988  !
1989  ! ! ---- Automatic irrigation (evergreen trees) ----
1990  ! WUDay_id(2) = Faut*(Ie_a(1)+Ie_a(2)*HDD_id(3)+Ie_a(3)*HDD_id(6))*sfr(ConifSurf)*IrrFracConif*DayWatPer(wd)
1991  ! IF (WUDay_id(2)<0) WUDay_id(2)=0 !If modelled WU is negative -> 0
1992  !
1993  ! ! ---- Manual irrigation (evergreen trees) ----
1994  ! WUDay_id(3) = (1-Faut)*(Ie_m(1)+Ie_m(2)*HDD_id(3)+Ie_m(3)*HDD_id(6))*sfr(ConifSurf)*IrrFracConif*DayWatPer(wd)
1995  ! IF (WUDay_id(3)<0) WUDay_id(3)=0 !If modelled WU is negative -> 0
1996  !
1997  ! ! ---- Total evergreen trees water use (automatic + manual) ----
1998  ! WUDay_id(1)=(WUDay_id(2)+WUDay_id(3))
1999  !
2000  ! ! ---- Automatic irrigation (deciduous trees) ----
2001  ! WUDay_id(5) = Faut*(Ie_a(1)+Ie_a(2)*HDD_id(3)+Ie_a(3)*HDD_id(6))*sfr(DecidSurf)*IrrFracDecid*DayWatPer(wd)
2002  ! IF (WUDay_id(5)<0) WUDay_id(5)=0 !If modelled WU is negative -> 0
2003  !
2004  ! ! ---- Manual irrigation (deciduous trees) ----
2005  ! WUDay_id(6) = (1-Faut)*(Ie_m(1)+Ie_m(2)*HDD_id(3)+Ie_m(3)*HDD_id(6))*sfr(DecidSurf)*&
2006  ! IrrFracDecid*DayWatPer(wd)
2007  ! IF (WUDay_id(6)<0) WUDay_id(6)=0 !If modelled WU is negative -> 0
2008  !
2009  ! ! ---- Total deciduous trees water use (automatic + manual) ----
2010  ! WUDay_id(4)=(WUDay_id(5)+WUDay_id(6))
2011  !
2012  ! ! ---- Automatic irrigation (grass) ----
2013  ! WUDay_id(8) = Faut*(Ie_a(1)+Ie_a(2)*HDD_id(3)+Ie_a(3)*HDD_id(6))*sfr(GrassSurf)*&
2014  ! IrrFracGrass*DayWatPer(wd)
2015  ! IF (WUDay_id(8)<0) WUDay_id(8)=0 !If modelled WU is negative -> 0
2016  ! ! ---- Manual irrigation (grass) ----
2017  ! WUDay_id(9) = (1-Faut)*(Ie_m(1)+Ie_m(2)*HDD_id(3)+Ie_m(3)*HDD_id(6))*sfr(GrassSurf)*&
2018  ! IrrFracGrass*DayWatPer(wd)
2019  ! IF (WUDay_id(9)<0) WUDay_id(9)=0 !If modelled WU is negative -> 0
2020  ! ! ---- Total grass water use (automatic + manual) ----
2021  ! WUDay_id(7)=(WUDay_id(8)+WUDay_id(9))
2022  ! ELSE
2023  ! WUDay_id(1)=0
2024  ! WUDay_id(2)=0
2025  ! WUDay_id(3)=0
2026  ! WUDay_id(4)=0
2027  ! WUDay_id(5)=0
2028  ! WUDay_id(6)=0
2029  ! WUDay_id(7)=0
2030  ! WUDay_id(8)=0
2031  ! WUDay_id(9)=0
2032  ! ENDIF
2033  ! ENDIF
2034  ! ENDIF
2035 
2036  ! -----------------------------------------------------------------------
2037 
2038  ! ---- AnOHM TS ---------------------
2039  ! initialize Bowen ratio
2040  ! Bo_grids(0,:)=2.
2041  ! mAH_grids(0,:)=25.
2042 
2043  ! -----------------------------------
2044 
2045  RETURN
2046 
2047 600 CALL errorhint(47, trim(fileinit), notused, notused, notusedi)
2048 601 CALL errorhint(48, trim(fileinit), notused, notused, ios_out)
2049 
real(kind(1d0)) evetreeh
real(kind(1d0)) soilstorebldgsstate
integer numberofgrids
real(kind(1d0)), dimension(3) ie_m
real(kind(1d0)), dimension(nsurf) icefrac
real(kind(1d0)) snowpackbsoil
integer, parameter ivgrass
integer diagnose
real(kind(1d0)) nan
real(kind(1d0)) z
integer, parameter bsoilsurf
real(kind(1d0)) faibldg
real(kind(1d0)) basethdd
real(kind(1d0)) notused
integer, dimension(nvegsurf) c_sddfull
integer, dimension(nsurf) c_albmin
subroutine day2month(b, mb, md, seas, year, latitude)
real(kind(1d0)) temp_c0
integer dls
subroutine leapyearcalc(year_int, nroDays)
integer snowuse
real(kind(1d0)) snowwaterbldgsstate
real(kind(1d0)) zdm
real(kind(1d0)) planf
real(kind(1d0)) soilstorepavedstate
integer, dimension(nvegsurf) c_porositymin
real(kind(1d0)) snowpackdectr
real(kind(1d0)) gdd_1_0
real(kind(1d0)) zh
real(kind(1d0)) soilstoregrassstate
real(kind(1d0)) snowwaterwaterstate
real(kind(1d0)), dimension(:, :), allocatable surfacechar
integer emissionsmethod
integer, dimension(nvegsurf) c_porositymax
integer, dimension(nvegsurf) c_laimax
real(kind(1d0)) snowwatergrassstate
integer startdls
real(kind(1d0)) zdm_in
real(kind(1d0)) snowpackbldgs
subroutine suews_translate(Gridiv, ir, iMB)
real(kind(1d0)) faievetree
real(kind(1d0)) zzd
real(kind(1d0)) snowwaterbsoilstate
integer, parameter conifsurf
integer id
real(kind(1d0)), dimension(12) hdd_id
real(kind(1d0)) snowwaterevetrstate
real(kind(1d0)) laiinitialdectr
real(kind(1d0)) porosity0
real(kind(1d0)) dectreeh
character(len=150) fileinputpath
real(kind(1d0)) faut
real(kind(1d0)) lat
integer, parameter grasssurf
integer, dimension(nvegsurf) c_laimin
real(kind(1d0)) snowpackpaved
real(kind(1d0)), dimension(:, :), allocatable modeldailystate
integer iy
integer, dimension(nsurf) cmod_state
real(kind(1d0)) snowpackgrass
integer, parameter ivconif
integer, dimension(nsurf) c_stormin
real(kind(1d0)) function normalizevegchar(VegCol, Gridiv)
real(kind(1d0)) faidectree
integer nofdaysthisyear
integer, dimension(nsurf) c_albmax
character(len=20) filecode
real(kind(1d0)) albevetr0
subroutine suews_cal_weekday(iy, id, lat, dayofWeek_id)
integer, dimension(nsurf) cmod_snowfrac
real(kind(1d0)), dimension(3) ie_a
real(kind(1d0)) z0m_in
real(kind(1d0)) albdectr0
integer, dimension(nsurf) c_stormax
real(kind(1d0)) soilstorebsoilstate
integer, dimension(nsurf) cmod_snowwaterstate
subroutine day_of_week(DATE, MONTH, YEAR, DOW)
real(kind(1d0)) snowpackevetr
real(kind(1d0)) snowwaterpavedstate
real(kind(1d0)) porosity_id
real(kind(1d0)) laiinitialevetr
real(kind(1d0)) snowalb0
real(kind(1d0)) soilstoredectrstate
integer, dimension(nsurf) cmod_snowpack
real(kind(1d0)) snowpackwater
real(kind(1d0)), dimension(7) daywatper
real(kind(1d0)), dimension(nsurf) sfr
real(kind(1d0)) laiinitialgrass
subroutine suews_cal_roughnessparameters(RoughLenMomMethod, sfr, bldgH, EveTreeH, DecTreeH, porosity_id, FAIBldg, FAIEveTree, FAIDecTree, z0m_in, zdm_in, Z, planF, Zh, z0m, zdm, ZZD)
real(kind(1d0)) decidcap0
real(kind(1d0)) snowwaterdectrstate
real(kind(1d0)), dimension(:, :, :), allocatable metforcingdata
subroutine update_wateruse(id, WaterUseMethod, DayofWeek_id, lat, Faut, HDD_id, Ie_a, Ie_m, Ie_start, Ie_end, DayWatPer, DayWat, WUDay_id)
integer roughlenmommethod
integer waterusemethod
integer, dimension(nsurf) cmod_soilstate
real(kind(1d0)), dimension(9) wuday_id
real(kind(1d0)) bldgh
real(kind(1d0)) gdd_2_0
integer, parameter decidsurf
real(kind(1d0)) z0m
integer, parameter pavsurf
integer, dimension(nsurf) cmds_snowdens
real(kind(1d0)) soilstoreevetrstate
real(kind(1d0)) albgrass0
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
real(kind(1d0)), dimension(:, :, :), allocatable modeloutputdata
integer, parameter bldgsurf
integer, parameter watersurf
integer, dimension(nvegsurf) c_gddfull
integer multipleinitfiles
character(len=150) fileoutputpath
character(len=150) filechoices
real(kind(1d0)), dimension(7) daywat
integer, parameter ivdecid
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nextinitial()

subroutine nextinitial ( character(len=15)  GridName,
integer  year_int 
)

Definition at line 2080 of file suews_ctrl_init.f95.

References allocatearray::albdectr_id, allocatearray::albevetr_id, allocatearray::albgrass_id, allocatearray::bldgsurf, allocatearray::bsoilsurf, allocatearray::conifsurf, allocatearray::decidcap_id, allocatearray::decidsurf, errorhint(), data_in::fileinputpath, allocatearray::gdd_id, allocatearray::grasssurf, allocatearray::hdd_id, time::id, time::imin, time::it, allocatearray::ivconif, allocatearray::ivdecid, allocatearray::ivgrass, time::iy, allocatearray::lai_id, time::nofdaysthisyear, defaultnotused::notused, defaultnotused::notusedi, sues_data::nsh_real, allocatearray::pavsurf, allocatearray::porosity_id, snowmod::snowalb, allocatearray::snowdens, allocatearray::snowfrac, allocatearray::snowpack, data_in::snowuse, allocatearray::snowwater, allocatearray::soilstore_id, allocatearray::state_id, allocatearray::watersurf, and data_in::year.

Referenced by suews_program().

2080  ! Last modified HCW 24 May 2016
2081  ! Year of InitialConditions output file fixed. _EndofRun appended to files where the run finishes before the year end
2082  ! Last modified LJ 06 Jul 2015
2083  ! Initial conditions of SnowAlb added, densSnow changed to SnowDens
2084  ! Last modified HCW 03 Jul 2015
2085  ! Added initial conditions albEveTr0 and albGrass0
2086  ! Modified by HCW 21 Nov 2014
2087  ! Last day of year is not anymore the number of days on that year, but rather
2088  ! id == 1. Thus nofDaysThisYear was changed to 1. LJ 9/4/2015
2089  !------------------------------------------------------------------------
2090 
2091  USE allocatearray
2092  USE colnamesinputfiles
2094  USE data_in
2095  USE defaultnotused
2096  USE initial
2097  USE sues_data
2098  USE snowmod
2099  USE time
2100  USE initialcond
2101 
2102  IMPLICIT NONE
2103 
2104  CHARACTER(len=15)::gridname
2105  CHARACTER(len=4)::year_txt2
2106  INTEGER:: year_int2
2107  INTEGER:: year_int
2108  INTEGER:: id_prev_out ! ID_Prev written to next Initial Conditions file
2109  INTEGER:: nofdaysthisyear_foroutput !Added HCW 13 Jan 2017
2110 
2111  year = year_int !HCW added 21 Nov 2014
2112 
2113  ! Modified by HCW 24 May 2016
2114  IF (id == 1 .AND. iy == (year + 1)) THEN !if id = 1 and this is the first row of next year
2115  year_int2 = int(year + 1)
2116  WRITE (year_txt2, '(I4)') year_int2
2117  OPEN (57, file=trim(fileinputpath)//trim("InitialConditions")//trim(gridname)//'_'//trim(adjustl(year_txt2))//'.nml', err=200)
2118  nofdaysthisyear_foroutput = nofdaysthisyear
2119  ELSE
2120  year_int2 = int(year) !End of Run but not end of year
2121  WRITE (year_txt2, '(I4)') year_int2
2122  OPEN (57, file=trim(fileinputpath)//trim("InitialConditions")//trim(gridname)//'_'//trim(adjustl(year_txt2))// &
2123  '_EndofRun.nml', err=201)
2124  nofdaysthisyear_foroutput = id - 1
2125  ENDIF
2126  id_prev_out = (id - 1)
2127 
2128  !! If last time of day, then DailyState variables will have been updated so can write out arrays for id rather than id-1
2129  !if(it==23 .and. imin == (nsh_real-1)/nsh_real*60) then !!LastTimeofday
2130  ! id=id+1
2131  !endif
2132  WRITE (57, *) '&InitialConditions'
2133  WRITE (57, *) 'DaysSinceRain=', int(hdd_id(12))
2134  WRITE (57, *) 'Temp_C0=', hdd_id(9)
2135  !WRITE(57,*)'ID_Prev=',ID_Prev_Out !No longer included in initial conditions (HCW 13 Jan 2017)
2136  WRITE (57, *) 'GDD_1_0=', gdd_id(1)
2137  WRITE (57, *) 'GDD_2_0=', gdd_id(2)
2138  WRITE (57, *) 'LAIinitialEveTr=', lai_id(ivconif)
2139  WRITE (57, *) 'LAIinitialDecTr=', lai_id(ivdecid)
2140  WRITE (57, *) 'LAIinitialGrass=', lai_id(ivgrass)
2141  WRITE (57, *) 'AlbEveTr0=', albevetr_id
2142  WRITE (57, *) 'AlbDecTr0=', albdectr_id
2143  WRITE (57, *) 'AlbGrass0=', albgrass_id
2144  WRITE (57, *) 'DecidCap0=', decidcap_id
2145  WRITE (57, *) 'Porosity0=', porosity_id
2146  WRITE (57, *) 'SoilStorePavedState=', soilstore_id(pavsurf)
2147  WRITE (57, *) 'SoilStoreBldgsState=', soilstore_id(bldgsurf)
2148  WRITE (57, *) 'SoilStoreEveTrState=', soilstore_id(conifsurf)
2149  WRITE (57, *) 'SoilStoreDecTrState=', soilstore_id(decidsurf)
2150  WRITE (57, *) 'SoilStoreGrassState=', soilstore_id(grasssurf)
2151  WRITE (57, *) 'SoilStoreBSoilState=', soilstore_id(bsoilsurf)
2152  WRITE (57, *) 'PavedState=', state_id(pavsurf)
2153  WRITE (57, *) 'BldgsState=', state_id(bldgsurf)
2154  WRITE (57, *) 'EveTrState=', state_id(conifsurf)
2155  WRITE (57, *) 'DecTrState=', state_id(decidsurf)
2156  WRITE (57, *) 'GrassState=', state_id(grasssurf)
2157  WRITE (57, *) 'BSoilState=', state_id(bsoilsurf)
2158  WRITE (57, *) 'WaterState=', state_id(watersurf)
2159  ! Only write snow variables if snow part is running
2160  IF (snowuse == 1) THEN
2161  WRITE (57, *) 'SnowWaterPavedState=', snowwater(pavsurf)
2162  WRITE (57, *) 'SnowWaterBldgsState=', snowwater(bldgsurf)
2163  WRITE (57, *) 'SnowWaterEveTrState=', snowwater(conifsurf)
2164  WRITE (57, *) 'SnowWaterDecTrState=', snowwater(decidsurf)
2165  WRITE (57, *) 'SnowWaterGrassState=', snowwater(grasssurf)
2166  WRITE (57, *) 'SnowWaterBSoilState=', snowwater(bsoilsurf)
2167  WRITE (57, *) 'SnowWaterWaterState=', snowwater(watersurf)
2168  WRITE (57, *) 'SnowPackPaved=', snowpack(pavsurf)
2169  WRITE (57, *) 'SnowPackBldgs=', snowpack(bldgsurf)
2170  WRITE (57, *) 'SnowPackEveTr=', snowpack(conifsurf)
2171  WRITE (57, *) 'SnowPackDecTr=', snowpack(decidsurf)
2172  WRITE (57, *) 'SnowPackGrass=', snowpack(grasssurf)
2173  WRITE (57, *) 'SnowPackBSoil=', snowpack(bsoilsurf)
2174  WRITE (57, *) 'SnowPackWater=', snowpack(watersurf)
2175  WRITE (57, *) 'SnowFracPaved=', snowfrac(pavsurf)
2176  WRITE (57, *) 'SnowFracBldgs=', snowfrac(bldgsurf)
2177  WRITE (57, *) 'SnowFracEveTr=', snowfrac(conifsurf)
2178  WRITE (57, *) 'SnowFracDecTr=', snowfrac(decidsurf)
2179  WRITE (57, *) 'SnowFracGrass=', snowfrac(grasssurf)
2180  WRITE (57, *) 'SnowFracBSoil=', snowfrac(bsoilsurf)
2181  WRITE (57, *) 'SnowFracWater=', snowfrac(watersurf)
2182  WRITE (57, *) 'SnowDensPaved=', snowdens(pavsurf)
2183  WRITE (57, *) 'SnowDensBldgs=', snowdens(bldgsurf)
2184  WRITE (57, *) 'SnowDensEveTr=', snowdens(conifsurf)
2185  WRITE (57, *) 'SnowDensDecTr=', snowdens(decidsurf)
2186  WRITE (57, *) 'SnowDensGrass=', snowdens(grasssurf)
2187  WRITE (57, *) 'SnowDensBSoil=', snowdens(bsoilsurf)
2188  WRITE (57, *) 'SnowDensWater=', snowdens(watersurf)
2189  WRITE (57, *) 'SnowAlb0=', snowalb
2190  ENDIF
2191  ! WRITE(57,*)'BoInit=',BoInit
2192  WRITE (57, *) '/'
2193  CLOSE (57)
2194 
2195  IF (it == 23 .AND. imin == (nsh_real - 1)/nsh_real*60) THEN
2196  id = id - 1
2197  ENDIF
2198 
2199  RETURN
2200 
2201 200 CALL errorhint(49, trim("InitialConditions")//trim(gridname)// &
2202  '_'//trim(adjustl(year_txt2))//'.nml', notused, notused, notusedi)
2203 201 CALL errorhint(49, trim("InitialConditions")//trim(gridname)// &
2204  '_'//trim(adjustl(year_txt2))//'EoR.nml', notused, notused, notusedi)
2205 
real(kind(1d0)), dimension(nsurf) snowdens
real(kind(1d0)), dimension(nsurf) snowwater
real(kind(1d0)), dimension(nsurf) state_id
integer, parameter ivgrass
integer, parameter bsoilsurf
real(kind(1d0)) snowalb
real(kind(1d0)), dimension(nsurf) soilstore_id
real(kind(1d0)) notused
real(kind(1d0)) year
integer snowuse
real(kind(1d0)) albevetr_id
integer, parameter conifsurf
integer id
real(kind(1d0)), dimension(12) hdd_id
integer imin
character(len=150) fileinputpath
integer, parameter grasssurf
integer iy
real(kind(1d0)), dimension(nsurf) snowfrac
integer, parameter ivconif
integer nofdaysthisyear
real(kind(1d0)), dimension(nvegsurf) lai_id
real(kind(1d0)) porosity_id
real(kind(1d0)) albgrass_id
real(kind(1d0)), dimension(nsurf) snowpack
real(kind(1d0)) nsh_real
integer it
integer, parameter decidsurf
integer, parameter pavsurf
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
integer, parameter bldgsurf
integer, parameter watersurf
real(kind(1d0)), dimension(nvegsurf) gdd_id
real(kind(1d0)) albdectr_id
integer, parameter ivdecid
real(kind(1d0)) decidcap_id
Here is the call graph for this function:
Here is the caller graph for this function:

◆ normalizevegchar()

real(kind(1d0)) function normalizevegchar ( integer, dimension(nvegsurf)  VegCol,
integer  Gridiv 
)

Definition at line 2054 of file suews_ctrl_init.f95.

References colnamesinputfiles::c_frdectr, colnamesinputfiles::c_frevetr, colnamesinputfiles::c_frgrass, allocatearray::ivconif, allocatearray::ivdecid, allocatearray::ivgrass, and allocatearray::surfacechar.

2054 
2055  USE allocatearray
2056  USE colnamesinputfiles
2057 
2058  IMPLICIT NONE
2059 
2060  INTEGER, DIMENSION(nvegsurf):: vegcol !Must be column numbers defined for veg surfaces only
2061  INTEGER:: gridiv
2062  REAL(KIND(1d0)):: normvegresult
2063  IF (surfacechar(gridiv, c_frevetr) + &
2064  surfacechar(gridiv, c_frdectr) + &
2065  surfacechar(gridiv, c_frgrass) == 0.) THEN ! prevent arithmetic error under a full impervious scenario
2066  normvegresult = 0.
2067  ELSE
2068  normvegresult = (surfacechar(gridiv, vegcol(ivconif))*surfacechar(gridiv, c_frevetr) + &
2069  surfacechar(gridiv, vegcol(ivdecid))*surfacechar(gridiv, c_frdectr) + &
2070  surfacechar(gridiv, vegcol(ivgrass))*surfacechar(gridiv, c_frgrass))/ &
2071  (surfacechar(gridiv, c_frevetr) + surfacechar(gridiv, c_frdectr) + surfacechar(gridiv, c_frgrass))
2072  END IF
2073 
2074  RETURN
integer, parameter ivgrass
real(kind(1d0)), dimension(:, :), allocatable surfacechar
integer, parameter ivconif
integer, parameter ivdecid

◆ numberrows()

subroutine numberrows ( character(len=50)  FileN,
integer  SkipHeaderLines 
)

Definition at line 403 of file suews_ctrl_init.f95.

References errorhint(), data_in::fileinputpath, initial::nlines, defaultnotused::notused, and defaultnotused::notusedi.

Referenced by overallruncontrol().

403 
404  USE data_in
405  USE defaultnotused
406  USE initial
407 
408  IMPLICIT NONE
409 
410  CHARACTER(len=50):: filen
411  INTEGER:: skipheaderlines, runnumber
412  INTEGER:: skipcounter
413  INTEGER:: ios
414 
415  WRITE (*, *) filen
416  OPEN (39, file=trim(fileinputpath)//trim(filen), err=204, status='old')
417 
418  IF (skipheaderlines > 0) THEN
419  DO skipcounter = 1, skipheaderlines
420  READ (39, *, err=205)
421  !write(*,*) SkipCounter, SkipHeaderLines
422  ENDDO
423  ENDIF
424 
425  nlines = 0 !Initialize nlines
426  DO
427  READ (39, *, iostat=ios) runnumber
428  IF (ios < 0 .OR. runnumber == -9) EXIT !IF(RunNumber==-9) EXIT
429  nlines = nlines + 1
430  END DO
431  !write(*,*) 'nlines read: ',nlines
432  CLOSE (39)
433 
434  RETURN
435 
436 204 CALL errorhint(47, trim(fileinputpath)//trim(filen), notused, notused, notusedi)
437 205 CALL errorhint(48, trim(fileinputpath)//trim(filen), notused, notused, notusedi)
438 
real(kind(1d0)) notused
character(len=150) fileinputpath
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
integer nlines
Here is the call graph for this function:
Here is the caller graph for this function:

◆ overallruncontrol()

subroutine overallruncontrol ( )

Definition at line 6 of file suews_ctrl_init.f95.

References allocatearray::anthropogenic_coeff, allocatearray::biogen_coeff, data_in::cbluse, allocatearray::conductance_coeff, data_in::diagnose, data_in::diagnosedisagg, data_in::diagnosedisaggestm, data_in::diagqn, data_in::diagqs, data_in::disaggmethod, data_in::disaggmethodestm, data_in::emissionsmethod, errorhint(), allocatearray::estmcoefficients_coeff, data_in::evapmethod, data_in::filechoices, data_in::filecode, data_in::fileinputpath, data_in::fileoutputpath, sues_data::halftimestep, allocatearray::headeranthropogenic_file, allocatearray::headerbiogen_file, allocatearray::headercond_file, allocatearray::headerestmcoefficients_file, allocatearray::headerirrigation_file, allocatearray::headernonveg_file, allocatearray::headerohmcoefficients_file, allocatearray::headerprofiles_file, allocatearray::headersiteselect_file, allocatearray::headersnow_file, allocatearray::headersoil_file, allocatearray::headerveg_file, allocatearray::headerwater_file, allocatearray::headerwgwaterdist_file, data_in::inputmetformat, allocatearray::irrigation_coeff, data_in::kdownzen, data_in::keeptstepfilesin, data_in::keeptstepfilesout, data_in::laicalcyes, data_in::multipleestmfiles, data_in::multipleinitfiles, data_in::multiplemetfiles, data_in::multrainamongn, data_in::multrainamongnupperi, allocatearray::ncolumnsanthropogenic, allocatearray::ncolumnsbiogen, allocatearray::ncolumnsconductance, allocatearray::ncolumnsestmcoefficients, allocatearray::ncolumnsirrigation, allocatearray::ncolumnsnonveg, allocatearray::ncolumnsohmcoefficients, allocatearray::ncolumnsprofiles, allocatearray::ncolumnssiteselect, allocatearray::ncolumnssnow, allocatearray::ncolumnssoil, allocatearray::ncolumnsveg, allocatearray::ncolumnswater, allocatearray::ncolumnswgwaterdist, data_in::netradiationmethod, initial::nlines, initial::nlinesanthropogenic, initial::nlinesbiogen, initial::nlinesconductance, initial::nlinesestmcoefficients, initial::nlinesirrigation, initial::nlinesnonveg, initial::nlinesohmcoefficients, initial::nlinesprofiles, initial::nlinessiteselect, initial::nlinessnow, initial::nlinessoil, initial::nlinesveg, initial::nlineswater, initial::nlineswgwaterdist, allocatearray::nonveg_coeff, defaultnotused::notused, defaultnotused::notusedi, sues_data::nsd, sues_data::nsh, sues_data::nsh_real, numberrows(), allocatearray::ohmcoefficients_coeff, data_in::ohmincqf, allocatearray::profiles_coeff, data_in::rainamongn, data_in::raindisaggmethod, readcoeff(), data_in::resolutionfilesin, data_in::resolutionfilesinestm, data_in::resolutionfilesout, sues_data::roughlenheatmethod, data_in::roughlenmommethod, allocatearray::siteselect, data_in::skipheadersiteinfo, data_in::smdmethod, allocatearray::snow_coeff, data_in::snowuse, allocatearray::soil_coeff, sues_data::stabilitymethod, data_in::storageheatmethod, data_in::suppresswarnings, sues_data::t_interval, sues_data::tstep, sues_data::tstep_prev, sues_data::tstep_real, time::tstepcount, allocatearray::veg_coeff, allocatearray::water_coeff, data_in::waterusemethod, allocatearray::wgwaterdist_coeff, data_in::writedailystate, and data_in::writeoutoption.

Referenced by suews_program().

6  ! Last modified:
7  ! MH 21 Jun 2017 - Added anthropogenic CO2 parameters and changed AnthropogenicHeat to Anthropogenic
8  ! MH 16 Jun 2017 - Added biogenic CO2 parameters
9  ! HCW 21 Apr 2017 - Added new method for precip disaggregation
10  ! HCW 13 Jan 2017 - Changes to RunControl and InitialConditions
11  ! HCW 04 Nov 2016 - minor bug fix in LAImin/LAImax warnings related to 3 veg surface types out cf 7 surface types
12  ! LJ 27 Jan 2016 - Removal of tabs, cleaning of the code
13  ! HCW 06 Mar 2015 - Removed options 10,20,30 (NARPOutput) for NetRadiationMethod
14  ! HCW 06 Feb 2015 - File ID numbers changed so they are unique
15  ! HCW 19 Dec 2014
16  ! To Do:
17  ! - Holidays.txt input file needs to be read in and coded into model
18  ! - Add column header checks for SiteSelect
19  !-------------------------------------------------------------------------
20 
21  USE allocatearray
23  USE data_in
24  USE defaultnotused
25  USE filename
26  USE initial
27  USE gis_data
28  USE mod_z
29  USE resist
30  USE snowmod
31  USE sues_data
32  USE time
33 
34  IMPLICIT NONE
35 
36  INTEGER:: iv, i, skipcounter, ifile !iv and i, ii are integers used in do loops
37  CHARACTER(len=50):: filen
38  INTEGER, PARAMETER :: nfile = 13
39  CHARACTER(len=50), DIMENSION(nFile) :: &
40  filenames = [character(len=50) :: &
41  'SUEWS_NonVeg.txt', 'SUEWS_Veg.txt', 'SUEWS_Water.txt', 'SUEWS_Snow.txt', &
42  'SUEWS_Soil.txt', 'SUEWS_Conductance.txt', 'SUEWS_OHMCoefficients.txt', &
43  'SUEWS_ESTMCoefficients.txt', 'SUEWS_AnthropogenicEmission.txt', 'SUEWS_Irrigation.txt', &
44  'SUEWS_Profiles.txt', 'SUEWS_WithinGridWaterDist.txt', 'SUEWS_BiogenCO2.txt']
45 
46  ! ---- Namelist for RunControl.nml ----
47  namelist /runcontrol/ filecode, &
48  fileinputpath, &
50  tstep, &
60  cbluse, &
61  snowuse, &
62  ! SOLWEIGuse, &
67  smdmethod, &
70  ohmincqf, &
72  disaggmethod, &
75  rainamongn, &
78  kdownzen, &
80  ! ncMode, &
81  ! nRow, &
82  ! nCol, &
83  diagnose, &
86  diagqn, &
87  diagqs
88 
89  ! -------------------------------------
90 
91  !Initialise namelist with default values
94  writeoutoption = 0
95  disaggmethod = 1 ! linear disaggregation of averages
96  disaggmethodestm = 1 ! linear disaggregation of averages
97  raindisaggmethod = 100 ! even distribution among all subintervals
98  rainamongn = -999 ! no default setting for number of rainy subintervals
99  multrainamongn = -999 ! no default setting for number of rainy subintervals
100  multrainamongnupperi = -999 ! no default setting for rain intensity upper bound
101  kdownzen = 1 ! use zenith angle by default
102 
103  suppresswarnings = 0 ! write warnings file
104  resolutionfilesin = 0 ! Set to zero so that if not found, automatically set to Tstep below
105 
106  ! Set Diagnose switch to off (0). If Diagnose = 1 is set in RunControl, model progress will be printed
107  diagnose = 0
108  diagnosedisagg = 0
110  diagqn = 0
111  diagqs = 0
112 
113  filecode = 'none'
114  !smithFile='Smith1966.grd'
115 
116  !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117  !Read in the RunControl.nml file
118  OPEN (55, file='RunControl.nml', err=200, status='old') !Change with needs
119  READ (55, nml=runcontrol, err=201)
120  CLOSE (55)
121 
122  ! set tstep_prev as tstep ! TS 04 Jul 2018
123  ! tstep_prev is NOT used by SUEWS but by WRF-SUEWS through the main interface
124  tstep_prev = tstep
125 
126  IF (diagnose == 1) WRITE (*, *) 'Diagnosis switched on (model progress will be printed to screen)...'
127 
128  !Check for problems with FileCode
129  IF (filecode == 'none') CALL errorhint(26, trim("RunControl.nml FileCode is missing"), notused, notused, notusedi)
130 
131  IF (resolutionfilesin == 0) resolutionfilesin = tstep !If ResolutionFilesIn not found, automatically set to Tstep
132 
133  !-----------------------------------------------------------------------
134 
135  !Write RunControl information to FileChoices.txt
136  filechoices = trim(fileoutputpath)//trim(filecode)//'_FileChoices.txt'
137  OPEN (12, file=filechoices, err=203)
138  WRITE (12, *) '----- RunControl -----'
139  WRITE (12, nml=runcontrol)
140  CLOSE (12)
141 
142  ! !Determine what should be done with respect to radiation
143  ! ! TODO: this can be wrapped into a subroutine, TS 20 Oct 2017
144  ! AlbedoChoice=0
145  ! ldown_option=0
146  ! IF(NetRadiationMethod==0)THEN !Observed Q* from the met input file will be used
147  ! IF(snowUse==1) THEN !If snow is modelled, NARP is needed for surface temperature
148  ! NetRadiationMethod=3000
149  ! ldown_option=3 !Ldown will be modelled
150  ! !NetRadiationMethod=NetRadiationMethod/1000
151  ! ENDIF
152  !
153  ! ELSEIF(NetRadiationMethod>0)THEN !Modelled Q* is used (NARP)
154  ! AlbedoChoice=-9
155  ! IF(NetRadiationMethod<10) THEN
156  ! AlbedoChoice=0
157  ! IF(NetRadiationMethod==1)ldown_option=1
158  ! IF(NetRadiationMethod==2)ldown_option=2
159  ! IF(NetRadiationMethod==3)ldown_option=3
160  !
161  ! ELSEIF(NetRadiationMethod>=100.AND.NetRadiationMethod<1000) THEN
162  ! AlbedoChoice=1
163  ! IF(NetRadiationMethod==100)ldown_option=1
164  ! IF(NetRadiationMethod==200)ldown_option=2
165  ! IF(NetRadiationMethod==300)ldown_option=3
166  ! NetRadiationMethod=NetRadiationMethod/100
167  ! ENDIF
168  !
169  ! !If bad NetRadiationMethod value
170  ! IF(NetRadiationMethod>3.OR. AlbedoChoice==-9)THEN
171  ! WRITE(*,*) 'NetRadiationMethod=',NetRadiationMethod
172  ! WRITE(*,*) 'Value not usable'
173  ! STOP
174  ! ENDIF
175  ! ENDIF
176 
177  ! Adjust input for precip downscaling using different intensities (HCW 21 Apr 2017)
178  IF (raindisaggmethod == 102) THEN
179  DO i = 1, 5
181  ENDDO
182  ENDIF
183 
184  !------------------------------------------------------------------
185  !Print run information on the screen
186  WRITE (*, *) '--------------------------------------------------------'
187  WRITE (*, *) "LUMPS/SUEWS - relevant references"
188  WRITE (*, *) "LUMPS - Grimmond and Oke (2002) JAM, 41, 79-810"
189  WRITE (*, *) "OHM - Grimmond and Oke (1999) JAM, 38, 922-940"
190  WRITE (*, *) "NARP - Offerle et al. (2003) JAM"
191  WRITE (*, *) "SUES - Evaporation Grimmond & Oke (1991) WRR"
192  WRITE (*, *) "Water Balance Model Grimmond et al. (1986) WRR"
193  WRITE (*, *) "NARP - Long wave improvements (Loridan et al. 2011 JAMC)"
194  WRITE (*, *) "SUEWS - Anthropogenic heat, etc (Jarvi et al. 2011 JH)"
195  WRITE (*, *) "SUEWS - Snow module included (Jarvi et al. 2014 GMD)"
196  WRITE (*, *) "SUEWS - v2016a release (Ward et al. 2016 UC)"
197  WRITE (*, *) '--------------------------------------------------------'
198 
199  !=======================================================================
200  !======================== Read input files =============================
201  ! This part reads the input files derived from the SiteInfo spreadsheet
202 
203  WRITE (*, *) 'Reading the following input files:'
204 
205  !=======================SUEWS_SiteSelect.txt============================
206  filen = 'SUEWS_SiteSelect.txt'
207  CALL numberrows(filen, skipheadersiteinfo) !Find number of rows in input file
210  !Read input file
211  OPEN (21, file=trim(fileinputpath)//trim(filen), err=300, status='old')
212  DO skipcounter = 1, (skipheadersiteinfo - 1)
213  READ (21, *) !Skip lines before header
214  ENDDO
215  READ (21, *) (headersiteselect_file(iv), iv=1, ncolumnssiteselect) !Get header
216 
217  DO i = 1, nlinessiteselect
218  READ (21, *) (siteselect(i, iv), iv=1, ncolumnssiteselect)
219  !write(*,*) (SiteSelect(i,iv),iv=1,ncolumnsSiteSelect)
220  ENDDO
221  CLOSE (21)
222 
223  !call InputHeaderCheck(FileN) !! Need to add column checks for SiteSelect.txt
224 
225  ! FileNames = (/'SUEWS_NonVeg.txt', 'SUEWS_Veg.txt', 'SUEWS_Water.txt', 'SUEWS_Snow.txt', &
226  ! 'SUEWS_Soil.txt', 'SUEWS_Conductance.txt', 'SUEWS_OHMCoefficients.txt', &
227  ! 'SUEWS_ESTMCoefficients.txt', 'SUEWS_AnthropogenicEmission.txt', 'SUEWS_Irrigation.txt', &
228  ! 'SUEWS_Profiles.txt', 'SUEWS_WithinGridWaterDist.txt', 'SUEWS_BiogenCO2.txt'/)
229 
230  DO ifile = 1, nfile
231  CALL numberrows(filenames(ifile), skipheadersiteinfo) !Find number of rows in input file
232  SELECT CASE (ifile)
233  CASE (1)
237  CASE (2)
238  nlinesveg = nlines
239  ALLOCATE (veg_coeff(nlinesveg, ncolumnsveg))
240  CALL readcoeff(filenames(ifile), nlinesveg, ncolumnsveg, headerveg_file, veg_coeff)
241  CASE (3)
245  CASE (4)
247  ALLOCATE (snow_coeff(nlinessnow, ncolumnssnow))
248  CALL readcoeff(filenames(ifile), nlinessnow, ncolumnssnow, headersnow_file, snow_coeff)
249  CASE (5)
251  ALLOCATE (soil_coeff(nlinessoil, ncolumnssoil))
252  CALL readcoeff(filenames(ifile), nlinessoil, ncolumnssoil, headersoil_file, soil_coeff)
253  CASE (6)
257  CASE (7)
262  CASE (8)
267  CASE (9)
271  CASE (10)
275  CASE (11)
279  CASE (12)
283  CASE (13)
287  END SELECT
288  END DO
289 
290  !=======================================================================
291  !=======================================================================
292 
293  !-----------------------------------------------------------------------
294  !SUEWS run information
295  inputmetformat = 10 !Input met data file in LUMPS format(1) or SUEWS format(10)
296  laicalcyes = 1 !Use observed(0) or modelled(1) LAI
297  evapmethod = 2 !Evaporation calculated according to Rutter(1) or Shuttleworth(2)
298  writedailystate = 1 !Daily state file written
299  tstepcount = 0
300 
301  t_interval = 3600 !Number of seconds in an hour
302 
303  !Calculate nsh (number of steps per hour) from model timestep (tstep) set in in RunControl
304  nsh_real = t_interval/REAL(tstep, kind(1d0))
305 
306  ! Check nsh is an integer
307  IF (nsh_real == int(nsh_real)) THEN
308  nsh = int(nsh_real)
309  ELSE
310  CALL errorhint(39, &
311  'TSTEP must divide into t_INTERVAL exactly.', REAL(tstep, KIND(1d0)), REAL(t_INTERVAL, KIND(1d0)), notusedi)
312  ENDIF
313 
314  ! Check nsh is reasonable
315  IF (nsh_real < 6 .OR. nsh_real > 60) THEN
316  CALL errorhint(39, 'TSTEP is too small or too large.', REAL(tstep, KIND(1d0)), REAL(t_INTERVAL, KIND(1d0)), notusedi)
317  ENDIF
318 
319  ! Cast integer nsh as nsh_real for use in calculations
320  nsh_real = REAL(nsh, kind(1d0))
321  ! Cast integer tstep as tstep_real for use in calculations
322  tstep_real = REAL(tstep, kind(1d0))
323  ! get integer nsd from nsh for use in AnOHM checking, 20160708 TS
324  nsd = 24*nsh
325 
326  !! Check this is still valid for v2016a
327  halftimestep = REAL(tstep_real)/2/(24*3600) !Used in NARP_cal_SunPosition to get sunpos in the middle of timestep
328 
329  RETURN
330 
331  !-------Possible problems-----------------------------------------------
332 200 CALL errorhint(47, 'RunControl.nml', notused, notused, notusedi)
333 201 CALL errorhint(48, 'RunControl.nml', notused, notused, notusedi)
334 
335 203 CALL errorhint(47, trim(filechoices), notused, notused, notusedi)
336 
337 300 CALL errorhint(48, trim(filen), notused, notused, notusedi)
338  !-----------------------------------------------------------------------
339 
340  !pause
341 
integer, parameter ncolumnssnow
integer inputmetformat
integer, parameter ncolumnswgwaterdist
integer keeptstepfilesout
integer disaggmethodestm
integer diagqn
integer, parameter ncolumnssiteselect
integer diagnosedisaggestm
real(kind(1d0)) halftimestep
real(kind(1d0)), dimension(:, :), allocatable water_coeff
integer nlinessoil
integer, parameter ncolumnsnonveg
integer writedailystate
real(kind(1d0)), dimension(:, :), allocatable irrigation_coeff
integer nlinesestmcoefficients
integer skipheadersiteinfo
integer nlinesprofiles
real(kind(1d0)), dimension(:, :), allocatable soil_coeff
integer resolutionfilesout
integer, parameter ncolumnsveg
integer diagnose
integer keeptstepfilesin
real(kind(1d0)), dimension(:, :), allocatable estmcoefficients_coeff
real(kind(1d0)), dimension(:, :), allocatable snow_coeff
real(kind(1d0)) notused
character(len=20), dimension(ncolumnswgwaterdist) headerwgwaterdist_file
subroutine numberrows(FileN, SkipHeaderLines)
integer, parameter ncolumnsohmcoefficients
integer, parameter ncolumnsestmcoefficients
integer snowuse
integer nlinesirrigation
integer multipleestmfiles
integer, parameter ncolumnsirrigation
integer writeoutoption
real(kind(1d0)), dimension(5) multrainamongnupperi
integer suppresswarnings
integer, parameter ncolumnsbiogen
integer emissionsmethod
integer, parameter ncolumnswater
integer nlinesveg
character(len=20), dimension(ncolumnsprofiles) headerprofiles_file
character(len=20), dimension(ncolumnsirrigation) headerirrigation_file
integer multiplemetfiles
character(len=20), dimension(ncolumnsanthropogenic) headeranthropogenic_file
integer nlinesanthropogenic
integer resolutionfilesinestm
integer diagqs
integer nlinesconductance
integer kdownzen
integer, parameter ncolumnsconductance
integer nlinesohmcoefficients
integer nlineswater
character(len=20), dimension(ncolumnssoil) headersoil_file
character(len=150) fileinputpath
integer laicalcyes
real(kind(1d0)), dimension(:, :), allocatable siteselect
real(kind(1d0)), dimension(:, :), allocatable ohmcoefficients_coeff
real(kind(1d0)), dimension(:, :), allocatable anthropogenic_coeff
integer roughlenheatmethod
character(len=20), dimension(ncolumnsbiogen) headerbiogen_file
real(kind(1d0)) tstep_real
integer, parameter ncolumnsanthropogenic
integer, parameter ncolumnssoil
real(kind(1d0)), dimension(:, :), allocatable biogen_coeff
integer raindisaggmethod
integer nlinessiteselect
character(len=20) filecode
integer nlinesnonveg
character(len=20), dimension(ncolumnssnow) headersnow_file
real(kind(1d0)), dimension(:, :), allocatable wgwaterdist_coeff
subroutine readcoeff(FileName, nlines, ncolumns, HeaderFile, Coeff)
integer evapmethod
integer cbluse
integer nlinesbiogen
character(len=20), dimension(ncolumnsnonveg) headernonveg_file
integer disaggmethod
real(kind(1d0)), dimension(:, :), allocatable veg_coeff
character(len=20), dimension(ncolumnsohmcoefficients) headerohmcoefficients_file
character(len=20), dimension(ncolumnswater) headerwater_file
character(len=20), dimension(ncolumnsveg) headerveg_file
integer nlinessnow
integer smdmethod
integer nlineswgwaterdist
integer ohmincqf
integer resolutionfilesin
integer netradiationmethod
real(kind(1d0)), dimension(:, :), allocatable nonveg_coeff
real(kind(1d0)) nsh_real
integer, dimension(5) multrainamongn
integer roughlenmommethod
integer waterusemethod
integer rainamongn
character(len=20), dimension(ncolumnssiteselect) headersiteselect_file
real(kind(1d0)), dimension(:, :), allocatable conductance_coeff
real(kind(1d0)) tstepcount
integer, parameter ncolumnsprofiles
integer diagnosedisagg
character(len=20), dimension(ncolumnsestmcoefficients) headerestmcoefficients_file
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
integer storageheatmethod
integer stabilitymethod
integer nlines
character(len=20), dimension(ncolumnsconductance) headercond_file
integer multipleinitfiles
real(kind(1d0)), dimension(:, :), allocatable profiles_coeff
character(len=150) fileoutputpath
character(len=150) filechoices
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readcoeff()

subroutine readcoeff ( character(len=*), intent(in)  FileName,
integer, intent(in)  nlines,
integer, intent(in)  ncolumns,
character(len=*), dimension(ncolumns), intent(out)  HeaderFile,
real(kind(1d0)), dimension(nlines, ncolumns), intent(out)  Coeff 
)

Definition at line 346 of file suews_ctrl_init.f95.

References errorhint(), data_in::fileinputpath, inputheadercheck(), defaultnotused::notused, defaultnotused::notusedi, and data_in::skipheadersiteinfo.

Referenced by overallruncontrol().

346 
347  USE data_in
348  USE defaultnotused
349 
350  IMPLICIT NONE
351  !----------------------------------------------------------------------
352  ! dummy arguments
353  !----------------------------------------------------------------------
354  CHARACTER(len=*), INTENT(in) :: filename
355  INTEGER, INTENT(in) :: nlines, ncolumns
356  CHARACTER(len=*), INTENT(out) :: headerfile(ncolumns)
357  REAL(KIND(1d0)), INTENT(out) :: coeff(nlines, ncolumns)
358 
359  !----------------------------------------------------------------------
360  ! local variables
361  !----------------------------------------------------------------------
362  INTEGER :: skipcounter, iv, i, ii
363 
364  !Read input file
365  OPEN (22, file=trim(fileinputpath)//trim(filename), err=301, status='old')
366 
367  DO skipcounter = 1, skipheadersiteinfo - 1
368  READ (22, *) !Skip lines before header
369  ENDDO
370  READ (22, *) (headerfile(iv), iv=1, ncolumns) !Get header
371 
372  DO i = 1, nlines
373  READ (22, *) (coeff(i, iv), iv=1, ncolumns)
374  !write(*,*) (NonVeg_Coeff(i,iv),iv=1,ncolumnsNonVeg)
375  ENDDO
376  CLOSE (22)
377 
379 
380  ! Check codes are unique
381  DO i = 1, nlines
382  DO ii = i + 1, nlines
383  IF (coeff(i, 1) == coeff(ii, 1) .AND. i /= ii) THEN
384  WRITE (*, *) 'Code', coeff(i, 1), 'in ', trim(filename), ' not unique!'
385  CALL errorhint(60, filename, coeff(i, 1), notused, notusedi)
386  ENDIF
387  ENDDO
388  ENDDO
389 
390  RETURN
391 
392 301 CALL errorhint(48, trim(filename), notused, notused, notusedi)
393 
subroutine inputheadercheck(FileName)
integer skipheadersiteinfo
real(kind(1d0)) notused
character(len=150) fileinputpath
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
integer nlines
Here is the call graph for this function:
Here is the caller graph for this function:

◆ suews_initializemetdata()

subroutine suews_initializemetdata ( integer  lunit)

Definition at line 2214 of file suews_ctrl_init.f95.

References errorhint(), data_in::filemet, initial::gridcounter, data_in::inputmetformat, defaultnotused::ios_out, data_in::ldown_option, allocatearray::metforcingdata, metread(), data_in::netradiationmethod, defaultnotused::notused, defaultnotused::notusedi, initial::readlinesmetdata, skipheader(), data_in::skipheadermet, initial::skippedlines, sues_data::smcap, data_in::smdmethod, data_in::snowuse, sues_data::soildensity, sues_data::soildepthmeas, sues_data::soilrocks, and sues_data::tstep_real.

Referenced by suews_program().

2214 
2215  USE allocatearray
2216  USE data_in
2217  USE sues_data
2218  USE time
2219  USE defaultnotused
2220  USE initial
2221 
2222  IMPLICIT NONE
2223 
2224  INTEGER::lunit, i, iyy !,RunNumber,NSHcounter
2225  REAL(KIND(1d0)), DIMENSION(24)::metarray
2226  REAL(KIND(1d0)):: imin_prev, ih_prev, iday_prev, tstep_met, iy_only !For checks on temporal resolution of met data
2227 
2228  ! initialisation
2229  iy_only = 1
2230  ih_prev = 1
2231  imin_prev = 1
2232  iday_prev = 1
2233 
2234  !---------------------------------------------------------------
2235 
2236  !Open the file for reading and read the actual data
2237  !write(*,*) fileMet
2238  OPEN (lunit, file=trim(filemet), status='old', err=314)
2239  CALL skipheader(lunit, skipheadermet)
2240 
2241  ! Skip to the right place in the met file, depending on how many chunks have been read already
2242  IF (skippedlines > 0) THEN
2243  DO iyy = 1, skippedlines
2244  READ (lunit, *)
2245  ENDDO
2246  ENDIF
2247 
2248  ! Read in next chunk of met data and fill MetForcingData array with data for every timestep
2249  !NSHcounter = 1
2250  !write(*,*) 'ReadlinesMetdata:',ReadlinesMetdata
2251  DO i = 1, readlinesmetdata
2252  CALL metread(lunit, metarray, inputmetformat, ldown_option, netradiationmethod, &
2254  !DO iv=1,NSH
2255  ! MetForcingData(NSHcounter,1:24,GridCounter) = MetArray
2256  ! NSHcounter = NSHcounter + 1
2257  !ENDDO
2258  metforcingdata(i, 1:24, gridcounter) = metarray
2259  ! Check timestamp of met data file matches TSTEP specified in RunControl
2260  IF (i == 1) THEN
2261  imin_prev = metarray(4)
2262  ih_prev = metarray(3)
2263  iday_prev = metarray(2)
2264  iy_only = metarray(1)
2265  ELSEIF (i == 2) THEN
2266  tstep_met = ((metarray(4) + 60*metarray(3)) - (imin_prev + 60*ih_prev))*60 !tstep in seconds
2267  IF (tstep_met /= tstep_real .AND. metarray(2) == iday_prev) THEN
2268  CALL errorhint(39, 'TSTEP in RunControl does not match TSTEP of met data (DOY).', REAL(tstep, KIND(1d0)), tstep_met, &
2269  int(metarray(2)))
2270  ENDIF
2271  ENDIF
2272 
2273  ! Check file only contains a single year --------------------------------------------
2274  ! Very last data point is allowed to be (should be) timestamped with following year
2275  IF (metarray(1) /= iy_only) THEN
2276  IF (metarray(1) == iy_only + 1 .AND. metarray(2) == 1 .AND. metarray(3) == 0 .AND. metarray(4) == 0) THEN
2277  !write(*,*) 'end of year - no problem'
2278  ELSE
2279  CALL errorhint(3, 'Problem in SUEWS_Initial: multiple years found in met forcing file.', &
2280  metarray(1), notused, notusedi)
2281  ENDIF
2282  ENDIF
2283 
2284  ENDDO
2285 
2286  CLOSE (lunit)
2287 
2288  RETURN
2289 
2290 314 CALL errorhint(11, trim(filemet), notused, notused, ios_out)
2291 
integer inputmetformat
real(kind(1d0)) notused
real(kind(1d0)) soilrocks
integer snowuse
subroutine skipheader(lfn, skip)
subroutine metread(lfn, MetArray, InputmetFormat, ldown_option, NetRadiationMethod, snowUse, SMDMethod, SoilDepthMeas, SoilRocks, SoilDensity, SmCap)
real(kind(1d0)) soildensity
real(kind(1d0)) soildepthmeas
integer skipheadermet
real(kind(1d0)) smcap
integer skippedlines
real(kind(1d0)) tstep_real
character(len=150) filemet
integer ldown_option
integer smdmethod
integer netradiationmethod
real(kind(1d0)), dimension(:, :, :), allocatable metforcingdata
integer readlinesmetdata
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
integer gridcounter
Here is the call graph for this function:
Here is the caller graph for this function: