SUEWS API Site
Documentation of SUEWS source code
Modules | Functions/Subroutines | Variables
suews_ctrl_input.f95 File Reference

Go to the source code of this file.

Modules

module  run_info
 
module  metdisagg
 

Functions/Subroutines

subroutine metread (lfn, MetArray, InputmetFormat, ldown_option, NetRadiationMethod, snowUse, SMDMethod, SoilDepthMeas, SoilRocks, SoilDensity, SmCap)
 
subroutine run_control (eval, LowerLimit, Upperlimit)
 
subroutine skipheader (lfn, skip)
 
subroutine inputheadercheck (FileName)
 
real(kind(1d0)) function get_prof_spectime_inst (Hour, Min, Sec, Prof_24h)
 
real(kind(1d0)) function get_prof_spectime_mean (Hour, Min, Sec, Prof_24h)
 
real(kind(1d0)) function get_prof_spectime_sum (Hour, Min, Sec, Prof_24h, dt)
 
subroutine codematchohm (Gridiv, is, SWWD)
 
subroutine codematchestm (Gridiv, is)
 
subroutine codematchestm_class (Gridiv, is, ii)
 
subroutine codematchprof (Gridiv, SurfaceCharCodeCol)
 
subroutine codematchdist (rr, CodeCol, codeColSameSurf)
 
subroutine codematchnonveg (rr, CodeCol)
 
subroutine codematchveg (rr, CodeCol)
 
subroutine codematchwater (rr, CodeCol)
 
subroutine codematchsnow (rr, CodeCol)
 
subroutine codematchconductance (rr, CodeCol)
 
subroutine codematchanthropogenic (rr, CodeCol)
 
subroutine codematchirrigation (rr, CodeCol)
 
subroutine codematchsoil (Gridiv, SurfaceCharCodeCol)
 
subroutine codematchbiogen (Gridiv, SurfaceCharCodeCol)
 
subroutine metdisagg::disaggregatemet (iBlock, igrid)
 
subroutine metdisagg::disaggregateestm (iBlock)
 
subroutine metdisagg::disaggregatedatetime (DateTimeForDisagg, tstep, Nper, ReadLinesOrigMetDataMax, DateTimeDscd)
 
real(kind(1d0)) function, dimension(readlinesorig_loc *nper_loc) metdisagg::disagg_lin (Slow, SlowPrev, SlowNext, DisaggType, Nper_loc, ReadLinesOrig_loc, ReadLinesOrigMax_loc, iBlock)
 
real(kind(1d0)) function, dimension(readlinesorig_loc *nper_loc) metdisagg::disaggp_amongn (Slow, amongN, Nper_loc, ReadLinesOrig_loc, ReadLinesOrigMax_loc)
 
real(kind(1d0)) function, dimension(readlinesorig_loc *nper_loc) metdisagg::disaggp_amongnmult (Slow, multupperI, multamongN, Nper_loc, ReadLinesOrig_loc, ReadLinesOrigMax_loc)
 
integer function, dimension(:), allocatable metdisagg::randomsamples (N, OutOf)
 

Variables

character(len=90), dimension(14) run_info::text
 
integer run_info::lim0 = 0
 
integer run_info::lim1 = 1
 
integer run_info::lim2 = 2
 
integer run_info::lim4 = 4
 
integer run_info::lim3 = 3
 
integer run_info::lim6 = 6
 
integer run_info::lim8 = 8
 
integer run_info::lim12 = 12
 
integer run_info::lfn_us
 
logical run_info::file_qs
 

Function/Subroutine Documentation

◆ codematchanthropogenic()

subroutine codematchanthropogenic ( integer  rr,
integer  CodeCol 
)

Definition at line 1229 of file suews_ctrl_input.f95.

References allocatearray::anthropogenic_coeff, colnamesinputfiles::ca_code, errorhint(), initial::iv5, initial::nlinesanthropogenic, defaultnotused::notused, defaultnotused::notusedi, and allocatearray::siteselect.

Referenced by initializesurfacecharacteristics().

1229  ! Matches AnthropogenicHeat characteristics via codes in SiteSelect
1230  ! HCW 20 Nov 2014
1231  ! MH 21 Jun 2017
1232  ! ---------------------------------------------------------
1233 
1234  USE allocatearray
1235  USE initial
1236  USE colnamesinputfiles
1237  USE defaultnotused
1238 
1239  IMPLICIT NONE
1240 
1241  INTEGER:: rr
1242  INTEGER:: codecol
1243 
1244  iv5 = 0 ! Reset iv5 to zero
1245 
1246  DO iv5 = 1, nlinesanthropogenic
1247  IF (anthropogenic_coeff(iv5, ca_code) == siteselect(rr, codecol)) THEN
1248  EXIT
1249  ELSEIF (iv5 == nlinesanthropogenic) THEN
1250  WRITE (*, *) 'Program stopped! Anthropogenic code ', siteselect(rr, codecol), &
1251  'not found in SUEWS_AnthropogenicEmission.txt.'
1252  CALL errorhint(57, 'Cannot find code in SUEWS_AnthropogenicEmission.txt', &
1253  siteselect(rr, codecol), notused, notusedi)
1254  ENDIF
1255  ENDDO
1256 
1257  RETURN
real(kind(1d0)) notused
integer nlinesanthropogenic
real(kind(1d0)), dimension(:, :), allocatable siteselect
real(kind(1d0)), dimension(:, :), allocatable anthropogenic_coeff
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchbiogen()

subroutine codematchbiogen ( integer  Gridiv,
integer  SurfaceCharCodeCol 
)

Definition at line 1322 of file suews_ctrl_input.f95.

References allocatearray::biogen_coeff, colnamesinputfiles::cb_code, errorhint(), initial::iv5, initial::nlinesbiogen, defaultnotused::notused, defaultnotused::notusedi, and allocatearray::surfacechar.

Referenced by initializesurfacecharacteristics().

1322  ! Matches Biogen characteristics via codes in *SuraceChar*
1323  ! MH 16 Jun 2017
1324  ! ---------------------------------------------------------
1325 
1326  USE allocatearray
1327  USE initial
1328  USE colnamesinputfiles
1329  USE defaultnotused
1330 
1331  IMPLICIT NONE
1332 
1333  INTEGER:: gridiv
1334  INTEGER:: surfacecharcodecol
1335 
1336  iv5 = 0 ! Reset iv5 to zero
1337 
1338  DO iv5 = 1, nlinesbiogen
1339  IF (biogen_coeff(iv5, cb_code) == surfacechar(gridiv, surfacecharcodecol)) THEN
1340  EXIT
1341  ELSEIF (iv5 == nlinesbiogen) THEN
1342  WRITE (*, *) 'Program stopped! Biogen code ', surfacechar(gridiv, surfacecharcodecol), 'not found in SUEWS_BiogenCO2.txt.'
1343  CALL errorhint(57, 'Cannot find code in SUEWS_BiogenCO2.txt', surfacechar(gridiv, surfacecharcodecol), notused, notusedi)
1344  ENDIF
1345  ENDDO
1346 
1347  RETURN
real(kind(1d0)) notused
real(kind(1d0)), dimension(:, :), allocatable surfacechar
real(kind(1d0)), dimension(:, :), allocatable biogen_coeff
integer nlinesbiogen
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchconductance()

subroutine codematchconductance ( integer  rr,
integer  CodeCol 
)

Definition at line 1199 of file suews_ctrl_input.f95.

References colnamesinputfiles::cc_code, allocatearray::conductance_coeff, errorhint(), initial::iv5, initial::nlinesconductance, defaultnotused::notused, defaultnotused::notusedi, and allocatearray::siteselect.

Referenced by initializesurfacecharacteristics().

1199  ! Matches Conductance characteristics via codes in SiteSelect
1200  ! HCW 20 Nov 2014
1201  ! ---------------------------------------------------------
1202 
1203  USE allocatearray
1204  USE initial
1205  USE colnamesinputfiles
1206  USE defaultnotused
1207 
1208  IMPLICIT NONE
1209 
1210  INTEGER:: rr
1211  INTEGER:: codecol
1212 
1213  iv5 = 0 ! Reset iv5 to zero
1214 
1215  DO iv5 = 1, nlinesconductance
1216  IF (conductance_coeff(iv5, cc_code) == siteselect(rr, codecol)) THEN
1217  EXIT
1218  ELSEIF (iv5 == nlinesconductance) THEN
1219  WRITE (*, *) 'Program stopped! Conductance code ', siteselect(rr, codecol), 'not found in SUEWS_Conductance.txt.'
1220  CALL errorhint(57, 'Cannot find code in SUEWS_Conductance.txt', siteselect(rr, codecol), notused, notusedi)
1221  ENDIF
1222  ENDDO
1223 
1224  RETURN
real(kind(1d0)) notused
integer nlinesconductance
real(kind(1d0)), dimension(:, :), allocatable siteselect
real(kind(1d0)), dimension(:, :), allocatable conductance_coeff
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchdist()

subroutine codematchdist ( integer  rr,
integer  CodeCol,
integer  codeColSameSurf 
)

Definition at line 1020 of file suews_ctrl_input.f95.

References colnamesinputfiles::c_wgwatercode, colnamesinputfiles::cwg_code, colnamesinputfiles::cwg_topaved, colnamesinputfiles::cwg_torunoff, colnamesinputfiles::cwg_tosoilstore, errorhint(), initial::iv5, initial::nlineswgwaterdist, defaultnotused::notused, defaultnotused::notusedi, allocatearray::siteselect, and allocatearray::wgwaterdist_coeff.

Referenced by initializesurfacecharacteristics().

