Skip to contents

Top-level driver that traces the nitrogen, carbon and volatile solids in realised feed intake (the redistribute_feed() result) through livestock excretion, manure management and application to soil by land use and crop, plus the management-loss side-streams. It chains estimate_n_excretion(), split_manure_management(), apply_management_losses() and allocate_manure_to_land(); at the "subnational" resolution it additionally spills each cell's un-placeable surplus to neighbouring cells with allocate_manure_transport() before local disposal. Every method choice is recorded in a method_* provenance column and the nitrogen balance (excreted = applied + management losses) is conserved.

Usage

build_livestock_nutrient_flows(
  intake,
  resolution = "national",
  methods = list(),
  gridded = NULL,
  bedding = NULL
)

Arguments

intake

A tibble of realised feed intake (the redistribute_feed() result); see estimate_n_excretion() for the required columns. At "subnational" resolution sub_territory is the "lon_lat" cell id.

resolution

One of "global", "national" (default) or "subnational". Transport between cells runs only at "subnational".

methods

A named list of per-stage option lists, any of excretion, split, bedding, losses, allocation and transport, each forwarded to the matching pipeline function's options. transport also takes land_split, which decides where manure trucked into a cell lands inside that cell's remaining room: "cropland_first" (default) fills the remaining cropland room and puts the rest on grassland, the same priority allocate_manure_to_land() gives a cell's own collected manure; "room_share" splits it in proportion to the remaining cropland and grassland room; "cropland_only" books all of it as cropland, the behaviour before whep#341, which counts grassland room as cropland. The total delivered to each cell is the same under all three.

gridded

The land-surface layer (crops and optional grass tibbles) passed to allocate_manure_to_land(); required for the default "potential_uptake" cap. NULL is treated as an empty list. The crop column of crops is a code: as.character(item_prod_code) from items_prod_full. That is the one contract, honoured by both consumers of this function's applied stream (the carbon balance and the nitrogen balance); a crop name is still resolved by the nitrogen path but is deprecated and warns.

bedding

An optional bedding supply from build_residue_bedding_supply(). When given, add_manure_bedding() places it on the litter-using housed streams before the management losses, so the manure reaching the field is bedded farmyard manure rather than excreta alone. NULL (default) leaves every number excreta-only. Build the supply from calculate_residue_destinies(), whose default bedding share is Wirsenius (2000) Table 3.21 (whep#1005); the turnkey soil-carbon reader of build_soil_carbon_inputs() does so.

Value

A named list with applied (manure applied per land_use x crop (x cell) with manure_type ("Excreta"/"Solid"/ "Liquid") and all method_* provenance columns, including method_transport_land_use, the land_split used, NA unless the resolution is "subnational"; and the grazing-excreta species mix: excreta_cpp_share, the share of a row's N deposited by cattle, poultry and pigs, the IPCC 2019 EF3PRP,CPP animals (Vol 4, Ch 11, Table 11.1 (Updated), p. 11.13), with sheep and other animals (SO) making up the rest, and method_excreta_species, which records where the share came from ("engine_livestock_category") or why an "Excreta" row has none ("fallback_label_no_species", a row the manure-type split labelled "Excreta" for want of a share, which is not grazing deposition). Both are NA on "Solid" and "Liquid" rows), losses (management-loss side-streams per polity) and excretion (the per-category excretion totals).

Examples

intake <- tibble::tribble(
  ~year, ~territory, ~sub_territory, ~livestock_category,
  ~item_cbs_code, ~feed_quality, ~intake_dm_t,
  2020L, "203", NA, "Cattle_milk", 2513L, "high_quality", 200,
  2020L, "203", NA, "Cattle_milk", NA, "grass", 600
)
gridded <- list(
  crops = tibble::tribble(
    ~year, ~territory, ~sub_territory, ~crop, ~manure_n_receptivity, ~crop_n_cap,
    2020L, "203", NA, "44", 6, 200,
    2020L, "203", NA, "15", 4, 200
  )
)
build_livestock_nutrient_flows(intake, gridded = gridded)
#> $applied
#> # A tibble: 5 × 30
#>    year territory sub_territory land_use  crop  source_stream manure_type
#>   <int> <chr>     <lgl>         <chr>     <chr> <chr>         <chr>      
#> 1  2020 203       NA            Cropland  44    collected     Liquid     
#> 2  2020 203       NA            Cropland  44    collected     Solid      
#> 3  2020 203       NA            Cropland  15    collected     Liquid     
#> 4  2020 203       NA            Cropland  15    collected     Solid      
#> 5  2020 203       NA            Grassland NA    grazing       Excreta    
#> # ℹ 23 more variables: applied_n <dbl>, applied_c <dbl>, applied_vs <dbl>,
#> #   over_cap <lgl>, method_allocation <chr>, method_cap <chr>,
#> #   disposal_method <chr>, excreta_cpp_share <dbl>,
#> #   method_excreta_species <chr>, resolution <chr>, method_n_excretion <chr>,
#> #   method_vs <chr>, method_digestibility <chr>, method_c_excretion <chr>,
#> #   method_forage_n <chr>, method_mms <chr>, method_losses <chr>,
#> #   method_bedding_c <chr>, method_indirect_n2o <chr>, …
#> 
#> $losses
#> # A tibble: 1 × 10
#>    year territory sub_territory n_volatilized n_leached n2o_direct_n  n2_n
#>   <int> <chr>     <lgl>                 <dbl>     <dbl>        <dbl> <dbl>
#> 1  2020 203       NA                     2.28     0.112       0.0589 0.177
#> # ℹ 3 more variables: n2o_indirect_n <dbl>, c_lost <dbl>, vs_destroyed <dbl>
#> 
#> $excretion
#> # A tibble: 1 × 13
#>    year territory sub_territory livestock_category n_intake n_excretion
#>   <int> <chr>     <lgl>         <chr>                 <dbl>       <dbl>
#> 1  2020 203       NA            Cattle_milk            15.7        12.6
#> # ℹ 7 more variables: c_excretion <dbl>, vs_excretion <dbl>,
#> #   method_n_excretion <chr>, method_vs <chr>, method_digestibility <chr>,
#> #   method_c_excretion <chr>, method_forage_n <chr>
#>