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

Some Fixes to get pesticides running. #3

Merged
merged 4 commits into from
Jul 24, 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
4 changes: 2 additions & 2 deletions src/aqu_1d_control.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ subroutine aqu_1d_control
use pesticide_data_module
use aqu_pesticide_module
use salt_module
use salt_aquifer
use cs_aquifer
use salt_aquifer_module
use cs_aquifer_module
use ch_pesticide_module

implicit none
Expand Down
2 changes: 1 addition & 1 deletion src/aqu_cs_output.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ subroutine aqu_cs_output(iaq) !rtb cs
use basin_module
use aquifer_module
use hydrograph_module, only : ob, sp_ob1
use cs_aquifer
use cs_aquifer_module
use constituent_mass_module

implicit none
Expand Down
8 changes: 5 additions & 3 deletions src/aqu_initial.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ subroutine aqu_initial
use constituent_mass_module
use aqu_pesticide_module
use salt_module !rtb salt
use salt_aquifer !rtb salt
use salt_aquifer_module !rtb salt
use cs_module !rtb cs
use cs_aquifer !rtb cs
use cs_aquifer_module !rtb cs

implicit none

Expand Down Expand Up @@ -122,7 +122,9 @@ subroutine aqu_initial
allocate (aqupst_a(iaq)%pest(cs_db%num_pests))
allocate (cs_aqu(iaq)%path(cs_db%num_paths))
allocate (cs_aqu(iaq)%hmet(cs_db%num_metals))
allocate (cs_aqu(iaq)%salt(cs_db%num_salts))
cs_aqu(iaq)%pest = 0.
cs_aqu(iaq)%path = 0.
cs_aqu(iaq)%hmet = 0.
end if
!salts !rtb salt
if (cs_db%num_salts > 0) then
Expand Down
2 changes: 1 addition & 1 deletion src/aqu_salt_output.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ subroutine aqu_salt_output(iaq)
use basin_module
use aquifer_module
use hydrograph_module, only : ob, sp_ob1
use salt_aquifer
use salt_aquifer_module
use constituent_mass_module

implicit none
Expand Down
3 changes: 2 additions & 1 deletion src/ch_rtpest.f90
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ subroutine ch_rtpest

!! calculate fraction of soluble and sorbed pesticide
frsol = 1. / (1. + kd * sedcon)
frsol = max(min(frsol,1.),0.)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems, good will ensure that frsol is represented as a fraction

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted back to main, will need further review.

frsrb = 1. - frsol

!! ASSUME DENSITY=2.6E6; KD2=KD1
Expand All @@ -160,7 +161,7 @@ subroutine ch_rtpest
!! calculate amount of pesticide that undergoes chemical or biological degradation on day in reach
pest_init = chpstmass
if (pest_init > 1.e-12) then
pest_end = chpstmass * (pestcp(jpst)%decay_a * tday)
pest_end = chpstmass * Exp(-.693 / pestdb(jpst)%aq_hlife * tday)
chpstmass = pest_end
chpst%pest(ipest)%react = pest_init - pest_end
!! add decay to daughter pesticides
Expand Down
2 changes: 1 addition & 1 deletion src/cs_aquifer.f90 → src/cs_aquifer_module.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
!module for constituent mass balance in aquifers (rtb cs)
module cs_aquifer
module cs_aquifer_module

implicit none

Expand Down
2 changes: 1 addition & 1 deletion src/cs_balance.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ subroutine cs_balance !rtb cs
use time_module
use constituent_mass_module
use cs_module
use cs_aquifer
use cs_aquifer_module
use res_cs_module, only : wetcs_d,rescs_d
use ch_cs_module, only: chcs_d
use gwflow_module, only : gw_solute_flag,gwsol_ss,ncell,ncell,gw_state,gwsol_state
Expand Down
2 changes: 1 addition & 1 deletion src/cs_divert.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ subroutine cs_divert(iwallo,idmd,dem_id) !rtb cs
use hru_module, only : hru
use basin_module, only : bsn_cc
use cs_module !rtb cs
use cs_aquifer !rtb cs
use cs_aquifer_module !rtb cs
use ch_cs_module !rtb cs
use res_cs_module !rtb cs
use constituent_mass_module
Expand Down
2 changes: 1 addition & 1 deletion src/cs_irrig.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ subroutine cs_irrig(iwallo,idmd,ihru) !rtb cs
use hydrograph_module, only : irrig,res,sp_ob1,ob
use hru_module, only : hru
use cs_module !rtb cs
use cs_aquifer !rtb cs
use cs_aquifer_module !rtb cs
use ch_cs_module !rtb cs
use res_cs_module !rtb cs
use basin_module, only : bsn_cc
Expand Down
2 changes: 1 addition & 1 deletion src/cs_rctn_aqu.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ subroutine cs_rctn_aqu !rtb cs
use cs_data_module
use organic_mineral_mass_module
use cs_module
use cs_aquifer
use cs_aquifer_module

implicit none

Expand Down
2 changes: 1 addition & 1 deletion src/cs_sorb_aqu.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ subroutine cs_sorb_aqu !rtb cs
use aquifer_module
use organic_mineral_mass_module
use constituent_mass_module
use cs_aquifer
use cs_aquifer_module
use cs_data_module

implicit none
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/header_const.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ subroutine header_const !rtb cs
use ch_cs_module
use res_cs_module
use cs_module
use cs_aquifer
use cs_aquifer_module

implicit none

Expand Down
2 changes: 1 addition & 1 deletion src/header_salt.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ subroutine header_salt
use ch_salt_module
use res_salt_module
use salt_module
use salt_aquifer
use salt_aquifer_module

implicit none

Expand Down
File renamed without changes.
136 changes: 0 additions & 136 deletions src/main.f90.in

This file was deleted.

14 changes: 9 additions & 5 deletions src/pest_decay.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ subroutine pest_decay
real :: pest_end !kg/ha |amount of pesticide present at end of day
real :: pst_decay !kg/ha |amount of pesticide decay in soil layer during day
real :: pst_decay_s !kg/ha |amount of pesticide decay in soil profile during day
real :: pst_decay_f !kg/ha |amount of pesticide decay in foliage during day
real :: metab_decay !kg/ha |amount of metabolite decay in soil layer during day

j = ihru
Expand Down Expand Up @@ -69,24 +70,27 @@ subroutine pest_decay
hpestb_d(j)%pest(k)%decay_s = pst_decay_s

!! calculate degradation on plant foliage
!! adjust foliar pesticide for wash off
pst_decay_f = 0.
!! adjust foliar pesticide for wash off
do ipl = 1, pcom(j)%npl
pest_init = cs_pl(j)%pl_on(ipl)%pest(k)
if (pest_init > 1.e-12) then
pest_end = pest_init * pestcp(ipest_db)%decay_f
cs_pl(j)%pl_on(ipl)%pest(k) = pest_end
hpestb_d(j)%pest(k)%decay_f = pest_init - pest_end
pst_decay = (pest_init - pest_end)
pst_decay_f = pst_decay_f + pst_decay
!! add decay to daughter pesticides
do imeta = 1, pestcp(ipest_db)%num_metab
ipseq = pestcp(ipest_db)%daughter(imeta)%num
ipdb = cs_db%pest_num(ipseq)
mol_wt_rto = pestdb(ipdb)%mol_wt / pestdb(ipest_db)%mol_wt
hpestb_d(j)%pest(ipseq)%metab_f = hpestb_d(j)%pest(ipseq)%metab_f + (pest_init - pest_end) * &
pestcp(ipest_db)%daughter(imeta)%soil_fr * mol_wt_rto
cs_pl(j)%pl_on(ipl)%pest(ipseq) = cs_pl(j)%pl_on(ipl)%pest(ipseq) + hpestb_d(j)%pest(ipseq)%metab_f
metab_decay = pst_decay * pestcp(ipest_db)%daughter(imeta)%foliar_fr * mol_wt_rto
hpestb_d(j)%pest(ipseq)%metab_f = hpestb_d(j)%pest(ipseq)%metab_f + metab_decay
cs_pl(j)%pl_on(ipl)%pest(ipseq) = cs_pl(j)%pl_on(ipl)%pest(ipseq) + metab_decay
end do
end if
end do
hpestb_d(j)%pest(k)%decay_f = pst_decay_f
end if
end do

Expand Down
1 change: 1 addition & 0 deletions src/pest_lch.f90
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ subroutine pest_lch
hpestb_d(j)%pest(k)%perc = 0.
hpestb_d(j)%pest(k)%surq = 0.
hpestb_d(j)%pest(k)%latq = 0.
hpestb_d(j)%pest(k)%tileq = 0.
end do

do ly = 1, soil(j)%nly
Expand Down
2 changes: 1 addition & 1 deletion src/pest_pl_up.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ subroutine pest_pl_up
if (cs_pl(j)%pl_on(ipl)%pest(k) >= 0.0001) then
if (ipest_db > 0) then
do ly = 1, soil(j)%nly
pest_up = pestdb(ipest_db)%pl_uptake * pcom(j)%plcur(ipl)%uptake(ly) / soil(j)%phys(k)%st &
pest_up = pestdb(ipest_db)%pl_uptake * pcom(j)%plcur(ipl)%uptake(ly) / soil(j)%phys(ly)%st &
* cs_soil(j)%ly(ly)%pest(k)
if (pest_up > cs_soil(j)%ly(ly)%pest(k)) pest_up = cs_soil(j)%ly(ly)%pest(k)
cs_soil(j)%ly(ly)%pest(k) = cs_soil(j)%ly(ly)%pest(k) - pest_up
Expand Down
6 changes: 4 additions & 2 deletions src/pest_soil_tot.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ subroutine pest_soil_tot
if (cs_db%num_pests == 0) return

do k = 1, cs_db%num_pests
hpestb_d(j)%pest(k)%plant = 0.
hpestb_d(j)%pest(k)%in_plant = 0.
do ipl = 1, pcom(j)%npl
hpestb_d(j)%pest(k)%plant = cs_pl(j)%pl_on(ipl)%pest(k)
hpestb_d(j)%pest(k)%in_plant = cs_pl(j)%pl_in(ipl)%pest(k)
hpestb_d(j)%pest(k)%plant = hpestb_d(j)%pest(k)%plant + cs_pl(j)%pl_on(ipl)%pest(k)
hpestb_d(j)%pest(k)%in_plant = hpestb_d(j)%pest(k)%in_plant + cs_pl(j)%pl_in(ipl)%pest(k)
end do
hpestb_d(j)%pest(k)%soil = 0.
do ly = 1, soil(j)%nly
Expand Down
3 changes: 2 additions & 1 deletion src/pest_washp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ subroutine pest_washp
do k = 1, cs_db%num_pests
ipest_db = cs_db%pest_num(k)
!! adjust foliar pesticide for wash off
hpestb_d(j)%pest(k)%wash = 0.
do ipl = 1, pcom(j)%npl
if (cs_pl(j)%pl_on(ipl)%pest(k) >= 0.0001) then
if (ipest_db > 0) then
pest_soil = pestdb(ipest_db)%washoff * cs_pl(j)%pl_on(ipl)%pest(k)
if (pest_soil > cs_pl(j)%pl_on(ipl)%pest(k)) pest_soil = cs_pl(j)%pl_on(ipl)%pest(k)
cs_soil(j)%ly(1)%pest(k) = cs_soil(j)%ly(1)%pest(k) + pest_soil
cs_pl(j)%pl_on(ipl)%pest(k) = cs_pl(j)%pl_on(ipl)%pest(k) - pest_soil
hpestb_d(j)%pest(k)%wash = pest_soil
hpestb_d(j)%pest(k)%wash = hpestb_d(j)%pest(k)%wash + pest_soil
end if
end if
end do
Expand Down
2 changes: 1 addition & 1 deletion src/pl_grow.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ subroutine pl_grow

!! check for start and end of dormancy of temp-based growth plant
idp = pcom(j)%plcur(ipl)%idplt
if (pldb(idp)%trig == "temp_gro") then
if (pldb(idp)%trig == "temp_gro" .and. pcom(j)%plcur(ipl)%gro == "y") then
call pl_dormant
end if

Expand Down
9 changes: 1 addition & 8 deletions src/pl_waterup.f90
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,7 @@ subroutine pl_waterup
sum = epmax(ipl) * (1. - Exp(-uptake%water_dis * gx / pcom(j)%plg(ipl)%root_dep)) / uptake%water_norm
end if

pcom(j)%plcur(ipl)%epco = 0.9
!! let second layer compensate - 10 mm layer causes problems wehn root depth is shallow
if (k == 2) then
wuse = sum !epco is always 1.0 for second layer
else
wuse = sum - sump * (1. - pcom(j)%plcur(ipl)%epco)
end if

wuse = sum - sump * (1. - pcom(j)%plcur(ipl)%epco)
! adjust for impervious area
ulu = hru(j)%luse%urb_lu
!wuse = wuse * urbdb(ulu)%fcimp
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/salt_aquifer.f90 → src/salt_aquifer_module.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module salt_aquifer
module salt_aquifer_module

implicit none

Expand Down
Loading