1020  ! Matches within-grid water distribution via codes
1021  ! Checks water cannot flow from one surface to the same surface
1022  ! Checks water distribution fractions sum to 1.
1023  ! HCW 10 Nov 2014
1024  ! ---------------------------------------------------------
1025 
1026  USE allocatearray
1027  USE initial
1028  USE colnamesinputfiles
1029  USE defaultnotused
1030 
1031  IMPLICIT NONE
1032 
1033  INTEGER:: rr
1034  INTEGER:: codecol, codecolsamesurf
1035 
1036  iv5 = 0 ! Reset iv5 to zero
1037 
1038  DO iv5 = 1, nlineswgwaterdist
1039  IF (wgwaterdist_coeff(iv5, cwg_code) == siteselect(rr, codecol)) THEN
1040  EXIT
1041  ELSEIF (iv5 == nlineswgwaterdist) THEN
1042  WRITE (*, *) 'Program stopped! Within-grid water distribution code ', siteselect(rr, codecol), &
1043  'not found in SUEWS_WaterDistWithinGrid.txt.'
1044  CALL errorhint(57, 'Cannot find code in SUEWS_WaterDistWithinGrid.txt', siteselect(rr, codecol), notused, notusedi)
1045  ENDIF
1046  ENDDO
1047 
1048  ! Check water flow to same surface is zero (previously in RunControlByGridByYear in SUEWS_Initial.f95)
1049  IF (wgwaterdist_coeff(iv5, codecolsamesurf) /= 0) THEN
1050  CALL errorhint(8, 'Diagonal elements should be zero as water cannot move from one surface to the same surface.', &
1051  wgwaterdist_coeff(iv5, codecolsamesurf), notused, notusedi)
1052  ENDIF
1053 
1054  !! QUESTION: MODIFY THIS?
1055  ! Check water either moves to runoff or soilstore, but not to both
1056  ! Model returns an error if both ToRunoff and ToSoilStore are non-zero.
1057  !! - Probably should remove this...
1058  !! - Also look at SUEWS_translate, as the non-zero value goes into WaterDist
1060  CALL errorhint(9, 'One of these (ToRunoff,ToSoilStore) should be zero.', &
1062  ENDIF
1063 
1064  !! Also do for water surface once implemented
1065  IF (codecol /= c_wgwatercode) THEN ! Except for Water surface
1066  ! Check total water distribution from each surface adds up to 1
1067  IF (sum(wgwaterdist_coeff(iv5, cwg_topaved:cwg_tosoilstore)) > 1.0000001 &
1068  .OR. sum(wgwaterdist_coeff(iv5, cwg_topaved:cwg_tosoilstore)) < 0.9999999) THEN
1069  CALL errorhint(8, 'Total water distribution from each surface should add up to 1.', &
1071  ENDIF
1072  ENDIF
1073 
1074  RETURN
real(kind(1d0)) notused
real(kind(1d0)), dimension(:, :), allocatable siteselect
real(kind(1d0)), dimension(:, :), allocatable wgwaterdist_coeff
integer nlineswgwaterdist
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchestm()

subroutine codematchestm ( integer  Gridiv,
integer  is 
)

Definition at line 910 of file suews_ctrl_input.f95.

References allocatearray::c_estmcode, colnamesinputfiles::ce_code, errorhint(), allocatearray::estmcoefficients_coeff, initial::iv5, initial::nlinesestmcoefficients, defaultnotused::notused, defaultnotused::notusedi, and allocatearray::surfacechar.

Referenced by initializesurfacecharacteristics().

910  ! Matches ESTM coefficients via ESTM code
911  ! Modified HCW 16 Jun 2016 - for SUEWS surface types
912  ! - removed summer/winter wet/dry option
913  ! S.O. 04 Feb 2016
914  ! ---------------------------------------------------------
915 
916  USE allocatearray
917  USE initial
919  USE defaultnotused
920 
921  IMPLICIT NONE
922 
923  INTEGER:: gridiv
924  INTEGER:: is
925 
926  iv5 = 0 ! Reset iv5 to zero
927 
929  IF (estmcoefficients_coeff(iv5, ce_code) == surfacechar(gridiv, c_estmcode(is))) THEN
930  EXIT
931  ELSEIF (iv5 == nlinesestmcoefficients) THEN
932  WRITE (*, *) 'Program stopped! ESTM code', surfacechar(gridiv, c_estmcode(is)), &
933  'not found in ESTM_Coefficients.txt for surface', is, '.'
934  CALL errorhint(57, 'Cannot find ESTM code', surfacechar(gridiv, c_estmcode(is)), notused, notusedi)
935  ENDIF
936  ENDDO
937 
938  RETURN
integer nlinesestmcoefficients
real(kind(1d0)), dimension(:, :), allocatable estmcoefficients_coeff
real(kind(1d0)) notused
integer, dimension(nsurfincsnow) c_estmcode
real(kind(1d0)), dimension(:, :), allocatable surfacechar
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchestm_class()

subroutine codematchestm_class ( integer  Gridiv,
integer  is,
integer  ii 
)

Definition at line 943 of file suews_ctrl_input.f95.

References allocatearray::bldgsurf, colnamesinputfiles::c_code_estmclass_bldgs, colnamesinputfiles::c_code_estmclass_paved, colnamesinputfiles::ce_code, errorhint(), allocatearray::estmcoefficients_coeff, initial::iv5, initial::nlinesestmcoefficients, defaultnotused::notused, defaultnotused::notusedi, allocatearray::pavsurf, and allocatearray::surfacechar.

Referenced by initializesurfacecharacteristics().

943  ! Matches ESTM coefficients via ESTM codes in SiteSelect for Paved and Bldgs ESTM classes
944  ! HCW 16 Jun 2016
945  ! ---------------------------------------------------------
946 
947  USE allocatearray
948  USE initial
950  USE defaultnotused
951 
952  IMPLICIT NONE
953 
954  INTEGER:: gridiv
955  INTEGER:: is, ii
956 
957  iv5 = 0 ! Reset iv5 to zero
958 
959  IF (is == bldgsurf) THEN
962  EXIT
963  ELSEIF (iv5 == nlinesestmcoefficients) THEN
964  WRITE (*, *) 'Program stopped! ESTM code', surfacechar(gridiv, c_code_estmclass_bldgs(ii)), &
965  'not found in ESTM_Coefficients.txt for surface', is, '.'
966  CALL errorhint(57, 'Cannot find ESTM code', surfacechar(gridiv, c_code_estmclass_bldgs(ii)), notused, notusedi)
967  ENDIF
968  ENDDO
969  ELSEIF (is == pavsurf) THEN
972  EXIT
973  ELSEIF (iv5 == nlinesestmcoefficients) THEN
974  WRITE (*, *) 'Program stopped! ESTM code', surfacechar(gridiv, c_code_estmclass_paved(ii)), &
975  'not found in ESTM_Coefficients.txt for surface', is, '.'
976  CALL errorhint(57, 'Cannot find ESTM code', surfacechar(gridiv, c_code_estmclass_paved(ii)), notused, notusedi)
977  ENDIF
978  ENDDO
979  ELSE
980  WRITE (*, *) 'Problem with CodeMatchESTM_Class (in SUEWS_ctrl_input.f95). ', is, ' not correct. Needs to be either ', &
981  '1 = Paved surfaced, 2 = Bldgs surfaces.'
982  stop
983  ENDIF
984  RETURN
integer nlinesestmcoefficients
integer, dimension(5) c_code_estmclass_bldgs
real(kind(1d0)), dimension(:, :), allocatable estmcoefficients_coeff
real(kind(1d0)) notused
real(kind(1d0)), dimension(:, :), allocatable surfacechar
integer, dimension(3) c_code_estmclass_paved
integer, parameter pavsurf
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
integer, parameter bldgsurf
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchirrigation()

subroutine codematchirrigation ( integer  rr,
integer  CodeCol 
)

Definition at line 1262 of file suews_ctrl_input.f95.

References colnamesinputfiles::cir_code, errorhint(), allocatearray::irrigation_coeff, initial::iv5, initial::nlinesirrigation, defaultnotused::notused, defaultnotused::notusedi, and allocatearray::siteselect.

Referenced by initializesurfacecharacteristics().

1262  ! Matches Irrigation characteristics via codes in SiteSelect
1263  ! HCW 20 Nov 2014
1264  ! ---------------------------------------------------------
1265 
1266  USE allocatearray
1267  USE initial
1268  USE colnamesinputfiles
1269  USE defaultnotused
1270 
1271  IMPLICIT NONE
1272 
1273  INTEGER:: rr
1274  INTEGER:: codecol
1275 
1276  iv5 = 0 ! Reset iv5 to zero
1277 
1278  DO iv5 = 1, nlinesirrigation
1279  IF (irrigation_coeff(iv5, cir_code) == siteselect(rr, codecol)) THEN
1280  EXIT
1281  ELSEIF (iv5 == nlinesirrigation) THEN
1282  WRITE (*, *) 'Program stopped! Irrigation code ', siteselect(rr, codecol), 'not found in SUEWS_Irrigation.txt.'
1283  CALL errorhint(57, 'Cannot find code in SUEWS_Irrigation.txt', siteselect(rr, codecol), notused, notusedi)
1284  ENDIF
1285  ENDDO
1286 
1287  RETURN
real(kind(1d0)), dimension(:, :), allocatable irrigation_coeff
real(kind(1d0)) notused
integer nlinesirrigation
real(kind(1d0)), dimension(:, :), allocatable siteselect
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchnonveg()

subroutine codematchnonveg ( integer  rr,
integer  CodeCol 
)

Definition at line 1079 of file suews_ctrl_input.f95.

References colnamesinputfiles::ci_code, errorhint(), initial::iv5, initial::nlinesnonveg, allocatearray::nonveg_coeff, defaultnotused::notused, defaultnotused::notusedi, and allocatearray::siteselect.

Referenced by initializesurfacecharacteristics().

1079  ! Matches Impervious characteristics via codes in SiteSelect
1080  ! HCW 20 Nov 2014
1081  ! ---------------------------------------------------------
1082 
1083  USE allocatearray
1084  USE initial
1085  USE colnamesinputfiles
1086  USE defaultnotused
1087 
1088  IMPLICIT NONE
1089 
1090  INTEGER:: rr
1091  INTEGER:: codecol
1092 
1093  iv5 = 0 ! Reset iv5 to zero
1094 
1095  DO iv5 = 1, nlinesnonveg
1096  IF (nonveg_coeff(iv5, ci_code) == siteselect(rr, codecol)) THEN
1097  EXIT
1098  ELSEIF (iv5 == nlinesnonveg) THEN
1099  WRITE (*, *) 'Program stopped! NonVeg code ', siteselect(rr, codecol), 'not found in SUEWS_NonVeg.txt.'
1100  CALL errorhint(57, 'Cannot find code in SUEWS_NonVeg.txt', siteselect(rr, codecol), notused, notusedi)
1101  ENDIF
1102  ENDDO
1103 
1104  RETURN
real(kind(1d0)) notused
real(kind(1d0)), dimension(:, :), allocatable siteselect
integer nlinesnonveg
real(kind(1d0)), dimension(:, :), allocatable nonveg_coeff
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchohm()

subroutine codematchohm ( integer  Gridiv,
integer  is,
character(len=4)  SWWD 
)

Definition at line 833 of file suews_ctrl_input.f95.

References allocatearray::c_ohmcode_sdry, allocatearray::c_ohmcode_swet, allocatearray::c_ohmcode_wdry, allocatearray::c_ohmcode_wwet, colnamesinputfiles::co_code, errorhint(), initial::iv5, initial::nlinesohmcoefficients, defaultnotused::notused, defaultnotused::notusedi, allocatearray::ohmcoefficients_coeff, and allocatearray::surfacechar.

Referenced by initializesurfacecharacteristics().

833  ! Matches OHM coefficients a1, a2, a3 via OHM codes
834  ! for summer/winter wet/dry conditions
835  ! HCW 03 Nov 2014
836  ! ---------------------------------------------------------
837 
838  USE allocatearray
839  USE initial
841  USE defaultnotused
842 
843  IMPLICIT NONE
844 
845  INTEGER:: gridiv
846  INTEGER:: is
847  CHARACTER(len=4):: swwd
848 
849  iv5 = 0 ! Reset iv5 to zero
850 
851  IF (swwd == 'SWet') THEN
852 
853  DO iv5 = 1, nlinesohmcoefficients
855  EXIT
856  ELSEIF (iv5 == nlinesohmcoefficients) THEN
857  WRITE (*, *) 'Program stopped! OHM code (summer wet)', surfacechar(gridiv, c_ohmcode_swet(is)), &
858  'not found in OHM_Coefficients.txt for surface', is, '.'
859  CALL errorhint(57, 'Cannot find OHM code (summer wet)', surfacechar(gridiv, c_ohmcode_swet(is)), notused, notusedi)
860  ENDIF
861  ENDDO
862 
863  ELSEIF (swwd == 'SDry') THEN
864 
865  DO iv5 = 1, nlinesohmcoefficients
867  EXIT
868  ELSEIF (iv5 == nlinesohmcoefficients) THEN
869  WRITE (*, *) 'Program stopped! OHM code (summer dry)', surfacechar(gridiv, c_ohmcode_sdry(is)), &
870  'not found in OHM_Coefficients.txt for surface', is, '.'
871  CALL errorhint(57, 'Cannot find OHM code (summer dry)', surfacechar(gridiv, c_ohmcode_sdry(is)), notused, notusedi)
872  ENDIF
873  ENDDO
874 
875  ELSEIF (swwd == 'WWet') THEN
876 
877  DO iv5 = 1, nlinesohmcoefficients
879  EXIT
880  ELSEIF (iv5 == nlinesohmcoefficients) THEN
881  WRITE (*, *) 'Program stopped! OHM code (winter wet)', surfacechar(gridiv, c_ohmcode_wwet(is)), &
882  'not found in OHM_Coefficients.txt for surface', is, '.'
883  CALL errorhint(57, 'Cannot find OHM code (winter wet)', surfacechar(gridiv, c_ohmcode_wwet(is)), notused, notusedi)
884  ENDIF
885  ENDDO
886 
887  ELSEIF (swwd == 'WDry') THEN
888 
889  DO iv5 = 1, nlinesohmcoefficients
891  EXIT
892  ELSEIF (iv5 == nlinesohmcoefficients) THEN
893  WRITE (*, *) 'Program stopped! OHM code (winter dry)', surfacechar(gridiv, c_ohmcode_wdry(is)), &
894  'not found in OHM_Coefficients.txt for surface', is, '.'
895  CALL errorhint(57, 'Cannot find OHM code (winter dry)', surfacechar(gridiv, c_ohmcode_wdry(is)), notused, notusedi)
896  ENDIF
897  ENDDO
898 
899  ELSE
900  WRITE (*, *) 'Problem with CodeMatchOHM (in SUEWS_CodeMatch.f95). ', swwd, ' not recognised. Needs to be one of: ', &
901  'SWet = Summer Wet, SDry = Summer Dry, WWet = WinterWet, WDry = Winter Dry. N.B. Case sensitive. '
902  stop
903  ENDIF
904 
905  RETURN
integer, dimension(nsurfincsnow) c_ohmcode_swet
real(kind(1d0)) notused
integer, dimension(nsurfincsnow) c_ohmcode_wwet
integer, dimension(nsurfincsnow) c_ohmcode_wdry
real(kind(1d0)), dimension(:, :), allocatable surfacechar
integer nlinesohmcoefficients
real(kind(1d0)), dimension(:, :), allocatable ohmcoefficients_coeff
integer, dimension(nsurfincsnow) c_ohmcode_sdry
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchprof()

subroutine codematchprof ( integer  Gridiv,
integer  SurfaceCharCodeCol 
)

Definition at line 989 of file suews_ctrl_input.f95.

References colnamesinputfiles::cpr_code, errorhint(), initial::iv5, initial::nlinesprofiles, defaultnotused::notused, defaultnotused::notusedi, allocatearray::profiles_coeff, and allocatearray::surfacechar.

Referenced by initializesurfacecharacteristics().

989  ! Matches Soil characteristics via codes in *SurfaceChar*
990  ! for energy use/water use/snow clearing
991  ! HCW 20 Nov 2014
992  ! ---------------------------------------------------------
993 
994  USE allocatearray
995  USE initial
997  USE defaultnotused
998 
999  IMPLICIT NONE
1000 
1001  INTEGER:: gridiv
1002  INTEGER:: surfacecharcodecol
1003 
1004  iv5 = 0 ! Reset iv5 to zero
1005 
1006  DO iv5 = 1, nlinesprofiles
1007  IF (profiles_coeff(iv5, cpr_code) == surfacechar(gridiv, surfacecharcodecol)) THEN
1008  EXIT
1009  ELSEIF (iv5 == nlinesprofiles) THEN
1010  WRITE (*, *) 'Program stopped! Profile code ', surfacechar(gridiv, surfacecharcodecol), 'not found in SUEWS_Profiles.txt.'
1011  CALL errorhint(57, 'Cannot find code in SUEWS_Profiles.txt', surfacechar(gridiv, surfacecharcodecol), notused, notusedi)
1012  ENDIF
1013  ENDDO
1014 
1015  RETURN
integer nlinesprofiles
real(kind(1d0)) notused
real(kind(1d0)), dimension(:, :), allocatable surfacechar
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
real(kind(1d0)), dimension(:, :), allocatable profiles_coeff
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchsnow()

subroutine codematchsnow ( integer  rr,
integer  CodeCol 
)

Definition at line 1169 of file suews_ctrl_input.f95.

References colnamesinputfiles::cs_code, errorhint(), initial::iv5, initial::nlinessnow, defaultnotused::notused, defaultnotused::notusedi, allocatearray::siteselect, and allocatearray::snow_coeff.

Referenced by initializesurfacecharacteristics().

1169  ! Matches Snow characteristics via codes in SiteSelect
1170  ! HCW 20 Nov 2014
1171  ! ---------------------------------------------------------
1172 
1173  USE allocatearray
1174  USE initial
1175  USE colnamesinputfiles
1176  USE defaultnotused
1177 
1178  IMPLICIT NONE
1179 
1180  INTEGER:: rr
1181  INTEGER:: codecol
1182 
1183  iv5 = 0 ! Reset iv5 to zero
1184 
1185  DO iv5 = 1, nlinessnow
1186  IF (snow_coeff(iv5, cs_code) == siteselect(rr, codecol)) THEN
1187  EXIT
1188  ELSEIF (iv5 == nlinessnow) THEN
1189  WRITE (*, *) 'Program stopped! Snow code ', siteselect(rr, codecol), 'not found in SUEWS_Snow.txt.'
1190  CALL errorhint(57, 'Cannot find code in SUEWS_Snow.txt', siteselect(rr, codecol), notused, notusedi)
1191  ENDIF
1192  ENDDO
1193 
1194  RETURN
real(kind(1d0)), dimension(:, :), allocatable snow_coeff
real(kind(1d0)) notused
real(kind(1d0)), dimension(:, :), allocatable siteselect
integer nlinessnow
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchsoil()

subroutine codematchsoil ( integer  Gridiv,
integer  SurfaceCharCodeCol 
)

Definition at line 1292 of file suews_ctrl_input.f95.

References colnamesinputfiles::cso_code, errorhint(), initial::iv5, initial::nlinessoil, defaultnotused::notused, defaultnotused::notusedi, allocatearray::soil_coeff, and allocatearray::surfacechar.

Referenced by initializesurfacecharacteristics().

1292  ! Matches Soil characteristics via codes in *SurfaceChar*
1293  ! HCW 20 Nov 2014
1294  ! ---------------------------------------------------------
1295 
1296  USE allocatearray
1297  USE initial
1298  USE colnamesinputfiles
1299  USE defaultnotused
1300 
1301  IMPLICIT NONE
1302 
1303  INTEGER:: gridiv
1304  INTEGER:: surfacecharcodecol
1305 
1306  iv5 = 0 ! Reset iv5 to zero
1307 
1308  DO iv5 = 1, nlinessoil
1309  IF (soil_coeff(iv5, cso_code) == surfacechar(gridiv, surfacecharcodecol)) THEN
1310  EXIT
1311  ELSEIF (iv5 == nlinessoil) THEN
1312  WRITE (*, *) 'Program stopped! Soil code ', surfacechar(gridiv, surfacecharcodecol), 'not found in SUEWS_Soil.txt.'
1313  CALL errorhint(57, 'Cannot find code in SUEWS_Soil.txt', surfacechar(gridiv, surfacecharcodecol), notused, notusedi)
1314  ENDIF
1315  ENDDO
1316 
1317  RETURN
integer nlinessoil
real(kind(1d0)), dimension(:, :), allocatable soil_coeff
real(kind(1d0)) notused
real(kind(1d0)), dimension(:, :), allocatable surfacechar
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchveg()

subroutine codematchveg ( integer  rr,
integer  CodeCol 
)

Definition at line 1109 of file suews_ctrl_input.f95.

References colnamesinputfiles::cp_code, errorhint(), initial::iv5, initial::nlinesveg, defaultnotused::notused, defaultnotused::notusedi, allocatearray::siteselect, and allocatearray::veg_coeff.

Referenced by initializesurfacecharacteristics().

1109  ! Matches Pervious characteristics via codes in SiteSelect
1110  ! HCW 20 Nov 2014
1111  ! ---------------------------------------------------------
1112 
1113  USE allocatearray
1114  USE initial
1115  USE colnamesinputfiles
1116  USE defaultnotused
1117 
1118  IMPLICIT NONE
1119 
1120  INTEGER:: rr
1121  INTEGER:: codecol
1122 
1123  iv5 = 0 ! Reset iv5 to zero
1124 
1125  DO iv5 = 1, nlinesveg
1126  IF (veg_coeff(iv5, cp_code) == siteselect(rr, codecol)) THEN
1127  EXIT
1128  ELSEIF (iv5 == nlinesveg) THEN
1129  WRITE (*, *) 'Program stopped! Veg code ', siteselect(rr, codecol), 'not found in SUEWS_Vegs.txt.'
1130  CALL errorhint(57, 'Cannot find code in SUEWS_Veg.txt', siteselect(rr, codecol), notused, notusedi)
1131  ENDIF
1132  ENDDO
1133 
1134  RETURN
real(kind(1d0)) notused
integer nlinesveg
real(kind(1d0)), dimension(:, :), allocatable siteselect
real(kind(1d0)), dimension(:, :), allocatable veg_coeff
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ codematchwater()

subroutine codematchwater ( integer  rr,
integer  CodeCol 
)

Definition at line 1139 of file suews_ctrl_input.f95.

References colnamesinputfiles::cw_code, errorhint(), initial::iv5, initial::nlineswater, defaultnotused::notused, defaultnotused::notusedi, allocatearray::siteselect, and allocatearray::water_coeff.

Referenced by initializesurfacecharacteristics().

1139  ! Matches Water characteristics via codes in SiteSelect
1140  ! HCW 20 Nov 2014
1141  ! ---------------------------------------------------------
1142 
1143  USE allocatearray
1144  USE initial
1145  USE colnamesinputfiles
1146  USE defaultnotused
1147 
1148  IMPLICIT NONE
1149 
1150  INTEGER:: rr
1151  INTEGER:: codecol
1152 
1153  iv5 = 0 ! Reset iv5 to zero
1154 
1155  DO iv5 = 1, nlineswater
1156  IF (water_coeff(iv5, cw_code) == siteselect(rr, codecol)) THEN
1157  EXIT
1158  ELSEIF (iv5 == nlineswater) THEN
1159  WRITE (*, *) 'Program stopped! Water code ', siteselect(rr, codecol), 'not found in SUEWS_Water.txt.'
1160  CALL errorhint(57, 'Cannot find code in SUEWS_Water.txt', siteselect(rr, codecol), notused, notusedi)
1161  ENDIF
1162  ENDDO
1163 
1164  RETURN
real(kind(1d0)), dimension(:, :), allocatable water_coeff
real(kind(1d0)) notused
integer nlineswater
real(kind(1d0)), dimension(:, :), allocatable siteselect
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_prof_spectime_inst()

real(kind(1d0)) function get_prof_spectime_inst ( integer, intent(in)  Hour,
integer, intent(in)  Min,
integer, intent(in)  Sec,
real(kind(1d0)), dimension(0:23), intent(in)  Prof_24h 
)

Definition at line 744 of file suews_ctrl_input.f95.

744 
745  IMPLICIT NONE
746 
747  INTEGER :: i, j !Used to count over hours and sub-hourly timesteps
748  INTEGER, INTENT(IN) :: hour, min, sec
749  INTEGER :: total_sec, secperhour
750  REAL(KIND(1d0)), DIMENSION(0:23), INTENT(IN) :: prof_24h
751  REAL(KIND(1d0)):: deltaprof !Change in hourly profiles per model timestep
752  REAL(KIND(1d0)) :: prof_currtime
753 
754  total_sec = min*60 + sec
755  secperhour = 3600
756 
757  i = hour
758  j = i + 1
759  IF (j == 24) j = 0
760 
761  deltaprof = (prof_24h(j) - prof_24h(i))/secperhour
762  prof_currtime = prof_24h(hour) + deltaprof*total_sec
763 

◆ get_prof_spectime_mean()

real(kind(1d0)) function get_prof_spectime_mean ( integer, intent(in)  Hour,
integer, intent(in)  Min,
integer, intent(in)  Sec,
real(kind(1d0)), dimension(0:23), intent(in)  Prof_24h 
)

Definition at line 770 of file suews_ctrl_input.f95.

770 
771  IMPLICIT NONE
772 
773  INTEGER :: i, j !Used to count over hours and sub-hourly timesteps
774  INTEGER, INTENT(IN) :: hour, min, sec
775  INTEGER :: total_sec, secperhour
776  REAL(KIND(1d0)), DIMENSION(0:23), INTENT(IN) :: prof_24h
777  REAL(KIND(1d0)), DIMENSION(0:23):: prof_24h_mean
778  REAL(KIND(1d0)):: deltaprof !Change in hourly profiles per model timestep
779  REAL(KIND(1d0)) :: prof_currtime
780 
781  total_sec = min*60 + sec
782  secperhour = 3600
783 
784  prof_24h_mean = merge(prof_24h/(sum(prof_24h)/size(prof_24h, dim=1)), 0.d0, sum(prof_24h) /= 0) ! prevent zero-division
785  ! print*, Prof_24h_mean
786 
787  i = hour
788  j = i + 1
789  IF (j == 24) j = 0
790 
791  deltaprof = (prof_24h_mean(j) - prof_24h_mean(i))/secperhour
792 
793  ! print*, deltaProf,total_sec
794  prof_currtime = prof_24h_mean(i) + deltaprof*total_sec
795 

◆ get_prof_spectime_sum()

real(kind(1d0)) function get_prof_spectime_sum ( integer, intent(in)  Hour,
integer, intent(in)  Min,
integer, intent(in)  Sec,
real(kind(1d0)), dimension(0:23), intent(in)  Prof_24h,
integer, intent(in)  dt 
)

Definition at line 802 of file suews_ctrl_input.f95.

802 
803  IMPLICIT NONE
804 
805  INTEGER :: i, j !Used to count over hours and sub-hourly timesteps
806  INTEGER, INTENT(IN) :: hour, min, sec, dt
807  INTEGER :: total_sec, secperhour
808  REAL(KIND(1d0)), DIMENSION(0:23), INTENT(IN) :: prof_24h
809  REAL(KIND(1d0)), DIMENSION(0:23):: prof_24h_sum
810  REAL(KIND(1d0)):: deltaprof !Change in hourly profiles per model timestep
811  REAL(KIND(1d0)) :: prof_currtime
812 
813  total_sec = min*60 + sec
814  secperhour = 3600
815 
816  prof_24h_sum = merge(prof_24h/(sum(prof_24h)), 0.d0, sum(prof_24h) /= 0) ! prevent zero-division
817 
818  i = hour
819  j = i + 1
820  IF (j == 24) j = 0
821 
822  deltaprof = (prof_24h_sum(j) - prof_24h_sum(i))/secperhour
823  prof_currtime = prof_24h_sum(hour) + deltaprof*total_sec
824  prof_currtime = prof_currtime*dt/secperhour
825 

◆ inputheadercheck()

subroutine inputheadercheck ( character(len=50)  FileName)

Definition at line 256 of file suews_ctrl_input.f95.

References colnamesinputfiles::ca_ahmin_wd, colnamesinputfiles::ca_ahmin_we, colnamesinputfiles::ca_ahslopecooling_wd, colnamesinputfiles::ca_ahslopecooling_we, colnamesinputfiles::ca_ahslopeheating_wd, colnamesinputfiles::ca_ahslopeheating_we, colnamesinputfiles::ca_baset_hc, colnamesinputfiles::ca_co2mwd, colnamesinputfiles::ca_co2mwe, colnamesinputfiles::ca_co2pointsource, colnamesinputfiles::ca_code, colnamesinputfiles::ca_ef_umolco2perj, colnamesinputfiles::ca_enef_v_jkm, colnamesinputfiles::ca_enprofwd, colnamesinputfiles::ca_enprofwe, colnamesinputfiles::ca_fcef_v_kgkmwd, colnamesinputfiles::ca_fcef_v_kgkmwe, colnamesinputfiles::ca_frfossilfuel_heat, colnamesinputfiles::ca_frfossilfuel_nonheat, colnamesinputfiles::ca_frpddwe, colnamesinputfiles::ca_maxfcmetab, colnamesinputfiles::ca_maxqfmetab, colnamesinputfiles::ca_minfcmetab, colnamesinputfiles::ca_minqfmetab, colnamesinputfiles::ca_popprofwd, colnamesinputfiles::ca_popprofwe, colnamesinputfiles::ca_qf_a1, colnamesinputfiles::ca_qf_a2, colnamesinputfiles::ca_qf_b1, colnamesinputfiles::ca_qf_b2, colnamesinputfiles::ca_qf_c1, colnamesinputfiles::ca_qf_c2, colnamesinputfiles::ca_tcriticcooling_wd, colnamesinputfiles::ca_tcriticcooling_we, colnamesinputfiles::ca_tcriticheating_wd, colnamesinputfiles::ca_tcriticheating_we, colnamesinputfiles::ca_trafficunits, colnamesinputfiles::ca_traffprofwd, colnamesinputfiles::ca_traffprofwe, colnamesinputfiles::cb_alpha, colnamesinputfiles::cb_alpha_enh, colnamesinputfiles::cb_beta, colnamesinputfiles::cb_beta_enh, colnamesinputfiles::cb_code, colnamesinputfiles::cb_min_r, colnamesinputfiles::cb_resp_a, colnamesinputfiles::cb_resp_b, colnamesinputfiles::cb_theta, colnamesinputfiles::cc_code, colnamesinputfiles::cc_gsg1, colnamesinputfiles::cc_gsg2, colnamesinputfiles::cc_gsg3, colnamesinputfiles::cc_gsg4, colnamesinputfiles::cc_gsg5, colnamesinputfiles::cc_gsg6, colnamesinputfiles::cc_gskmax, colnamesinputfiles::cc_gsmodel, colnamesinputfiles::cc_gss1, colnamesinputfiles::cc_gss2, colnamesinputfiles::cc_gsth, colnamesinputfiles::cc_gstl, colnamesinputfiles::ce_alb_ibld, colnamesinputfiles::ce_ch_ibld, colnamesinputfiles::ce_ch_iroof, colnamesinputfiles::ce_ch_iwall, colnamesinputfiles::ce_code, colnamesinputfiles::ce_em_ibld, colnamesinputfiles::ce_internal_k1, colnamesinputfiles::ce_internal_k2, colnamesinputfiles::ce_internal_k3, colnamesinputfiles::ce_internal_k4, colnamesinputfiles::ce_internal_k5, colnamesinputfiles::ce_internal_rhocp1, colnamesinputfiles::ce_internal_rhocp2, colnamesinputfiles::ce_internal_rhocp3, colnamesinputfiles::ce_internal_rhocp4, colnamesinputfiles::ce_internal_rhocp5, colnamesinputfiles::ce_internal_thick1, colnamesinputfiles::ce_internal_thick2, colnamesinputfiles::ce_internal_thick3, colnamesinputfiles::ce_internal_thick4, colnamesinputfiles::ce_internal_thick5, colnamesinputfiles::ce_nroom, colnamesinputfiles::ce_surf_k1, colnamesinputfiles::ce_surf_k2, colnamesinputfiles::ce_surf_k3, colnamesinputfiles::ce_surf_k4, colnamesinputfiles::ce_surf_k5, colnamesinputfiles::ce_surf_rhocp1, colnamesinputfiles::ce_surf_rhocp2, colnamesinputfiles::ce_surf_rhocp3, colnamesinputfiles::ce_surf_rhocp4, colnamesinputfiles::ce_surf_rhocp5, colnamesinputfiles::ce_surf_thick1, colnamesinputfiles::ce_surf_thick2, colnamesinputfiles::ce_surf_thick3, colnamesinputfiles::ce_surf_thick4, colnamesinputfiles::ce_surf_thick5, colnamesinputfiles::ce_wall_k1, colnamesinputfiles::ce_wall_k2, colnamesinputfiles::ce_wall_k3, colnamesinputfiles::ce_wall_k4, colnamesinputfiles::ce_wall_k5, colnamesinputfiles::ce_wall_rhocp1, colnamesinputfiles::ce_wall_rhocp2, colnamesinputfiles::ce_wall_rhocp3, colnamesinputfiles::ce_wall_rhocp4, colnamesinputfiles::ce_wall_rhocp5, colnamesinputfiles::ce_wall_thick1, colnamesinputfiles::ce_wall_thick2, colnamesinputfiles::ce_wall_thick3, colnamesinputfiles::ce_wall_thick4, colnamesinputfiles::ce_wall_thick5, colnamesinputfiles::ci_albmax, colnamesinputfiles::ci_albmin, colnamesinputfiles::ci_chanohm, colnamesinputfiles::ci_code, colnamesinputfiles::ci_cpanohm, colnamesinputfiles::ci_drcoef1, colnamesinputfiles::ci_drcoef2, colnamesinputfiles::ci_dreq, colnamesinputfiles::ci_emis, colnamesinputfiles::ci_estmcode, colnamesinputfiles::ci_kkanohm, colnamesinputfiles::ci_ohmcode_sdry, colnamesinputfiles::ci_ohmcode_swet, colnamesinputfiles::ci_ohmcode_wdry, colnamesinputfiles::ci_ohmcode_wwet, colnamesinputfiles::ci_ohmthresh_sw, colnamesinputfiles::ci_ohmthresh_wd, colnamesinputfiles::ci_snowlimpat, colnamesinputfiles::ci_snowlimrem, colnamesinputfiles::ci_soiltcode, colnamesinputfiles::ci_statelimit, colnamesinputfiles::ci_stormax, colnamesinputfiles::ci_stormin, colnamesinputfiles::ci_wetthresh, colnamesinputfiles::cir_code, colnamesinputfiles::cir_daywat1, colnamesinputfiles::cir_daywat2, colnamesinputfiles::cir_daywat3, colnamesinputfiles::cir_daywat4, colnamesinputfiles::cir_daywat5, colnamesinputfiles::cir_daywat6, colnamesinputfiles::cir_daywat7, colnamesinputfiles::cir_daywatper1, colnamesinputfiles::cir_daywatper2, colnamesinputfiles::cir_daywatper3, colnamesinputfiles::cir_daywatper4, colnamesinputfiles::cir_daywatper5, colnamesinputfiles::cir_daywatper6, colnamesinputfiles::cir_daywatper7, colnamesinputfiles::cir_faut, colnamesinputfiles::cir_h_ponding, colnamesinputfiles::cir_ie_a1, colnamesinputfiles::cir_ie_a2, colnamesinputfiles::cir_ie_a3, colnamesinputfiles::cir_ie_m1, colnamesinputfiles::cir_ie_m2, colnamesinputfiles::cir_ie_m3, colnamesinputfiles::cir_ieend, colnamesinputfiles::cir_iestart, colnamesinputfiles::cir_intwu, colnamesinputfiles::co_a1, colnamesinputfiles::co_a2, colnamesinputfiles::co_a3, colnamesinputfiles::co_code, colnamesinputfiles::cp_albmax, colnamesinputfiles::cp_albmin, colnamesinputfiles::cp_baset, colnamesinputfiles::cp_basete, colnamesinputfiles::cp_biogenco2code, colnamesinputfiles::cp_chanohm, colnamesinputfiles::cp_code, colnamesinputfiles::cp_cpanohm, colnamesinputfiles::cp_drcoef1, colnamesinputfiles::cp_drcoef2, colnamesinputfiles::cp_dreq, colnamesinputfiles::cp_emis, colnamesinputfiles::cp_estmcode, colnamesinputfiles::cp_gddfull, colnamesinputfiles::cp_gsmax, colnamesinputfiles::cp_kkanohm, colnamesinputfiles::cp_laieq, colnamesinputfiles::cp_laimax, colnamesinputfiles::cp_laimin, colnamesinputfiles::cp_leafgp1, colnamesinputfiles::cp_leafgp2, colnamesinputfiles::cp_leafop1, colnamesinputfiles::cp_leafop2, colnamesinputfiles::cp_ohmcode_sdry, colnamesinputfiles::cp_ohmcode_swet, colnamesinputfiles::cp_ohmcode_wdry, colnamesinputfiles::cp_ohmcode_wwet, colnamesinputfiles::cp_ohmthresh_sw, colnamesinputfiles::cp_ohmthresh_wd, colnamesinputfiles::cp_porositymax, colnamesinputfiles::cp_porositymin, colnamesinputfiles::cp_sddfull, colnamesinputfiles::cp_snowlimpat, colnamesinputfiles::cp_soiltcode, colnamesinputfiles::cp_statelimit, colnamesinputfiles::cp_stormax, colnamesinputfiles::cp_stormin, colnamesinputfiles::cp_wetthresh, colnamesinputfiles::cpr_code, colnamesinputfiles::cpr_hours, colnamesinputfiles::cs_chanohm, colnamesinputfiles::cs_code, colnamesinputfiles::cs_cpanohm, colnamesinputfiles::cs_estmcode, colnamesinputfiles::cs_kkanohm, colnamesinputfiles::cs_ohmcode_sdry, colnamesinputfiles::cs_ohmcode_swet, colnamesinputfiles::cs_ohmcode_wdry, colnamesinputfiles::cs_ohmcode_wwet, colnamesinputfiles::cs_ohmthresh_sw, colnamesinputfiles::cs_ohmthresh_wd, colnamesinputfiles::cs_snowalbmax, colnamesinputfiles::cs_snowalbmin, colnamesinputfiles::cs_snowcrwmax, colnamesinputfiles::cs_snowcrwmin, colnamesinputfiles::cs_snowemis, colnamesinputfiles::cs_snowplimalb, colnamesinputfiles::cs_snowplimsnow, colnamesinputfiles::cs_snowrmfactor, colnamesinputfiles::cs_snowsdmax, colnamesinputfiles::cs_snowsdmin, colnamesinputfiles::cs_snowtau_a, colnamesinputfiles::cs_snowtau_f, colnamesinputfiles::cs_snowtau_r, colnamesinputfiles::cs_snowtmfactor, colnamesinputfiles::cso_code, colnamesinputfiles::cso_ksat, colnamesinputfiles::cso_obssmdepth, colnamesinputfiles::cso_obssmmax, colnamesinputfiles::cso_obssnrfrac, colnamesinputfiles::cso_soildens, colnamesinputfiles::cso_soildepth, colnamesinputfiles::cso_soilinfrate, colnamesinputfiles::cso_soilstcap, colnamesinputfiles::cw_albmax, colnamesinputfiles::cw_albmin, colnamesinputfiles::cw_chanohm, colnamesinputfiles::cw_code, colnamesinputfiles::cw_cpanohm, colnamesinputfiles::cw_drcoef1, colnamesinputfiles::cw_drcoef2, colnamesinputfiles::cw_dreq, colnamesinputfiles::cw_emis, colnamesinputfiles::cw_estmcode, colnamesinputfiles::cw_kkanohm, colnamesinputfiles::cw_ohmcode_sdry, colnamesinputfiles::cw_ohmcode_swet, colnamesinputfiles::cw_ohmcode_wdry, colnamesinputfiles::cw_ohmcode_wwet, colnamesinputfiles::cw_ohmthresh_sw, colnamesinputfiles::cw_ohmthresh_wd, colnamesinputfiles::cw_statelimit, colnamesinputfiles::cw_stormax, colnamesinputfiles::cw_stormin, colnamesinputfiles::cw_waterdepth, colnamesinputfiles::cw_wetthresh, colnamesinputfiles::cwg_code, colnamesinputfiles::cwg_tobldgs, colnamesinputfiles::cwg_tobsoil, colnamesinputfiles::cwg_todectr, colnamesinputfiles::cwg_toevetr, colnamesinputfiles::cwg_tograss, colnamesinputfiles::cwg_topaved, colnamesinputfiles::cwg_torunoff, colnamesinputfiles::cwg_tosoilstore, colnamesinputfiles::cwg_towater, errorhint(), allocatearray::headeranthropogenic_file, allocatearray::headeranthropogenic_reqd, allocatearray::headerbiogen_file, allocatearray::headerbiogen_reqd, allocatearray::headercond_file, allocatearray::headercond_reqd, allocatearray::headerestmcoefficients_file, allocatearray::headerestmcoefficients_reqd, allocatearray::headerirrigation_file, allocatearray::headerirrigation_reqd, allocatearray::headernonveg_file, allocatearray::headernonveg_reqd, allocatearray::headerohmcoefficients_file, allocatearray::headerohmcoefficients_reqd, allocatearray::headerprofiles_file, allocatearray::headerprofiles_reqd, allocatearray::headersnow_file, allocatearray::headersnow_reqd, allocatearray::headersoil_file, allocatearray::headersoil_reqd, allocatearray::headerveg_file, allocatearray::headerveg_reqd, allocatearray::headerwater_file, allocatearray::headerwater_reqd, allocatearray::headerwgwaterdist_file, allocatearray::headerwgwaterdist_reqd, defaultnotused::notused, and defaultnotused::notusedi.

Referenced by readcoeff().

256  ! Checks columns in input files match the columns expected by model code
257  ! Model code columns are defined here
258  ! Latest update:
259  ! MH 21 Jun 2017 - Added parameters to SUEWS_AnthropogenicEmissions.txt
260  ! MH 16 Jun 2017 - Added SUEWS_BiogenCO2.txt
261  ! TS 02 Mar 2016 - AnOHM related variables added
262  ! LJ 27 Jan 2016 - Removal of tabs
263  ! LJ 07 July 2015 - snow albedo removed
264  ! HCW 12 Nov 2014
265  !-------------------------------------------------------------------------
266 
267  USE allocatearray
269  USE defaultnotused
270 
271  IMPLICIT NONE
272 
273  CHARACTER(len=50):: filename
274 
275  ! ========== Define expected column names here ==========
276  ! =======================================================
277 
278  ! ========== SUEWS_NonVeg.txt =============
279  headernonveg_reqd(ci_code) = "Code"
280  headernonveg_reqd(ci_albmin) = "AlbedoMin"
281  headernonveg_reqd(ci_albmax) = "AlbedoMax"
282  headernonveg_reqd(ci_emis) = "Emissivity"
283  headernonveg_reqd(ci_stormin) = "StorageMin"
284  headernonveg_reqd(ci_stormax) = "StorageMax"
285  headernonveg_reqd(ci_wetthresh) = "WetThreshold"
286  headernonveg_reqd(ci_statelimit) = "StateLimit"
287  headernonveg_reqd(ci_dreq) = "DrainageEq"
288  headernonveg_reqd(ci_drcoef1) = "DrainageCoef1"
289  headernonveg_reqd(ci_drcoef2) = "DrainageCoef2"
290  headernonveg_reqd(ci_soiltcode) = "SoilTypeCode"
291  headernonveg_reqd(ci_snowlimpat) = "SnowLimPatch"
292  headernonveg_reqd(ci_snowlimrem) = "SnowLimRemove"
293  headernonveg_reqd(ci_ohmcode_swet) = "OHMCode_SummerWet"
294  headernonveg_reqd(ci_ohmcode_sdry) = "OHMCode_SummerDry"
295  headernonveg_reqd(ci_ohmcode_wwet) = "OHMCode_WinterWet"
296  headernonveg_reqd(ci_ohmcode_wdry) = "OHMCode_WinterDry"
297  headernonveg_reqd(ci_ohmthresh_sw) = "OHMThresh_SW"
298  headernonveg_reqd(ci_ohmthresh_wd) = "OHMThresh_WD"
299  headernonveg_reqd(ci_estmcode) = "ESTMCode"
300  headernonveg_reqd(ci_cpanohm) = "AnOHM_Cp" ! AnOHM TS
301  headernonveg_reqd(ci_kkanohm) = "AnOHM_Kk" ! AnOHM TS
302  headernonveg_reqd(ci_chanohm) = "AnOHM_Ch" ! AnOHM TS
303 
304  ! ========== SUEWS_Veg.txt ===============
305  headerveg_reqd(cp_code) = "Code"
306  headerveg_reqd(cp_albmin) = "AlbedoMin"
307  headerveg_reqd(cp_albmax) = "AlbedoMax"
308  headerveg_reqd(cp_emis) = "Emissivity"
309  headerveg_reqd(cp_stormin) = "StorageMin"
310  headerveg_reqd(cp_stormax) = "StorageMax"
311  headerveg_reqd(cp_wetthresh) = "WetThreshold"
312  headerveg_reqd(cp_statelimit) = "StateLimit"
313  headerveg_reqd(cp_dreq) = "DrainageEq"
314  headerveg_reqd(cp_drcoef1) = "DrainageCoef1"
315  headerveg_reqd(cp_drcoef2) = "DrainageCoef2"
316  headerveg_reqd(cp_soiltcode) = "SoilTypeCode"
317  headerveg_reqd(cp_snowlimpat) = "SnowLimPatch"
318  headerveg_reqd(cp_baset) = "BaseT"
319  headerveg_reqd(cp_basete) = "BaseTe"
320  headerveg_reqd(cp_gddfull) = "GDDFull"
321  headerveg_reqd(cp_sddfull) = "SDDFull"
322  headerveg_reqd(cp_laimin) = "LAIMin"
323  headerveg_reqd(cp_laimax) = "LAIMax"
324  headerveg_reqd(cp_porositymin) = "PorosityMin"
325  headerveg_reqd(cp_porositymax) = "PorosityMax"
326  headerveg_reqd(cp_gsmax) = "MaxConductance"
327  headerveg_reqd(cp_laieq) = "LAIEq"
328  headerveg_reqd(cp_leafgp1) = "LeafGrowthPower1"
329  headerveg_reqd(cp_leafgp2) = "LeafGrowthPower2"
330  headerveg_reqd(cp_leafop1) = "LeafOffPower1"
331  headerveg_reqd(cp_leafop2) = "LeafOffPower2"
332  headerveg_reqd(cp_ohmcode_swet) = "OHMCode_SummerWet"
333  headerveg_reqd(cp_ohmcode_sdry) = "OHMCode_SummerDry"
334  headerveg_reqd(cp_ohmcode_wwet) = "OHMCode_WinterWet"
335  headerveg_reqd(cp_ohmcode_wdry) = "OHMCode_WinterDry"
336  headerveg_reqd(cp_ohmthresh_sw) = "OHMThresh_SW"
337  headerveg_reqd(cp_ohmthresh_wd) = "OHMThresh_WD"
338  headerveg_reqd(cp_estmcode) = "ESTMCode"
339  headerveg_reqd(cp_cpanohm) = "AnOHM_Cp" ! AnOHM TS
340  headerveg_reqd(cp_kkanohm) = "AnOHM_Kk" ! AnOHM TS
341  headerveg_reqd(cp_chanohm) = "AnOHM_Ch" ! AnOHM TS
342  headerveg_reqd(cp_biogenco2code) = "BiogenCO2Code"
343 
344  ! ========== SUEWS_Water.txt ==================
345  headerwater_reqd(cw_code) = "Code"
346  headerwater_reqd(cw_albmin) = "AlbedoMin"
347  headerwater_reqd(cw_albmax) = "AlbedoMax"
348  headerwater_reqd(cw_emis) = "Emissivity"
349  headerwater_reqd(cw_stormin) = "StorageMin"
350  headerwater_reqd(cw_stormax) = "StorageMax"
351  headerwater_reqd(cw_wetthresh) = "WetThreshold"
352  headerwater_reqd(cw_statelimit) = "StateLimit"
353  headerwater_reqd(cw_waterdepth) = "WaterDepth"
354  headerwater_reqd(cw_dreq) = "DrainageEq"
355  headerwater_reqd(cw_drcoef1) = "DrainageCoef1"
356  headerwater_reqd(cw_drcoef2) = "DrainageCoef2"
357  headerwater_reqd(cw_ohmcode_swet) = "OHMCode_SummerWet"
358  headerwater_reqd(cw_ohmcode_sdry) = "OHMCode_SummerDry"
359  headerwater_reqd(cw_ohmcode_wwet) = "OHMCode_WinterWet"
360  headerwater_reqd(cw_ohmcode_wdry) = "OHMCode_WinterDry"
361  headerwater_reqd(cw_ohmthresh_sw) = "OHMThresh_SW"
362  headerwater_reqd(cw_ohmthresh_wd) = "OHMThresh_WD"
363  headerwater_reqd(cw_estmcode) = "ESTMCode"
364  headerwater_reqd(cw_cpanohm) = "AnOHM_Cp" ! AnOHM TS
365  headerwater_reqd(cw_kkanohm) = "AnOHM_Kk" ! AnOHM TS
366  headerwater_reqd(cw_chanohm) = "AnOHM_Ch" ! AnOHM TS
367 
368  ! ========== SUEWS_Snow.txt ===================
369  headersnow_reqd(cs_code) = "Code"
370  headersnow_reqd(cs_snowrmfactor) = "RadMeltFactor"
371  headersnow_reqd(cs_snowtmfactor) = "TempMeltFactor"
372  headersnow_reqd(cs_snowalbmin) = "AlbedoMin"
373  headersnow_reqd(cs_snowalbmax) = "AlbedoMax"
374  headersnow_reqd(cs_snowemis) = "Emissivity"
375  headersnow_reqd(cs_snowtau_a) = "tau_a"
376  headersnow_reqd(cs_snowtau_f) = "tau_f"
377  headersnow_reqd(cs_snowplimalb) = "PrecipLimAlb"
378  headersnow_reqd(cs_snowsdmin) = "SnowDensMin"
379  headersnow_reqd(cs_snowsdmax) = "SnowDensMax"
380  headersnow_reqd(cs_snowtau_r) = "tau_r"
381  headersnow_reqd(cs_snowcrwmin) = "CRWMin"
382  headersnow_reqd(cs_snowcrwmax) = "CRWMax"
383  headersnow_reqd(cs_snowplimsnow) = "PrecipLimSnow"
384  headersnow_reqd(cs_ohmcode_swet) = "OHMCode_SummerWet"
385  headersnow_reqd(cs_ohmcode_sdry) = "OHMCode_SummerDry"
386  headersnow_reqd(cs_ohmcode_wwet) = "OHMCode_WinterWet"
387  headersnow_reqd(cs_ohmcode_wdry) = "OHMCode_WinterDry"
388  headersnow_reqd(cs_ohmthresh_sw) = "OHMThresh_SW"
389  headersnow_reqd(cs_ohmthresh_wd) = "OHMThresh_WD"
390  headersnow_reqd(cs_estmcode) = "ESTMCode"
391  headersnow_reqd(cs_cpanohm) = "AnOHM_Cp" ! AnOHM TS
392  headersnow_reqd(cs_kkanohm) = "AnOHM_Kk" ! AnOHM TS
393  headersnow_reqd(cs_chanohm) = "AnOHM_Ch" ! AnOHM TS
394 
395  ! ========== SUEWS_Soil.txt ===================
396  headersoil_reqd(cso_code) = "Code"
397  headersoil_reqd(cso_soildepth) = "SoilDepth"
398  headersoil_reqd(cso_soilstcap) = "SoilStoreCap"
399  headersoil_reqd(cso_ksat) = "SatHydraulicCond"
400  headersoil_reqd(cso_soildens) = "SoilDensity"
401  headersoil_reqd(cso_soilinfrate) = "InfiltrationRate"
402  headersoil_reqd(cso_obssmdepth) = "OBS_SMDepth"
403  headersoil_reqd(cso_obssmmax) = "OBS_SMCap"
404  headersoil_reqd(cso_obssnrfrac) = "OBS_SoilNotRocks"
405 
406  ! ========== SUEWS_Conductance.txt ============
407  headercond_reqd(cc_code) = "Code"
408  headercond_reqd(cc_gsg1) = "G1"
409  headercond_reqd(cc_gsg2) = "G2"
410  headercond_reqd(cc_gsg3) = "G3"
411  headercond_reqd(cc_gsg4) = "G4"
412  headercond_reqd(cc_gsg5) = "G5"
413  headercond_reqd(cc_gsg6) = "G6"
414  headercond_reqd(cc_gsth) = "TH"
415  headercond_reqd(cc_gstl) = "TL"
416  headercond_reqd(cc_gss1) = "S1"
417  headercond_reqd(cc_gss2) = "S2"
418  headercond_reqd(cc_gskmax) = "Kmax"
419  headercond_reqd(cc_gsmodel) = "gsModel"
420 
421  ! ========== SUEWS_OHMCoefficients.txt ========
426 
427  ! ========== SUEWS_ESTMCoefficients.txt ========
475  headerestmcoefficients_reqd(ce_alb_ibld) = "Internal_albedo"
476  headerestmcoefficients_reqd(ce_em_ibld) = "Internal_emissivity"
477  headerestmcoefficients_reqd(ce_ch_iwall) = "Internal_CHwall"
478  headerestmcoefficients_reqd(ce_ch_iroof) = "Internal_CHroof"
479  headerestmcoefficients_reqd(ce_ch_ibld) = "Internal_CHbld"
480 
481  ! ========== SUEWS_AnthropogenicEmission.txt ======
492  headeranthropogenic_reqd(ca_ahslopeheating_wd) = "AHSlope_Heating_WD"
493  headeranthropogenic_reqd(ca_ahslopeheating_we) = "AHSlope_Heating_WE"
494  headeranthropogenic_reqd(ca_ahslopecooling_wd) = "AHSlope_Cooling_WD"
495  headeranthropogenic_reqd(ca_ahslopecooling_we) = "AHSlope_Cooling_WE"
496  headeranthropogenic_reqd(ca_tcriticheating_wd) = "TCritic_Heating_WD"
497  headeranthropogenic_reqd(ca_tcriticheating_we) = "TCritic_Heating_WE"
498  headeranthropogenic_reqd(ca_tcriticcooling_wd) = "TCritic_Cooling_WD"
499  headeranthropogenic_reqd(ca_tcriticcooling_we) = "TCritic_Cooling_WE"
500  headeranthropogenic_reqd(ca_enprofwd) = "EnergyUseProfWD"
501  headeranthropogenic_reqd(ca_enprofwe) = "EnergyUseProfWE"
502  headeranthropogenic_reqd(ca_co2mwd) = "ActivityProfWD"
503  headeranthropogenic_reqd(ca_co2mwe) = "ActivityProfWE"
513  headeranthropogenic_reqd(ca_frfossilfuel_heat) = "FrFossilFuel_Heat"
514  headeranthropogenic_reqd(ca_frfossilfuel_nonheat) = "FrFossilFuel_NonHeat"
515  headeranthropogenic_reqd(ca_ef_umolco2perj) = "EF_umolCO2perJ"
517  headeranthropogenic_reqd(ca_fcef_v_kgkmwd) = "FcEF_v_kgkmWD"
518  headeranthropogenic_reqd(ca_fcef_v_kgkmwe) = "FcEF_v_kgkmWE"
519  headeranthropogenic_reqd(ca_co2pointsource) = "CO2PointSource"
520  headeranthropogenic_reqd(ca_trafficunits) = "TrafficUnits"
521 
522  ! ========== SUEWS_Irrigation.txt =============
524  headerirrigation_reqd(cir_iestart) = "Ie_start"
525  headerirrigation_reqd(cir_ieend) = "Ie_end"
526  headerirrigation_reqd(cir_intwu) = "InternalWaterUse"
528  headerirrigation_reqd(cir_h_ponding) = "H_maintain"
535  headerirrigation_reqd(cir_daywat1) = "DayWat(1)"
536  headerirrigation_reqd(cir_daywat2) = "DayWat(2)"
537  headerirrigation_reqd(cir_daywat3) = "DayWat(3)"
538  headerirrigation_reqd(cir_daywat4) = "DayWat(4)"
539  headerirrigation_reqd(cir_daywat5) = "DayWat(5)"
540  headerirrigation_reqd(cir_daywat6) = "DayWat(6)"
541  headerirrigation_reqd(cir_daywat7) = "DayWat(7)"
542  headerirrigation_reqd(cir_daywatper1) = "DayWatPer(1)"
543  headerirrigation_reqd(cir_daywatper2) = "DayWatPer(2)"
544  headerirrigation_reqd(cir_daywatper3) = "DayWatPer(3)"
545  headerirrigation_reqd(cir_daywatper4) = "DayWatPer(4)"
546  headerirrigation_reqd(cir_daywatper5) = "DayWatPer(5)"
547  headerirrigation_reqd(cir_daywatper6) = "DayWatPer(6)"
548  headerirrigation_reqd(cir_daywatper7) = "DayWatPer(7)"
549 
550  ! ========== SUEWS_Profiles.txt ===============
551  headerprofiles_reqd(cpr_code) = "Code"
561  headerprofiles_reqd(cpr_hours(10)) = "9"
562  headerprofiles_reqd(cpr_hours(11)) = "10"
563  headerprofiles_reqd(cpr_hours(12)) = "11"
564  headerprofiles_reqd(cpr_hours(13)) = "12"
565  headerprofiles_reqd(cpr_hours(14)) = "13"
566  headerprofiles_reqd(cpr_hours(15)) = "14"
567  headerprofiles_reqd(cpr_hours(16)) = "15"
568  headerprofiles_reqd(cpr_hours(17)) = "16"
569  headerprofiles_reqd(cpr_hours(18)) = "17"
570  headerprofiles_reqd(cpr_hours(19)) = "18"
571  headerprofiles_reqd(cpr_hours(20)) = "19"
572  headerprofiles_reqd(cpr_hours(21)) = "20"
573  headerprofiles_reqd(cpr_hours(22)) = "21"
574  headerprofiles_reqd(cpr_hours(23)) = "22"
575  headerprofiles_reqd(cpr_hours(24)) = "23"
576 
577  ! ========== SUEWS_WithinGridWaterDist.txt ====
587  headerwgwaterdist_reqd(cwg_tosoilstore) = "ToSoilStore"
588 
589  ! ========== SUEWS_BiogenCO2.txt ======
590  headerbiogen_reqd(cb_code) = "Code"
591  headerbiogen_reqd(cb_alpha) = "alpha"
592  headerbiogen_reqd(cb_beta) = "beta"
593  headerbiogen_reqd(cb_theta) = "theta"
594  headerbiogen_reqd(cb_alpha_enh) = "alpha_enh"
595  headerbiogen_reqd(cb_beta_enh) = "beta_enh"
596  headerbiogen_reqd(cb_resp_a) = "resp_a"
597  headerbiogen_reqd(cb_resp_b) = "resp_b"
598  headerbiogen_reqd(cb_min_r) = "min_respi"
599 
600  ! =======================================================
601 
602  !write(*,*) 'Checking header for ', FileName
603  ! Check columns in input files match model code
604 
605  IF (filename == 'SUEWS_NonVeg.txt') THEN
606  IF (any(headernonveg_file /= headernonveg_reqd)) THEN
607  WRITE (*, *) headernonveg_file == headernonveg_reqd
608  WRITE (*, *) headernonveg_file
609  WRITE (*, *) headernonveg_reqd
610  CALL errorhint(56, 'Names or order of columns in SUEWS_NonVeg.txt does not match model code.', notused, notused, notusedi)
611  ENDIF
612 
613  ELSEIF (filename == 'SUEWS_Veg.txt') THEN
614  IF (any(headerveg_file /= headerveg_reqd)) THEN
615  WRITE (*, *) headerveg_file == headerveg_reqd
616  CALL errorhint(56, 'Names or order of columns in SUEWS_Veg.txt does not match model code.', notused, notused, notusedi)
617  ENDIF
618 
619  ELSEIF (filename == 'SUEWS_Water.txt') THEN
620  IF (any(headerwater_file /= headerwater_reqd)) THEN
621  WRITE (*, *) headerwater_file == headerwater_reqd
622  WRITE (*, *) headerwater_file
623  WRITE (*, *) headerwater_reqd
624  CALL errorhint(56, 'Names or order of columns in SUEWS_Water.txt does not match model code.', notused, notused, notusedi)
625  ENDIF
626 
627  ELSEIF (filename == 'SUEWS_Snow.txt') THEN
628  IF (any(headersnow_file /= headersnow_reqd)) THEN
629  WRITE (*, *) headersnow_file == headersnow_reqd
630  CALL errorhint(56, 'Names or order of columns in SUEWS_Snow.txt does not match model code.', notused, notused, notusedi)
631  ENDIF
632 
633  ELSEIF (filename == 'SUEWS_Soil.txt') THEN
634  IF (any(headersoil_file /= headersoil_reqd)) THEN
635  WRITE (*, *) headersoil_file == headersoil_reqd
636  CALL errorhint(56, 'Names or order of columns in SUEWS_Soil.txt does not match model code.', notused, notused, notusedi)
637  ENDIF
638 
639  ELSEIF (filename == 'SUEWS_Conductance.txt') THEN
640  IF (any(headercond_file /= headercond_reqd)) THEN
641  WRITE (*, *) headercond_file == headercond_reqd
642  CALL errorhint(56, 'Names or order of columns in SUEWS_Cond.txt does not match model code.', notused, notused, notusedi)
643  ENDIF
644 
645  ELSEIF (filename == 'SUEWS_OHMCoefficients.txt') THEN
648  CALL errorhint(56, 'Names or order of columns in SUEWS_OHMCoefficients.txt does not match model code.', &
650  ENDIF
651 
652  ELSEIF (filename == 'SUEWS_ESTMCoefficients.txt') THEN
655  CALL errorhint(56, 'Names or order of columns in SUEWS_ESTMCoefficients.txt does not match model code.', &
657  ENDIF
658 
659  ELSEIF (filename == 'SUEWS_AnthropogenicEmission.txt') THEN
662  CALL errorhint(56, 'Names or order of columns in SUEWS_AnthropogenicEmission.txt does not match model code.', &
664  ENDIF
665 
666  ELSEIF (filename == 'SUEWS_Irrigation.txt') THEN
669  WRITE (*, *) headerirrigation_file
670  WRITE (*, *) headerirrigation_reqd
671  CALL errorhint(56, 'Names or order of columns in SUEWS_Irrigation.txt does not match model code.', &
673  ENDIF
674 
675  ELSEIF (filename == 'SUEWS_Profiles.txt') THEN
676  IF (any(headerprofiles_file /= headerprofiles_reqd)) THEN
678  CALL errorhint(56, 'Names or order of columns in SUEWS_Profiles.txt does not match model code.', &
680  ENDIF
681 
682  ELSEIF (filename == 'SUEWS_WithinGridWaterDist.txt') THEN
685  CALL errorhint(56, 'Names or order of columns in SUEWS_WithinGridWaterDist.txt does not match model code.', &
687  ENDIF
688 
689  ELSEIF (filename == 'SUEWS_BiogenCO2.txt') THEN
690  IF (any(headerbiogen_file /= headerbiogen_reqd)) THEN
691  WRITE (*, *) headerbiogen_file == headerbiogen_reqd
692  CALL errorhint(56, 'Names or order of columns in SUEWS_BiogenCO2.txt does not match model code.', &
694  ENDIF
695 
696  ELSE
697  WRITE (*, *) 'Problem in subroutine InputHeaderCheck. File header not specified in model code for ', filename
699 
700  ENDIF
701 
character(len=20), dimension(ncolumnsbiogen) headerbiogen_reqd
character(len=20), dimension(ncolumnssoil) headersoil_reqd
real(kind(1d0)) notused
character(len=20), dimension(ncolumnswgwaterdist) headerwgwaterdist_file
integer, dimension(24) cpr_hours
character(len=20), dimension(ncolumnswgwaterdist) headerwgwaterdist_reqd
character(len=20), dimension(ncolumnsprofiles) headerprofiles_file
character(len=20), dimension(ncolumnsirrigation) headerirrigation_file
character(len=20), dimension(ncolumnsanthropogenic) headeranthropogenic_file
character(len=20), dimension(ncolumnswater) headerwater_reqd
character(len=20), dimension(ncolumnssoil) headersoil_file
character(len=20), dimension(ncolumnsbiogen) headerbiogen_file
character(len=20), dimension(ncolumnssnow) headersnow_file
character(len=20), dimension(ncolumnsnonveg) headernonveg_file
character(len=20), dimension(ncolumnssnow) headersnow_reqd
character(len=20), dimension(ncolumnsohmcoefficients) headerohmcoefficients_file
character(len=20), dimension(ncolumnswater) headerwater_file
character(len=20), dimension(ncolumnsveg) headerveg_file
character(len=20), dimension(ncolumnsprofiles) headerprofiles_reqd
character(len=20), dimension(ncolumnsirrigation) headerirrigation_reqd
character(len=20), dimension(ncolumnsveg) headerveg_reqd
character(len=20), dimension(ncolumnsestmcoefficients) headerestmcoefficients_reqd
character(len=20), dimension(ncolumnsohmcoefficients) headerohmcoefficients_reqd
character(len=20), dimension(ncolumnsanthropogenic) headeranthropogenic_reqd
character(len=20), dimension(ncolumnsestmcoefficients) headerestmcoefficients_file
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
character(len=20), dimension(ncolumnsconductance) headercond_file
character(len=20), dimension(ncolumnsconductance) headercond_reqd
character(len=20), dimension(ncolumnsnonveg) headernonveg_reqd
Here is the call graph for this function:
Here is the caller graph for this function:

◆ metread()

subroutine metread ( integer  lfn,
real(kind(1d0)), dimension(24)  MetArray,
integer  InputmetFormat,
integer  ldown_option,
integer  NetRadiationMethod,
integer  snowUse,
integer  SMDMethod,
real(kind(1d0))  SoilDepthMeas,
real(kind(1d0))  SoilRocks,
real(kind(1d0))  SoilDensity,
real(kind(1d0))  SmCap 
)

Definition at line 15 of file suews_ctrl_input.f95.

References errorhint(), defaultnotused::nan, defaultnotused::notused, and defaultnotused::notusedi.

Referenced by metdisagg::disaggregatemet(), and suews_initializemetdata().

15 
16  USE defaultnotused
17 
18  IMPLICIT NONE
19 
20  !INPUT
21  REAL(KIND(1d0)), DIMENSION(24)::metarray !Array leaving the subroutine within
22  !each INTERVAL (defined in RunControl.nml)
23  ! - Met data now provided at a resolution of tstep, HCW Jan 2015
24 
25  REAL(KIND(1d0))::smcap, &
26  soildepthmeas, & !Measured soil depth
27  soilrocks, & !Rocks on ground
28  soildensity !Density of soil
29 
30  INTEGER::inputmetformat, & !Format of the meteorological forcing file
31  ldown_option, & !Method of calculating Ldown
32  netradiationmethod, & !Method of calculating Q*
33  smdmethod, & !Method of measured soil moisture
34  snowuse
35 
36  ! Variables read in
37  REAL(KIND(1d0))::avkdn, & !Average downwelling shortwave radiation
38  avrh, & !Average relative humidity
39  avu1, & !Average wind speed
40  dectime, & !Decimal time
41  fcld_obs, & !Cloud fraction observed
42  iy, & !Year
43  id, & !Day
44  it, & !Hour
45  imin, & !Minute
46  kdiff, & !Diffuse shortwave radiation
47  kdir, & !Direct shortwave radiation
48  lai_obs, & !Overall LAI of the study area
49  ldown_obs, & !Downwelling longwave radiation
50  precip, & !Rainfall [mm]
51  pres_hpa, & !Station air pressure in hPa
52  pres_kpa, & !Station air pressure in kPa
53  snowfrac_obs, & !Observed surface fraction of snow (between 0 and 1)
54  qe_obs, & !Observed latent heat flux
55  qf_obs, & !Observed antrhropogeni heat flux
56  qh_obs, & !Observed sensible heat flux
57  qn1_obs, & !Observed net all-wave radiation
58  qs_obs, & !Observed storage heat flux
59  temp_c, & !Air temperature
60  wdir, & !Wind direction
61  wu_m3, & !Water use provided in met forcing file [m3]
62  xsmd !Measured soil moisture deficit
63 
64  INTEGER::iostat_var, lfn
65 
66  !-----------------------------------------------------------------------------------
67  !-----------------------------------------------------------------------------------
68 
69  IF (inputmetformat == 0) THEN !Default format using LUMPS only
70 
71  READ (lfn, *, iostat=iostat_var) iy, id, it, imin, qn1_obs, avu1, avrh, &
73 
74  !Set other variables needed while running SUEWS to zero
75  qf_obs = nan
76  qs_obs = nan
77  qh_obs = nan
78  qe_obs = nan
79  xsmd = -99999
80  kdiff = nan
81  kdir = nan
82  wdir = nan
83 
84  ELSEIF (inputmetformat == 10) THEN !SUEWS reading
85  READ (lfn, *, iostat=iostat_var) iy, id, it, imin, qn1_obs, qh_obs, qe_obs, qs_obs, qf_obs, avu1, avrh, &
88 
89  !write(*,*) 'In LUMPS_MetRead (1)'
90  !write(*,*) 'imin',imin
91  !write(*,*) 'it',it
92  !write(*,*) 'id',id
93  !write(*,*) 'iy',iy
94 
95  !Calculate observed soil moisture deficits from either volumetric or gravimetric SoilStates
96  IF (smdmethod == 1 .AND. xsmd /= -999) THEN !Soil moisture - volumetric
98  ELSEIF (smdmethod == 2 .AND. xsmd /= -999) THEN !Soil moisture -gravimetric
100  ELSE
101  xsmd = -999
102  ENDIF
103 
104  ELSE
105  CALL errorhint(55, 'RunControl.nml, InputMetFormat not usable.', notused, notused, inputmetformat)
106  ENDIF
107 
108  !===============Meteorological variables reading done==========================
109  pres_hpa = pres_kpa*10. ! convert to hPa
110 
111  IF (iostat_var < 0) THEN
112  iostat_var = 0
113  CLOSE (lfn)
114  RETURN
115  ENDIF
116 
117  IF (avkdn < 0) THEN
118  CALL errorhint(27, 'Met Data: avKdn - needed for StoreDrainPrm. resistance, If present, check file not tab delimited', &
120  !sg removed this is causing the problems with resistances
121  ! AvKdn=0 !Solar radiation cannot be lower than 1
122  ENDIF
123 
124  IF ((ldown_option == 1) .AND. (ldown_obs < 0)) THEN
125  CALL errorhint(27, 'Met Data: LWdn (ldown_obs) - impact Q* calc', ldown_obs, dectime, notusedi)
126 
127  ELSEIF (ldown_option == 2) THEN
128  IF (fcld_obs == -999.0 .OR. fcld_obs < 0 .OR. fcld_obs > 1) THEN
129  CALL errorhint(27, 'Met Data: flcd_obs - impacts LW & Q* radiation', fcld_obs, dectime, notusedi)
130  ENDIF
131  ENDIF
132 
133  IF (qn1_obs == -999 .AND. netradiationmethod == 0) THEN !If measured Q* is used and it is -999
134  CALL errorhint(27, 'Met Data: Q* - will impact everything', qn1_obs, dectime, notusedi)
135  ENDIF
136 
137  IF (avu1 <= 0) THEN !If wind speed is negative
138  CALL errorhint(27, 'Met Data: avU1 - impacts aeroydnamic resistances', avu1, dectime, notusedi)
139  ENDIF
140 
141  IF (temp_c < -50 .OR. temp_c > 60) THEN !If temperature unrealistic
142  CALL errorhint(27, 'Met Data: Temp_C - beyond what is expected', temp_c, dectime, notusedi)
143  ENDIF
144 
145  IF (avrh > 100 .OR. avrh < 1) THEN !If relative humidity larger than 100%
146  CALL errorhint(27, 'Met Data: avRH - beyond what is expected', avrh, dectime, notusedi)
147  ENDIF
148 
149  IF (pres_kpa < 80) THEN !If pressure too low
150  CALL errorhint(27, 'Met Data: Pres_kPa - too low - this could be fixed in model', pres_kpa, dectime, notusedi)
151  ENDIF
152 
153  IF (precip < 0) THEN !If rain in negative, set it to zero
154  CALL errorhint(27, 'Met Data: Precip - less than 0', precip, dectime, notusedi)
155  ENDIF
156 
157  IF (snowfrac_obs == nan) snowfrac_obs = 0
158 
159  IF (snowuse == 0 .AND. (snowfrac_obs < 0 .OR. snowfrac_obs > 1)) THEN
160  CALL errorhint(27, 'Met Data: snow not between [0 1]', snowfrac_obs, dectime, notusedi)
161  ENDIF
162 
163  IF (xsmd < 0 .AND. smdmethod == 1) THEN !If soil moisture deficit is zero
164  CALL errorhint(27, 'Met Data: xsmd - less than 0', xsmd, dectime, notusedi)
165  ENDIF
166 
167  !Create an array to be printed out.
168  metarray(1:24) = (/iy, id, it, imin, qn1_obs, qh_obs, qe_obs, qs_obs, qf_obs, avu1, &
169  avrh, temp_c, pres_hpa, precip, avkdn, snowfrac_obs, ldown_obs, &
171 
172  !write(*,*) 'In LUMPS_MetRead (2)'
173  !write(*,*) 'imin',imin
174  !write(*,*) 'it',it
175  !write(*,*) 'id',id
176  !write(*,*) 'iy',iy
177 
178  RETURN
179 
integer inputmetformat
real(kind(1d0)) pres_kpa
real(kind(1d0)) avrh
real(kind(1d0)) nan
real(kind(1d0)) wu_m3
real(kind(1d0)) temp_c
real(kind(1d0)) avu1
real(kind(1d0)) notused
real(kind(1d0)) soilrocks
integer snowuse
real(kind(1d0)) xsmd
real(kind(1d0)) snowfrac_obs
real(kind(1d0)) qf_obs
real(kind(1d0)) soildensity
real(kind(1d0)) kdir
integer id
real(kind(1d0)) ldown_obs
real(kind(1d0)) fcld_obs
integer imin
real(kind(1d0)) soildepthmeas
real(kind(1d0)) avkdn
real(kind(1d0)) lai_obs
real(kind(1d0)) qs_obs
real(kind(1d0)) smcap
integer iy
real(kind(1d0)) qh_obs
integer ldown_option
integer smdmethod
integer netradiationmethod
real(kind(1d0)) precip
integer it
real(kind(1d0)) dectime
real(kind(1d0)) qn1_obs
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
real(kind(1d0)) wdir
real(kind(1d0)) kdiff
real(kind(1d0)) qe_obs
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_control()

subroutine run_control ( integer  eval,
integer  LowerLimit,
integer  Upperlimit 
)

Definition at line 201 of file suews_ctrl_input.f95.

References run_info::file_qs, run_info::lfn_us, and run_info::text.

201  ! ver - determines if value to be read is an integer or real and returns the value
202  ! if ver=-9 - then use integer
203  USE run_info
204  IMPLICIT NONE
205  INTEGER::eval, i, lowerlimit, upperlimit
206  CHARACTER(len=4)::check
207 
208  IF (file_qs) THEN
209 101 READ (lfn_us, *) check
210  WRITE (*, *) check
211  DO i = 1, 3
212  IF (check(i:i) == "#") THEN
213  ! write(*,*)check(i:i),i,"check"
214  GOTO 101
215  ELSE
216  backspace(lfn_us)
217  READ (lfn_us, *) eval
218  !write(*,*)eval, TEXT(1)
219  EXIT
220  ENDIF
221  ENDDO
222  ENDIF
223 
224  WRITE (12, 120) eval, text(1)
225 
226  IF (eval < lowerlimit .OR. eval > upperlimit) THEN
227  WRITE (*, *) "Value out of range"
228  WRITE (*, *) eval, text(1)
229  stop
230  ENDIF
231 
232  WRITE (*, 120) eval, text(1)
233 120 FORMAT(i4, 2x, a90)
234 
235  RETURN
character(len=90), dimension(14) text

◆ skipheader()

subroutine skipheader ( integer  lfn,
integer  skip 
)

Definition at line 240 of file suews_ctrl_input.f95.

References errorhint(), defaultnotused::ios_out, defaultnotused::notused, and defaultnotused::reall.

Referenced by estm_module::suews_getestmdata(), and suews_initializemetdata().

240  USE defaultnotused
241  IMPLICIT NONE
242 
243  INTEGER::skip, lfn, i
244  DO i = 1, skip
245  READ (lfn, *, err=201, iostat=ios_out)
246  END DO
247 
248  RETURN
249 
250 201 reall = REAL(skip)
251  CALL errorhint(20, 'In SkipHeader subroutine.', reall, notused, ios_out)
real(kind(1d0)) notused
real(kind(1d0)) reall
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)
Here is the call graph for this function:
Here is the caller graph for this function: