From 5c06e5b170bf754f687d54f5629c6789276a5ba4 Mon Sep 17 00:00:00 2001 From: Frank Geter Date: Fri, 8 Nov 2024 12:47:00 -0700 Subject: [PATCH 1/2] Made a number of changes to accumlate organic flux during a calendar year and output to hru_cflux_stat.txt and hru_cflux_stat.csv --- src/carbon_module.f90 | 77 ++--- src/cbn_zhang2.f90 | 65 ++-- src/command.f90 | 15 +- src/gwflow_read.f90 | 17 +- src/organic_mineral_mass_module.f90 | 56 +++- src/output_landscape_init.f90 | 48 ++- src/output_landscape_module.f90 | 501 +++++++++++++++------------- src/soil_module.f90 | 5 +- src/soil_nutcarb_write.f90 | 32 +- src/soils_init.f90 | 5 +- 10 files changed, 488 insertions(+), 333 deletions(-) diff --git a/src/carbon_module.f90 b/src/carbon_module.f90 index 436528e..3831647 100644 --- a/src/carbon_module.f90 +++ b/src/carbon_module.f90 @@ -1,27 +1,27 @@ module carbon_module - + implicit none - + type carbon_terrestrial_inputs real :: er_POC_para = 1.5 ! |POC enrichment ratio ! 0-10 ! 0.0-5.0 MOST SENSITIVE real :: CFB_para = 0.42 ! |Carbon fraction of residue (0.42; from data of Pinck et al., 1950) - real :: Sf_para_sur = 0.05 ! |Fraction of mineral N sorbed to litter: 0.05 for surface litter, 0.1 for below ground litter - real :: Sf_para_sub = 0.10 ! |Fraction of mineral N sorbed to litter: 0.05 for surface litter, 0.1 for belowg round litter + real :: Sf_para_sur = 0.05 ! |Fraction of mineral N sorbed to litter: 0.05 for surface litter, 0.1 for below ground litter + real :: Sf_para_sub = 0.10 ! |Fraction of mineral N sorbed to litter: 0.05 for surface litter, 0.1 for belowg round litter !Dissovled carbon - real :: ABL_para = 0.0 ! |Calculated - Carbon allocation from Microbial Biomass to Leaching + real :: ABL_para = 0.0 ! |Calculated - Carbon allocation from Microbial Biomass to Leaching real :: peroc_DIC_para = 0.95 !0-1 |DIC percolation coefficient - real :: peroc_DOC_para = 0.70 !0-1 |DOC percolation coefficient + real :: peroc_DOC_para = 0.70 !0-1 |DOC percolation coefficient real :: part_DOC_para = 4000. ! |organic carbon partition coefficient 1000 to 1200 ! 500-2000 !replacing KOC=Liquid-solid partition coefficient for Microbial Biomass (10^3 m3 Mg-1) real :: hlife_doc_para = 50. !days |DOC half life in groundwater, calculating DOC decay in groundwater ! 0-100 !Allocation of CO2 and Carbon transformation - real :: ABCO2_para_sur = 0.6 ! |Allocation from Microbial Biomass C pool to CO2; 0.6 (surface Litter), 0.85 - 0.68 x (CLAY+SILT) (all other layers) (Parton et al., 1993, 1994) + real :: ABCO2_para_sur = 0.6 ! |Allocation from Microbial Biomass C pool to CO2; 0.6 (surface Litter), 0.85 - 0.68 x (CLAY+SILT) (all other layers) (Parton et al., 1993, 1994) real :: ABCO2_para_sub = 0. ! |Calculated -Allocation from Microbial Biomass C pool to CO2; 0.6 (surface Litter), 0.85 - 0.68 x (CLAY+SILT) (all other layers) (Parton et al., 1993, 1994) - real :: ABP_para_sur = 0.0 ! |Allocation from Biomass to passive Humus; 0 (surface Litter), 0.003 + 0.032 x SOL_CLAY (all other layers) (Parton et al., 1993, 1994) + real :: ABP_para_sur = 0.0 ! |Allocation from Biomass to passive Humus; 0 (surface Litter), 0.003 + 0.032 x SOL_CLAY (all other layers) (Parton et al., 1993, 1994) real :: ABP_para_sub = 0.0 ! |Calculated - Allocation from Biomass to passive Humus; 0 (surface Litter), 0.003 + 0.032 x SOL_CLAY (all other layers) (Parton et al., 1993, 1994) - real :: ALMCO2_para_sur = 0.6 ! |Allocation from metabolic Litter to CO2; 0.6 (surface Litter), 0.55 (all other layers) (Parton et al., 1993, 1994) - real :: ALMCO2_para_sub = 0.55 ! |Allocation from metabolic Litter to CO2; 0.6 (surface Litter), 0.55 (all other layers) (Parton et al., 1993, 1994) + real :: ALMCO2_para_sur = 0.6 ! |Allocation from metabolic Litter to CO2; 0.6 (surface Litter), 0.55 (all other layers) (Parton et al., 1993, 1994) + real :: ALMCO2_para_sub = 0.55 ! |Allocation from metabolic Litter to CO2; 0.6 (surface Litter), 0.55 (all other layers) (Parton et al., 1993, 1994) real :: ALSLNCO2_para_sur = 0.6 ! |Allocation from non-lignin of structural Litter to CO2; 0.6 (surface Litter), 0.55 (all other layers) (Parton et al., 1993, 1994) - real :: ALSLNCO2_para_sub =0.55 ! |Allocation from non-lignin of structural Litter to CO2; 0.6 (surface Litter), 0.55 (all other layers) (Parton et al., 1993, 1994) + real :: ALSLNCO2_para_sub =0.55 ! |Allocation from non-lignin of structural Litter to CO2; 0.6 (surface Litter), 0.55 (all other layers) (Parton et al., 1993, 1994) real :: ASP_para_sur = 0.0 ! |Allocation from slow Humus to passive; 0 (surface Litter), 0.003 + 0.00009 x CLAF (all other layers) (Parton et al., 1993, 1994) real :: ASP_para_sub = 0.0 ! |Calculated - Allocation from slow Humus to passive; 0 (surface Litter), 0.003 + 0.00009 x CLAF (all other layers) (Parton et al., 1993, 1994) real :: ALSLCO2_para = 0.3 ! |Allocation from lignin of structural Litter to CO2; 0.3 (Parton et al., 1993, 1994) @@ -30,8 +30,8 @@ module carbon_module !decomposition rates real :: PRMT_51_para = 1.0 ! |COEF ADJUSTS MICROBIAL ACTIVITY FUNCTION IN TOP SOIL LAYER (0.1_1.), real :: PRMT_45_para = 0.003 ! |COEF IN CENTURY EQ ALLOCATING SLOW TO PASSIVE HUMUS(0.001_0.05) ORIGINAL VALUE = 0.003, ASP=MAX(.001,PRMT_45-.00009*sol_clay(k,j)), ASP=MAX(.001,PRMT_45+.009*sol_clay(k,j)/100) - real :: BMR_para_sur = 0.0164 ! |Rate of transformation of microbial Biomass and associated products under optimal conditions (surface = 0.0164 d-1; all other layers = 0.02 d-1) (Parton et al., 1993, 1994) - real :: BMR_para_sub = 0.02 ! |Rate of transformation of microbial Biomass and associated products under optimal conditions (surface = 0.0164 d-1; all other layers = 0.02 d-1) (Parton et al., 1993, 1994) + real :: BMR_para_sur = 0.0164 ! |Rate of transformation of microbial Biomass and associated products under optimal conditions (surface = 0.0164 d-1; all other layers = 0.02 d-1) (Parton et al., 1993, 1994) + real :: BMR_para_sub = 0.02 ! |Rate of transformation of microbial Biomass and associated products under optimal conditions (surface = 0.0164 d-1; all other layers = 0.02 d-1) (Parton et al., 1993, 1994) real :: HPR_para = 0.000012 ! |Rate of transformation of passive Humus under optimal conditions (subsurface layers = 0.000012 d-1) (Parton et al., 1993, 1994) real :: HSR_para = 0.000548 ! |Rate of transformation of slow Humus under optimal conditions (all layers = 0.0005 d-1) (Parton et al., 1993, 1994; Vitousek et al., 1993) real :: LMR_para_sur = 0.0405 ! |Rate of transformation of metabolic Litter under optimal conditions (surface = 0.0405 d-1; all other layers = 0.0507 d-1) (Parton et al., 1994) @@ -62,32 +62,32 @@ module carbon_module end type carbon_inputs type (carbon_inputs) :: carbdb type (carbon_inputs) :: carbz - + type organic_allocations real :: abco2 = 0. ! |Fraction of decomposed microbial biomass allocated to CO2 - real :: abl = 0. ! |Fraction of microbial biomass loss due to leaching - real :: abp = 0. ! |Fraction of decomposed microbial biomass allocated to passive humus - real :: almco2 = 0. ! |Fraction of decomposed metabolic litter allocated to CO2 - real :: alslco2 = 0. ! |Fraction of decomposed lignin of structural litter allocated to CO2 - real :: alslnco2 = 0. ! |Fraction of decomposed lignin of structural litter allocated to CO2 - real :: apco2 = 0. ! |Fraction of decomposed passive humus allocated to CO2 - real :: asco2 = 0. ! |Fraction of decomposed slow humus allocated to CO2 - real :: asp = 0. ! |Fraction of decomposed slow humus allocated to passive + real :: abl = 0. ! |Fraction of microbial biomass loss due to leaching + real :: abp = 0. ! |Fraction of decomposed microbial biomass allocated to passive humus + real :: almco2 = 0. ! |Fraction of decomposed metabolic litter allocated to CO2 + real :: alslco2 = 0. ! |Fraction of decomposed lignin of structural litter allocated to CO2 + real :: alslnco2 = 0. ! |Fraction of decomposed lignin of structural litter allocated to CO2 + real :: apco2 = 0. ! |Fraction of decomposed passive humus allocated to CO2 + real :: asco2 = 0. ! |Fraction of decomposed slow humus allocated to CO2 + real :: asp = 0. ! |Fraction of decomposed slow humus allocated to passive end type organic_allocations type (organic_allocations) :: org_allo type (organic_allocations) :: org_alloz - + type organic_controls - real :: cdg = 0. ! |soil temperature control on biological processes - real :: cs = 0. ! |combined factor controlling biological processes - real :: ox = 0. ! |oxygen control on biological processes - real :: sut = 0. ! |soil water control on biological processes - real :: x1 = 0. ! |tillage control on residue decomposition + real :: cdg = 0. ! |soil temperature control on biological processes + real :: cs = 0. ! |combined factor controlling biological processes + real :: ox = 0. ! |oxygen control on biological processes + real :: sut = 0. ! |soil water control on biological processes + real :: x1 = 0. ! |tillage control on residue decomposition real :: xbmt = 0. ! |control on transformation of microbial biomass by soil texture and structure real :: xlslf = 0. ! |control on potential transformation of structural litter by lignin fraction end type organic_controls type (organic_controls) :: org_con - + type organic_fractions real :: lmf = 0. !frac |fraction of the litter that is metabolic real :: lmnf = 0. !kg kg-1 |fraction of metabolic litter that is N @@ -101,23 +101,23 @@ module carbon_module real :: cnr = 0. ! |c/n ratio of standing dead real :: ncbm = 0. ! |n/c ratio of biomass real :: nchp = 0. ! |n/c ratio of passive humus - real :: nchs = 0. ! |n/c ration of slow humus + real :: nchs = 0. ! |n/c ration of slow humus end type organic_ratio type (organic_ratio) :: org_ratio - + type organic_transformations real :: bmctp = 0. !kg ha-1 day-1 |potential transformation of C in microbial biomass - real :: bmntp = 0. !kg ha-1 day-1 |potential transformation of N in microbial biomass - real :: hsctp = 0. !kg ha-1 day-1 |potential transformation of C in slow humus - real :: hsntp = 0. !kg ha-1 day-1 |potential transformation of N in slow humus + real :: bmntp = 0. !kg ha-1 day-1 |potential transformation of N in microbial biomass + real :: hsctp = 0. !kg ha-1 day-1 |potential transformation of C in slow humus + real :: hsntp = 0. !kg ha-1 day-1 |potential transformation of N in slow humus real :: hpctp = 0. !kg ha-1 day-1 |potential transformation of C in passive humus real :: hpntp = 0. !kg ha-1 day-1 |potential transformation of N in passive humus real :: lmctp = 0. !kg ha-1 day-1 |potential transformation of C in metabolic litter - real :: lmntp = 0. !kg ha-1 day-1 |potential transformation of N in metabolic litter + real :: lmntp = 0. !kg ha-1 day-1 |potential transformation of N in metabolic litter real :: lsctp = 0. !kg ha-1 day-1 |potential transformation of C in structural litter real :: lslctp = 0. !kg ha-1 day-1 |potential transformation of C in lignin of structural litter real :: lslnctp = 0. !kg ha-1 day-1 |potential transformation of C in nonlignin structural litter - real :: lsntp = 0. !kg ha-1 day-1 |potential transformation of N in structural litter + real :: lsntp = 0. !kg ha-1 day-1 |potential transformation of N in structural litter end type organic_transformations type (organic_transformations) :: org_tran @@ -161,7 +161,8 @@ module carbon_module real :: co2fs3 = 0. !(kg C ha-1 day-1) |CO2 production resulting from S3 (Passive Humus) transformations end type organic_flux type (organic_flux) :: org_flux - + type (organic_flux) :: org_flux_zero + type carbon_soil_transformations real :: meta_micr = 0. !(kg C ha-1 day-1) |C transformed from Metabolic Litter to S1 (Microbial Biomass) real :: str_micr = 0. !(kg C ha-1 day-1) |C transformed from Structural Litter to S1 (Microbial Biomass) @@ -231,7 +232,7 @@ module carbon_module type (carbon_soil_gain_losses) :: bsc_a type carbon_residue_gain_losses - real :: plant_c = 0. !kg C/ha |carbon added to residue from leaf drop and kill + real :: plant_c = 0. !kg C/ha |carbon added to residue from leaf drop and kill real :: res_decay_c = 0. !kg C/ha |carbon lost to soil from residue decay real :: harv_stov_c = 0. !kg C/ha |carbon removed during residue harvest real :: emit_c = 0. !kg C/ha |CO2 production from burning residue carbon diff --git a/src/cbn_zhang2.f90 b/src/cbn_zhang2.f90 index 64de2c4..eeaafb5 100644 --- a/src/cbn_zhang2.f90 +++ b/src/cbn_zhang2.f90 @@ -19,7 +19,7 @@ subroutine cbn_zhang2 !!============================================== !! local variables !rnmn - !abco2 : allocation from biomass to co2; 0.6 (surface litter), 0.85–0.68*(claf + silf) (all other layers) (parton et al., 1993, 1994) + !abco2 : allocation from biomass to co2; 0.6 (surface litter), 0.85�0.68*(claf + silf) (all other layers) (parton et al., 1993, 1994) !abl : carbon allocation from biomass to leaching; abl = (1-exp(-f/(0.01* sw+ 0.1*(kdbm)*db)) (williams, 1995) !abp : allocation from biomass to passive humus; 0 (surface litter), 0.003 + 0.032*claf (all other layers) (parton et al., 1993, 1994) !almco2 : allocation from metabolic litter to co2; 0.6 (surface litter), 0.55 (all other layers) (parton et al., 1993, 1994) @@ -42,7 +42,7 @@ subroutine cbn_zhang2 !cpn3 : potential n deficit resulting from the transformation of microbial biomass; calc as (pn5+pn6)-bmntp if bmntp < (pn5+pn6), otherwise = 0 (kg n ha-1 day-1) !cpn4 : potential n deficit resulting from the transformation of slow humus; calc as (pn7+pn8)-hsntp if hsntp < (pn7+pn8), otherwise = 0 (kg n ha-1 day-1) !cpn5 : potential n deficit resulting from the transformation of passive humus; calc as pn9-hpntp if hpntp < pn9, otherwise = 0 (kg n ha-1 day-1) - !cs : combined factor controlling biological processes [cs = sqrt(cdg×sut)* 0.8*ox*x1), cs < 10; cs = 10, cs>=10 (williams, 1995)] + !cs : combined factor controlling biological processes [cs = sqrt(cdg�sut)* 0.8*ox*x1), cs < 10; cs = 10, cs>=10 (williams, 1995)] !dbp : soil bulk density of plow layer (mg m-3) (not used) !hsctp : potential transformation of c in slow humus (kg ha-1 day-1) !hsntp : potential transformation of n in slow humus (kg ha-1 day-1) @@ -52,7 +52,7 @@ subroutine cbn_zhang2 !layers = 0.000012 day-1) (parton et al.,1993, 1994) !hsr : rate of transformation of slow humus under optimal conditions (all layers != 0.0005 day-1) (parton et al., 1993, 1994; vitousek et al., 1993) - !koc : liquid–solid partition coefficient for microbial biomass (10^3 m^3 mg-1) + !koc : liquid�solid partition coefficient for microbial biomass (10^3 m^3 mg-1) !lmf : fraction of the litter that is metabolic !lmnf : fraction of metabolic litter that is n (kg kg-1) !lmr : rate of transformation of metabolic litter under optimal conditions (surface = @@ -180,6 +180,16 @@ subroutine cbn_zhang2 real :: rto = 0. !none |cloud cover factor real :: rspc = 0. ! | real :: xx = 0. !varies |variable to hold calculation results + + integer :: day + integer :: seq_year + integer :: cal_year + integer :: mon + + day = time%day + seq_year = time%yrs + cal_year = time%yrc + mon = time%mo !! initialize local variables deltawn = 0. @@ -279,20 +289,12 @@ subroutine cbn_zhang2 j = ihru - !! calculate carbon loss in surface residue - !soil1(j)%str(k)%n = soil1(j)%str(k)%n * (1. - decr) - !soil1(j)%lig(k)%n = soil1(j)%lig(k)%n * (1. - decr) - !soil1(j)%meta(k)%n = soil1(j)%meta(k)%n * (1. - decr) - !soil1(j)%str(k)%p = soil1(j)%str(k)%p * (1. - decr) - !soil1(j)%lig(k)%p = soil1(j)%lig(k)%p * (1. - decr) - !soil1(j)%meta(k)%p = soil1(j)%meta(k)%p * (1. - decr) - !calculate tillage factor using dssat if (tillage_switch(j) .eq. 1 .and. tillage_days(j) .le. 30) then tillage_factor(j) = 1.6 else tillage_factor(j) = 1.0 - end if + end if !!calculate c/n dynamics for each soil layer !!=========================================== @@ -341,11 +343,11 @@ subroutine cbn_zhang2 till_eff = 1.6 else if (soil(j)%phys(k-1)%d .lt. tillage_depth(j)) then till_eff = 1.0 + 0.6 * (tillage_depth(j) - soil(j)%phys(k-1)%d) / (soil(j)%phys(k)%d - soil(j)%phys(k-1)%d) - end if + end if end if else till_eff = 1.0 - end if + end if !!compute soil temperature factor - when sol_tep is larger than 35, cdg is negative? org_con%cdg = soil(j)%phys(k)%tmp / (soil(j)%phys(k)%tmp + exp(5.058459 - 0.2503591 * soil(j)%phys(k)%tmp)) @@ -638,16 +640,16 @@ subroutine cbn_zhang2 ! update if (rnmn > 0.) then soil1(j)%mn(k)%nh4 = soil1(j)%mn(k)%nh4 + rnmn - min_n = soil1(j)%mn(k)%no3 + rnmn - if (min_n < 0.) then - rnmn = -soil1(j)%mn(k)%no3 - soil1(j)%mn(k)%no3 = 1.e-10 - else - soil1(j)%mn(k)%no3 = min_n + min_n = soil1(j)%mn(k)%no3 + rnmn + if (min_n < 0.) then + rnmn = -soil1(j)%mn(k)%no3 + soil1(j)%mn(k)%no3 = 1.e-10 + else + soil1(j)%mn(k)%no3 = min_n end if end if - ! calculate p flows + ! calculate p flows ! compute humus mineralization on active organic p hmp_rate = 1.4 * (hsnta + hpnta) / (soil1(j)%hs(k)%n + soil1(j)%hp(k)%n + 1.e-6) @@ -655,9 +657,9 @@ subroutine cbn_zhang2 hmp = hmp_rate * soil1(j)%hp(k)%p hmp = min(hmp, soil1(j)%hp(k)%p) soil1(j)%hp(k)%p = soil1(j)%hp(k)%p - hmp - soil1(j)%mp(k)%lab = soil1(j)%mp(k)%lab + hmp - - !! compute residue decomp and mineralization of + soil1(j)%mp(k)%lab = soil1(j)%mp(k)%lab + hmp + + !! compute residue decomp and mineralization of !! fresh organic n and p (upper two layers only) decr = (lscta + lmcta) / (soil1(j)%str(k)%c + soil1(j)%meta(k)%c + 1.e-6) decr = min(1., decr) @@ -665,12 +667,12 @@ subroutine cbn_zhang2 soil1(j)%tot(k)%p = soil1(j)%tot(k)%p - rmp soil1(j)%mp(k)%lab = soil1(j)%mp(k)%lab + .8 * rmp - soil1(j)%hp(k)%p = soil1(j)%hp(k)%p + .2 * rmp + soil1(j)%hp(k)%p = soil1(j)%hp(k)%p + .2 * rmp !!!================================= !!determine the final rate of the decomposition of each carbon pool and !!allocation of c and nutrients to different som pools, as well as co2 emissions from different pools - lscta = min(soil1(j)%str(k)%c, lscta) + lscta = min(soil1(j)%str(k)%c, lscta) lslcta = min(soil1(j)%lig(k)%c, lslcta) org_flux%co2fstr = .3 * lslcta @@ -783,7 +785,7 @@ subroutine cbn_zhang2 !!epic procedures (not used): calculating n supply - n demand !!df1 is the supply of n during structural litter decomposition (lsnta) - demand of n to meet the transformaitons of other pools !! c pools into structural litter (0 as no other pools transformed into structural litter) - df1 = lsnta + df1 = lsnta !!df2 is the supply of n during metabolic litter decomposition (lsnta) - demand of n to meet the transformaitons of other pools !! c pools into metabolic litter (0 as no other pools transformed into structural litter) @@ -894,12 +896,21 @@ subroutine cbn_zhang2 !!rspc_da is accounting variable summarizing co2 emissions from all soil layers hsc_d(j)%rsp_c = hsc_d(j)%rsp_c + rspc + ! Save the the org_flux for each layer + soil1(j)%org_flx_lr(k) = org_flux ! Org flux for current day for soil layer k + soil1(j)%org_flx_cum_lr(k) = soil1(j)%org_flx_cum_lr(k) + soil1(j)%org_flx_lr(k) !cumulative org flux for layer k + + !total cumulative org flux soil profile + soil1(j)%org_flx_cum_tot = soil1(j)%org_flx_cum_tot + soil1(j)%org_flx_lr(k) + !!update other vairables used in swat !!================================== !soil1(j)%tot(k)%m = soil1(j)%str(k)%m + soil1(j)%meta(k)%m !soil1(j)%tot(k)%c = 100. * (soil1(j)%hs(k)%c + soil1(j)%hp(k)%c + soil1(j)%microb(k)%c) / sol_mass soil1(j)%tot(k)%c = soil1(j)%hs(k)%c + soil1(j)%hp(k)%c + soil1(j)%microb(k)%c + & soil1(j)%meta(k)%c + soil1(j)%str(k)%c + soil1(j)%lig(k)%c + + end if !soil temp and soil water > 0. end do !soil layer loop diff --git a/src/command.f90 b/src/command.f90 index ff8402a..d451941 100644 --- a/src/command.f90 +++ b/src/command.f90 @@ -112,11 +112,6 @@ subroutine command if (cs_db%num_tot > 0 .and. obcs_alloc(icmd).eq.1) then obcs(icmd)%hin_sur(1) = obcs(icmd)%hin_sur(1) + frac_in * obcs(iob)%hd(3) end if - ! add to tile flow - ob(icmd)%hin_til = ob(icmd)%hin_til + frac_in * ob(iob)%hd(5) - if (cs_db%num_tot > 0 .and. obcs_alloc(icmd).eq.1) then - obcs(icmd)%hin_til(1) = obcs(icmd)%hin_til(1) + frac_in * obcs(iob)%hd(5) - end if ! add to lateral soil runon ob(icmd)%hin_lat = ob(icmd)%hin_lat + frac_in * ob(iob)%hd(4) if (cs_db%num_tot > 0 .and. obcs_alloc(icmd).eq.1) then @@ -480,20 +475,20 @@ subroutine command select case (pco%carbout) !! write carbon in soil, plant, and residue at end of the day case ("d") - call soil_nutcarb_write + call soil_nutcarb_write(pco%carbout) !! write carbon in soil, plant, and residue at end the month case ("m") if (time%end_mo == 1) then - call soil_nutcarb_write + call soil_nutcarb_write(pco%carbout) end if !! write carbon in soil, plant, and residue at end of year case ("y") if (time%end_yr == 1) then - call soil_nutcarb_write + call soil_nutcarb_write(pco%carbout) end if !! write carbon in soil, plant, and residue at end the simulation case ("a") - call soil_nutcarb_write + call soil_nutcarb_write(pco%carbout) end select end do ! hru loop @@ -623,7 +618,7 @@ subroutine command enddo 102 format(i6,11x,i3,8x,i5,5x,1000(f16.4)) -!*** tu Wunused-label: 103 format(4i6,2i8,2x,a,35f12.3) +103 format(4i6,2i8,2x,a,35f12.3) return diff --git a/src/gwflow_read.f90 b/src/gwflow_read.f90 index a824455..eb9e7f3 100644 --- a/src/gwflow_read.f90 +++ b/src/gwflow_read.f90 @@ -16,6 +16,7 @@ subroutine gwflow_read use reservoir_data_module, only : wet_dat use cs_data_module use constituent_mass_module, only : cs_db + use input_file_module, only : in_con implicit none @@ -323,7 +324,7 @@ subroutine gwflow_read gw_state(i)%xcrd = 0. gw_state(i)%ycrd = 0. gw_state(i)%area = 0. - gw_state(i)%init = 0. + gw_state(i)%init = 0. gw_state(i)%head = 0. gw_state(i)%hydc = 0. gw_state(i)%spyd = 0. @@ -532,7 +533,7 @@ subroutine gwflow_read gw_state(i)%xcrd = 0. gw_state(i)%ycrd = 0. gw_state(i)%area = 0. - gw_state(i)%init = 0. + gw_state(i)%init = 0. gw_state(i)%head = 0. gw_state(i)%hydc = 0. gw_state(i)%spyd = 0. @@ -1728,7 +1729,7 @@ subroutine gwflow_read read(5100,*) dum1,huc12(k) enddo !open up and read the HRUs listed for each HUC12 subwatershed - open(5101,file='hru.con') + open(5101,file=in_con%hru_con) allocate (huc12_hrus(sp_ob%outlet,5000), source = 0) allocate (huc12_nhru(sp_ob%outlet), source = 0) huc12_nhru = 0 @@ -1929,7 +1930,7 @@ subroutine gwflow_read write(out_gwbal,*) 'ppex: mm groundwater pumping specified by user' write(out_gwbal,*) 'tile: mm groundwater removed via tile drains' write(out_gwbal,*) 'resv: mm groundwater exchanged with reservoirs' - write(out_gwbal,*) 'wetl: mm groundwater outflow to wetlands' + write(out_gwbal,*) 'wetl: mm groundwater outflow to wetlands' write(out_gwbal,*) 'canl: mm canal seepage to groundwater' write(out_gwbal,*) 'fpln: mm floodplain exchange' write(out_gwbal,*) 'error: -- water balance error for aquifer' @@ -2427,7 +2428,7 @@ subroutine gwflow_read write(out_hyd_sep,*) 'chan_satexsw: channel flow contributed from saturation excess runoff' write(out_hyd_sep,*) 'chan_tile: channel flow contributed from tile drain flow' write(out_hyd_sep,*) - hydsep_hdr = [character(len=12) :: " year"," day","channel","chan_surf","chan_lat","chan_gwsw","chan_swgw", & + hydsep_hdr = [character(len=16) :: " year"," day","channel","chan_surf","chan_lat","chan_gwsw","chan_swgw", & "chan_satexgw","chan_satexsw","chan_tile"] write(out_hyd_sep,121) (hydsep_hdr(j),j=1,10) @@ -2440,14 +2441,14 @@ subroutine gwflow_read return -!*** tu Wunused-label: 100 format(i6,i6,10(f10.2)) +100 format(i6,i6,10(f10.2)) !output files for all cells !101 format((f12.4)) !102 format((i4)) 101 format(f12.4) -!*** tu Wunused-label: 102 format(i4) +102 format(i4) !other formats -!*** tu Wunused-label: 103 format(10000(i8)) +103 format(10000(i8)) 111 format(1x,a, 5x,"Time",2x,i2,":",i2,":",i2) 119 format(4x,a8,a8,a10,a16,a19,50(a13)) 120 format(a8,50(a13)) diff --git a/src/organic_mineral_mass_module.f90 b/src/organic_mineral_mass_module.f90 index 1e3e6a4..55d74ce 100644 --- a/src/organic_mineral_mass_module.f90 +++ b/src/organic_mineral_mass_module.f90 @@ -1,5 +1,7 @@ module organic_mineral_mass_module + use carbon_module, only: organic_flux + implicit none type organic_mass @@ -39,7 +41,6 @@ module organic_mineral_mass_module character (len=16) :: name = "" real :: tot_mn = 0. ! |total mineral n pool (no3+nh4) in soil profile real :: tot_mp = 0. ! |mineral p pool (wsol+lab+act+sta) in soil profile - real :: salt = 0. ! |total salt amount (kg/ha) in soil profile type (organic_mass) :: tot_org ! |total organics in soil profile real, dimension(:), allocatable :: sw !mm |soil water dimensioned by layer real, dimension(:), allocatable :: cbn !% |percent carbon @@ -47,6 +48,9 @@ module organic_mineral_mass_module type (mineral_nitrogen), dimension(:), allocatable :: mn ! |mineral n pool dimensioned by layer type (mineral_phosphorus), dimension(:), allocatable :: mp ! |mineral p humus pool dimensioned by layer type (organic_mass), dimension(:), allocatable :: tot ! |total organic pool dimensioned by layer + type (organic_flux) :: org_flx_cum_tot ! |cumulative organic flux for soil profile + type (organic_flux), dimension(:), allocatable :: org_flx_lr ! |organic flux by layer + type (organic_flux), dimension(:), allocatable :: org_flx_cum_lr ! |cumulative organic flux by layer type (organic_mass), dimension(:), allocatable :: hact ! |active humus for old mineralization model dimensioned by layer type (organic_mass), dimension(:), allocatable :: hsta ! |stable humus for old mineralization model dimensioned by layer type (organic_mass), dimension(:), allocatable :: hs ! |slow humus dimensioned by layer @@ -94,7 +98,7 @@ module organic_mineral_mass_module type (organic_mass), dimension(:), allocatable :: tot ! |total mass surface residue litter pool-dimensioned by plant type (organic_mass), dimension(:), allocatable :: meta ! |metabolic litter pool-dimensioned by plant type (organic_mass), dimension(:), allocatable :: str ! |structural litter pool-dimensioned by plant - type (organic_mass), dimension(:), allocatable :: lignin ! |lignin pool-dimensioned by plant + type (organic_mass), dimension(:), allocatable :: lignin ! |lignin pool-dimensioned by plant type (organic_mass) :: tot_com !kg/ha |total type (organic_mass) :: tot_meta ! | type (organic_mass) :: tot_str ! | @@ -306,6 +310,10 @@ module organic_mineral_mass_module module procedure om_add1 end interface + interface operator (+) + module procedure org_flux_add1 + end interface + interface operator (-) module procedure om_subtract end interface @@ -358,6 +366,50 @@ function om_add1 (o_m1, o_m2) result (o_m3) o_m3%p = o_m1%p + o_m2%p end function om_add1 + !! add org_flux + function org_flux_add1 (org_flux1, org_flux2) result (org_flux3) + type (organic_flux), intent (in) :: org_flux1 + type (organic_flux), intent (in) :: org_flux2 + type (organic_flux) :: org_flux3 + org_flux3%cfmets1 = org_flux1%cfmets1 + org_flux2%cfmets1 + org_flux3%cfstrs1 = org_flux1%cfstrs1 + org_flux2%cfstrs1 + org_flux3%cfstrs2 = org_flux1%cfstrs2 + org_flux2%cfstrs2 + org_flux3%efmets1 = org_flux1%efmets1 + org_flux2%efmets1 + org_flux3%efstrs1 = org_flux1%efstrs1 + org_flux2%efstrs1 + org_flux3%efstrs2 = org_flux1%efstrs2 + org_flux2%efstrs2 + org_flux3%immmets1 = org_flux1%immmets1 + org_flux2%immmets1 + org_flux3%immstrs1 = org_flux1%immstrs1 + org_flux2%immstrs1 + org_flux3%immstrs2 = org_flux1%immstrs2 + org_flux2%immstrs2 + org_flux3%mnrmets1 = org_flux1%mnrmets1 + org_flux2%mnrmets1 + org_flux3%mnrstrs1 = org_flux1%mnrstrs1 + org_flux2%mnrstrs1 + org_flux3%mnrstrs1 = org_flux1%mnrstrs2 + org_flux2%mnrstrs2 + org_flux3%co2fmet = org_flux1%co2fmet + org_flux2%co2fmet + org_flux3%co2fstr = org_flux1%co2fstr + org_flux2%co2fstr + org_flux3%cfs1s2 = org_flux1%cfs1s2 + org_flux2%cfs1s2 + org_flux3%cfs1s3 = org_flux1%cfs1s3 + org_flux2%cfs1s3 + org_flux3%cfs2s1 = org_flux1%cfs2s1 + org_flux2%cfs2s1 + org_flux3%cfs2s3 = org_flux1%cfs2s3 + org_flux2%cfs2s3 + org_flux3%cfs3s1 = org_flux1%cfs3s1 + org_flux2%cfs3s1 + org_flux3%efs1s2 = org_flux1%efs1s2 + org_flux2%efs1s2 + org_flux3%efs1s3 = org_flux1%efs1s3 + org_flux2%efs1s3 + org_flux3%efs2s1 = org_flux1%efs2s1 + org_flux2%efs2s1 + org_flux3%efs2s3 = org_flux1%efs2s3 + org_flux2%efs2s3 + org_flux3%efs3s1 = org_flux1%efs3s1 + org_flux2%efs3s1 + org_flux3%imms1s2 = org_flux1%imms1s2 + org_flux2%imms1s2 + org_flux3%imms1s3 = org_flux1%imms1s3 + org_flux2%imms1s3 + org_flux3%imms2s1 = org_flux1%imms2s1 + org_flux2%imms2s1 + org_flux3%imms2s3 = org_flux1%imms2s3 + org_flux2%imms2s3 + org_flux3%imms3s1 = org_flux1%imms3s1 + org_flux2%imms3s1 + org_flux3%mnrs1s2 = org_flux1%mnrs1s2 + org_flux2%mnrs1s2 + org_flux3%mnrs1s3 = org_flux1%mnrs1s3 + org_flux2%mnrs1s3 + org_flux3%mnrs2s1 = org_flux1%mnrs2s1 + org_flux2%mnrs2s1 + org_flux3%mnrs2s3 = org_flux1%mnrs2s3 + org_flux2%mnrs2s3 + org_flux3%mnrs3s1 = org_flux1%mnrs3s1 + org_flux2%mnrs3s1 + org_flux3%co2fs1 = org_flux1%co2fs1 + org_flux2%co2fs1 + org_flux3%co2fs2 = org_flux1%co2fs2 + org_flux2%co2fs2 + org_flux3%co2fs3 = org_flux1%co2fs3 + org_flux2%co2fs3 + end function org_flux_add1 + !! subtract organic mass function om_subtract (o_m1, o_m2) result (o_m3) type (organic_mass), intent (in) :: o_m1 diff --git a/src/output_landscape_init.f90 b/src/output_landscape_init.f90 index ab2c495..8786ed7 100644 --- a/src/output_landscape_init.f90 +++ b/src/output_landscape_init.f90 @@ -436,20 +436,22 @@ subroutine output_landscape_init end if endif - if (pco%nb_hru%a == "y") then - open (4553,file="hru_scf_aa.txt", recl = 1500) - write (4553,*) bsn%name, prog - write (4553,*) hscf_hdr - write (4553,*) hscf_hdr_units - write (9000,*) "HRU hru_scf_aa.txt" - if (pco%csvout == "y") then - open (4557,file="hru_scf_aa.csv", recl = 1500) - write (4557,*) bsn%name, prog - write (4557,'(*(G0.3,:,","))') hscf_hdr - write (4557,'(*(G0.3,:,","))') hscf_hdr_units - write (9000,*) "HRU hru_scf_aa.csv" - end if - endif + if (bsn_cc%cswat == 2) then + if (pco%nb_hru%a == "y") then + open (4553,file="hru_scf_aa.txt", recl = 1500) + write (4553,*) bsn%name, prog + write (4553,*) hscf_hdr + write (4553,*) hscf_hdr_units + write (9000,*) "HRU hru_scf_aa.txt" + if (pco%csvout == "y") then + open (4557,file="hru_scf_aa.csv", recl = 1500) + write (4557,*) bsn%name, prog + write (4557,'(*(G0.3,:,","))') hscf_hdr + write (4557,'(*(G0.3,:,","))') hscf_hdr_units + write (9000,*) "HRU hru_scf_aa.csv" + end if + endif + end if !!!NEW SOIL TRANSFORMATIONS CARBON OUTPUT @@ -477,8 +479,8 @@ subroutine output_landscape_init end if endif + open (4561,file = "hru_resc_stat.txt", recl = 1500) if (pco%nb_hru%a == "y") then - open (4561,file = "hru_resc_stat.txt", recl = 1500) write (4561,*) bsn%name, prog write (4561,*) resc_hdr write (4561,*) resc_hdr_units @@ -506,6 +508,19 @@ subroutine output_landscape_init write (9000,*) "HRU hru_soilc_stat.csv" end if endif + + open (4567,file = "hru_cflux_stat.txt", recl = 1500) + if (pco%nb_hru%a == "y") then + write (4567,*) bsn%name, prog + write (4567,*) soil_org_flux_hdr + write (9000,*) "HRU hru_cflux_stat.txt" + if (pco%csvout == "y") then + open (4568,file="hru_cflux_stat.csv", recl = 1500) + write (4568,*) bsn%name, prog + write (4568,'(*(G0.3,:,","))') soil_org_flux_hdr + write (9000,*) "HRU hru_cflux_stat.csv" + end if + endif !!! NEW SOILC_STAT/RESC_STAT/PLC_STAT CARBON OUTPUT FILES @@ -1423,8 +1438,7 @@ subroutine output_landscape_init !! headers for annual crop yields if (pco%crop_yld == "a" .or. pco%crop_yld == "b") then open (4008,file="crop_yld_aa.txt", recl = 1500) - write (4008,*) bsn%name - write (4008,*) prog + write (4008,*) bsn%name, prog write (4008,1000) write (9000,*) "CROP crop_yld_aa.txt" if (pco%csvout == "y") then diff --git a/src/output_landscape_module.f90 b/src/output_landscape_module.f90 index 10fc2a6..366546b 100644 --- a/src/output_landscape_module.f90 +++ b/src/output_landscape_module.f90 @@ -39,12 +39,12 @@ module output_landscape_module real :: satex = 0. !mm H2O |saturation excess flow developed from high water table !rtb gwflow real :: satex_chan = 0. !mm H2O |saturation excess flow reaching main channel !rtb gwflow real :: delsw = 0. !mm H2O |change in soil water volume !rtb gwflow - real :: lagsurf = 0. !mm H2O |surface runoff in transit to channel - real :: laglatq = 0. !mm H2O |lateral flow in transit to channel - real :: lagsatex = 0. !mm H2O |saturation excess flow in transit to channel - real :: wet_evap = 0. !mm H2O |evaporation from wetland surface - real :: wet_out = 0. !mm H2O |outflow (spill) from wetland - real :: wet_stor = 0. !mm H2O |volume stored in wetland at end of time period + real :: lagsurf = 0. !mm H2O |surface runoff in transit to channel + real :: laglatq = 0. !mm H2O |lateral flow in transit to channel + real :: lagsatex = 0. !mm H2O |saturation excess flow in transit to channel + real :: wet_evap = 0. !mm H2O |evaporation from wetland surface + real :: wet_out = 0. !mm H2O |outflow (spill) from wetland + real :: wet_stor = 0. !mm H2O |volume stored in wetland at end of time period end type output_waterbal type (output_waterbal), pointer :: h @@ -292,15 +292,15 @@ module output_landscape_module character (len=6) :: day_mo = " day" character (len=6) :: yrc = " yr" character (len=8) :: isd = " unit" - character (len=8) :: id = " gis_id" - character (len=16) :: name = " name " + character (len=8) :: id = " gis_id" + character (len=16) :: name = " name " character (len=14) :: precip = " precip" character (len=12) :: snofall = " snofall" - character (len=12) :: snomlt = " snomlt" - character (len=12) :: surq_gen = " surq_gen" - character (len=12) :: latq = " latq" + character (len=12) :: snomlt = " snomlt" + character (len=12) :: surq_gen = " surq_gen" + character (len=12) :: latq = " latq" character (len=12) :: wateryld = " wateryld" - character (len=12) :: perc = " perc" + character (len=12) :: perc = " perc" character (len=12) :: et = " et" character (len=12) :: ecanopy = " ecanopy" character (len=12) :: eplant = " eplant" @@ -313,7 +313,7 @@ module output_landscape_module character (len=12) :: sw_300 = " sw_300" character (len=12) :: sno_init = " sno_init" character (len=12) :: sno_final = " sno_final" - character (len=12) :: snopack = " snopack" + character (len=12) :: snopack = " snopack" character (len=12) :: pet = " pet" character (len=12) :: qtile = " qtile" character (len=12) :: irr = " irr" @@ -336,8 +336,6 @@ module output_landscape_module character (len=12) :: wet_evap = " wet_evap" character (len=12) :: wet_oflo = " wet_oflo" character (len=12) :: wet_stor = " wet_stor" - character (len=16) :: plt_cov = " plant_cov " - character (len=30) :: mgt_ops = " mgt_ops " end type output_waterbal_header type (output_waterbal_header) :: wb_hdr @@ -347,15 +345,15 @@ module output_landscape_module character (len=6) :: day_mo = " " character (len=6) :: yrc = " " character (len=8) :: isd = " " - character (len=8) :: id = " " - character (len=16) :: name = " " + character (len=8) :: id = " " + character (len=16) :: name = " " character (len=14) :: precip = " mm" character (len=12) :: snofall = " mm" - character (len=12) :: snomlt = " mm" - character (len=12) :: surq_gen = " mm" - character (len=12) :: latq = " mm" + character (len=12) :: snomlt = " mm" + character (len=12) :: surq_gen = " mm" + character (len=12) :: latq = " mm" character (len=12) :: wateryld = " mm" - character (len=12) :: perc = " mm" + character (len=12) :: perc = " mm" character (len=12) :: et = " mm" character (len=12) :: ecanopy = " mm" character (len=12) :: eplant = " mm" @@ -368,7 +366,7 @@ module output_landscape_module character (len=12) :: sw_300 = " mm" character (len=12) :: sno_init = " mm" character (len=12) :: sno_final = " mm" - character (len=12) :: snopack = " mm" + character (len=12) :: snopack = " mm" character (len=12) :: pet = " mm" character (len=12) :: qtile = " mm" character (len=12) :: irr = " mm" @@ -399,30 +397,28 @@ module output_landscape_module character (len=6) :: mo = " mon" character (len=6) :: day_mo = " day" character (len=6) :: yrc = " yr" - character (len=9) :: isd = " unit " - character (len=8) :: id = " gis_id " - character (len=16) :: name = " name " + character (len=9) :: isd = " unit " + character (len=8) :: id = " gis_id " + character (len=16) :: name = " name " character(len=12) :: grazn = " grzn " - character(len=12) :: grazp = " grzp " - character(len=12) :: lab_min_p = " lab_min_p " - character(len=12) :: act_sta_p = " act_sta_p " - character(len=17) :: fertn = " fertn " - character(len=17) :: fertp = " fertp " - character(len=17) :: fixn = " fixn " + character(len=12) :: grazp = " grzp " + character(len=12) :: lab_min_p = " lab_min_p " + character(len=12) :: act_sta_p = " act_sta_p " + character(len=17) :: fertn = " fertn " + character(len=17) :: fertp = " fertp " + character(len=17) :: fixn = " fixn " character(len=17) :: denit = " denit " character(len=17) :: act_nit_n = " act_nit_n " character(len=17) :: act_sta_n = " act_sta_n " character(len=17) :: org_lab_p = " org_lab_p " - character(len=17) :: rsd_nitorg_n = " rsd_nitorg_n" - character(len=17) :: rsd_laborg_p = " rsd_laborg_p" - character(len=17) :: no3atmo = " no3atmo " - character(len=17) :: nh4atmo = " nh4atmo " - character(len=17) :: nuptake = " nuptake " - character(len=17) :: puptake = " puptake " - character(len=17) :: gwsoiln = " gwsoiln " - character(len=17) :: gwsoilp = " gwsoilp " - character (len=16) :: plt_cov = "plant_cov " - character (len=30) :: mgt_ops = "mgt_ops " + character(len=17) :: rsd_nitorg_n = " rsd_nitorg_n" + character(len=17) :: rsd_laborg_p = " rsd_laborg_p" + character(len=17) :: no3atmo = " no3atmo " + character(len=17) :: nh4atmo = " nh4atmo " + character(len=17) :: puptake = " puptake " + character(len=17) :: nuptake = " nuptake " + character(len=17) :: gwsoiln = " gwsoiln " + character(len=17) :: gwsoilp = " gwsoilp " end type output_nutbal_header type (output_nutbal_header) :: nb_hdr @@ -431,26 +427,26 @@ module output_landscape_module character (len=6) :: mo = " " character (len=6) :: day_mo = " " character (len=6) :: yrc = " " - character (len=9) :: isd = " " - character (len=8) :: id = " " - character (len=16) :: name = " " + character (len=9) :: isd = " " + character (len=8) :: id = " " + character (len=16) :: name = " " character(len=12) :: grazn = " kgha " - character(len=12) :: grazp = " kgha " - character(len=12) :: lab_min_p = " kgha " - character(len=12) :: act_sta_p = " kgha " - character(len=17) :: fertn = " kgha " - character(len=17) :: fertp = " kgha " - character(len=17) :: fixn = " kgha " - character(len=17) :: denit = " kgha " - character(len=17) :: act_nit_n = " kgha " - character(len=17) :: act_sta_n = " kgha " - character(len=17) :: org_lab_p = " kgha " - character(len=17) :: rsd_nitorg_n = " kgha " - character(len=17) :: rsd_laborg_p = " kgha " - character(len=17) :: no3atmo = " kgha " - character(len=17) :: nh4atmo = " kgha " - character(len=17) :: nuptake = " kgha " - character(len=17) :: puptake = " kgha " + character(len=12) :: grazp = " kgha " + character(len=12) :: lab_min_p = " kgha " + character(len=12) :: act_sta_p = " kgha " + character(len=17) :: fertn = " kgha " + character(len=17) :: fertp = " kgha " + character(len=17) :: fixn = " kgha " + character(len=17) :: denit = " kgha " + character(len=17) :: act_nit_n = " kgha " + character(len=17) :: act_sta_n = " kgha " + character(len=17) :: org_lab_p = " kgha " + character(len=17) :: rsd_nitorg_n = " kgha " + character(len=17) :: rsd_laborg_p = " kgha " + character(len=17) :: no3atmo = " kgha " + character(len=17) :: nh4atmo = " kgha " + character(len=17) :: nuptake = " kgha " + character(len=17) :: puptake = " kgha " character(len=17) :: gwsoiln = " kgha " character(len=17) :: gwsoilp = " kgha " end type output_nutbal_header_units @@ -462,22 +458,20 @@ module output_landscape_module character (len=6) :: day_mo = " day" character (len=6) :: yrc = " yr" character (len=8) :: isd = " unit " - character (len=8) :: id = " gis_id " - character (len=16) :: name = " name " + character (len=8) :: id = " gis_id " + character (len=16) :: name = " name " character (len=12) :: sedyld = " sedyld" character (len=12) :: sedorgn = " sedorgn" character (len=12) :: sedorgp = " sedorgp" character (len=12) :: surqno3 = " surqno3" - character (len=12) :: latno3 = " lat3no3" + character (len=12) :: latno3 = " lat3no3" character (len=12) :: surqsolp = " surqsolp" - character (len=12) :: usle = " usle" + character (len=12) :: usle = " usle" character (len=12) :: sedminp = " sedminp" character (len=12) :: tileno3 = " tileno3" character (len=12) :: lchlabp = " lchlabp" character (len=12) :: tilelabp = " tilelabp" character (len=12) :: satexn = " satexn" - character (len=16) :: plt_cov = " plant_cov " - character (len=30) :: mgt_ops = " mgt_ops " end type output_losses_header type (output_losses_header) :: ls_hdr @@ -487,15 +481,15 @@ module output_landscape_module character (len=6) :: day_mo = " " character (len=6) :: yrc = " " character (len=8) :: isd = " " - character (len=8) :: id = " " - character (len=16) :: name = " " + character (len=8) :: id = " " + character (len=16) :: name = " " character (len=12) :: sedyld = " tha" character (len=12) :: sedorgn = " kgha" character (len=12) :: sedorgp = " kgha" character (len=12) :: surqno3 = " kgha" - character (len=12) :: latno3 = " kgha" + character (len=12) :: latno3 = " kgha" character (len=12) :: surqsolp = " kgha" - character (len=12) :: usle = " tons" + character (len=12) :: usle = " tons" character (len=12) :: sedmin = " kgha" character (len=12) :: tileno3 = " kgha" character (len=12) :: lchlabp = " kgha" @@ -509,17 +503,17 @@ module output_landscape_module character (len=6) :: mo = " mon" character (len=6) :: day_mo = " day" character (len=6) :: yrc = " yr" - character (len=9) :: isd = " unit " - character (len=8) :: id = " gis_id " - character (len=9) :: name = " name " - character(len=17) :: lab_min_p = " lab_min_p" + character (len=9) :: isd = " unit " + character (len=8) :: id = " gis_id " + character (len=9) :: name = " name " + character(len=17) :: lab_min_p = " lab_min_p" character(len=17) :: act_sta_p = " act_sta_p" character(len=17) :: act_nit_n = " act_nit_n" character(len=17) :: act_sta_n = " act_sta_n" character(len=17) :: org_lab_p = " org_lab_p" character(len=17) :: rsd_hs_c = " rsd_hs_c" character(len=17) :: rsd_nitorg_n = " rsd_nitrorg_n" - character(len=17) :: rsd_laborg_p = " rsd_laborg_p" + character(len=17) :: rsd_laborg_p = " rsd_laborg_p" end type output_nutcarb_cycling_header type (output_nutcarb_cycling_header) :: nb_hdr1 @@ -528,17 +522,17 @@ module output_landscape_module character (len=6) :: mo = " " character (len=6) :: day_mo = " " character (len=6) :: yrc = " " - character (len=9) :: isd = " " - character (len=8) :: id = " " - character (len=9) :: name = " " + character (len=9) :: isd = " " + character (len=8) :: id = " " + character (len=9) :: name = " " character(len=17) :: lab_min_p = " kgha" - character(len=17) :: act_sta_p = " kgha" - character(len=17) :: act_nit_n = " kgha" - character(len=17) :: act_sta_n = " kgha" - character(len=17) :: org_lab_p = " kgha" - character(len=17) :: rsd_hs_c = " kgha" - character(len=17) :: rsd_nitorg_n = " kgha" - character(len=17) :: rsd_laborg_p = " kgha" + character(len=17) :: act_sta_p = " kgha" + character(len=17) :: act_nit_n = " kgha" + character(len=17) :: act_sta_n = " kgha" + character(len=17) :: org_lab_p = " kgha" + character(len=17) :: rsd_hs_c = " kgha" + character(len=17) :: rsd_nitorg_n = " kgha" + character(len=17) :: rsd_laborg_p = " kgha" end type output_nutbal_header_units1 type (output_nutbal_header_units1) :: nb_hdr_units1 @@ -548,10 +542,10 @@ module output_landscape_module character (len=6) :: mo = " mon" character (len=6) :: day_mo = " day" character (len=6) :: yrc = " yr" - character (len=9) :: isd = " unit " - character (len=8) :: id = " gis_id " - character (len=9) :: name = " name " - character(len=17) :: sed_c = " sed_c" + character (len=9) :: isd = " unit " + character (len=8) :: id = " gis_id " + character (len=9) :: name = " name " + character(len=17) :: sed_c = " sed_c" character(len=17) :: surq_c = " surq_c" character(len=17) :: surq_doc = " surq_doc" character(len=17) :: surq_dic = " surq_dic" @@ -559,8 +553,8 @@ module output_landscape_module character(len=17) :: latq_doc = " latq_doc" character(len=17) :: latq_dic = " latq_dic" character(len=17) :: perc_c = " perc_c" - character(len=17) :: perc_doc = " perc_doc" - character(len=17) :: perc_dic = " perc_dic" + character(len=17) :: perc_doc = " perc_doc" + character(len=17) :: perc_dic = " perc_dic" character(len=17) :: npp_c = " npp_c" character(len=17) :: rsd_c = " rsd_c" character(len=17) :: grain_c = " grain_c" @@ -575,16 +569,16 @@ module output_landscape_module character (len=6) :: mo = " " character (len=6) :: day_mo = " " character (len=6) :: yrc = " " - character (len=9) :: isd = " " - character (len=8) :: id = " " - character (len=9) :: name = " " + character (len=9) :: isd = " " + character (len=8) :: id = " " + character (len=9) :: name = " " character(len=17) :: sed_c = " kg C/ha" - character(len=17) :: surq_c = " kg C/ha" - character(len=17) :: surq_doc = " kg C/ha" - character(len=17) :: surq_dic = " kg C/ha" - character(len=17) :: latq_c = " kg C/ha" - character(len=17) :: latq_doc = " kg C/ha" - character(len=17) :: latq_dic = " kg C/ha" + character(len=17) :: surq_c = " kg C/ha" + character(len=17) :: surq_doc = " kg C/ha" + character(len=17) :: surq_dic = " kg C/ha" + character(len=17) :: latq_c = " kg C/ha" + character(len=17) :: latq_doc = " kg C/ha" + character(len=17) :: latq_dic = " kg C/ha" character(len=17) :: perc_c = " kg C/ha" character(len=17) :: perc_doc = " kg C/ha" character(len=17) :: perc_dic = " kg C/ha" @@ -603,20 +597,20 @@ module output_landscape_module character (len=11) :: day = " jday" character (len=11) :: mo = " mon" character (len=11) :: day_mo = " day" - character (len=11) :: yrc = " yr" - character (len=16) :: isd = " unit" - character (len=21) :: id = " gis_id " + character (len=11) :: yrc = " yr" + character (len=16) :: isd = " unit" + character (len=21) :: id = " gis_id " character (len=16) :: name = " name " character(len=15) :: sed_c = " sed_c" - character(len=15) :: surq_c = " surq_c" - character(len=15) :: surq_doc = " surq_doc" + character(len=15) :: surq_c = " surq_c" + character(len=15) :: surq_doc = " surq_doc" character(len=15) :: surq_dic = " surq_dic" - character(len=15) :: latq_c = " latq_c" + character(len=15) :: latq_c = " latq_c" character(len=15) :: latq_doc = " latq_doc" character(len=15) :: latq_dic = " latq_dic" character(len=15) :: perc_c = " perc_c" - character(len=15) :: perc_doc = " perc_doc" - character(len=15) :: perc_dic = " perc_dic" + character(len=15) :: perc_doc = " perc_doc" + character(len=15) :: perc_dic = " perc_dic" character(len=15) :: res_decay = " res_decay" character(len=15) :: man_app_c = " man_app_c" character(len=15) :: man_graze_c = " man_graze_c" @@ -629,17 +623,17 @@ module output_landscape_module character (len=11) :: day = " " character (len=11) :: mo = " " character (len=11) :: day_mo = " " - character (len=11) :: yrc = " " - character (len=16) :: isd = " " - character (len=21) :: id = " " - character (len=16) :: name = " " + character (len=11) :: yrc = " " + character (len=16) :: isd = " " + character (len=21) :: id = " " + character (len=16) :: name = " " character(len=15) :: sed_c = " kg C/ha" - character(len=15) :: surq_c = " kg C/ha" - character(len=15) :: surq_doc = " kg C/ha" - character(len=15) :: surq_dic = " kg C/ha" - character(len=15) :: latq_c = " kg C/ha" - character(len=15) :: latq_doc = " kg C/ha" - character(len=15) :: latq_dic = " kg C/ha" + character(len=15) :: surq_c = " kg C/ha" + character(len=15) :: surq_doc = " kg C/ha" + character(len=15) :: surq_dic = " kg C/ha" + character(len=15) :: latq_c = " kg C/ha" + character(len=15) :: latq_doc = " kg C/ha" + character(len=15) :: latq_dic = " kg C/ha" character(len=15) :: perc_c = " kg C/ha" character(len=15) :: perc_doc = " kg C/ha" character(len=15) :: perc_dic = " kg C/ha" @@ -659,13 +653,13 @@ module output_landscape_module character (len=11) :: day = " jday" character (len=11) :: mo = " mon" character (len=11) :: day_mo = " day" - character (len=11) :: yrc = " yr" - character (len=16) :: isd = " unit" - character (len=21) :: id = " gis_id " + character (len=11) :: yrc = " yr" + character (len=16) :: isd = " unit" + character (len=21) :: id = " gis_id " character (len=16) :: name = " name " character(len=15) :: plant_c = " plant_c" - character(len=15) :: res_decay_c = " res_decay_c" - character(len=15) :: harv_stov_c = " harv_stov_c" + character(len=15) :: res_decay_c = " res_decay_c" + character(len=15) :: harv_stov_c = " harv_stov_c" character(len=15) :: emit_c = " emit_c" end type output_rescarb_header type (output_rescarb_header) :: rescarb_hdr @@ -674,13 +668,13 @@ module output_landscape_module character (len=11) :: day = " " character (len=11) :: mo = " " character (len=11) :: day_mo = " " - character (len=11) :: yrc = " " - character (len=16) :: isd = " " - character (len=21) :: id = " " - character (len=16) :: name = " " + character (len=11) :: yrc = " " + character (len=16) :: isd = " " + character (len=21) :: id = " " + character (len=16) :: name = " " character(len=15) :: plant_c = " kg C/ha" - character(len=15) :: res_decay_c = " kg C/ha" - character(len=15) :: harv_stov_c = " kg C/ha" + character(len=15) :: res_decay_c = " kg C/ha" + character(len=15) :: harv_stov_c = " kg C/ha" character(len=15) :: emit_c = " kg C/ha" end type output_rescarb_header_units type (output_rescarb_header_units) :: rescarb_hdr_units @@ -693,13 +687,13 @@ module output_landscape_module character (len=11) :: day = " jday" character (len=11) :: mo = " mon" character (len=11) :: day_mo = " day" - character (len=11) :: yrc = " yr" - character (len=16) :: isd = " unit" - character (len=21) :: id = " gis_id " - character (len=16) :: name = " name " + character (len=11) :: yrc = " yr" + character (len=16) :: isd = " unit" + character (len=21) :: id = " gis_id " + character (len=16) :: name = " name " character(len=15) :: npp_c = " npp_c" - character(len=15) :: harv_c = " harv_c" - character(len=15) :: drop_c = " drop_c" + character(len=15) :: harv_c = " harv_c" + character(len=15) :: drop_c = " drop_c" character(len=15) :: grazeat_c = " grazeat_c" character(len=15) :: emit_c = " emit_c" end type output_plcarb_header @@ -709,14 +703,14 @@ module output_landscape_module character (len=11) :: day = " " character (len=11) :: mo = " " character (len=11) :: day_mo = " " - character (len=11) :: yrc = " " - character (len=16) :: isd = " " - character (len=21) :: id = " " - character (len=16) :: name = " " + character (len=11) :: yrc = " " + character (len=16) :: isd = " " + character (len=21) :: id = " " + character (len=16) :: name = " " character(len=15) :: npp_c = " kg C/ha" - character(len=15) :: harv_c = " kg C/ha" - character(len=15) :: drop_c = " kg C/ha" - character(len=15) :: grazeat_c = " kg C/ha" + character(len=15) :: harv_c = " kg C/ha" + character(len=15) :: drop_c = " kg C/ha" + character(len=15) :: grazeat_c = " kg C/ha" character(len=15) :: emit_c = " kg C/ha" end type output_plcarb_header_units type (output_plcarb_header_units) :: plcarb_hdr_units @@ -729,18 +723,18 @@ module output_landscape_module character (len=11) :: day = " jday" character (len=11) :: mo = " mon" character (len=11) :: day_mo = " day" - character (len=11) :: yrc = " yr" - character (len=16) :: isd = " unit" - character (len=21) :: id = " gis_id " - character (len=16) :: name = " name " + character (len=11) :: yrc = " yr" + character (len=16) :: isd = " unit" + character (len=21) :: id = " gis_id " + character (len=16) :: name = " name " character(len=15) :: meta_micr = " meta_micr" - character(len=15) :: str_micr = " str_micr" - character(len=15) :: str_hs = " str_hs" + character(len=15) :: str_micr = " str_micr" + character(len=15) :: str_hs = " str_hs" character(len=15) :: co2_meta = " co2_meta" character(len=15) :: co2_str = " co2_str" character(len=15) :: micr_hs = " micr_hs" character(len=15) :: micr_hp = " micr_hp" - character(len=15) :: hs_micr = " hs_micr" + character(len=15) :: hs_micr = " hs_micr" character(len=15) :: hs_hp = " hs_hp" character(len=15) :: hp_micr = " hp_micr" character(len=15) :: co2_micr = " co2_micr" @@ -753,13 +747,13 @@ module output_landscape_module character (len=11) :: day = " " character (len=11) :: mo = " " character (len=11) :: day_mo = " " - character (len=11) :: yrc = " " - character (len=16) :: isd = " " - character (len=21) :: id = " " - character (len=16) :: name = " " + character (len=11) :: yrc = " " + character (len=16) :: isd = " " + character (len=21) :: id = " " + character (len=16) :: name = " " character(len=15) :: meta_micr = " kg C/ha" - character(len=15) :: str_micr = " kg C/ha" - character(len=15) :: str_hs = " kg C/ha" + character(len=15) :: str_micr = " kg C/ha" + character(len=15) :: str_hs = " kg C/ha" character(len=15) :: co2_meta = " kg C/ha" character(len=15) :: co2_str = " kg C/ha" character(len=15) :: micr_hs = " kg C/ha" @@ -769,7 +763,7 @@ module output_landscape_module character(len=15) :: hp_micr = " kg C/ha" character(len=15) :: co2_micr = " kg C/ha" character(len=15) :: co2_hs = " kg C/ha" - character(len=15) :: co2_hp = " kg C/ha" + character(len=15) :: co2_hp = " kg C/ha" end type output_hscf_header_units type (output_hscf_header_units) :: hscf_hdr_units @@ -781,13 +775,13 @@ module output_landscape_module character (len=11) :: day = " jday" character (len=11) :: mo = " mon" character (len=11) :: day_mo = " day" - character (len=11) :: yrc = " yr" - character (len=16) :: isd = " unit" - character (len=21) :: id = " gis_id " - character (len=16) :: name = " name " + character (len=11) :: yrc = " yr" + character (len=16) :: isd = " unit" + character (len=21) :: id = " gis_id " + character (len=16) :: name = " name " character(len=15) :: tot_c = " meta_micr" - character(len=15) :: ab_gr_c = " ab_gr_c" - character(len=15) :: leaf_c = " leaf_c" + character(len=15) :: ab_gr_c = " ab_gr_c" + character(len=15) :: leaf_c = " leaf_c" character(len=15) :: stem_c = " stem_c" character(len=15) :: seed_c = " seed_c" character(len=15) :: root_c = " root_c" @@ -798,13 +792,13 @@ module output_landscape_module character (len=11) :: day = " " character (len=11) :: mo = " " character (len=11) :: day_mo = " " - character (len=11) :: yrc = " " - character (len=16) :: isd = " " - character (len=21) :: id = " " - character (len=16) :: name = " " + character (len=11) :: yrc = " " + character (len=16) :: isd = " " + character (len=21) :: id = " " + character (len=16) :: name = " " character(len=15) :: tot_c = " kg/ha" - character(len=15) :: ab_gr_c = " kg/ha" - character(len=15) :: leaf_c = " kg/ha" + character(len=15) :: ab_gr_c = " kg/ha" + character(len=15) :: leaf_c = " kg/ha" character(len=15) :: stem_c = " kg/ha" character(len=15) :: seed_c = " kg/ha" character(len=15) :: root_c = " kg/ha" @@ -819,13 +813,13 @@ module output_landscape_module character (len=11) :: day = " jday" character (len=11) :: mo = " mon" character (len=11) :: day_mo = " day" - character (len=11) :: yrc = " yr" - character (len=16) :: isd = " unit" - character (len=21) :: id = " gis_id " - character (len=16) :: name = " name " + character (len=11) :: yrc = " yr" + character (len=16) :: isd = " unit" + character (len=21) :: id = " gis_id " + character (len=16) :: name = " name " character(len=15) :: tot_c = " tot_c" - character(len=15) :: meta_c = " meta_c" - character(len=15) :: str_c = " str_c" + character(len=15) :: meta_c = " meta_c" + character(len=15) :: str_c = " str_c" character(len=15) :: lig_c = " lig_c" end type output_resc_header @@ -835,13 +829,13 @@ module output_landscape_module character (len=11) :: day = " " character (len=11) :: mo = " " character (len=11) :: day_mo = " " - character (len=11) :: yrc = " " - character (len=16) :: isd = " " - character (len=21) :: id = " " - character (len=16) :: name = " " + character (len=11) :: yrc = " " + character (len=16) :: isd = " " + character (len=21) :: id = " " + character (len=16) :: name = " " character(len=15) :: tot_c = " kg/ha" - character(len=15) :: meta_c = " kg/ha" - character(len=15) :: str_c = " kg/ha" + character(len=15) :: meta_c = " kg/ha" + character(len=15) :: str_c = " kg/ha" character(len=15) :: lig_c = " kg/ha" end type output_resc_header_units type (output_resc_header_units) :: resc_hdr_units @@ -854,17 +848,17 @@ module output_landscape_module character (len=11) :: day = " jday" character (len=11) :: mo = " mon" character (len=11) :: day_mo = " day" - character (len=11) :: yrc = " yr" - character (len=16) :: isd = " unit" - character (len=21) :: id = " gis_id " - character (len=16) :: name = " name " + character (len=11) :: yrc = " yr" + character (len=16) :: isd = " unit" + character (len=21) :: id = " gis_id " + character (len=16) :: name = " name " character(len=15) :: tot_org_c = " tot_org_c" - character(len=15) :: str_c = " str_c" - character(len=15) :: lig_c = " lib_c" + character(len=15) :: str_c = " str_c" + character(len=15) :: lig_c = " lib_c" character(len=15) :: meta_c = " meta_c" character(len=15) :: man_c = " man_c" - character(len=15) :: humus_low_c = " humus_low_c" - character(len=15) :: humus_pass_c = " humus_pass_c" + character(len=15) :: humus_low_c = " humus_low_c" + character(len=15) :: humus_pass_c = " humus_pass_c" character(len=15) :: microb_c = " microb_c" end type output_soilc_header type (output_soilc_header) :: soilc_hdr @@ -873,42 +867,99 @@ module output_landscape_module character (len=11) :: day = " " character (len=11) :: mo = " " character (len=11) :: day_mo = " " - character (len=11) :: yrc = " " - character (len=16) :: isd = " " - character (len=21) :: id = " " - character (len=16) :: name = " " + character (len=11) :: yrc = " " + character (len=16) :: isd = " " + character (len=21) :: id = " " + character (len=16) :: name = " " character(len=15) :: tot_org_c = " kg/ha" - character(len=15) :: str_c = " kg/ha" - character(len=15) :: lig_c = " kg/ha" + character(len=15) :: str_c = " kg/ha" + character(len=15) :: lig_c = " kg/ha" character(len=15) :: meta_c = " kg/ha" character(len=15) :: man_c = " kg/ha" - character(len=15) :: humus_low_c = " kg/ha" - character(len=15) :: humus_pass_c = " kg/ha" + character(len=15) :: humus_low_c = " kg/ha" + character(len=15) :: humus_pass_c = " kg/ha" character(len=15) :: microb_c = " kg/ha" end type output_soilc_header_units type (output_soilc_header_units) :: soilc_hdr_units + type output_soil_org_flux_header + character (len=11) :: day = " jday" + character (len=11) :: mo = " mon" + character (len=11) :: day_mo = " day" + character (len=11) :: yrc = " yr" + character (len=16) :: isd = " unit" + character (len=22) :: id = " gis_id " + character (len=16) :: name = " name " + character(len=15) :: cfmets1 = " cfmets1" + character(len=15) :: cfstrs1 = " cfstrs1" + character(len=15) :: cfstrs2 = " cfstrs2" + character(len=15) :: efmets1 = " efmets1" + character(len=15) :: efstrs1 = " efstrs1" + character(len=15) :: efstrs2 = " efstrs2" + character(len=15) :: immmets1 = " immmets1" + character(len=15) :: immstrs1 = " immstrs1" + character(len=15) :: immstrs2 = " immstrs2" + character(len=15) :: mnrmets1 = " mnrmets1" + character(len=15) :: mnrstrs1 = " mnrstrs1" + character(len=15) :: mnrstrs2 = " mnrstrs2" + character(len=15) :: co2fmet = " co2fmet" + character(len=15) :: co2fstr = " co2fstr" + character(len=15) :: cfs1s2 = " cfs1s2" + character(len=15) :: cfs1s3 = " cfs1s3" + character(len=15) :: cfs2s1 = " cfs2s1" + character(len=15) :: cfs2s3 = " cfs2s3" + character(len=15) :: cfs3s1 = " cfs3s1" + character(len=15) :: efs1s2 = " efs1s2" + character(len=15) :: efs1s3 = " efs1s3" + character(len=15) :: efs2s1 = " efs2s1" + character(len=15) :: efs2s3 = " efs2s3" + character(len=15) :: efs3s1 = " efs3s1" + character(len=15) :: imms1s2 = " imms1s2" + character(len=15) :: imms1s3 = " imms1s3" + character(len=15) :: imms2s1 = " imms2s1" + character(len=15) :: imms2s3 = " imms2s3" + character(len=15) :: imms3s1 = " imms3s1" + character(len=15) :: mnrs1s2 = " mnrs1s2" + character(len=15) :: mnrs1s3 = " mnrs1s3" + character(len=15) :: mnrs2s1 = " mnrs2s1" + character(len=15) :: mnrs2s3 = " mnrs2s3" + character(len=15) :: mnrs3s1 = " mnrs3s1" + character(len=15) :: co2fs1 = " co2fs1" + character(len=15) :: co2fs2 = " co2fs2" + character(len=15) :: co2fs3 = " co2fs3" + + ! character(len=15) :: tot_org_c = " tot_org_c" + ! character(len=15) :: str_c = " str_c" + ! character(len=15) :: lig_c = " lib_c" + ! character(len=15) :: meta_c = " meta_c" + ! character(len=15) :: man_c = " man_c" + ! character(len=15) :: humus_low_c = " humus_low_c" + ! character(len=15) :: humus_pass_c = " humus_pass_c" + ! character(len=15) :: microb_c = " microb_c" + end type output_soil_org_flux_header + type (output_soil_org_flux_header) :: soil_org_flux_hdr + !!! NEW SOIL CARBON STAT OUTPUT !!! NEW BASIN CARBON OUTPUT type output_bsn_carb_header character (len=11) :: day = " jday" - character (len=11) :: yrc = " yr" + character (len=11) :: yrc = " yr" character (len=6) :: blnk = " " character (len=15) :: org_soilc = " org_soilc" - character (len=15) :: org_plc = " org_plc" - character (len=15) :: org_resc = " org_resc" + character (len=15) :: org_plc = " org_plc" + character (len=15) :: org_resc = " org_resc" end type output_bsn_carb_header type (output_bsn_carb_header) :: bsn_carb_hdr type output_bsn_carb_header_units character (len=11) :: day = " " - character (len=11) :: yrc = " " + character (len=11) :: yrc = " " character (len=6) :: blnk = " " character(len=15) :: org_soilc = " kg/ha" - character(len=15) :: org_plc = " kg/ha" - character(len=15) :: org_resc = " kg/ha" + character(len=15) :: org_plc = " kg/ha" + character(len=15) :: org_resc = " kg/ha" end type output_bsn_carb_header_units type (output_bsn_carb_header_units) :: bsn_carb_hdr_units @@ -916,21 +967,21 @@ module output_landscape_module type output_losses_header1 - character (len=5) :: day = " jday" + character (len=6) :: day = " jday" character (len=6) :: mo = " mon" character (len=6) :: day_mo = " day" character (len=6) :: yrc = " yr" character (len=9) :: isd = " unit " - character (len=8) :: id = " gis_id " - character (len=9) :: name = " name " + character (len=8) :: id = " gis_id " + character (len=9) :: name = " name " character (len=17) :: sedyld = " sedyld" - character (len=17) :: usle = " usle" - character (len=17) :: sedorgc = " sedorgc" + character (len=17) :: usle = " usle" + character (len=17) :: sedorgc = " sedorgc" character (len=17) :: sedorgn = " sedorgn" character (len=17) :: sedorgp = " sedorgp" character (len=17) :: surqno3 = " surqno3" - character (len=17) :: latno3 = " lat3no3" - character (len=17) :: surqsolp = " surqsolp" + character (len=17) :: latno3 = " lat3no3" + character (len=17) :: surqsolp = " surqsolp" character (len=17) :: sedminp = " sedminp" character (len=17) :: tileno3 = " tileno3" character (len=17) :: no3atmo = " no3atmo" @@ -956,20 +1007,20 @@ module output_landscape_module type (output_losses_header1) :: ls_hdr1 type output_losses_header_units1 - character (len=5) :: day = " " + character (len=6) :: day = " " character (len=6) :: mo = " " character (len=6) :: day_mo = " " character (len=6) :: yrc = " " character (len=9) :: isd = " " - character (len=8) :: id = " " - character (len=9) :: name = " " + character (len=8) :: id = " " + character (len=9) :: name = " " character (len=17) :: sedyld = " tons" character (len=17) :: usle = " tha" character (len=17) :: sedorgc = " kgha" character (len=17) :: sedorgn = " kgha" character (len=17) :: sedorgp = " kgha" character (len=17) :: surqno3 = " kgha" - character (len=17) :: latno3 = " kgha" + character (len=17) :: latno3 = " kgha" character (len=17) :: surqsolp = " kgha" character (len=17) :: sedmin = " ----" character (len=17) :: tileno3 = " kgha" @@ -1001,8 +1052,8 @@ module output_landscape_module character (len=6) :: day_mo = " day" character (len=6) :: yrc = " yr" character (len=8) :: isd = " unit " - character (len=8) :: id = " gis_id " - character (len=16) :: name = " name " + character (len=8) :: id = " gis_id " + character (len=16) :: name = " name " character (len=13) :: lai = " lai" character (len=12) :: bioms = " bioms" character (len=12) :: yield = " yield" @@ -1027,9 +1078,7 @@ module output_landscape_module character (len=12) :: lai_max = " lai_max" character (len=12) :: bm_max = " bm_max" character (len=12) :: bm_grow = " bm_grow" - character (len=12) :: c_gro = " c_gro" - character (len=16) :: plt_cov = " plant_cov " - character (len=30) :: mgt_ops = " mgt_ops " + character (len=12) :: c_gro = " c_gro" end type output_plantweather_header type (output_plantweather_header) :: pw_hdr @@ -1039,19 +1088,19 @@ module output_landscape_module character (len=6) :: day_mo = " " character (len=6) :: yrc = " " character (len=8) :: isd = " " - character (len=8) :: id = " " - character (len=16) :: name = " " + character (len=8) :: id = " " + character (len=16) :: name = " " character (len=13) :: lai = " m**2/m**2" character (len=12) :: bioms = " kgha" character (len=12) :: yield = " kgha" character (len=12) :: residue = " kgha" character (len=12) :: sol_tmp = " degc" - character (len=12) :: strsw = " ----" - character (len=12) :: strsa = " ----" - character (len=12) :: strstmp = " ----" - character (len=12) :: strsn = " ----" - character (len=12) :: strsp = " ----" - character (len=12) :: strss = " ----" + character (len=12) :: strsw = " ----" + character (len=12) :: strsa = " ----" + character (len=12) :: strstmp = " ----" + character (len=12) :: strsn = " ----" + character (len=12) :: strsp = " ----" + character (len=12) :: strss = " ----" character (len=12) :: nplnt = " kgha" character (len=12) :: percn = " kgha" character (len=12) :: pplnt = " kgha" diff --git a/src/soil_module.f90 b/src/soil_module.f90 index 845e995..213fb30 100644 --- a/src/soil_module.f90 +++ b/src/soil_module.f90 @@ -1,7 +1,10 @@ module soil_module + use carbon_module, only: org_flux + implicit none + type soilayer real :: ec = 0. real :: cal = 0. @@ -50,7 +53,7 @@ module soil_module type (soil_physical_properties),dimension (:), allocatable:: phys1 type soil_profile - character(len=20) :: snam = "" !! NA soil series name + character(len=16) :: snam = "" !! NA soil series name character(len=16) :: hydgrp = "" !! NA hydrologic soil group character(len=16) :: texture = "" integer :: nly = 0 !! none number of soil layers diff --git a/src/soil_nutcarb_write.f90 b/src/soil_nutcarb_write.f90 index 3c746de..ac4f5a5 100644 --- a/src/soil_nutcarb_write.f90 +++ b/src/soil_nutcarb_write.f90 @@ -1,7 +1,7 @@ - subroutine soil_nutcarb_write + subroutine soil_nutcarb_write(out_freq) !! ~ ~ ~ PURPOSE ~ ~ ~ -!! this subroutine writes daily HRU output to the output.hru file +!! this subroutine writes HRU output to the output.hru file !! ~ ~ ~ INCOMING VARIABLES ~ ~ ~ !! name |units |definition @@ -30,9 +30,12 @@ subroutine soil_nutcarb_write use organic_mineral_mass_module use hydrograph_module use calibration_data_module + use carbon_module, only: org_flux_zero + use basin_module implicit none + character(len=1), intent(in) :: out_freq ! Output freqency (d, m, y, a) integer :: ly = 0 !none |counter real :: const = 0. !none |counter integer :: iihru = 0 !none |counter @@ -88,7 +91,32 @@ subroutine soil_nutcarb_write write (4562,*) time%day, time%mo, time%day_mo, time%yrc, j, ob(iob)%gis_id, ob(iob)%name, & soil1(j)%tot_org%c, soil_prof_str%c, soil_prof_lig%c, soil_prof_meta%c, & soil_prof_man%c, soil_prof_hs%c, soil_prof_hp%c, soil_prof_microb%c + + if (pco%csvout == "y") then + write (4565,'(*(G0.3,:,","))') time%day, time%mo, time%day_mo, time%yrc, j, ob(iob)%gis_id, ob(iob)%name, & + soil1(j)%tot_org%c, soil_prof_str%c, soil_prof_lig%c, soil_prof_meta%c, & + soil_prof_man%c, soil_prof_hs%c, soil_prof_hp%c, soil_prof_microb%c + !write organic flux pools for the soil profile + if (bsn_cc%cswat == 2) then + write (4567,*) time%day, time%mo, time%day_mo, time%yrc, j, ob(iob)%gis_id, ob(iob)%name, & + soil1(j)%org_flx_cum_tot + if (pco%csvout == "y") then + write (4568,'(*(G0.3,:,","))') time%day, time%mo, time%day_mo, time%yrc, j, ob(iob)%gis_id, ob(iob)%name, & + soil1(j)%org_flx_cum_tot + endif + end if + + ! Set the org_flux pools to zero if at the end of the calendar year + if (bsn_cc%cswat == 2) then + if (out_freq == "y") then + soil1(j)%org_flx_cum_tot = org_flux_zero + do ly = 1, soil(j)%nly + soil1(j)%org_flx_cum_lr(ly) = org_flux_zero + end do + end if + end if + end do !! hru loop !! summing hru output for the basin diff --git a/src/soils_init.f90 b/src/soils_init.f90 index 30894f5..8b34a6d 100644 --- a/src/soils_init.f90 +++ b/src/soils_init.f90 @@ -134,7 +134,7 @@ subroutine soils_init if (sep(isep)%opt /= 0) then dep_new1 = 0. dep_new2 = 0. - if (sep(isep)%z + sep(isep)%thk > soil(ihru)%phys(nly)%d) then + if (sep(isep)%z + sep(isep)%thk > soil(ihru)%phys(nly)%d) then i_sep(ihru) = nly + 1 dep_new1 = sep(isep)%z - sep(isep)%thk dep_new2 = 0. @@ -170,6 +170,8 @@ subroutine soils_init allocate (soil1(ihru)%mn(nly)) allocate (soil1(ihru)%mp(nly)) allocate (soil1(ihru)%tot(nly)) + allocate (soil1(ihru)%org_flx_lr(nly)) + allocate (soil1(ihru)%org_flx_cum_lr(nly)) allocate (soil1(ihru)%hact(nly)) allocate (soil1(ihru)%hsta(nly)) allocate (soil1(ihru)%rsd(nly)) @@ -200,7 +202,6 @@ subroutine soils_init allocate (soil1_init(ihru)%man(nly)) allocate (soil1_init(ihru)%water(nly)) - call soil_nutcarb_init(isol) !! initialize soil nutrient/carbon parameters Jaehak 2024 end do return From 07a76f19190d7bd74c475c776d00e9f11ec832ca Mon Sep 17 00:00:00 2001 From: Frank Geter Date: Fri, 8 Nov 2024 12:59:56 -0700 Subject: [PATCH 2/2] fixed a missing end if statement. --- src/soil_nutcarb_write.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/soil_nutcarb_write.f90 b/src/soil_nutcarb_write.f90 index ac4f5a5..c00f120 100644 --- a/src/soil_nutcarb_write.f90 +++ b/src/soil_nutcarb_write.f90 @@ -96,6 +96,7 @@ subroutine soil_nutcarb_write(out_freq) write (4565,'(*(G0.3,:,","))') time%day, time%mo, time%day_mo, time%yrc, j, ob(iob)%gis_id, ob(iob)%name, & soil1(j)%tot_org%c, soil_prof_str%c, soil_prof_lig%c, soil_prof_meta%c, & soil_prof_man%c, soil_prof_hs%c, soil_prof_hp%c, soil_prof_microb%c + end if !write organic flux pools for the soil profile if (bsn_cc%cswat == 2) then