42 INTEGER,
INTENT(in) :: is
44 REAL(KIND(1D0)),
INTENT(in) :: state_is
45 REAL(KIND(1D0)),
INTENT(in) :: StorCap
46 REAL(KIND(1D0)),
INTENT(in) :: DrainCoef1
47 REAL(KIND(1D0)),
INTENT(in) :: DrainCoef2
48 REAL(KIND(1D0)),
INTENT(in) :: DrainEq
49 REAL(KIND(1D0)),
INTENT(in) :: nsh_real
50 REAL(KIND(1D0)),
INTENT(out) :: drain_is
53 IF (state_is < 0.000000001)
THEN
56 IF (int(draineq) == 1)
THEN
58 IF (state_is < storcap)
THEN
61 drain_is = (draincoef1*(state_is - storcap)**draincoef2)/nsh_real
64 ELSEIF (int(draineq) == 2)
THEN
65 drain_is = (draincoef1*(exp(draincoef2*state_is) - 1))/nsh_real
68 ELSEIF (int(draineq) == 3)
THEN
69 drain_is = (draincoef1*(state_is**draincoef2))/nsh_real
77 IF (drain_is > state_is)
THEN
79 CALL errorhint(61,
'SUEWS_drain: drain_is > state_is for surface is ', drain_is, state_is, is)
81 ELSEIF (drain_is < 0.0001)
THEN
93 is, sfr_surf, PipeCapacity, RunoffToWater, pin, & ! input:
95 drain_surf, AddWater, addImpervious, nsh_real, state_in, frac_water2runoff, &
96 PervFraction, addVeg, SoilStoreCap, addWaterBody, FlowChange, StateLimit, &
97 runoffAGimpervious, runoffAGveg, runoffPipes, ev, soilstore_id, & ! inout:
98 surplusWaterBody, SurplusEvap, runoffWaterBody, & ! inout:
143 INTEGER,
INTENT(in) :: is
145 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: sfr_surf
146 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: AddWater
147 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: state_in
148 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: frac_water2runoff
149 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: SoilStoreCap
150 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: StateLimit
151 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: drain_surf
152 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: WU_surf
154 REAL(KIND(1D0)),
INTENT(in) :: PipeCapacity
155 REAL(KIND(1D0)),
INTENT(in) :: RunoffToWater
156 REAL(KIND(1D0)),
INTENT(in) :: pin
157 REAL(KIND(1D0)),
INTENT(in) :: addImpervious
158 REAL(KIND(1D0)),
INTENT(in) :: nsh_real
159 REAL(KIND(1D0)),
INTENT(in) :: PervFraction
160 REAL(KIND(1D0)),
INTENT(in) :: addVeg
161 REAL(KIND(1D0)),
INTENT(in) :: addWaterBody
162 REAL(KIND(1D0)),
INTENT(in) :: FlowChange
164 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(inout) :: soilstore_id
165 REAL(KIND(1D0)),
DIMENSION(2),
INTENT(inout) :: SurplusEvap
167 REAL(KIND(1D0)),
DIMENSION(nsurf) :: chang
168 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(out) :: runoff
169 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(out) :: state_out
175 REAL(KIND(1D0)),
INTENT(inout) :: surplusWaterBody
176 REAL(KIND(1D0)),
INTENT(inout) :: runoffAGimpervious
177 REAL(KIND(1D0)),
INTENT(inout) :: runoffAGveg
178 REAL(KIND(1D0)),
INTENT(inout) :: runoffPipes
179 REAL(KIND(1D0)),
INTENT(inout) :: ev
180 REAL(KIND(1D0)),
INTENT(inout) :: runoffWaterBody
182 REAL(KIND(1D0)) :: p_mm
185 REAL(KIND(1D0)) :: EvPart
186 REAL(KIND(1D0)),
PARAMETER :: NotUsed = -55.5
189 REAL(KIND(1D0)),
PARAMETER :: IPThreshold_mmhr = 10
202 p_mm = pin + wu_surf(is)
207 p_mm = p_mm + addwater(is)
217 IF (sfr_surf(
pavsurf) /= 0)
THEN
218 p_mm = p_mm + addimpervious/sfr_surf(
pavsurf)
223 chang(is) = p_mm - (drain_surf(is) + ev)
227 IF (p_mm > ipthreshold_mmhr/nsh_real)
THEN
228 runoff(is) = runoff(is) + (p_mm - ipthreshold_mmhr/nsh_real)
229 chang(is) = ipthreshold_mmhr/nsh_real - (drain_surf(is) + ev)
233 state_out(is) = state_in(is) + chang(is)
236 IF (state_out(is) < 0.0)
THEN
239 surplusevap(is) = abs(state_out(is))
240 ev = ev - surplusevap(is)
250 chang(is) = state_out(is) - state_in(is)
254 runoff(is) = runoff(is) + drain_surf(is)*frac_water2runoff(is)
281 chang(is) = p_mm - (drain_surf(is) + ev)
285 IF (p_mm > ipthreshold_mmhr/nsh_real)
THEN
286 runoff(is) = runoff(is) + (p_mm - ipthreshold_mmhr/nsh_real)
287 chang(is) = ipthreshold_mmhr/nsh_real - (drain_surf(is) + ev)
291 state_out(is) = state_in(is) + chang(is)
294 IF (state_out(is) < 0.0)
THEN
297 IF ((soilstore_id(is) + state_out(is)) >= 0)
THEN
298 soilstore_id(is) = soilstore_id(is) + state_out(is)
302 ev = ev - abs(state_out(is))
314 chang(is) = state_out(is) - state_in(is)
320 soilstore_id(is) = soilstore_id(is) + drain_surf(is)*frac_water2runoff(is)
323 IF (soilstore_id(is) > soilstorecap(is))
THEN
324 runoff(is) = runoff(is) + (soilstore_id(is) - soilstorecap(is))
325 soilstore_id(is) = soilstorecap(is)
326 ELSEIF (soilstore_id(is) < 0)
THEN
327 CALL errorhint(62,
'SUEWS_store: soilstore_id(is) < 0 ', soilstore_id(is), notused, is)
336 p_mm = p_mm + addwaterbody/sfr_surf(
watersurf)
341 chang(is) = p_mm + flowchange/nsh_real - ev
344 state_out(is) = state_in(is) + chang(is)
347 IF (state_out(is) < 0.0)
THEN
349 ev = ev - abs(state_out(is))
359 chang(is) = state_out(is) - state_in(is)
375 chang(is) = state_out(is) - state_in(is)
390 sfr_surf, pipecapacity, runofftowater, &
391 runoffagimpervious, surpluswaterbody, runoffagveg, runoffpipes)
399 pin, nsh_real, & ! input:
400 PipeCapacity, RunoffToWater, &
401 addImpervious, addVeg, addWaterBody, FlowChange, &
402 SoilStoreCap_surf, StateLimit_surf, &
404 sfr_surf, drain_surf, AddWater_surf, frac_water2runoff_surf, WU_surf, &
405 ev_surf_in, state_surf_in, soilstore_surf_in, &
406 ev_surf_out, state_surf_out, soilstore_surf_out, & ! output:
408 runoffAGimpervious_grid, runoffAGveg_grid, runoffPipes_grid, runoffWaterBody_grid & ! output
415 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: sfr_surf
416 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: AddWater_surf
417 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: state_surf_in
418 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: frac_water2runoff_surf
419 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: SoilStoreCap_surf
420 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: StateLimit_surf
421 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: drain_surf
422 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: WU_surf
423 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: ev_surf_in
424 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: soilstore_surf_in
427 REAL(KIND(1D0)),
INTENT(in) :: PipeCapacity
428 REAL(KIND(1D0)),
INTENT(in) :: RunoffToWater
429 REAL(KIND(1D0)),
INTENT(in) :: pin
430 REAL(KIND(1D0)),
INTENT(in) :: addImpervious
431 REAL(KIND(1D0)),
INTENT(in) :: nsh_real
432 REAL(KIND(1D0)),
INTENT(in) :: PervFraction
433 REAL(KIND(1D0)),
INTENT(in) :: addVeg
434 REAL(KIND(1D0)),
INTENT(in) :: addWaterBody
435 REAL(KIND(1D0)),
INTENT(in) :: FlowChange
441 REAL(KIND(1D0)),
INTENT(out) :: runoffAGimpervious_grid
442 REAL(KIND(1D0)),
INTENT(out) :: runoffAGveg_grid
443 REAL(KIND(1D0)),
INTENT(out) :: runoffPipes_grid
444 REAL(KIND(1D0)),
INTENT(out) :: runoffWaterBody_grid
447 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(out) :: ev_surf_out
448 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(out) :: state_surf_out
449 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(out) :: soilstore_surf_out
451 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(out) :: runoff_surf
452 REAL(KIND(1D0)),
DIMENSION(nsurf) :: soilstore
454 REAL(KIND(1D0)),
DIMENSION(2) :: SurplusEvap
460 REAL(KIND(1D0)) :: surplusWaterBody
464 REAL(KIND(1D0)),
DIMENSION(nsurf) :: ev_surf
468 REAL(KIND(1D0)),
PARAMETER :: NotUsed = -55.5
471 REAL(KIND(1D0)),
PARAMETER :: IPThreshold_mmhr = 10
474 soilstore = soilstore_surf_in
479 runoffagimpervious_grid = 0
480 runoffwaterbody_grid = 0
492 IF (sfr_surf(is) > 0)
THEN
496 is, sfr_surf, pipecapacity, runofftowater, pin, &
498 drain_surf, addwater_surf, addimpervious, nsh_real, state_surf_in, frac_water2runoff_surf, &
499 pervfraction, addveg, soilstorecap_surf, addwaterbody, flowchange, statelimit_surf, &
500 runoffagimpervious_grid, runoffagveg_grid, runoffpipes_grid, ev_surf(is), soilstore, &
501 surpluswaterbody, surplusevap, runoffwaterbody_grid, &
502 runoff_surf, state_surf_out)
508 soilstore_surf_out = soilstore
511 ev_surf_out = ev_surf
517 pin, nsh_real, nlayer, &
518 sfr_roof, StateLimit_roof, SoilStoreCap_roof, WetThresh_roof, & ! input:
519 ev_roof_in, state_roof_in, soilstore_roof_in, & ! input:
520 sfr_wall, StateLimit_wall, SoilStoreCap_wall, WetThresh_wall, & ! input:
521 ev_wall_in, state_wall_in, soilstore_wall_in, & ! input:
522 ev_roof_out, state_roof_out, soilstore_roof_out, runoff_roof, & ! general output:
523 ev_wall_out, state_wall_out, soilstore_wall_out, runoff_wall, & ! general output:
524 state_building, soilstore_building, runoff_building, SoilStoreCap_building)
528 INTEGER,
INTENT(in) :: nlayer
529 REAL(KIND(1D0)),
INTENT(in) :: pin
530 REAL(KIND(1D0)),
INTENT(in) :: nsh_real
533 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: sfr_roof
534 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: StateLimit_roof
535 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: WetThresh_roof
536 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: SoilStoreCap_roof
537 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: state_roof_in
538 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: soilstore_roof_in
539 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: ev_roof_in
542 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: sfr_wall
543 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: StateLimit_wall
544 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: WetThresh_wall
545 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: SoilStoreCap_wall
546 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: state_wall_in
547 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: soilstore_wall_in
548 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(in) :: ev_wall_in
551 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(out) :: ev_roof_out
552 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(out) :: state_roof_out
553 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(out) :: soilstore_roof_out
554 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(out) :: runoff_roof
557 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(out) :: ev_wall_out
558 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(out) :: state_wall_out
559 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(out) :: soilstore_wall_out
560 REAL(KIND(1D0)),
DIMENSION(nlayer),
INTENT(out) :: runoff_wall
562 REAL(KIND(1D0)),
INTENT(out) :: state_building
563 REAL(KIND(1D0)),
INTENT(out) :: soilstore_building
564 REAL(KIND(1D0)),
INTENT(out) :: runoff_building
565 REAL(KIND(1D0)),
INTENT(out) :: SoilStoreCap_building
567 REAL(KIND(1D0)) :: precip_excess_roof
568 REAL(KIND(1D0)) :: precip_excess_wall
569 REAL(KIND(1D0)) :: pin_wall
571 REAL(KIND(1D0)),
DIMENSION(nlayer) :: chang_roof
572 REAL(KIND(1D0)),
DIMENSION(nlayer) :: chang_wall
573 REAL(KIND(1D0)),
DIMENSION(nlayer) :: drain_roof
574 REAL(KIND(1D0)),
DIMENSION(nlayer) :: drain_wall
575 REAL(KIND(1D0)),
DIMENSION(nlayer) :: infil_roof
576 REAL(KIND(1D0)),
DIMENSION(nlayer) :: infil_wall
577 REAL(KIND(1D0)),
DIMENSION(nlayer) :: evap_roof
578 REAL(KIND(1D0)),
DIMENSION(nlayer) :: evap_wall
584 REAL(KIND(1D0)),
PARAMETER :: IPThreshold_mmhr = 10
585 REAL(KIND(1D0)) :: IPThreshold
587 INTEGER :: n_layer, i_layer
590 ipthreshold = ipthreshold_mmhr/nsh_real
593 precip_excess_roof = pin - ipthreshold
596 DO i_layer = 1, nlayer
600 runoff_roof(i_layer) = 0.0
601 chang_roof(i_layer) = 0.0
605 drain_roof(i_layer) = state_roof_in(i_layer)*.0
608 infil_roof(i_layer) = state_roof_in(i_layer)*.3
610 IF (precip_excess_roof > 0)
THEN
612 runoff_roof(i_layer) = precip_excess_roof
613 chang_roof(i_layer) = ipthreshold - ev_roof_in(i_layer) - drain_roof(i_layer) - infil_roof(i_layer)
615 chang_roof(i_layer) = pin - ev_roof_in(i_layer) - drain_roof(i_layer) - infil_roof(i_layer)
619 state_roof_out(i_layer) = state_roof_in(i_layer) + chang_roof(i_layer)
622 IF (state_roof_out(i_layer) < 0.0)
THEN
625 IF ((soilstore_roof_in(i_layer) + state_roof_out(i_layer)) >= 0)
THEN
627 soilstore_roof_out(i_layer) = soilstore_roof_in(i_layer) + state_roof_out(i_layer)
630 ev_roof_out(i_layer) = ev_roof_in(i_layer) - abs(state_roof_out(i_layer))
633 state_roof_out(i_layer) = 0.0
636 IF (soilstore_roof_in(i_layer) + infil_roof(i_layer) > soilstorecap_roof(i_layer))
THEN
638 soilstore_roof_out(i_layer) = soilstorecap_roof(i_layer)
641 runoff_roof = runoff_roof + (soilstore_roof_in(i_layer) + infil_roof(i_layer) - soilstorecap_roof(i_layer))
643 soilstore_roof_out(i_layer) = soilstore_roof_in(i_layer) + infil_roof(i_layer)
650 runoff_wall(i_layer) = 0.0
651 chang_wall(i_layer) = 0.0
656 pin_wall = runoff_roof(i_layer) + pin*.2
657 precip_excess_wall = pin_wall - statelimit_wall(i_layer)
661 drain_wall(i_layer) = state_wall_in(i_layer)*.0
664 infil_wall(i_layer) = state_wall_in(i_layer)*.1
666 IF (precip_excess_wall > 0)
THEN
668 runoff_wall(i_layer) = precip_excess_wall
669 chang_wall(i_layer) = statelimit_wall(i_layer) - ev_wall_in(i_layer) - drain_wall(i_layer) - infil_wall(i_layer)
671 chang_wall(i_layer) = pin_wall - ev_wall_in(i_layer) - drain_wall(i_layer) - infil_wall(i_layer)
675 state_wall_out(i_layer) = state_wall_in(i_layer) + chang_wall(i_layer)
678 IF (state_wall_out(i_layer) < 0.0)
THEN
681 IF ((soilstore_wall_in(i_layer) + state_wall_out(i_layer)) >= 0)
THEN
683 soilstore_wall_out(i_layer) = soilstore_wall_in(i_layer) + state_wall_out(i_layer)
686 ev_wall_out(i_layer) = ev_wall_in(i_layer) - abs(state_wall_out(i_layer))
689 state_wall_out(i_layer) = 0.0
692 IF (soilstore_wall_in(i_layer) + infil_wall(i_layer) > soilstorecap_wall(i_layer))
THEN
694 soilstore_wall_out(i_layer) = soilstorecap_wall(i_layer)
697 runoff_wall(i_layer) = &
698 runoff_wall(i_layer) + &
699 (soilstore_wall_in(i_layer) + infil_wall(i_layer) - soilstorecap_wall(i_layer))
701 soilstore_wall_out(i_layer) = soilstore_wall_in(i_layer) + infil_wall(i_layer)
715 state_building = dot_product(state_roof_out, sfr_roof) + dot_product(state_wall_out, sfr_wall)
716 soilstore_building = dot_product(soilstore_roof_out, sfr_roof) + dot_product(soilstore_wall_out, sfr_wall)
717 soilstorecap_building = dot_product(soilstorecap_roof, sfr_roof) + dot_product(soilstorecap_wall, sfr_wall)
719 runoff_building = dot_product(runoff_wall, sfr_wall)
725 is, runoff, & ! input:
726 sfr_surf, PipeCapacity, RunoffToWater, &
727 runoffAGimpervious, surplusWaterBody, runoffAGveg, runoffPipes)
731 INTEGER,
INTENT(in) :: is
732 REAL(KIND(1D0)),
INTENT(in) :: sfr_surf(nsurf), runoff(nsurf), PipeCapacity, RunoffToWater
733 REAL(KIND(1D0)),
INTENT(inout) :: runoffAGimpervious, surplusWaterBody, runoffAGveg, runoffPipes
736 runoffpipes = runoffpipes + (runoff(is)*sfr_surf(is))
740 IF (runoffpipes > pipecapacity)
THEN
744 IF (sfr_surf(
watersurf) > 0.0000001)
THEN
747 runoffagimpervious = runoffagimpervious + (runoffpipes - pipecapacity)*(1 - runofftowater)
748 surpluswaterbody = surpluswaterbody + (runoffpipes - pipecapacity)*runofftowater
751 runoffagimpervious = runoffagimpervious + (runoffpipes - pipecapacity)
755 IF (sfr_surf(
watersurf) > 0.0000001)
THEN
757 runoffagveg = runoffagveg + (runoffpipes - pipecapacity)*(1 - runofftowater)
758 surpluswaterbody = surpluswaterbody + (runoffpipes - pipecapacity)*runofftowater
761 runoffagveg = runoffagveg + (runoffpipes - pipecapacity)
765 runoffpipes = pipecapacity
774 SnowUse, WaterDist, sfr_surf, Drain, & ! input:
775 AddWaterRunoff, AddWater)
782 INTEGER,
INTENT(in) :: SnowUse
784 REAL(KIND(1D0)),
INTENT(in) :: WaterDist(nsurf + 1, nsurf - 1)
785 REAL(KIND(1D0)),
INTENT(in) :: sfr_surf(nsurf)
786 REAL(KIND(1D0)),
INTENT(in) :: Drain(nsurf)
788 REAL(KIND(1D0)),
INTENT(out) :: AddWaterRunoff(nsurf)
789 REAL(KIND(1D0)),
INTENT(out) :: AddWater(nsurf)
792 INTEGER :: NSurfDoNotReceiveDrainage = 0
796 addwaterrunoff(ii) = waterdist(8, ii)
801 DO ii = 1, nsurf - nsurfdonotreceivedrainage
802 DO jj = 1, nsurf - (nsurfdonotreceivedrainage + 1)
804 IF (sfr_surf(ii) /= 0)
THEN
807 IF (snowuse == 0)
THEN
808 addwater(ii) = addwater(ii) + (drain(jj)*sfr_surf(jj)/sfr_surf(ii))*waterdist(ii, jj)
812 addwaterrunoff(jj) = addwaterrunoff(jj) + waterdist(ii, jj)
816 addwaterrunoff(jj) = addwaterrunoff(jj) + waterdist(ii, jj)
827 NonWaterFraction, & !input
828 SoilStoreCap, sfr_surf, soilstore_id, &
829 SoilMoistCap, SoilState, & !output
834 REAL(KIND(1D0)),
INTENT(in) :: NonWaterFraction
835 REAL(KIND(1D0)),
INTENT(in),
DIMENSION(nsurf) :: SoilStoreCap, sfr_surf, soilstore_id
837 REAL(KIND(1D0)),
INTENT(out) :: SoilMoistCap, SoilState
838 REAL(KIND(1D0)),
INTENT(out) :: vsmd, smd
841 REAL(KIND(1D0)) :: fveg
846 IF (nonwaterfraction /= 0)
THEN
848 soilmoistcap = soilmoistcap + (soilstorecap(is)*sfr_surf(is)/nonwaterfraction)
849 soilstate = soilstate + (soilstore_id(is)*sfr_surf(is)/nonwaterfraction)
855 smd = soilmoistcap - soilstate
870 vsmd = vsmd + (soilstorecap(is) - soilstore_id(is))*sfr_surf(is)/fveg
880 SMDMethod, xsmd, NonWaterFraction, SoilMoistCap, & !input
881 SoilStoreCap, surf_chang_per_tstep, &
882 soilstore_id, soilstoreOld, sfr_surf, &
883 smd, smd_nsurf, tot_chang_per_tstep, SoilState)
888 INTEGER,
INTENT(in) :: SMDMethod
889 REAL(KIND(1D0)),
INTENT(in) :: xsmd
890 REAL(KIND(1D0)),
INTENT(in) :: NonWaterFraction
891 REAL(KIND(1D0)),
INTENT(in) :: SoilMoistCap
893 REAL(KIND(1D0)),
INTENT(in) :: surf_chang_per_tstep
894 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: soilstore_id
895 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: soilstoreOld
896 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: sfr_surf
897 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: SoilStoreCap
899 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(out) :: smd_nsurf
900 REAL(KIND(1D0)),
INTENT(out) :: SoilState
901 REAL(KIND(1D0)),
INTENT(out) :: smd
902 REAL(KIND(1D0)),
INTENT(out) :: tot_chang_per_tstep
904 REAL(KIND(1D0)),
PARAMETER :: NotUsed = -999
905 REAL(KIND(1D0)),
PARAMETER :: NAN = -999
909 IF (nonwaterfraction /= 0)
THEN
911 soilstate = soilstate + (soilstore_id(is)*sfr_surf(is)/nonwaterfraction)
912 IF (soilstate < 0)
THEN
913 CALL errorhint(62,
'SUEWS_Calculations: total SoilState < 0 (just added surface is) ', soilstate, notused, is)
914 ELSEIF (soilstate > soilmoistcap)
THEN
915 CALL errorhint(62,
'SUEWS_Calculations: total SoilState > capacity (just added surface is) ', soilstate, notused, is)
929 smd = soilmoistcap - soilstate
930 smd_nsurf = soilstorecap - soilstore_id
934 tot_chang_per_tstep = surf_chang_per_tstep
935 DO is = 1, (
nsurf - 1)
936 tot_chang_per_tstep = tot_chang_per_tstep + ((soilstore_id(is) - soilstoreold(is))*sfr_surf(is))
939 IF (smdmethod > 0)
THEN
949 sfr_surf, & ! input: ! surface fractions
950 SoilStoreCap, & !Capacity of soil store for each surface [mm]
951 SoilDepth, & !Depth of sub-surface soil store for each surface [mm]
952 SatHydraulicConduct, & !Saturated hydraulic conductivity for each soil subsurface [mm s-1]
953 SurfaceArea, & !Surface area of the study area [m2]
954 NonWaterFraction, & ! sum of surface cover fractions for all except water surfaces
955 tstep_real, & !tstep cast as a real for use in calculations
956 soilstore_id, & ! inout: !Soil moisture of each surface type [mm]
957 runoffSoil, & !Soil runoff from each soil sub-surface [mm]
958 runoffSoil_per_tstep & ! output:!Runoff to deep soil per timestep [mm] (for whole surface, excluding water body)
981 REAL(KIND(1D0)),
INTENT(in) :: sfr_surf(nsurf)
982 REAL(KIND(1D0)),
INTENT(in) :: SoilStoreCap(nsurf)
983 REAL(KIND(1D0)),
INTENT(in) :: SoilDepth(nsurf)
984 REAL(KIND(1D0)),
INTENT(in) :: SatHydraulicConduct(nsurf)
985 REAL(KIND(1D0)),
INTENT(in) :: SurfaceArea
986 REAL(KIND(1D0)),
INTENT(in) :: NonWaterFraction
987 REAL(KIND(1D0)),
INTENT(in) :: tstep_real
989 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(inout) :: soilstore_id
990 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(out) :: runoffSoil
992 REAL(KIND(1D0)),
INTENT(out) :: runoffSoil_per_tstep
996 DimenWaterCon1, DimenWaterCon2, &
1001 B_r1, MatPot1, Km1, &
1002 B_r2, MatPot2, Km2, &
1003 Distance, KmWeight, dI, &
1006 REAL(KIND(1D0)),
PARAMETER :: &
1023 runoffsoil_per_tstep = 0
1025 DO is = 1, nsurf - 1
1027 IF (sfr_surf(is) /= 0 .AND. soilstorecap(is) > 0)
THEN
1029 DO jj = is + 1, nsurf - 1
1031 IF (sfr_surf(jj) /= 0 .AND. soilstorecap(jj) > 0)
THEN
1036 soilmoistcap_vol1 = soilstorecap(is)/soildepth(is)
1037 soilmoist_vol1 = soilstore_id(is)/soildepth(is)
1046 IF (b_r1 >= soilmoist_vol1)
THEN
1051 dimenwatercon1 = (soilmoist_vol1 - b_r1)/(soilmoistcap_vol1 - b_r1)
1054 IF (dimenwatercon1 > 0.99999)
THEN
1055 dimenwatercon1 = dimenwatercon1 - 0.0001
1058 IF (dimenwatercon1 < 0.00000005)
THEN
1059 dimenwatercon1 = dimenwatercon1 + 0.0000001
1064 matpot1 = sqrt(1/dimenwatercon1**2 - 1)/alphavg
1067 km1 = sathydraulicconduct(is)*sqrt(dimenwatercon1)*(1 - (1 - dimenwatercon1**2)**0.5)**2
1070 IF (matpot1 > 100000)
THEN
1079 soilmoistcap_vol2 = soilstorecap(jj)/soildepth(jj)
1080 soilmoist_vol2 = soilstore_id(jj)/soildepth(jj)
1088 IF (b_r2 >= soilmoist_vol2)
THEN
1092 dimenwatercon2 = (soilmoist_vol2 - b_r2)/(soilmoistcap_vol2 - b_r2)
1094 IF (dimenwatercon2 > 0.99999)
THEN
1095 dimenwatercon2 = dimenwatercon2 - 0.0001
1098 IF (dimenwatercon2 < 0.00000005)
THEN
1099 dimenwatercon2 = dimenwatercon2 + 0.0000001
1109 matpot2 = sqrt(1/dimenwatercon2**2 - 1)/alphavg
1112 km2 = sathydraulicconduct(jj)*sqrt(dimenwatercon2)*(1 - (1 - dimenwatercon2**2)**0.5)**2
1114 IF ((matpot2) > 100000)
THEN
1125 distance = (sqrt(sfr_surf(is)*surfacearea/nunits) + sqrt(sfr_surf(jj)*surfacearea/nunits))/2
1128 kmweight = (sfr_surf(is)*km1 + sfr_surf(jj)*km2)/(sfr_surf(is) + sfr_surf(jj))
1132 di_dt = -(kmweight)*(-matpot1 + matpot2)/(distance*1000)
1136 di = di_dt*tstep_real
1142 IF ((soilstore_id(jj) >= di*sfr_surf(is)/sfr_surf(jj)) .AND. ((soilstore_id(is) + di) >= 0))
THEN
1143 soilstore_id(is) = soilstore_id(is) + di
1144 soilstore_id(jj) = soilstore_id(jj) - di*sfr_surf(is)/sfr_surf(jj)
1147 ELSEIF ((soilstore_id(is) + di) < 0)
THEN
1148 soilstore_id(jj) = soilstore_id(jj) + soilstore_id(is)*sfr_surf(is)/sfr_surf(jj)
1149 soilstore_id(is) = 0
1153 soilstore_id(is) = soilstore_id(is) + soilstore_id(jj)*sfr_surf(jj)/sfr_surf(is)
1154 soilstore_id(jj) = 0
1158 IF (soilstore_id(is) > soilstorecap(is))
THEN
1159 runoffsoil(is) = runoffsoil(is) + (soilstore_id(is) - soilstorecap(is))
1160 soilstore_id(is) = soilstorecap(is)
1166 IF (soilstore_id(jj) > soilstorecap(jj))
THEN
1167 runoffsoil(jj) = runoffsoil(jj) + (soilstore_id(jj) - soilstorecap(jj))
1168 soilstore_id(jj) = soilstorecap(jj)
1177 runoffsoil_per_tstep = runoffsoil_per_tstep + (runoffsoil(is)*sfr_surf(is)/nonwaterfraction)
1190 nsh_real, & ! input:
1191 wu_m3, SurfaceArea, sfr_surf, &
1192 IrrFracPaved, IrrFracBldgs, &
1193 IrrFracEveTr, IrrFracDecTr, IrrFracGrass, &
1194 IrrFracBSoil, IrrFracWater, &
1195 DayofWeek_id, WUProfA_24hr, WUProfM_24hr, &
1196 InternalWaterUse_h, HDD_id, WUDay_id, &
1197 WaterUseMethod, NSH, it, imin, DLS, &
1198 wu_surf, wu_int, wu_ext)
1219 REAL(KIND(1D0)),
INTENT(in) :: nsh_real
1220 REAL(KIND(1D0)),
INTENT(in) :: wu_m3
1221 REAL(KIND(1D0)),
INTENT(in) :: SurfaceArea
1222 REAL(KIND(1D0)),
INTENT(IN) :: IrrFracPaved
1223 REAL(KIND(1D0)),
INTENT(IN) :: IrrFracBldgs
1224 REAL(KIND(1D0)),
INTENT(IN) :: IrrFracEveTr
1225 REAL(KIND(1D0)),
INTENT(IN) :: IrrFracDecTr
1226 REAL(KIND(1D0)),
INTENT(IN) :: IrrFracGrass
1227 REAL(KIND(1D0)),
INTENT(IN) :: IrrFracBSoil
1228 REAL(KIND(1D0)),
INTENT(IN) :: IrrFracWater
1229 REAL(KIND(1D0)),
INTENT(in) :: InternalWaterUse_h
1230 REAL(KIND(1D0)),
DIMENSION(0:23, 2),
INTENT(in) :: WUProfA_24hr
1231 REAL(KIND(1D0)),
DIMENSION(0:23, 2),
INTENT(in) :: WUProfM_24hr
1232 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(in) :: sfr_surf
1234 REAL(KIND(1D0)),
DIMENSION(12),
INTENT(in) :: HDD_id
1235 REAL(KIND(1D0)),
DIMENSION(9),
INTENT(in) :: WUDay_id
1237 INTEGER,
INTENT(in) :: DayofWeek_id(3)
1238 INTEGER,
INTENT(in) :: WaterUseMethod
1239 INTEGER,
INTENT(in) :: NSH
1240 INTEGER,
INTENT(in) :: it
1241 INTEGER,
INTENT(in) :: imin
1242 INTEGER,
INTENT(in) :: DLS
1244 REAL(KIND(1D0)),
DIMENSION(nsurf),
INTENT(out) :: wu_surf
1245 REAL(KIND(1D0)),
INTENT(out) :: wu_int
1246 REAL(KIND(1D0)),
INTENT(out) :: wu_ext
1248 REAL(KIND(1D0)) :: wu_EveTr
1249 REAL(KIND(1D0)) :: wu_DecTr
1250 REAL(KIND(1D0)) :: wu_Grass
1252 REAL(KIND(1D0)),
DIMENSION(nsurf) :: WUDay_A_id
1253 REAL(KIND(1D0)),
DIMENSION(nsurf) :: WUDay_M_id
1254 REAL(KIND(1D0)),
DIMENSION(nsurf) :: IrrFrac
1255 REAL(KIND(1D0)),
DIMENSION(nsurf) :: WUArea
1260 REAL(KIND(1D0)) :: WUAreaTotal_m2
1261 REAL(KIND(1D0)) :: InternalWaterUse
1262 REAL(KIND(1D0)) :: flag_WuM = 1
1263 REAL(KIND(1D0)) :: wu
1267 REAL(KIND(1D0)),
PARAMETER :: NAN = -999.
1268 REAL(KIND(1D0)) :: OverUse
1269 REAL(KIND(1D0)) :: rain_cum_daily
1271 REAL(KIND(1D0)) :: get_Prof_SpecTime_sum
1273 REAL(KIND(1D0)) :: WUProfA_tstep
1274 REAL(KIND(1D0)) :: WUProfM_tstep
1284 tstep = int(3600/nsh)
1287 rain_cum_daily = hdd_id(11)
1294 irrfrac = [irrfracpaved, irrfracbldgs, &
1295 irrfracevetr, irrfracdectr, irrfracgrass, &
1296 irrfracbsoil, irrfracwater]
1301 IF (waterusemethod == 1)
THEN
1308 wuarea = irrfrac*sfr_surf*surfacearea
1309 wuareatotal_m2 = sum(wuarea)
1317 IF (wu_m3 == nan .OR. wu_m3 == 0)
THEN
1321 IF (wuareatotal_m2 > 0)
THEN
1322 wu = (wu_m3/wuareatotal_m2*1000)
1336 wu_surf = wu*irrfrac
1338 wu = (wu_m3/surfacearea*1000)
1344 ELSEIF (waterusemethod == 0)
THEN
1353 IF (dayofweek_id(1) == 1 .OR. dayofweek_id(1) == 7)
THEN
1369 wuprofa_tstep = get_prof_spectime_sum(ih, imin, 0, wuprofa_24hr(:, iu), tstep)
1374 IF (rain_cum_daily > 2)
THEN
1379 wuprofm_tstep = get_prof_spectime_sum(ih, imin, 0, wuprofm_24hr(:, iu), tstep)
1382 wu_surf = wuprofa_tstep*wuday_a_id + wuprofm_tstep*wuday_m_id*flag_wum
1384 wu_surf = wu_surf*irrfrac
1388 wu = dot_product(wu_surf, sfr_surf)
1395 internalwateruse = internalwateruse_h/nsh_real
1398 wu_ext = wu - (internalwateruse + overuse)
1400 IF (wu_ext < 0)
THEN
1401 overuse = abs(wu_ext)
1407 wu_int = wu - wu_ext
1410 IF (wu_ext /= 0 .AND. wu /= 0)
THEN
1414 wu_surf = wu_surf*wu_ext/wu
integer, parameter bldgsurf
integer, parameter conifsurf
integer, parameter watersurf
integer, parameter grasssurf
integer, parameter bsoilsurf
integer, parameter pavsurf
integer, parameter excesssurf
integer, parameter decidsurf
subroutine cal_water_storage_surf(pin, nsh_real, PipeCapacity, RunoffToWater, addImpervious, addVeg, addWaterBody, FlowChange, SoilStoreCap_surf, StateLimit_surf, PervFraction, sfr_surf, drain_surf, AddWater_surf, frac_water2runoff_surf, WU_surf, ev_surf_in, state_surf_in, soilstore_surf_in, ev_surf_out, state_surf_out, soilstore_surf_out, runoff_surf, runoffAGimpervious_grid, runoffAGveg_grid, runoffPipes_grid, runoffWaterBody_grid)
subroutine suews_update_soilmoist(NonWaterFraction, SoilStoreCap, sfr_surf, soilstore_id, SoilMoistCap, SoilState, vsmd, smd)
subroutine suews_cal_soilstate(SMDMethod, xsmd, NonWaterFraction, SoilMoistCap, SoilStoreCap, surf_chang_per_tstep, soilstore_id, soilstoreOld, sfr_surf, smd, smd_nsurf, tot_chang_per_tstep, SoilState)
subroutine updateflood(is, runoff, sfr_surf, PipeCapacity, RunoffToWater, runoffAGimpervious, surplusWaterBody, runoffAGveg, runoffPipes)
subroutine drainage(is, state_is, StorCap, DrainEq, DrainCoef1, DrainCoef2, nsh_real, drain_is)
subroutine redistributewater(SnowUse, WaterDist, sfr_surf, Drain, AddWaterRunoff, AddWater)
subroutine cal_water_storage_building(pin, nsh_real, nlayer, sfr_roof, StateLimit_roof, SoilStoreCap_roof, WetThresh_roof, ev_roof_in, state_roof_in, soilstore_roof_in, sfr_wall, StateLimit_wall, SoilStoreCap_wall, WetThresh_wall, ev_wall_in, state_wall_in, soilstore_wall_in, ev_roof_out, state_roof_out, soilstore_roof_out, runoff_roof, ev_wall_out, state_wall_out, soilstore_wall_out, runoff_wall, state_building, soilstore_building, runoff_building, SoilStoreCap_building)
subroutine suews_cal_horizontalsoilwater(sfr_surf, SoilStoreCap, SoilDepth, SatHydraulicConduct, SurfaceArea, NonWaterFraction, tstep_real, soilstore_id, runoffSoil, runoffSoil_per_tstep)
subroutine suews_cal_wateruse(nsh_real, wu_m3, SurfaceArea, sfr_surf, IrrFracPaved, IrrFracBldgs, IrrFracEveTr, IrrFracDecTr, IrrFracGrass, IrrFracBSoil, IrrFracWater, DayofWeek_id, WUProfA_24hr, WUProfM_24hr, InternalWaterUse_h, HDD_id, WUDay_id, WaterUseMethod, NSH, it, imin, DLS, wu_surf, wu_int, wu_ext)
subroutine cal_water_storage(is, sfr_surf, PipeCapacity, RunoffToWater, pin, WU_surf, drain_surf, AddWater, addImpervious, nsh_real, state_in, frac_water2runoff, PervFraction, addVeg, SoilStoreCap, addWaterBody, FlowChange, StateLimit, runoffAGimpervious, runoffAGveg, runoffPipes, ev, soilstore_id, surplusWaterBody, SurplusEvap, runoffWaterBody, runoff, state_out)
subroutine errorhint(errh, ProblemFile, VALUE, value2, valueI)