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

Functions/Subroutines

subroutine suews_cal_main (AerodynamicResistanceMethod, AH_MIN, AHProf_24hr, AH_SLOPE_Cooling, AH_SLOPE_Heating, alb, AlbMax_DecTr, AlbMax_EveTr, AlbMax_Grass, AlbMin_DecTr, AlbMin_EveTr, AlbMin_Grass, alpha_bioCO2, alpha_enh_bioCO2, alt, avkdn, avRh, avU1, BaseT, BaseTe, BaseTMethod, BaseT_HC, beta_bioCO2, beta_enh_bioCO2, bldgH, CapMax_dec, CapMin_dec, chAnOHM, CO2PointSource, cpAnOHM, CRWmax, CRWmin, DayWat, DayWatPer, DecTreeH, Diagnose, DiagQN, DiagQS, DRAINRT, dt_since_start, dqndt, qn1_av, dqnsdt, qn1_s_av, EF_umolCO2perJ, emis, EmissionsMethod, EnEF_v_Jkm, endDLS, EveTreeH, FAIBldg, FAIDecTree, FAIEveTree, Faut, FcEF_v_kgkm, fcld_obs, FlowChange, FrFossilFuel_Heat, FrFossilFuel_NonHeat, G1, G2, G3, G4, G5, G6, GDD_id, GDDFull, Gridiv, gsModel, H_maintain, HDD_id, HumActivity_24hr, IceFrac, id, Ie_a, Ie_end, Ie_m, Ie_start, imin, InternalWaterUse_h, IrrFracPaved, IrrFracBldgs, IrrFracEveTr, IrrFracDecTr, IrrFracGrass, IrrFracBSoil, IrrFracWater, isec, it, EvapMethod, iy, kkAnOHM, Kmax, LAI_id, LAICalcYes, LAIMax, LAIMin, LAI_obs, LAIPower, LAIType, lat, lenDay_id, ldown_obs, lng, MaxConductance, MaxFCMetab, MaxQFMetab, SnowWater, MetForcingData_grid, MinFCMetab, MinQFMetab, min_res_bioCO2, NARP_EMIS_SNOW, NARP_TRANS_SITE, NetRadiationMethod, OHM_coef, OHMIncQF, OHM_threshSW, OHM_threshWD, PipeCapacity, PopDensDaytime, PopDensNighttime, PopProf_24hr, PorMax_dec, PorMin_dec, Precip, PrecipLimit, PrecipLimitAlb, Press_hPa, QF0_BEU, Qf_A, Qf_B, Qf_C, qn1_obs, qs_obs, qf_obs, RadMeltFact, RAINCOVER, RainMaxRes, resp_a, resp_b, RoughLenHeatMethod, RoughLenMomMethod, RunoffToWater, S1, S2, SatHydraulicConduct, SDDFull, SDD_id, sfr, SMDMethod, SnowAlb, SnowAlbMax, SnowAlbMin, SnowPackLimit, SnowDens, SnowDensMax, SnowDensMin, SnowfallCum, SnowFrac, SnowLimBldg, SnowLimPaved, snowFrac_obs, SnowPack, SnowProf_24hr, snowUse, SoilDepth, soilstore_id, SoilStoreCap, StabilityMethod, startDLS, state_id, StateLimit, StorageHeatMethod, StoreDrainPrm, SurfaceArea, Tair_av, tau_a, tau_f, tau_r, Tmax_id, Tmin_id, BaseT_Cooling, BaseT_Heating, Temp_C, TempMeltFact, TH, theta_bioCO2, timezone, TL, TrafficRate, TrafficUnits, TraffProf_24hr, Ts5mindata_ir, tstep, tstep_prev, veg_type, WaterDist, WaterUseMethod, WetThresh, wu_m3, WUDay_id, DecidCap_id, albDecTr_id, albEveTr_id, albGrass_id, porosity_id, WUProfA_24hr, WUProfM_24hr, xsmd, Z, z0m_in, zdm_in, datetimeLine, dataOutLineSUEWS, dataOutLineSnow, dataOutLineESTM, dataoutLineRSL, dataOutLineSOLWEIG, DailyStateLine)
 
subroutine suews_cal_anthropogenicemission (AH_MIN, AHProf_24hr, AH_SLOPE_Cooling, AH_SLOPE_Heating, CO2PointSource, dayofWeek_id, DLS, EF_umolCO2perJ, EmissionsMethod, EnEF_v_Jkm, FcEF_v_kgkm, FrFossilFuel_Heat, FrFossilFuel_NonHeat, HDD_id, HumActivity_24hr, id, imin, it, MaxFCMetab, MaxQFMetab, MinFCMetab, MinQFMetab, nsh, PopDensDaytime, PopDensNighttime, PopProf_24hr, QF, QF0_BEU, Qf_A, Qf_B, Qf_C, QF_obs, QF_SAHP, SurfaceArea, BaseT_Cooling, BaseT_Heating, Temp_C, TrafficRate, TrafficUnits, TraffProf_24hr, Fc_anthro, Fc_build, Fc_metab, Fc_point, Fc_traff)
 
subroutine suews_cal_biogenco2 (alpha_bioCO2, alpha_enh_bioCO2, avkdn, avRh, beta_bioCO2, beta_enh_bioCO2, BSoilSurf, ConifSurf, DecidSurf, dectime, Diagnose, EmissionsMethod, Fc_anthro, G1, G2, G3, G4, G5, G6, gfunc, GrassSurf, gsmodel, id, it, ivConif, ivDecid, ivGrass, Kmax, LAI_id, LAIMin, LAIMax, MaxConductance, min_res_bioCO2, nsurf, NVegSurf, Press_hPa, resp_a, resp_b, S1, S2, sfr, SMDMethod, SnowFrac, t2_C, Temp_C, theta_bioCO2, TH, TL, vsmd, xsmd, Fc, Fc_biogen, Fc_photo, Fc_respi)
 
subroutine suews_cal_qn (NetRadiationMethod, snowUse, tstep, SnowPack_prev, tau_a, tau_f, SnowAlbMax, SnowAlbMin, Diagnose, snowFrac_obs, ldown_obs, fcld_obs, dectime, ZENITH_deg, Tsurf_0, avKdn, Temp_C, avRH, ea_hPa, qn1_obs, SnowAlb_prev, snowFrac_prev, DiagQN, NARP_TRANS_SITE, NARP_EMIS_SNOW, IceFrac, sfr, emis, alb_prev, albDecTr_id, albEveTr_id, albGrass_id, alb_next, ldown, fcld, qn1, qn1_snowfree, qn1_S, kclear, kup, lup, tsurf, qn1_ind_snow, kup_ind_snow, Tsurf_ind_snow, Tsurf_ind, alb1, snowFrac_next, SnowAlb_next)
 
subroutine suews_cal_qs (StorageHeatMethod, qs_obs, OHMIncQF, Gridiv, id, tstep, dt_since_start, Diagnose, sfr, OHM_coef, OHM_threshSW, OHM_threshWD, soilstore_id, SoilStoreCap, state_id, SnowUse, SnowFrac, DiagQS, HDD_id, MetForcingData_grid, Ts5mindata_ir, qf, qn1, avkdn, avu1, temp_c, zenith_deg, avrh, press_hpa, ldown, bldgh, alb, emis, cpAnOHM, kkAnOHM, chAnOHM, EmissionsMethod, Tair_av, qn1_av_prev, dqndt_prev, qn1_s_av_prev, dqnsdt_prev, StoreDrainPrm, qn1_S, dataOutLineESTM, qs, qn1_av_next, dqndt_next, qn1_s_av_next, dqnsdt_next, deltaQi, a1, a2, a3)
 
subroutine suews_cal_water (Diagnose, snowUse, NonWaterFraction, addPipes, addImpervious, addVeg, addWaterBody, state_id, soilstore_id, sfr, StoreDrainPrm, WaterDist, nsh_real, drain_per_tstep, drain, frac_water2runoff, AdditionalWater, runoffPipes, runoff_per_interval, AddWater, stateOld, soilstoreOld)
 
subroutine suews_init_qh (avdens, avcp, h_mod, qn1, dectime, H_init)
 
subroutine suews_cal_qe (Diagnose, snowuse, tstep, imin, it, EvapMethod, snowCalcSwitch, dayofWeek_id, CRWmin, CRWmax, dectime, avdens, avcp, lv_J_kg, lvS_J_kg, avRh, Press_hPa, Temp_C, RAsnow, psyc_hPa, sIce_hPa, PervFraction, vegfraction, addimpervious, qn1_snowfree, qf, qs, vpd_hPa, s_hPa, ResistSurf, RA, rb, snowdensmin, precip, PipeCapacity, RunoffToWater, NonWaterFraction, WU_nsurf, addVeg, addWaterBody, SnowLimPaved, SnowLimBldg, SurfaceArea, FlowChange, drain, WetThresh, stateOld, mw_ind, SoilStoreCap, rainonsnow, freezmelt, freezstate, freezstatevol, Qm_Melt, Qm_rain, Tsurf_ind, sfr, StateLimit, AddWater, addwaterrunoff, StoreDrainPrm, SnowPackLimit, SnowProf_24hr, SnowPack_in, SnowFrac_in, SnowWater_in, iceFrac_in, SnowDens_in, runoff_per_interval_in, state_id_in, soilstore_id_in, state_id_out, soilstore_id_out, SnowPack_out, SnowFrac_out, SnowWater_out, iceFrac_out, SnowDens_out, runoffSoil, SnowRemoval, state_per_tstep, NWstate_per_tstep, qe, swe, chSnow_per_interval, ev_per_tstep, runoff_per_tstep, surf_chang_per_tstep, runoffPipes, mwstore, runoffwaterbody, runoffAGveg, runoffAGimpervious)
 
subroutine suews_cal_qh (QHMethod, qn1, qf, QmRain, qeOut, qs, QmFreez, qm, avdens, avcp, tsurf, Temp_C, RA, qh, qh_residual, qh_resist)
 
subroutine suews_cal_resistance (StabilityMethod, Diagnose, AerodynamicResistanceMethod, RoughLenHeatMethod, snowUse, id, it, gsModel, SMDMethod, avdens, avcp, QH_init, zzd, z0m, zdm, avU1, Temp_C, VegFraction, avkdn, Kmax, G1, G2, G3, G4, G5, G6, S1, S2, TH, TL, dq, xsmd, vsmd, MaxConductance, LAIMax, LAI_id, SnowFrac, sfr, UStar, TStar, L_mod, zL, gsc, ResistSurf, RA, RAsnow, rb)
 
subroutine suews_update_outputline (AdditionalWater, alb, avkdn, avU10_ms, azimuth, chSnow_per_interval, dectime, drain_per_tstep, E_mod, ev_per_tstep, ext_wu, Fc, Fc_build, fcld, Fc_metab, Fc_photo, Fc_respi, Fc_point, Fc_traff, FlowChange, h_mod, id, imin, int_wu, it, iy, kup, LAI_id, ldown, l_mod, lup, mwh, MwStore, nsh_real, NWstate_per_tstep, Precip, q2_gkg, qeOut, qf, qh, qh_resist, Qm, QmFreez, QmRain, qn1, qn1_S, qn1_snowfree, qs, RA, resistsurf, RH2, runoffAGimpervious, runoffAGveg, runoff_per_tstep, runoffPipes, runoffSoil_per_tstep, runoffWaterBody, sfr, smd, smd_nsurf, SnowAlb, SnowRemoval, state_id, state_per_tstep, surf_chang_per_tstep, swe, t2_C, tskin_C, tot_chang_per_tstep, tsurf, UStar, wu_nsurf, z0m, zdm, zenith_deg, datetimeLine, dataOutLineSUEWS)
 
subroutine suews_update_output (SnowUse, storageheatmethod, ReadLinesMetdata, NumberOfGrids, ir, gridiv, datetimeLine, dataOutLineSUEWS, dataOutLineSnow, dataOutLineESTM, dataoutLineRSL, dataOutLineSOLWEIG, dataOutSUEWS, dataOutSnow, dataOutESTM, dataOutRSL, dataOutSOLWEIG)
 
subroutine suews_cal_surf (sfr, vegfraction, ImpervFraction, PervFraction, NonWaterFraction)
 
elemental real(kind(1d0)) function set_nan (x)
 
real(kind(1d0)) function square (x)
 
real function square_real (x)
 
subroutine output_name_n (i, name, group, aggreg, outlevel)
 
subroutine output_size (nVar)
 
subroutine suews_cal_multitsteps (MetForcingBlock, len_sim, AerodynamicResistanceMethod, AH_MIN, AHProf_24hr, AH_SLOPE_Cooling, AH_SLOPE_Heating, alb, AlbMax_DecTr, AlbMax_EveTr, AlbMax_Grass, AlbMin_DecTr, AlbMin_EveTr, AlbMin_Grass, alpha_bioCO2, alpha_enh_bioCO2, alt, BaseT, BaseTe, BaseTMethod, BaseT_HC, beta_bioCO2, beta_enh_bioCO2, bldgH, CapMax_dec, CapMin_dec, chAnOHM, CO2PointSource, cpAnOHM, CRWmax, CRWmin, DayWat, DayWatPer, DecTreeH, Diagnose, DiagQN, DiagQS, DRAINRT, dt_since_start, dqndt, qn1_av, dqnsdt, qn1_s_av, EF_umolCO2perJ, emis, EmissionsMethod, EnEF_v_Jkm, endDLS, EveTreeH, FAIBldg, FAIDecTree, FAIEveTree, Faut, FcEF_v_kgkm, FlowChange, FrFossilFuel_Heat, FrFossilFuel_NonHeat, G1, G2, G3, G4, G5, G6, GDD_id, GDDFull, Gridiv, gsModel, H_maintain, HDD_id, HumActivity_24hr, IceFrac, Ie_a, Ie_end, Ie_m, Ie_start, InternalWaterUse_h, IrrFracPaved, IrrFracBldgs, IrrFracEveTr, IrrFracDecTr, IrrFracGrass, IrrFracBSoil, IrrFracWater, EvapMethod, kkAnOHM, Kmax, LAI_id, LAICalcYes, LAIMax, LAIMin, LAIPower, LAIType, lat, lng, MaxConductance, MaxFCMetab, MaxQFMetab, SnowWater, MinFCMetab, MinQFMetab, min_res_bioCO2, NARP_EMIS_SNOW, NARP_TRANS_SITE, NetRadiationMethod, OHM_coef, OHMIncQF, OHM_threshSW, OHM_threshWD, PipeCapacity, PopDensDaytime, PopDensNighttime, PopProf_24hr, PorMax_dec, PorMin_dec, PrecipLimit, PrecipLimitAlb, QF0_BEU, Qf_A, Qf_B, Qf_C, RadMeltFact, RAINCOVER, RainMaxRes, resp_a, resp_b, RoughLenHeatMethod, RoughLenMomMethod, RunoffToWater, S1, S2, SatHydraulicConduct, SDDFull, SDD_id, sfr, SMDMethod, SnowAlb, SnowAlbMax, SnowAlbMin, SnowPackLimit, SnowDens, SnowDensMax, SnowDensMin, SnowfallCum, SnowFrac, SnowLimBldg, SnowLimPaved, SnowPack, SnowProf_24hr, snowUse, SoilDepth, soilstore_id, SoilStoreCap, StabilityMethod, startDLS, state_id, StateLimit, StorageHeatMethod, StoreDrainPrm, SurfaceArea, Tair_av, tau_a, tau_f, tau_r, BaseT_Cooling, BaseT_Heating, TempMeltFact, TH, theta_bioCO2, timezone, TL, TrafficRate, TrafficUnits, Tmin_id, Tmax_id, lenday_id, TraffProf_24hr, Ts5mindata_ir, tstep, tstep_prev, veg_type, WaterDist, WaterUseMethod, WetThresh, WUDay_id, DecidCap_id, albDecTr_id, albEveTr_id, albGrass_id, porosity_id, WUProfA_24hr, WUProfM_24hr, Z, z0m_in, zdm_in, dataOutBlockSUEWS, dataOutBlockSnow, dataOutBlockESTM, dataOutBlockRSL, dataOutBlockSOL, DailyStateBlock)
 
subroutine suews_cal_sunposition (year, idectime, UTC, locationlatitude, locationlongitude, locationaltitude, sunazimuth, sunzenith)
 
real(kind(1d0)) function cal_tair_av (tair_av_prev, dt_since_start, tstep, temp_c)
 
real(kind(1d0)) function cal_tsfc (qh, avdens, avcp, RA, temp_c)
 

Function/Subroutine Documentation

◆ cal_tair_av()

real(kind(1d0)) function suews_driver::cal_tair_av ( real(kind(1d0)), intent(in)  tair_av_prev,
integer, intent(in)  dt_since_start,
integer, intent(in)  tstep,
real(kind(1d0)), intent(in)  temp_c 
)

Definition at line 3555 of file suews_ctrl_driver.f95.

Referenced by suews_cal_main().

3555  ! calculate mean air temperature of past 24 hours
3556  ! TS, 17 Sep 2019
3557  implicit none
3558  real(KIND(1D0)), intent(in) :: tair_av_prev
3559  real(KIND(1D0)), intent(in) :: temp_c
3560  integer, intent(in) :: dt_since_start
3561  integer, intent(in) :: tstep
3562 
3563  real(KIND(1D0)) ::tair_av_next
3564 
3565  real(KIND(1D0)), parameter:: len_day_s = 24*3600 ! day length in seconds
3566  real(KIND(1D0)):: len_cal_s ! length of average period in seconds
3567  real(KIND(1D0)):: temp_k ! temp in K
3568 
3569  ! determine the average period
3570  if (dt_since_start > len_day_s) then
3571  ! if simulation has been running over one day
3572  len_cal_s = len_day_s
3573  else
3574  ! if simulation has been running less than one day
3575  len_cal_s = dt_since_start + tstep
3576  end if
3577  temp_k = temp_c + 273.15
3578  tair_av_next = tair_av_prev*(len_cal_s - tstep*1.)/len_cal_s + temp_k*tstep/len_cal_s
3579 
integer dt_since_start
Here is the caller graph for this function:

◆ cal_tsfc()

real(kind(1d0)) function suews_driver::cal_tsfc ( real(kind(1d0)), intent(in)  qh,
real(kind(1d0)), intent(in)  avdens,
real(kind(1d0)), intent(in)  avcp,
real(kind(1d0)), intent(in)  RA,
real(kind(1d0)), intent(in)  temp_c 
)

Definition at line 3583 of file suews_ctrl_driver.f95.

Referenced by suews_cal_main().

3583  ! calculate surface/skin temperature
3584  ! TS, 23 Oct 2019
3585  implicit none
3586  real(KIND(1D0)), intent(in) :: qh ! sensible heat flux [W m-2]
3587  real(KIND(1D0)), intent(in) :: avdens ! air density [kg m-3]
3588  real(KIND(1D0)), intent(in) :: avcp !air heat capacity [J m-3 K-1]
3589  real(KIND(1D0)), intent(in) :: ra !Aerodynamic resistance [s m^-1]
3590  real(KIND(1D0)), intent(in) :: temp_c ! air temperature [C]
3591 
3592  real(KIND(1D0)) ::tsfc_c ! surface temperature [C]
3593 
3594  tsfc_c = qh/(avdens*avcp)*ra + temp_c
real(kind(1d0)) avcp
real(kind(1d0)) avdens
Here is the caller graph for this function:

◆ output_name_n()

subroutine suews_driver::output_name_n ( integer, intent(in)  i,
character(len=15), intent(out)  name,
character(len=15), intent(out)  group,
character(len=15), intent(out)  aggreg,
integer, intent(out)  outlevel 
)

Definition at line 2803 of file suews_ctrl_driver.f95.

References ctrl_output::varlistall.

2803  ! used by f2py module to handle output names
2804  IMPLICIT NONE
2805  ! the dimension is potentially incorrect,
2806  ! which should be consistent with that in output module
2807  INTEGER, INTENT(in) :: i
2808  CHARACTER(len=15), INTENT(out) :: name, group, aggreg
2809  INTEGER, INTENT(out) :: outlevel
2810 
2811  INTEGER :: nvar
2812  nvar = SIZE(varlistall, dim=1)
2813  IF (i < nvar .AND. i > 0) THEN
2814  name = trim(varlistall(i)%header)
2815  group = trim(varlistall(i)%group)
2816  aggreg = trim(varlistall(i)%aggreg)
2817  outlevel = varlistall(i)%level
2818  ELSE
2819  name = ''
2820  group = ''
2821  aggreg = ''
2822  outlevel = 0
2823  END IF
2824 

◆ output_size()

subroutine suews_driver::output_size ( integer, intent(out)  nVar)

Definition at line 2828 of file suews_ctrl_driver.f95.

References ctrl_output::varlistall.

2828  ! used by f2py module to get size of the output list
2829  IMPLICIT NONE
2830  ! the dimension is potentially incorrect,
2831  ! which should be consistent with that in output module
2832  INTEGER, INTENT(out) :: nvar
2833 
2834  nvar = SIZE(varlistall, dim=1)
2835 

◆ set_nan()

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

Definition at line 2762 of file suews_ctrl_driver.f95.

Referenced by suews_cal_main(), and suews_update_output().

2762  IMPLICIT NONE
2763  REAL(KIND(1d0)), PARAMETER::pnan = 30000 ! 30000 to prevent water_state being filtered out as it can be large
2764  REAL(KIND(1d0)), PARAMETER::nan = -999
2765  REAL(KIND(1d0)), INTENT(in)::x
2766  REAL(KIND(1d0))::xx
2767 
2768  IF (abs(x) > pnan) THEN
2769  xx = nan
2770  ELSE
2771  xx = x
2772  ENDIF
2773 
real(kind(1d0)) nan
real(kind(1d0)) pnan
Here is the caller graph for this function:

◆ square()

real(kind(1d0)) function suews_driver::square ( real(kind(1d0)), intent(in)  x)

Definition at line 2779 of file suews_ctrl_driver.f95.

2779  IMPLICIT NONE
2780  REAL(KIND(1d0)), PARAMETER::pnan = 9999
2781  REAL(KIND(1d0)), PARAMETER::nan = -999
2782  REAL(KIND(1d0)), INTENT(in)::x
2783  REAL(KIND(1d0))::xx
2784 
2785  xx = x**2 + nan/pnan
2786  xx = x**2
2787 
real(kind(1d0)) nan
real(kind(1d0)) pnan

◆ square_real()

real function suews_driver::square_real ( real, intent(in)  x)

Definition at line 2791 of file suews_ctrl_driver.f95.

2791  IMPLICIT NONE
2792  REAL, PARAMETER::pnan = 9999
2793  REAL, PARAMETER::nan = -999
2794  REAL, INTENT(in)::x
2795  REAL::xx
2796 
2797  xx = x**2 + nan/pnan
2798  xx = x**2
2799 
real(kind(1d0)) nan
real(kind(1d0)) pnan

◆ suews_cal_anthropogenicemission()

subroutine suews_driver::suews_cal_anthropogenicemission ( real(kind(1d0)), dimension(2), intent(in)  AH_MIN,
real(kind(1d0)), dimension(0:23, 2), intent(in)  AHProf_24hr,
real(kind(1d0)), dimension(2), intent(in)  AH_SLOPE_Cooling,
real(kind(1d0)), dimension(2), intent(in)  AH_SLOPE_Heating,
real(kind(1d0)), intent(in)  CO2PointSource,
integer, dimension(3), intent(in)  dayofWeek_id,
integer, intent(in)  DLS,
real(kind(1d0)), intent(in)  EF_umolCO2perJ,
integer, intent(in)  EmissionsMethod,
real(kind(1d0)), intent(in)  EnEF_v_Jkm,
real(kind(1d0)), dimension(2), intent(in)  FcEF_v_kgkm,
real(kind(1d0)), intent(in)  FrFossilFuel_Heat,
real(kind(1d0)), intent(in)  FrFossilFuel_NonHeat,
real(kind(1d0)), dimension(6, 2), intent(in)  HDD_id,
real(kind(1d0)), dimension(0:23, 2), intent(in)  HumActivity_24hr,
integer, intent(in)  id,
integer, intent(in)  imin,
integer, intent(in)  it,
real(kind(1d0)), intent(in)  MaxFCMetab,
real(kind(1d0)), intent(in)  MaxQFMetab,
real(kind(1d0)), intent(in)  MinFCMetab,
real(kind(1d0)), intent(in)  MinQFMetab,
integer, intent(in)  nsh,
real(kind(1d0)), dimension(2), intent(in)  PopDensDaytime,
real(kind(1d0)), intent(in)  PopDensNighttime,
real(kind(1d0)), dimension(0:23, 2), intent(in)  PopProf_24hr,
real(kind(1d0)), intent(out)  QF,
real(kind(1d0)), dimension(2), intent(in)  QF0_BEU,
real(kind(1d0)), dimension(2), intent(in)  Qf_A,
real(kind(1d0)), dimension(2), intent(in)  Qf_B,
real(kind(1d0)), dimension(2), intent(in)  Qf_C,
real(kind(1d0)), intent(in)  QF_obs,
real(kind(1d0)), intent(out)  QF_SAHP,
real(kind(1d0)), intent(in)  SurfaceArea,
real(kind(1d0)), dimension(2), intent(in)  BaseT_Cooling,
real(kind(1d0)), dimension(2), intent(in)  BaseT_Heating,
real(kind(1d0)), intent(in)  Temp_C,
real(kind(1d0)), dimension(2), intent(in)  TrafficRate,
real(kind(1d0)), intent(in)  TrafficUnits,
real(kind(1d0)), dimension(0:23, 2), intent(in)  TraffProf_24hr,
real(kind(1d0)), intent(out)  Fc_anthro,
real(kind(1d0)), intent(out)  Fc_build,
real(kind(1d0)), intent(out)  Fc_metab,
real(kind(1d0)), intent(out)  Fc_point,
real(kind(1d0)), intent(out)  Fc_traff 
)

Definition at line 1085 of file suews_ctrl_driver.f95.

References anemsn_module::anthropogenicemissions(), and errorhint().

Referenced by suews_cal_main().

1085 
1086  IMPLICIT NONE
1087 
1088  ! INTEGER, INTENT(in)::Diagnose
1089  INTEGER, INTENT(in)::dls
1090  INTEGER, INTENT(in)::emissionsmethod
1091  INTEGER, INTENT(in)::id
1092  INTEGER, INTENT(in)::it
1093  INTEGER, INTENT(in)::imin
1094  INTEGER, INTENT(in)::nsh
1095  INTEGER, DIMENSION(3), INTENT(in)::dayofweek_id
1096 
1097  REAL(KIND(1d0)), DIMENSION(6, 2), INTENT(in)::hdd_id
1098 
1099  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::ah_min
1100  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::ah_slope_heating
1101  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::ah_slope_cooling
1102  REAL(KIND(1D0)), DIMENSION(2), INTENT(in)::fcef_v_kgkm
1103  ! REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::NumCapita
1104  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::popdensdaytime
1105  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::qf0_beu
1106  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::qf_a
1107  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::qf_b
1108  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::qf_c
1109  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::baset_heating
1110  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::baset_cooling
1111  REAL(KIND(1d0)), DIMENSION(2), INTENT(in)::trafficrate
1112 
1113  REAL(KIND(1d0)), DIMENSION(0:23, 2), INTENT(in)::ahprof_24hr
1114  REAL(KIND(1d0)), DIMENSION(0:23, 2), INTENT(in)::humactivity_24hr
1115  REAL(KIND(1d0)), DIMENSION(0:23, 2), INTENT(in)::traffprof_24hr
1116  REAL(KIND(1d0)), DIMENSION(0:23, 2), INTENT(in)::popprof_24hr
1117 
1118  REAL(KIND(1D0)), INTENT(in)::co2pointsource
1119  REAL(KIND(1D0)), INTENT(in)::ef_umolco2perj
1120  REAL(KIND(1D0)), INTENT(in)::enef_v_jkm
1121  REAL(KIND(1D0)), INTENT(in)::frfossilfuel_heat
1122  REAL(KIND(1D0)), INTENT(in)::frfossilfuel_nonheat
1123  REAL(KIND(1D0)), INTENT(in)::maxfcmetab
1124  REAL(KIND(1D0)), INTENT(in)::maxqfmetab
1125  REAL(KIND(1D0)), INTENT(in)::minfcmetab
1126  REAL(KIND(1D0)), INTENT(in)::minqfmetab
1127  REAL(KIND(1D0)), INTENT(in)::popdensnighttime
1128  REAL(KIND(1D0)), INTENT(in)::qf_obs
1129  REAL(KIND(1D0)), INTENT(in)::temp_c
1130  REAL(KIND(1D0)), INTENT(in)::trafficunits
1131 
1132  ! REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::sfr
1133  ! REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::SnowFrac
1134  REAL(KIND(1D0)), INTENT(IN)::surfacearea
1135 
1136  REAL(KIND(1D0)), INTENT(out)::fc_anthro
1137  REAL(KIND(1D0)), INTENT(out)::fc_build
1138  REAL(KIND(1D0)), INTENT(out)::fc_metab
1139  REAL(KIND(1D0)), INTENT(out)::fc_point
1140  REAL(KIND(1D0)), INTENT(out)::fc_traff
1141  REAL(KIND(1D0)), INTENT(out)::qf
1142  REAL(KIND(1D0)), INTENT(out)::qf_sahp
1143 
1144  INTEGER, PARAMETER :: notusedi = -999
1145  REAL(KIND(1D0)), PARAMETER::notused = -999
1146 
1147  IF (emissionsmethod == 0) THEN ! use observed qf
1148  qf = qf_obs
1149  ELSEIF ((emissionsmethod > 0 .AND. emissionsmethod <= 6) .OR. emissionsmethod >= 11) THEN
1150  CALL anthropogenicemissions( &
1151  co2pointsource, emissionsmethod, &
1152  it, imin, dls, dayofweek_id, &
1153  ef_umolco2perj, fcef_v_kgkm, enef_v_jkm, trafficunits, &
1154  frfossilfuel_heat, frfossilfuel_nonheat, &
1155  minfcmetab, maxfcmetab, minqfmetab, maxqfmetab, &
1156  popdensdaytime, popdensnighttime, &
1157  temp_c, hdd_id, qf_a, qf_b, qf_c, &
1158  ah_min, ah_slope_heating, ah_slope_cooling, &
1159  baset_heating, baset_cooling, &
1160  trafficrate, &
1161  qf0_beu, qf_sahp, &
1162  fc_anthro, fc_metab, fc_traff, fc_build, fc_point, &
1164 
1165  ELSE
1166  CALL errorhint(73, 'RunControl.nml:EmissionsMethod unusable', notused, notused, emissionsmethod)
1167  ENDIF
1168 
1169  IF (emissionsmethod >= 1) qf = qf_sahp
1170 
1171  IF (emissionsmethod >= 0 .AND. emissionsmethod <= 6) THEN
1172  fc_anthro = 0
1173  fc_metab = 0
1174  fc_traff = 0
1175  fc_build = 0
1176  fc_point = 0
1177  ENDIF
1178 
real(kind(1d0)), dimension(0:23, 2) ahprof_24hr
real(kind(1d0)) notused
integer dls
integer id
real(kind(1d0)), dimension(12) hdd_id
real(kind(1d0)), dimension(0:23, 2) popprof_24hr
integer imin
real(kind(1d0)), dimension(0:23, 2) traffprof_24hr
integer it
real(kind(1d0)), dimension(0:23, 2) humactivity_24hr
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ suews_cal_biogenco2()

subroutine suews_driver::suews_cal_biogenco2 ( real(kind(1d0)), dimension(nvegsurf), intent(in)  alpha_bioCO2,
real(kind(1d0)), dimension(nvegsurf), intent(in)  alpha_enh_bioCO2,
real(kind(1d0)), intent(in)  avkdn,
real(kind(1d0)), intent(in)  avRh,
real(kind(1d0)), dimension(nvegsurf), intent(in)  beta_bioCO2,
real(kind(1d0)), dimension(nvegsurf), intent(in)  beta_enh_bioCO2,
integer, intent(in)  BSoilSurf,
integer, intent(in)  ConifSurf,
integer, intent(in)  DecidSurf,
real(kind(1d0)), intent(in)  dectime,
integer, intent(in)  Diagnose,
integer, intent(in)  EmissionsMethod,
real(kind(1d0)), intent(in)  Fc_anthro,
real(kind(1d0)), intent(in)  G1,
real(kind(1d0)), intent(in)  G2,
real(kind(1d0)), intent(in)  G3,
real(kind(1d0)), intent(in)  G4,
real(kind(1d0)), intent(in)  G5,
real(kind(1d0)), intent(in)  G6,
real(kind(1d0)), intent(in)  gfunc,
integer, intent(in)  GrassSurf,
integer, intent(in)  gsmodel,
integer, intent(in)  id,
integer, intent(in)  it,
integer, intent(in)  ivConif,
integer, intent(in)  ivDecid,
integer, intent(in)  ivGrass,
real(kind(1d0)), intent(in)  Kmax,
real(kind(1d0)), dimension(nvegsurf), intent(in)  LAI_id,
real(kind(1d0)), dimension(nvegsurf), intent(in)  LAIMin,
real(kind(1d0)), dimension(nvegsurf), intent(in)  LAIMax,
real(kind(1d0)), dimension(3), intent(in)  MaxConductance,
real(kind(1d0)), dimension(nvegsurf), intent(in)  min_res_bioCO2,
integer, intent(in)  nsurf,
integer, intent(in)  NVegSurf,
real(kind(1d0)), intent(in)  Press_hPa,
real(kind(1d0)), dimension(nvegsurf), intent(in)  resp_a,
real(kind(1d0)), dimension(nvegsurf), intent(in)  resp_b,
real(kind(1d0)), intent(in)  S1,
real(kind(1d0)), intent(in)  S2,
real(kind(1d0)), dimension(nsurf), intent(in)  sfr,
integer, intent(in)  SMDMethod,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowFrac,
real(kind(1d0)), intent(in)  t2_C,
real(kind(1d0)), intent(in)  Temp_C,
real(kind(1d0)), dimension(nvegsurf), intent(in)  theta_bioCO2,
real(kind(1d0)), intent(in)  TH,
real(kind(1d0)), intent(in)  TL,
real(kind(1d0)), intent(in)  vsmd,
real(kind(1d0)), intent(in)  xsmd,
real(kind(1d0)), intent(out)  Fc,
real(kind(1d0)), intent(out)  Fc_biogen,
real(kind(1d0)), intent(out)  Fc_photo,
real(kind(1d0)), intent(out)  Fc_respi 
)

Definition at line 1190 of file suews_ctrl_driver.f95.

References atmmoiststab_module::cal_atmmoist(), co2_module::co2_biogen(), and resist_module::surfaceresistance().

Referenced by suews_cal_main().

1190 
1191  IMPLICIT NONE
1192 
1193  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::alpha_bioco2
1194  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::alpha_enh_bioco2
1195  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::beta_bioco2
1196  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::beta_enh_bioco2
1197  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::lai_id
1198  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::laimin
1199  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::laimax
1200  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::min_res_bioco2
1201  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::resp_a
1202  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::resp_b
1203  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(in)::theta_bioco2
1204 
1205  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::sfr
1206  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::snowfrac
1207 
1208  REAL(KIND(1d0)), DIMENSION(3), INTENT(in)::maxconductance
1209 
1210  INTEGER, INTENT(in)::bsoilsurf
1211  INTEGER, INTENT(in)::conifsurf
1212  INTEGER, INTENT(in)::decidsurf
1213  INTEGER, INTENT(in)::diagnose
1214  INTEGER, INTENT(in)::emissionsmethod
1215  INTEGER, INTENT(in)::grasssurf
1216  INTEGER, INTENT(in)::gsmodel
1217  INTEGER, INTENT(in)::id
1218  INTEGER, INTENT(in)::it
1219  INTEGER, INTENT(in)::ivconif
1220  INTEGER, INTENT(in)::ivdecid
1221  INTEGER, INTENT(in)::ivgrass
1222  INTEGER, INTENT(in)::nsurf
1223  INTEGER, INTENT(in)::nvegsurf
1224  INTEGER, INTENT(in)::smdmethod
1225 
1226  REAL(KIND(1d0)), INTENT(in)::avkdn
1227  REAL(KIND(1d0)), INTENT(in)::avrh
1228  REAL(KIND(1d0)), INTENT(in)::dectime
1229  REAL(KIND(1d0)), INTENT(in)::fc_anthro
1230  REAL(KIND(1d0)), INTENT(in)::g1
1231  REAL(KIND(1d0)), INTENT(in)::g2
1232  REAL(KIND(1d0)), INTENT(in)::g3
1233  REAL(KIND(1d0)), INTENT(in)::g4
1234  REAL(KIND(1d0)), INTENT(in)::g5
1235  REAL(KIND(1d0)), INTENT(in)::g6
1236  REAL(KIND(1d0)), INTENT(in)::gfunc
1237  REAL(KIND(1d0)), INTENT(in)::kmax
1238  REAL(KIND(1d0)), INTENT(in)::press_hpa
1239  REAL(KIND(1d0)), INTENT(in)::s1
1240  REAL(KIND(1d0)), INTENT(in)::s2
1241  REAL(KIND(1d0)), INTENT(in)::t2_c
1242  REAL(KIND(1d0)), INTENT(in)::temp_c
1243  REAL(KIND(1d0)), INTENT(in)::th
1244  REAL(KIND(1d0)), INTENT(in)::tl
1245  REAL(KIND(1d0)), INTENT(in)::vsmd
1246  REAL(KIND(1d0)), INTENT(in)::xsmd
1247 
1248  REAL(KIND(1d0)), INTENT(out)::fc_biogen
1249  REAL(KIND(1d0)), INTENT(out)::fc_photo
1250  REAL(KIND(1d0)), INTENT(out)::fc_respi
1251  REAL(KIND(1d0)), INTENT(out)::fc
1252 
1253  REAL(KIND(1d0))::gfunc2
1254  REAL(KIND(1d0))::dq
1255  REAL(KIND(1d0))::t2
1256  REAL(KIND(1d0))::dummy1
1257  REAL(KIND(1d0))::dummy2
1258  REAL(KIND(1d0))::dummy3
1259  REAL(KIND(1d0))::dummy4
1260  REAL(KIND(1d0))::dummy5
1261  REAL(KIND(1d0))::dummy6
1262  REAL(KIND(1d0))::dummy7
1263  REAL(KIND(1d0))::dummy8
1264  REAL(KIND(1d0))::dummy9
1265  REAL(KIND(1d0))::dummy10
1266  REAL(KIND(1d0))::dummy11
1267 
1268  IF (emissionsmethod >= 11) THEN
1269 
1270  IF (gsmodel == 3 .OR. gsmodel == 4) THEN ! With modelled 2 meter temperature
1271  ! Call LUMPS_cal_AtmMoist for dq and SurfaceResistance for gfunc with 2 meter temperature
1272  ! If modelled 2 meter temperature is too different from measured air temperature then
1273  ! use temp_c
1274  IF (abs(temp_c - t2_c) > 5) THEN
1275  t2 = temp_c
1276  ELSE
1277  t2 = t2_c
1278  ENDIF
1279 
1280  CALL cal_atmmoist( &
1281  t2, press_hpa, avrh, dectime, &! input:
1282  dummy1, dummy2, &! output:
1283  dummy3, dummy4, dummy5, dummy6, dq, dummy7, dummy8, dummy9)
1284 
1285  CALL surfaceresistance( &
1286  id, it, &! input:
1287  smdmethod, snowfrac, sfr, avkdn, t2, dq, xsmd, vsmd, maxconductance, &
1288  laimax, lai_id, gsmodel, kmax, &
1289  g1, g2, g3, g4, g5, g6, th, tl, s1, s2, &
1290  gfunc2, dummy10, dummy11)! output:
1291  ENDIF
1292 
1293  ! Calculate CO2 fluxes from biogenic components
1294  IF (diagnose == 1) WRITE (*, *) 'Calling CO2_biogen...'
1295  CALL co2_biogen( &
1297  conifsurf, decidsurf, dectime, emissionsmethod, gfunc, gfunc2, grasssurf, gsmodel, &
1299  nvegsurf, resp_a, resp_b, sfr, snowfrac, t2, temp_c, theta_bioco2, &
1300  fc_biogen, fc_photo, fc_respi)! output:
1301  ENDIF
1302 
1303  IF (emissionsmethod >= 0 .AND. emissionsmethod <= 6) THEN
1304  fc_biogen = 0
1305  fc_photo = 0
1306  fc_respi = 0
1307  ENDIF
1308 
1309  fc = fc_anthro + fc_biogen
1310 
real(kind(1d0)) g1
real(kind(1d0)) s2
real(kind(1d0)), dimension(nvegsurf) theta_bioco2
integer gsmodel
real(kind(1d0)) g5
integer, parameter ivgrass
real(kind(1d0)) kmax
real(kind(1d0)), dimension(nvegsurf) laimax
integer, parameter bsoilsurf
real(kind(1d0)) th
real(kind(1d0)), dimension(nvegsurf) maxconductance
real(kind(1d0)), dimension(nvegsurf) alpha_enh_bioco2
real(kind(1d0)), dimension(nvegsurf) alpha_bioco2
integer, parameter nsurf
real(kind(1d0)), dimension(nvegsurf) resp_a
real(kind(1d0)) g2
real(kind(1d0)) g3
integer, parameter conifsurf
integer id
real(kind(1d0)) dq
real(kind(1d0)), dimension(nvegsurf) resp_b
integer, parameter grasssurf
real(kind(1d0)), dimension(nsurf) snowfrac
integer, parameter ivconif
real(kind(1d0)) g4
real(kind(1d0)), dimension(nvegsurf) laimin
integer, parameter nvegsurf
real(kind(1d0)), dimension(nvegsurf) lai_id
real(kind(1d0)), dimension(nsurf) sfr
real(kind(1d0)) g6
real(kind(1d0)), dimension(nvegsurf) min_res_bioco2
integer it
integer, parameter decidsurf
real(kind(1d0)) dectime
real(kind(1d0)) tl
real(kind(1d0)), dimension(nvegsurf) beta_enh_bioco2
real(kind(1d0)), dimension(nvegsurf) beta_bioco2
integer, parameter ivdecid
real(kind(1d0)) s1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ suews_cal_main()

subroutine suews_driver::suews_cal_main ( integer, intent(in)  AerodynamicResistanceMethod,
real(kind(1d0)), dimension(2), intent(in)  AH_MIN,
real(kind(1d0)), dimension(0:23, 2), intent(in)  AHProf_24hr,
real(kind(1d0)), dimension(2), intent(in)  AH_SLOPE_Cooling,
real(kind(1d0)), dimension(2), intent(in)  AH_SLOPE_Heating,
real(kind(1d0)), dimension(nsurf), intent(inout)  alb,
real(kind(1d0)), intent(in)  AlbMax_DecTr,
real(kind(1d0)), intent(in)  AlbMax_EveTr,
real(kind(1d0)), intent(in)  AlbMax_Grass,
real(kind(1d0)), intent(in)  AlbMin_DecTr,
real(kind(1d0)), intent(in)  AlbMin_EveTr,
real(kind(1d0)), intent(in)  AlbMin_Grass,
real(kind(1d0)), dimension(nvegsurf), intent(in)  alpha_bioCO2,
real(kind(1d0)), dimension(nvegsurf), intent(in)  alpha_enh_bioCO2,
real(kind(1d0)), intent(in)  alt,
real(kind(1d0)), intent(in)  avkdn,
real(kind(1d0)), intent(in)  avRh,
real(kind(1d0)), intent(in)  avU1,
real(kind(1d0)), dimension(nvegsurf), intent(in)  BaseT,
real(kind(1d0)), dimension(nvegsurf), intent(in)  BaseTe,
integer, intent(in)  BaseTMethod,
real(kind(1d0)), intent(in)  BaseT_HC,
real(kind(1d0)), dimension(nvegsurf), intent(in)  beta_bioCO2,
real(kind(1d0)), dimension(nvegsurf), intent(in)  beta_enh_bioCO2,
real(kind(1d0)), intent(in)  bldgH,
real(kind(1d0)), intent(in)  CapMax_dec,
real(kind(1d0)), intent(in)  CapMin_dec,
real(kind(1d0)), dimension(nsurf), intent(in)  chAnOHM,
real(kind(1d0)), intent(in)  CO2PointSource,
real(kind(1d0)), dimension(nsurf), intent(in)  cpAnOHM,
real(kind(1d0)), intent(in)  CRWmax,
real(kind(1d0)), intent(in)  CRWmin,
real(kind(1d0)), dimension(7), intent(in)  DayWat,
real(kind(1d0)), dimension(7), intent(in)  DayWatPer,
real(kind(1d0)), intent(in)  DecTreeH,
integer, intent(in)  Diagnose,
integer, intent(in)  DiagQN,
integer, intent(in)  DiagQS,
real(kind(1d0)), intent(in)  DRAINRT,
integer, intent(in)  dt_since_start,
real(kind(1d0)), intent(inout)  dqndt,
real(kind(1d0)), intent(inout)  qn1_av,
real(kind(1d0)), intent(inout)  dqnsdt,
real(kind(1d0)), intent(inout)  qn1_s_av,
real(kind(1d0)), intent(in)  EF_umolCO2perJ,
real(kind(1d0)), dimension(nsurf), intent(in)  emis,
integer, intent(in)  EmissionsMethod,
real(kind(1d0)), intent(in)  EnEF_v_Jkm,
integer, intent(in)  endDLS,
real(kind(1d0)), intent(in)  EveTreeH,
real(kind(1d0)), intent(in)  FAIBldg,
real(kind(1d0)), intent(in)  FAIDecTree,
real(kind(1d0)), intent(in)  FAIEveTree,
real(kind(1d0)), intent(in)  Faut,
real(kind(1d0)), dimension(2), intent(in)  FcEF_v_kgkm,
real(kind(1d0)), intent(in)  fcld_obs,
real(kind(1d0)), intent(in)  FlowChange,
real(kind(1d0)), intent(in)  FrFossilFuel_Heat,
real(kind(1d0)), intent(in)  FrFossilFuel_NonHeat,
real(kind(1d0)), intent(in)  G1,
real(kind(1d0)), intent(in)  G2,
real(kind(1d0)), intent(in)  G3,
real(kind(1d0)), intent(in)  G4,
real(kind(1d0)), intent(in)  G5,
real(kind(1d0)), intent(in)  G6,
real(kind(1d0)), dimension(nvegsurf), intent(inout)  GDD_id,
real(kind(1d0)), dimension(nvegsurf), intent(in)  GDDFull,
integer, intent(in)  Gridiv,
integer, intent(in)  gsModel,
real(kind(1d0)), intent(in)  H_maintain,
real(kind(1d0)), dimension(12), intent(inout)  HDD_id,
real(kind(1d0)), dimension(0:23, 2), intent(in)  HumActivity_24hr,
real(kind(1d0)), dimension(nsurf), intent(inout)  IceFrac,
integer, intent(in)  id,
real(kind(1d0)), dimension(3), intent(in)  Ie_a,
integer, intent(in)  Ie_end,
real(kind(1d0)), dimension(3), intent(in)  Ie_m,
integer, intent(in)  Ie_start,
integer, intent(in)  imin,
real(kind(1d0)), intent(in)  InternalWaterUse_h,
real(kind(1d0)), intent(in)  IrrFracPaved,
real(kind(1d0)), intent(in)  IrrFracBldgs,
real(kind(1d0)), intent(in)  IrrFracEveTr,
real(kind(1d0)), intent(in)  IrrFracDecTr,
real(kind(1d0)), intent(in)  IrrFracGrass,
real(kind(1d0)), intent(in)  IrrFracBSoil,
real(kind(1d0)), intent(in)  IrrFracWater,
integer, intent(in)  isec,
integer, intent(in)  it,
integer, intent(in)  EvapMethod,
integer, intent(in)  iy,
real(kind(1d0)), dimension(nsurf), intent(in)  kkAnOHM,
real(kind(1d0)), intent(in)  Kmax,
real(kind(1d0)), dimension(nvegsurf), intent(inout)  LAI_id,
integer, intent(in)  LAICalcYes,
real(kind(1d0)), dimension(nvegsurf), intent(in)  LAIMax,
real(kind(1d0)), dimension(nvegsurf), intent(in)  LAIMin,
real(kind(1d0)), intent(in)  LAI_obs,
real(kind(1d0)), dimension(4, nvegsurf), intent(in)  LAIPower,
integer, dimension(nvegsurf), intent(in)  LAIType,
real(kind(1d0)), intent(in)  lat,
real(kind(1d0)), intent(inout)  lenDay_id,
real(kind(1d0)), intent(in)  ldown_obs,
real(kind(1d0)), intent(in)  lng,
real(kind(1d0)), dimension(3), intent(in)  MaxConductance,
real(kind(1d0)), intent(in)  MaxFCMetab,
real(kind(1d0)), intent(in)  MaxQFMetab,
real(kind(1d0)), dimension(nsurf), intent(inout)  SnowWater,
real(kind(1d0)), dimension(:, :), intent(in)  MetForcingData_grid,
real(kind(1d0)), intent(in)  MinFCMetab,
real(kind(1d0)), intent(in)  MinQFMetab,
real(kind(1d0)), dimension(nvegsurf), intent(in)  min_res_bioCO2,
real(kind(1d0)), intent(in)  NARP_EMIS_SNOW,
real(kind(1d0)), intent(in)  NARP_TRANS_SITE,
integer, intent(in)  NetRadiationMethod,
real(kind(1d0)), dimension(nsurf + 1, 4, 3), intent(in)  OHM_coef,
integer, intent(in)  OHMIncQF,
real(kind(1d0)), dimension(nsurf + 1), intent(in)  OHM_threshSW,
real(kind(1d0)), dimension(nsurf + 1), intent(in)  OHM_threshWD,
real(kind(1d0)), intent(in)  PipeCapacity,
real(kind(1d0)), dimension(2), intent(in)  PopDensDaytime,
real(kind(1d0)), intent(in)  PopDensNighttime,
real(kind(1d0)), dimension(0:23, 2), intent(in)  PopProf_24hr,
real(kind(1d0)), intent(in)  PorMax_dec,
real(kind(1d0)), intent(in)  PorMin_dec,
real(kind(1d0)), intent(in)  Precip,
real(kind(1d0)), intent(in)  PrecipLimit,
real(kind(1d0)), intent(in)  PrecipLimitAlb,
real(kind(1d0)), intent(in)  Press_hPa,
real(kind(1d0)), dimension(2), intent(in)  QF0_BEU,
real(kind(1d0)), dimension(2), intent(in)  Qf_A,
real(kind(1d0)), dimension(2), intent(in)  Qf_B,
real(kind(1d0)), dimension(2), intent(in)  Qf_C,
real(kind(1d0)), intent(in)  qn1_obs,
real(kind(1d0)), intent(in)  qs_obs,
real(kind(1d0)), intent(in)  qf_obs,
real(kind(1d0)), intent(in)  RadMeltFact,
real(kind(1d0)), intent(in)  RAINCOVER,
real(kind(1d0)), intent(in)  RainMaxRes,
real(kind(1d0)), dimension(nvegsurf), intent(in)  resp_a,
real(kind(1d0)), dimension(nvegsurf), intent(in)  resp_b,
integer, intent(in)  RoughLenHeatMethod,
integer, intent(in)  RoughLenMomMethod,
real(kind(1d0)), intent(in)  RunoffToWater,
real(kind(1d0)), intent(in)  S1,
real(kind(1d0)), intent(in)  S2,
real(kind(1d0)), dimension(nsurf), intent(in)  SatHydraulicConduct,
real(kind(1d0)), dimension(nvegsurf), intent(in)  SDDFull,
real(kind(1d0)), dimension(nvegsurf), intent(inout)  SDD_id,
real(kind(1d0)), dimension(nsurf), intent(in)  sfr,
integer, intent(in)  SMDMethod,
real(kind(1d0)), intent(inout)  SnowAlb,
real(kind(1d0)), intent(in)  SnowAlbMax,
real(kind(1d0)), intent(in)  SnowAlbMin,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowPackLimit,
real(kind(1d0)), dimension(nsurf), intent(inout)  SnowDens,
real(kind(1d0)), intent(in)  SnowDensMax,
real(kind(1d0)), intent(in)  SnowDensMin,
real(kind(1d0)), intent(inout)  SnowfallCum,
real(kind(1d0)), dimension(nsurf), intent(inout)  SnowFrac,
real(kind(1d0)), intent(in)  SnowLimBldg,
real(kind(1d0)), intent(in)  SnowLimPaved,
real(kind(1d0)), intent(in)  snowFrac_obs,
real(kind(1d0)), dimension(nsurf), intent(inout)  SnowPack,
real(kind(1d0)), dimension(0:23, 2), intent(in)  SnowProf_24hr,
integer, intent(in)  snowUse,
real(kind(1d0)), dimension(nsurf), intent(in)  SoilDepth,
real(kind(1d0)), dimension(nsurf), intent(inout)  soilstore_id,
real(kind(1d0)), dimension(nsurf), intent(in)  SoilStoreCap,
integer, intent(in)  StabilityMethod,
integer, intent(in)  startDLS,
real(kind(1d0)), dimension(nsurf), intent(inout)  state_id,
real(kind(1d0)), dimension(nsurf), intent(in)  StateLimit,
integer, intent(in)  StorageHeatMethod,
real(kind(1d0)), dimension(6, nsurf), intent(inout)  StoreDrainPrm,
real(kind(1d0)), intent(in)  SurfaceArea,
real(kind(1d0)), intent(inout)  Tair_av,
real(kind(1d0)), intent(in)  tau_a,
real(kind(1d0)), intent(in)  tau_f,
real(kind(1d0)), intent(in)  tau_r,
real(kind(1d0)), intent(inout)  Tmax_id,
real(kind(1d0)), intent(inout)  Tmin_id,
real(kind(1d0)), dimension(2), intent(in)  BaseT_Cooling,
real(kind(1d0)), dimension(2), intent(in)  BaseT_Heating,
real(kind(1d0)), intent(in)  Temp_C,
real(kind(1d0)), intent(in)  TempMeltFact,
real(kind(1d0)), intent(in)  TH,
real(kind(1d0)), dimension(nvegsurf), intent(in)  theta_bioCO2,
real(kind(1d0)), intent(in)  timezone,
real(kind(1d0)), intent(in)  TL,
real(kind(1d0)), dimension(2), intent(in)  TrafficRate,
real(kind(1d0)), intent(in)  TrafficUnits,
real(kind(1d0)), dimension(0:23, 2), intent(in)  TraffProf_24hr,
real(kind(1d0)), dimension(:), intent(in)  Ts5mindata_ir,
integer, intent(in)  tstep,
integer, intent(in)  tstep_prev,
integer, intent(in)  veg_type,
real(kind(1d0)), dimension(nsurf + 1, nsurf - 1), intent(in)  WaterDist,
integer, intent(in)  WaterUseMethod,
real(kind(1d0)), dimension(nsurf), intent(in)  WetThresh,
real(kind(1d0)), intent(in)  wu_m3,
real(kind(1d0)), dimension(9), intent(inout)  WUDay_id,
real(kind(1d0)), intent(inout)  DecidCap_id,
real(kind(1d0)), intent(inout)  albDecTr_id,
real(kind(1d0)), intent(inout)  albEveTr_id,
real(kind(1d0)), intent(inout)  albGrass_id,
real(kind(1d0)), intent(inout)  porosity_id,
real(kind(1d0)), dimension(0:23, 2), intent(in)  WUProfA_24hr,
real(kind(1d0)), dimension(0:23, 2), intent(in)  WUProfM_24hr,
real(kind(1d0)), intent(in)  xsmd,
real(kind(1d0)), intent(in)  Z,
real(kind(1d0)), intent(in)  z0m_in,
real(kind(1d0)), intent(in)  zdm_in,
real(kind(1d0)), dimension(5), intent(out)  datetimeLine,
real(kind(1d0)), dimension(ncolumnsdataoutsuews - 5), intent(out)  dataOutLineSUEWS,
real(kind(1d0)), dimension(ncolumnsdataoutsnow - 5), intent(out)  dataOutLineSnow,
real(kind(1d0)), dimension(ncolumnsdataoutestm - 5), intent(out)  dataOutLineESTM,
real(kind(1d0)), dimension(ncolumnsdataoutrsl - 5), intent(out)  dataoutLineRSL,
real(kind(1d0)), dimension(ncolumnsdataoutsol - 5), intent(out)  dataOutLineSOLWEIG,
real(kind(1d0)), dimension(ncolumnsdataoutdailystate - 5), intent(out)  DailyStateLine 
)

Definition at line 92 of file suews_ctrl_driver.f95.

References moist::avcp, moist::avdens, allocatearray::bldgsurf, allocatearray::bsoilsurf, atmmoiststab_module::cal_atmmoist(), cal_tair_av(), cal_tsfc(), allocatearray::conifsurf, allocatearray::decidsurf, allocatearray::grasssurf, allocatearray::ivconif, allocatearray::ivdecid, allocatearray::ivgrass, lumps_module::lumps_cal_qhqe(), moist::lv_j_kg, narp_module::narp_cal_sunposition(), allocatearray::nsurf, allocatearray::nvegsurf, rsl_module::rslprofile(), set_nan(), snow_module::snow_cal_meltheat(), solweig_module::solweig_cal_main(), suews_cal_anthropogenicemission(), suews_cal_biogenco2(), suews_cal_dectime(), suews_cal_dls(), waterdist_module::suews_cal_horizontalsoilwater(), suews_cal_qe(), suews_cal_qh(), suews_cal_qn(), suews_cal_qs(), suews_cal_resistance(), resist_module::suews_cal_roughnessparameters(), waterdist_module::suews_cal_soilstate(), suews_cal_surf(), suews_cal_tstep(), suews_cal_water(), waterdist_module::suews_cal_wateruse(), suews_cal_weekday(), suews_update_outputline(), and waterdist_module::suews_update_soilmoist().

Referenced by suews_cal_multitsteps(), suews_calculations(), and sumin_module::sumin().

92 
93  IMPLICIT NONE
94 
95  ! ########################################################################################
96  ! input variables
97  INTEGER, INTENT(IN)::aerodynamicresistancemethod
98  INTEGER, INTENT(IN)::basetmethod
99  INTEGER, INTENT(IN)::diagnose
100  INTEGER, INTENT(IN)::diagqn
101  INTEGER, INTENT(IN)::diagqs
102  INTEGER, INTENT(IN)::startdls
103  INTEGER, INTENT(IN)::enddls
104  INTEGER, INTENT(IN)::emissionsmethod
105  INTEGER, INTENT(IN)::gridiv
106  INTEGER, INTENT(IN)::gsmodel
107  INTEGER, INTENT(IN)::id
108  INTEGER, INTENT(IN)::ie_end
109  INTEGER, INTENT(IN)::ie_start
110  INTEGER, INTENT(IN)::isec
111  INTEGER, INTENT(IN)::imin
112  INTEGER, INTENT(IN)::it
113  INTEGER, INTENT(IN)::evapmethod
114  INTEGER, INTENT(IN)::iy
115  INTEGER, INTENT(IN)::laicalcyes
116  INTEGER, INTENT(IN)::netradiationmethod
117  INTEGER, INTENT(IN)::ohmincqf
118  INTEGER, INTENT(IN)::roughlenheatmethod
119  INTEGER, INTENT(IN)::roughlenmommethod
120  INTEGER, INTENT(IN)::smdmethod
121  INTEGER, INTENT(IN)::snowuse
122  INTEGER, INTENT(IN)::stabilitymethod
123  INTEGER, INTENT(IN)::storageheatmethod
124  INTEGER, INTENT(IN)::tstep
125  INTEGER, INTENT(IN)::tstep_prev ! tstep size of the previous step
126  INTEGER, INTENT(in)::dt_since_start ! time since simulation starts [s]
127  INTEGER, INTENT(IN)::veg_type
128  INTEGER, INTENT(IN)::waterusemethod
129 
130  REAL(KIND(1D0)), INTENT(IN)::albmax_dectr
131  REAL(KIND(1D0)), INTENT(IN)::albmax_evetr
132  REAL(KIND(1D0)), INTENT(IN)::albmax_grass
133  REAL(KIND(1D0)), INTENT(IN)::albmin_dectr
134  REAL(KIND(1D0)), INTENT(IN)::albmin_evetr
135  REAL(KIND(1D0)), INTENT(IN)::albmin_grass
136  REAL(KIND(1D0)), INTENT(IN)::alt
137  REAL(KIND(1D0)), INTENT(IN)::avkdn
138  REAL(KIND(1D0)), INTENT(IN)::avrh
139  REAL(KIND(1D0)), INTENT(IN)::avu1
140  REAL(KIND(1D0)), INTENT(IN)::baset_hc
141  REAL(KIND(1D0)), INTENT(IN)::bldgh
142  REAL(KIND(1D0)), INTENT(IN)::capmax_dec
143  REAL(KIND(1D0)), INTENT(IN)::capmin_dec
144  REAL(KIND(1D0)), INTENT(IN)::co2pointsource
145  REAL(KIND(1D0)), INTENT(IN)::crwmax
146  REAL(KIND(1D0)), INTENT(IN)::crwmin
147  REAL(KIND(1D0)), INTENT(IN)::dectreeh
148  REAL(KIND(1D0)), INTENT(IN)::drainrt
149  REAL(KIND(1D0)), INTENT(IN)::ef_umolco2perj
150  REAL(KIND(1D0)), INTENT(IN)::enef_v_jkm
151  REAL(KIND(1D0)), INTENT(IN)::evetreeh
152  REAL(KIND(1D0)), INTENT(IN)::faibldg
153  REAL(KIND(1D0)), INTENT(IN)::faidectree
154  REAL(KIND(1D0)), INTENT(IN)::faievetree
155  REAL(KIND(1D0)), INTENT(IN)::faut
156  REAL(KIND(1D0)), INTENT(IN)::fcld_obs
157  REAL(KIND(1D0)), INTENT(IN)::flowchange
158  REAL(KIND(1D0)), INTENT(IN)::frfossilfuel_heat
159  REAL(KIND(1D0)), INTENT(IN)::frfossilfuel_nonheat
160  REAL(KIND(1D0)), INTENT(IN)::g1
161  REAL(KIND(1D0)), INTENT(IN)::g2
162  REAL(KIND(1D0)), INTENT(IN)::g3
163  REAL(KIND(1D0)), INTENT(IN)::g4
164  REAL(KIND(1D0)), INTENT(IN)::g5
165  REAL(KIND(1D0)), INTENT(IN)::g6
166  REAL(KIND(1D0)), INTENT(IN)::h_maintain
167  REAL(KIND(1D0)), INTENT(IN)::internalwateruse_h
168  REAL(KIND(1D0)), INTENT(IN)::irrfracpaved
169  REAL(KIND(1D0)), INTENT(IN)::irrfracbldgs
170  REAL(KIND(1D0)), INTENT(IN)::irrfracevetr
171  REAL(KIND(1D0)), INTENT(IN)::irrfracdectr
172  REAL(KIND(1D0)), INTENT(IN)::irrfracgrass
173  REAL(KIND(1D0)), INTENT(IN)::irrfracbsoil
174  REAL(KIND(1D0)), INTENT(IN)::irrfracwater
175  REAL(KIND(1D0)), INTENT(IN)::kmax
176  REAL(KIND(1D0)), INTENT(IN)::lai_obs
177  REAL(KIND(1D0)), INTENT(IN)::lat
178  REAL(KIND(1D0)), INTENT(IN)::ldown_obs
179  REAL(KIND(1D0)), INTENT(IN)::lng
180  REAL(KIND(1D0)), INTENT(IN)::maxfcmetab
181  REAL(KIND(1D0)), INTENT(IN)::maxqfmetab
182  REAL(KIND(1D0)), INTENT(IN)::minfcmetab
183  REAL(KIND(1D0)), INTENT(IN)::minqfmetab
184  REAL(KIND(1D0)), INTENT(IN)::narp_emis_snow
185  REAL(KIND(1D0)), INTENT(IN)::narp_trans_site
186  REAL(KIND(1D0)), INTENT(IN)::pipecapacity
187  REAL(KIND(1D0)), INTENT(IN)::popdensnighttime
188  REAL(KIND(1D0)), INTENT(IN)::pormax_dec
189  REAL(KIND(1D0)), INTENT(IN)::pormin_dec
190  REAL(KIND(1D0)), INTENT(IN)::precip
191  REAL(KIND(1D0)), INTENT(IN)::preciplimit
192  REAL(KIND(1D0)), INTENT(IN)::preciplimitalb
193  REAL(KIND(1D0)), INTENT(IN)::press_hpa
194  REAL(KIND(1D0)), INTENT(IN)::qn1_obs
195  REAL(KIND(1D0)), INTENT(IN)::qs_obs
196  REAL(KIND(1D0)), INTENT(IN)::qf_obs
197  REAL(KIND(1D0)), INTENT(IN)::radmeltfact
198  REAL(KIND(1D0)), INTENT(IN)::raincover
199  REAL(KIND(1D0)), INTENT(IN)::rainmaxres
200  REAL(KIND(1D0)), INTENT(IN)::runofftowater
201  REAL(KIND(1D0)), INTENT(IN)::s1
202  REAL(KIND(1D0)), INTENT(IN)::s2
203  REAL(KIND(1D0)), INTENT(IN)::snowalbmax
204  REAL(KIND(1D0)), INTENT(IN)::snowalbmin
205  REAL(KIND(1D0)), INTENT(IN)::snowdensmax
206  REAL(KIND(1D0)), INTENT(IN)::snowdensmin
207  REAL(KIND(1D0)), INTENT(IN)::snowlimbldg
208  REAL(KIND(1D0)), INTENT(IN)::snowlimpaved
209  REAL(KIND(1D0)), INTENT(IN)::snowfrac_obs
210  REAL(KIND(1D0)), INTENT(IN)::surfacearea
211  REAL(KIND(1D0)), INTENT(IN)::tau_a
212  REAL(KIND(1D0)), INTENT(IN)::tau_f
213  REAL(KIND(1D0)), INTENT(IN)::tau_r
214  REAL(KIND(1D0)), INTENT(IN)::temp_c
215  REAL(KIND(1D0)), INTENT(IN)::tempmeltfact
216  REAL(KIND(1D0)), INTENT(IN)::th
217  REAL(KIND(1D0)), INTENT(IN)::timezone
218  REAL(KIND(1D0)), INTENT(IN)::tl
219  REAL(KIND(1D0)), INTENT(IN)::trafficunits
220  REAL(KIND(1D0)), INTENT(IN)::wu_m3
221  REAL(KIND(1D0)), INTENT(IN)::xsmd
222  REAL(KIND(1D0)), INTENT(IN)::z
223  REAL(KIND(1D0)), INTENT(IN)::z0m_in
224  REAL(KIND(1D0)), INTENT(IN)::zdm_in
225 
226  INTEGER, DIMENSION(NVEGSURF), INTENT(IN)::laitype
227 
228  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::ah_min
229  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::ah_slope_cooling
230  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::ah_slope_heating
231  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::fcef_v_kgkm
232  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::qf0_beu
233  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::qf_a
234  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::qf_b
235  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::qf_c
236  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::popdensdaytime
237  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::baset_cooling
238  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::baset_heating
239  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::trafficrate
240  REAL(KIND(1D0)), DIMENSION(3), INTENT(IN) ::ie_a
241  REAL(KIND(1D0)), DIMENSION(3), INTENT(IN) ::ie_m
242  REAL(KIND(1D0)), DIMENSION(3), INTENT(IN) ::maxconductance
243  REAL(KIND(1D0)), DIMENSION(7), INTENT(IN) ::daywat
244  REAL(KIND(1D0)), DIMENSION(7), INTENT(IN) ::daywatper
245  REAL(KIND(1D0)), DIMENSION(nsurf + 1), INTENT(IN) ::ohm_threshsw
246  REAL(KIND(1D0)), DIMENSION(nsurf + 1), INTENT(IN) ::ohm_threshwd
247  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::chanohm
248  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::cpanohm
249  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::emis
250  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::kkanohm
251  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::sathydraulicconduct
252  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::sfr
253  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::snowpacklimit
254  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::soildepth
255  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::soilstorecap
256  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::statelimit
257  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::wetthresh
258  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::alpha_bioco2
259  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::alpha_enh_bioco2
260  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::baset
261  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::basete
262  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::beta_bioco2
263  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::beta_enh_bioco2
264  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::gddfull
265  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::laimax
266  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::laimin
267  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::min_res_bioco2
268  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::resp_a
269  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::resp_b
270  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::sddfull
271  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::snowprof_24hr
272  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::theta_bioco2
273  REAL(KIND(1D0)), DIMENSION(4, NVEGSURF), INTENT(IN) ::laipower
274  REAL(KIND(1D0)), DIMENSION(nsurf + 1, 4, 3), INTENT(IN) ::ohm_coef
275  REAL(KIND(1D0)), DIMENSION(NSURF + 1, NSURF - 1), INTENT(IN)::waterdist
276  REAL(KIND(1d0)), DIMENSION(:), INTENT(IN) ::ts5mindata_ir
277  REAL(KIND(1D0)), DIMENSION(:, :), INTENT(IN) ::metforcingdata_grid
278 
279  ! diurnal profile values for 24hr
280  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::ahprof_24hr
281  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::humactivity_24hr
282  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::popprof_24hr
283  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::traffprof_24hr
284  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::wuprofa_24hr
285  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::wuprofm_24hr
286 
287  ! ########################################################################################
288 
289  ! ########################################################################################
290  ! inout variables
291  ! OHM related:
292  REAL(KIND(1d0)), INTENT(INOUT) ::qn1_av
293  REAL(KIND(1d0)), INTENT(INOUT) ::dqndt
294  REAL(KIND(1d0)), INTENT(INOUT) ::qn1_s_av
295  REAL(KIND(1d0)), INTENT(INOUT) ::dqnsdt
296 
297  ! snow related:
298  REAL(KIND(1D0)), INTENT(INOUT) ::snowfallcum
299  REAL(KIND(1D0)), INTENT(INOUT) ::snowalb
300  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT)::icefrac
301  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT)::snowwater
302  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT)::snowdens
303  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT)::snowfrac
304  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT)::snowpack
305 
306  ! water balance related:
307  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::soilstore_id
308  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::state_id
309  REAL(KIND(1D0)), DIMENSION(6, NSURF), INTENT(INOUT)::storedrainprm
310 
311  ! phenology related:
312  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::alb
313  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(INOUT)::gdd_id !Growing Degree Days (see SUEWS_DailyState.f95)
314  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(INout)::sdd_id !Senescence Degree Days (see SUEWS_DailyState.f95)
315  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(INOUT)::lai_id !LAI for each veg surface [m2 m-2]
316  REAL(KIND(1d0)), INTENT(INout)::tmin_id
317  REAL(KIND(1d0)), INTENT(INout)::tmax_id
318  REAL(KIND(1d0)), INTENT(INout)::lenday_id
319  REAL(KIND(1d0)), INTENT(INOUT)::decidcap_id
320  REAL(KIND(1d0)), INTENT(INOUT)::albdectr_id
321  REAL(KIND(1d0)), INTENT(INOUT)::albevetr_id
322  REAL(KIND(1d0)), INTENT(INOUT)::albgrass_id
323  REAL(KIND(1d0)), INTENT(INOUT)::porosity_id
324 
325  ! anthropogenic heat related:
326  REAL(KIND(1d0)), DIMENSION(12), INTENT(INOUT) ::hdd_id !Heating Degree Days (see SUEWS_DailyState.f95)
327 
328  ! water use related:
329  REAL(KIND(1d0)), DIMENSION(9), INTENT(INOUT) ::wuday_id
330 
331  ! ESTM related:
332  REAL(KIND(1d0)), INTENT(INOUT) ::tair_av
333  ! ########################################################################################
334 
335  ! ########################################################################################
336  ! output variables
337  REAL(KIND(1D0)), DIMENSION(5), INTENT(OUT) ::datetimeline
338  REAL(KIND(1D0)), DIMENSION(ncolumnsDataOutSUEWS - 5), INTENT(OUT) ::dataoutlinesuews
339  REAL(KIND(1D0)), DIMENSION(ncolumnsDataOutSnow - 5), INTENT(OUT) ::dataoutlinesnow
340  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutESTM - 5), INTENT(OUT) ::dataoutlineestm
341  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutRSL - 5), INTENT(OUT) ::dataoutlinersl ! RSL variable array
342  REAL(KIND(1D0)), DIMENSION(ncolumnsDataOutSol - 5), INTENT(OUT) ::dataoutlinesolweig
343  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutDailyState - 5), INTENT(OUT)::dailystateline
344  ! ########################################################################################
345 
346  ! ########################################################################################
347  ! local variables
348  REAL(KIND(1D0))::a1
349  REAL(KIND(1D0))::a2
350  REAL(KIND(1D0))::a3
351  REAL(KIND(1D0))::additionalwater
352  REAL(KIND(1D0))::u10_ms
353  REAL(KIND(1D0))::azimuth
354  REAL(KIND(1D0))::chsnow_per_interval
355 
356  REAL(KIND(1D0))::dens_dry
357  REAL(KIND(1d0))::deltalai
358  REAL(KIND(1D0))::drain_per_tstep
359  REAL(KIND(1D0))::ea_hpa
360  REAL(KIND(1D0))::qe_lumps
361  REAL(KIND(1D0))::es_hpa
362  REAL(KIND(1D0))::ev_per_tstep
363  REAL(KIND(1D0))::wu_ext
364  REAL(KIND(1D0))::fc
365  REAL(KIND(1D0))::fc_anthro
366  REAL(KIND(1D0))::fc_biogen
367  REAL(KIND(1D0))::fc_build
368  REAL(KIND(1D0))::fcld
369  REAL(KIND(1D0))::fc_metab
370  REAL(KIND(1D0))::fc_photo
371  REAL(KIND(1D0))::fc_point
372  REAL(KIND(1D0))::fc_respi
373  REAL(KIND(1D0))::fc_traff
374  REAL(KIND(1D0))::gfunc
375  REAL(KIND(1D0))::gsc
376  REAL(KIND(1D0))::qh_lumps
377  REAL(KIND(1D0))::wu_int
378  REAL(KIND(1D0))::kclear
379  REAL(KIND(1D0))::kup
380  REAL(KIND(1D0))::ldown
381  REAL(KIND(1D0))::lup
382  REAL(KIND(1D0))::l_mod
383  REAL(KIND(1D0))::mwh
384  REAL(KIND(1D0))::mwstore
385  REAL(KIND(1D0))::nwstate_per_tstep
386  REAL(KIND(1D0))::planf
387  REAL(KIND(1D0))::zl
388  REAL(KIND(1D0))::q2_gkg
389  REAL(KIND(1D0))::qe
390  REAL(KIND(1D0))::qf
391  REAL(KIND(1D0))::qf_sahp
392  REAL(KIND(1D0))::qh
393  REAL(KIND(1D0))::qh_residual
394  REAL(KIND(1D0))::qh_resist
395  REAL(KIND(1D0))::qm
396  REAL(KIND(1D0))::qmfreez
397  REAL(KIND(1D0))::qmrain
398  REAL(KIND(1D0))::qn1
399  REAL(KIND(1D0))::qn1_s
400  REAL(KIND(1D0))::qn1_snowfree
401  REAL(KIND(1D0))::qs
402  REAL(KIND(1D0))::ra
403  REAL(KIND(1D0))::resistsurf
404  REAL(KIND(1D0))::rh2
405  REAL(KIND(1d0))::runoffagveg
406  REAL(KIND(1d0))::runoffagimpervious
407  REAL(KIND(1D0))::runoff_per_tstep
408  REAL(KIND(1D0))::runoffpipes
409  REAL(KIND(1D0))::runoffsoil_per_tstep
410  REAL(KIND(1D0))::runoffwaterbody
411  REAL(KIND(1D0))::smd
412  REAL(KIND(1D0))::soilstate
413  REAL(KIND(1D0))::state_per_tstep
414  REAL(KIND(1D0))::surf_chang_per_tstep
415  REAL(KIND(1D0))::swe
416  REAL(KIND(1D0))::t2_c
417  REAL(KIND(1D0))::tsfc_c
418  REAL(KIND(1D0))::tempveg
419  REAL(KIND(1D0))::tot_chang_per_tstep
420  REAL(KIND(1D0))::tstar
421  REAL(KIND(1D0))::tsurf
422  REAL(KIND(1D0))::ustar
423  REAL(KIND(1D0))::vpd_pa
424  ! REAL(KIND(1D0))::wu_DecTr
425  ! REAL(KIND(1D0))::wu_EveTr
426  ! REAL(KIND(1D0))::wu_Grass
427  REAL(KIND(1D0))::z0m
428  REAL(KIND(1D0))::zdm
429  REAL(KIND(1D0))::zenith_deg
430  REAL(KIND(1D0))::zh
431 
432  REAL(KIND(1D0)), DIMENSION(2)::snowremoval
433  REAL(KIND(1D0)), DIMENSION(NSURF)::wu_nsurf
434  REAL(KIND(1D0)), DIMENSION(NSURF)::freezmelt
435  REAL(KIND(1d0)), DIMENSION(nsurf)::kup_ind_snow
436  REAL(KIND(1D0)), DIMENSION(NSURF)::mw_ind
437  REAL(KIND(1D0)), DIMENSION(NSURF)::qm_freezstate
438  REAL(KIND(1D0)), DIMENSION(NSURF)::qm_melt
439  REAL(KIND(1D0)), DIMENSION(NSURF)::qm_rain
440  REAL(KIND(1D0)), DIMENSION(NSURF)::qn1_ind_snow
441  REAL(KIND(1D0)), DIMENSION(NSURF)::rainonsnow
442  REAL(KIND(1D0)), DIMENSION(NSURF)::runoffsoil
443  REAL(KIND(1D0)), DIMENSION(NSURF)::smd_nsurf
444  REAL(KIND(1D0)), DIMENSION(NSURF)::snowdepth
445 
446  REAL(KIND(1d0)), DIMENSION(nsurf)::tsurf_ind_snow
447 
448  INTEGER, DIMENSION(NSURF)::snowcalcswitch
449  INTEGER, DIMENSION(3) ::dayofweek_id
450  INTEGER::dls
451 
452  ! REAL(KIND(1D0))::avcp
453  ! REAL(KIND(1D0))::avdens
454  ! REAL(KIND(1D0))::lv_J_kg
455  REAL(KIND(1D0))::dq
456  REAL(KIND(1D0))::lvs_j_kg
457  REAL(KIND(1D0))::psyc_hpa
458  REAL(KIND(1D0))::rasnow
459  REAL(KIND(1D0))::rb
460  REAL(KIND(1D0))::runoff_per_interval
461  REAL(KIND(1D0))::s_hpa
462  REAL(KIND(1D0))::sice_hpa
463  REAL(KIND(1D0))::soilmoistcap
464  REAL(KIND(1D0))::veg_fr
465  REAL(KIND(1D0))::vegphenlumps
466  REAL(KIND(1D0))::vpd_hpa
467  REAL(KIND(1D0))::vsmd
468  REAL(KIND(1D0))::zzd
469 
470  REAL(KIND(1D0)), DIMENSION(NSURF)::deltaqi
471  REAL(KIND(1D0)), DIMENSION(NSURF)::drain
472  REAL(KIND(1D0)), DIMENSION(NSURF)::freezstate
473  REAL(KIND(1D0)), DIMENSION(NSURF)::freezstatevol
474  REAL(KIND(1D0)), DIMENSION(NSURF)::soilstoreold
475  REAL(KIND(1D0)), DIMENSION(NSURF)::stateold
476  REAL(KIND(1D0)), DIMENSION(NSURF)::tsurf_ind
477 
478  ! TODO: TS 25 Oct 2017
479  ! the variables are not used currently as grid-to-grid connection is NOT set up.
480  ! set these variables as zero.
481  REAL(KIND(1D0))::addimpervious = 0
482  REAL(KIND(1D0))::addpipes = 0
483  REAL(KIND(1D0))::addveg = 0
484  REAL(KIND(1D0))::addwaterbody = 0
485  REAL(KIND(1D0)), DIMENSION(NSURF)::addwater = 0
486  REAL(KIND(1D0)), DIMENSION(NSURF)::frac_water2runoff = 0
487 
488  ! values that are derived from tstep
489  INTEGER::nsh ! number of timesteps per hour
490  REAL(KIND(1D0))::nsh_real ! nsh in type real
491  REAL(KIND(1D0))::tstep_real ! tstep in type real
492  REAL(KIND(1D0))::dectime
493 
494  ! values that are derived from sfr (surface fractions)
495  REAL(KIND(1D0))::vegfraction
496  REAL(KIND(1D0))::impervfraction
497  REAL(KIND(1D0))::pervfraction
498  REAL(KIND(1D0))::nonwaterfraction
499 
500  ! snow related temporary values
501  ! REAL(KIND(1D0))::alb0
502  REAL(KIND(1D0))::alb1
503 
504  ! ########################################################################################
505  ! TS 19 Sep 2019
506  ! temporary variables to save values for inout varialbes
507  ! suffixes and denote values from last and to next tsteps, respectively
508  ! these variables are introduced to allow safe and robust iterations inccurred in this subroutine
509  ! so that these values won't updated in unexpectedly many times
510 
511  ! OHM related:
512  REAL(KIND(1D0))::qn1_av_prev, qn1_av_next
513  REAL(KIND(1D0))::dqndt_prev, dqndt_next
514  REAL(KIND(1D0))::qn1_s_av_prev, qn1_s_av_next
515  REAL(KIND(1D0))::dqnsdt_prev, dqnsdt_next
516 
517  ! snow related:
518  REAL(KIND(1D0))::snowfallcum_prev, snowfallcum_next
519  REAL(KIND(1D0))::snowalb_prev, snowalb_next
520 
521  REAL(KIND(1D0)), DIMENSION(NSURF)::icefrac_prev, icefrac_next
522  REAL(KIND(1D0)), DIMENSION(NSURF)::snowwater_prev, snowwater_next
523  REAL(KIND(1D0)), DIMENSION(NSURF)::snowdens_prev, snowdens_next
524  REAL(KIND(1D0)), DIMENSION(NSURF)::snowfrac_prev, snowfrac_next
525  REAL(KIND(1D0)), DIMENSION(NSURF)::snowpack_prev, snowpack_next
526 
527  ! water balance related:
528  REAL(KIND(1D0)), DIMENSION(NSURF) ::soilstore_id_prev, soilstore_id_next
529  REAL(KIND(1D0)), DIMENSION(NSURF) ::state_id_prev, state_id_next
530  REAL(KIND(1D0)), DIMENSION(6, NSURF)::storedrainprm_prev, storedrainprm_next
531 
532  ! phenology related:
533  REAL(KIND(1D0)), DIMENSION(NSURF) ::alb_prev, alb_next
534  REAL(KIND(1d0)), DIMENSION(nvegsurf)::gdd_id_prev, gdd_id_next
535  REAL(KIND(1d0)), DIMENSION(nvegsurf)::lai_id_prev, lai_id_next
536  REAL(KIND(1d0)), DIMENSION(nvegsurf)::sdd_id_prev, sdd_id_next
537 
538  REAL(KIND(1D0))::decidcap_id_prev, decidcap_id_next
539  REAL(KIND(1D0))::albdectr_id_prev, albdectr_id_next
540  REAL(KIND(1D0))::albevetr_id_prev, albevetr_id_next
541  REAL(KIND(1D0))::albgrass_id_prev, albgrass_id_next
542  REAL(KIND(1D0))::porosity_id_prev, porosity_id_next
543 
544  REAL(KIND(1d0))::tmin_id_prev, tmin_id_next
545  REAL(KIND(1d0))::tmax_id_prev, tmax_id_next
546  REAL(KIND(1d0))::lenday_id_prev, lenday_id_next
547 
548  ! anthropogenic heat related:
549  REAL(KIND(1d0)), DIMENSION(12)::hdd_id_prev, hdd_id_next
550 
551  ! water use related:
552  REAL(KIND(1d0)), DIMENSION(9)::wuday_id_prev, wuday_id_next
553 
554  REAL(KIND(1D0))::tair_av_prev, tair_av_next
555  ! ########################################################################################
556 
557  ! Related to RSL wind profiles
558  INTEGER, PARAMETER :: nz = 90 ! number of levels 10 levels in canopy plus 20 (3 x Zh) above the canopy
559 
560  ! flag for Tsurf convergence
561  logical:: flag_converge
562  REAL(KIND(1D0)):: ts_iter
563  REAL(KIND(1D0)):: l_mod_iter
564  REAL(KIND(1D0)):: qh_init
565  INTEGER::i_iter
566 
567  ! REAL(KIND(1d0)), DIMENSION(30):: psihatm_z
568  ! REAL(KIND(1d0)), DIMENSION(30):: psihath_z
569 
570  ! ########################################################################################
571  ! save initial values of inout variables
572  qn1_av_prev = qn1_av
573  dqndt_prev = dqndt
574  qn1_s_av_prev = qn1_s_av
575  dqnsdt_prev = dqnsdt
576  snowfallcum_prev = snowfallcum
577  snowalb_prev = snowalb
578  icefrac_prev = icefrac
579  snowwater_prev = snowwater
580  snowdens_prev = snowdens
581  snowfrac_prev = snowfrac
582  snowpack_prev = snowpack
583  soilstore_id_prev = soilstore_id
584  state_id_prev = state_id
585  tair_av_prev = tair_av
588  sdd_id_prev = sdd_id
589  tmin_id_prev = tmin_id
590  tmax_id_prev = tmax_id
591  lenday_id_prev = lenday_id
592  storedrainprm_prev = storedrainprm
593  decidcap_id_prev = decidcap_id
594  porosity_id_prev = porosity_id
595  alb_prev = alb
596  albdectr_id_prev = albdectr_id
597  albevetr_id_prev = albevetr_id
598  albgrass_id_prev = albgrass_id
599  hdd_id_prev = hdd_id
601 
602  ! initialise variables
603  qn1_av_next = qn1_av
604  dqndt_next = dqndt
605  qn1_s_av_next = qn1_s_av
606  dqnsdt_next = dqnsdt
607  snowfallcum_next = snowfallcum
608  snowalb_next = snowalb
609  icefrac_next = icefrac
610  snowwater_next = snowwater
611  snowdens_next = snowdens
612  snowfrac_next = snowfrac
613  snowpack_next = snowpack
614  soilstore_id_next = soilstore_id
615  state_id_next = state_id
616  tair_av_next = tair_av
617  lai_id_next = lai_id
618  gdd_id_next = gdd_id
619  sdd_id_next = sdd_id
620  tmin_id_next = tmin_id
621  tmax_id_next = tmax_id
622  lenday_id_next = lenday_id
623  storedrainprm_next = storedrainprm
624  decidcap_id_next = decidcap_id
625  porosity_id_next = porosity_id
626  alb_next = alb
627  albdectr_id_next = albdectr_id
628  albevetr_id_next = albevetr_id
629  albgrass_id_next = albgrass_id
630  hdd_id_next = hdd_id
631  wuday_id_next = wuday_id
632 
633  !########################################################################################
634  ! main calculation starts here
635  !########################################################################################
636 
637  ! iteration is used below to get results converge
638  flag_converge = .false.
639  ts_iter = temp_c
640  l_mod_iter = 10
641  i_iter = 1
642  do while (.not. flag_converge)
643 
644  ! calculate dectime
645  CALL suews_cal_dectime( &
646  id, it, imin, isec, & ! input
647  dectime) ! output
648 
649  ! calculate tstep related VARIABLES
650  CALL suews_cal_tstep( &
651  tstep, & ! input
652  nsh, nsh_real, tstep_real) ! output
653 
654  ! calculate surface fraction related VARIABLES
655  CALL suews_cal_surf( &
656  sfr, & !input
657  vegfraction, impervfraction, pervfraction, nonwaterfraction) ! output
658 
659  ! calculate dayofweek information
660  CALL suews_cal_weekday( &
661  iy, id, lat, & !input
662  dayofweek_id) !output
663 
664  ! calculate dayofweek information
665  CALL suews_cal_dls( &
666  id, startdls, enddls, & !input
667  dls) !output
668 
669  ! calculate mean air temperature of past 24 hours
670  tair_av_next = cal_tair_av(tair_av_prev, dt_since_start, tstep, temp_c)
671 
672  !==============main calculation start=======================
673 
674  !==============surface roughness calculation=======================
675  IF (diagnose == 1) WRITE (*, *) 'Calling SUEWS_cal_RoughnessParameters...'
676  IF (diagnose == 1) print *, 'z0m_in =', z0m_in
678  roughlenmommethod, sfr, &!input
679  bldgh, evetreeh, dectreeh, &
680  porosity_id_prev, faibldg, faievetree, faidectree, &
681  z0m_in, zdm_in, z, &
682  planf, &!output
683  zh, z0m, zdm, zzd)
684 
685  !=================Calculate sun position=================
686  IF (diagnose == 1) WRITE (*, *) 'Calling NARP_cal_SunPosition...'
687  CALL narp_cal_sunposition( &
688  REAL(iy, KIND(1d0)), &!input:
689  dectime - tstep/2, &! sun position at middle of timestep before
690  timezone, lat, lng, alt, &
691  azimuth, zenith_deg)!output:
692 
693  !=================Call the SUEWS_cal_DailyState routine to get surface characteristics ready=================
694  IF (diagnose == 1) WRITE (*, *) 'Calling SUEWS_cal_DailyState...'
695  CALL suews_cal_dailystate( &
696  iy, id, it, imin, isec, tstep, tstep_prev, dt_since_start, dayofweek_id, &!input
697  tmin_id_prev, tmax_id_prev, lenday_id_prev, &
698  basetmethod, &
699  waterusemethod, ie_start, ie_end, &
700  laicalcyes, laitype, &
701  nsh_real, avkdn, temp_c, precip, baset_hc, &
702  baset_heating, baset_cooling, &
703  lat, faut, lai_obs, &
707  ie_a, ie_m, daywatper, daywat, &
709  decidcap_id_prev, storedrainprm_prev, lai_id_prev, gdd_id_prev, sdd_id_prev, &
710  albdectr_id_prev, albevetr_id_prev, albgrass_id_prev, porosity_id_prev, &!input
711  hdd_id_prev, &!input
712  state_id_prev, soilstore_id_prev, soilstorecap, h_maintain, &!input
713  hdd_id_next, &!output
714  tmin_id_next, tmax_id_next, lenday_id_next, &
715  albdectr_id_next, albevetr_id_next, albgrass_id_next, porosity_id_next, &!output
716  decidcap_id_next, storedrainprm_next, lai_id_next, gdd_id_next, sdd_id_next, deltalai, wuday_id_next)!output
717 
718  !=================Calculation of density and other water related parameters=================
719  IF (diagnose == 1) WRITE (*, *) 'Calling LUMPS_cal_AtmMoist...'
720  CALL cal_atmmoist( &
721  temp_c, press_hpa, avrh, dectime, &! input:
722  lv_j_kg, lvs_j_kg, &! output:
724 
725  !======== Calculate soil moisture =========
726  IF (diagnose == 1) WRITE (*, *) 'Calling SUEWS_update_SoilMoist...'
727  CALL suews_update_soilmoist( &
728  nonwaterfraction, &!input
729  soilstorecap, sfr, soilstore_id_prev, &
730  soilmoistcap, soilstate, &!output
731  vsmd, smd)
732 
733  IF (diagnose == 1) WRITE (*, *) 'Calling SUEWS_cal_WaterUse...'
734  !=================Gives the external and internal water uses per timestep=================
735  CALL suews_cal_wateruse( &
736  nsh_real, & ! input:
737  wu_m3, surfacearea, sfr, &
738  irrfracpaved, irrfracbldgs, &
739  irrfracevetr, irrfracdectr, irrfracgrass, &
740  irrfracbsoil, irrfracwater, &
741  dayofweek_id, wuprofa_24hr, wuprofm_24hr, &
742  internalwateruse_h, hdd_id_next, wuday_id_next, &
743  waterusemethod, nsh, it, imin, dls, &
744  wu_nsurf, wu_int, wu_ext)! output:
745 
746  ! ===================ANTHROPOGENIC HEAT AND CO2 FLUX======================
747  CALL suews_cal_anthropogenicemission( &
748  ah_min, ahprof_24hr, ah_slope_cooling, ah_slope_heating, co2pointsource, &! input:
749  dayofweek_id, dls, ef_umolco2perj, emissionsmethod, enef_v_jkm, &
750  fcef_v_kgkm, frfossilfuel_heat, frfossilfuel_nonheat, hdd_id_next, humactivity_24hr, &
751  id, imin, it, maxfcmetab, maxqfmetab, minfcmetab, minqfmetab, nsh, &
752  popdensdaytime, popdensnighttime, popprof_24hr, qf, qf0_beu, qf_a, qf_b, qf_c, &
753  qf_obs, qf_sahp, surfacearea, baset_cooling, baset_heating, &
754  temp_c, trafficrate, trafficunits, traffprof_24hr, &
755  fc_anthro, fc_build, fc_metab, fc_point, fc_traff)! output:
756 
757  ! ========================================================================
758  ! N.B.: the following parts involves snow-related calculations.
759 
760  ! ===================NET ALLWAVE RADIATION================================
761  CALL suews_cal_qn( &
762  netradiationmethod, snowuse, &!input
763  tstep, snowpack_prev, tau_a, tau_f, snowalbmax, snowalbmin, &
764  diagnose, snowfrac_obs, ldown_obs, fcld_obs, &
765  dectime, zenith_deg, ts_iter, avkdn, temp_c, avrh, ea_hpa, qn1_obs, &
766  snowalb_prev, snowfrac_prev, diagqn, &
767  narp_trans_site, narp_emis_snow, icefrac_prev, sfr, emis, &
768  alb_prev, albdectr_id_next, albevetr_id_next, albgrass_id_next, &!input
769  alb_next, &!output
770  ldown, fcld, &!output
771  qn1, qn1_snowfree, qn1_s, kclear, kup, lup, tsurf, &
773  alb1, snowfrac_next, snowalb_next)
774 
775  ! =================STORAGE HEAT FLUX=======================================
776  CALL suews_cal_qs( &
777  storageheatmethod, qs_obs, ohmincqf, gridiv, &!input
778  id, tstep, dt_since_start, diagnose, sfr, &
780  soilstore_id_prev, soilstorecap, state_id_prev, snowuse, snowfrac_next, diagqs, &
781  hdd_id_next, metforcingdata_grid, ts5mindata_ir, qf, qn1, &
782  avkdn, avu1, temp_c, zenith_deg, avrh, press_hpa, ldown, &
783  bldgh, alb_next, emis, cpanohm, kkanohm, chanohm, emissionsmethod, &
784  tair_av_next, qn1_av_prev, dqndt_prev, qn1_s_av_prev, dqnsdt_prev, &
785  storedrainprm_next, &
786  qn1_s, dataoutlineestm, qs, &!output
787  qn1_av_next, dqndt_next, qn1_s_av_next, dqnsdt_next, &
788  deltaqi, a1, a2, a3)
789 
790  !==================Energy related to snow melting/freezing processes=======
791  IF (diagnose == 1) WRITE (*, *) 'Calling MeltHeat'
792 
793  CALL snow_cal_meltheat( &
794  snowuse, &!input
795  tstep, tau_r, snowdensmax, &
797  snowdensmin, temp_c, precip, preciplimit, preciplimitalb, &
798  nsh_real, sfr, tsurf_ind, tsurf_ind_snow, state_id_prev, qn1_ind_snow, &
799  kup_ind_snow, snowwater_prev, deltaqi, alb1, &
800  snowpack_prev, snowfrac_next, snowalb_next, snowdens_prev, snowfallcum_prev, &!input
801  snowpack_next, snowfrac_next, snowalb_next, snowdens_next, snowfallcum_next, &!output
802  mwh, qm, qmfreez, qmrain, &! output
805  dataoutlinesnow)!output
806 
807  !==========================Turbulent Fluxes================================
808  IF (diagnose == 1) WRITE (*, *) 'Calling LUMPS_cal_QHQE...'
809  if (i_iter == 1) then
810  !Calculate QH and QE from LUMPS in the first iteration of each time step
811  CALL lumps_cal_qhqe( &
812  veg_type, & !input
813  snowuse, qn1, qf, qs, qm, temp_c, veg_fr, avcp, press_hpa, lv_j_kg, &
814  tstep_real, drainrt, nsh_real, &
815  precip, rainmaxres, raincover, sfr, lai_id_next, laimax, laimin, &
816  qh_lumps, & !output
817  qe_lumps, psyc_hpa, s_hpa, sice_hpa, tempveg, vegphenlumps)
818 
819  ! use LUMPS QH to do stability correction
820  qh_init = qh_lumps
821  else
822  ! use SUEWS QH to do stability correction
823  qh_init = qh
824  end if
825 
826  !============= calculate water balance =============
827  CALL suews_cal_water( &
828  diagnose, &!input
829  snowuse, nonwaterfraction, addpipes, addimpervious, addveg, addwaterbody, &
830  state_id_prev, soilstore_id_prev, sfr, storedrainprm_next, waterdist, nsh_real, &
831  drain_per_tstep, & !output
832  drain, frac_water2runoff, &
833  additionalwater, runoffpipes, runoff_per_interval, &
835  !============= calculate water balance end =============
836 
837  !===============Resistance Calculations=======================
838  CALL suews_cal_resistance( &
839  stabilitymethod, &!input:
840  diagnose, aerodynamicresistancemethod, roughlenheatmethod, snowuse, &
841  id, it, gsmodel, smdmethod, &
842  avdens, avcp, qh_init, zzd, z0m, zdm, &
843  avu1, temp_c, vegfraction, avkdn, &
844  kmax, &
845  g1, g2, g3, g4, &
846  g5, g6, s1, s2, &
847  th, tl, &
848  dq, xsmd, vsmd, maxconductance, laimax, lai_id_next, snowfrac_next, sfr, &
849  ustar, tstar, l_mod, &!output
850  zl, gsc, resistsurf, ra, rasnow, rb)
851 
852  !======== Evaporation and surface state_id ========
853  CALL suews_cal_qe( &
854  diagnose, snowuse, &!input
855  tstep, imin, it, evapmethod, snowcalcswitch, dayofweek_id, crwmin, crwmax, &
856  dectime, avdens, avcp, lv_j_kg, lvs_j_kg, avrh, press_hpa, temp_c, &
857  rasnow, psyc_hpa, sice_hpa, &
858  pervfraction, vegfraction, addimpervious, qn1_snowfree, qf, qs, vpd_hpa, s_hpa, &
859  resistsurf, ra, rb, snowdensmin, precip, pipecapacity, runofftowater, &
860  nonwaterfraction, wu_nsurf, addveg, addwaterbody, snowlimpaved, snowlimbldg, &
861  surfacearea, flowchange, drain, wetthresh, stateold, mw_ind, soilstorecap, rainonsnow, &
863  statelimit, addwater, frac_water2runoff, storedrainprm_next, snowpacklimit, snowprof_24hr, &
864  snowpack_next, snowfrac_next, snowwater_prev, icefrac_prev, snowdens_next, &! input:
865  runoff_per_interval, state_id_prev, soilstore_id_prev, &! input:
866  state_id_next, soilstore_id_next, &! output:
867  snowpack_next, snowfrac_next, snowwater_next, icefrac_next, snowdens_next, &! output
868  runoffsoil, &! output:
869  snowremoval, &
870  state_per_tstep, nwstate_per_tstep, qe, &
871  swe, chsnow_per_interval, ev_per_tstep, runoff_per_tstep, &
872  surf_chang_per_tstep, runoffpipes, mwstore, runoffwaterbody, &
873  runoffagveg, runoffagimpervious)
874  !======== Evaporation and surface state_id end========
875 
876  !============ Sensible heat flux ===============
877  IF (diagnose == 1) WRITE (*, *) 'Calling SUEWS_cal_QH...'
878  CALL suews_cal_qh( &
879  1, &
880  qn1, qf, qmrain, qe, qs, qmfreez, qm, avdens, avcp, tsurf, temp_c, ra, &
881  qh, qh_residual, qh_resist)!output
882  !============ Sensible heat flux end===============
883 
884  ! N.B.: snow-related calculations end here.
885  !===================================================
886 
887  !=== Horizontal movement between soil stores ===
888  ! Now water is allowed to move horizontally between the soil stores
889  IF (diagnose == 1) WRITE (*, *) 'Calling SUEWS_cal_HorizontalSoilWater...'
890  CALL suews_cal_horizontalsoilwater( &
891  sfr, &! input: ! surface fractions
892  soilstorecap, &!Capacity of soil store for each surface [mm]
893  soildepth, &!Depth of sub-surface soil store for each surface [mm]
894  sathydraulicconduct, &!Saturated hydraulic conductivity for each soil subsurface [mm s-1]
895  surfacearea, &!Surface area of the study area [m2]
896  nonwaterfraction, &! sum of surface cover fractions for all except water surfaces
897  tstep_real, & !tstep cast as a real for use in calculations
898  soilstore_id_next, &! inout:!Soil moisture of each surface type [mm]
899  runoffsoil, &!Soil runoff from each soil sub-surface [mm]
900  runoffsoil_per_tstep &! output:!Runoff to deep soil per timestep [mm] (for whole surface, excluding water body)
901  )
902 
903  !========== Calculate soil moisture ============
904  IF (diagnose == 1) WRITE (*, *) 'Calling SUEWS_cal_SoilState...'
905  CALL suews_cal_soilstate( &
906  smdmethod, xsmd, nonwaterfraction, soilmoistcap, &!input
907  soilstorecap, surf_chang_per_tstep, &
908  soilstore_id_next, soilstoreold, sfr, &
909  smd, smd_nsurf, tot_chang_per_tstep, soilstate)!output
910 
911  !============ surface-level diagonostics ===============
912  ! IF (Diagnose == 1) WRITE (*, *) 'Calling SUEWS_cal_Diagnostics...'
913  ! CALL SUEWS_cal_Diagnostics( &
914  ! dectime, &!input
915  ! avU1, Temp_C, avRH, Press_hPa, &
916  ! qh, qe, &
917  ! VegFraction, z, z0m, zdm, RA, avdens, avcp, lv_J_kg, tstep_real, &
918  ! RoughLenHeatMethod, StabilityMethod, &
919  ! U10_ms, t2_C, q2_gkg, tsfc_C, RH2)!output
920 
921  !============ roughness sub-layer diagonostics ===============
922  ! IF (Diagnose == 1) WRITE (*, *) 'Calling RSLProfile...'
923  ! CALL RSLProfile( &
924  ! Zh, z0m, zdm, &
925  ! UStar, L_MOD, sfr, planF, StabilityMethod, &
926  ! avcp, lv_J_kg, &
927  ! Temp_C, avRH, Press_hPa, z, qh, qe, & ! input
928  ! T2_C, q2_gkg, U10_ms, RH2, & !output
929  ! dataoutLineRSL) ! output
930 
931  !============ calculate surface temperature ===============
932  tsfc_c = cal_tsfc(qh, avdens, avcp, ra, temp_c)
933 
934  !============ surface-level diagonostics end ===============
935 
936  ! ============ BIOGENIC CO2 FLUX =======================
937  ! CALL SUEWS_cal_BiogenCO2( &
938  ! alpha_bioCO2, alpha_enh_bioCO2, avkdn, avRh, beta_bioCO2, beta_enh_bioCO2, BSoilSurf, &! input:
939  ! ConifSurf, DecidSurf, dectime, Diagnose, EmissionsMethod, Fc_anthro, G1, G2, G3, G4, &
940  ! G5, G6, gfunc, GrassSurf, gsmodel, id, it, ivConif, ivDecid, ivGrass, Kmax, LAI_id_next, LAIMin, &
941  ! LAIMax, MaxConductance, min_res_bioCO2, nsurf, NVegSurf, Press_hPa, resp_a, &
942  ! resp_b, S1, S2, sfr, SMDMethod, SnowFrac, t2_C, Temp_C, theta_bioCO2, TH, TL, vsmd, xsmd, &
943  ! Fc, Fc_biogen, Fc_photo, Fc_respi)! output:
944 
945  ! force quit do-while, i.e., skip iteration and use NARP for Tsurf calculation
946  ! if (NetRadiationMethod < 10 .or. NetRadiationMethod > 100) exit
947 
948  ! Test if sensible heat fluxes converge in iterations
949  i_iter = i_iter + 1
950  if (abs(qh - qh_init) > 0.1) then
951  flag_converge = .false.
952  else
953  flag_converge = .true.
954  end if
955 
956  ! force quit do-while loop if not convergent after 100 iterations
957  if (i_iter > 100) exit
958 
959  ts_iter = tsfc_c
960  l_mod_iter = l_mod
961 
962  !==============main calculation end=======================
963  ENDDO ! end iteration for tsurf calculations
964 
965  !==============================================================
966  ! Calculate diagnostics: these variables are decoupled from the main SUEWS calculation
967 
968  !============ roughness sub-layer diagonostics ===============
969  IF (diagnose == 1) WRITE (*, *) 'Calling RSLProfile...'
970  CALL rslprofile( &
971  zh, z0m, zdm, &
972  l_mod, sfr, planf, stabilitymethod, &
973  avcp, lv_j_kg, avdens, &
974  avu1, temp_c, avrh, press_hpa, z, qh, qe, & ! input
975  t2_c, q2_gkg, u10_ms, rh2, & !output
976  dataoutlinersl) ! output
977 
978  ! ============ BIOGENIC CO2 FLUX =======================
979  CALL suews_cal_biogenco2( &
981  conifsurf, decidsurf, dectime, diagnose, emissionsmethod, fc_anthro, g1, g2, g3, g4, &
982  g5, g6, gfunc, grasssurf, gsmodel, id, it, ivconif, ivdecid, ivgrass, kmax, lai_id_next, laimin, &
984  resp_b, s1, s2, sfr, smdmethod, snowfrac, t2_c, temp_c, theta_bioco2, th, tl, vsmd, xsmd, &
985  fc, fc_biogen, fc_photo, fc_respi)! output:
986 
987  ! calculations of diagnostics end
988  !==============================================================
989 
990  !==============================================================
991  ! update inout variables with new values
992  qn1_av = qn1_av_next
993  dqndt = dqndt_next
994  qn1_s_av = qn1_s_av_next
995  dqnsdt = dqnsdt_next
996  snowfallcum = snowfallcum_next
997  snowalb = snowalb_next
998  icefrac = icefrac_next
999  snowwater = snowwater_next
1000  snowdens = snowdens_next
1001  snowfrac = snowfrac_next
1002  snowpack = snowpack_next
1003 
1004  soilstore_id = soilstore_id_next
1005  state_id = state_id_next
1006  alb = alb_next
1007  gdd_id = gdd_id_next
1008  sdd_id = sdd_id_next
1009  lai_id = lai_id_next
1010  decidcap_id = decidcap_id_next
1011  albdectr_id = albdectr_id_next
1012  albevetr_id = albevetr_id_next
1013  albgrass_id = albgrass_id_next
1014  porosity_id = porosity_id_next
1015  storedrainprm = storedrainprm_next
1016  tair_av = tair_av_next
1017  tmin_id = tmin_id_next
1018  tmax_id = tmax_id_next
1019  lenday_id = lenday_id_next
1020  hdd_id = hdd_id_next
1021  wuday_id = wuday_id_next
1022 
1023  !==============use SOLWEIG to get localised radiation flux==================
1024  if (sfr(bldgsurf) > 0) then
1025  CALL solweig_cal_main(id, it, dectime, 0.8d0, planf, avkdn, ldown, temp_c, avrh, press_hpa, tsfc_c, &
1026  lat, zenith_deg, azimuth, 1.d0, alb(1), alb(2), emis(1), emis(2), bldgh, dataoutlinesolweig)
1027  else
1029  endif
1030  !==============translation of output variables into output array===========
1031  CALL suews_update_outputline( &
1032  additionalwater, alb, avkdn, u10_ms, azimuth, &!input
1033  chsnow_per_interval, dectime, &
1034  drain_per_tstep, qe_lumps, ev_per_tstep, wu_ext, fc, fc_build, fcld, &
1035  fc_metab, fc_photo, fc_respi, fc_point, fc_traff, flowchange, &
1036  qh_lumps, id, imin, wu_int, it, iy, &
1037  kup, lai_id, ldown, l_mod, lup, mwh, &
1038  mwstore, &
1039  nsh_real, nwstate_per_tstep, precip, q2_gkg, &
1040  qe, qf, qh, qh_resist, qm, qmfreez, &
1041  qmrain, qn1, qn1_s, qn1_snowfree, qs, ra, &
1042  resistsurf, rh2, runoffagimpervious, runoffagveg, &
1043  runoff_per_tstep, runoffpipes, runoffsoil_per_tstep, &
1044  runoffwaterbody, sfr, smd, smd_nsurf, snowalb, snowremoval, &
1045  state_id_next, state_per_tstep, surf_chang_per_tstep, swe, t2_c, tsfc_c, &
1046  tot_chang_per_tstep, tsurf, ustar, &
1047  wu_nsurf, &
1048  z0m, zdm, zenith_deg, &
1050 
1051  ! model state_id:
1052 
1053  ! daily state_id:
1054  CALL update_dailystateline( &
1055  it, imin, nsh_real, &!input
1056  gdd_id, hdd_id, lai_id, &
1057  sdd_id, &
1059  decidcap_id, &
1060  albdectr_id, &
1061  albevetr_id, &
1062  albgrass_id, &
1063  porosity_id, &
1064  wuday_id, &
1065  deltalai, vegphenlumps, &
1066  snowalb, snowdens, &
1067  a1, a2, a3, &
1068  dailystateline)!out
1069 
1070  !==============translation end ================
1071 
real(kind(1d0)), dimension(nvegsurf) lai_id_prev
real(kind(1d0)), dimension(nsurf) mw_ind
real(kind(1d0)), dimension(nsurf) freezstate
real(kind(1d0)), dimension(:, :), allocatable metforcingdata_grid
real(kind(1d0)) qn1_s_av
real(kind(1d0)) tau_r
real(kind(1d0)), dimension(nsurf+1) ohm_threshwd
real(kind(1d0)), dimension(nsurf+1) ohm_threshsw
real(kind(1d0)), dimension(nsurf) snowdens
real(kind(1d0)), dimension(nsurf) rainonsnow
real(kind(1d0)) g1
real(kind(1d0)) s2
real(kind(1d0)), dimension(nvegsurf) theta_bioco2
integer gsmodel
real(kind(1d0)), dimension(nsurf) icefrac
integer, dimension(nsurf) snowcalcswitch
real(kind(1d0)), dimension(nsurf) snowwater
real(kind(1d0)) albmin_grass
real(kind(1d0)) g5
real(kind(1d0)) narp_emis_snow
real(kind(1d0)) snowfallcum
real(kind(1d0)) albmin_evetr
real(kind(1d0)), dimension(nsurf) state_id
integer, parameter ivgrass
real(kind(1d0)) mwstore
real(kind(1d0)) qn1_av
real(kind(1d0)) kmax
real(kind(1d0)) a2
real(kind(1d0)), dimension(nvegsurf) laimax
real(kind(1d0)), dimension(ncolumnsdataoutrsl - 5) dataoutlinersl
real(kind(1d0)), dimension(nsurf) drain
real(kind(1d0)) snowlimpaved
real(kind(1d0)) z
integer, parameter bsoilsurf
real(kind(1d0)) th
real(kind(1d0)), dimension(nvegsurf) maxconductance
real(kind(1d0)), dimension(0:23, 2) ahprof_24hr
real(kind(1d0)) snowalb
real(kind(1d0)), dimension(nsurf) kup_ind_snow
real(kind(1d0)) tempmeltfact
real(kind(1d0)), dimension(nsurf) soilstore_id
real(kind(1d0)) preciplimit
real(kind(1d0)), dimension(nsurf) qm_freezstate
real(kind(1d0)), dimension(nvegsurf) alpha_enh_bioco2
real(kind(1d0)) a1
real(kind(1d0)), dimension(4, nvegsurf) laipower
integer dls
real(kind(1d0)), dimension(nsurf) snowpacklimit
real(kind(1d0)), dimension(ncolumnsdataoutsuews - 5) dataoutlinesuews
real(kind(1d0)) albmax_evetr
real(kind(1d0)), dimension(nvegsurf) alpha_bioco2
real(kind(1d0)) zdm
real(kind(1d0)) albevetr_id
real(kind(1d0)), dimension(nsurf) kkanohm
integer, parameter nsurf
real(kind(1d0)) a3
real(kind(1d0)), dimension(nvegsurf) resp_a
real(kind(1d0)) g2
real(kind(1d0)) lvs_j_kg
integer isec
real(kind(1d0)) tmax_id
real(kind(1d0)) ea_hpa
real(kind(1d0)) lv_j_kg
real(kind(1d0)), dimension(nsurf) soilstorecap
real(kind(1d0)), dimension(nvegsurf) sdd_id
real(kind(1d0)), dimension(27) dataoutlineestm
real(kind(1d0)) zdm_in
real(kind(1d0)) qm
real(kind(1d0)) vpd_pa
real(kind(1d0)) snowdensmin
real(kind(1d0)) tair_av
real(kind(1d0)) zzd
real(kind(1d0)) g3
real(kind(1d0)), dimension(ncolumnsdataoutsnow - 5) dataoutlinesnow
real(kind(1d0)) albmax_grass
integer, parameter conifsurf
real(kind(1d0)), dimension(nsurf) sathydraulicconduct
subroutine suews_cal_tstep(tstep, nsh, nsh_real, tstep_real)
real(kind(1d0)), dimension(nsurf) statelimit
integer id
real(kind(1d0)), dimension(nvegsurf) gddfull
real(kind(1d0)), dimension(12) hdd_id
real(kind(1d0)), dimension(nsurf) snowdepth
real(kind(1d0)) avcp
real(kind(1d0)) dq
real(kind(1d0)) tau_f
real(kind(1d0)) capmax_dec
real(kind(1d0)) dqnsdt
real(kind(1d0)), dimension(0:23, 2) popprof_24hr
integer, dimension(nvegsurf) laitype
integer imin
real(kind(1d0)) snowalbmax
real(kind(1d0)), dimension(0:23, 2) wuprofm_24hr
real(kind(1d0)), dimension(nvegsurf) resp_b
real(kind(1d0)) pormax_dec
real(kind(1d0)), dimension(nsurf) chanohm
real(kind(1d0)), dimension(2) snowremoval
real(kind(1d0)) tmin_id
real(kind(1d0)), dimension(nsurf) emis
real(kind(1d0)), dimension(nsurf) soildepth
integer, parameter grasssurf
real(kind(1d0)), dimension(nvegsurf) gdd_id_prev
real(kind(1d0)) tau_a
real(kind(1d0)) radmeltfact
real(kind(1d0)) mwh
real(kind(1d0)), dimension(0:23, 2) snowprof_24hr
integer iy
real(kind(1d0)), dimension(nsurf) snowfrac
integer, parameter ivconif
real(kind(1d0)), dimension(nsurf) runoffsoil
real(kind(1d0)) qmrain
real(kind(1d0)) psyc_hpa
real(kind(1d0)) g4
integer dt_since_start
real(kind(1d0)), dimension(nsurf+1, 4, 3) ohm_coef
real(kind(1d0)), dimension(nvegsurf) laimin
subroutine suews_cal_dectime(id, it, imin, isec, dectime)
integer, parameter nvegsurf
real(kind(1d0)), dimension(nsurf) qn1_ind_snow
real(kind(1d0)), dimension(nsurf) freezstatevol
real(kind(1d0)), dimension(nsurf) wetthresh
subroutine suews_cal_weekday(iy, id, lat, dayofWeek_id)
real(kind(1d0)) z0m_in
real(kind(1d0)) qmfreez
real(kind(1d0)), dimension(nsurf) deltaqi
real(kind(1d0)) narp_trans_site
real(kind(1d0)), dimension(nvegsurf) lai_id
real(kind(1d0)), dimension(nsurf) stateold
real(kind(1d0)) lenday_id
real(kind(1d0)), dimension(nsurf) qm_melt
real(kind(1d0)) porosity_id
real(kind(1d0)), dimension(nsurf) cpanohm
real(kind(1d0)), dimension(nsurf) freezmelt
real(kind(1d0)) albmin_dectr
real(kind(1d0)) vpd_hpa
real(kind(1d0)), dimension(nvegsurf) basete
real(kind(1d0)) albgrass_id
real(kind(1d0)), dimension(nsurf) addwater
real(kind(1d0)), dimension(nsurf) snowpack
real(kind(1d0)), dimension(6, nsurf) storedrainprm
real(kind(1d0)) es_hpa
real(kind(1d0)), dimension(0:23, 2) traffprof_24hr
real(kind(1d0)) dqndt
real(kind(1d0)), dimension(nsurf) sfr
real(kind(1d0)) snowlimbldg
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)), dimension(0:23, 2) wuprofa_24hr
real(kind(1d0)) sice_hpa
real(kind(1d0)) g6
real(kind(1d0)), dimension(nsurf) smd_nsurf
real(kind(1d0)), dimension(9) wuday_id
real(kind(1d0)) s_hpa
real(kind(1d0)), dimension(nvegsurf) min_res_bioco2
real(kind(1d0)) crwmin
real(kind(1d0)) bldgh
integer it
real(kind(1d0)) snowdensmax
integer, parameter decidsurf
real(kind(1d0)) z0m
real(kind(1d0)) dectime
real(kind(1d0)), dimension(ncolumnsdataoutdailystate - 5) dailystateline
real(kind(1d0)), dimension(nsurf) alb
real(kind(1d0)) preciplimitalb
real(kind(1d0)) pormin_dec
real(kind(1d0)) tl
real(kind(1d0)) avdens
real(kind(1d0)), dimension(nvegsurf) beta_enh_bioco2
real(kind(1d0)), dimension(0:23, 2) humactivity_24hr
real(kind(1d0)) dens_dry
subroutine suews_cal_dls(id, startDLS, endDLS, DLS)
real(kind(1d0)) capmin_dec
integer, parameter bldgsurf
real(kind(1d0)), dimension(nvegsurf) gdd_id
real(kind(1d0)), dimension(nvegsurf) sddfull
real(kind(1d0)), dimension(:), allocatable ts5mindata_ir
real(kind(1d0)) crwmax
real(kind(1d0)), dimension(nsurf) soilstoreold
real(kind(1d0)), dimension(9) wuday_id_prev
real(kind(1d0)) swe
real(kind(1d0)), dimension(nvegsurf) baset
real(kind(1d0)) snowalbmin
real(kind(1d0)), dimension(nsurf) qm_rain
real(kind(1d0)), dimension(nvegsurf) beta_bioco2
real(kind(1d0)), dimension(5) datetimeline
real(kind(1d0)), dimension(nsurf) tsurf_ind
real(kind(1d0)) albdectr_id
integer, parameter ivdecid
real(kind(1d0)), dimension(nsurf) tsurf_ind_snow
real(kind(1d0)), dimension(ncolumnsdataoutsol - 5) dataoutlinesolweig
real(kind(1d0)), dimension(nsurf+1, nsurf - 1) waterdist
real(kind(1d0)) decidcap_id
real(kind(1d0)) albmax_dectr
real(kind(1d0)) s1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ suews_cal_multitsteps()

subroutine suews_driver::suews_cal_multitsteps ( real(kind(1d0)), dimension(len_sim, 24), intent(in)  MetForcingBlock,
integer, intent(in)  len_sim,
integer, intent(in)  AerodynamicResistanceMethod,
real(kind(1d0)), dimension(2), intent(in)  AH_MIN,
real(kind(1d0)), dimension(0:23, 2), intent(in)  AHProf_24hr,
real(kind(1d0)), dimension(2), intent(in)  AH_SLOPE_Cooling,
real(kind(1d0)), dimension(2), intent(in)  AH_SLOPE_Heating,
real(kind(1d0)), dimension(nsurf), intent(inout)  alb,
real(kind(1d0)), intent(in)  AlbMax_DecTr,
real(kind(1d0)), intent(in)  AlbMax_EveTr,
real(kind(1d0)), intent(in)  AlbMax_Grass,
real(kind(1d0)), intent(in)  AlbMin_DecTr,
real(kind(1d0)), intent(in)  AlbMin_EveTr,
real(kind(1d0)), intent(in)  AlbMin_Grass,
real(kind(1d0)), dimension(nvegsurf), intent(in)  alpha_bioCO2,
real(kind(1d0)), dimension(nvegsurf), intent(in)  alpha_enh_bioCO2,
real(kind(1d0)), intent(in)  alt,
real(kind(1d0)), dimension(nvegsurf), intent(in)  BaseT,
real(kind(1d0)), dimension(nvegsurf), intent(in)  BaseTe,
integer, intent(in)  BaseTMethod,
real(kind(1d0)), intent(in)  BaseT_HC,
real(kind(1d0)), dimension(nvegsurf), intent(in)  beta_bioCO2,
real(kind(1d0)), dimension(nvegsurf), intent(in)  beta_enh_bioCO2,
real(kind(1d0)), intent(in)  bldgH,
real(kind(1d0)), intent(in)  CapMax_dec,
real(kind(1d0)), intent(in)  CapMin_dec,
real(kind(1d0)), dimension(nsurf), intent(in)  chAnOHM,
real(kind(1d0)), intent(in)  CO2PointSource,
real(kind(1d0)), dimension(nsurf), intent(in)  cpAnOHM,
real(kind(1d0)), intent(in)  CRWmax,
real(kind(1d0)), intent(in)  CRWmin,
real(kind(1d0)), dimension(7), intent(in)  DayWat,
real(kind(1d0)), dimension(7), intent(in)  DayWatPer,
real(kind(1d0)), intent(in)  DecTreeH,
integer, intent(in)  Diagnose,
integer, intent(in)  DiagQN,
integer, intent(in)  DiagQS,
real(kind(1d0)), intent(in)  DRAINRT,
integer, intent(inout)  dt_since_start,
real(kind(1d0)), intent(inout)  dqndt,
real(kind(1d0)), intent(inout)  qn1_av,
real(kind(1d0)), intent(inout)  dqnsdt,
real(kind(1d0)), intent(inout)  qn1_s_av,
real(kind(1d0)), intent(in)  EF_umolCO2perJ,
real(kind(1d0)), dimension(nsurf), intent(in)  emis,
integer, intent(in)  EmissionsMethod,
real(kind(1d0)), intent(in)  EnEF_v_Jkm,
integer, intent(in)  endDLS,
real(kind(1d0)), intent(in)  EveTreeH,
real(kind(1d0)), intent(in)  FAIBldg,
real(kind(1d0)), intent(in)  FAIDecTree,
real(kind(1d0)), intent(in)  FAIEveTree,
real(kind(1d0)), intent(in)  Faut,
real(kind(1d0)), dimension(2), intent(in)  FcEF_v_kgkm,
real(kind(1d0)), intent(in)  FlowChange,
real(kind(1d0)), intent(in)  FrFossilFuel_Heat,
real(kind(1d0)), intent(in)  FrFossilFuel_NonHeat,
real(kind(1d0)), intent(in)  G1,
real(kind(1d0)), intent(in)  G2,
real(kind(1d0)), intent(in)  G3,
real(kind(1d0)), intent(in)  G4,
real(kind(1d0)), intent(in)  G5,
real(kind(1d0)), intent(in)  G6,
real(kind(1d0)), dimension(nvegsurf), intent(inout)  GDD_id,
real(kind(1d0)), dimension(nvegsurf), intent(in)  GDDFull,
integer, intent(in)  Gridiv,
integer, intent(in)  gsModel,
real(kind(1d0)), intent(in)  H_maintain,
real(kind(1d0)), dimension(12), intent(inout)  HDD_id,
real(kind(1d0)), dimension(0:23, 2), intent(in)  HumActivity_24hr,
real(kind(1d0)), dimension(nsurf), intent(inout)  IceFrac,
real(kind(1d0)), dimension(3), intent(in)  Ie_a,
integer, intent(in)  Ie_end,
real(kind(1d0)), dimension(3), intent(in)  Ie_m,
integer, intent(in)  Ie_start,
real(kind(1d0)), intent(in)  InternalWaterUse_h,
real(kind(1d0)), intent(in)  IrrFracPaved,
real(kind(1d0)), intent(in)  IrrFracBldgs,
real(kind(1d0)), intent(in)  IrrFracEveTr,
real(kind(1d0)), intent(in)  IrrFracDecTr,
real(kind(1d0)), intent(in)  IrrFracGrass,
real(kind(1d0)), intent(in)  IrrFracBSoil,
real(kind(1d0)), intent(in)  IrrFracWater,
integer, intent(in)  EvapMethod,
real(kind(1d0)), dimension(nsurf), intent(in)  kkAnOHM,
real(kind(1d0)), intent(in)  Kmax,
real(kind(1d0)), dimension(nvegsurf), intent(inout)  LAI_id,
integer, intent(in)  LAICalcYes,
real(kind(1d0)), dimension(nvegsurf), intent(in)  LAIMax,
real(kind(1d0)), dimension(nvegsurf), intent(in)  LAIMin,
real(kind(1d0)), dimension(4, nvegsurf), intent(in)  LAIPower,
integer, dimension(nvegsurf), intent(in)  LAIType,
real(kind(1d0)), intent(in)  lat,
real(kind(1d0)), intent(in)  lng,
real(kind(1d0)), dimension(3), intent(in)  MaxConductance,
real(kind(1d0)), intent(in)  MaxFCMetab,
real(kind(1d0)), intent(in)  MaxQFMetab,
real(kind(1d0)), dimension(nsurf), intent(inout)  SnowWater,
real(kind(1d0)), intent(in)  MinFCMetab,
real(kind(1d0)), intent(in)  MinQFMetab,
real(kind(1d0)), dimension(nvegsurf), intent(in)  min_res_bioCO2,
real(kind(1d0)), intent(in)  NARP_EMIS_SNOW,
real(kind(1d0)), intent(in)  NARP_TRANS_SITE,
integer, intent(in)  NetRadiationMethod,
real(kind(1d0)), dimension(nsurf + 1, 4, 3), intent(in)  OHM_coef,
integer, intent(in)  OHMIncQF,
real(kind(1d0)), dimension(nsurf + 1), intent(in)  OHM_threshSW,
real(kind(1d0)), dimension(nsurf + 1), intent(in)  OHM_threshWD,
real(kind(1d0)), intent(in)  PipeCapacity,
real(kind(1d0)), dimension(2), intent(in)  PopDensDaytime,
real(kind(1d0)), intent(in)  PopDensNighttime,
real(kind(1d0)), dimension(0:23, 2), intent(in)  PopProf_24hr,
real(kind(1d0)), intent(in)  PorMax_dec,
real(kind(1d0)), intent(in)  PorMin_dec,
real(kind(1d0)), intent(in)  PrecipLimit,
real(kind(1d0)), intent(in)  PrecipLimitAlb,
real(kind(1d0)), dimension(2), intent(in)  QF0_BEU,
real(kind(1d0)), dimension(2), intent(in)  Qf_A,
real(kind(1d0)), dimension(2), intent(in)  Qf_B,
real(kind(1d0)), dimension(2), intent(in)  Qf_C,
real(kind(1d0)), intent(in)  RadMeltFact,
real(kind(1d0)), intent(in)  RAINCOVER,
real(kind(1d0)), intent(in)  RainMaxRes,
real(kind(1d0)), dimension(nvegsurf), intent(in)  resp_a,
real(kind(1d0)), dimension(nvegsurf), intent(in)  resp_b,
integer, intent(in)  RoughLenHeatMethod,
integer, intent(in)  RoughLenMomMethod,
real(kind(1d0)), intent(in)  RunoffToWater,
real(kind(1d0)), intent(in)  S1,
real(kind(1d0)), intent(in)  S2,
real(kind(1d0)), dimension(nsurf), intent(in)  SatHydraulicConduct,
real(kind(1d0)), dimension(nvegsurf), intent(in)  SDDFull,
real(kind(1d0)), dimension(nvegsurf), intent(inout)  SDD_id,
real(kind(1d0)), dimension(nsurf), intent(in)  sfr,
integer, intent(in)  SMDMethod,
real(kind(1d0)), intent(inout)  SnowAlb,
real(kind(1d0)), intent(in)  SnowAlbMax,
real(kind(1d0)), intent(in)  SnowAlbMin,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowPackLimit,
real(kind(1d0)), dimension(nsurf), intent(inout)  SnowDens,
real(kind(1d0)), intent(in)  SnowDensMax,
real(kind(1d0)), intent(in)  SnowDensMin,
real(kind(1d0)), intent(inout)  SnowfallCum,
real(kind(1d0)), dimension(nsurf), intent(inout)  SnowFrac,
real(kind(1d0)), intent(in)  SnowLimBldg,
real(kind(1d0)), intent(in)  SnowLimPaved,
real(kind(1d0)), dimension(nsurf), intent(inout)  SnowPack,
real(kind(1d0)), dimension(0:23, 2), intent(in)  SnowProf_24hr,
integer, intent(in)  snowUse,
real(kind(1d0)), dimension(nsurf), intent(in)  SoilDepth,
real(kind(1d0)), dimension(nsurf), intent(inout)  soilstore_id,
real(kind(1d0)), dimension(nsurf), intent(in)  SoilStoreCap,
integer, intent(in)  StabilityMethod,
integer, intent(in)  startDLS,
real(kind(1d0)), dimension(nsurf), intent(inout)  state_id,
real(kind(1d0)), dimension(nsurf), intent(in)  StateLimit,
integer, intent(in)  StorageHeatMethod,
real(kind(1d0)), dimension(6, nsurf), intent(inout)  StoreDrainPrm,
real(kind(1d0)), intent(in)  SurfaceArea,
real(kind(1d0)), intent(inout)  Tair_av,
real(kind(1d0)), intent(in)  tau_a,
real(kind(1d0)), intent(in)  tau_f,
real(kind(1d0)), intent(in)  tau_r,
real(kind(1d0)), dimension(2), intent(in)  BaseT_Cooling,
real(kind(1d0)), dimension(2), intent(in)  BaseT_Heating,
real(kind(1d0)), intent(in)  TempMeltFact,
real(kind(1d0)), intent(in)  TH,
real(kind(1d0)), dimension(nvegsurf), intent(in)  theta_bioCO2,
real(kind(1d0)), intent(in)  timezone,
real(kind(1d0)), intent(in)  TL,
real(kind(1d0)), dimension(2), intent(in)  TrafficRate,
real(kind(1d0)), intent(in)  TrafficUnits,
real(kind(1d0)), intent(inout)  Tmin_id,
real(kind(1d0)), intent(inout)  Tmax_id,
real(kind(1d0)), intent(inout)  lenday_id,
real(kind(1d0)), dimension(0:23, 2), intent(in)  TraffProf_24hr,
real(kind(1d0)), dimension(:), intent(in)  Ts5mindata_ir,
integer, intent(in)  tstep,
integer, intent(in)  tstep_prev,
integer, intent(in)  veg_type,
real(kind(1d0)), dimension(nsurf + 1, nsurf - 1), intent(in)  WaterDist,
integer, intent(in)  WaterUseMethod,
real(kind(1d0)), dimension(nsurf), intent(in)  WetThresh,
real(kind(1d0)), dimension(9), intent(inout)  WUDay_id,
real(kind(1d0)), intent(inout)  DecidCap_id,
real(kind(1d0)), intent(inout)  albDecTr_id,
real(kind(1d0)), intent(inout)  albEveTr_id,
real(kind(1d0)), intent(inout)  albGrass_id,
real(kind(1d0)), intent(inout)  porosity_id,
real(kind(1d0)), dimension(0:23, 2), intent(in)  WUProfA_24hr,
real(kind(1d0)), dimension(0:23, 2), intent(in)  WUProfM_24hr,
real(kind(1d0)), intent(in)  Z,
real(kind(1d0)), intent(in)  z0m_in,
real(kind(1d0)), intent(in)  zdm_in,
real(kind(1d0)), dimension(len_sim, ncolumnsdataoutsuews), intent(out)  dataOutBlockSUEWS,
real(kind(1d0)), dimension(len_sim, ncolumnsdataoutsnow), intent(out)  dataOutBlockSnow,
real(kind(1d0)), dimension(len_sim, ncolumnsdataoutestm), intent(out)  dataOutBlockESTM,
real(kind(1d0)), dimension(len_sim, ncolumnsdataoutrsl), intent(out)  dataOutBlockRSL,
real(kind(1d0)), dimension(len_sim, ncolumnsdataoutsol), intent(out)  dataOutBlockSOL,
real(kind(1d0)), dimension(len_sim, ncolumnsdataoutdailystate), intent(out)  DailyStateBlock 
)

Definition at line 2885 of file suews_ctrl_driver.f95.

References suews_cal_main(), and suews_update_output().

2885 
2886  IMPLICIT NONE
2887  ! input:
2888  ! met forcing block
2889  REAL(KIND(1D0)), DIMENSION(len_sim, 24), INTENT(IN) ::metforcingblock
2890  INTEGER, INTENT(IN) :: len_sim
2891  ! input variables
2892  INTEGER, INTENT(IN)::aerodynamicresistancemethod
2893  INTEGER, INTENT(IN)::basetmethod
2894  INTEGER, INTENT(IN)::diagnose
2895  INTEGER, INTENT(IN)::diagqn
2896  INTEGER, INTENT(IN)::diagqs
2897  INTEGER, INTENT(IN)::startdls
2898  INTEGER, INTENT(IN)::enddls
2899  INTEGER, INTENT(IN)::emissionsmethod
2900  INTEGER, INTENT(IN)::gridiv
2901  INTEGER, INTENT(IN)::gsmodel
2902  INTEGER, INTENT(IN)::ie_end
2903  INTEGER, INTENT(IN)::ie_start
2904  INTEGER, INTENT(IN)::evapmethod
2905  INTEGER, INTENT(IN)::laicalcyes
2906  INTEGER, INTENT(IN)::netradiationmethod
2907  INTEGER, INTENT(IN)::ohmincqf
2908  INTEGER, INTENT(IN)::roughlenheatmethod
2909  INTEGER, INTENT(IN)::roughlenmommethod
2910  INTEGER, INTENT(IN)::smdmethod
2911  INTEGER, INTENT(IN)::snowuse
2912  INTEGER, INTENT(IN)::stabilitymethod
2913  INTEGER, INTENT(IN)::storageheatmethod
2914  INTEGER, INTENT(IN)::tstep
2915  INTEGER, INTENT(IN)::tstep_prev ! tstep size of the previous step
2916  ! dt_since_start is intentionally made as inout to keep naming consistency with the embedded subroutine
2917  INTEGER, INTENT(inout)::dt_since_start ! time since simulation starts [s]
2918  INTEGER, INTENT(IN)::veg_type
2919  INTEGER, INTENT(IN)::waterusemethod
2920 
2921  INTEGER, DIMENSION(NVEGSURF), INTENT(IN)::laitype
2922 
2923  REAL(KIND(1D0)), INTENT(IN)::albmax_dectr
2924  REAL(KIND(1D0)), INTENT(IN)::albmax_evetr
2925  REAL(KIND(1D0)), INTENT(IN)::albmax_grass
2926  REAL(KIND(1D0)), INTENT(IN)::albmin_dectr
2927  REAL(KIND(1D0)), INTENT(IN)::albmin_evetr
2928  REAL(KIND(1D0)), INTENT(IN)::albmin_grass
2929  REAL(KIND(1D0)), INTENT(IN)::alt
2930  ! REAL(KIND(1D0)),INTENT(IN)::avkdn
2931  ! REAL(KIND(1D0)),INTENT(IN)::avRh
2932  ! REAL(KIND(1D0)),INTENT(IN)::avU1
2933  REAL(KIND(1D0)), INTENT(IN)::baset_hc
2934  REAL(KIND(1D0)), INTENT(IN)::bldgh
2935  REAL(KIND(1D0)), INTENT(IN)::capmax_dec
2936  REAL(KIND(1D0)), INTENT(IN)::capmin_dec
2937  REAL(KIND(1D0)), INTENT(IN)::co2pointsource
2938  REAL(KIND(1D0)), INTENT(IN)::crwmax
2939  REAL(KIND(1D0)), INTENT(IN)::crwmin
2940  REAL(KIND(1D0)), INTENT(IN)::dectreeh
2941  REAL(KIND(1D0)), INTENT(IN)::drainrt
2942  REAL(KIND(1D0)), INTENT(IN)::ef_umolco2perj
2943  REAL(KIND(1D0)), INTENT(IN)::enef_v_jkm
2944  REAL(KIND(1D0)), INTENT(IN)::evetreeh
2945  REAL(KIND(1D0)), INTENT(IN)::faibldg
2946  REAL(KIND(1D0)), INTENT(IN)::faidectree
2947  REAL(KIND(1D0)), INTENT(IN)::faievetree
2948  REAL(KIND(1D0)), INTENT(IN)::faut
2949  ! REAL(KIND(1D0)),INTENT(IN)::fcld_obs
2950  REAL(KIND(1D0)), INTENT(IN)::flowchange
2951  REAL(KIND(1D0)), INTENT(IN)::frfossilfuel_heat
2952  REAL(KIND(1D0)), INTENT(IN)::frfossilfuel_nonheat
2953  REAL(KIND(1D0)), INTENT(IN)::g1
2954  REAL(KIND(1D0)), INTENT(IN)::g2
2955  REAL(KIND(1D0)), INTENT(IN)::g3
2956  REAL(KIND(1D0)), INTENT(IN)::g4
2957  REAL(KIND(1D0)), INTENT(IN)::g5
2958  REAL(KIND(1D0)), INTENT(IN)::g6
2959  REAL(KIND(1D0)), INTENT(IN)::h_maintain
2960  REAL(KIND(1D0)), INTENT(IN)::internalwateruse_h
2961  REAL(KIND(1D0)), INTENT(IN)::irrfracpaved
2962  REAL(KIND(1D0)), INTENT(IN)::irrfracbldgs
2963  REAL(KIND(1D0)), INTENT(IN)::irrfracevetr
2964  REAL(KIND(1D0)), INTENT(IN)::irrfracdectr
2965  REAL(KIND(1D0)), INTENT(IN)::irrfracgrass
2966  REAL(KIND(1D0)), INTENT(IN)::irrfracbsoil
2967  REAL(KIND(1D0)), INTENT(IN)::irrfracwater
2968  REAL(KIND(1D0)), INTENT(IN)::kmax
2969  ! REAL(KIND(1D0)),INTENT(IN)::LAI_obs
2970  REAL(KIND(1D0)), INTENT(IN)::lat
2971  ! REAL(KIND(1D0)),INTENT(IN)::ldown_obs
2972  REAL(KIND(1D0)), INTENT(IN)::lng
2973  REAL(KIND(1D0)), INTENT(IN)::maxfcmetab
2974  REAL(KIND(1D0)), INTENT(IN)::maxqfmetab
2975  REAL(KIND(1D0)), INTENT(IN)::minfcmetab
2976  REAL(KIND(1D0)), INTENT(IN)::minqfmetab
2977  REAL(KIND(1D0)), INTENT(IN)::narp_emis_snow
2978  REAL(KIND(1D0)), INTENT(IN)::narp_trans_site
2979  REAL(KIND(1D0)), INTENT(IN)::pipecapacity
2980  REAL(KIND(1D0)), INTENT(IN)::popdensnighttime
2981  REAL(KIND(1D0)), INTENT(IN)::pormax_dec
2982  REAL(KIND(1D0)), INTENT(IN)::pormin_dec
2983  ! REAL(KIND(1D0)),INTENT(IN)::Precip
2984  REAL(KIND(1D0)), INTENT(IN)::preciplimit
2985  REAL(KIND(1D0)), INTENT(IN)::preciplimitalb
2986  ! REAL(KIND(1D0)),INTENT(IN)::Press_hPa
2987  ! REAL(KIND(1D0)),INTENT(IN)::qh_obs
2988  ! REAL(KIND(1D0)),INTENT(IN)::qn1_obs
2989  ! REAL(KIND(1D0)),INTENT(IN)::qs_obs
2990  ! REAL(KIND(1D0)),INTENT(IN)::qf_obs
2991  REAL(KIND(1D0)), INTENT(IN)::radmeltfact
2992  REAL(KIND(1D0)), INTENT(IN)::raincover
2993  REAL(KIND(1D0)), INTENT(IN)::rainmaxres
2994  REAL(KIND(1D0)), INTENT(IN)::runofftowater
2995  REAL(KIND(1D0)), INTENT(IN)::s1
2996  REAL(KIND(1D0)), INTENT(IN)::s2
2997  REAL(KIND(1D0)), INTENT(IN)::snowalbmax
2998  REAL(KIND(1D0)), INTENT(IN)::snowalbmin
2999  REAL(KIND(1D0)), INTENT(IN)::snowdensmax
3000  REAL(KIND(1D0)), INTENT(IN)::snowdensmin
3001  REAL(KIND(1D0)), INTENT(IN)::snowlimbldg
3002  REAL(KIND(1D0)), INTENT(IN)::snowlimpaved
3003  ! REAL(KIND(1D0)),INTENT(IN)::snowFrac_obs
3004  REAL(KIND(1D0)), INTENT(IN)::surfacearea
3005  REAL(KIND(1D0)), INTENT(IN)::tau_a
3006  REAL(KIND(1D0)), INTENT(IN)::tau_f
3007  REAL(KIND(1D0)), INTENT(IN)::tau_r
3008  ! REAL(KIND(1D0)),INTENT(IN)::Temp_C
3009  REAL(KIND(1D0)), INTENT(IN)::tempmeltfact
3010  REAL(KIND(1D0)), INTENT(IN)::th
3011  REAL(KIND(1D0)), INTENT(IN)::timezone
3012  REAL(KIND(1D0)), INTENT(IN)::tl
3013  REAL(KIND(1D0)), INTENT(IN)::trafficunits
3014  ! REAL(KIND(1D0)),INTENT(IN)::xsmd
3015  REAL(KIND(1D0)), INTENT(IN)::z
3016  REAL(KIND(1D0)), INTENT(IN)::z0m_in
3017  REAL(KIND(1D0)), INTENT(IN)::zdm_in
3018 
3019  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::ah_min
3020  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::ah_slope_cooling
3021  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::ah_slope_heating
3022  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::fcef_v_kgkm
3023  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::qf0_beu
3024  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::qf_a
3025  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::qf_b
3026  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::qf_c
3027  ! REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::Numcapita
3028  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::popdensdaytime
3029  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::baset_cooling
3030  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::baset_heating
3031  REAL(KIND(1D0)), DIMENSION(2), INTENT(IN) ::trafficrate
3032  REAL(KIND(1D0)), DIMENSION(3), INTENT(IN) ::ie_a
3033  REAL(KIND(1D0)), DIMENSION(3), INTENT(IN) ::ie_m
3034  REAL(KIND(1D0)), DIMENSION(3), INTENT(IN) ::maxconductance
3035  REAL(KIND(1D0)), DIMENSION(7), INTENT(IN) ::daywat
3036  REAL(KIND(1D0)), DIMENSION(7), INTENT(IN) ::daywatper
3037  REAL(KIND(1D0)), DIMENSION(nsurf + 1), INTENT(IN)::ohm_threshsw
3038  REAL(KIND(1D0)), DIMENSION(nsurf + 1), INTENT(IN)::ohm_threshwd
3039  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::chanohm
3040  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::cpanohm
3041  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::emis
3042  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::kkanohm
3043  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::sathydraulicconduct
3044  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::sfr
3045  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::snowpacklimit
3046  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::soildepth
3047  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::soilstorecap
3048  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::statelimit
3049  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN) ::wetthresh
3050  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::alpha_bioco2
3051  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::alpha_enh_bioco2
3052  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::baset
3053  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::basete
3054  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::beta_bioco2
3055  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::beta_enh_bioco2
3056  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::gddfull
3057  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::laimax
3058  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::laimin
3059  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::min_res_bioco2
3060  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::resp_a
3061  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::resp_b
3062  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::sddfull
3063  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::snowprof_24hr
3064  REAL(KIND(1D0)), DIMENSION(NVEGSURF), INTENT(IN) ::theta_bioco2
3065  REAL(KIND(1D0)), DIMENSION(4, NVEGSURF), INTENT(IN) ::laipower
3066  REAL(KIND(1D0)), DIMENSION(nsurf + 1, 4, 3), INTENT(IN) ::ohm_coef
3067  REAL(KIND(1D0)), DIMENSION(NSURF + 1, NSURF - 1), INTENT(IN) ::waterdist
3068  REAL(KIND(1d0)), DIMENSION(:), INTENT(IN) ::ts5mindata_ir
3069 
3070  ! diurnal profile values for 24hr
3071  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::ahprof_24hr
3072  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::humactivity_24hr
3073  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::popprof_24hr
3074  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::traffprof_24hr
3075  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::wuprofa_24hr
3076  REAL(KIND(1D0)), DIMENSION(0:23, 2), INTENT(IN) ::wuprofm_24hr
3077  ! ########################################################################################
3078 
3079  ! ########################################################################################
3080  ! inout variables
3081  ! OHM related:
3082  REAL(KIND(1d0)), INTENT(INOUT) ::qn1_av
3083  REAL(KIND(1d0)), INTENT(INOUT) ::dqndt
3084  REAL(KIND(1d0)), INTENT(INOUT) ::qn1_s_av
3085  REAL(KIND(1d0)), INTENT(INOUT) ::dqnsdt
3086 
3087  ! snow related:
3088  REAL(KIND(1D0)), INTENT(INOUT) ::snowfallcum
3089  REAL(KIND(1D0)), INTENT(INOUT) ::snowalb
3090  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::icefrac
3091  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::snowwater
3092  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::snowdens
3093  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::snowfrac
3094  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::snowpack
3095 
3096  ! water balance related:
3097  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::soilstore_id
3098  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::state_id
3099  REAL(KIND(1D0)), DIMENSION(6, NSURF), INTENT(INOUT) ::storedrainprm
3100 
3101  ! phenology related:
3102  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(INOUT) ::alb
3103  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(INOUT) ::gdd_id !Growing Degree Days (see SUEWS_DailyState.f95)
3104  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(INOUT) ::sdd_id !Senescence Degree Days (see SUEWS_DailyState.f95)
3105  REAL(KIND(1d0)), DIMENSION(nvegsurf), INTENT(INOUT)::lai_id !LAI for each veg surface [m2 m-2]
3106  REAL(KIND(1d0)), INTENT(INOUT) :: decidcap_id
3107  REAL(KIND(1d0)), INTENT(INOUT) :: albdectr_id
3108  REAL(KIND(1d0)), INTENT(INOUT) :: albevetr_id
3109  REAL(KIND(1d0)), INTENT(INOUT) :: albgrass_id
3110  REAL(KIND(1d0)), INTENT(INOUT) :: porosity_id
3111  REAL(KIND(1d0)), INTENT(INOUT) :: tmin_id
3112  REAL(KIND(1d0)), INTENT(INOUT) :: tmax_id
3113  REAL(KIND(1d0)), INTENT(INOUT) :: lenday_id
3114 
3115  ! anthropogenic heat related:
3116  REAL(KIND(1d0)), DIMENSION(12), INTENT(INOUT) ::hdd_id !Heating Degree Days (see SUEWS_DailyState.f95)
3117 
3118  ! water use related:
3119  REAL(KIND(1d0)), DIMENSION(9), INTENT(INOUT) ::wuday_id
3120 
3121  ! ESTM related:
3122  REAL(KIND(1d0)), INTENT(INOUT) ::tair_av
3123  ! ########################################################################################
3124 
3125  ! ########################################################################################
3126  ! output variables
3127  ! REAL(KIND(1D0)),DIMENSION(:,:,:),ALLOCATABLE,INTENT(OUT) ::datetimeBlock
3128  REAL(KIND(1D0)), DIMENSION(len_sim, ncolumnsDataOutSUEWS), INTENT(OUT) ::dataoutblocksuews
3129  REAL(KIND(1D0)), DIMENSION(len_sim, ncolumnsDataOutSnow), INTENT(OUT) ::dataoutblocksnow
3130  REAL(KIND(1d0)), DIMENSION(len_sim, ncolumnsDataOutESTM), INTENT(OUT) ::dataoutblockestm
3131  REAL(KIND(1d0)), DIMENSION(len_sim, ncolumnsDataOutRSL), INTENT(OUT) ::dataoutblockrsl
3132  REAL(KIND(1d0)), DIMENSION(len_sim, ncolumnsdataOutSOL), INTENT(OUT) ::dataoutblocksol
3133  REAL(KIND(1d0)), DIMENSION(len_sim, ncolumnsDataOutDailyState), INTENT(OUT) ::dailystateblock
3134  ! ########################################################################################
3135 
3136  ! internal temporal iteration related variables
3137  ! INTEGER::dt_since_start ! time since simulation starts [s]
3138 
3139  ! model output blocks of the same size as met forcing block
3140 
3141  ! local variables
3142  ! length of met forcing block
3143  INTEGER :: ir
3144  ! met forcing variables
3145  INTEGER :: iy
3146  INTEGER :: id
3147  INTEGER :: it
3148  INTEGER :: imin
3149  INTEGER :: isec
3150  INTEGER, PARAMETER :: gridiv_x = 1 ! a dummy gridiv as this routine is only one grid
3151  REAL(KIND(1D0))::qn1_obs
3152  REAL(KIND(1D0))::qh_obs
3153  REAL(KIND(1D0))::qe_obs
3154  REAL(KIND(1D0))::qs_obs
3155  REAL(KIND(1D0))::qf_obs
3156  REAL(KIND(1D0))::avu1
3157  REAL(KIND(1D0))::avrh
3158  REAL(KIND(1D0))::temp_c
3159  REAL(KIND(1D0))::press_hpa
3160  REAL(KIND(1D0))::precip
3161  REAL(KIND(1D0))::avkdn
3162  REAL(KIND(1D0))::snowfrac_obs
3163  REAL(KIND(1D0))::ldown_obs
3164  REAL(KIND(1D0))::fcld_obs
3165  REAL(KIND(1D0))::wu_m3
3166  REAL(KIND(1D0))::xsmd
3167  REAL(KIND(1D0))::lai_obs
3168  REAL(KIND(1D0))::kdiff
3169  REAL(KIND(1D0))::kdir
3170  REAL(KIND(1D0))::wdir
3171 
3172  REAL(KIND(1D0)), DIMENSION(5)::datetimeline
3173  REAL(KIND(1D0)), DIMENSION(ncolumnsDataOutSUEWS - 5)::dataoutlinesuews
3174  REAL(KIND(1D0)), DIMENSION(ncolumnsDataOutSnow - 5)::dataoutlinesnow
3175  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutESTM - 5)::dataoutlineestm
3176  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutRSL - 5)::dataoutlinersl
3177  REAL(KIND(1D0)), DIMENSION(ncolumnsDataOutSol - 5) ::dataoutlinesolweig
3178  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutDailyState - 5)::dailystateline
3179 
3180  REAL(KIND(1D0)), DIMENSION(len_sim, ncolumnsDataOutSUEWS, 1) ::dataoutblocksuews_x
3181  REAL(KIND(1D0)), DIMENSION(len_sim, ncolumnsDataOutSnow, 1) ::dataoutblocksnow_x
3182  REAL(KIND(1d0)), DIMENSION(len_sim, ncolumnsDataOutESTM, 1) ::dataoutblockestm_x
3183  REAL(KIND(1d0)), DIMENSION(len_sim, ncolumnsDataOutRSL, 1) ::dataoutblockrsl_x
3184  REAL(KIND(1d0)), DIMENSION(len_sim, ncolumnsDataOutSOL, 1) ::dataoutblocksol_x
3185  ! REAL(KIND(1d0)),DIMENSION(len_sim,ncolumnsDataOutDailyState,1) ::DailyStateBlock_X
3186 
3187  REAL(KIND(1D0)), DIMENSION(10, 10) ::metforcingdata_grid ! fake array as a placeholder
3188 
3189  ! CHARACTER(len=150):: FileStateInit
3190  ! CHARACTER(len=4):: year_txt
3191  ! CHARACTER(len=3):: id_text
3192  ! CHARACTER(len=2):: it_text, imin_text
3193 
3194  ! get initial dt_since_start_x from dt_since_start, dt_since_start_x is used for Qn averaging. TS 28 Nov 2018
3195  ! dt_since_start = dt_since_start
3196 
3197  DO ir = 1, len_sim, 1
3198  ! =============================================================================
3199  ! === Translate met data from MetForcingBlock to variable names used in model ==
3200  ! =============================================================================
3201  iy = int(metforcingblock(ir, 1)) !Integer variables
3202  id = int(metforcingblock(ir, 2))
3203  it = int(metforcingblock(ir, 3))
3204  imin = int(metforcingblock(ir, 4))
3205  isec = 0 ! NOT used by SUEWS but by WRF-SUEWS via the cal_main interface
3206  qn1_obs = metforcingblock(ir, 5) !Real values (kind(1d0))
3207  qh_obs = metforcingblock(ir, 6)
3208  qe_obs = metforcingblock(ir, 7)
3209  qs_obs = metforcingblock(ir, 8)
3210  qf_obs = metforcingblock(ir, 9)
3211  avu1 = metforcingblock(ir, 10)
3212  avrh = metforcingblock(ir, 11)
3213  temp_c = metforcingblock(ir, 12)
3214  press_hpa = metforcingblock(ir, 13)
3215  precip = metforcingblock(ir, 14)
3216  avkdn = metforcingblock(ir, 15)
3217  snowfrac_obs = metforcingblock(ir, 16)
3218  ldown_obs = metforcingblock(ir, 17)
3219  fcld_obs = metforcingblock(ir, 18)
3220  wu_m3 = metforcingblock(ir, 19)
3221  xsmd = metforcingblock(ir, 20)
3222  lai_obs = metforcingblock(ir, 21)
3223  kdiff = metforcingblock(ir, 22)
3224  kdir = metforcingblock(ir, 23)
3225  wdir = metforcingblock(ir, 24)
3226 
3227  ! !================================================
3228  ! ! below is for debugging
3229  ! WRITE (year_txt, '(I4)') INT(iy)
3230  ! WRITE (id_text, '(I3)') INT(id)
3231  ! WRITE (it_text, '(I4)') INT(it)
3232  ! WRITE (imin_text, '(I4)') INT(imin)
3233 
3234  ! FileStateInit = './'//TRIM(ADJUSTL(year_txt))//'_'&
3235  ! //TRIM(ADJUSTL(id_text))//'_'&
3236  ! //TRIM(ADJUSTL(it_text))//'_'&
3237  ! //TRIM(ADJUSTL(imin_text))//'_'&
3238  ! //'state_init.nml'
3239 
3240  ! OPEN (12, file=FileStateInit, position='rewind')
3241 
3242  ! write (12, *) '&state_init'
3243  ! write (12, *) 'aerodynamicresistancemethod=', aerodynamicresistancemethod
3244  ! write (12, *) 'ah_min=', ah_min
3245  ! write (12, *) 'ahprof_24hr=', ahprof_24hr
3246  ! write (12, *) 'ah_slope_cooling=', ah_slope_cooling
3247  ! write (12, *) 'ah_slope_heating=', ah_slope_heating
3248  ! write (12, *) 'alb=', alb
3249  ! write (12, *) 'albmax_dectr=', albmax_dectr
3250  ! write (12, *) 'albmax_evetr=', albmax_evetr
3251  ! write (12, *) 'albmax_grass=', albmax_grass
3252  ! write (12, *) 'albmin_dectr=', albmin_dectr
3253  ! write (12, *) 'albmin_evetr=', albmin_evetr
3254  ! write (12, *) 'albmin_grass=', albmin_grass
3255  ! write (12, *) 'alpha_bioco2=', alpha_bioco2
3256  ! write (12, *) 'alpha_enh_bioco2=', alpha_enh_bioco2
3257  ! write (12, *) 'alt=', alt
3258  ! write (12, *) 'avkdn=', avkdn
3259  ! write (12, *) 'avrh=', avrh
3260  ! write (12, *) 'avu1=', avu1
3261  ! write (12, *) 'baset=', baset
3262  ! write (12, *) 'basete=', basete
3263  ! write (12, *) 'BaseT_HC=', BaseT_HC
3264  ! write (12, *) 'beta_bioco2=', beta_bioco2
3265  ! write (12, *) 'beta_enh_bioco2=', beta_enh_bioco2
3266  ! write (12, *) 'bldgh=', bldgh
3267  ! write (12, *) 'capmax_dec=', capmax_dec
3268  ! write (12, *) 'capmin_dec=', capmin_dec
3269  ! write (12, *) 'chanohm=', chanohm
3270  ! write (12, *) 'co2pointsource=', co2pointsource
3271  ! write (12, *) 'cpanohm=', cpanohm
3272  ! write (12, *) 'crwmax=', crwmax
3273  ! write (12, *) 'crwmin=', crwmin
3274  ! write (12, *) 'daywat=', daywat
3275  ! write (12, *) 'daywatper=', daywatper
3276  ! write (12, *) 'dectreeh=', dectreeh
3277  ! write (12, *) 'diagnose=', diagnose
3278  ! write (12, *) 'diagqn=', diagqn
3279  ! write (12, *) 'diagqs=', diagqs
3280  ! write (12, *) 'drainrt=', drainrt
3281  ! write (12, *) 'dt_since_start=', dt_since_start
3282  ! write (12, *) 'dqndt=', dqndt
3283  ! write (12, *) 'qn1_av=', qn1_av
3284  ! write (12, *) 'dqnsdt=', dqnsdt
3285  ! write (12, *) 'qn1_s_av=', qn1_s_av
3286  ! write (12, *) 'ef_umolco2perj=', ef_umolco2perj
3287  ! write (12, *) 'emis=', emis
3288  ! write (12, *) 'emissionsmethod=', emissionsmethod
3289  ! write (12, *) 'enef_v_jkm=', enef_v_jkm
3290  ! write (12, *) 'enddls=', enddls
3291  ! write (12, *) 'evetreeh=', evetreeh
3292  ! write (12, *) 'faibldg=', faibldg
3293  ! write (12, *) 'faidectree=', faidectree
3294  ! write (12, *) 'faievetree=', faievetree
3295  ! write (12, *) 'faut=', faut
3296  ! write (12, *) 'fcef_v_kgkm=', fcef_v_kgkm
3297  ! write (12, *) 'fcld_obs=', fcld_obs
3298  ! write (12, *) 'flowchange=', flowchange
3299  ! write (12, *) 'frfossilfuel_heat=', frfossilfuel_heat
3300  ! write (12, *) 'frfossilfuel_nonheat=', frfossilfuel_nonheat
3301  ! write (12, *) 'g1=', g1
3302  ! write (12, *) 'g2=', g2
3303  ! write (12, *) 'g3=', g3
3304  ! write (12, *) 'g4=', g4
3305  ! write (12, *) 'g5=', g5
3306  ! write (12, *) 'g6=', g6
3307  ! write (12, *) 'gdd_id=', gdd_id
3308  ! write (12, *) 'gddfull=', gddfull
3309  ! write (12, *) 'gridiv=', gridiv
3310  ! write (12, *) 'gsmodel=', gsmodel
3311  ! write (12, *) 'hdd_id=', hdd_id
3312  ! write (12, *) 'humactivity_24hr=', humactivity_24hr
3313  ! write (12, *) 'icefrac=', icefrac
3314  ! write (12, *) 'id=', id
3315  ! write (12, *) 'ie_a=', ie_a
3316  ! write (12, *) 'ie_end=', ie_end
3317  ! write (12, *) 'ie_m=', ie_m
3318  ! write (12, *) 'ie_start=', ie_start
3319  ! write (12, *) 'imin=', imin
3320  ! write (12, *) 'internalwateruse_h=', internalwateruse_h
3321  ! write (12, *) 'IrrFracEveTr=', IrrFracEveTr
3322  ! write (12, *) 'IrrFracDecTr=', IrrFracDecTr
3323  ! write (12, *) 'irrfracgrass=', irrfracgrass
3324  ! write (12, *) 'isec=', isec
3325  ! write (12, *) 'it=', it
3326  ! write (12, *) 'evapmethod=', evapmethod
3327  ! write (12, *) 'iy=', iy
3328  ! write (12, *) 'kkanohm=', kkanohm
3329  ! write (12, *) 'kmax=', kmax
3330  ! write (12, *) 'lai_id=', lai_id
3331  ! write (12, *) 'laicalcyes=', laicalcyes
3332  ! write (12, *) 'laimax=', laimax
3333  ! write (12, *) 'laimin=', laimin
3334  ! write (12, *) 'lai_obs=', lai_obs
3335  ! write (12, *) 'laipower=', laipower
3336  ! write (12, *) 'laitype=', laitype
3337  ! write (12, *) 'lat=', lat
3338  ! write (12, *) 'lenday_id=', lenday_id
3339  ! write (12, *) 'ldown_obs=', ldown_obs
3340  ! write (12, *) 'lng=', lng
3341  ! write (12, *) 'maxconductance=', maxconductance
3342  ! write (12, *) 'maxfcmetab=', maxfcmetab
3343  ! write (12, *) 'maxqfmetab=', maxqfmetab
3344  ! write (12, *) 'snowwater=', snowwater
3345  ! ! write (12, *) 'metforcingdata_grid=', metforcingdata_grid
3346  ! write (12, *) 'minfcmetab=', minfcmetab
3347  ! write (12, *) 'minqfmetab=', minqfmetab
3348  ! write (12, *) 'min_res_bioco2=', min_res_bioco2
3349  ! write (12, *) 'narp_emis_snow=', narp_emis_snow
3350  ! write (12, *) 'narp_trans_site=', narp_trans_site
3351  ! write (12, *) 'netradiationmethod=', netradiationmethod
3352  ! write (12, *) 'ohm_coef=', ohm_coef
3353  ! write (12, *) 'ohmincqf=', ohmincqf
3354  ! write (12, *) 'ohm_threshsw=', ohm_threshsw
3355  ! write (12, *) 'ohm_threshwd=', ohm_threshwd
3356  ! write (12, *) 'pipecapacity=', pipecapacity
3357  ! write (12, *) 'popdensdaytime=', popdensdaytime
3358  ! write (12, *) 'popdensnighttime=', popdensnighttime
3359  ! write (12, *) 'popprof_24hr=', popprof_24hr
3360  ! write (12, *) 'pormax_dec=', pormax_dec
3361  ! write (12, *) 'pormin_dec=', pormin_dec
3362  ! write (12, *) 'precip=', precip
3363  ! write (12, *) 'preciplimit=', preciplimit
3364  ! write (12, *) 'preciplimitalb=', preciplimitalb
3365  ! write (12, *) 'press_hpa=', press_hpa
3366  ! write (12, *) 'qf0_beu=', qf0_beu
3367  ! write (12, *) 'qf_a=', qf_a
3368  ! write (12, *) 'qf_b=', qf_b
3369  ! write (12, *) 'qf_c=', qf_c
3370  ! write (12, *) 'qn1_obs=', qn1_obs
3371  ! write (12, *) 'qh_obs=', qh_obs
3372  ! write (12, *) 'qs_obs=', qs_obs
3373  ! write (12, *) 'qf_obs=', qf_obs
3374  ! write (12, *) 'radmeltfact=', radmeltfact
3375  ! write (12, *) 'raincover=', raincover
3376  ! write (12, *) 'rainmaxres=', rainmaxres
3377  ! write (12, *) 'resp_a=', resp_a
3378  ! write (12, *) 'resp_b=', resp_b
3379  ! write (12, *) 'roughlenheatmethod=', roughlenheatmethod
3380  ! write (12, *) 'roughlenmommethod=', roughlenmommethod
3381  ! write (12, *) 'runofftowater=', runofftowater
3382  ! write (12, *) 's1=', s1
3383  ! write (12, *) 's2=', s2
3384  ! write (12, *) 'sathydraulicconduct=', sathydraulicconduct
3385  ! write (12, *) 'sddfull=', sddfull
3386  ! write (12, *) 'sdd_id=', sdd_id
3387  ! write (12, *) 'sfr=', sfr
3388  ! write (12, *) 'smdmethod=', smdmethod
3389  ! write (12, *) 'snowalb=', snowalb
3390  ! write (12, *) 'snowalbmax=', snowalbmax
3391  ! write (12, *) 'snowalbmin=', snowalbmin
3392  ! write (12, *) 'snowpacklimit=', snowpacklimit
3393  ! write (12, *) 'snowdens=', snowdens
3394  ! write (12, *) 'snowdensmax=', snowdensmax
3395  ! write (12, *) 'snowdensmin=', snowdensmin
3396  ! write (12, *) 'snowfallcum=', snowfallcum
3397  ! write (12, *) 'snowfrac=', snowfrac
3398  ! write (12, *) 'snowlimbldg=', snowlimbldg
3399  ! write (12, *) 'snowlimpaved=', snowlimpaved
3400  ! write (12, *) 'snowfrac_obs=', snowfrac_obs
3401  ! write (12, *) 'snowpack=', snowpack
3402  ! write (12, *) 'snowprof_24hr=', snowprof_24hr
3403  ! write (12, *) 'snowuse=', snowuse
3404  ! write (12, *) 'soildepth=', soildepth
3405  ! write (12, *) 'soilstore_id=', soilstore_id
3406  ! write (12, *) 'soilstorecap=', soilstorecap
3407  ! write (12, *) 'stabilitymethod=', stabilitymethod
3408  ! write (12, *) 'startdls=', startdls
3409  ! write (12, *) 'state_id=', state_id
3410  ! write (12, *) 'statelimit=', statelimit
3411  ! write (12, *) 'storageheatmethod=', storageheatmethod
3412  ! write (12, *) 'storedrainprm=', storedrainprm
3413  ! write (12, *) 'surfacearea=', surfacearea
3414  ! write (12, *) 'tair_av=', tair_av
3415  ! write (12, *) 'tau_a=', tau_a
3416  ! write (12, *) 'tau_f=', tau_f
3417  ! write (12, *) 'tau_r=', tau_r
3418  ! write (12, *) 'tmax_id=', tmax_id
3419  ! write (12, *) 'tmin_id=', tmin_id
3420  ! write (12, *) 'BaseT_Cooling=', BaseT_Cooling
3421  ! write (12, *) 'BaseT_Heating=', BaseT_Heating
3422  ! write (12, *) 'temp_c=', temp_c
3423  ! write (12, *) 'tempmeltfact=', tempmeltfact
3424  ! write (12, *) 'th=', th
3425  ! write (12, *) 'theta_bioco2=', theta_bioco2
3426  ! write (12, *) 'timezone=', timezone
3427  ! write (12, *) 'tl=', tl
3428  ! write (12, *) 'trafficrate=', trafficrate
3429  ! write (12, *) 'trafficunits=', trafficunits
3430  ! write (12, *) 'traffprof_24hr=', traffprof_24hr
3431  ! ! write (12, *) 'ts5mindata_ir=', ts5mindata_ir
3432  ! write (12, *) 'tstep=', tstep
3433  ! write (12, *) 'tstep_prev=', tstep_prev
3434  ! write (12, *) 'veg_type=', veg_type
3435  ! write (12, *) 'waterdist=', waterdist
3436  ! write (12, *) 'waterusemethod=', waterusemethod
3437  ! write (12, *) 'wetthresh=', wetthresh
3438  ! write (12, *) 'wu_m3=', wu_m3
3439  ! write (12, *) 'wuday_id=', wuday_id
3440  ! write (12, *) 'decidcap_id=', decidcap_id
3441  ! write (12, *) 'albdectr_id=', albdectr_id
3442  ! write (12, *) 'albevetr_id=', albevetr_id
3443  ! write (12, *) 'albgrass_id=', albgrass_id
3444  ! write (12, *) 'porosity_id=', porosity_id
3445  ! write (12, *) 'wuprofa_24hr=', wuprofa_24hr
3446  ! write (12, *) 'wuprofm_24hr=', wuprofm_24hr
3447  ! write (12, *) 'xsmd=', xsmd
3448  ! write (12, *) 'z=', z
3449  ! write (12, *) 'z0m_in=', z0m_in
3450  ! write (12, *) 'zdm_in=', zdm_in
3451  ! write (12, *) '/'
3452 
3453  ! WRITE (12, *) ''
3454 
3455  ! CLOSE (12)
3456  ! !================================================
3457 
3458  CALL suews_cal_main( &
3459  aerodynamicresistancemethod, ah_min, ahprof_24hr, ah_slope_cooling, & ! input&inout in alphabetical order
3460  ah_slope_heating, &
3463  alpha_bioco2, alpha_enh_bioco2, alt, avkdn, avrh, avu1, baset, basete, &
3464  basetmethod, &
3466  chanohm, co2pointsource, cpanohm, crwmax, crwmin, daywat, daywatper, &
3467  dectreeh, diagnose, diagqn, diagqs, drainrt, &
3469  ef_umolco2perj, emis, emissionsmethod, enef_v_jkm, enddls, evetreeh, faibldg, &
3470  faidectree, faievetree, faut, fcef_v_kgkm, fcld_obs, flowchange, &
3471  frfossilfuel_heat, frfossilfuel_nonheat, g1, g2, g3, g4, g5, g6, gdd_id, &
3472  gddfull, gridiv, gsmodel, h_maintain, hdd_id, humactivity_24hr, &
3473  icefrac, id, ie_a, ie_end, ie_m, ie_start, imin, &
3474  internalwateruse_h, &
3475  irrfracpaved, irrfracbldgs, &
3476  irrfracevetr, irrfracdectr, irrfracgrass, &
3477  irrfracbsoil, irrfracwater, &
3478  isec, it, evapmethod, &
3479  iy, kkanohm, kmax, lai_id, laicalcyes, laimax, laimin, lai_obs, &
3480  laipower, laitype, lat, lenday_id, ldown_obs, lng, maxconductance, maxfcmetab, maxqfmetab, &
3481  snowwater, metforcingdata_grid, minfcmetab, minqfmetab, min_res_bioco2, &
3482  narp_emis_snow, narp_trans_site, netradiationmethod, &
3483  ohm_coef, ohmincqf, ohm_threshsw, &
3484  ohm_threshwd, pipecapacity, popdensdaytime, &
3485  popdensnighttime, popprof_24hr, pormax_dec, pormin_dec, &
3486  precip, preciplimit, preciplimitalb, press_hpa, &
3487  qf0_beu, qf_a, qf_b, qf_c, &
3488  qn1_obs, qs_obs, qf_obs, &
3489  radmeltfact, raincover, rainmaxres, resp_a, resp_b, &
3490  roughlenheatmethod, roughlenmommethod, runofftowater, s1, s2, &
3493  snowlimbldg, snowlimpaved, snowfrac_obs, snowpack, snowprof_24hr, snowuse, soildepth, &
3494  soilstore_id, soilstorecap, stabilitymethod, startdls, state_id, statelimit, &
3495  storageheatmethod, storedrainprm, surfacearea, tair_av, tau_a, tau_f, tau_r, &
3496  tmax_id, tmin_id, &
3497  baset_cooling, baset_heating, temp_c, tempmeltfact, th, &
3498  theta_bioco2, timezone, tl, trafficrate, trafficunits, &
3499  traffprof_24hr, ts5mindata_ir, tstep, tstep_prev, veg_type, &
3500  waterdist, waterusemethod, wetthresh, wu_m3, &
3502  wuprofa_24hr, wuprofm_24hr, xsmd, z, z0m_in, zdm_in, &
3504  dailystateline)!output
3505 
3506  ! update dt_since_start_x for next iteration, dt_since_start_x is used for Qn averaging. TS 28 Nov 2018
3507  dt_since_start = dt_since_start + tstep
3508 
3509  !============ update DailyStateBlock ===============
3510  dailystateblock(ir, :) = [datetimeline, dailystateline]
3511 
3512  !============ write out results ===============
3513  ! works at each timestep
3514  CALL suews_update_output( &
3515  snowuse, storageheatmethod, &!input
3516  len_sim, 1, &
3518  dataoutblocksuews_x, dataoutblocksnow_x, dataoutblockestm_x, dataoutblockrsl_x, dataoutblocksol_x)!inout
3519 
3520  END DO
3521 
3522  dataoutblocksuews = dataoutblocksuews_x(:, :, 1)
3523  dataoutblocksnow = dataoutblocksnow_x(:, :, 1)
3524  dataoutblockestm = dataoutblockestm_x(:, :, 1)
3525  dataoutblockrsl = dataoutblockrsl_x(:, :, 1)
3526  dataoutblocksol = dataoutblocksol_x(:, :, 1)
3527  ! DailyStateBlock=DailyStateBlock_X(:,:,1)
3528 
real(kind(1d0)), dimension(:, :), allocatable metforcingdata_grid
real(kind(1d0)) qn1_s_av
real(kind(1d0)) tau_r
real(kind(1d0)), dimension(nsurf+1) ohm_threshwd
real(kind(1d0)), dimension(nsurf+1) ohm_threshsw
real(kind(1d0)), dimension(nsurf) snowdens
real(kind(1d0)) g1
real(kind(1d0)) s2
real(kind(1d0)), dimension(nvegsurf) theta_bioco2
integer gsmodel
real(kind(1d0)), dimension(nsurf) icefrac
real(kind(1d0)), dimension(nsurf) snowwater
real(kind(1d0)) albmin_grass
real(kind(1d0)) g5
real(kind(1d0)) narp_emis_snow
real(kind(1d0)) snowfallcum
real(kind(1d0)) albmin_evetr
real(kind(1d0)), dimension(nsurf) state_id
real(kind(1d0)) qn1_av
real(kind(1d0)) kmax
real(kind(1d0)), dimension(nvegsurf) laimax
real(kind(1d0)), dimension(ncolumnsdataoutrsl - 5) dataoutlinersl
real(kind(1d0)) snowlimpaved
real(kind(1d0)) z
real(kind(1d0)) th
real(kind(1d0)), dimension(nvegsurf) maxconductance
real(kind(1d0)), dimension(0:23, 2) ahprof_24hr
real(kind(1d0)) snowalb
real(kind(1d0)) tempmeltfact
real(kind(1d0)), dimension(nsurf) soilstore_id
real(kind(1d0)) preciplimit
real(kind(1d0)), dimension(nvegsurf) alpha_enh_bioco2
real(kind(1d0)), dimension(4, nvegsurf) laipower
real(kind(1d0)), dimension(nsurf) snowpacklimit
real(kind(1d0)), dimension(ncolumnsdataoutsuews - 5) dataoutlinesuews
real(kind(1d0)) albmax_evetr
real(kind(1d0)), dimension(nvegsurf) alpha_bioco2
real(kind(1d0)) albevetr_id
real(kind(1d0)), dimension(nsurf) kkanohm
real(kind(1d0)), dimension(nvegsurf) resp_a
real(kind(1d0)) g2
integer isec
real(kind(1d0)) tmax_id
real(kind(1d0)), dimension(nsurf) soilstorecap
real(kind(1d0)), dimension(nvegsurf) sdd_id
real(kind(1d0)), dimension(27) dataoutlineestm
real(kind(1d0)) zdm_in
real(kind(1d0)) snowdensmin
real(kind(1d0)) tair_av
real(kind(1d0)) g3
real(kind(1d0)), dimension(ncolumnsdataoutsnow - 5) dataoutlinesnow
real(kind(1d0)) albmax_grass
real(kind(1d0)), dimension(nsurf) sathydraulicconduct
real(kind(1d0)), dimension(nsurf) statelimit
integer id
real(kind(1d0)), dimension(nvegsurf) gddfull
real(kind(1d0)), dimension(12) hdd_id
real(kind(1d0)) tau_f
real(kind(1d0)) capmax_dec
real(kind(1d0)) dqnsdt
real(kind(1d0)), dimension(0:23, 2) popprof_24hr
integer, dimension(nvegsurf) laitype
integer imin
real(kind(1d0)) snowalbmax
real(kind(1d0)), dimension(0:23, 2) wuprofm_24hr
real(kind(1d0)), dimension(nvegsurf) resp_b
real(kind(1d0)) pormax_dec
real(kind(1d0)), dimension(nsurf) chanohm
real(kind(1d0)) tmin_id
real(kind(1d0)), dimension(nsurf) emis
real(kind(1d0)), dimension(nsurf) soildepth
real(kind(1d0)) tau_a
real(kind(1d0)) radmeltfact
real(kind(1d0)), dimension(0:23, 2) snowprof_24hr
integer iy
real(kind(1d0)), dimension(nsurf) snowfrac
subroutine suews_cal_main(AerodynamicResistanceMethod, AH_MIN, AHProf_24hr, AH_SLOPE_Cooling, AH_SLOPE_Heating, alb, AlbMax_DecTr, AlbMax_EveTr, AlbMax_Grass, AlbMin_DecTr, AlbMin_EveTr, AlbMin_Grass, alpha_bioCO2, alpha_enh_bioCO2, alt, avkdn, avRh, avU1, BaseT, BaseTe, BaseTMethod, BaseT_HC, beta_bioCO2, beta_enh_bioCO2, bldgH, CapMax_dec, CapMin_dec, chAnOHM, CO2PointSource, cpAnOHM, CRWmax, CRWmin, DayWat, DayWatPer, DecTreeH, Diagnose, DiagQN, DiagQS, DRAINRT, dt_since_start, dqndt, qn1_av, dqnsdt, qn1_s_av, EF_umolCO2perJ, emis, EmissionsMethod, EnEF_v_Jkm, endDLS, EveTreeH, FAIBldg, FAIDecTree, FAIEveTree, Faut, FcEF_v_kgkm, fcld_obs, FlowChange, FrFossilFuel_Heat, FrFossilFuel_NonHeat, G1, G2, G3, G4, G5, G6, GDD_id, GDDFull, Gridiv, gsModel, H_maintain, HDD_id, HumActivity_24hr, IceFrac, id, Ie_a, Ie_end, Ie_m, Ie_start, imin, InternalWaterUse_h, IrrFracPaved, IrrFracBldgs, IrrFracEveTr, IrrFracDecTr, IrrFracGrass, IrrFracBSoil, IrrFracWater, isec, it, EvapMethod, iy, kkAnOHM, Kmax, LAI_id, LAICalcYes, LAIMax, LAIMin, LAI_obs, LAIPower, LAIType, lat, lenDay_id, ldown_obs, lng, MaxConductance, MaxFCMetab, MaxQFMetab, SnowWater, MetForcingData_grid, MinFCMetab, MinQFMetab, min_res_bioCO2, NARP_EMIS_SNOW, NARP_TRANS_SITE, NetRadiationMethod, OHM_coef, OHMIncQF, OHM_threshSW, OHM_threshWD, PipeCapacity, PopDensDaytime, PopDensNighttime, PopProf_24hr, PorMax_dec, PorMin_dec, Precip, PrecipLimit, PrecipLimitAlb, Press_hPa, QF0_BEU, Qf_A, Qf_B, Qf_C, qn1_obs, qs_obs, qf_obs, RadMeltFact, RAINCOVER, RainMaxRes, resp_a, resp_b, RoughLenHeatMethod, RoughLenMomMethod, RunoffToWater, S1, S2, SatHydraulicConduct, SDDFull, SDD_id, sfr, SMDMethod, SnowAlb, SnowAlbMax, SnowAlbMin, SnowPackLimit, SnowDens, SnowDensMax, SnowDensMin, SnowfallCum, SnowFrac, SnowLimBldg, SnowLimPaved, snowFrac_obs, SnowPack, SnowProf_24hr, snowUse, SoilDepth, soilstore_id, SoilStoreCap, StabilityMethod, startDLS, state_id, StateLimit, StorageHeatMethod, StoreDrainPrm, SurfaceArea, Tair_av, tau_a, tau_f, tau_r, Tmax_id, Tmin_id, BaseT_Cooling, BaseT_Heating, Temp_C, TempMeltFact, TH, theta_bioCO2, timezone, TL, TrafficRate, TrafficUnits, TraffProf_24hr, Ts5mindata_ir, tstep, tstep_prev, veg_type, WaterDist, WaterUseMethod, WetThresh, wu_m3, WUDay_id, DecidCap_id, albDecTr_id, albEveTr_id, albGrass_id, porosity_id, WUProfA_24hr, WUProfM_24hr, xsmd, Z, z0m_in, zdm_in, datetimeLine, dataOutLineSUEWS, dataOutLineSnow, dataOutLineESTM, dataoutLineRSL, dataOutLineSOLWEIG, DailyStateLine)
real(kind(1d0)) g4
integer dt_since_start
real(kind(1d0)), dimension(nsurf+1, 4, 3) ohm_coef
real(kind(1d0)), dimension(nvegsurf) laimin
real(kind(1d0)), dimension(nsurf) wetthresh
real(kind(1d0)) z0m_in
real(kind(1d0)) narp_trans_site
real(kind(1d0)), dimension(nvegsurf) lai_id
real(kind(1d0)) lenday_id
real(kind(1d0)) porosity_id
real(kind(1d0)), dimension(nsurf) cpanohm
real(kind(1d0)) albmin_dectr
real(kind(1d0)), dimension(nvegsurf) basete
real(kind(1d0)) albgrass_id
real(kind(1d0)), dimension(nsurf) snowpack
real(kind(1d0)), dimension(6, nsurf) storedrainprm
real(kind(1d0)), dimension(0:23, 2) traffprof_24hr
real(kind(1d0)) dqndt
real(kind(1d0)), dimension(nsurf) sfr
real(kind(1d0)) snowlimbldg
real(kind(1d0)), dimension(0:23, 2) wuprofa_24hr
real(kind(1d0)) g6
real(kind(1d0)), dimension(9) wuday_id
real(kind(1d0)), dimension(nvegsurf) min_res_bioco2
real(kind(1d0)) crwmin
real(kind(1d0)) bldgh
integer it
real(kind(1d0)) snowdensmax
real(kind(1d0)), dimension(ncolumnsdataoutdailystate - 5) dailystateline
real(kind(1d0)), dimension(nsurf) alb
real(kind(1d0)) preciplimitalb
real(kind(1d0)) pormin_dec
real(kind(1d0)) tl
real(kind(1d0)), dimension(nvegsurf) beta_enh_bioco2
real(kind(1d0)), dimension(0:23, 2) humactivity_24hr
real(kind(1d0)) capmin_dec
real(kind(1d0)), dimension(nvegsurf) gdd_id
real(kind(1d0)), dimension(nvegsurf) sddfull
real(kind(1d0)), dimension(:), allocatable ts5mindata_ir
real(kind(1d0)) crwmax
real(kind(1d0)), dimension(nvegsurf) baset
real(kind(1d0)) snowalbmin
real(kind(1d0)), dimension(nvegsurf) beta_bioco2
real(kind(1d0)), dimension(5) datetimeline
real(kind(1d0)) albdectr_id
real(kind(1d0)), dimension(ncolumnsdataoutsol - 5) dataoutlinesolweig
real(kind(1d0)), dimension(nsurf+1, nsurf - 1) waterdist
real(kind(1d0)) decidcap_id
real(kind(1d0)) albmax_dectr
real(kind(1d0)) s1
Here is the call graph for this function:

◆ suews_cal_qe()

subroutine suews_driver::suews_cal_qe ( integer, intent(in)  Diagnose,
integer, intent(in)  snowuse,
integer, intent(in)  tstep,
integer, intent(in)  imin,
integer, intent(in)  it,
integer, intent(in)  EvapMethod,
integer, dimension(nsurf), intent(in)  snowCalcSwitch,
integer, dimension(3), intent(in)  dayofWeek_id,
real(kind(1d0)), intent(in)  CRWmin,
real(kind(1d0)), intent(in)  CRWmax,
real(kind(1d0)), intent(in)  dectime,
real(kind(1d0)), intent(in)  avdens,
real(kind(1d0)), intent(in)  avcp,
real(kind(1d0)), intent(in)  lv_J_kg,
real(kind(1d0)), intent(in)  lvS_J_kg,
real(kind(1d0)), intent(in)  avRh,
real(kind(1d0)), intent(in)  Press_hPa,
real(kind(1d0)), intent(in)  Temp_C,
real(kind(1d0)), intent(in)  RAsnow,
real(kind(1d0)), intent(in)  psyc_hPa,
real(kind(1d0)), intent(in)  sIce_hPa,
real(kind(1d0)), intent(in)  PervFraction,
real(kind(1d0)), intent(in)  vegfraction,
real(kind(1d0)), intent(in)  addimpervious,
real(kind(1d0)), intent(in)  qn1_snowfree,
real(kind(1d0)), intent(in)  qf,
real(kind(1d0)), intent(in)  qs,
real(kind(1d0)), intent(in)  vpd_hPa,
real(kind(1d0)), intent(in)  s_hPa,
real(kind(1d0)), intent(in)  ResistSurf,
real(kind(1d0)), intent(in)  RA,
real(kind(1d0)), intent(in)  rb,
real(kind(1d0)), intent(in)  snowdensmin,
real(kind(1d0)), intent(in)  precip,
real(kind(1d0)), intent(in)  PipeCapacity,
real(kind(1d0)), intent(in)  RunoffToWater,
real(kind(1d0)), intent(in)  NonWaterFraction,
real(kind(1d0)), dimension(nsurf), intent(in)  WU_nsurf,
real(kind(1d0)), intent(in)  addVeg,
real(kind(1d0)), intent(in)  addWaterBody,
real(kind(1d0)), intent(in)  SnowLimPaved,
real(kind(1d0)), intent(in)  SnowLimBldg,
real(kind(1d0)), intent(in)  SurfaceArea,
real(kind(1d0)), intent(in)  FlowChange,
real(kind(1d0)), dimension(nsurf), intent(in)  drain,
real(kind(1d0)), dimension(nsurf), intent(in)  WetThresh,
real(kind(1d0)), dimension(nsurf), intent(in)  stateOld,
real(kind(1d0)), dimension(nsurf), intent(in)  mw_ind,
real(kind(1d0)), dimension(nsurf), intent(in)  SoilStoreCap,
real(kind(1d0)), dimension(nsurf), intent(in)  rainonsnow,
real(kind(1d0)), dimension(nsurf), intent(in)  freezmelt,
real(kind(1d0)), dimension(nsurf), intent(in)  freezstate,
real(kind(1d0)), dimension(nsurf), intent(in)  freezstatevol,
real(kind(1d0)), dimension(nsurf), intent(in)  Qm_Melt,
real(kind(1d0)), dimension(nsurf), intent(in)  Qm_rain,
real(kind(1d0)), dimension(nsurf), intent(in)  Tsurf_ind,
real(kind(1d0)), dimension(nsurf), intent(in)  sfr,
real(kind(1d0)), dimension(nsurf), intent(in)  StateLimit,
real(kind(1d0)), dimension(nsurf), intent(in)  AddWater,
real(kind(1d0)), dimension(nsurf), intent(in)  addwaterrunoff,
real(kind(1d0)), dimension(6, nsurf), intent(in)  StoreDrainPrm,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowPackLimit,
real(kind(1d0)), dimension(0:23, 2), intent(in)  SnowProf_24hr,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowPack_in,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowFrac_in,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowWater_in,
real(kind(1d0)), dimension(nsurf), intent(in)  iceFrac_in,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowDens_in,
real(kind(1d0)), intent(in)  runoff_per_interval_in,
real(kind(1d0)), dimension(nsurf), intent(in)  state_id_in,
real(kind(1d0)), dimension(nsurf), intent(in)  soilstore_id_in,
real(kind(1d0)), dimension(nsurf), intent(out)  state_id_out,
real(kind(1d0)), dimension(nsurf), intent(out)  soilstore_id_out,
real(kind(1d0)), dimension(nsurf), intent(out)  SnowPack_out,
real(kind(1d0)), dimension(nsurf), intent(out)  SnowFrac_out,
real(kind(1d0)), dimension(nsurf), intent(out)  SnowWater_out,
real(kind(1d0)), dimension(nsurf), intent(out)  iceFrac_out,
real(kind(1d0)), dimension(nsurf), intent(out)  SnowDens_out,
real(kind(1d0)), dimension(nsurf), intent(out)  runoffSoil,
real(kind(1d0)), dimension(2), intent(out)  SnowRemoval,
real(kind(1d0)), intent(out)  state_per_tstep,
real(kind(1d0)), intent(out)  NWstate_per_tstep,
real(kind(1d0)), intent(out)  qe,
real(kind(1d0)), intent(out)  swe,
real(kind(1d0)), intent(out)  chSnow_per_interval,
real(kind(1d0)), intent(out)  ev_per_tstep,
real(kind(1d0)), intent(out)  runoff_per_tstep,
real(kind(1d0)), intent(out)  surf_chang_per_tstep,
real(kind(1d0)), intent(out)  runoffPipes,
real(kind(1d0)), intent(out)  mwstore,
real(kind(1d0)), intent(out)  runoffwaterbody,
real(kind(1d0)), intent(out)  runoffAGveg,
real(kind(1d0)), intent(out)  runoffAGimpervious 
)

Definition at line 1792 of file suews_ctrl_driver.f95.

References evap_module::cal_evap(), waterdist_module::cal_water_storage(), allocatearray::nsurf, snow_module::snowcalc(), and allocatearray::watersurf.

Referenced by suews_cal_main().

1792 
1793  IMPLICIT NONE
1794 
1795  INTEGER, INTENT(in) ::diagnose
1796  INTEGER, INTENT(in) ::snowuse
1797  INTEGER, INTENT(in) ::tstep
1798  INTEGER, INTENT(in) ::imin
1799  INTEGER, INTENT(in) ::it
1800  INTEGER, INTENT(in) ::evapmethod !Evaporation calculated according to Rutter (1) or Shuttleworth (2)
1801 
1802  INTEGER, DIMENSION(nsurf), INTENT(in)::snowcalcswitch
1803  INTEGER, DIMENSION(3), INTENT(in)::dayofweek_id
1804 
1805  REAL(KIND(1d0)), INTENT(in)::crwmin
1806  REAL(KIND(1d0)), INTENT(in)::crwmax
1807  REAL(KIND(1d0)), INTENT(in)::dectime
1808  REAL(KIND(1d0)), INTENT(in)::lvs_j_kg
1809  REAL(KIND(1d0)), INTENT(in)::lv_j_kg
1810  REAL(KIND(1d0)), INTENT(in)::avdens
1811  REAL(KIND(1d0)), INTENT(in)::avrh
1812  REAL(KIND(1d0)), INTENT(in)::press_hpa
1813  REAL(KIND(1d0)), INTENT(in)::temp_c
1814  REAL(KIND(1d0)), INTENT(in)::rasnow
1815  REAL(KIND(1d0)), INTENT(in)::psyc_hpa
1816  REAL(KIND(1d0)), INTENT(in)::avcp
1817  REAL(KIND(1d0)), INTENT(in)::sice_hpa
1818  REAL(KIND(1d0)), INTENT(in)::pervfraction
1819  REAL(KIND(1d0)), INTENT(in)::vegfraction
1820  REAL(KIND(1d0)), INTENT(in)::addimpervious
1821  REAL(KIND(1d0)), INTENT(in)::qn1_snowfree
1822  REAL(KIND(1d0)), INTENT(in)::qf
1823  REAL(KIND(1d0)), INTENT(in)::qs
1824  REAL(KIND(1d0)), INTENT(in)::vpd_hpa
1825  REAL(KIND(1d0)), INTENT(in)::s_hpa
1826  REAL(KIND(1d0)), INTENT(in)::resistsurf
1827  REAL(KIND(1d0)), INTENT(in)::ra
1828  REAL(KIND(1d0)), INTENT(in)::rb
1829  REAL(KIND(1d0)), INTENT(in)::snowdensmin
1830  REAL(KIND(1d0)), INTENT(in)::precip
1831  REAL(KIND(1d0)), INTENT(in)::pipecapacity
1832  REAL(KIND(1d0)), INTENT(in)::runofftowater
1833  REAL(KIND(1d0)), INTENT(in)::nonwaterfraction
1834  ! REAL(KIND(1d0)), INTENT(in)::wu_EveTr!Water use for evergreen trees/shrubs [mm]
1835  ! REAL(KIND(1d0)), INTENT(in)::wu_DecTr!Water use for deciduous trees/shrubs [mm]
1836  ! REAL(KIND(1d0)), INTENT(in)::wu_Grass!Water use for grass [mm]
1837  REAL(KIND(1d0)), INTENT(in)::addveg!Water from vegetated surfaces of other grids [mm] for whole surface area
1838  REAL(KIND(1d0)), INTENT(in)::addwaterbody!Water from water surface of other grids [mm] for whole surface area
1839  REAL(KIND(1d0)), INTENT(in)::snowlimpaved
1840  REAL(KIND(1d0)), INTENT(in)::snowlimbldg
1841  REAL(KIND(1d0)), INTENT(in)::surfacearea
1842  REAL(KIND(1d0)), INTENT(in)::flowchange
1843 
1844  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::wu_nsurf
1845  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::drain
1846  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::wetthresh
1847  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::stateold
1848  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::mw_ind
1849  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::soilstorecap
1850  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::rainonsnow
1851  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::freezmelt
1852  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::freezstate
1853  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::freezstatevol
1854  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::qm_melt
1855  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::qm_rain
1856  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::tsurf_ind
1857  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::sfr
1858  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::snowpacklimit
1859  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::statelimit !Limit for state_id of each surface type [mm] (specified in input files)
1860  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::addwater
1861  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::addwaterrunoff
1862  REAL(KIND(1d0)), DIMENSION(6, nsurf), INTENT(in)::storedrainprm
1863  REAL(KIND(1d0)), DIMENSION(0:23, 2), INTENT(in):: snowprof_24hr
1864 
1865  ! Total water transported to each grid for grid-to-grid connectivity
1866  REAL(KIND(1d0)), INTENT(in)::runoff_per_interval_in
1867  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::state_id_in
1868  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::soilstore_id_in
1869  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::snowpack_in
1870  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::snowfrac_in
1871  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::snowwater_in
1872  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::icefrac_in
1873  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::snowdens_in
1874 
1875  ! output:
1876  REAL(KIND(1d0))::runoff_per_interval_out
1877  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out)::state_id_out
1878  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out)::soilstore_id_out
1879  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out)::snowpack_out
1880  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out)::snowfrac_out
1881  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out)::snowwater_out
1882  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out)::icefrac_out
1883  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out)::snowdens_out
1884 
1885  REAL(KIND(1d0)), DIMENSION(nsurf)::runoffsnow !Initialize for runoff caused by snowmelting
1886  REAL(KIND(1d0)), DIMENSION(nsurf)::runoff
1887  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out)::runoffsoil
1888  REAL(KIND(1d0)), DIMENSION(nsurf)::chang
1889  REAL(KIND(1d0)), DIMENSION(nsurf)::changsnow
1890  REAL(KIND(1d0)), DIMENSION(nsurf)::snowdepth
1891  REAL(KIND(1d0)), DIMENSION(nsurf)::snowtosurf
1892  REAL(KIND(1d0)), DIMENSION(nsurf)::ev_snow
1893  REAL(KIND(1d0)), DIMENSION(2), INTENT(out)::snowremoval
1894  REAL(KIND(1d0)), DIMENSION(nsurf)::evap
1895  REAL(KIND(1d0)), DIMENSION(nsurf)::rss_nsurf
1896 
1897  REAL(KIND(1d0))::p_mm!Inputs to surface water balance
1898  ! REAL(KIND(1d0)),INTENT(out)::rss
1899  REAL(KIND(1d0))::qe_surf ! latent heat flux [W m-2]
1900  REAL(KIND(1d0)), INTENT(out)::state_per_tstep
1901  REAL(KIND(1d0)), INTENT(out)::nwstate_per_tstep
1902  REAL(KIND(1d0)), INTENT(out)::qe
1903  REAL(KIND(1d0)), INTENT(out)::swe
1904  REAL(KIND(1d0))::ev
1905  REAL(KIND(1d0)), INTENT(out)::chsnow_per_interval
1906  REAL(KIND(1d0)), INTENT(out)::ev_per_tstep
1907  REAL(KIND(1d0))::qe_per_tstep
1908  REAL(KIND(1d0)), INTENT(out)::runoff_per_tstep
1909  REAL(KIND(1d0)), INTENT(out)::surf_chang_per_tstep
1910  REAL(KIND(1d0)), INTENT(out)::runoffpipes
1911  REAL(KIND(1d0)), INTENT(out)::mwstore
1912  REAL(KIND(1d0)), INTENT(out)::runoffwaterbody
1913  REAL(KIND(1d0))::runoffwaterbody_m3
1914  REAL(KIND(1d0))::runoffpipes_m3
1915  REAL(KIND(1d0)), INTENT(out)::runoffagveg
1916  REAL(KIND(1d0)), INTENT(out)::runoffagimpervious
1917 
1918  ! local:
1919  INTEGER:: is
1920 
1921  REAL(KIND(1d0))::runoff_per_interval
1922  REAL(KIND(1d0)), DIMENSION(nsurf)::state_id
1923  REAL(KIND(1d0)), DIMENSION(nsurf)::soilstore_id
1924  REAL(KIND(1d0)), DIMENSION(nsurf)::snowpack
1925  REAL(KIND(1d0)), DIMENSION(nsurf)::snowfrac
1926  REAL(KIND(1d0)), DIMENSION(nsurf)::snowwater
1927  REAL(KIND(1d0)), DIMENSION(nsurf)::icefrac
1928  REAL(KIND(1d0)), DIMENSION(nsurf)::snowdens
1929 
1930  REAL(KIND(1d0)), DIMENSION(2) ::surplusevap !Surplus for evaporation in 5 min timestep
1931  REAL(KIND(1d0))::surpluswaterbody
1932  REAL(KIND(1d0))::pin!Rain per time interval
1933  ! REAL(KIND(1d0))::sae
1934  ! REAL(KIND(1d0))::vdrc
1935  ! REAL(KIND(1d0))::sp
1936  ! REAL(KIND(1d0))::numPM
1937  REAL(KIND(1d0))::qn_e
1938  REAL(KIND(1d0))::tlv
1939  REAL(KIND(1d0))::runoffagimpervious_m3
1940  REAL(KIND(1d0))::runoffagveg_m3
1941  REAL(KIND(1d0))::nsh_real
1942  REAL(KIND(1d0))::tstep_real
1943  REAL(KIND(1d0))::ev_tot
1944  REAL(KIND(1d0))::qe_tot
1945  REAL(KIND(1d0))::surf_chang_tot
1946  REAL(KIND(1d0))::runoff_tot
1947  REAL(KIND(1d0))::chsnow_tot
1948 
1949  REAL(KIND(1d0)), DIMENSION(7)::capstore ! current storage capacity [mm]
1950 
1951  runoff_per_interval = runoff_per_interval_in
1952  state_id = state_id_in
1953  soilstore_id = soilstore_id_in
1954  snowpack = snowpack_in
1955  snowfrac = snowfrac_in
1956  snowwater = snowwater_in
1957  icefrac = icefrac_in
1958  snowdens = snowdens_in
1959 
1960  tstep_real = tstep*1.d0
1961  nsh_real = 3600/tstep_real
1962 
1963  capstore = 0 !initialise capStore
1964 
1965  tlv = lv_j_kg/tstep_real !Latent heat of vapourisation per timestep
1966 
1967  pin = max(0., precip)!Initiate rain data [mm]
1968 
1969  ! Initialize the output variables
1970  qe_surf = 0
1971  ev = 0
1972  qe_tot = 0
1973  ev_tot = 0
1974  swe = 0
1975  ev_snow = 0
1976  ev_per_tstep = 0
1977  qe_per_tstep = 0
1978  surf_chang_per_tstep = 0
1979  runoff_per_tstep = 0
1980  state_per_tstep = 0
1981  nwstate_per_tstep = 0
1982  qe = 0
1983  runoffwaterbody = 0
1984  chsnow_per_interval = 0
1985  mwstore = 0
1986  runoffagveg = 0
1987  runoffagimpervious = 0
1988  surpluswaterbody = 0
1989  runoffsoil = 0
1990  runoff = 0
1991  chang = 0
1992  surplusevap = 0
1993  snowremoval = 0
1994 
1995  ! net available energy for evaporation
1996  qn_e = qn1_snowfree + qf - qs ! qn1 changed to qn1_snowfree, lj in May 2013
1997 
1998  IF (diagnose == 1) WRITE (*, *) 'Calling evap_SUEWS and SoilStore...'
1999  DO is = 1, nsurf !For each surface in turn
2000  IF (snowuse == 1 .and. snowcalcswitch(is) == 1) THEN ! snow calculation
2001  IF (sfr(is) /= 0) THEN
2002  ! IF (Diagnose == 1) WRITE (*, *) 'Calling SnowCalc...'
2003  CALL snowcalc( &
2004  tstep, imin, it, dectime, is, &!input
2005  evapmethod, crwmin, crwmax, nsh_real, lvs_j_kg, avdens, &
2006  avrh, press_hpa, temp_c, rasnow, psyc_hpa, avcp, sice_hpa, &
2007  pervfraction, vegfraction, addimpervious, &
2008  vpd_hpa, qn_e, s_hpa, resistsurf, ra, rb, tlv, snowdensmin, snowprof_24hr, precip, &
2009  pipecapacity, runofftowater, &
2010  addveg, snowlimpaved, snowlimbldg, flowchange, drain, &
2013  qm_melt, qm_rain, tsurf_ind, sfr, dayofweek_id, storedrainprm, snowpacklimit, &
2015  soilstore_id, snowpack, surplusevap, &!inout
2017  runoffagimpervious, runoffagveg, surpluswaterbody, &
2018  rss_nsurf, runoffsnow, & ! output
2020  snowdepth, snowremoval, swe, ev, chsnow_tot, &
2021  ev_tot, qe_tot, runoff_tot, surf_chang_tot, &
2022  runoffpipes, mwstore, runoffwaterbody)
2023 
2024  !Actual updates here as xx_tstep variables not taken as input to snowcalc
2025  ev_per_tstep = ev_per_tstep + ev_tot
2026  qe_per_tstep = qe_per_tstep + qe_tot
2027  runoff_per_tstep = runoff_per_tstep + runoff_tot
2028  surf_chang_per_tstep = surf_chang_per_tstep + surf_chang_tot
2029  chsnow_per_interval = chsnow_per_interval + chsnow_tot
2030  ELSE
2031  snowfrac(is) = 0
2032  snowdens(is) = 0
2033  snowpack(is) = 0
2034  ENDIF
2035 
2036  !Store ev_tot for each surface
2037  evap(is) = ev_tot
2038  ELSE ! snow-free calculation
2039 
2040  capstore(is) = storedrainprm(6, is)
2041  !Calculates ev [mm]
2042  CALL cal_evap( &
2043  evapmethod, state_id(is), wetthresh(is), capstore(is), &!input
2044  vpd_hpa, avdens, avcp, qn_e, s_hpa, psyc_hpa, resistsurf, ra, rb, tlv, &
2045  rss_nsurf(is), ev, qe_surf) !output
2046 
2047  !Surface water balance and soil store updates (can modify ev, updates state_id)
2048  CALL cal_water_storage( &
2049  is, sfr, pipecapacity, runofftowater, pin, & ! input:
2050  wu_nsurf, &
2051  drain, addwater, addimpervious, nsh_real, stateold, addwaterrunoff, &
2052  pervfraction, addveg, soilstorecap, addwaterbody, flowchange, statelimit, runoffagimpervious, surpluswaterbody, &
2053  runoffagveg, runoffpipes, ev, soilstore_id, surplusevap, runoffwaterbody, &
2054  p_mm, chang, runoff, state_id)!output:
2055 
2056  !Store ev for each surface
2057  evap(is) = ev
2058 
2059  ! Sum evaporation from different surfaces to find total evaporation [mm]
2060  ev_per_tstep = ev_per_tstep + evap(is)*sfr(is)
2061 
2062  ! Sum latent heat flux from different surfaces to find total latent heat flux
2063  qe_per_tstep = qe_per_tstep + qe_surf*sfr(is)
2064 
2065  ! Sum change from different surfaces to find total change to surface state_id
2066  surf_chang_per_tstep = surf_chang_per_tstep + (state_id(is) - stateold(is))*sfr(is)
2067 
2068  ! Sum runoff from different surfaces to find total runoff
2069  runoff_per_tstep = runoff_per_tstep + runoff(is)*sfr(is)
2070 
2071  ! Calculate total state_id (including water body)
2072  state_per_tstep = state_per_tstep + state_id(is)*sfr(is)
2073 
2074  ! sum The total runoff from the area !!Check (HCW)
2075  runoff_per_interval = runoff_per_interval + (runoff(is)*sfr(is))
2076 
2077  IF (nonwaterfraction /= 0 .AND. is /= watersurf) THEN
2078  nwstate_per_tstep = nwstate_per_tstep + (state_id(is)*sfr(is)/nonwaterfraction)
2079  ENDIF
2080 
2081  changsnow(is) = 0
2082  runoffsnow(is) = 0
2083 
2084  ENDIF
2085  ENDDO !end loop over surfaces
2086 
2087  qe = qe_per_tstep
2088 
2089  ! Calculate volume of water that will move between grids
2090  ! Volume [m3] = Depth relative to whole area [mm] / 1000 [mm m-1] * SurfaceArea [m2]
2091  ! Need to use these volumes when converting back to addImpervious, AddVeg and AddWater
2092  runoffagimpervious_m3 = runoffagimpervious/1000*surfacearea
2093  runoffagveg_m3 = runoffagveg/1000*surfacearea
2094  runoffwaterbody_m3 = runoffwaterbody/1000*surfacearea
2095  runoffpipes_m3 = runoffpipes/1000*surfacearea
2096 
2097  runoff_per_interval_out = runoff_per_interval
2098  state_id_out = state_id
2099  soilstore_id_out = soilstore_id
2100  snowpack_out = snowpack
2101  snowfrac_out = snowfrac
2102  snowwater_out = snowwater
2103  icefrac_out = icefrac
2104  snowdens_out = snowdens
2105 
real(kind(1d0)), dimension(nsurf) mw_ind
real(kind(1d0)) tlv
real(kind(1d0)), dimension(nsurf) freezstate
real(kind(1d0)), dimension(nsurf) changsnow
real(kind(1d0)), dimension(nsurf) snowdens
real(kind(1d0)), dimension(nsurf) rainonsnow
real(kind(1d0)), dimension(nsurf) icefrac
integer, dimension(nsurf) snowcalcswitch
real(kind(1d0)), dimension(nsurf) snowwater
real(kind(1d0)), dimension(nsurf) state_id
real(kind(1d0)) mwstore
real(kind(1d0)), dimension(nsurf) drain
real(kind(1d0)) snowlimpaved
real(kind(1d0)), dimension(nsurf) soilstore_id
real(kind(1d0)), dimension(nsurf) ev_snow
real(kind(1d0)), dimension(nsurf) snowpacklimit
integer, parameter nsurf
real(kind(1d0)) lvs_j_kg
real(kind(1d0)), dimension(nsurf) evap
real(kind(1d0)) lv_j_kg
real(kind(1d0)), dimension(nsurf) soilstorecap
real(kind(1d0)), dimension(nsurf) chang
real(kind(1d0)) snowdensmin
real(kind(1d0)), dimension(nsurf) rss_nsurf
real(kind(1d0)), dimension(nsurf) statelimit
real(kind(1d0)), dimension(nsurf) snowdepth
real(kind(1d0)) avcp
integer imin
real(kind(1d0)), dimension(2) snowremoval
real(kind(1d0)), dimension(0:23, 2) snowprof_24hr
real(kind(1d0)), dimension(nsurf) snowfrac
real(kind(1d0)), dimension(nsurf) runoffsoil
real(kind(1d0)) psyc_hpa
real(kind(1d0)), dimension(nsurf) freezstatevol
real(kind(1d0)), dimension(nsurf) wetthresh
real(kind(1d0)), dimension(nsurf) stateold
real(kind(1d0)), dimension(nsurf) snowtosurf
real(kind(1d0)), dimension(nsurf) qm_melt
real(kind(1d0)), dimension(nsurf) freezmelt
real(kind(1d0)) vpd_hpa
real(kind(1d0)), dimension(nsurf) addwater
real(kind(1d0)), dimension(nsurf) snowpack
real(kind(1d0)), dimension(6, nsurf) storedrainprm
real(kind(1d0)), dimension(nsurf) runoffsnow
real(kind(1d0)), dimension(nsurf) sfr
real(kind(1d0)) snowlimbldg
real(kind(1d0)), dimension(nsurf) addwaterrunoff
real(kind(1d0)) sice_hpa
real(kind(1d0)) s_hpa
real(kind(1d0)) crwmin
integer it
real(kind(1d0)) dectime
real(kind(1d0)) avdens
integer, parameter watersurf
real(kind(1d0)), dimension(nsurf) runoff
real(kind(1d0)) crwmax
real(kind(1d0)) swe
real(kind(1d0)), dimension(nsurf) qm_rain
real(kind(1d0)), dimension(nsurf) tsurf_ind
Here is the call graph for this function:
Here is the caller graph for this function:

◆ suews_cal_qh()

subroutine suews_driver::suews_cal_qh ( integer, intent(in)  QHMethod,
real(kind(1d0)), intent(in)  qn1,
real(kind(1d0)), intent(in)  qf,
real(kind(1d0)), intent(in)  QmRain,
real(kind(1d0)), intent(in)  qeOut,
real(kind(1d0)), intent(in)  qs,
real(kind(1d0)), intent(in)  QmFreez,
real(kind(1d0)), intent(in)  qm,
real(kind(1d0)), intent(in)  avdens,
real(kind(1d0)), intent(in)  avcp,
real(kind(1d0)), intent(in)  tsurf,
real(kind(1d0)), intent(in)  Temp_C,
real(kind(1d0)), intent(in)  RA,
real(kind(1d0)), intent(out)  qh,
real(kind(1d0)), intent(out)  qh_residual,
real(kind(1d0)), intent(out)  qh_resist 
)

Definition at line 2114 of file suews_ctrl_driver.f95.

Referenced by suews_cal_main().

2114  IMPLICIT NONE
2115 
2116  INTEGER, INTENT(in) :: qhmethod ! option for QH calculation: 1, residual; 2, resistance-based
2117 
2118  REAL(KIND(1d0)), INTENT(in)::qn1
2119  REAL(KIND(1d0)), INTENT(in)::qf
2120  REAL(KIND(1d0)), INTENT(in)::qmrain
2121  REAL(KIND(1d0)), INTENT(in)::qeout
2122  REAL(KIND(1d0)), INTENT(in)::qs
2123  REAL(KIND(1d0)), INTENT(in)::qmfreez
2124  REAL(KIND(1d0)), INTENT(in)::qm
2125  REAL(KIND(1d0)), INTENT(in)::avdens
2126  REAL(KIND(1d0)), INTENT(in)::avcp
2127  REAL(KIND(1d0)), INTENT(in)::tsurf
2128  REAL(KIND(1d0)), INTENT(in)::temp_c
2129  REAL(KIND(1d0)), INTENT(in)::ra
2130 
2131  REAL(KIND(1d0)), INTENT(out)::qh
2132  REAL(KIND(1d0)), INTENT(out)::qh_resist
2133  REAL(KIND(1d0)), INTENT(out)::qh_residual
2134 
2135  REAL(KIND(1d0)), PARAMETER::nan = -999
2136 
2137  ! Calculate sensible heat flux as a residual (Modified by LJ in Nov 2012)
2138  qh_residual = (qn1 + qf + qmrain) - (qeout + qs + qm + qmfreez) !qh=(qn1+qf+QmRain+QmFreez)-(qeOut+qs+Qm)
2139 
2140  ! ! Calculate QH using resistance method (for testing HCW 06 Jul 2016)
2141  ! Aerodynamic-Resistance-based method
2142  IF (ra /= 0) THEN
2143  qh_resist = avdens*avcp*(tsurf - temp_c)/ra
2144  ELSE
2145  qh_resist = nan
2146  ENDIF
2147 
2148  ! choose output QH
2149  SELECT CASE (qhmethod)
2150  CASE (1)
2151  qh = qh_residual
2152  CASE (2)
2153  qh = qh_resist
2154  END SELECT
2155 
real(kind(1d0)) nan
real(kind(1d0)) qm
real(kind(1d0)) avcp
real(kind(1d0)) qmrain
real(kind(1d0)) qmfreez
real(kind(1d0)) avdens
Here is the caller graph for this function:

◆ suews_cal_qn()

subroutine suews_driver::suews_cal_qn ( integer, intent(in)  NetRadiationMethod,
integer, intent(in)  snowUse,
integer, intent(in)  tstep,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowPack_prev,
real(kind(1d0)), intent(in)  tau_a,
real(kind(1d0)), intent(in)  tau_f,
real(kind(1d0)), intent(in)  SnowAlbMax,
real(kind(1d0)), intent(in)  SnowAlbMin,
integer, intent(in)  Diagnose,
real(kind(1d0)), intent(in)  snowFrac_obs,
real(kind(1d0)), intent(in)  ldown_obs,
real(kind(1d0)), intent(in)  fcld_obs,
real(kind(1d0)), intent(in)  dectime,
real(kind(1d0)), intent(in)  ZENITH_deg,
real(kind(1d0)), intent(in)  Tsurf_0,
real(kind(1d0)), intent(in)  avKdn,
real(kind(1d0)), intent(in)  Temp_C,
real(kind(1d0)), intent(in)  avRH,
real(kind(1d0)), intent(in)  ea_hPa,
real(kind(1d0)), intent(in)  qn1_obs,
real(kind(1d0)), intent(in)  SnowAlb_prev,
real(kind(1d0)), dimension(nsurf), intent(in)  snowFrac_prev,
integer, intent(in)  DiagQN,
real(kind(1d0)), intent(in)  NARP_TRANS_SITE,
real(kind(1d0)), intent(in)  NARP_EMIS_SNOW,
real(kind(1d0)), dimension(nsurf), intent(in)  IceFrac,
real(kind(1d0)), dimension(nsurf), intent(in)  sfr,
real(kind(1d0)), dimension(nsurf), intent(in)  emis,
real(kind(1d0)), dimension(nsurf), intent(in)  alb_prev,
real(kind(1d0)), intent(in)  albDecTr_id,
real(kind(1d0)), intent(in)  albEveTr_id,
real(kind(1d0)), intent(in)  albGrass_id,
real(kind(1d0)), dimension(nsurf), intent(out)  alb_next,
real(kind(1d0)), intent(out)  ldown,
real(kind(1d0)), intent(out)  fcld,
real(kind(1d0)), intent(out)  qn1,
real(kind(1d0)), intent(out)  qn1_snowfree,
real(kind(1d0)), intent(out)  qn1_S,
real(kind(1d0)), intent(out)  kclear,
real(kind(1d0)), intent(out)  kup,
real(kind(1d0)), intent(out)  lup,
real(kind(1d0)), intent(out)  tsurf,
real(kind(1d0)), dimension(nsurf), intent(out)  qn1_ind_snow,
real(kind(1d0)), dimension(nsurf), intent(out)  kup_ind_snow,
real(kind(1d0)), dimension(nsurf), intent(out)  Tsurf_ind_snow,
real(kind(1d0)), dimension(nsurf), intent(out)  Tsurf_ind,
real(kind(1d0)), intent(out)  alb1,
real(kind(1d0)), dimension(nsurf), intent(out)  snowFrac_next,
real(kind(1d0)), intent(out)  SnowAlb_next 
)

