Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source code updates #30

Merged
merged 16 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/actions.f90
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ subroutine actions (ob_cur, ob_num, idtbl)
!set organics and constituents from irr.ops ! irrig(j)%water = cs_irr(j) =
if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, " ", "IRRIGATE", phubase(j), &
pcom(j)%plcur(ipl)%phuacc, soil(j)%sw,pl_mass(j)%tot(ipl)%m, rsd1(j)%tot(ipl)%m, &
pcom(j)%plcur(ipl)%phuacc, soil(j)%sw,pl_mass(j)%tot(ipl)%m, soil1(j)%rsd(1)%m, &
sol_sumno3(j), sol_sumsolp(j), irrig(j)%applied
end if
else
!! set demand for irrigation from channel, reservoir or aquifer
if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, " ", "IRRIG_DMD", phubase(j), &
pcom(j)%plcur(ipl)%phuacc, soil(j)%sw,pl_mass(j)%tot(ipl)%m, rsd1(j)%tot(ipl)%m, &
pcom(j)%plcur(ipl)%phuacc, soil(j)%sw,pl_mass(j)%tot(ipl)%m, soil1(j)%rsd(1)%m, &
sol_sumno3(j), sol_sumsolp(j), irrop_db(irrop)%amt_mm
end if
end if
Expand Down Expand Up @@ -244,7 +244,7 @@ subroutine actions (ob_cur, ob_num, idtbl)

if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, " ", "IRRIGATE", phubase(j), &
pcom(j)%plcur(ipl)%phuacc, soil(j)%sw,pl_mass(j)%tot(ipl)%m, rsd1(j)%tot(ipl)%m, &
pcom(j)%plcur(ipl)%phuacc, soil(j)%sw,pl_mass(j)%tot(ipl)%m, soil1(j)%rsd(1)%m, &
sol_sumno3(j), sol_sumsolp(j), irrig(j)%demand
end if

Expand All @@ -270,15 +270,15 @@ subroutine actions (ob_cur, ob_num, idtbl)
if (pco%mgtout == "y") then
write (2612,*) j, time%yrc, time%mo, time%day_mo, mgt%op_char, " FERT-WET", &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, pl_mass(j)%tot(ipl)%m, &
rsd1(j)%tot_com%m, sol_sumno3(j), sol_sumsolp(j), frt_kg, fertno3, fertnh3, &
soil1(j)%rsd(1)%m, sol_sumno3(j), sol_sumsolp(j), frt_kg, fertno3, fertnh3, &
fertorgn, fertsolp, fertorgp
endif
else
call pl_fert (ifrt, frt_kg, ifertop)
if (pco%mgtout == "y") then
write (2612,*) j, time%yrc, time%mo, time%day_mo, mgt%op_char, " FERT ", &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, pl_mass(j)%tot(ipl)%m, &
rsd1(j)%tot_com%m, sol_sumno3(j), sol_sumsolp(j), frt_kg, fertno3, fertnh3, &
soil1(j)%rsd(1)%m, sol_sumno3(j), sol_sumsolp(j), frt_kg, fertno3, fertnh3, &
fertorgn, fertsolp, fertorgp
endif
endif
Expand Down Expand Up @@ -306,7 +306,7 @@ subroutine actions (ob_cur, ob_num, idtbl)
if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, tilldb(idtill)%tillnm, " TILLAGE", &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, pl_mass(j)%tot(ipl)%m, &
rsd1(j)%tot(ipl)%m, sol_sumno3(j), sol_sumsolp(j), tilldb(idtill)%effmix
soil1(j)%rsd(1)%m, sol_sumno3(j), sol_sumsolp(j), tilldb(idtill)%effmix
end if
pcom(j)%dtbl(idtbl)%num_actions(iac) = pcom(j)%dtbl(idtbl)%num_actions(iac) + 1
pcom(j)%dtbl(idtbl)%days_act(iac) = 1 !reset days since this action
Expand Down Expand Up @@ -345,15 +345,15 @@ subroutine actions (ob_cur, ob_num, idtbl)
if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, pldb(idp)%plantnm, " PLANT", &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(ihru)%sw, &
pl_mass(j)%tot(ipl)%m, rsd1(j)%tot_com%m, sol_sumno3(j), &
pl_mass(j)%tot(ipl)%m, soil1(j)%rsd(1)%m, sol_sumno3(j), &
sol_sumsolp(j), pcom(j)%plg(ipl)%lai, pcom(j)%plcur(ipl)%lai_pot
end if
else
!! don't plant if the crop is already growing
if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, pldb(idp)%plantnm, &
" PLANT_ALREADY_GROWING", phubase(j), pcom(j)%plcur(ipl)%phuacc, &
soil(j)%sw, pl_mass(j)%tot(ipl)%m, rsd1(j)%tot_com%m, sol_sumno3(j), &
soil(j)%sw, pl_mass(j)%tot(ipl)%m, soil1(j)%rsd(1)%m, sol_sumno3(j), &
sol_sumsolp(j),pcom(j)%plg(ipl)%lai, pcom(j)%plcur(ipl)%lai_pot
end if
end if
Expand Down Expand Up @@ -437,7 +437,7 @@ subroutine actions (ob_cur, ob_num, idtbl)
idp = pcom(j)%plcur(ipl)%idplt
if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, pldb(idp)%plantnm, " HARVEST", &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, biomass, rsd1(j)%tot(ipl)%m, &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, biomass, soil1(j)%rsd(1)%m, &
sol_sumno3(j), sol_sumsolp(j), pl_yield%m, pcom(j)%plstr(ipl)%sum_n, &
pcom(j)%plstr(ipl)%sum_p, pcom(j)%plstr(ipl)%sum_tmp, pcom(j)%plstr(ipl)%sum_w, &
pcom(j)%plstr(ipl)%sum_a
Expand Down Expand Up @@ -466,7 +466,7 @@ subroutine actions (ob_cur, ob_num, idtbl)
idp = pcom(j)%plcur(ipl)%idplt
if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, pldb(idp)%plantnm, " KILL", &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, biomass, rsd1(j)%tot(ipl)%m, &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, biomass, soil1(j)%rsd(1)%m, &
sol_sumno3(j), sol_sumsolp(j), yield, pcom(j)%plstr(ipl)%sum_n, &
pcom(j)%plstr(ipl)%sum_p, pcom(j)%plstr(ipl)%sum_tmp, pcom(j)%plstr(ipl)%sum_w, &
pcom(j)%plstr(ipl)%sum_a
Expand Down Expand Up @@ -554,7 +554,7 @@ subroutine actions (ob_cur, ob_num, idtbl)
idp = pcom(j)%plcur(ipl)%idplt
if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, pldb(idp)%plantnm, " HARV/KILL", &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, biomass, rsd1(j)%tot(ipl)%m, &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, biomass, soil1(j)%rsd(1)%m, &
sol_sumno3(j), sol_sumsolp(j), pl_yield%m, pcom(j)%plstr(ipl)%sum_n, &
pcom(j)%plstr(ipl)%sum_p, pcom(j)%plstr(ipl)%sum_tmp, pcom(j)%plstr(ipl)%sum_w, &
pcom(j)%plstr(ipl)%sum_a
Expand Down Expand Up @@ -589,7 +589,7 @@ subroutine actions (ob_cur, ob_num, idtbl)
if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, d_tbl%act(iac)%option, " PEST ", &
phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw,pl_mass(j)%tot(ipl)%m, &
rsd1(j)%tot(ipl)%m, sol_sumno3(j), sol_sumsolp(j), pest_kg
soil1(j)%rsd(1)%m, sol_sumno3(j), sol_sumsolp(j), pest_kg
endif
pcom(j)%dtbl(idtbl)%num_actions(iac) = pcom(j)%dtbl(idtbl)%num_actions(iac) + 1
!dtbl_lum(idtbl)%hru_lu_cur = dtbl_lum(idtbl)%hru_lu_cur + 1
Expand All @@ -607,7 +607,7 @@ subroutine actions (ob_cur, ob_num, idtbl)
!if (pco%mgtout == "y") then
! write (2612, *) j, time%yrc, time%mo, time%day_mo, " ", " GRAZE", &
! phubase(j), pcom(j)%plcur(ipl)%phuacc, soil(j)%sw,pl_mass(j)%tot(ipl)%m, &
! rsd1(j)%tot(ipl)%m, sol_sumno3(j), sol_sumsolp(j), grazeop_db(igr)%eat, grazeop_db(igr)%manure
! soil1(j)%rsd(1)%m, sol_sumno3(j), sol_sumsolp(j), grazeop_db(igr)%eat, grazeop_db(igr)%manure
!end if
pcom(j)%dtbl(idtbl)%num_actions(iac) = pcom(j)%dtbl(idtbl)%num_actions(iac) + 1

Expand Down Expand Up @@ -673,7 +673,7 @@ subroutine actions (ob_cur, ob_num, idtbl)
if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, tilldb(idtill)%tillnm, " DRAIN_CONTROL", &
phubase(j), pcom(j)%plcur(1)%phuacc, soil(j)%sw, pl_mass(j)%tot(1)%m, &
rsd1(j)%tot(1)%m, sol_sumno3(j), sol_sumsolp(j), hru(j)%lumv%sdr_dep
soil1(j)%rsd(1)%m, sol_sumno3(j), sol_sumsolp(j), hru(j)%lumv%sdr_dep
end if
end if

Expand Down Expand Up @@ -1119,7 +1119,7 @@ subroutine actions (ob_cur, ob_num, idtbl)

if (pco%mgtout == "y") then
write (2612, *) j, time%yrc, time%mo, time%day_mo, " ", " BURN", phubase(j), &
pcom(j)%plcur(ipl)%phuacc, soil(j)%sw,pl_mass(j)%tot(ipl)%m, rsd1(j)%tot(ipl)%m, &
pcom(j)%plcur(ipl)%phuacc, soil(j)%sw,pl_mass(j)%tot(ipl)%m, soil1(j)%rsd(1)%m, &
sol_sumno3(j), sol_sumsolp(j)
end if
pcom(j)%dtbl(idtbl)%num_actions(iac) = pcom(j)%dtbl(idtbl)%num_actions(iac) + 1
Expand All @@ -1139,7 +1139,7 @@ subroutine actions (ob_cur, ob_num, idtbl)
if (pco%mgtout == "y") then
ipl = 1
write (2612, *) j, time%yrc, time%mo, time%day_mo, " ", " CNUP", phubase(j), &
pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, pl_mass(j)%tot(ipl)%m, rsd1(j)%tot(ipl)%m, &
pcom(j)%plcur(ipl)%phuacc, soil(j)%sw, pl_mass(j)%tot(ipl)%m, soil1(j)%rsd(1)%m, &
sol_sumno3(j), sol_sumsolp(j), cn_prev, cn2(j)
end if

Expand Down
2 changes: 1 addition & 1 deletion src/albedo.f90
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ subroutine albedo

!! calculate albedo
cej = -5.e-5
cover = pl_mass(j)%ab_gr_com%m + rsd1(j)%tot_com%m
cover = pl_mass(j)%ab_gr_com%m + soil1(j)%rsd(1)%m
eaj = Exp(cej * (cover + .1)) !! equation 2.2.16 in SWAT manual

if (hru(j)%sno_mm <= .5) then
Expand Down
4 changes: 3 additions & 1 deletion src/basin_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ module basin_module
integer :: swift_out = 0 !! write to SWIFT input file
!! 0 = do not write
!! 1 = write to swift_hru.inp
integer :: sed_det = 0 !! not used
integer :: sed_det = 0 !! peak rate method
!! 0 = NRCS dimensionless hydrograph with PRF
!! 1 = half hour rainfall intensity method
integer :: rte = 0 !! water routing method
!! 0 variable storage method
!! 1 Muskingum method
Expand Down
4 changes: 0 additions & 4 deletions src/cal_allo_init.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ subroutine cal_allo_init

allocate (hru_init(0:sp_ob%hru))
allocate (soil_init(0:sp_ob%hru))
allocate (rsd1_init(0:sp_ob%hru))
allocate (pl_mass_init(0:sp_ob%hru))
allocate (pcom_init(0:sp_ob%hru))

Expand Down Expand Up @@ -56,8 +55,6 @@ subroutine cal_allo_init
pcom_init(iihru)%dtbl(iauto)%days_act = 0
end do

allocate (rsd1_init(iihru)%tot(nplt))

nly1 = soil(iihru)%nly + 1
allocate (soil_init(iihru)%ly(nly1))
!allocate (soil_init(iihru)%ly(nly1)%rs(nplt)) !bac and pest not allocated
Expand All @@ -72,7 +69,6 @@ subroutine cal_allo_init
hru_init = hru
soil_init = soil
soil1_init = soil1
rsd1_init = rsd1
pcom_init = pcom
pl_mass_init = pl_mass
wet = wet_om_init
Expand Down
Loading