From 2405a688344be78c3c7a02bb8ed1fed9c3b2f75a Mon Sep 17 00:00:00 2001 From: Mike-Fuchs Date: Tue, 16 Jul 2024 14:10:21 +0200 Subject: [PATCH 1/4] Fixing for Compiling - Changed names to follow Fortran convention - Fixed bugs with pesticide routines - Fixed water uptake calculation for plants --- src/aqu_1d_control.f90 | 4 +- src/aqu_cs_output.f90 | 2 +- src/aqu_initial.f90 | 4 +- src/aqu_salt_output.f90 | 2 +- src/ch_rtpest.f90 | 2 +- src/{cs_aquifer.f90 => cs_aquifer_module.f90} | 2 +- src/cs_balance.f90 | 2 +- src/cs_divert.f90 | 2 +- src/cs_irrig.f90 | 2 +- src/cs_rctn_aqu.f90 | 2 +- src/cs_sorb_aqu.f90 | 2 +- src/{dr_read_path.f90 => dr_path_read.f90} | 0 src/header_const.f90 | 2 +- src/header_salt.f90 | 2 +- ..._parms_cal.f90 => ls_read_lsparms_cal.f90} | 0 src/main.f90.in | 136 ------------------ src/pest_decay.f90 | 14 +- src/pest_lch.f90 | 1 + src/pest_soil_tot.f90 | 6 +- src/pest_washp.f90 | 3 +- src/pl_grow.f90 | 2 +- src/pl_waterup.f90 | 9 +- src/{res_rel_ctbl.f90 => res_rel_conds.f90} | 0 ...lt_aquifer.f90 => salt_aquifer_module.f90} | 2 +- src/salt_balance.f90 | 2 +- src/salt_chem_aqu.f90 | 2 +- src/salt_irrig.f90 | 2 +- 27 files changed, 37 insertions(+), 172 deletions(-) rename src/{cs_aquifer.f90 => cs_aquifer_module.f90} (99%) rename src/{dr_read_path.f90 => dr_path_read.f90} (100%) rename src/{ls_read_parms_cal.f90 => ls_read_lsparms_cal.f90} (100%) delete mode 100644 src/main.f90.in rename src/{res_rel_ctbl.f90 => res_rel_conds.f90} (100%) rename src/{salt_aquifer.f90 => salt_aquifer_module.f90} (99%) diff --git a/src/aqu_1d_control.f90 b/src/aqu_1d_control.f90 index d41bf73..1d69727 100644 --- a/src/aqu_1d_control.f90 +++ b/src/aqu_1d_control.f90 @@ -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 diff --git a/src/aqu_cs_output.f90 b/src/aqu_cs_output.f90 index dc3fefe..93f7889 100644 --- a/src/aqu_cs_output.f90 +++ b/src/aqu_cs_output.f90 @@ -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 diff --git a/src/aqu_initial.f90 b/src/aqu_initial.f90 index e8fad79..0a3f58c 100644 --- a/src/aqu_initial.f90 +++ b/src/aqu_initial.f90 @@ -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 diff --git a/src/aqu_salt_output.f90 b/src/aqu_salt_output.f90 index 3a9650d..1ed0787 100644 --- a/src/aqu_salt_output.f90 +++ b/src/aqu_salt_output.f90 @@ -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 diff --git a/src/ch_rtpest.f90 b/src/ch_rtpest.f90 index 35dba2c..4f0f251 100644 --- a/src/ch_rtpest.f90 +++ b/src/ch_rtpest.f90 @@ -160,7 +160,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 diff --git a/src/cs_aquifer.f90 b/src/cs_aquifer_module.f90 similarity index 99% rename from src/cs_aquifer.f90 rename to src/cs_aquifer_module.f90 index 0b8d737..9d6cbba 100644 --- a/src/cs_aquifer.f90 +++ b/src/cs_aquifer_module.f90 @@ -1,5 +1,5 @@ !module for constituent mass balance in aquifers (rtb cs) - module cs_aquifer + module cs_aquifer_module implicit none diff --git a/src/cs_balance.f90 b/src/cs_balance.f90 index c549642..b62d033 100644 --- a/src/cs_balance.f90 +++ b/src/cs_balance.f90 @@ -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 diff --git a/src/cs_divert.f90 b/src/cs_divert.f90 index 231a6b4..7a565d3 100644 --- a/src/cs_divert.f90 +++ b/src/cs_divert.f90 @@ -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 diff --git a/src/cs_irrig.f90 b/src/cs_irrig.f90 index 45c41d2..9c3ad31 100644 --- a/src/cs_irrig.f90 +++ b/src/cs_irrig.f90 @@ -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 diff --git a/src/cs_rctn_aqu.f90 b/src/cs_rctn_aqu.f90 index b1fc715..3ef6dac 100644 --- a/src/cs_rctn_aqu.f90 +++ b/src/cs_rctn_aqu.f90 @@ -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 diff --git a/src/cs_sorb_aqu.f90 b/src/cs_sorb_aqu.f90 index b538625..5d72542 100644 --- a/src/cs_sorb_aqu.f90 +++ b/src/cs_sorb_aqu.f90 @@ -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 diff --git a/src/dr_read_path.f90 b/src/dr_path_read.f90 similarity index 100% rename from src/dr_read_path.f90 rename to src/dr_path_read.f90 diff --git a/src/header_const.f90 b/src/header_const.f90 index af051bf..d218291 100644 --- a/src/header_const.f90 +++ b/src/header_const.f90 @@ -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 diff --git a/src/header_salt.f90 b/src/header_salt.f90 index 17cd045..8c1cf14 100644 --- a/src/header_salt.f90 +++ b/src/header_salt.f90 @@ -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 diff --git a/src/ls_read_parms_cal.f90 b/src/ls_read_lsparms_cal.f90 similarity index 100% rename from src/ls_read_parms_cal.f90 rename to src/ls_read_lsparms_cal.f90 diff --git a/src/main.f90.in b/src/main.f90.in deleted file mode 100644 index e3ddb7a..0000000 --- a/src/main.f90.in +++ /dev/null @@ -1,136 +0,0 @@ - program main - - use time_module - use hydrograph_module - use maximum_data_module - use calibration_data_module - - implicit none - - integer :: date_time(8) ! | - character*10 b(3) ! | - - prog = " SWAT+ @TODAY@ MODULAR Rev @YEAR@.@SWAT_VERSION@" - - write (*,1000) - open (9003,file='simulation.out') - write (9003,1000) - 1000 format(1x," SWAT+ ",/, & - & " Revision @SWAT_VERSION@ ",/, & - & " Soil & Water Assessment Tool ",/, & - & "@CMAKE_Fortran_COMPILER_ID@ (@CMAKE_Fortran_COMPILER_VERSION@), @ISO@, @CMAKE_HOST_SYSTEM_NAME@",/, & - & " Program reading . . . executing",/) - - open (888,file="erosion.txt",recl = 1500) - - !!!! for Luis only - ! open (7777,file='res1_out.txt',recl=1500) - ! write (7777,7778) -!7778 format (9x,'DAY',8x,'YEAR',10x,'RES',7x,'VOL m^3',4x,'INFLO m^3',5x,'OUTFLO m^3',5x,'PREC m^3',7x,'EVAP m^3', & -! 8x,'AREA ha') - !!!! for Luis only - - call proc_bsn - call proc_date_time - call proc_db - call proc_read - - call hyd_connect - call exco_db_read - call dr_db_read - - call cli_lapse - call object_read_output - - call om_water_init - call pest_cha_res_read - call path_cha_res_read - call salt_cha_read !rtb salt - call cs_cha_read !rtb cs - - call lsu_read_elements !defining landscape units by hru - - call proc_hru - call proc_cha - call proc_aqu - - !! read decision table data for conditional management - call dtbl_lum_read - - call hru_lte_read - - call proc_cond - - call res_read_weir !moved from proc_res Jaehak 2023 - call dtbl_res_read - call dtbl_scen_read - ! input scenarios used in simulation - call cal_cond_read - - ! read manure allocation inputs - call manure_allocation_read - - call dtbl_flocon_read - - ! read water treatment and water allocation files - before hru lum tables - call treat_read_om - call water_allocation_read - - call hru_dtbl_actions_init - - ! read reservoir and wetland data - call proc_res - call wet_read_hyd - call wet_read - call wet_read_salt_cs - if (db_mx%wet_dat > 0) call wet_all_initial - if (bsn_cc%i_fpwet == 2) call wet_fp_init - - call proc_cal - - call proc_open - - ! compute unit hydrograph parameters for subdaily runoff - call unit_hyd_ru_hru - - call dr_ru - - call hyd_connect_out - - ! save initial time settings for soft calibration runs - time_init = time - - !! simulate watershed processes - if (time%step < 0) then - !! export coefficient - average annual - time%end_sim = 1 - call command - else - call time_control - end if - - if (cal_soft == "y") call calsoft_control - - if (cal_hard == "y") then - deallocate (cal_upd) - call cal_parmchg_read - call calhard_control - end if - - !! write output for SWIFT input - if (bsn_cc%swift_out == 1) call swift_output - - !! write successful completion to screen and file - write (*,1001) - write (9003,1001) - open (107,file="success.fin") - - call DATE_AND_TIME (b(1), b(2), b(3), date_time) - write (*,1234) date_time(2), date_time(3), date_time(1), date_time(5), date_time(6), date_time(7) - write (9003,1234) date_time(2), date_time(3), date_time(1), date_time(5), date_time(6), date_time(7) -1234 format(/," Date of Sim", 2x,i2,"/",i2,"/",i4, " Time",2x,i2,":",i2,":",i2) - - write (107,1001) - 1001 format (/," Execution successfully completed ") - - end diff --git a/src/pest_decay.f90 b/src/pest_decay.f90 index e3c5e04..8e6cc21 100644 --- a/src/pest_decay.f90 +++ b/src/pest_decay.f90 @@ -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 @@ -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 diff --git a/src/pest_lch.f90 b/src/pest_lch.f90 index a3fbc06..3874e6a 100644 --- a/src/pest_lch.f90 +++ b/src/pest_lch.f90 @@ -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 diff --git a/src/pest_soil_tot.f90 b/src/pest_soil_tot.f90 index 7abc1a0..be777a4 100644 --- a/src/pest_soil_tot.f90 +++ b/src/pest_soil_tot.f90 @@ -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 diff --git a/src/pest_washp.f90 b/src/pest_washp.f90 index edc42ac..1a05356 100644 --- a/src/pest_washp.f90 +++ b/src/pest_washp.f90 @@ -26,6 +26,7 @@ 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 @@ -33,7 +34,7 @@ subroutine pest_washp 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 diff --git a/src/pl_grow.f90 b/src/pl_grow.f90 index 37ec92c..35ea9ff 100644 --- a/src/pl_grow.f90 +++ b/src/pl_grow.f90 @@ -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 diff --git a/src/pl_waterup.f90 b/src/pl_waterup.f90 index 41f3726..b69e49b 100644 --- a/src/pl_waterup.f90 +++ b/src/pl_waterup.f90 @@ -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 diff --git a/src/res_rel_ctbl.f90 b/src/res_rel_conds.f90 similarity index 100% rename from src/res_rel_ctbl.f90 rename to src/res_rel_conds.f90 diff --git a/src/salt_aquifer.f90 b/src/salt_aquifer_module.f90 similarity index 99% rename from src/salt_aquifer.f90 rename to src/salt_aquifer_module.f90 index 9ec0cab..d0a1f05 100644 --- a/src/salt_aquifer.f90 +++ b/src/salt_aquifer_module.f90 @@ -1,4 +1,4 @@ - module salt_aquifer + module salt_aquifer_module implicit none diff --git a/src/salt_balance.f90 b/src/salt_balance.f90 index 9f220f5..7722423 100644 --- a/src/salt_balance.f90 +++ b/src/salt_balance.f90 @@ -12,7 +12,7 @@ subroutine salt_balance use soil_module use time_module use salt_module - use salt_aquifer + use salt_aquifer_module use constituent_mass_module use res_salt_module, only : wetsalt_d,ressalt_d use ch_salt_module, only : chsalt_d diff --git a/src/salt_chem_aqu.f90 b/src/salt_chem_aqu.f90 index ee1b0c7..76ccfc1 100644 --- a/src/salt_chem_aqu.f90 +++ b/src/salt_chem_aqu.f90 @@ -27,7 +27,7 @@ subroutine salt_chem_aqu use salt_data_module use hydrograph_module, only : ob,icmd use salt_module - use salt_aquifer + use salt_aquifer_module implicit none diff --git a/src/salt_irrig.f90 b/src/salt_irrig.f90 index 7cc6699..ee0023f 100644 --- a/src/salt_irrig.f90 +++ b/src/salt_irrig.f90 @@ -11,7 +11,7 @@ subroutine salt_irrig(iwallo,idmd,ihru) !rtb salt use hydrograph_module, only : irrig,res,sp_ob1,ob use hru_module, only : hru use salt_module !rtb salt - use salt_aquifer !rtb salt + use salt_aquifer_module !rtb salt use ch_salt_module !rtb salt use res_salt_module !rtb salt use basin_module, only : bsn_cc From 0913193c37665da965109afecc072b92ce3dfbc1 Mon Sep 17 00:00:00 2001 From: Mike-Fuchs Date: Tue, 16 Jul 2024 16:07:40 +0200 Subject: [PATCH 2/4] Fixed bug with incorrect loop --- src/pest_pl_up.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pest_pl_up.f90 b/src/pest_pl_up.f90 index 48304d6..de7a149 100644 --- a/src/pest_pl_up.f90 +++ b/src/pest_pl_up.f90 @@ -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 From 6bbaf9384da633d6129033b7b8ecfc0a0abf7e3d Mon Sep 17 00:00:00 2001 From: Mike-Fuchs Date: Thu, 18 Jul 2024 10:22:22 +0200 Subject: [PATCH 3/4] Added initialization. --- src/aqu_initial.f90 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aqu_initial.f90 b/src/aqu_initial.f90 index 0a3f58c..4043d2c 100644 --- a/src/aqu_initial.f90 +++ b/src/aqu_initial.f90 @@ -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 From ac6918c1b652031170689f1accc7a3ec99b1b18d Mon Sep 17 00:00:00 2001 From: Mike-Fuchs Date: Thu, 18 Jul 2024 11:00:09 +0200 Subject: [PATCH 4/4] Fixed bug. Clamp frsol between 0 and 1 in case negative sedcon values are produced. --- src/ch_rtpest.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ch_rtpest.f90 b/src/ch_rtpest.f90 index 4f0f251..3bd6f4a 100644 --- a/src/ch_rtpest.f90 +++ b/src/ch_rtpest.f90 @@ -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.) frsrb = 1. - frsol !! ASSUME DENSITY=2.6E6; KD2=KD1