Definition at line 1328 of file suews_ctrl_driver.f95.

References allocatearray::conifsurf, allocatearray::decidsurf, allocatearray::grasssurf, narp_module::narp(), allocatearray::nsurf, narp_module::radmethod(), and snow_module::update_snow_albedo().

Referenced by suews_cal_main().

1328  USE narp_module, ONLY: radmethod, narp
1329 
1330  IMPLICIT NONE
1331  ! INTEGER,PARAMETER ::nsurf = 7 ! number of surface types
1332  ! INTEGER,PARAMETER ::ConifSurf = 3 !New surface classes: Grass = 5th/7 surfaces
1333  ! INTEGER,PARAMETER ::DecidSurf = 4 !New surface classes: Grass = 5th/7 surfaces
1334  ! INTEGER,PARAMETER ::GrassSurf = 5
1335 
1336  INTEGER, INTENT(in)::netradiationmethod
1337  INTEGER, INTENT(in)::snowuse
1338  INTEGER, INTENT(in)::diagnose
1339  INTEGER, INTENT(in)::diagqn
1340  INTEGER, INTENT(in)::tstep
1341 
1342  REAL(KIND(1d0)), INTENT(in)::snowfrac_obs
1343  REAL(KIND(1d0)), INTENT(in)::ldown_obs
1344  REAL(KIND(1d0)), INTENT(in)::fcld_obs
1345  REAL(KIND(1d0)), INTENT(in)::dectime
1346  REAL(KIND(1d0)), INTENT(in)::zenith_deg
1347  REAL(KIND(1d0)), INTENT(in)::tsurf_0
1348  REAL(KIND(1d0)), INTENT(in)::avkdn
1349  REAL(KIND(1d0)), INTENT(in)::temp_c
1350  REAL(KIND(1d0)), INTENT(in)::avrh
1351  REAL(KIND(1d0)), INTENT(in)::ea_hpa
1352  REAL(KIND(1d0)), INTENT(in)::qn1_obs
1353  REAL(KIND(1d0)), INTENT(in)::snowalb_prev
1354  REAL(KIND(1d0)), INTENT(in)::narp_emis_snow
1355  REAL(KIND(1d0)), INTENT(in)::narp_trans_site
1356  REAL(KIND(1d0)), INTENT(in)::tau_a, tau_f, snowalbmax, snowalbmin
1357 
1358  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in):: icefrac
1359  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in):: sfr
1360  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in):: emis
1361 
1362  REAL(KIND(1d0)), DIMENSION(nsurf) ::alb
1363  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in) ::alb_prev
1364  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out) ::alb_next
1365  REAL(KIND(1d0)), INTENT(in) ::albdectr_id
1366  ! REAL(KIND(1d0)), INTENT(in) ::DecidCap_id
1367  REAL(KIND(1d0)), INTENT(in) ::albevetr_id
1368  REAL(KIND(1d0)), INTENT(in) ::albgrass_id
1369 
1370  ! REAL(KIND(1d0)), DIMENSION(6, nsurf), INTENT(inout)::StoreDrainPrm
1371 
1372  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::snowpack_prev
1373  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::snowfrac_prev
1374  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out)::snowfrac_next
1375  REAL(KIND(1d0)), DIMENSION(nsurf)::snowfrac
1376 
1377  REAL(KIND(1d0)), INTENT(out)::ldown
1378  REAL(KIND(1d0)), INTENT(out)::fcld
1379  REAL(KIND(1d0)), INTENT(out)::qn1
1380  REAL(KIND(1d0)), INTENT(out)::qn1_snowfree
1381  REAL(KIND(1d0)), INTENT(out)::qn1_s
1382  REAL(KIND(1d0)), INTENT(out)::kclear
1383  REAL(KIND(1d0)), INTENT(out)::kup
1384  REAL(KIND(1d0)), INTENT(out)::lup
1385  REAL(KIND(1d0)), INTENT(out)::tsurf
1386  REAL(KIND(1d0)), INTENT(out)::alb1
1387  REAL(KIND(1d0)), INTENT(out)::snowalb_next
1388  REAL(KIND(1d0))::alb0
1389  REAL(KIND(1d0))::snowalb
1390 
1391  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out) ::qn1_ind_snow
1392  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out) ::kup_ind_snow
1393  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out) ::tsurf_ind_snow
1394  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out):: tsurf_ind
1395 
1396  REAL(KIND(1d0)), DIMENSION(nsurf):: lup_ind
1397  REAL(KIND(1d0)), DIMENSION(nsurf):: kup_ind
1398  REAL(KIND(1d0)), DIMENSION(nsurf):: qn1_ind
1399 
1400  REAL(KIND(1d0)), PARAMETER::nan = -999
1401  INTEGER :: netradiationmethod_use
1402  INTEGER::albedochoice, ldown_option
1403 
1404  ! translate values
1405  alb = alb_prev
1406 
1407  ! update snow albedo
1408  snowalb = update_snow_albedo( &
1409  tstep, snowpack_prev, snowalb_prev, temp_c, &
1411 
1412  CALL radmethod( &
1413  netradiationmethod, &!input
1414  snowuse, &!input
1415  netradiationmethod_use, albedochoice, ldown_option)!output
1416 
1417  snowfrac = snowfrac_prev
1418  IF (netradiationmethod_use > 0) THEN
1419 
1420  ! IF (snowUse==0) SnowFrac=snowFrac_obs
1421  IF (snowuse == 0) snowfrac = 0
1422 
1423  IF (ldown_option == 1) THEN !Observed ldown provided as forcing
1424  ldown = ldown_obs
1425  ELSE
1426  ldown = -9 !to be filled in NARP
1427  ENDIF
1428 
1429  IF (ldown_option == 2) THEN !observed cloud fraction provided as forcing
1430  fcld = fcld_obs
1431  ENDIF
1432 
1433  !write(*,*) DecidCap(id), id, it, imin, 'Calc - near start'
1434 
1435  ! Update variables that change daily and represent seasonal variability
1436  alb(decidsurf) = albdectr_id !Change deciduous albedo
1437  ! StoreDrainPrm(6, DecidSurf) = DecidCap_id !Change current storage capacity of deciduous trees
1438  ! Change EveTr and Grass albedo too
1441 
1442  IF (diagnose == 1) WRITE (*, *) 'Calling NARP...'
1443  IF (diagqn == 1) WRITE (*, *) 'NetRadiationMethodX:', netradiationmethod_use
1444  IF (diagqn == 1) WRITE (*, *) 'AlbedoChoice:', albedochoice
1445 
1446  CALL narp( &
1447  nsurf, sfr, snowfrac, alb, emis, icefrac, &! input:
1449  dectime, zenith_deg, tsurf_0, avkdn, temp_c, avrh, ea_hpa, qn1_obs, &
1450  snowalb, &
1451  albedochoice, ldown_option, netradiationmethod_use, diagqn, &
1452  qn1, qn1_snowfree, qn1_s, kclear, kup, ldown, lup, fcld, tsurf, &! output:
1454 
1455  ELSE ! NetRadiationMethod==0
1456  snowfrac = snowfrac_obs
1457  qn1 = qn1_obs
1458  qn1_snowfree = qn1_obs
1459  qn1_s = qn1_obs
1460  ldown = nan
1461  lup = nan
1462  kup = nan
1463  tsurf = nan
1464  lup_ind = nan
1465  kup_ind = nan
1466  tsurf_ind = nan
1467  qn1_ind = nan
1468  fcld = nan
1469  ENDIF
1470  snowfrac_next = snowfrac
1471 
1472  IF (ldown_option == 1) THEN
1473  fcld = nan
1474  ENDIF
1475 
1476  ! translate values
1477  alb_next = alb
1478  snowalb_next = snowalb
1479 
real(kind(1d0)), dimension(nsurf) qn1_ind
real(kind(1d0)), dimension(nsurf) icefrac
real(kind(1d0)) narp_emis_snow
real(kind(1d0)) nan
real(kind(1d0)) snowalb
real(kind(1d0)), dimension(nsurf) kup_ind_snow
subroutine radmethod(NetRadiationMethod, snowUse, NetRadiationMethod_use, AlbedoChoice, ldown_option)
real(kind(1d0)) albevetr_id
integer, parameter nsurf
real(kind(1d0)) ea_hpa
real(kind(1d0)), dimension(nsurf) lup_ind
integer, parameter conifsurf
real(kind(1d0)) tau_f
real(kind(1d0)) snowalbmax
real(kind(1d0)), dimension(nsurf) emis
integer, parameter grasssurf
real(kind(1d0)) tau_a
real(kind(1d0)), dimension(nsurf) snowfrac
real(kind(1d0)), dimension(nsurf) qn1_ind_snow
real(kind(1d0)) narp_trans_site
subroutine narp(nsurf, sfr, SnowFrac, alb, emis, IceFrac, NARP_TRANS_SITE, NARP_EMIS_SNOW, DTIME, ZENITH_deg, tsurf_0, kdown, Temp_C, RH, Press_hPa, qn1_obs, SnowAlb, AlbedoChoice, ldown_option, NetRadiationMethod_use, DiagQN, QSTARall, QSTAR_SF, QSTAR_S, kclear, KUPall, LDOWN, LUPall, fcld, TSURFall, qn1_ind_snow, kup_ind_snow, Tsurf_ind_snow, Tsurf_ind, alb0, alb1)
real(kind(1d0)) albgrass_id
real(kind(1d0)), dimension(nsurf) sfr
integer, parameter decidsurf
real(kind(1d0)) dectime
real(kind(1d0)), dimension(nsurf) alb
real(kind(1d0)), dimension(nsurf) kup_ind
real(kind(1d0)) snowalbmin
real(kind(1d0)), dimension(nsurf) tsurf_ind
real(kind(1d0)) albdectr_id
real(kind(1d0)), dimension(nsurf) tsurf_ind_snow
Here is the call graph for this function:
Here is the caller graph for this function:

◆ suews_cal_qs()

subroutine suews_driver::suews_cal_qs ( integer, intent(in)  StorageHeatMethod,
real(kind(1d0)), intent(in)  qs_obs,
integer, intent(in)  OHMIncQF,
integer, intent(in)  Gridiv,
integer, intent(in)  id,
integer, intent(in)  tstep,
integer, intent(in)  dt_since_start,
integer, intent(in)  Diagnose,
real(kind(1d0)), dimension(nsurf), intent(in)  sfr,
real(kind(1d0)), dimension(nsurf + 1, 4, 3), intent(in)  OHM_coef,
real(kind(1d0)), dimension(nsurf + 1), intent(in)  OHM_threshSW,
real(kind(1d0)), dimension(nsurf + 1), intent(in)  OHM_threshWD,
real(kind(1d0)), dimension(nsurf), intent(in)  soilstore_id,
real(kind(1d0)), dimension(nsurf), intent(in)  SoilStoreCap,
real(kind(1d0)), dimension(nsurf), intent(in)  state_id,
integer, intent(in)  SnowUse,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowFrac,
integer, intent(in)  DiagQS,
real(kind(1d0)), dimension(12), intent(in)  HDD_id,
real(kind(1d0)), dimension(:, :), intent(in)  MetForcingData_grid,
real(kind(1d0)), dimension(:), intent(in)  Ts5mindata_ir,
real(kind(1d0)), intent(in)  qf,
real(kind(1d0)), intent(in)  qn1,
real(kind(1d0)), intent(in)  avkdn,
real(kind(1d0)), intent(in)  avu1,
real(kind(1d0)), intent(in)  temp_c,
real(kind(1d0)), intent(in)  zenith_deg,
real(kind(1d0)), intent(in)  avrh,
real(kind(1d0)), intent(in)  press_hpa,
real(kind(1d0)), intent(in)  ldown,
real(kind(1d0)), intent(in)  bldgh,
real(kind(1d0)), dimension(nsurf), intent(in)  alb,
real(kind(1d0)), dimension(nsurf), intent(in)  emis,
real(kind(1d0)), dimension(nsurf), intent(in)  cpAnOHM,
real(kind(1d0)), dimension(nsurf), intent(in)  kkAnOHM,
real(kind(1d0)), dimension(nsurf), intent(in)  chAnOHM,
integer, intent(in)  EmissionsMethod,
real(kind(1d0)), intent(in)  Tair_av,
real(kind(1d0)), intent(in)  qn1_av_prev,
real(kind(1d0)), intent(in)  dqndt_prev,
real(kind(1d0)), intent(in)  qn1_s_av_prev,
real(kind(1d0)), intent(in)  dqnsdt_prev,
real(kind(1d0)), dimension(6, nsurf), intent(in)  StoreDrainPrm,
real(kind(1d0)), intent(out)  qn1_S,
real(kind(1d0)), dimension(27), intent(out)  dataOutLineESTM,
real(kind(1d0)), intent(out)  qs,
real(kind(1d0)), intent(out)  qn1_av_next,
real(kind(1d0)), intent(out)  dqndt_next,
real(kind(1d0)), intent(out)  qn1_s_av_next,
real(kind(1d0)), intent(out)  dqnsdt_next,
real(kind(1d0)), dimension(nsurf), intent(out)  deltaQi,
real(kind(1d0)), intent(out)  a1,
real(kind(1d0)), intent(out)  a2,
real(kind(1d0)), intent(out)  a3 
)
Parameters
[in]emissionsmethodAnthropHeat option [-]
[in]albalbedo [-]
[in]emisemissivity [-]
[in]cpanohmheat capacity [J m-3 K-1]
[in]kkanohmthermal conductivity [W m-1 K-1]
[in]chanohmbulk transfer coef [J m-3 K-1]
[in]metforcingdata_gridmet forcing array of grid
[out]a1AnOHM coefficients of grid [-]
[out]a2AnOHM coefficients of grid [h]
[out]a3AnOHM coefficients of grid [W m-2]

Definition at line 1497 of file suews_ctrl_driver.f95.

References anohm_module::anohm(), allocatearray::bldgsurf, estm_module::estm(), allocatearray::nsurf, ohm(), and allocatearray::watersurf.

Referenced by suews_cal_main().

1497 
1498  IMPLICIT NONE
1499 
1500  INTEGER, INTENT(in) ::storageheatmethod
1501  INTEGER, INTENT(in) ::ohmincqf
1502  INTEGER, INTENT(in) ::gridiv
1503  INTEGER, INTENT(in) ::id
1504  INTEGER, INTENT(in) ::tstep ! time step [s]
1505  INTEGER, INTENT(in) ::dt_since_start ! time since simulation starts [s]
1506  INTEGER, INTENT(in) ::diagnose
1507  ! INTEGER, INTENT(in) ::nsh ! number of timesteps in one hour
1508  INTEGER, INTENT(in) ::snowuse ! option for snow related calculations
1509  INTEGER, INTENT(in) ::diagqs ! diagnostic option
1510  INTEGER, INTENT(in) :: emissionsmethod
1511 
1512  REAL(KIND(1d0)), INTENT(in)::ohm_coef(nsurf + 1, 4, 3) ! OHM coefficients
1513  REAL(KIND(1d0)), INTENT(in)::ohm_threshsw(nsurf + 1) ! OHM thresholds
1514  REAL(KIND(1d0)), INTENT(in)::ohm_threshwd(nsurf + 1) ! OHM thresholds
1515  REAL(KIND(1d0)), INTENT(in)::soilstore_id(nsurf) ! soil moisture
1516  REAL(KIND(1d0)), INTENT(in)::soilstorecap(nsurf) ! capacity of soil store
1517  REAL(KIND(1d0)), INTENT(in)::state_id(nsurf) ! wetness status
1518 
1519  REAL(KIND(1d0)), DIMENSION(12), INTENT(in)::hdd_id
1520  REAL(KIND(1d0)), INTENT(in)::qf
1521  REAL(KIND(1d0)), INTENT(in)::qn1
1522  REAL(KIND(1d0)), INTENT(in)::qs_obs
1523  REAL(KIND(1d0)), INTENT(in)::avkdn, avu1, temp_c, zenith_deg, avrh, press_hpa, ldown
1524  REAL(KIND(1d0)), INTENT(in)::bldgh
1525 
1526  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::sfr
1527  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::alb
1528  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::emis
1529  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::cpanohm
1530  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::kkanohm
1531  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::chanohm
1532  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::snowfrac
1533 
1534  REAL(KIND(1d0)), DIMENSION(:, :), INTENT(in)::metforcingdata_grid
1535 
1536  REAL(KIND(1d0)), DIMENSION(:), INTENT(in)::ts5mindata_ir
1537 
1538  REAL(KIND(1d0)), INTENT(in)::tair_av
1539  REAL(KIND(1d0)), INTENT(in)::qn1_av_prev
1540  REAL(KIND(1d0)), INTENT(out)::qn1_av_next
1541  REAL(KIND(1d0)), INTENT(in)::dqndt_prev ! Rate of change of net radiation [W m-2 h-1] at t-1
1542  REAL(KIND(1d0)), INTENT(out)::dqndt_next ! Rate of change of net radiation [W m-2 h-1] at t-1
1543  REAL(KIND(1d0)), INTENT(in)::qn1_s_av_prev
1544  REAL(KIND(1d0)), INTENT(out)::qn1_s_av_next
1545  REAL(KIND(1d0)), INTENT(in)::dqnsdt_prev ! Rate of change of net radiation [W m-2 h-1] at t-1
1546  REAL(KIND(1d0)), INTENT(out)::dqnsdt_next ! Rate of change of net radiation [W m-2 h-1] at t-1
1547  ! REAL(KIND(1d0)),DIMENSION(nsh),INTENT(inout) ::qn1_store_grid
1548  ! REAL(KIND(1d0)),DIMENSION(nsh),INTENT(inout) ::qn1_S_store_grid !< stored qn1 [W m-2]
1549 
1550  ! REAL(KIND(1d0)),DIMENSION(2*nsh+1),INTENT(inout)::qn1_av_store_grid
1551  ! REAL(KIND(1d0)),DIMENSION(2*nsh+1),INTENT(inout)::qn1_S_av_store_grid !< average net radiation over previous hour [W m-2]
1552  REAL(KIND(1d0)), DIMENSION(6, nsurf), INTENT(in)::storedrainprm
1553 
1554  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out)::deltaqi ! storage heat flux of snow surfaces
1555 
1556  REAL(KIND(1d0)), DIMENSION(27), INTENT(out):: dataoutlineestm
1557  REAL(KIND(1d0)), INTENT(out)::qn1_s
1558  REAL(KIND(1d0)), INTENT(out):: qs ! storage heat flux
1559  REAL(KIND(1d0)), INTENT(out):: a1
1560  REAL(KIND(1d0)), INTENT(out):: a2
1561  REAL(KIND(1d0)), INTENT(out):: a3
1562 
1563  REAL(KIND(1d0))::tair_mav_5d ! Tair_mav_5d=HDD(id-1,4) HDD at the begining of today (id-1)
1564  REAL(KIND(1d0))::qn1_use ! qn used in OHM calculations
1565 
1566  REAL(KIND(1d0)):: moist_surf(nsurf)
1567 
1568  ! initialise output variables
1569  !deltaQi = 0
1570  !SnowFrac = 0
1571  !qn1_S = 0
1572  dataoutlineestm = -999
1573  qs = -999
1574  a1 = -999
1575  a2 = -999
1576  a3 = -999
1577 
1578  ! calculate qn if qf should be included
1579  IF (ohmincqf == 1) THEN
1580  qn1_use = qf + qn1
1581  ELSEIF (ohmincqf == 0) THEN
1582  qn1_use = qn1
1583  ENDIF
1584 
1585  IF (storageheatmethod == 0) THEN !Use observed QS
1586  qs = qs_obs
1587 
1588  ELSEIF (storageheatmethod == 1) THEN !Use OHM to calculate QS
1589  tair_mav_5d = hdd_id(10)
1590  IF (diagnose == 1) WRITE (*, *) 'Calling OHM...'
1591  CALL ohm(qn1_use, qn1_av_prev, dqndt_prev, qn1_av_next, dqndt_next, &
1592  qn1_s, qn1_s_av_prev, dqnsdt_prev, qn1_s_av_next, dqnsdt_next, &
1593  tstep, dt_since_start, &
1594  sfr, nsurf, &
1595  tair_mav_5d, &
1596  ohm_coef, &
1599  bldgsurf, watersurf, &
1600  snowuse, snowfrac, &
1601  diagqs, &
1602  a1, a2, a3, qs, deltaqi)
1603 
1604  ! use AnOHM to calculate QS, TS 14 Mar 2016
1605  ELSEIF (storageheatmethod == 3) THEN
1606  IF (diagnose == 1) WRITE (*, *) 'Calling AnOHM...'
1607  ! CALL AnOHM(qn1_use,qn1_store_grid,qn1_av_store_grid,qf,&
1608  ! MetForcingData_grid,state_id/StoreDrainPrm(6,:),&
1609  ! alb, emis, cpAnOHM, kkAnOHM, chAnOHM,&
1610  ! sfr,nsurf,nsh,EmissionsMethod,id,Gridiv,&
1611  ! a1,a2,a3,qs,deltaQi)
1612  moist_surf = state_id/storedrainprm(6, :)
1613  CALL anohm( &
1614  tstep, dt_since_start, &
1615  qn1_use, qn1_av_prev, dqndt_prev, qf, &
1616  metforcingdata_grid, moist_surf, &
1617  alb, emis, cpanohm, kkanohm, chanohm, &! input
1618  sfr, nsurf, emissionsmethod, id, gridiv, &
1619  qn1_av_next, dqndt_next, &
1620  a1, a2, a3, qs, deltaqi)! output
1621 
1622  ! !Calculate QS using ESTM
1623  ELSEIF (storageheatmethod == 4 .OR. storageheatmethod == 14) THEN
1624  ! !CALL ESTM(QSestm,iMB)
1625  IF (diagnose == 1) WRITE (*, *) 'Calling ESTM...'
1626  CALL estm( &
1627  gridiv, &!input
1628  tstep, &
1629  avkdn, avu1, temp_c, zenith_deg, avrh, press_hpa, ldown, &
1630  bldgh, ts5mindata_ir, &
1631  tair_av, &
1632  dataoutlineestm, qs)!output
1633  ! CALL ESTM(QSestm,Gridiv,ir) ! iMB corrected to Gridiv, TS 09 Jun 2016
1634  ! QS=QSestm ! Use ESTM qs
1635  ENDIF
1636 
real(kind(1d0)), dimension(:, :), allocatable metforcingdata_grid
real(kind(1d0)), dimension(nsurf+1) ohm_threshwd
real(kind(1d0)), dimension(nsurf+1) ohm_threshsw
real(kind(1d0)), dimension(nsurf) state_id
real(kind(1d0)) a2
real(kind(1d0)), dimension(nsurf) soilstore_id
real(kind(1d0)) a1
real(kind(1d0)), dimension(nsurf) kkanohm
integer, parameter nsurf
real(kind(1d0)) a3
real(kind(1d0)), dimension(nsurf) soilstorecap
real(kind(1d0)), dimension(27) dataoutlineestm
subroutine ohm(qn1, qn1_av_prev, dqndt_prev, qn1_av_next, dqndt_next, qn1_S, qn1_s_av_prev, dqnsdt_prev, qn1_s_av_next, dqnsdt_next, tstep, dt_since_start, sfr, nsurf, Tair_mav_5d, OHM_coef, OHM_threshSW, OHM_threshWD, soilstore_id, SoilStoreCap, state_id, BldgSurf, WaterSurf, SnowUse, SnowFrac, DiagQS, a1, a2, a3, qs, deltaQi)
real(kind(1d0)) tair_av
integer id
real(kind(1d0)), dimension(12) hdd_id
real(kind(1d0)), dimension(nsurf) chanohm
real(kind(1d0)), dimension(nsurf) emis
real(kind(1d0)), dimension(nsurf) snowfrac
integer dt_since_start
real(kind(1d0)), dimension(nsurf+1, 4, 3) ohm_coef
real(kind(1d0)), dimension(nsurf) deltaqi
real(kind(1d0)), dimension(nsurf) cpanohm
real(kind(1d0)), dimension(6, nsurf) storedrainprm
real(kind(1d0)), dimension(nsurf) sfr
real(kind(1d0)) bldgh
real(kind(1d0)), dimension(nsurf) alb
integer, parameter bldgsurf
integer, parameter watersurf
real(kind(1d0)), dimension(:), allocatable ts5mindata_ir
Here is the call graph for this function:
Here is the caller graph for this function:

◆ suews_cal_resistance()

subroutine suews_driver::suews_cal_resistance ( integer, intent(in)  StabilityMethod,
integer, intent(in)  Diagnose,
integer, intent(in)  AerodynamicResistanceMethod,
integer, intent(in)  RoughLenHeatMethod,
integer, intent(in)  snowUse,
integer, intent(in)  id,
integer, intent(in)  it,
integer, intent(in)  gsModel,
integer, intent(in)  SMDMethod,
real(kind(1d0)), intent(in)  avdens,
real(kind(1d0)), intent(in)  avcp,
real(kind(1d0)), intent(in)  QH_init,
real(kind(1d0)), intent(in)  zzd,
real(kind(1d0)), intent(in)  z0m,
real(kind(1d0)), intent(in)  zdm,
real(kind(1d0)), intent(in)  avU1,
real(kind(1d0)), intent(in)  Temp_C,
real(kind(1d0)), intent(in)  VegFraction,
real(kind(1d0)), intent(in)  avkdn,
real(kind(1d0)), intent(in)  Kmax,
real(kind(1d0)), intent(in)  G1,
real(kind(1d0)), intent(in)  G2,
real(kind(1d0)), intent(in)  G3,
real(kind(1d0)), intent(in)  G4,
real(kind(1d0)), intent(in)  G5,
real(kind(1d0)), intent(in)  G6,
real(kind(1d0)), intent(in)  S1,
real(kind(1d0)), intent(in)  S2,
real(kind(1d0)), intent(in)  TH,
real(kind(1d0)), intent(in)  TL,
real(kind(1d0)), intent(in)  dq,
real(kind(1d0)), intent(in)  xsmd,
real(kind(1d0)), intent(in)  vsmd,
real(kind(1d0)), dimension(3), intent(in)  MaxConductance,
real(kind(1d0)), dimension(3), intent(in)  LAIMax,
real(kind(1d0)), dimension(3), intent(in)  LAI_id,
real(kind(1d0)), dimension(nsurf), intent(in)  SnowFrac,
real(kind(1d0)), dimension(nsurf), intent(in)  sfr,
real(kind(1d0)), intent(out)  UStar,
real(kind(1d0)), intent(out)  TStar,
real(kind(1d0)), intent(out)  L_mod,
real(kind(1d0)), intent(out)  zL,
real(kind(1d0)), intent(out)  gsc,
real(kind(1d0)), intent(out)  ResistSurf,
real(kind(1d0)), intent(out)  RA,
real(kind(1d0)), intent(out)  RAsnow,
real(kind(1d0)), intent(out)  rb 
)

Definition at line 2170 of file suews_ctrl_driver.f95.

References resist_module::aerodynamicresistance(), resist_module::boundarylayerresistance(), atmmoiststab_module::cal_stab(), and resist_module::surfaceresistance().

Referenced by suews_cal_main().

2170 
2171  IMPLICIT NONE
2172 
2173  INTEGER, INTENT(in)::stabilitymethod
2174  INTEGER, INTENT(in)::diagnose
2175  INTEGER, INTENT(in)::aerodynamicresistancemethod
2176  INTEGER, INTENT(in)::roughlenheatmethod
2177  INTEGER, INTENT(in)::snowuse
2178  INTEGER, INTENT(in)::id
2179  INTEGER, INTENT(in)::it !time: day of year and hour
2180  INTEGER, INTENT(in)::gsmodel !Choice of gs parameterisation (1 = Ja11, 2 = Wa16)
2181  INTEGER, INTENT(in)::smdmethod!Method of measured soil moisture
2182 
2183  ! REAL(KIND(1d0)), INTENT(in)::qh_obs
2184  REAL(KIND(1d0)), INTENT(in)::avdens
2185  REAL(KIND(1d0)), INTENT(in)::avcp
2186  REAL(KIND(1d0)), INTENT(in)::qh_init
2187  REAL(KIND(1d0)), INTENT(in)::zzd !Active measurement height (meas. height-displac. height)
2188  REAL(KIND(1d0)), INTENT(in)::z0m !Aerodynamic roughness length
2189  REAL(KIND(1d0)), INTENT(in)::zdm !Displacement height
2190  REAL(KIND(1d0)), INTENT(in)::avu1 !Average wind speed
2191  REAL(KIND(1d0)), INTENT(in)::temp_c !Air temperature
2192  REAL(KIND(1d0)), INTENT(in)::vegfraction!Fraction of vegetation
2193  REAL(KIND(1d0)), INTENT(in)::avkdn !Average downwelling shortwave radiation
2194  REAL(KIND(1d0)), INTENT(in)::kmax !Annual maximum hourly solar radiation
2195  REAL(KIND(1d0)), INTENT(in)::g1 !Fitted parameters related to surface res. calculations
2196  REAL(KIND(1d0)), INTENT(in)::g2 !Fitted parameters related to surface res. calculations
2197  REAL(KIND(1d0)), INTENT(in)::g3 !Fitted parameters related to surface res. calculations
2198  REAL(KIND(1d0)), INTENT(in)::g4 !Fitted parameters related to surface res. calculations
2199  REAL(KIND(1d0)), INTENT(in)::g5 !Fitted parameters related to surface res. calculations
2200  REAL(KIND(1d0)), INTENT(in)::g6 !Fitted parameters related to surface res. calculations
2201  REAL(KIND(1d0)), INTENT(in)::s1 !Fitted parameters related to surface res. calculations
2202  REAL(KIND(1d0)), INTENT(in)::s2 !Fitted parameters related to surface res. calculations
2203  REAL(KIND(1d0)), INTENT(in)::th !Maximum temperature limit
2204  REAL(KIND(1d0)), INTENT(in)::tl !Minimum temperature limit
2205  REAL(KIND(1d0)), INTENT(in)::dq !Specific humidity deficit
2206  REAL(KIND(1d0)), INTENT(in)::xsmd !Measured soil moisture deficit
2207  REAL(KIND(1d0)), INTENT(in)::vsmd !Soil moisture deficit for vegetated surfaces only (QUESTION: what about BSoil?)
2208 
2209  REAL(KIND(1d0)), DIMENSION(3), INTENT(in) ::maxconductance!Max conductance [mm s-1]
2210  REAL(KIND(1d0)), DIMENSION(3), INTENT(in) ::laimax !Max LAI [m2 m-2]
2211  REAL(KIND(1d0)), DIMENSION(3), INTENT(in) ::lai_id !=LAI_id(id-1,:), LAI for each veg surface [m2 m-2]
2212 
2213  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::snowfrac !Surface fraction of snow cover
2214  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in)::sfr !Surface fractions [-]
2215 
2216  REAL(KIND(1d0)), INTENT(out)::tstar !T*
2217  REAL(KIND(1d0)), INTENT(out) ::ustar !Friction velocity
2218  REAL(KIND(1d0)), INTENT(out) ::zl !
2219  REAL(KIND(1d0)), INTENT(out) ::gsc !Surface Layer Conductance
2220  REAL(KIND(1d0)), INTENT(out) ::resistsurf!Surface resistance
2221  REAL(KIND(1d0)), INTENT(out) ::ra !Aerodynamic resistance [s m^-1]
2222  REAL(KIND(1d0)), INTENT(out) ::rasnow !Aerodynamic resistance for snow [s m^-1]
2223  REAL(KIND(1d0)), INTENT(out) ::rb !boundary layer resistance shuttleworth
2224  REAL(KIND(1d0)), INTENT(out) ::l_mod !Obukhov length
2225  REAL(KIND(1d0)) ::gfunc !gdq*gtemp*gs*gq for photosynthesis calculations
2226  ! REAL(KIND(1d0)) ::H_init !Kinematic sensible heat flux [K m s-1] used to calculate friction velocity
2227 
2228  ! Get first estimate of sensible heat flux. Modified by HCW 26 Feb 2015
2229  ! CALL SUEWS_init_QH( &
2230  ! avdens, avcp, QH_init, qn1, dectime, &
2231  ! H_init)
2232 
2233  IF (diagnose == 1) WRITE (*, *) 'Calling STAB_lumps...'
2234  !u* and Obukhov length out
2235  CALL cal_stab( &
2236  stabilitymethod, & ! input
2237  zzd, & !Active measurement height (meas. height-displac. height)
2238  z0m, & !Aerodynamic roughness length
2239  zdm, & !zero-plane displacement
2240  avu1, & !Average wind speed
2241  temp_c, & !Air temperature
2242  qh_init, & !sensible heat flux
2243  avdens, & ! air density
2244  avcp, & ! heat capacity of air
2245  l_mod, &! output: !Obukhov length
2246  tstar, & !T*, temperature scale
2247  ustar, & !Friction velocity
2248  zl)!Stability scale
2249 
2250  IF (diagnose == 1) WRITE (*, *) 'Calling AerodynamicResistance...'
2251  CALL aerodynamicresistance( &
2252  zzd, &! input:
2253  z0m, &
2254  avu1, &
2255  l_mod, &
2256  ustar, &
2257  vegfraction, &
2258  aerodynamicresistancemethod, &
2259  stabilitymethod, &
2260  roughlenheatmethod, &
2261  ra) ! output:
2262 
2263  IF (snowuse == 1) THEN
2264  IF (diagnose == 1) WRITE (*, *) 'Calling AerodynamicResistance for snow...'
2265  CALL aerodynamicresistance( &
2266  zzd, &! input:
2267  z0m, &
2268  avu1, &
2269  l_mod, &
2270  ustar, &
2271  vegfraction, &
2272  aerodynamicresistancemethod, &
2273  stabilitymethod, &
2274  3, &
2275  rasnow) ! output:
2276  ENDIF
2277 
2278  IF (diagnose == 1) WRITE (*, *) 'Calling SurfaceResistance...'
2279  ! CALL SurfaceResistance(id,it) !qsc and surface resistance out
2280  CALL surfaceresistance( &
2281  id, it, &! input:
2282  smdmethod, snowfrac, sfr, avkdn, temp_c, dq, xsmd, vsmd, maxconductance, &
2283  laimax, lai_id, gsmodel, kmax, &
2284  g1, g2, g3, g4, g5, g6, th, tl, s1, s2, &
2285  gfunc, gsc, resistsurf)! output:
2286 
2287  IF (diagnose == 1) WRITE (*, *) 'Calling BoundaryLayerResistance...'
2288  CALL boundarylayerresistance( &
2289  zzd, &! input: !Active measurement height (meas. height- zero-plane displacement)
2290  z0m, & !Aerodynamic roughness length
2291  avu1, & !Average wind speed
2292  ustar, & ! input/output:
2293  rb) ! output:
2294 
real(kind(1d0)) g1
real(kind(1d0)) s2
integer gsmodel
real(kind(1d0)) g5
real(kind(1d0)) kmax
real(kind(1d0)), dimension(nvegsurf) laimax
real(kind(1d0)) th
real(kind(1d0)), dimension(nvegsurf) maxconductance
real(kind(1d0)) zdm
real(kind(1d0)) g2
real(kind(1d0)) zzd
real(kind(1d0)) g3
integer id
real(kind(1d0)) avcp
real(kind(1d0)) dq
real(kind(1d0)), dimension(nsurf) snowfrac
real(kind(1d0)) g4
real(kind(1d0)), dimension(nvegsurf) lai_id
real(kind(1d0)), dimension(nsurf) sfr
real(kind(1d0)) g6
integer it
real(kind(1d0)) z0m
real(kind(1d0)) tl
real(kind(1d0)) avdens
real(kind(1d0)) s1
Here is the call graph for this function:
Here is the caller graph for this function:

◆ suews_cal_sunposition()

subroutine suews_driver::suews_cal_sunposition ( real(kind(1d0)), intent(in)  year,
real(kind(1d0)), intent(in)  idectime,
real(kind(1d0)), intent(in)  UTC,
real(kind(1d0)), intent(in)  locationlatitude,
real(kind(1d0)), intent(in)  locationlongitude,
real(kind(1d0)), intent(in)  locationaltitude,
real(kind(1d0)), intent(out)  sunazimuth,
real(kind(1d0)), intent(out)  sunzenith 
)

Definition at line 3535 of file suews_ctrl_driver.f95.

References narp_module::narp_cal_sunposition().

3535  IMPLICIT NONE
3536 
3537  REAL(KIND(1D0)), INTENT(in) :: year, idectime, utc, &
3538  locationlatitude, locationlongitude, locationaltitude
3539  REAL(KIND(1D0)), INTENT(out) ::sunazimuth, sunzenith
3540 
3541  CALL narp_cal_sunposition( &
3542  year, idectime, utc, locationlatitude, locationlongitude, locationaltitude, &
3543  sunazimuth, sunzenith)
3544 
Here is the call graph for this function:

◆ suews_cal_surf()

subroutine suews_driver::suews_cal_surf ( real(kind(1d0)), dimension(nsurf), intent(in)  sfr,
real(kind(1d0)), intent(out)  vegfraction,
real(kind(1d0)), intent(out)  ImpervFraction,
real(kind(1d0)), intent(out)  PervFraction,
real(kind(1d0)), intent(out)  NonWaterFraction 
)

Definition at line 2609 of file suews_ctrl_driver.f95.

References allocatearray::bldgsurf, allocatearray::conifsurf, allocatearray::decidsurf, allocatearray::grasssurf, allocatearray::pavsurf, and allocatearray::watersurf.

Referenced by suews_cal_main().

2609  IMPLICIT NONE
2610 
2611  REAL(KIND(1D0)), DIMENSION(NSURF), INTENT(IN)::sfr
2612  REAL(KIND(1D0)), INTENT(OUT)::vegfraction
2613  REAL(KIND(1D0)), INTENT(OUT)::impervfraction
2614  REAL(KIND(1D0)), INTENT(OUT)::pervfraction
2615  REAL(KIND(1D0)), INTENT(OUT)::nonwaterfraction
2616 
2617  vegfraction = sfr(conifsurf) + sfr(decidsurf) + sfr(grasssurf)
2618  impervfraction = sfr(pavsurf) + sfr(bldgsurf)
2619  pervfraction = 1 - impervfraction
2620  nonwaterfraction = 1 - sfr(watersurf)
2621 
integer, parameter conifsurf
integer, parameter grasssurf
real(kind(1d0)), dimension(nsurf) sfr
integer, parameter decidsurf
integer, parameter pavsurf
integer, parameter bldgsurf
integer, parameter watersurf
Here is the caller graph for this function:

◆ suews_cal_water()

subroutine suews_driver::suews_cal_water ( integer, intent(in)  Diagnose,
integer, intent(in)  snowUse,
real(kind(1d0)), intent(in)  NonWaterFraction,
real(kind(1d0)), intent(in)  addPipes,
real(kind(1d0)), intent(in)  addImpervious,
real(kind(1d0)), intent(in)  addVeg,
real(kind(1d0)), intent(in)  addWaterBody,
real(kind(1d0)), dimension(nsurf), intent(in)  state_id,
real(kind(1d0)), dimension(nsurf), intent(in)  soilstore_id,
real(kind(1d0)), dimension(nsurf), intent(in)  sfr,
real(kind(1d0)), dimension(6, nsurf), intent(in)  StoreDrainPrm,
real(kind(1d0)), dimension(nsurf + 1, nsurf - 1), intent(in)  WaterDist,
real(kind(1d0)), intent(in)  nsh_real,
real(kind(1d0)), intent(out)  drain_per_tstep,
real(kind(1d0)), dimension(nsurf), intent(out)  drain,
real(kind(1d0)), dimension(nsurf), intent(out)  frac_water2runoff,
real(kind(1d0)), intent(out)  AdditionalWater,
real(kind(1d0)), intent(out)  runoffPipes,
real(kind(1d0)), intent(out)  runoff_per_interval,
real(kind(1d0)), dimension(nsurf), intent(out)  AddWater,
real(kind(1d0)), dimension(nsurf), intent(out)  stateOld,
real(kind(1d0)), dimension(nsurf), intent(out)  soilstoreOld 
)

Definition at line 1649 of file suews_ctrl_driver.f95.

References waterdist_module::drainage(), allocatearray::nsurf, waterdist_module::redistributewater(), and allocatearray::watersurf.

Referenced by suews_cal_main().

1649 
1650  IMPLICIT NONE
1651  ! INTEGER,PARAMETER :: nsurf=7! number of surface types
1652  ! INTEGER,PARAMETER ::WaterSurf = 7
1653  INTEGER, INTENT(in) ::diagnose
1654  INTEGER, INTENT(in) ::snowuse
1655 
1656  REAL(KIND(1d0)), INTENT(in)::nonwaterfraction
1657  REAL(KIND(1d0)), INTENT(in)::addpipes
1658  REAL(KIND(1d0)), INTENT(in)::addimpervious
1659  REAL(KIND(1d0)), INTENT(in)::addveg
1660  REAL(KIND(1d0)), INTENT(in)::addwaterbody
1661  REAL(KIND(1d0)), INTENT(in)::nsh_real !nsh cast as a real for use in calculations
1662 
1663  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in) ::state_id
1664  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in) ::soilstore_id
1665  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in) ::sfr
1666  REAL(KIND(1d0)), DIMENSION(6, nsurf), INTENT(in) ::storedrainprm
1667  REAL(KIND(1d0)), DIMENSION(nsurf + 1, nsurf - 1), INTENT(in)::waterdist
1668 
1669  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out):: drain !Drainage of surface type "is" [mm]
1670  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out):: frac_water2runoff!Fraction of water going to runoff/sub-surface soil (WGWaterDist) [-]
1671  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out):: addwater !water from other surfaces (WGWaterDist in SUEWS_ReDistributeWater.f95) [mm]
1672  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out):: stateold
1673  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(out):: soilstoreold
1674 
1675  REAL(KIND(1d0)), INTENT(out)::drain_per_tstep
1676  REAL(KIND(1d0)), INTENT(out)::additionalwater
1677  REAL(KIND(1d0)), INTENT(out)::runoffpipes
1678  REAL(KIND(1d0)), INTENT(out)::runoff_per_interval
1679  INTEGER:: is
1680 
1681  ! Retain previous surface state_id and soil moisture state_id
1682  stateold = state_id !state_id of each surface [mm] for the previous timestep
1683  soilstoreold = soilstore_id !Soil moisture of each surface [mm] for the previous timestep
1684 
1685  !============= Grid-to-grid runoff =============
1686  ! Calculate additional water coming from other grids
1687  ! i.e. the variables addImpervious, addVeg, addWaterBody, addPipes
1688  !call RunoffFromGrid(GridFromFrac) !!Need to code between-grid water transfer
1689 
1690  ! Sum water coming from other grids (these are expressed as depths over the whole surface)
1691  additionalwater = addpipes + addimpervious + addveg + addwaterbody ![mm]
1692 
1693  ! Initialise runoff in pipes
1694  runoffpipes = addpipes !Water flowing in pipes from other grids. QUESTION: No need for scaling?
1695  !! CHECK p_i
1696  runoff_per_interval = addpipes !pipe plor added to total runoff.
1697 
1698  !================== Drainage ===================
1699  ! Calculate drainage for each soil subsurface (excluding water body)
1700  IF (diagnose == 1) WRITE (*, *) 'Calling Drainage...'
1701 
1702  IF (nonwaterfraction /= 0) THEN !Soil states only calculated if soil exists. LJ June 2017
1703  DO is = 1, nsurf - 1
1704 
1705  CALL drainage( &
1706  is, &! input:
1707  state_id(is), &
1708  storedrainprm(6, is), &
1709  storedrainprm(2, is), &
1710  storedrainprm(3, is), &
1711  storedrainprm(4, is), &
1712  nsh_real, &
1713  drain(is))! output
1714 
1715  ! !HCW added and changed to StoreDrainPrm(6,is) here 20 Feb 2015
1716  ! drain_per_tstep=drain_per_tstep+(drain(is)*sfr(is)/NonWaterFraction) !No water body included
1717  ENDDO
1718  drain_per_tstep = dot_product(drain(1:nsurf - 1), sfr(1:nsurf - 1))/nonwaterfraction !No water body included
1719  ELSE
1720  drain(1:nsurf - 1) = 0
1721  drain_per_tstep = 0
1722  ENDIF
1723 
1724  drain(watersurf) = 0 ! Set drainage from water body to zero
1725 
1726  ! Distribute water within grid, according to WithinGridWaterDist matrix (Cols 1-7)
1727  IF (diagnose == 1) WRITE (*, *) 'Calling ReDistributeWater...'
1728  ! CALL ReDistributeWater
1729  !Calculates AddWater(is)
1730  CALL redistributewater( &
1731  snowuse, waterdist, sfr, drain, &! input:
1732  frac_water2runoff, addwater)! output
1733 
real(kind(1d0)), dimension(nsurf) state_id
real(kind(1d0)), dimension(nsurf) drain
real(kind(1d0)), dimension(nsurf) soilstore_id
integer, parameter nsurf
real(kind(1d0)), dimension(nsurf) stateold
real(kind(1d0)), dimension(nsurf) addwater
real(kind(1d0)), dimension(6, nsurf) storedrainprm
real(kind(1d0)), dimension(nsurf) sfr
integer, parameter watersurf
real(kind(1d0)), dimension(nsurf) soilstoreold
real(kind(1d0)), dimension(nsurf+1, nsurf - 1) waterdist
Here is the call graph for this function:
Here is the caller graph for this function:

◆ suews_init_qh()

subroutine suews_driver::suews_init_qh ( real(kind(1d0)), intent(in)  avdens,
real(kind(1d0)), intent(in)  avcp,
real(kind(1d0)), intent(in)  h_mod,
real(kind(1d0)), intent(in)  qn1,
real(kind(1d0)), intent(in)  dectime,
real(kind(1d0)), intent(out)  H_init 
)

Definition at line 1741 of file suews_ctrl_driver.f95.

References errorhint().

1741 
1742  IMPLICIT NONE
1743  ! REAL(KIND(1d0)), INTENT(in)::qh_obs
1744  REAL(KIND(1d0)), INTENT(in)::avdens
1745  REAL(KIND(1d0)), INTENT(in)::avcp
1746  REAL(KIND(1d0)), INTENT(in)::h_mod
1747  REAL(KIND(1d0)), INTENT(in)::qn1
1748  REAL(KIND(1d0)), INTENT(in)::dectime
1749  REAL(KIND(1d0)), INTENT(out)::h_init
1750 
1751  REAL(KIND(1d0)), PARAMETER::nan = -999
1752  INTEGER, PARAMETER::notusedi = -999
1753 
1754  ! Calculate kinematic heat flux (w'T') from sensible heat flux [W m-2] from observed data (if available) or LUMPS
1755  ! IF (qh_obs /= NAN) THEN !if(qh_obs/=NAN) qh=qh_obs !Commented out by HCW 04 Mar 2015
1756  ! H_init = qh_obs/(avdens*avcp) !Use observed value
1757  ! ELSE
1758  IF (h_mod /= nan) THEN
1759  h_init = h_mod/(avdens*avcp) !Use LUMPS value
1760  ELSE
1761  h_init = (qn1*0.2)/(avdens*avcp) !If LUMPS has had a problem, we still need a value
1762  CALL errorhint(38, 'LUMPS unable to calculate realistic value for H_mod.', h_mod, dectime, notusedi)
1763  ENDIF
1764  ! ENDIF
1765 
real(kind(1d0)) nan
real(kind(1d0)) avcp
real(kind(1d0)) dectime
real(kind(1d0)) avdens
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:

◆ suews_update_output()

subroutine suews_driver::suews_update_output ( integer, intent(in)  SnowUse,
integer, intent(in)  storageheatmethod,
integer, intent(in)  ReadLinesMetdata,
integer, intent(in)  NumberOfGrids,
integer, intent(in)  ir,
integer, intent(in)  gridiv,
real(kind(1d0)), dimension(5), intent(in)  datetimeLine,
real(kind(1d0)), dimension(ncolumnsdataoutsuews - 5), intent(in)  dataOutLineSUEWS,
real(kind(1d0)), dimension(ncolumnsdataoutsnow - 5), intent(in)  dataOutLineSnow,
real(kind(1d0)), dimension(ncolumnsdataoutestm - 5), intent(in)  dataOutLineESTM,
real(kind(1d0)), dimension(ncolumnsdataoutrsl - 5), intent(in)  dataoutLineRSL,
real(kind(1d0)), dimension(ncolumnsdataoutsol - 5), intent(in)  dataOutLineSOLWEIG,
real(kind(1d0)), dimension(readlinesmetdata, ncolumnsdataoutsuews, numberofgrids), intent(inout)  dataOutSUEWS,
real(kind(1d0)), dimension(readlinesmetdata, ncolumnsdataoutsnow, numberofgrids), intent(inout)  dataOutSnow,
real(kind(1d0)), dimension(readlinesmetdata, ncolumnsdataoutestm, numberofgrids), intent(inout)  dataOutESTM,
real(kind(1d0)), dimension(readlinesmetdata, ncolumnsdataoutrsl, numberofgrids), intent(inout)  dataOutRSL,
real(kind(1d0)), dimension(readlinesmetdata, ncolumnsdataoutrsl, numberofgrids), intent(inout)  dataOutSOLWEIG 
)

Definition at line 2493 of file suews_ctrl_driver.f95.

References allocatearray::ncolumnsdataoutestm, allocatearray::ncolumnsdataoutrsl, allocatearray::ncolumnsdataoutsnow, allocatearray::ncolumnsdataoutsol, allocatearray::ncolumnsdataoutsuews, and set_nan().

Referenced by suews_cal_multitsteps(), and suews_calculations().

2493  IMPLICIT NONE
2494 
2495  INTEGER, INTENT(in) ::readlinesmetdata
2496  INTEGER, INTENT(in) ::numberofgrids
2497  INTEGER, INTENT(in) ::gridiv
2498  INTEGER, INTENT(in) ::snowuse
2499  INTEGER, INTENT(in) ::storageheatmethod
2500  INTEGER, INTENT(in) ::ir
2501 
2502  REAL(KIND(1d0)), DIMENSION(5), INTENT(in) :: datetimeline
2503  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutSUEWS - 5), INTENT(in) :: dataoutlinesuews
2504  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutESTM - 5), INTENT(in) :: dataoutlineestm
2505  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutSnow - 5), INTENT(in) :: dataoutlinesnow
2506  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutRSL - 5), INTENT(in) :: dataoutlinersl
2507  REAL(KIND(1d0)), DIMENSION(ncolumnsdataOutSOL - 5), INTENT(in) :: dataoutlinesolweig
2508 
2509  REAL(KIND(1d0)), INTENT(inout) :: dataoutsuews(readlinesmetdata, ncolumnsdataoutsuews, numberofgrids)
2510  REAL(KIND(1d0)), INTENT(inout) :: dataoutsnow(readlinesmetdata, ncolumnsdataoutsnow, numberofgrids)
2511  REAL(KIND(1d0)), INTENT(inout) :: dataoutestm(readlinesmetdata, ncolumnsdataoutestm, numberofgrids)
2512  REAL(KIND(1d0)), INTENT(inout) :: dataoutrsl(readlinesmetdata, ncolumnsdataoutrsl, numberofgrids)
2513  REAL(KIND(1d0)), INTENT(inout) :: dataoutsolweig(readlinesmetdata, ncolumnsdataoutrsl, numberofgrids)
2514 
2515  !====================== update output arrays ==============================
2516  !Define the overall output matrix to be printed out step by step
2517  dataoutsuews(ir, 1:ncolumnsdataoutsuews, gridiv) = [datetimeline, set_nan(dataoutlinesuews)]
2518  dataoutrsl(ir, 1:ncolumnsdataoutrsl, gridiv) = [datetimeline, set_nan(dataoutlinersl)]
2520  ! ! set invalid values to NAN
2521  ! dataOutSUEWS(ir,6:ncolumnsDataOutSUEWS,Gridiv)=set_nan(dataOutSUEWS(ir,6:ncolumnsDataOutSUEWS,Gridiv))
2522 
2523  IF (snowuse == 1) THEN
2524  dataoutsnow(ir, 1:ncolumnsdataoutsnow, gridiv) = [datetimeline, set_nan(dataoutlinesnow)]
2525  END IF
2526 
2527  IF (storageheatmethod == 4) THEN
2528  dataoutestm(ir, 1:ncolumnsdataoutestm, gridiv) = [datetimeline, set_nan(dataoutlineestm)]
2529  END IF
2530 
2531  !====================update output arrays end==============================
2532 
integer, parameter ncolumnsdataoutestm
real(kind(1d0)), dimension(:, :, :), allocatable dataoutestm
real(kind(1d0)), dimension(ncolumnsdataoutrsl - 5) dataoutlinersl
real(kind(1d0)), dimension(ncolumnsdataoutsuews - 5) dataoutlinesuews
real(kind(1d0)), dimension(27) dataoutlineestm
integer, parameter ncolumnsdataoutsol
real(kind(1d0)), dimension(ncolumnsdataoutsnow - 5) dataoutlinesnow
integer, parameter ncolumnsdataoutrsl
integer, parameter ncolumnsdataoutsnow
real(kind(1d0)), dimension(:, :, :), allocatable dataoutsuews
real(kind(1d0)), dimension(:, :, :), allocatable dataoutrsl
integer, parameter ncolumnsdataoutsuews
real(kind(1d0)), dimension(:, :, :), allocatable dataoutsnow
integer readlinesmetdata
real(kind(1d0)), dimension(:, :, :), allocatable dataoutsolweig
real(kind(1d0)), dimension(5) datetimeline
real(kind(1d0)), dimension(ncolumnsdataoutsol - 5) dataoutlinesolweig
Here is the call graph for this function:
Here is the caller graph for this function:

◆ suews_update_outputline()

subroutine suews_driver::suews_update_outputline ( real(kind(1d0)), intent(in)  AdditionalWater,
real(kind(1d0)), dimension(nsurf), intent(in)  alb,
real(kind(1d0)), intent(in)  avkdn,
real(kind(1d0)), intent(in)  avU10_ms,
real(kind(1d0)), intent(in)  azimuth,
real(kind(1d0)), intent(in)  chSnow_per_interval,
real(kind(1d0)), intent(in)  dectime,
real(kind(1d0)), intent(in)  drain_per_tstep,
real(kind(1d0)), intent(in)  E_mod,
real(kind(1d0)), intent(in)  ev_per_tstep,
real(kind(1d0)), intent(in)  ext_wu,
real(kind(1d0)), intent(in)  Fc,
real(kind(1d0)), intent(in)  Fc_build,
real(kind(1d0)), intent(in)  fcld,
real(kind(1d0)), intent(in)  Fc_metab,
real(kind(1d0)), intent(in)  Fc_photo,
real(kind(1d0)), intent(in)  Fc_respi,
real(kind(1d0)), intent(in)  Fc_point,
real(kind(1d0)), intent(in)  Fc_traff,
real(kind(1d0)), intent(in)  FlowChange,
real(kind(1d0)), intent(in)  h_mod,
integer, intent(in)  id,
integer, intent(in)  imin,
real(kind(1d0)), intent(in)  int_wu,
integer, intent(in)  it,
integer, intent(in)  iy,
real(kind(1d0)), intent(in)  kup,
real(kind(1d0)), dimension(nvegsurf), intent(in)  LAI_id,
real(kind(1d0)), intent(in)  ldown,
real(kind(1d0)), intent(in)  l_mod,
real(kind(1d0)), intent(in)  lup,
real(kind(1d0)), intent(in)  mwh,
real(kind(1d0)), intent(in)  MwStore,
real(kind(1d0)), intent(in)  nsh_real,
real(kind(1d0)), intent(in)  NWstate_per_tstep,
real(kind(1d0)), intent(in)  Precip,
real(kind(1d0)), intent(in)  q2_gkg,
real(kind(1d0)), intent(in)  qeOut,
real(kind(1d0)), intent(in)  qf,
real(kind(1d0)), intent(in)  qh,
real(kind(1d0)), intent(in)  qh_resist,
real(kind(1d0)), intent(in)  Qm,
real(kind(1d0)), intent(in)  QmFreez,
real(kind(1d0)), intent(in)  QmRain,
real(kind(1d0)), intent(in)  qn1,
real(kind(1d0)), intent(in)  qn1_S,
real(kind(1d0)), intent(in)  qn1_snowfree,
real(kind(1d0)), intent(in)  qs,
real(kind(1d0)), intent(in)  RA,
real(kind(1d0)), intent(in)  resistsurf,
real(kind(1d0)), intent(in)  RH2,
real(kind(1d0)), intent(in)  runoffAGimpervious,
real(kind(1d0)), intent(in)  runoffAGveg,
real(kind(1d0)), intent(in)  runoff_per_tstep,
real(kind(1d0)), intent(in)  runoffPipes,
real(kind(1d0)), intent(in)  runoffSoil_per_tstep,
real(kind(1d0)), intent(in)  runoffWaterBody,
real(kind(1d0)), dimension(nsurf), intent(in)  sfr,
real(kind(1d0)), intent(in)  smd,
real(kind(1d0)), dimension(nsurf), intent(in)  smd_nsurf,
real(kind(1d0)), intent(in)  SnowAlb,
real(kind(1d0)), dimension(2), intent(in)  SnowRemoval,
real(kind(1d0)), dimension(nsurf), intent(in)  state_id,
real(kind(1d0)), intent(in)  state_per_tstep,
real(kind(1d0)), intent(in)  surf_chang_per_tstep,
real(kind(1d0)), intent(in)  swe,
real(kind(1d0)), intent(in)  t2_C,
real(kind(1d0)), intent(in)  tskin_C,
real(kind(1d0)), intent(in)  tot_chang_per_tstep,
real(kind(1d0)), intent(in)  tsurf,
real(kind(1d0)), intent(in)  UStar,
real(kind(1d0)), dimension(nsurf), intent(in)  wu_nsurf,
real(kind(1d0)), intent(in)  z0m,
real(kind(1d0)), intent(in)  zdm,
real(kind(1d0)), intent(in)  zenith_deg,
real(kind(1d0)), dimension(5), intent(out)  datetimeLine,
real(kind(1d0)), dimension(ncolumnsdataoutsuews - 5), intent(out)  dataOutLineSUEWS 
)

Definition at line 2318 of file suews_ctrl_driver.f95.

References allocatearray::nsurf, and allocatearray::nvegsurf.

Referenced by suews_cal_main().

2318  IMPLICIT NONE
2319 
2320  REAL(KIND(1d0)), PARAMETER :: nan = -999
2321  INTEGER, INTENT(in) :: iy
2322  ! INTEGER,INTENT(in) :: iy_prev_t
2323  INTEGER, INTENT(in) :: id
2324  ! INTEGER,INTENT(in) :: id_prev_t
2325  INTEGER, INTENT(in) :: it
2326  INTEGER, INTENT(in) :: imin
2327  ! INTEGER, INTENT(in) :: Gridiv
2328  REAL(KIND(1d0)), INTENT(in) :: additionalwater
2329  REAL(KIND(1d0)), INTENT(in) :: alb(nsurf)
2330  REAL(KIND(1d0)), INTENT(in) :: avkdn
2331  REAL(KIND(1d0)), INTENT(in) :: avu10_ms
2332  REAL(KIND(1d0)), INTENT(in) :: azimuth
2333  REAL(KIND(1d0)), INTENT(in) :: chsnow_per_interval
2334  REAL(KIND(1d0)), INTENT(in) :: dectime
2335  REAL(KIND(1d0)), INTENT(in) :: drain_per_tstep
2336  REAL(KIND(1d0)), INTENT(in) :: e_mod
2337  REAL(KIND(1d0)), INTENT(in) :: ev_per_tstep
2338  REAL(KIND(1d0)), INTENT(in) :: ext_wu
2339  REAL(KIND(1d0)), INTENT(in) :: fc
2340  REAL(KIND(1d0)), INTENT(in) :: fc_build
2341  REAL(KIND(1d0)), INTENT(in) :: fc_metab
2342  REAL(KIND(1d0)), INTENT(in) :: fc_photo
2343  REAL(KIND(1d0)), INTENT(in) :: fc_respi
2344  REAL(KIND(1d0)), INTENT(in) :: fc_point
2345  REAL(KIND(1d0)), INTENT(in) :: fc_traff
2346  REAL(KIND(1d0)), INTENT(in) :: fcld
2347  REAL(KIND(1d0)), INTENT(in) :: flowchange
2348  REAL(KIND(1d0)), INTENT(in) :: h_mod
2349  REAL(KIND(1d0)), INTENT(in) :: int_wu
2350  REAL(KIND(1d0)), INTENT(in) :: kup
2351  REAL(KIND(1d0)), INTENT(in) :: l_mod
2352  REAL(KIND(1d0)), INTENT(in) :: lai_id(nvegsurf)
2353  REAL(KIND(1d0)), INTENT(in) :: ldown
2354  REAL(KIND(1d0)), INTENT(in) :: lup
2355  REAL(KIND(1d0)), INTENT(in) :: mwh
2356  REAL(KIND(1d0)), INTENT(in) :: mwstore
2357  REAL(KIND(1d0)), INTENT(in) :: nsh_real
2358  REAL(KIND(1d0)), INTENT(in) :: nwstate_per_tstep
2359  REAL(KIND(1d0)), INTENT(in) :: precip
2360  REAL(KIND(1d0)), INTENT(in) :: q2_gkg
2361  REAL(KIND(1d0)), INTENT(in) :: qeout
2362  REAL(KIND(1d0)), INTENT(in) :: qf
2363  REAL(KIND(1d0)), INTENT(in) :: qh
2364  REAL(KIND(1d0)), INTENT(in) :: qh_resist
2365  REAL(KIND(1d0)), INTENT(in) :: qm
2366  REAL(KIND(1d0)), INTENT(in) :: qmfreez
2367  REAL(KIND(1d0)), INTENT(in) :: qmrain
2368  REAL(KIND(1d0)), INTENT(in) :: qn1
2369  REAL(KIND(1d0)), INTENT(in) :: qn1_s
2370  REAL(KIND(1d0)), INTENT(in) :: qn1_snowfree
2371  REAL(KIND(1d0)), INTENT(in) :: qs
2372  REAL(KIND(1d0)), INTENT(in) :: ra
2373  REAL(KIND(1d0)), INTENT(in) :: resistsurf
2374  REAL(KIND(1d0)), INTENT(in) :: rh2
2375  REAL(KIND(1d0)), INTENT(in) :: runoff_per_tstep
2376  REAL(KIND(1d0)), INTENT(in) :: runoffagimpervious
2377  REAL(KIND(1d0)), INTENT(in) :: runoffagveg
2378  REAL(KIND(1d0)), INTENT(in) :: runoffpipes
2379  REAL(KIND(1d0)), INTENT(in) :: runoffsoil_per_tstep
2380  REAL(KIND(1d0)), INTENT(in) :: runoffwaterbody
2381  REAL(KIND(1d0)), INTENT(in) :: sfr(nsurf)
2382  REAL(KIND(1d0)), INTENT(in) :: smd
2383  REAL(KIND(1d0)), INTENT(in) :: smd_nsurf(nsurf)
2384  REAL(KIND(1d0)), INTENT(in) :: snowalb
2385  REAL(KIND(1d0)), INTENT(in) :: snowremoval(2)
2386  REAL(KIND(1d0)), INTENT(in) :: state_id(nsurf)
2387  REAL(KIND(1d0)), INTENT(in) :: state_per_tstep
2388  REAL(KIND(1d0)), INTENT(in) :: surf_chang_per_tstep
2389  REAL(KIND(1d0)), INTENT(in) :: swe
2390  REAL(KIND(1d0)), INTENT(in) :: t2_c
2391  REAL(KIND(1d0)), INTENT(in) :: tskin_c
2392  REAL(KIND(1d0)), INTENT(in) :: tot_chang_per_tstep
2393  REAL(KIND(1d0)), INTENT(in) :: tsurf
2394  REAL(KIND(1d0)), INTENT(in) :: ustar
2395  REAL(KIND(1d0)), DIMENSION(nsurf), INTENT(in) :: wu_nsurf
2396 
2397  REAL(KIND(1d0)), INTENT(in) :: z0m
2398  REAL(KIND(1d0)), INTENT(in) :: zdm
2399  REAL(KIND(1d0)), INTENT(in) :: zenith_deg
2400 
2401  REAL(KIND(1D0)), DIMENSION(5), INTENT(OUT)::datetimeline
2402  REAL(KIND(1d0)), DIMENSION(ncolumnsDataOutSUEWS - 5), INTENT(out) :: dataoutlinesuews
2403  ! REAL(KIND(1d0)),DIMENSION(ncolumnsDataOutSnow-5),INTENT(out) :: dataOutLineSnow
2404  ! REAL(KIND(1d0)),DIMENSION(ncolumnsDataOutESTM-5),INTENT(out) :: dataOutLineESTM
2405  ! INTEGER:: is
2406  REAL(KIND(1d0)):: lai_wt
2407  REAL(KIND(1d0)):: rh2_pct ! RH2 in percentage
2408 
2409  ! the variables below with '_x' endings stand for 'exported' values
2410  REAL(KIND(1d0))::resistsurf_x
2411  REAL(KIND(1d0))::l_mod_x
2412  REAL(KIND(1d0))::bulkalbedo
2413  REAL(KIND(1d0))::smd_nsurf_x(nsurf)
2414  REAL(KIND(1d0))::state_x(nsurf)
2415  REAL(KIND(1d0)):: wu_dectr
2416  REAL(KIND(1d0)):: wu_evetr
2417  REAL(KIND(1d0)):: wu_grass
2418 
2419  !=====================================================================
2420  !====================== Prepare data for output ======================
2421  ! values outside of reasonable range are set as NAN-like numbers. TS 10 Jun 2018
2422 
2423  ! Remove non-existing surface type from surface and soil outputs ! Added back in with NANs by HCW 24 Aug 2016
2424  state_x = unpack(spread(nan, dim=1, ncopies=SIZE(sfr)), mask=(sfr < 0.00001), field=state_id)
2425  smd_nsurf_x = unpack(spread(nan, dim=1, ncopies=SIZE(sfr)), mask=(sfr < 0.00001), field=smd_nsurf)
2426 
2427  resistsurf_x = min(9999., resistsurf)
2428 
2429  l_mod_x = max(min(9999., l_mod), -9999.)
2430 
2431  ! Calculate areally-weighted LAI
2432  ! IF(iy == (iy_prev_t +1) .AND. (id-1) == 0) THEN !Check for start of next year and avoid using LAI(id-1) as this is at the start of the year
2433  ! LAI_wt=DOT_PRODUCT(LAI(id_prev_t,:),sfr(1+2:nvegsurf+2))
2434  ! ELSE
2435  ! LAI_wt=DOT_PRODUCT(LAI(id-1,:),sfr(1+2:nvegsurf+2))
2436  ! ENDIF
2437 
2438  lai_wt = dot_product(lai_id(:), sfr(1 + 2:nvegsurf + 2))
2439 
2440  ! Calculate areally-weighted albedo
2441  bulkalbedo = dot_product(alb, sfr)
2442 
2443  ! convert RH2 to a percentage form
2444  rh2_pct = rh2*100.0
2445 
2446  ! translate water use to vegetated surfaces
2447  wu_dectr = wu_nsurf(3)
2448  wu_evetr = wu_nsurf(4)
2449  wu_grass = wu_nsurf(5)
2450 
2451  !====================== update output line ==============================
2452  ! date & time:
2453  datetimeline = [ &
2454  REAL(iy, KIND(1D0)), REAL(id, KIND(1D0)), &
2455  REAL(it, KIND(1D0)), REAL(imin, KIND(1D0)), dectime]
2456  !Define the overall output matrix to be printed out step by step
2457  dataoutlinesuews = [ &
2458  avkdn, kup, ldown, lup, tsurf, &
2459  qn1, qf, qs, qh, qeout, &
2460  h_mod, e_mod, qh_resist, &
2461  precip, ext_wu, ev_per_tstep, runoff_per_tstep, tot_chang_per_tstep, &
2462  surf_chang_per_tstep, state_per_tstep, nwstate_per_tstep, drain_per_tstep, smd, &
2463  flowchange/nsh_real, additionalwater, &
2464  runoffsoil_per_tstep, runoffpipes, runoffagimpervious, runoffagveg, runoffwaterbody, &
2465  int_wu, wu_evetr, wu_dectr, wu_grass, &
2466  smd_nsurf_x(1:nsurf - 1), &
2467  state_x(1:nsurf), &
2468  zenith_deg, azimuth, bulkalbedo, fcld, &
2469  lai_wt, z0m, zdm, &
2470  ustar, l_mod, ra, resistsurf, &
2471  fc, &
2472  fc_photo, fc_respi, fc_metab, fc_traff, fc_build, fc_point, &
2473  qn1_snowfree, qn1_s, snowalb, &
2474  qm, qmfreez, qmrain, swe, mwh, mwstore, chsnow_per_interval, &
2475  snowremoval(1:2), &
2476  tskin_c, t2_c, q2_gkg, avu10_ms, rh2_pct & ! surface-level diagonostics
2477  ]
2478  ! set invalid values to NAN
2479  ! dataOutLineSUEWS = set_nan(dataOutLineSUEWS)
2480 
2481  !====================update output line end==============================
2482 
real(kind(1d0)), dimension(nsurf) state_id
real(kind(1d0)) mwstore
real(kind(1d0)) nan
real(kind(1d0)) snowalb
real(kind(1d0)) bulkalbedo
real(kind(1d0)), dimension(ncolumnsdataoutsuews - 5) dataoutlinesuews
real(kind(1d0)) zdm
integer, parameter nsurf
real(kind(1d0)) qm
integer id
integer imin
real(kind(1d0)), dimension(2) snowremoval
real(kind(1d0)) mwh
integer iy
real(kind(1d0)) qmrain
integer, parameter nvegsurf
real(kind(1d0)) qmfreez
real(kind(1d0)), dimension(nvegsurf) lai_id
real(kind(1d0)), dimension(nsurf) sfr
real(kind(1d0)), dimension(nsurf) smd_nsurf
integer it
real(kind(1d0)) z0m
real(kind(1d0)) dectime
real(kind(1d0)), dimension(nsurf) alb
real(kind(1d0)) swe
real(kind(1d0)), dimension(5) datetimeline
Here is the caller graph for this function: