From ebbe81b87a219c577108f9773f81d81e62d89883 Mon Sep 17 00:00:00 2001 From: jadamchick <146877580+jadamchick@users.noreply.github.com> Date: Tue, 7 Jul 2026 08:34:17 -0400 Subject: [PATCH 1/4] manure anaerobic lagoon updates --- docs/scientific/quarto-scidoc/qmd/manure.qmd | 102 +++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/docs/scientific/quarto-scidoc/qmd/manure.qmd b/docs/scientific/quarto-scidoc/qmd/manure.qmd index f61a0d91d8..4f838d7ac6 100644 --- a/docs/scientific/quarto-scidoc/qmd/manure.qmd +++ b/docs/scientific/quarto-scidoc/qmd/manure.qmd @@ -910,13 +910,115 @@ import_table( ## Anaerobic Lagoon ### Introduction +Manure that is stored and managed at less than 5% dry matter is generally considered to b e liquid manure. Liquid manure is generated by either dilution of raw or slurry manure, generally through the addition of wash or flush water, or removal of a portion of manure solids through solid liquid separation methods (mechanical separator, settling basin, etc.) or anaerobic digestion. Liquid manure is generally stored in a type of large, outdoor storage structure called an anaerobic lagoon, or simply a lagoon. Anaerobic lagoons are not simply structures in which to store manure. Lagoons facilitate biological breakdown of organic materials, which reduces volatile solids content and odor, though also increases N mineralization and loss as ammonia, particularly if the lagoon is uncovered. Accordingly, +anaerobic lagoons have specific design and management requirements to facilitate biological treatment activity [@NRCS2017]. Some characteristics that separate an anaerobic lagoon from slurry or liquid manure storage are: + +* Greater storage capacity +* Less frequent and less complete emptying, resulting in longer solids/sludge retention time +* Storage of liquid rather than slurry manure +* Controlled volatile solids loading rate +* Lagoons are generally a lined or unlined in-ground basin, whereas slurry storage may be either in-ground or above-ground tanks or other structures + +**Implementation in RuFaS** + +In RuFaS, the underlying biological and gas emission methods are identical for slurry storages vs. anaerobic lagoons, as the biological process of organic matter breakdown is very similar between the two in reality. However, the differences in size, dilution, management, and other factors differ between the two in reality, leading to generally greater GHG emissions from lagoons compared to slurry storages. In the anaerobic lagoon submodule, accumulated manure in storage (i.e., held in the lagoon) is modeled on a daily timestep. Nutrient/mass gains from daily addition of manure (feces/urine, bedding, wash water) to storage, and precipitation volume entering storage, are tracked. Gas emissions are calculated +daily based on the quantity of nutrients in stored manure, manure temperature, storage type, use of a cover, and storage duration. Manure composition is then updated according to net nutrient losses/gains.Manure accumulates in storage until the end of the user-defned storage interval is reached. However, quantities of manure may additionally be removed from storage according to the user-defined manure application schedule. + +**Classes** + +```{python} +#| label: tbl-mn-AL-classes +#| tbl-cap: List of classes for anaerobic lagoon. +import_table( + "../resources/table_data/manure/tbl-mn-AL-classes.csv", + colalign = ["center", "center"] +) +``` ### Required User Inputs +```{python} +#| label: tbl-mn-AL-inputs +#| tbl-cap: Required inputs for the anaerobic lagoon section (`refreshed_manure_management.json`) +import_table( + "../resources/table_data/manure/tbl-mn-AL-inputs.csv", + colalign = ["left", "center", "left"] +) +``` + +**Other inputs** + +Instance(s) of ManureStream for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. ManureStream instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$/kgVS): + +* water +* `ammoniacal_nitrogen` +* nitrogen +* phosphorus +* potassium +* ash +* `manure_degradable_volatile_solids` +* `manure_non_degradable_volatile_solids` +* `bedding_non_degradable_volatile_solids` +* `total_solids` +* mass (equal to sum of water and total solids) +* `total volatile solids` (equal to sum of degradable and non-degradable volatile solids) +* volume +* `methane_production_potential` ### Expected Outputs +* ManureStream variables representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses +* `storage_methane`(kg): Daily emission of CH4 from accumulated manure in an anaerobic lagoon. +* `storage_ammonia`(kg): Daily emission of NH3 from accumulated manure in an anaerobic lagoon. +* `storage_nitrous_oxide`(kg): Daily emission of N2O from accumulated manure in an anaerobic lagoon. + ### Methodology +**Calculate manure temperature** +`_determine_outdoor_storage_temperature` + +Manure temperature is modeled using a cosine function whose parameters are derived from a least-squares fit of simulation-wide weather data. The air temperature amplitude is reduced using a damping factor to reflect the smaller annual variation in manure temperature relative to air. The phase shift (i.e., timing of peak temperature) is determined based on the least squares function and is adjusted by a fixed lag constant representing the delayed thermal response of manure temperature relative to air temperature. + +First, we determine the amplitude of the manure temperature function by applying the damping factor. + +:::{#eq-mn-sto-13} +[[**MN.STO.13**]]{.aside .content-visible when-format="html"} +$$ +\text{manure\_amplitude} = \text{amplitude} \times \text{MANURE\_DAMPING\_FACTOR} +$$ +::: + +**When:** + +* amplitude: modeled amplitude of the seasonal air temperature function, calculated from user-supplied, simulation-wide weather data +* MANURE_DAMPING_FACTOR: a fixed damping factor applied to the air temperature amplitude, set to 0.65 + +Second, we use this amplitude in the following function to determine modeled manure temperature (℃) each simulation day. Note the function includes a 'max' term to implement a lower temperature bound for manure temperature. + +:::{#eq-mn-sto-14 style="font-size:90%"} +[[**MN.STO.14**]]{.aside .content-visible when-format="html"} +$$ +\begin{aligned} +\text{manure\_temp} &= \text{max}( \\ +&\text{mean\_temp} \times \text{manure\_amplitude} \times \text{cos}(\frac{2\pi}{365}) \\ + &\times (\text{jday} - \text{phase\_shift} - \text{MANURE\_TEMPERATURE\_LAG})), \\ + & \text{min\_temp}) +\end{aligned} +$$ +::: + +**When:** + +* mean_temp (℃): simulation_wide mean air temperature +* manure_amplitude: amplitude of the manure temperature function, determined in @MN.STO.13 +* jday: Julian day of the simulation +* phase_shift: Julian date of peak air temperature in the simulation +* MANURE_TEMPERATURE_LAG (days): fixed lag constant representing the delayed thermal response of manure temperature relative to air temperature, set to 30. +* min_temp (℃): A fixed minimum temperature constant, dependent on the type of storage: +- Anaerobic lagoon: 1℃ +- Slurry storage outdoor: -20℃ + + + ### Received, stored, and emptied outputs ### Manure Composition Update From 3884c90af706dcc92579c51e63289d4756badc9a Mon Sep 17 00:00:00 2001 From: jadamchick <146877580+jadamchick@users.noreply.github.com> Date: Thu, 9 Jul 2026 09:54:28 -0400 Subject: [PATCH 2/4] finish anaerobic lagoon updates --- docs/scientific/quarto-scidoc/qmd/manure.qmd | 298 +- .../quarto-scidoc/qmd/manure.quarto_ipynb_1 | 3800 +++++++++++++++++ .../table_data/manure/tbl-mn-AL-calc.csv | 12 + .../table_data/manure/tbl-mn-AL-classes.csv | 2 + .../table_data/manure/tbl-mn-AL-inputs.csv | 6 + 5 files changed, 4109 insertions(+), 9 deletions(-) create mode 100644 docs/scientific/quarto-scidoc/qmd/manure.quarto_ipynb_1 create mode 100644 docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-calc.csv create mode 100644 docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-classes.csv create mode 100644 docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-inputs.csv diff --git a/docs/scientific/quarto-scidoc/qmd/manure.qmd b/docs/scientific/quarto-scidoc/qmd/manure.qmd index 4f838d7ac6..851bc929a9 100644 --- a/docs/scientific/quarto-scidoc/qmd/manure.qmd +++ b/docs/scientific/quarto-scidoc/qmd/manure.qmd @@ -910,7 +910,7 @@ import_table( ## Anaerobic Lagoon ### Introduction -Manure that is stored and managed at less than 5% dry matter is generally considered to b e liquid manure. Liquid manure is generated by either dilution of raw or slurry manure, generally through the addition of wash or flush water, or removal of a portion of manure solids through solid liquid separation methods (mechanical separator, settling basin, etc.) or anaerobic digestion. Liquid manure is generally stored in a type of large, outdoor storage structure called an anaerobic lagoon, or simply a lagoon. Anaerobic lagoons are not simply structures in which to store manure. Lagoons facilitate biological breakdown of organic materials, which reduces volatile solids content and odor, though also increases N mineralization and loss as ammonia, particularly if the lagoon is uncovered. Accordingly, +Manure that is stored and managed at less than 5% dry matter is generally considered to be liquid manure. Liquid manure is generated by either dilution of raw or slurry manure, generally through the addition of wash or flush water, or removal of a portion of manure solids through solid liquid separation methods (mechanical separator, settling basin, etc.) or anaerobic digestion. Liquid manure is generally stored in a type of large, outdoor storage structure called an anaerobic lagoon, or simply a lagoon. Anaerobic lagoons are not simply structures in which to store manure. Lagoons facilitate biological breakdown of organic materials, which reduces volatile solids content and odor, though also increases N mineralization and loss as ammonia, particularly if the lagoon is uncovered. Accordingly, anaerobic lagoons have specific design and management requirements to facilitate biological treatment activity [@NRCS2017]. Some characteristics that separate an anaerobic lagoon from slurry or liquid manure storage are: * Greater storage capacity @@ -921,8 +921,7 @@ anaerobic lagoons have specific design and management requirements to facilitate **Implementation in RuFaS** -In RuFaS, the underlying biological and gas emission methods are identical for slurry storages vs. anaerobic lagoons, as the biological process of organic matter breakdown is very similar between the two in reality. However, the differences in size, dilution, management, and other factors differ between the two in reality, leading to generally greater GHG emissions from lagoons compared to slurry storages. In the anaerobic lagoon submodule, accumulated manure in storage (i.e., held in the lagoon) is modeled on a daily timestep. Nutrient/mass gains from daily addition of manure (feces/urine, bedding, wash water) to storage, and precipitation volume entering storage, are tracked. Gas emissions are calculated -daily based on the quantity of nutrients in stored manure, manure temperature, storage type, use of a cover, and storage duration. Manure composition is then updated according to net nutrient losses/gains.Manure accumulates in storage until the end of the user-defned storage interval is reached. However, quantities of manure may additionally be removed from storage according to the user-defined manure application schedule. +In RuFaS, the underlying biological and gas emission methods are identical for slurry storages vs. anaerobic lagoons, as the biological process of organic matter breakdown is very similar between the two in reality. However, the differences in size, dilution, management, and other factors differ between the two in reality, leading to generally greater GHG emissions from lagoons compared to slurry storages. In the anaerobic lagoon submodule, accumulated manure in storage (i.e., held in the lagoon) is modeled on a daily timestep. Nutrient/mass gains from daily addition of manure (feces/urine, bedding, wash water) to storage, and precipitation volume entering storage, are tracked. Gas emissions are calculated daily based on the quantity of nutrients in stored manure, manure temperature, storage type, use of a cover, and storage duration. Manure composition is then updated according to net nutrient losses/gains. Manure accumulates in storage until the end of the user-defned storage interval is reached. However, quantities of manure may additionally be removed from storage according to the user-defined manure application schedule. **Classes** @@ -987,7 +986,7 @@ $$ $$ ::: -**When:** +*Where*: * amplitude: modeled amplitude of the seasonal air temperature function, calculated from user-supplied, simulation-wide weather data * MANURE_DAMPING_FACTOR: a fixed damping factor applied to the air temperature amplitude, set to 0.65 @@ -1006,24 +1005,305 @@ $$ $$ ::: -**When:** +*Where*: * mean_temp (℃): simulation_wide mean air temperature -* manure_amplitude: amplitude of the manure temperature function, determined in @MN.STO.13 -* jday: Julian day of the simulation -* phase_shift: Julian date of peak air temperature in the simulation +* manure_amplitude: amplitude of the manure temperature function, determined in [MN.STO.13]{#eq-mn-sto-13} +* jday: Julian day of the simulation [MN.MET.3]{#eq-mn-met-3}r temperature in the simulation * MANURE_TEMPERATURE_LAG (days): fixed lag constant representing the delayed thermal response of manure temperature relative to air temperature, set to 30. * min_temp (℃): A fixed minimum temperature constant, dependent on the type of storage: - Anaerobic lagoon: 1℃ - Slurry storage outdoor: -20℃ - +**Calculate storage surface area** +Exposed surface area (m$^2$) of the manure in storage is important in determining NH3-N emissions, as well as in determining precipitation volume added to storage if the storage is not covered or indoors. Wherever possible, this value should be provided by the user if modeling a real farm. If farm-specific information is unavailable or the farm being modeled is theoretical, the surface area should be estimated using tools like the USDA's Animal Waste Management Version 2.4.1. However, the RuFaS team recognizes that minimizing required inputs is desirable, though a fixed storage surface area is undesirable due to the variability in storage structure size and surface area. With this, an equation was developed that estimates storage surface area based on the following assumptions: + +* All manure excreted by animals on the farm enters the specified storage. At this time, the Manure module is not capable of assessing the proportion of manure excreted that is stored in the defined storages, therefore, all manure is assumed to be stored in the current storage, for the purposes of surface are estimation. +* The storage is 15 ft deep, with vertical walls. +* The storage receives 2500 mm of precipitation per year. +* Herd composition, and thus manure excretion, is fixed, and the number of animals in each life stage class is proportional to the number of mature cows. + +A constant value was derived to calculate estimated manure excretion based on the number of mature cows housed on the farm (a user input). The average number of animals in each class was determined according to default RuFaS animal life cycle inputs, and the total mass and volume of manure excreted by the herd was calculated. This resulted in an estimated daily herd-wide manure excretion of 168.6 kg or 0.118 m$^3$ of manure per mature cow housed on the farm. The resulting equation is used to calculate storage surface area (m$^2$). + +:::{#eq-mn-sto-1 style="font-size:90%"} +[[**MN.STO.1**]]{.aside .content-visible when-format="html"} +$$ +\begin{aligned} +&\text{surface\_area(m$^2$)} = \\ +&\frac{\text{cow\_num} \times \text{MANURE\_CONVERSION\_CONSTANT} \times \text{storage\_time} \times \text{FREEBOARD\_CONSTANT}}{\text{DEPTH\_CONSTANT} - \text{PRECIPITATION\_CONSTANT}} +\end{aligned} +$$ +::: + +*Where*: + +* cow_num: user-inputted number of mature cows housed on the farm +* MANURE_CONVERSION_CONSTANT: Factor to estimate m$^3$ of herd-wide manure produced per day per mature cow housed on teh farm, set to 0.1175 m$^3$. +* storage_time (days): user-inputted number of days that manure is stored in this storage for before being emptied +* FREEBOARD_CONSTANT: the volume allowance above the maximum volume of a slurry or liquid manure storage, set to 1.20 (20%). +* DEPTH_CONSTANT: value for slurry or liquid manure storage depth, set to 4.572 m (15 feet) +* PRECIPITATION_CONSTANT: the annual precipitation constant value, used only in determination of storage surface area if surface area is not provided by the user, set to 0.25m. + +**Calculate Precipitation Volume** + +The use of covers has implications for inclusion or exclusion of precipitation volume, as well as for N2O emissions. Four cover options exist for anaerobic lagoons: + +* Cover +* Cover and flare +* Crust +* No cover + +Detailed descriptions are outlined in the Slurry Storage section of this module. Precipitation volume for anaerobic lagoons that are uncovered or have a crust is calculated as follows: + +:::{#eq-mn-sto-2} +[[**MN.STO.2**]]{.aside .content-visible when-format="html"} +$$ +\text{Daily\_precipitation\_volume}(\text{m}^3) = \text{storage\_surface\_area} \times \text{precipitation} +$$ +::: + +*Where*: + +* Storage surface area: the user-defined or model-estimated storage surface area (m$^2$). +* Precipitation: the daily amount of precipitation (m). + +**Calculate Methane Emissions `_calculate_methane_emissions`** + +We use an adaptation of a method originally conceived by @Sommer2004 to calculate daily emissions of CH4 from degradable and non-degradable VS in anaerobic lagoons. These equations focus on the degradation of degradable and non-degradable volatile solids (VS) present in the manure. Factors like degradable and non-degradable VS (VSd and VSnd) content in storage, temperature, and location (indoor/outdoor) affect estimated CH4 emissions. We apply the original method from @Sommer2022 with updated dairy manure Arrhenius and activation energy values from @Elsgaard2016 and @Petersen2024. The same equation is utilized to calculate CH4 emissions from VSd and VSnd (from both manure and bedding sources), though the rate-correcting factor differs between the two. + +First, we must calculate the value of the Arrhenius exponent (`_calculate_arrhenius_exponent`). This value directly represents the responsiveness of biological reaction speed to temperature, and in the context of this empirical equation, may also be related to the methane potential of manure in storage and activity of the microbial population: + +:::{#eq-mn-met-2} +[[**MN.MET.2**]]{.aside .content-visible when-format="html"} +$$ +\text{Arrh\_exp g}(\text{CH}_4\text{ kg}^{-1}\text{VS h}^{-1}) = e^{\text{Ln(A)} - \frac{\text{ACTIVATION\_ENERGY}}{\text{Gas constant} \times \text{manure temperature}}} +$$ +::: + +*Where*: + +* Ln(A): The natural log of the Arrhenius parameter (NATURAL\_LOG\_ARRHENIUS\_CONSTANT constant), set at 30.6 based on @Petersen2024. This is an empirically-derived value determined based on observed manure CH4 emission values. +* `ACTIVATION_ENERGY`: the apparent activation energy of methanogenesis in cattle slurry (J/mol), set at 81,000 J/mol, based on @Elsgaard2016. +* Gas constant: ideal gas constant, set at 8.314 J K/mol. +* Manure temperature (K): temperature of manure in storage. + +Now we can calculate actual daily CH4 emission, based on the total quantity of VSd and VSnd in stored manure. The basic equation, used to calculate CH4 emissions for each VS fraction, is as follows: + +:::{#eq-mn-met-3} +[[**MN.MET.3**]]{.aside .content-visible when-format="html"} +$$ +\text{CH}_4 \text{ emission from VS}_{\text{d or nd}} (\text{kg d}^{-1}) = 24 \times \text{Arrh\_exp} \times \text{VS}_{\text{d or nd}} \times \text{rate\_factor} +$$ +::: + +*Where*: + +* 24: conversion factor from hours to day. +* `Arrh_exp`: Arrhenius parameter for CH4 emission rate (g CH4 kg$^{-1}$ VS h$^{-1}$), calculated in [MN.MET.2]{#eq-mn-met-2}. +* VSd or nd: The mass (kg) of VS~d~ or VS~nd~ in manure in slurry storage. +* `rate_factor`: The unitless rate-correcting factor, set to 1 for VSd and 0.01 for VSnd. + +The total daily CH4 emission is equal to the sum of emissions from the VS~d~ and VS~nd~ fractions. + +**Calculate Cover and Flare Emissions `_calculate_cover_and_flare_methane`** + + If the cover and flare option is selected, daily CH4 emission from an anaerobic lagoon is multiplied by a methane destruction efficiency value. The set value for methane destruction efficiency is 81%, based on a white paper commissioned by Dairy Management, Inc. on cover and flare efficiency [@wallaceDMI]. The updated daily CH4 emission (kg) from a cover and flare lagoon is as follows: + +:::{#eq-mn-met-4} +[[**MN.MET.4**]]{.aside .content-visible when-format="html"} +$$ +\text{Daily storage CH}_4 (\text{kg}) = \text{storage CH}_4 \times (1 - \text{METHANE\_DESTRUCTION\_EFFICIENCY}) +$$ +::: + +*Where*: + +* Storage CH4 (kg): total daily kg of CH4 emitted from stored manure, calculated in [MN.MET.3]{#eq-mn-met-3}. +* `METHANE_DESTRUCTION_EFFICIENCY`: coefficient for destruction of methane by the flare, set to 0.81. + +**Calculate Volatile Solids Losses `_apply_methane_emissions`** + +Daily emissions of CH4 and CO2 from anaerobic lagoons occur through microbial degradation of VS in manure, among other processes [@Petersen2024]. Therefore, gaseous emissions from slurry storage result in a decrease in the quantity of VS in stored slurry. VSd and VSnd remaining in manure are updated separately according to their respective loss via CH4 [MN.STO.4]{#eq-mn-sto-4}. Here, we assume a fixed 1:3 molar ratio of CH4-C to CO2-C emissions from stored slurry from @Petersen2024. This enables calculation of the total amount of C and thus VSd and VSnd lost through CH4 and CO2 emissions based on the quantity of CH4 emitted from each VS fraction. + +Given that C is assumed to be lost via CH4 and CO2 emissions in a ratio of 1:3, we assume for each C lost as CH4, 3 C are lost as CO2. CH4 is ~75% C by mass, thus for each kg of CH4 emitted, 0.7498 C are lost via CH4 and (3 x 0.7498) are lost from CO2, for a total of 2.992 kg C per kg of CH4 emitted. We assume manure VS are 45% C [@Petersen2024]; therefore, 2.9992 kg C / 45% C = 6.665 kg VS are lost per kg of CH4 emitted. + +:::{#eq-mn-sto-3} +[[**MN.STO.3**]]{.aside .content-visible when-format="html"} +$$ +\text{VS}_\text{d or nd}\text{loss (kg)} = \text{CH}_4\text{ emission from VS}_\text{d or nd} \times \text{VS\_TO\_METHANE\_LOSS\_RATIO} +$$ +::: + +*Where*: + +* CH4 emission from VSd or nd (kg): total daily kg of CH4 emitted from VSd or nd, calculated in [MN.MET.3]{#eq-mn-met-3} +* `VS_TO_METHANE_LOSS_RATIO`: default ratio of VS degraded per kg of CH4 emitted from slurry storage, set to 6.665 + +**Calculate manure retention at emptying `_emptying_fraction`** + +Anaerobic lagoons, through their settling action, accumulate and retain a bottom layer of solids often +referred to as "sludge". Additionally, depending on the frequency and extent of lagoon agitation, retention time of volatile solids in lagoons is typically explicitly managed to promote biological degradation of +solids. These factors contribute to the generally greater CH4 emissions per unit of volatile solids loaded into anaerobic lagoons compared to in-ground basin or tank manure storages. To directly capture the +greater retention of manure at emptying events, and to indirectly capture the greater biological activity +in anaerobic lagoons, a default manure retention factor is implemented in RuFaS. This factor dictates +the portion of manure which, when the storage time interval is reached, is retained in the lagoon. This +factor is applied evenly to all manure constituents (i.e., ManureStream variables). + +:::{#eq-mn-sto-15 style="font-size:90%"} +[[**MN.STO.15**]]{.aside .content-visible when-format="html"} +$$ +\text{retained\_manure}_i = \text{accumulated\_manure}_i \times \text{ANAEROBIC\_LAGOON\_MANURE\_RETENTION} +$$ +::: + +*Where:* + +* *i*: manure constituent *i* +* accumulated_manurei: quantity of manure constituent *i* present in the accumulate anaerobic lagoon manure when the storage time interval is reached +* ANAEROBIC_LAGOON_MANURE_RETENTION: constant fraction of the accumulated stored manure that is retained in the anaerobic lagoon when the storage time interval is reached, set to 0.10 + +**Calculate ammonia emissions `_calculate_ammonia_emissions`** + +Emission of NH3-N from anaerobic lagoons is determined using equations from @Rotz2006, which are also utilized in the IFSM [@Rotz2023]. Ammonia emissions are influenced by the quantity of TAN accumulated in manure storage, manure temperature, and manure storage surface area. First, we must derive the various parameters utilized in the calculation. + +First, we need to derive the value of the equilibrium coefficient Q for the NH3 gas in the air for a given concentration of TAN in stored manure using Henry’s law. Note that the concentration of NH3 in the free atmosphere is assumed to be zero. Since Q is a function of the Henry’s law coefficient Kh and a dissociation of ammonium coefficient Ka, we will calculate those first. + +*Henry’s law coefficient (Kh)*: + +:::{#eq-mn-amm-1} +[[**MN.AMM.1**]]{.aside .content-visible when-format="html"} +$$ +\text{K}_\text{h} = 10^{\frac{1478}{\text{manure temperature}}} - 1.69 +$$ +::: + +*Where*: + +* Manure temperature (K): temperature of manure storage. + +*Dissociation coefficient of ammonium (Ka)* + +:::{#eq-mn-amm-2} +[[**MN.AMM.2**]]{.aside .content-visible when-format="html"} +$$ +\text{K}_\text{h} = 1 + 10^{(0.09018 + \frac{2729.9}{\text{manure temperature}} - \text{pH})} +$$ +::: + +*Where*: + +* Manure temperature (K): temperature of stored manure. +* `DEFAULT_STORED_MANURE_PH`: the pH of the manure in storage, set to 7.5 by default + +*Equilibrium coefficient (Q)* + +:::{#eq-mn-amm-3} +[[**MN.AMM.3**]]{.aside .content-visible when-format="html"} +$$ +\text{Q} = \text{K}_\text{h} \times \text{K}_\text{a} +$$ +::: + +*Where*: + +* Kh: Henry’s law coefficient, calculated in [MN.AMM.1]{#eq-mn-amm-1}. +* Ka: Dissociation coefficient of ammonium, calculated in [MN.AMM.2]{#-eq-mn-amm-2}. + +Next, the rate of NH3-N loss in kg N/m$^2$ from stored manure is calculated: + +:::{#eq-mn-amm-5} +[[**MN.AMM.5**]]{.aside .content-visible when-format="html"} +$$ +\text{NH}_3\text{N emission rate} (\text{kg N/m}^2) = \frac{\text{TAN} \times \text{c} \times \text{y}}{\text{STORAGE\_RESISTANCE} \times \text{M} \times \text{Q}} +$$ +::: + +*Where*: + +* TAN (kg): Mass of ammoniacal N in stored manure +* c: time conversion constant (86400 s per d) +* y: manure density, set to 990 kg/m$^3$ +* `STORAGE_RESISTANCE`: A constant value representing the sum of resistance of NH3 transfer from solution to manure surface, and from manure surface to atmosphere, set at 23.1 s/m. +* M (kg): Total mass of stored manure +* Q: Equilibrium coefficient calculated in [MN.AMM.3]{#eq-mn-amm-3} + +Lastly, we calculate total NH3-N emissions (kg), based on the emission rate we just calculated and the manure storage surface area. + +:::{#eq-mn-amm-7} +[[**MN.AMM.7**]]{.aside .content-visible when-format="html"} +$$ +\text{NH}_3\text{ emissions (kg)} = \text{NH}_3\text{N\_rate} \times \text{surface\_area} +$$ +::: + +*Where*: + +* `NH3N_rate` (kg N/m$^2$): Rate of NH3-N loss (kg/m$^2$) from manure, calculated in [MN.AMM.5]{#eq-m-amm-5}. +* `surface_area` (m$^2$): Total manure storage surface area. + +**Calculate Nitrous Oxide Emissions `_calculate_nitrous_oxide_emissions`** + +N2O emissions (kg N2O-N) are based on the daily quantity of manure N loaded into the lagoon, and whether the lagoon is covered or uncovered. This method is based on @IPCC2019; however, it should be noted that the original @IPCC2006 method is based on daily manure N excretion by animals, whereas the current method is based on manure N loading into storage, which may reflect upstream N losses from NH3 emissions in housing, solid liquid separation, etc. The calculation is as follows: + +:::{#eq-mn-nit-1} +[[**MN.NIT.1**]]{.aside .content-visible when-format="html"} +$$ +\text{N}_2\text{O-N emissions (kg)} = \text{Received\_N} \times \text{N}_2\text{O factor} +$$ +::: + +*Where*: + +* `Received_N` (kg): Quantity of manure total N loaded into storage on the current day +* N2O factor: kg of N2O-N emitted per kg of manure N added per day to storage, based on the following logic: + * Cover type = crust OR cover; 0.005 + * Cover type = no cover; 0 (no N2O emissions) ### Received, stored, and emptied outputs +Manure storages in RuFaS report two types of outputs to OutputManager each day: received manure and stored manure. + +**Received Manure** + +Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values. + +**Stored Manure** + +Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In anaerobic lagoon processors, daily losses include CH4, NH3, and N2O emissions. The order of operations in updating accumulated manure values is: + +* Add received manure values to stored manure values +* Calculate gas emissions and total nutrient losses based on stored manure values +* Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. + +For anaerobic lagoons and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. + +**Emptied Manure** + +Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and Manure Stream attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage. + ### Manure Composition Update +**Received manure** +In anaerobic lagoon processors, the following nutrient sources are represented in received manure values: + +* `ManureStream` values, as received from the previous processor(s) in the manure management chain +* Precipitation water (kg), calculated in [MN.STO.2]{#eq-mn-sto-2} (if applicable), is added to the water value in `ManureStream` + +**Stored manure** + +Below is a summary of updates to ManureStream variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable. + +Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. Received manure simply refers to the manure being loaded into the manure storage each day. + +```{python} +#| label: tbl-mn-AL-calc +#| tbl-cap: Manure storage variable calculations. +import_table( + "../resources/table_data/manure/tbl-mn-SS-calc.csv", + colalign = ["left", "center", "left"] +) +``` diff --git a/docs/scientific/quarto-scidoc/qmd/manure.quarto_ipynb_1 b/docs/scientific/quarto-scidoc/qmd/manure.quarto_ipynb_1 new file mode 100644 index 0000000000..a23bb8095e --- /dev/null +++ b/docs/scientific/quarto-scidoc/qmd/manure.quarto_ipynb_1 @@ -0,0 +1,3800 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "6ff7a0ab", + "metadata": {}, + "source": [ + "![Manure module icon](../resources/images/man_icon.png){width=25%}\n", + "# Manure Module\n", + "" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "e29ac7c6", + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "sys.path.append(\"../scripts\")\n", + "from markdown_tables import import_table, display_md_tbl, read_tbl" + ] + }, + { + "cell_type": "markdown", + "id": "90da1b01", + "metadata": {}, + "source": [ + "## Introduction\n", + "\n", + "The responsibility of the manure module in RuFaS is to simulate the loss and/or gain of manure mass and nutrients on a daily timestep at each step of the manure management chain on a dairy farm. On the majority of farms, manure represents an important link in the cycling of nutrients through animals, land, crops, and back to animals. Therefore, modeling both greenhouse gas (GHG) emissions as well as non-GHG nutrient and losses is crucial in capturing nutrient flows through the whole-farm system. \n", + "\n", + "The manure module accomplishes its responsibilities by tracking a critical, core set of variables called `ManureStream` variables, which include key agronomic nutrients (N, P, K), carbon (e.g. total and volatile solids), water, ash, mass, and volume. The Manure Module receives manure excretion and bedding information from the animal module, then passes manure through the manure management chain, until manure is either applied to fields or exported. The specific steps of the manure management chain are user-defined, and the individual steps/options in manure management chains are referred to as `processors`. The exact chemical, physical, or other processes that occur at each step along the management chain depend on what type of processor the manure is being held in. For example, parlor cleaning processors, which represent removing manure from the milking parlor and holding areas, principally add water to manure but do not estimate GH emissions or other nutrient losses. A slurry storage outdoor processor (a type of manure storage), however, estimates daily methane CH4 and ammonia (NH3-N) losses, which are then reflected by reducing the quantity of nutrients remaining in the stored manure at the end of the day. \n", + "\n", + "### Structural setup of the Manure Module\n", + "\n", + "Processors in the Manure Module fall into four basic classes, with multiple types available within each class. The processor classes are intended to represent the common, primary steps in manure management. They include manure handling (which refers to the daily activities of cleaning and removing manure from facilities or managing it in place), storage, and manure treatment, such as anaerobic digestion or mechanical solid liquid separation. " + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "tbl-mn-process-type", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+-----------+--------------------------------------------------------------------------------------------------------+\n", + "| Classes | Types |\n", + "+:==========+:=======================================================================================================+\n", + "| Handler | Manual Scraping; Alley Scraper; Flus System; Parlor Cleaning |\n", + "+-----------+--------------------------------------------------------------------------------------------------------+\n", + "| Digester | Continuous Mix |\n", + "+-----------+--------------------------------------------------------------------------------------------------------+\n", + "| Separator | Screw Press; Rotary Press |\n", + "+-----------+--------------------------------------------------------------------------------------------------------+\n", + "| Storage | Composting; Open Lot; Bedded Pack; Slurry Storage Outdoor; Slurry Storage Underfloor; Anaerobic Lagoon |\n", + "+-----------+--------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-process-type\n", + "#| tbl-cap: Examples of processor types by class.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-process-type.csv\",\n", + " colalign = [\"left\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "04398285", + "metadata": {}, + "source": [ + "How manure moves between processors is based on defining the destination processor that any one processor should send its manure to, and the proportion(s) of manure from the originating processor that should go there. For example, if 50% of manure from a single pen is routed to storage A, and 50% to storage B, the manure handler processor assigned to that pen will have two destinations defined (storage A and storage B), with the proportion going to each defined as 0.50. By controlling destinations and proportions, the user is able to define aggregating (i.e., assigning manure from two separate processors to the same destination) and splitting (assigning manure from one processor to two or more locations) behavior. A visual example is below and illustrates the manure management chain without RuFaS-specific syntax. The next figure illustrates RuFaS-specific information (e.g. specific processor names, creation of manure streams in the animal module, etc.). Note that the splitting of manure generated from singular pens in the Animal Module is covered in the Animal to Manure Connection section. \n", + "\n", + "![Real world example of a simplistic manure management chain](../resources/images/man_flow_types.png){#fig-man-flow-types}\n", + "\n", + "![Manure management chain with RuFaS specific information reflected](../resources/images/man_flow_req_inputs.png){#fig-man-flow-req-inputs}\n", + "\n", + "### Overview of Required Inputs\n", + "\n", + "There are two general categories of input required from the user: \n", + "\n", + "1. Which processors are used and how do they work (processor-specific configurations) e.g., storage time length, use of a cover \n", + "2. Destination and proportion(s) allocated to destination(s) of manure passed from each processor \n", + "\n", + "Information on inputs required and options available for each individual processor are outlined in the individual processor documentation. \n", + "\n", + "For defining destinations and proportions, there are very few rules and restrictions on how manure can be moved between processors. The primary rule for defining processor destinations is that users cannot define loops, i.e., manure from a processor “downstream” in a manure management chain cannot return its manure to a processor “upstream”.\n", + "\n", + "::: {.callout-note}\n", + "The assignment of manure generated in the Animal Module (which also reflects the quantity of bedding used) to its destination in the Manure Module occurs in the Animal Module. See the Animal to Manure Connection section for more information. \n", + ":::\n", + "\n", + "### General Assumptions of the Manure Module\n", + "\n", + "* All manure is recovered unless otherwise specifically stated. For example, all manure excreted by animals is assumed to be captured by manure handlers, all manure in a manure storage is assumed to be completely removed when the storage is emptied (unless explicitly noted in the specific processor’s documentation), etc. \n", + "* Manure moves through the manure management chain once, and only once, per day. With this, values are reported on a daily timestep, and represent the current state at the end of the given day (e.g. CH4 emissions from this day, amount of N left in storage on this day, etc.). \n", + " * Storage processors include a user-defined “storage time”, during which manure accumulates in the storage until reaching the end of the time interval, at which point it is passed to the next processor or exported, if the storage comes last in the manure chain. The minimum storage time value is 1, thus manure cannot move through more than one storage per day. \n", + " * For processors without a storage time option, manure is assumed to move through the processor immediately. E.g., on a single day, excreted manure may move through a handler, continuous mix digester, separator, and into composting storage, with each processor reporting the quantity and composition of manure they either passed to the next processor or are holding in storage.\n", + "* The Manure Module adheres to the principle of mass balance, meaning, the quantity of manure nutrients remaining in manure is proportional to the quantity of the nutrient lost through biological or physical processes. The same is true for additions of mass/nutrients.\n", + " * One current exception to this is N loss. N losses are not currently reflected in the total mass of manure; this exception will be addressed and corrected in the near future. \n", + "\n", + "**Manure Storage Assumptions**\n", + "\n", + "* Received manure nutrients entering a storage are added to accumulated mass/nutrient quantities prior to calculating gas emissions each day.\n", + "* When the end of the storage’s user defined storage time is reached, the accumulated manure in storage is removed completely and entirely, and is passed to the next processor in the chain (e.g., a subsequent storage, field application, etc.).\n", + "* Emptying intervals (in days) are defined by the user in equal lengths at this time, e.g., manure storage can be emptied every 3 months (e.g. in April, July, October, January) but cannot be emptied in April, then 2 months later in June, and then 3 months later in September. However, timing of storage emptying (e.g. April and October emptying vs. May and November emptying) can be set according to the general simulation dates to simulate more realistic manure removal behavior.\n", + "\n", + "\n", + "## Manure Handler\n", + "\n", + "\n", + "### Introduction \n", + "\n", + "### Methodology\n", + "\n", + "#### Relevant Inputs\n", + "\n", + "#### Relevant Outputs\n", + "\n", + "### Manure Composition Update\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "## Solid Liquid Separators\n", + "\n", + "### Introduction\n", + "\n", + "A solid-liquid separator (SLS) is a specialized piece of equipment or system designed to separate larger, solid particles from the liquid component of manure. This type of system may be implemented for a variety of reasons, such as to improve ease of handling of manure liquid, improve the nutrient concentration in manure liquid, reduce storage volume required for manure lagoons or other storage systems, prevent solid accumulation in a covered manure storage, or reclaim manure solids for use as bedding or compost. \n", + " \n", + "The solid fraction of manure slurry is composed of fibers originating primarily from manure, but also from feed, bedding, and other environmental sources. Once mechanically separated, the moisture content of the solid fraction ranges from 70% to 90%, depending on the specific separator system used. To further reduce moisture content of the separated solids, an additional dewatering or drying step may be incorporated. Manure solids may be directly used or sold for animal bedding (after stabilization), composted, or land applied. \n", + " \n", + "After the manure solids are mechanically separated, the remaining liquid fraction is composed of small particles, water, and most of the nutrients present in the manure. Because the bulk of relevant nutrients (e.g., P, N, K) are mainly associated with the small particles which remain with the liquid fraction after separation occurs, separating the larger, less nutrient-dense particles out from the slurry liquid enriches the concentration of these nutrients in the liquid fraction. Solid-liquid separation also makes the manure slurry easier to pump, transport, and apply to fields, as large particles that may clog lines and sprayers are removed.\n", + "\n", + "**Implementation in RuFaS**\n", + "\n", + "In RuFaS, solid liquid separators currently represent mechanical, short retention time pieces of equipment. GHG emissions and other nutrient transformations from long-retention separators such as weeping walls or settling basins are not yet represented in the model. Because of this, the impact of these longer retention separators can only be approximated via modification of the separation efficiencies of the short retention time methods.\n", + "\n", + "Currently, SLS inputs are simply nutrient-specific separation efficiencies that reflect the proportion of a specific nutrient that is separated into the solids fraction. With this, essentially any type of mechanical manure separation system can be modeled, as long as effective separation efficiencies are known. Manure is assumed to be loaded, processed, and passed to the next processor within a single day. Default separation efficiencies exist for two common types of SLS - a screw press and a rotary screen. The separated manure solids and remaining liquid fraction are quantified and can be managed in separate, downstream manure management systems in RuFaS. However, separated solids cannot be directly recycled (i.e., utilized with the specific nutrient composition of those separated solids) “upstream” as bedding. \n", + "\n", + "**Classes**" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "tbl-mn-SLS-classes", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+-----------------------+-----------------+\n", + "| Handlers | Description |\n", + "+:=====================:+:===============:+\n", + "| Separator (Processor) | `separator.py` |\n", + "+-----------------------+-----------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-SLS-classes\n", + "#| tbl-cap: Classes for solid liquid separators.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-SLS-classes.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "2bc01383", + "metadata": {}, + "source": [ + "### Required User Inputs" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "tbl-mn-SLS-inputs", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Variable | Definition | Description |\n", + "+:===============================+:============================:+:================================================================================================================================================================================================================+\n", + "| Name | -- | Unique identifier of the specific separator configuration used |\n", + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| type | rotary screen or screw press | The type of solid liquid separator; selection of this input indicates which default separations efficiencies should be used, however, any and all separation efficiencies may also be overwritten by user input |\n", + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| separated_solids_dry_matter | -- | percent dry matter by mass of the manure solids post solid-liquid separation |\n", + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| total_solids_efficiency | -- | the proportion of manure total solids (TS) that are separated into the manure solids fraction by the separator |\n", + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| volatile_solids_efficiency | -- | the proportion of manure volatile solids (VS) that are separated into the manure solids fraction by the separator |\n", + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| nitrogen_efficiency | -- | the proportion of manure total nitrogen that is separated into the manure solids fraction by the separator |\n", + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| ammoniacal_nitrogen_efficiency | -- | the proportion of manure ammoniacal nitrogen that is separated into the manure solids fraction by the separator |\n", + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| phosphorus_efficiency | -- | the proportion of manure phosphorus that is separated into the manure solids fraction by the separator |\n", + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| potassium_efficiency | -- | the proportion of manure potassium that is separated into the manure solids fraction by the separator. |\n", + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| ash_efficiency | -- | the proportion of manure ash that is separated into the manure solids fraction by the separator |\n", + "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-SLS-inputs\n", + "#| tbl-cap: Classes for solid liquid separators.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-SLS-inputs.csv\",\n", + " colalign = [\"left\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "cfcdb61b", + "metadata": {}, + "source": [ + "**Other Inputs**\n", + "\n", + "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. `ManureStream` instances include the following variables (all in kg except for volume, m$^3$, and manure methane potential, m$^3$ / kgVS):\n", + "\n", + "* water \n", + "* `ammoniacal_nitrogen`\n", + "* nitrogen \n", + "* phosphorus\n", + "* potassium\n", + "* ash\n", + "* `manure_degradable_volatile_solids`\n", + "* `manure_non_degradable_volatile_solids`\n", + "* `bedding_non_degradable_volatile_solids`\n", + "* `total_solids`\n", + "* mass (equal to sum of water and total solids)\n", + "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", + "* volume\n", + "* `methane_production_potential`\n", + "\n", + "### Expected Outputs\n", + "\n", + "Two sets of `ManureStream` variables:\n", + "\n", + "* Separated solids (`SeparatedSolids`) \n", + "* Liquid fraction (`SeparatedLiquid`)\n", + "\n", + "### Methodology\n", + "\n", + "**Separate Nutrients**\n", + "\n", + "The equations below describe the general process for separating nutrients between liquid and solid fractions. The general equation for nutrient removal is as follows:\n", + "\n", + ":::{#eq-mn-sep-1}\n", + "[[**MN.SEP.1**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Separated solids nutrient content} = \\text{recevied manure nutrient} \\times \\text{separation efficiency}\n", + "$$\n", + ":::\n", + "\n", + ":::{#eq-mn-sep-2}\n", + "[[**MN.SEP.2**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Separated liquid nutrient content} = \\text{recevied manure nutrient} \\times (1 - \\text{separation efficiency})\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Received manure nutrient (kg): quantity of the specific nutrient in manure being loaded into the separator on a single day. \n", + "\n", + "Nutrients that are separated according to this pattern are presented in the table below. The default separation efficiencies, as well as minimum and maximum allowable separation efficiencies, for the rotary screen and screw press separators are also provided [@Hegg1981; @Mukhtar1999; @Varma2021]. Note that separate removal efficiencies for manure degradable and non-degradable VS or bedding non-degradable VS are not specifiable at this time; all VS fractions are assumed to be removed at the rate of total VS removal. " + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "tbl-mn-SLS-sep-eff-rotary", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+-----------------+------------+--------+--------+\n", + "| Variable | Default | Min | Max |\n", + "+:================+:==========:+:======:+:======:+\n", + "| Total solids | 0.35 | 0.25 | 0.4 |\n", + "+-----------------+------------+--------+--------+\n", + "| Nitrogen | 0.3 | 0.25 | 0.35 |\n", + "+-----------------+------------+--------+--------+\n", + "| Ammoniacal N | 0.15 | 0.1 | 0.2 |\n", + "+-----------------+------------+--------+--------+\n", + "| Phosphorus | 0.4 | 0.3 | 0.45 |\n", + "+-----------------+------------+--------+--------+\n", + "| Potassium | 0.15 | 0.05 | 0.2 |\n", + "+-----------------+------------+--------+--------+\n", + "| Ash | 0.2 | 0.05 | 0.3 |\n", + "+-----------------+------------+--------+--------+\n", + "| Volatile solids | 0.35 | 0.3 | 0.45 |\n", + "+-----------------+------------+--------+--------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-SLS-sep-eff-rotary\n", + "#| tbl-cap: Classes for solid liquid separators.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-SLS-sep-eff-rotary.csv\",\n", + " colalign = [\"left\", \"center\", \"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "tbl-mn-SLS-sep-eff-screw", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+-----------------+------------+--------+--------+\n", + "| Variable | Default | Min | Max |\n", + "+:================+:==========:+:======:+:======:+\n", + "| Total solids | 0.25 | 0.15 | 0.35 |\n", + "+-----------------+------------+--------+--------+\n", + "| Nitrogen | 0.3 | 0.2 | 0.35 |\n", + "+-----------------+------------+--------+--------+\n", + "| Ammoniacal N | 0.15 | 0.05 | 0.2 |\n", + "+-----------------+------------+--------+--------+\n", + "| Phosphorus | 0.2 | 0.1 | 0.35 |\n", + "+-----------------+------------+--------+--------+\n", + "| Potassium | 0.23 | 0.15 | 0.35 |\n", + "+-----------------+------------+--------+--------+\n", + "| Ash | 0.2 | 0.05 | 0.3 |\n", + "+-----------------+------------+--------+--------+\n", + "| Volatile solids | 0.25 | 0.2 | 0.4 |\n", + "+-----------------+------------+--------+--------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-SLS-sep-eff-screw\n", + "#| tbl-cap: Classes for solid liquid separators.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-SLS-sep-eff-screw.csv\",\n", + " colalign = [\"left\", \"center\", \"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "7b2e6730", + "metadata": {}, + "source": [ + "[@Jorgensen2009; @Fournel2019]\n", + "\n", + "**Calculate Total Mass and Water**\n", + "\n", + "*Separated solids fraction*\n", + "\n", + "Total mass of the separated solids fraction is determined by dividing the mass of separated solids by the user-inputted separated solids dry matter content. \n", + "\n", + ":::{#eq-mn-sep-3}\n", + "[[**MN.SEP.3**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Separated solids mass (kg)} = \\frac{\\text{Separated solids TS}}{\\text{Separated solids %DM}}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Separated solids TS (kg): the mass of solids in the separated manure solids fraction\n", + "* Separated solids %DM: user-inputted separated solids dry matter content\n", + " \n", + "The mass of water in the separated solids fraction can then be determined as follows, given the assumption that total mass is equal to the sum of solids plus water:\n", + "\n", + "$$\n", + "\\text{Separated solids water (kg)} = \\text{Separated solids mass} - \\text{Separated solids TS}\n", + "$$\n", + "\n", + "*Separated liquids fraction*\n", + "\n", + "The total mass of the separated liquid fraction, as well as the mass of water, are simply equal to the mass and water in manure loaded into the separator, minus the quantity of each respective value partitioned into the separated solids fraction{.mark}. \n", + "\n", + "$$\n", + "\\text{Separated solids mass (kg)} = \\text{Received mass} - \\text{Separated solids mass}\n", + "$$\n", + "\n", + "$$\n", + "\\text{Separated solids water (kg)} = \\text{Received water} - \\text{Separated solids water}\n", + "$$\n", + "\n", + "**Calculate Volume**\n", + "\n", + "Volume of each separated fraction is determined by dividing the mass of each fraction by its respective density:\n", + "\n", + ":::{#eq-mn-sep-4}\n", + "[[**MN.SEP.4**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Separated solids volume}(\\text{m}^3) = \\frac{\\text{Separated solids mass}}{\\text{SOLIDS\\_MANURE\\_DENSITY}}\n", + "$$\n", + ":::\n", + "\n", + ":::{#eq-mn-sep-5}\n", + "[[**MN.SEP.5**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Separated liquid volume}(\\text{m}^3) = \\frac{\\text{Separated liquid mass}}{\\text{LIQUID\\_MANURE\\_DENSITY}}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `SOLID_MANURE_DENSITY` (kg/m$^3$): The default density of solid manure, set to 700 kg/m$^3$\n", + "* `LIQUID_MANURE_DENSITY` (kg/m$^3$): The default density of liquid manure, set to 900 kg/m$^3$\n", + "\n", + "### Manure Composition Update\n", + "\n", + "Below is a summary of updates to `ManureStream` variables. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", + "\n", + "Equations in the table below are in the format of “Output/exiting value” = “Entering processor value” +/- XYZ. “Entering” refers to the manure entering the processor (i.e., being loaded into the digester) and output variables reflect the manure leaving the processor (i.e., digestate leaving the digester). The Calculation column describes how the variable is updated in the processor." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "tbl-mn-SLS-frac-calc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| Variable | Units | Calculation (Solids Fraction) | Calculation (Liquids Fraction) |\n", + "+:=======================================+:============:+:========================================================================+:=======================================================================+\n", + "| water | kg | Separated solids mass - Separated solids TS | Entering water - Separated solids water |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| total_ammoniacal _nitrogen | kg | Entering ammoniacal nitrogen x TAN removal efficiency | Entering ammoniacal nitrogen x (1 - TAN removal efficiency) |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| nitrogen | kg | Entering nitrogen x N removal efficiency | Entering nitrogen x (1 - N removal efficiency) |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| phosphorus | kg | Entering phosphorus x phosphorus removal efficiency | Entering phosphorus x (1 - phosphorus removal efficiency) |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| potassium | kg | Entering potassium x potassium removal efficiency | Entering potassium x (1 - potassium removal efficiency) |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| ash | kg | Entering ash x potassium removal efficiency | Entering ash x (1 - potassium removal efficiency) |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| manure_degradable_volatile_solids | -- | Entering manure VSd x VS removal efficiency x degradable_VS_frac | Entering VSd x (1 - VS removal efficiency) x (1 - degradable_VS_frac) |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| manure_non_degradable_volatile_solids | -- | Entering manure VSnd x VS removal efficiency x (1 - degradable_VS_frac) | Entering VSnd x (1 - VS removal efficiency) x (1 - degradable_VS_frac) |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| bedding_non_degradable_volatile_solids | -- | Entering manure VSnd x VS removal efficiency x (1 - degradable_VS_frac) | Entering VSnd x (1 - VS removal efficiency) x (1 - degradable_VS_frac) |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| total_solids | kg | Entering TS x TS removal efficiency | Entering TS x (1 - TS removal efficiency) |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", + "| volume | $\\text{m}^3$ | $\\frac{\\text{Separated solids mass}}{\\text{SOLID\\_MANURE\\_DENSITY}}$ | $\\frac{\\text{Separated liquid mass}}{\\text{LIQUID\\_MANURE\\_DENSITY}}$ |\n", + "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-SLS-frac-calc\n", + "#| tbl-cap: Solids and liquid fraction calculations for separated manure components.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-SLS-frac-calc.csv\",\n", + " colalign = [\"left\", \"center\", \"left\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "589fc055", + "metadata": {}, + "source": [ + "## Anaerobic Digestion\n", + "\n", + "### Introduction\n", + "\n", + "Anaerobic digestion is a process where dairy cow manure is treated in an oxygen-free (anaerobic) environment to produce biogas, containing approximately 60% CH4, 40% CO2, which can be utilized as an on-farm or exported energy source. Additional benefits of anaerobic digestion include reduced manure odor, improved stability and quality of manure for fertilization purposes, and reductions in nutrient losses via undesirable greenhouse gas emissions.\n", + "\n", + "Manure can undergo anaerobic digestion in a specialized anaerobic digestion chamber/system, usually referred to simply as a ‘digester’, or can occur in other manure storage systems that create anaerobic conditions, such as anaerobic lagoons. \n", + "\n", + "**Implementation in RuFaS**\n", + "\n", + "The anaerobic digestion submodule in RuFaS currently represents anaerobic digestion within an enclosed, mechanical digester system. The following assumptions are made in the RuFaS anaerobic digestion submodule:\n", + "\n", + "* The digester represented is assumed to be a mesophilic, continuous stirred-tank reactor (CSTR).\n", + "* Manure is loaded into the digester and removed from the digester once daily.\n", + "* The digester is fully functional at the start of the simulation, i.e., the digester is full of substrate and the microbial population has stabilized.\n", + "* Residence time of manure in the digester is not modeled. As a result, the composition of effluent exiting the digester each day is identical to the influent composition, with the exception of nutrient losses or transformations that occur in the digester.\n", + "* At this time, CH4 generation and volatile solids destruction is based strictly on the quantity of manure volatile solids loaded; other factors are not considered at this time.\n", + "\n", + "\n", + "The anaerobic submodule has two primary functions in RuFaS: \n", + "\n", + "* Estimate daily methane production (kg/d) based on the daily mass of manure volatile solids (VS) loaded into the digester.\n", + " * VS loading is dependent on the number and type of animals contributing manure to the digester, the diet of the animals, quantity and type of bedding, and any upstream manure handling processes, e.g., solid liquid separation, water addition, etc.\n", + "* Update the composition of the liquid manure effluent leaving the digester, which enters the anaerobic lagoon. \n", + " * Reflecting VS loss in effluent exiting the digester is essential to capture the reduction in methane emissions from digestate compared to undigested, liquid manure, as well as changes in proportion of inorganic (ammoniacal) to total nitrogen.\n", + "\n", + "**Classes**" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "tbl-mn-AD-classes", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Digester | Description |\n", + "+:==================+:================================================================================================================================================================================================================================================+\n", + "| AnaerobicDigester | anaerobic_digester.py inherits behavior from the base class, Digester; however, at this time, there is no functionality included in the base Digester class. Therefore all methods are contained within the anaerobic_digestion.py child class. |\n", + "+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-AD-classes\n", + "#| tbl-cap: List of classes for anaerobic digesters.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-AD-classes.csv\",\n", + " colalign = [\"left\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "e6966093", + "metadata": {}, + "source": [ + "### Required User Inputs" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "tbl-mn-AD-inputs", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+-------------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Variable | Units | Description |\n", + "+:==========================================+:========:+:============================================================================================================================================================================================+\n", + "| name | -- | Unique identifier of the specific anaerobic digester configuration used |\n", + "+-------------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| hydraulic_retention_time | days | Number of days manure spends in the anaerobic digester. Note that this variable is not utilized directly by the module but is utilized by the Economics Emissions and Energy module. |\n", + "+-------------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| anaerobic_digestion_temperature_set_point | ℃ | Temperature set point for the anaerobic digestion. This input is utilized in the conversion of CH$_4$ and CO$_2$ generation volume to mass; it does not directly influence CH$_4$ emissions |\n", + "+-------------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| biogas_leakage_fraction | none | Fraction of biogas generated in the anaerobic digester that escapes to the atmosphere through unintended leakage and is not collected by the gas capture system |\n", + "+-------------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-AD-inputs\n", + "#| tbl-cap: Required inputs for Anaerobic Digestion.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-AD-inputs.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "562793a9", + "metadata": {}, + "source": [ + "**Other Inputs**\n", + "\n", + "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. ManureStream instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$ / kgVS):\n", + "\n", + "* water\n", + "* `ammoniacal_nitrogen`\n", + "* nitrogen\n", + "* phosphorus\n", + "* potassium\n", + "* ash\n", + "* `manure_degradable_volatile_solids`\n", + "* `manure_non_degradable_volatile_solids`\n", + "* `bedding_non_degradable_volatile_solids`\n", + "* `total_solids`\n", + "* mass (equal to sum of water and total solids)\n", + "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", + "* volume\n", + "* `methane_production_potential`\n", + "\n", + "### Expected Outputs\n", + "\n", + "* `captured_biogas_volume` (m$^3$): Captured biogas (assumed to be composed of 40% CO2, 60% CH4) volume after accounting for leakage on the current day\n", + "* `captured_methane_volume` (m$^3$): Captured methane volume on the current day, after accounting for leakage\n", + "* `methane_leakage_mass` (kg): Mass of CH4 lost to the atmosphere through unintended leakage on the current day. This variable is expressed as mass as opposed to volume as CH4 emissions are reported in kg in the rest of the manure module and other RuFaS modules\n", + "\n", + "### Methodology\n", + "\n", + "**Calculate Daily Methane Generation**\n", + "\n", + "Calculates volume of methane (CH4) generated from a CSTR digester. Methane generation is estimated from the daily loading of manure volatile solids (VS). Degradable (VSd) and non-degradable (VSnd) VS are tracked separately but the ratio of VSd : VSnd does not affect CH4 estimation; only the total quantity of VS is considered. To perform this calculation, we make several assumptions/simplifications: \n", + "\n", + "* The ratio of chemical oxygen demand (COD): VS in dairy manure is assumed to be 1.2 to 1. 1 kg of COD can generate 0.4 kg of methane. Therefore, 1 kg VS reduction/degradation in the anaerobic digester = 1.2 kg COD = 480 L CH4. In other words, each kg VS of reduced is assumed to generate 480 L of CH4. \n", + "* A CSTR reduces manure VS content by approximately 50%. This is a generalization across CSTR digesters of varying efficiencies, based on expert opinion from W. Liao (MSU) and A. Leytem (USDA-ARS). \n", + "* Considering that 480 L of CH4 are generated per kg of VS destroyed, and approximately 50% of VS loaded are anticipated to be destroyed, we estimate CH4 generation by assuming 240 L CH4 are generated per VS kg loaded into the digester; this is also in alignment with the @IPCC2019 Tier II manure CH4 B$_0$ value.\n", + "* Lastly, the volumetric ratio of CH4 to CO2 generation in the CSTR is assumed to be 6:4 (e.g. generation of 60% CH4, 40% CO2biogas) based on commonly cited digester performance metrics (e.g., EPA, [@Fernandez2015]). The total quantity of VS destroyed in anaerobic digestion is then assumed to be equal to the quantity of CH4 and CO2 generated in the digester. This assumption is made due to a lack of data on destruction of degradable vs. non-degradable VS in anaerobic digestion.\n", + "\n", + ":::{#eq-mn-adg-1}\n", + "[[**MN.ADG.1**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{generated\\_methane\\_volume}(\\text{m}^3) &= \\text{ACHIEVABLE\\_METHANE\\_EMISSIONS} \\\\[8pt]\n", + "&\\qquad \\times \\text{total\\_volatile\\_solids (kg)}\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `ACHIEVABLE_METHANE_EMISSION` = achievable methane generation constant (m$^3$ CH4 per kg VS loaded into digester); Constant Value: 0.24 m$^3$ CH4/kg VS\n", + "* `total_volatile_solids` = daily mass (kg) of manure total volatile solids loaded into the digester, received from `ManureStream(s)`\n", + "\n", + "Lastly, we need to convert daily CH4 volume (`generated_methane_volume`) to CH4 mass. First we calculate CH4 density according to the user-provided digestion setpoint temperature, then we apply the density value to the volume of CH4 generated.\n", + "\n", + ":::{#eq-mn-adg-2 style=\"font-size:90%\"}\n", + "[[**MN.ADG.2**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{methane\\_density} = \\frac{\\text{METHANE\\_MOLAR\\_MASS}}{\\text{IDEAL\\_GAS\\_LAW\\_R} \\times (\\text{temperature\\_set\\_point} + \\text{CELSIUS\\_TO\\_KELVIN})}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `METHANE_MOLAR_MASS` (16.04 g/mol): molar mass of CH4\n", + "* `IDEAL_GAS_LAW_R` (0.0821 L atm/mol K): ideal gas law R value \n", + "* `temperature_set_point` (℃): user-provided digestion set point temperature\n", + "* `CELSIUS_TO_KELVIN` (273.15): value to convert ℃ temperature values to K\n", + "\n", + ":::{#eq-mn-adg-3}\n", + "[[**MN.ADG.3**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{generated\\_methane\\_mass}(\\text{kg}) = \\text{generated\\_methane\\_volume} \\times \\text{methane\\_density}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `generated_methane_volume` ($\\text{m}^3$): volume of CH4 generated in the digester on a single day, calculated in [MN.ADG.1]{#eq-mn-adg-1}.\n", + "\n", + "**Calculate Destroyed Volatile Solids `_destroy_volatile_solids`**\n", + "\n", + "Microbes convert (destroy) VS during anaerobic digestion and produce biogas containing primarily CH4 and CO2. Therefore, the quantity of VS is assumed to be equal to the mass of CH4 and CO2 generated. In this section, we calculate the total mass of CO2 and CH4 generated, which is used later to update the degradable and non-degradable VS values of the `ManureStream` instance passed to the next processor.\n", + "\n", + "First, we calculate the density of CO2 based on the user-provided digestion setpoint temperature.\n", + "\n", + ":::{#eq-mn-adg-4 style=\"font-size:90%\"}\n", + "[[**MN.ADG.4**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{carbon\\_dioxide\\_density} = \\frac{\\text{CARBON\\_DIOXIDE\\_MOLAR\\_MASS}}{\\text{IDEAL\\_GAS\\_LAW\\_R} \\times (\\text{temperature\\_set\\_point} + \\text{CELSIUS\\_TO\\_KELVIN})}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `CARBON_DIOXIDE_MOLAR_MASS` (44.01 g/mol): molar mass of CO2\n", + "* `IDEAL_GAS_LAW_R` (0.0821 L atm/mol K): ideal gas law R value \n", + "* `temperature_set_point` (℃): user-provided digestion set point temperature\n", + "* `CELSIUS_TO_KELVIN` (273.15): value to convert ℃ temperature values to K\n", + "\n", + "Second, we determine the quantity of CO2 volume and mass generated, assuming digester biogas contains a 60:40 volumetric ratio of CH4 to CO2. \n", + "\n", + ":::{#eq-mn-adg-5}\n", + "[[**MN.ADG.5**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{generated\\_carbon\\_dioxide} &= \\text{generated\\_methane\\_volume} \\\\[8pt]\n", + "&\\qquad \\times \\text{CARBON\\_DIOXIDE\\_TO\\_METHANE\\_RATIO} \\\\[8pt]\n", + "&\\qquad \\times \\text{CARBON\\_DIOXIDE\\_DENSITY}\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `CARBON_DIOXIDE_MOLAR_MASS` (44.01 g/mol): molar mass of CO2; Constant Value: = 4/6 L/L (0.667) \n", + "* `carbon_dioxide_density` (kg per m$^3$) = ideal gas law value to convert CO2 from mass to volume\n", + "\n", + "Third, we calculate the total destruction of total VS. \n", + "\n", + ":::{#eq-mn-adg-6 style=\"font-size:90%\"}\n", + "[[**MN.ADG.6**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{total\\_volatile\\_solids\\_destruction} = \\text{generated\\_methane\\_mass} + \\text{generated\\_carbon\\_dioxide\\_mass}\n", + "$$\n", + ":::\n", + "\n", + "We then utilize the value of `total_volatile_solids_destruction` (kg) to update VSd, manure VSnd, and bedding VSnd. As mentioned above, the total quantity of VS destroyed is partitioned between the three VS fractions according to the proportion of each fraction in manure entering the digester. E.g., if manure entering contained 60% VSd, 10% manure VSnd, and 30% bedding VSnd, 60% of destroyed VS will be subtracted from VSd, 10% from manure VSnd, and 30% from bedding VSnd.\n", + "\n", + "To do this, we calculate the ratio of VSd to VS (`degradable_volatile_solids_frac`) and manure VSd to VS and apply these fractions to the `total_volatile_solids_destruction` value to determine the updated VS fraction values.\n", + "\n", + ":::{#eq-mn-adg-7}\n", + "[[**MN.ADG.7**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{degradable\\_VS\\_frac} = \\frac{\\text{degradable\\_VS}}{\\text{total\\_VS}}\n", + "$$\n", + ":::\n", + "\n", + ":::{#eq-mn-adg-8}\n", + "[[**MN.ADG.8**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{manure\\_non\\_degradable\\_VS\\_frac} = \\frac{\\text{manure\\_non\\_degradable\\_VS}}{\\text{total\\_VS}}\n", + "$$\n", + ":::\n", + "\n", + ":::{#eq-mn-adg-9}\n", + "[[**MN.ADG.9**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{degradable\\_VS} = \\text{degradable\\_VS} - (\\text{total\\_VS\\_destruction} \\times \\text{degradable\\_VS\\_frac})\n", + "$$\n", + ":::\n", + "\n", + ":::{#eq-mn-adg-10 style=\"font-size:90%\"}\n", + "[[**MN.ADG.10**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{manure\\_non\\_degradable\\_VS} &= \\text{manure\\_non\\_degradable\\_VS} \\\\[8pt]\n", + "&\\qquad - (\\text{total\\_VS\\_destruction} \\times \\text{manure\\_non\\_degradable\\_VS\\_frac})\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + ":::{#eq-mn-adg-11 style=\"font-size:90%\"}\n", + "[[**MN.ADG.11**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{bedding\\_non\\_degradable\\_VS} &= \\text{bedding\\_non\\_degradable\\_VS} - \\text{total\\_VS\\_destruction} \\\\[8pt]\n", + "&\\qquad \\times (1 - \\text{manure\\_non\\_degradable\\_VS\\_frac} + \\text{degradable\\_VS\\_frac})\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "**Calculate Methane Leakage `_calculate_methane_leakage`**\n", + "\n", + "Calculates the volume of CH4 generated that is lost to the atmosphere via leakage. The leakage fraction is currently a user input with a default value of 1\\%, which represents a conservative leakage rate. Leakage is largely dependent on the age and type of digester and should ideally be provided by the user for specificity.\n", + "\n", + ":::{#eq-mn-adg-12}\n", + "[[**MN.ADG.12**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{methane\\_leakage\\_volume}(\\text{m}^3) = \\text{generated\\_methane\\_volume} \\times \\text{biogas\\_leakage\\_fraction}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `generated_methane_volume` (m$^3$): volume of CH4 generated in the digester on a single day, calculated in [MN.ADG.1]{#eq-mn-adg-1}\n", + "* `biogas_leakage_fraction` (%): fraction of biogas generated in the anaerobic digester that escapes to the atmosphere through unintended leakage; Default Value: 0.01 (1%)\n", + "\n", + "**Update Digestor Effluent Composition `_report_anaerobic_digestor_outputs`**\n", + "\n", + "The calculations below are some additional prerequisites to generating anaerobic digestion-specific outputs.\n", + "\n", + "The equation below is used to calculate the quantity of net, captured gas according to the quantity of biogas leakage. \n", + "\n", + ":::{#eq-mn-adg-13 style=\"font-size:90%\"}\n", + "[[**MN.ADG.13**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{captured\\_methane\\_volume}(\\text{m}^3) = \\text{generated\\_methane\\_volume} - \\text{methane\\_leakage\\_volume}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `generated_methane_volume` (m$^3$): total volume of CH4 generated in the digester on a specific day\n", + "* `methane_leakage_volume` (m$^3$): the volume of CH4 generated that is lost to the atmosphere via leakage\n", + " \n", + "The equation below is used to calculate the updated volume of manure in the digester, accounting for the volume of destroyed VS.\n", + "\n", + ":::{#eq-mn-adg-14 style=\"font-size:90%\"}\n", + "[[**MN.ADG.14**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{updated\\_volume}(\\text{m}^3) = \\text{incoming\\_volume} - \\frac{\\text{total\\_volatile\\_solids\\_destruction}}{\\text{ManureConstants.SLURRY\\_MANURE\\_DENSITY}}\n", + "$$\n", + ":::\n", + "\n", + "Microbial processes during anaerobic digestion are known to increase the proportion/mass of total ammoniacal N (TAN), though the total mass of N is generally not different pre and post-digestion [@AguirreVillegas2019]. To reflect this, the proportion of TAN in manure in the digester is multiplied by a fixed factor. The factor (`TAN_INCREASE_FACTOR`, 1.60) was chosen based on a target of ~50% loss of total N via NH3-N emissions from a subsequent digestate lagoon, as reported by the USDA GHG estimation guidelines for uncovered digestate storage [@Hanson2024].\n", + "\n", + ":::{#eq-mn-adg-15 style=\"font-size:80%\"}\n", + "[[**MN.ADG.15**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{updated\\_ammoniacal\\_nitrogen (kg)} = min(\\text{ammoniacal\\_nitrogen} \\times \\text{TAN\\_INCREASE\\_FACTOR},\\text{nitrogen})\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + " \n", + "* `ammoniacal_nitrogen` (kg): the mass of ammoniacal N in manure loaded into the digester on a single day\n", + "* `TAN_INCREASE_FACTOR`: factor by which total ammoniacal nitrogen content is increased by the anaerobic digestion process, set to 1.60\n", + "* Note that the “min” notation prevents manure TAN from exceeding manure total N\n", + "\n", + "\n", + "### Manure Composition Update\n", + "\n", + "Below is a summary of updates to `ManureStream` variables. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", + "\n", + "Equations in the table below are in the format of “Output/exiting value” = “Entering processor value” +/- XYZ. “Entering” refers to the manure entering the processor (i.e., being loaded into the digester) and output variables reflect the manure leaving the processor (i.e., digestate leaving the digester). The Calculation column describes how the variable is updated in the processor." + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "tbl-mn-AD-calc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| Variable | Units | Calculation |\n", + "+:=======================================+:========:+:==========================================================================================================================+\n", + "| water | kg | Entering water |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| total_ammoniacal_nitrogen | kg | min(entering ammoniacal_nitrogen x TAN_INCREASE_FACTOR, nitrogen |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| nitrogen | kg | Entering nitrogen |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| phosphorus | kg | Entering phosphorus |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| potassium | kg | Entering potassium |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| ash | kg | Entering ash |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| degradable_volatile_solids | -- | Entering degradable_volatile_solids - total_VS_destruction x degradable_VS_frac |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| manure_non_degradable_volatile_solids | -- | Entering non_degradable_volatile_solids - total_VS_destruction x manure_non_degradable_VS_frac |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| bedding_non_degradable_volatile_solids | -- | Entering non_degradable_volatile_solids - total_VS_destruction x (1 - degradable_VS_frac - manure_non_degradable_VS_frac) |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| total\\_solids | kg | Entering total_solids - total_VS_destruction |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", + "| volume | m$^3$ | Entering volume - $\\frac{\\text{total\\_VS\\_destruction}}{\\text{ManureConstants.SLURRY\\_MANURE\\_DENSITY}}$ |\n", + "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-AD-calc\n", + "#| tbl-cap: Calculated anaerobic digestion outputs.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-AD-calc.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "658b40da", + "metadata": {}, + "source": [ + "## Slurry Storage\n", + "\n", + "### Introduction\n", + "\n", + "Manure that is stored and managed at ~7 to 12% dry matter is generally considered to be “slurry” manure. Several common options exist for storing manure at this %DM range. Slurry may be stored in underfloor pits, where manure is deposited directly into the pit through slatted floors, or is moved to an underfloor storage via scrapers or other manure handling systems. Manure may also be transported to outdoor storage tanks or pits/basins, which may be covered or uncovered.\n", + "\n", + "Compared to anaerobic lagoons, slurry storages are typically of a smaller capacity, and do not result in controlled treatment (e.g., reduction of odor, N content reduction, organic matter decomposition) of manure. Slurry storages are typically emptied more frequently than liquid manure storages like anaerobic lagoons and contain more concentrated manure. In general, the biological processes in slurry storages and anaerobic lagoons are similar: microbes break down manure carbohydrates and proteins, resulting in CO2, CH4, and N2O emissions, and mineralization of organic to inorganic N, and N losses occur through NH3 volatilization at the manure surface. However, management of these two types of liquid manure storages differs as described above, which results in differences in emissions and nutrient losses.\n", + "\n", + "**Implementation in RuFaS**\n", + "\n", + "There are two options for slurry storage in RuFaS, slurry storage outdoor and slurry storage underfloor, which function almost identically. The key differences between the two methods are presented in @tbl-mn-SS-options Because the two methods are highly similar, both are covered in this document." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "tbl-mn-SS-options", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+---------------------+-------------------------------------+------------------------------------------------------------------------+\n", + "| | Slurry Storage Underfloor | Slurry Storage Outdoor |\n", + "+:====================+:====================================+:=======================================================================+\n", + "| Temperature | Barn temperature method | Modeled air temperature method |\n", + "+---------------------+-------------------------------------+------------------------------------------------------------------------+\n", + "| Cover options | Only “no cover” permitted | Cover, cover and flare, crust, or no cover |\n", + "+---------------------+-------------------------------------+------------------------------------------------------------------------+\n", + "| Precipitationvolume | Precipitation excluded from storage | Precipitation excluded or included depending on cover option selection |\n", + "+---------------------+-------------------------------------+------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-SS-options\n", + "#| tbl-cap: Key differences for two options for slurry storage\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-SS-options.csv\",\n", + " colalign = [\"left\", \"left\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "e93b2266", + "metadata": {}, + "source": [ + "In the slurry storage submodules, accumulated manure in storage is modeled on a daily timestep. Nutrient/mass gains from daily addition of manure (feces/urine, bedding, wash water) to storage, and precipitation volume entering storage, are tracked. Gas emissions are calculated daily based on the quantity of nutrients in stored manure, manure temperature, storage type, use of a cover, and storage duration. Manure composition is then updated according to net nutrient losses/gains. Manure accumulates in storage until the end of the user-defined storage interval is reached. However, quantities of manure may additionally be removed from storage according to the user-defined manure application schedule. Note that at this time, water and nutrients from surface runoff, and water evaporation from storage manure, are not captured in slurry storage submodules.\n", + "\n", + "**Classes**\n", + "\n", + "Note that both slurry storage methods inherit some behavior from the base class, Storage. Because the two methods are highly similar, the content below is representative of both types of slurry storage, with specific differences between the two noted explicitly (@tbl-mn-SS-options)." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "tbl-mn-SS-classes", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------------------+------------------------------+\n", + "| Digester | Description |\n", + "+:================================:+:============================:+\n", + "| SlurryStorageOutdoor(Storage) | slurry_storage_outdoor.py |\n", + "+----------------------------------+------------------------------+\n", + "| SlurryStorageUnderfloor(Storage) | slurry_storage_underfloor.py |\n", + "+----------------------------------+------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-SS-classes\n", + "#| tbl-cap: Classes for slurry storage\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-SS-classes.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "936c039a", + "metadata": {}, + "source": [ + "### Required User Inputs" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "tbl-mn-SS-inputs", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Variable | Units | Description |\n", + "+:====================+:========:+:==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+\n", + "| Name | -- | Unique identifier of the specific slurry storage configuration used. |\n", + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Capacity | m$^3$ | The volumetric capacity of the slurry storage, in m$^3$. Note that this variable is a placeholder at this time, and does not influence model calculations. |\n", + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Cover | -- | Default value is “no cover” for slurry storage underfloor, as these storages do not generally have a synthetic cover, and typically receive too much surface disturbance to form a crust. Note that precipitation is always excluded from slurry storage underfloor given they are assumed to be completely covered or indoors. Default value for slurry storage outdoor is “no cover”. Cover (a synthetic, precipitation-excluding cover, or an enclosed tank) or crust (a naturally-forming crust over >50% of the stored manure surface) are also options. |\n", + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Surface_area | m$^3$ | The surface area of the slurry storage. If not provided by the user, surface area is calculated based on the number of mature cows in the herd; see Calculate Surface Area section below. |\n", + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Storage_time_period | days | The number of days that manure is stored between emptying events. At the end of this interval, the manure storage is emptied completely. |\n", + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-SS-inputs\n", + "#| tbl-cap: Required inputs for the slurry storage section\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-SS-inputs.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "7f460782", + "metadata": {}, + "source": [ + "**Other inputs**\n", + "\n", + "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. ManureStream instances include the following variables (all in kg except for volume, m$^3$, and manure methane production potential, m$^3$/kgVS):\n", + "\n", + "* water \n", + "* `ammoniacal_nitrogen`\n", + "* nitrogen\n", + "* phosphorus\n", + "* potassium\n", + "* ash\n", + "* `manure_degradable_volatile_solids`\n", + "* `manure_non_degradable_volatile_solids`\n", + "* `bedding_non_degradable_volatile_solids`\n", + "* `total_solids`\n", + "* mass (equal to sum of water and total solids)\n", + "* `total volatile solids` (equal to sum of degradable and non-degradable volatile solids)\n", + "* volume\n", + "* `methane_production_potential`\n", + "\n", + "### Expected Outputs\n", + "\n", + "* `ManureStream` variables representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses\n", + "* `storage_methane` (kg): Daily emission of CH4 from accumulated manure in slurry storage\n", + "* `storage_ammonia` (kg): Daily emission of NH3 from accumulated manure in slurry storage\n", + "* `storage_nitrous_oxide` (kg): Daily emission of N2O from accumulated manure in slurry storage.\n", + "\n", + "### Methodology\n", + "\n", + "**Calculate Manure Temperature**\n", + "\n", + "*Slurry Storage Underfloor* `_determine_barn_temperature`\n", + "\n", + "Temperature of stored manure is assumed to be equal throughout the entire mass of manure. In slurry storage underfloor, manure temperature is assumed to be equal to air temperature, but is bounded to 5 to 30℃. See barn temperature determination method in Manure Handler section for more information. \n", + "\n", + "*Slurry Storage Outdoor* `_determine_outdoor_storage_temperature`\n", + "\n", + "Daily temperature of manure in slurry storage outdoors is determined using a sine/cosine least squares fit to user-provided weather data, with a fixed amplitude damping and lag (phase shift) factor. For more information, see the Calculate Stored Manure Temperature in the Anaerobic Lagoon section.\n", + "\n", + "**Calculate Storage Surface Area**\n", + "\n", + "Exposed surface area (m$^2$) of the manure in storage is important in determining NH3-N emissions, as well as in determining precipitation volume added to storage if the storage is not covered or indoors. Wherever possible, this value should be provided by the user if modeling a real farm. If farm-specific information is unavailable or the farm being modeled is theoretical, the surface area should be estimated using tools like the USDA's Animal Waste Management Version 2.4.1. However, RuFaS recognizes that minimizing required inputs is desirable, though a fixed storage surface area is undesirable due to the variability in storage structure size and surface area. With this, an equation was developed that estimates storage surface area based on the following assumptions:\n", + "\n", + "\n", + "* All manure excreted by animals on the farm enters the specified storage. At this time, the Manure module is not capable of assessing the proportion of manure excreted that is stored in the defined storages, therefore, all manure is assumed to be stored in the current storage, for the purposes of surface area estimation.\n", + "* The storage is 15 ft deep, with vertical walls.\n", + "* The storage receives 2500 mm of precipitation per year. \n", + "* Herd composition, and thus manure excretion, is fixed, and the number of animals in each life stage class is proportional to the number of mature cows. \n", + "\n", + "A constant value was derived to calculate estimated manure excretion based on the number of mature cows housed on the farm (a user input). The average number of animals in each class was determined according to default RuFaS animal lifecycle inputs, and the total mass and volume of manure excreted by the herd was calculated. This resulted in an estimated daily herd-wide manure excretion of 168.6 kg or 0.118 ($\\text{m}^3$) of manure per mature cow housed on the farm. The resulting equation is used to calculate storage surface area ($\\text{m}^2$).\n", + "\n", + ":::{#eq-mn-sto-1 style=\"font-size:80%\"}\n", + "[[**MN.STO.1**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{surface\\_area}(\\text{m}^2) = \\frac{\\text{cow\\_num} \\times \\text{MANURE\\_CONVERSION\\_CONSTANT} \\times \\text{storage\\_time} \\times \\text{FREEBOARD\\_CONSTANT}}{\\text{DEPTH\\_CONSTANT} - \\text{PRECIPITATION\\_CONSTANT}}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* cow\\_num: user-inputted number of mature cows housed on the farm\n", + "* `MANURE_CONVERSION_CONSTANT`: Factor to estimate m$^3$ of herd-wide manure produced per day per mature cow housed on the farm, set to 0.1175 m$^3$.\n", + "* `storage_time` (days): user-inputted number of days that manure is stored in this storage for before being emptied.\n", + "* `FREEBOARD_CONSTANT`: the volume allowance above the maximum volume of a slurry or liquid manure storage, set to 1.20 (20%).\n", + "* `DEPTH_CONSTANT`: value for slurry or liquid manure storage depth, set to 4.572 m (15 feet). \n", + "* `PRECIPITATION_CONSTANT`: The annual precipitation constant value, used only in determination of storage surface area if surface area is not provided by the user, set to 0.25 m.\n", + "\n", + "**Calculate Precipitation Volume**\n", + "\n", + "Covers have implications for inclusion or exclusion of precipitation volume, as well as for N2O emissions. Four cover options exist for slurry storages: \n", + "\n", + "* “Cover”: An impermeable cover that does not permit precipitation to enter the storage.\n", + "* “Cover and flare”: An impermeable cover with flaring of methane produced in storage. See Cover and Flare section. \n", + "* “Crust”: A naturally forming crust exists on the surface of the slurry storage.\n", + "* “No cover”: Storage is not covered or indoors.\n", + "\n", + "The cover type for slurry storage underfloor in the default manure management file is “uncovered”, as these storages are typically not enclosed. However, precipitation is always excluded from underfloor slurry storages, regardless of the cover type – see Precipitation below.\n", + "\n", + "Precipitation volume for uncovered outdoor slurry storages is calculated as follows:\n", + "\n", + ":::{#eq-mn-sto-2}\n", + "[[**MN.STO.2**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Daily\\_precipitation\\_volume}(\\text{m}^3) = \\text{storage\\_surface\\_area} \\times \\text{precipitation}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Storage surface area: the user-defined or model-estimated storage surface area (m$^2$). \n", + "* Precipitation: the daily amount of precipitation (m).\n", + "\n", + "**Calculate Methane Emissions `_calculate_methane_emissions`**\n", + "\n", + "We use an adaptation of a method originally conceived by @Sommer2004 to calculate daily emissions of CH4 from degradable and non-degradable VS in slurry. These equations focus on the degradation of degradable and non-degradable volatile solids (VS) present in the manure. Factors like degradable and non-degradable VS (VSd and VSnd) content in storage, temperature, and location (indoor/outdoor) affect estimated CH4 emissions. We apply the original method from @Sommer2004 with updated dairy manure Arrhenius and activation energy values from @Elsgaard2016 and @Petersen2024.\n", + "\n", + "Methane emissions are calculated in the same way for slurry storage outdoor and underfloor, with the exception that temperature of manure in outdoor vs. underfloor slurry storage is determined differently, as described below. The same equation is utilized to calculate CH4 emissions from VSd and VSnd (from both manure and bedding sources), though the rate-correcting factor differs between the two.\n", + "\n", + "First, we must calculate the value of the Arrhenius exponent (`_calculate_arrhenius_exponent`). This value directly represents the responsiveness of biological reaction speed to temperature, and in the context of this empirical equation, may also be related to the methane potential of manure in storage and activity of the microbial population:\n", + "\n", + ":::{#eq-mn-met-2}\n", + "[[**MN.MET.2**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Arrh\\_exp g}(\\text{CH}_4\\text{ kg}^{-1}\\text{VS h}^{-1}) = e^{\\text{Ln(A)} - \\frac{\\text{ACTIVATION\\_ENERGY}}{\\text{Gas constant} \\times \\text{manure temperature}}}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Ln(A): The natural log of the Arrhenius parameter (NATURAL\\_LOG\\_ARRHENIUS\\_CONSTANT constant), set at 30.7 based on @Petersen2024. This is an empirically-derived value determined based on observed manure CH4 emission values.\n", + "* `ACTIVATION_ENERGY`: the apparent activation energy of methanogenesis in cattle slurry (J/mol), set at 81,000 J/mol, based on @Elsgaard2016. \n", + "* Gas constant: ideal gas constant, set at 8.314 J K/mol.\n", + "* Manure temperature (K): temperature of manure in storage. \n", + "\n", + "Now we can calculate actual daily CH4 emission, based on the total quantity of VSd and VSnd in stored manure. The basic equation, used to calculate CH4 emissions for each VS fraction, is as follows:\n", + "\n", + ":::{#eq-mn-met-3}\n", + "[[**MN.MET.3**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{CH}_4 \\text{ emission from VS}_{\\text{d or nd}} (\\text{kg d}^{-1}) = 24 \\times \\text{Arrh\\_exp} \\times \\text{VS}_{\\text{d or nd}} \\times \\text{rate\\_factor}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* 24: conversion factor from hours to day. \n", + "* `Arrh_exp`: Arrhenius parameter for CH4 emission rate (g CH4 kg$^{-1}$ VS h$^{-1}$), calculated in [MN.MET.2]{#eq-mn-met-2}. \n", + "* `VSd or nd}`: The mass (kg) of VSd or VSnd in manure in slurry storage.\n", + "* `rate_factor`: The unitless rate-correcting factor, set to 1 for VS$_d$ and 0.01 for VS$_{nd}$. \n", + "\n", + "The total daily CH4 emission is equal to the sum of emissions from the VSd and VSnd fractions.\n", + "\n", + "**Calculate Cover and Flare Emissions `_calculate_cover_and_flare_emissions`**\n", + "\n", + "The cover and flare option is applicable to slurry storage outdoor only (i.e., not usable with slurry storage underfloor). If the cover and flare option is selected, daily CH4 emission from slurry storage is multiplied by a methane destruction efficiency value. The set value for methane destruction efficiency is 81%, based on a white paper commissioned by Dairy Management, Inc. on cover and flare efficiency [@wallaceDMI]. The updated daily CH4 emission (kg) from a cover and flare slurry storage is as follows:\n", + "\n", + ":::{#eq-mn-met-4}\n", + "[[**MN.MET.4**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Daily storage CH}_4 (\\text{kg}) = \\text{storage CH}_4 \\times (1 - \\text{METHANE\\_DESTRUCTION\\_EFFICIENCY})\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Storage CH4 (kg): total daily kg of CH4 emitted from stored manure, calculated in [MN.MET.3]{#eq-mn-met-3}.\n", + "* `METHANE_DESTRUCTION_EFFICIENCY`: coefficient for destruction of methane by the flare, set to 0.81.\n", + "\n", + "**Calculate Volatile Solids Loss `_apply_methane_emissions`**\n", + "\n", + "Daily emissions of CH4 and CO2 from slurry storage occur through microbial degradation of VS in slurry manure, among other processes [@Petersen2024]. Therefore, gaseous emissions from slurry storage result in a decrease in the quantity of VS in stored slurry. VSd and VSnd remaining in manure are updated separately according to their respective loss via CH4 [MN.STO.4]{#eq-mn-sto-4}. Here, we assume a fixed 1:3 molar ratio of CH4-C to CO2-C emissions from stored slurry from @Petersen2024. This enables calculation of the total amount of C and thus VSd and VSnd lost through CH4 and CO2 emissions based on the quantity of CH4 emitted from each VS fraction.\n", + "\n", + "Given that C is assumed to be lost via CH4 and CO2 emissions in a ratio of 1:3, we assume for each C lost as CH4, 3 C are lost as CO2. CH4 is ~75% C by mass, thus for each kg of CH4 emitted, 0.7498 C are lost via CH4 and (3 x 0.7498) are lost from CO2, for a total of 2.992 kg C per kg of CH4 emitted. We assume manure VS are 45% C [@Petersen2024]; therefore, 2.9992 kg C / 45% C = 6.665 kg VS are lost per kg of CH4 emitted.\n", + "\n", + ":::{#eq-mn-sto-3}\n", + "[[**MN.STO.3**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{VS}_\\text{d or nd}\\text{loss (kg)} = \\text{CH}_4\\text{ emission from VS}_\\text{d or nd} \\times \\text{VS\\_TO\\_METHANE\\_LOSS\\_RATIO}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* CH4 emission from VSd or nd (kg): total daily kg of CH4 emitted from VSd or nd, calculated in [MN.MET.3]{#eq-mn-met-3}\n", + "* `VS_TO_METHANE_LOSS_RATIO`: default ratio of VS degraded per kg of CH4 emitted from slurry storage, set to 6.665\n", + "\n", + "**Calculate Ammonia Emissions `_calculate_ammonia_emissions`**\n", + "\n", + "Emission of NH3-N from stored slurry is determined using equations from @Rotz2006, which are also utilized in the IFSM [@Rotz2023]. Ammonia emissions are influenced by the quantity of TAN accumulated in manure storage, manure temperature, and manure storage surface area. First, we must derive the various parameters utilized in the calculation.\n", + "\n", + "First, we need to derive the value of the equilibrium coefficient Q for the NH3 gas in the air for a given concentration of TAN in stored manure using Henry’s law. Note that the concentration of NH3 in the free atmosphere is assumed to be zero. Since Q is a function of the Henry’s law coefficient Kh and a dissociation of ammonium coefficient Ka, we will calculate those first. \n", + " \n", + "*Henry’s law coefficient (Kh)*:\n", + "\n", + ":::{#eq-mn-amm-1}\n", + "[[**MN.AMM.1**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{K}_\\text{h} = 10^{\\frac{1478}{\\text{manure temperature}}} - 1.69\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Manure temperature (K): temperature of manure storage.\n", + "\n", + "*Dissociation coefficient of ammonium (Ka)*\n", + "\n", + ":::{#eq-mn-amm-2}\n", + "[[**MN.AMM.2**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{K}_\\text{h} = 1 + 10^{(0.09018 + \\frac{2729.9}{\\text{manure temperature}} - \\text{pH})}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Manure temperature (K): temperature of stored manure.\n", + "* `DEFAULT_STORED_MANURE_PH`: the pH of the manure in storage, set to 7.5 by default\n", + "\n", + "*Equilibrium coefficient (Q)*\n", + "\n", + ":::{#eq-mn-amm-3}\n", + "[[**MN.AMM.3**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Q} = \\text{K}_\\text{h} \\times \\text{K}_\\text{a}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Kh: Henry’s law coefficient, calculated in [MN.AMM.1]{#eq-mn-amm-1}.\n", + "* Ka: Dissociation coefficient of ammonium, calculated in [MN.AMM.2]{#-eq-mn-amm-2}.\n", + "\n", + "Next, the rate of NH3-N loss in kg N/m$^2$ from stored manure is calculated:\n", + "\n", + ":::{#eq-mn-amm-5}\n", + "[[**MN.AMM.5**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{NH}_3\\text{N emission rate} (\\text{kg N/m}^2) = \\frac{\\text{TAN} \\times \\text{c} \\times \\text{y}}{\\text{STORAGE\\_RESISTANCE} \\times \\text{M} \\times \\text{Q}}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* TAN (kg): Mass of ammoniacal N in stored manure\n", + "* c: time conversion constant (86400 s per d)\n", + "* y: manure density, set to 990 kg/m$^3$ \n", + "* `STORAGE_RESISTANCE`: A constant value representing the sum of resistance of NH3 transfer from solution to manure surface, and from manure surface to atmosphere, set at 23.1 s/m.\n", + "* M (kg): Total mass of stored manure\n", + "* Q: Equilibrium coefficient calculated in [MN.AMM.3]{#eq-mn-amm-3}\n", + "\n", + "Lastly, we calculate total NH3-N emissions (kg), based on the emission rate we just calculated and the manure storage surface area.\n", + "\n", + ":::{#eq-mn-amm-7}\n", + "[[**MN.AMM.7**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{NH}_3\\text{ emissions (kg)} = \\text{NH}_3\\text{N\\_rate} \\times \\text{surface\\_area}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `NH3N_rate` (kg N/m$^2$): Rate of NH3-N loss (kg/m$^2$) from manure, calculated in [MN.AMM.5]{#eq-m-amm-5}.\n", + "* `surface_area` (m$^2$): Total manure storage surface area.\n", + "\n", + "**Calculate Nitrous Oxide Emissions `_calculate_nitrous_oxide_emissions`**\n", + "\n", + "N2O emissions (kg N2O-N) are based on the daily quantity of manure N loaded into storage, whether the manure storage is covered or uncovered. This method is based on @IPCC2019; however, it should be noted that the original @IPCC2006 method is based on daily manure N excretion by animals, whereas the current method is based on manure N loading into storage, which may reflect upstream N losses from NH3 emissions in housing, solid liquid separation, etc. The calculation is as follows:\n", + "\n", + ":::{#eq-mn-nit-1}\n", + "[[**MN.NIT.1**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{N}_2\\text{O-N emissions (kg)} = \\text{Received\\_N} \\times \\text{N}_2\\text{O factor}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `Received_N` (kg): Quantity of manure total N loaded into storage on the current day\n", + "* N2O factor: kg of N2O-N emitted per kg of manure N added per day to storage, based on the following logic:\n", + " * Cover type = crust OR cover; 0.005\n", + " * Cover type = no cover; 0 (no N2O emissions)\n", + "\n", + "### Received, stored, and emptied outputs\n", + "\n", + "Manure storages in RuFaS report two types of outputs to OutputManager each day: received manure and stored manure. \n", + "\n", + "**Received Manure**\n", + "\n", + "Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values. \n", + "\n", + "**Stored Manure**\n", + "\n", + "Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In slurry storage processors, daily losses include CH4, NH3, and N2O emissions. The order of operations in updating accumulated manure values is:\n", + "\n", + "* Add received manure values to stored manure values\n", + "* Calculate gas emissions and total nutrient losses based on stored manure values\n", + "* Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. \n", + "\n", + "For slurry storage and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. \n", + "\n", + "**Emptied Manure**\n", + "\n", + "Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and Manure Stream attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage.\n", + "\n", + "### Manure Composition Update\n", + "\n", + "**Received manure**\n", + "\n", + "In slurry storage processors, the following nutrient sources are represented in received manure values:\n", + "\n", + "* `ManureStream` values, as received from the previous processor(s) in the manure management chain\n", + "* Precipitation water (kg), calculated in [MN.STO.2]{#eq-mn-sto-2} (if applicable), is added to the water value in `ManureStream`\n", + "\n", + "**Stored manure**\n", + "\n", + "Below is a summary of updates to ManureStream variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", + "\n", + "Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. Received manure simply refers to the manure being loaded into the manure storage each day. " + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "tbl-mn-SS-calc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| Variable | Units | Calculation |\n", + "+:=======================================+:========:+:==========================================================================================================+\n", + "| water | kg | stored manure water + received manure water |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| total_ammoniacal_nitrogen | kg | max(0,stored manure ammoniacal nitrogen + received ammoniacal nitrogen - NH$_3$N emissions) |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| nitrogen | kg | stored manure nitrogen + received manure nitrogen - NH$_3$N emissions - N$_2$O-N emissions |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| phosphorus | kg | stored manure phosphorus + received manure phosphorus |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| potassium | kg | stored manure potassium + received manure potassium |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| ash | kg | stored manure ash + received manure ash |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| degradable_volatile_solids | -- | stored degradable VS + received degradable VS - VSd loss |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| manure_non_degradable_volatile_solids | -- | stored manure non-degradable VS + received manure non-degradable VS - manure VSnd loss |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| bedding_non_degradable_volatile_solids | -- | stored bedding non-degradable VS + received bedding non-degradable VS - bedding VSnd loss |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| total_solids | kg | stored total solids + received total solids - VSd loss - VSnd los) |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| volume | m$^3$ | stored volume + Received volume- $\\frac{\\text{VSd loss}+\\text{VSnd loss}}{\\text{SLURRY\\_MANURE\\_DENSITY}$ |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-SS-calc\n", + "#| tbl-cap: Manure storage variable calculations.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-SS-calc.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "f22be40d", + "metadata": {}, + "source": [ + "## Anaerobic Lagoon\n", + "\n", + "### Introduction\n", + "Manure that is stored and managed at less than 5% dry matter is generally considered to be liquid manure. Liquid manure is generated by either dilution of raw or slurry manure, generally through the addition of wash or flush water, or removal of a portion of manure solids through solid liquid separation methods (mechanical separator, settling basin, etc.) or anaerobic digestion. Liquid manure is generally stored in a type of large, outdoor storage structure called an anaerobic lagoon, or simply a lagoon. Anaerobic lagoons are not simply structures in which to store manure. Lagoons facilitate biological breakdown of organic materials, which reduces volatile solids content and odor, though also increases N mineralization and loss as ammonia, particularly if the lagoon is uncovered. Accordingly,\n", + "anaerobic lagoons have specific design and management requirements to facilitate biological treatment activity [@NRCS2017]. Some characteristics that separate an anaerobic lagoon from slurry or liquid manure storage are:\n", + "\n", + "* Greater storage capacity\n", + "* Less frequent and less complete emptying, resulting in longer solids/sludge retention time\n", + "* Storage of liquid rather than slurry manure\n", + "* Controlled volatile solids loading rate\n", + "* Lagoons are generally a lined or unlined in-ground basin, whereas slurry storage may be either in-ground or above-ground tanks or other structures \n", + "\n", + "**Implementation in RuFaS**\n", + "\n", + "In RuFaS, the underlying biological and gas emission methods are identical for slurry storages vs. anaerobic lagoons, as the biological process of organic matter breakdown is very similar between the two in reality. However, the differences in size, dilution, management, and other factors differ between the two in reality, leading to generally greater GHG emissions from lagoons compared to slurry storages. In the anaerobic lagoon submodule, accumulated manure in storage (i.e., held in the lagoon) is modeled on a daily timestep. Nutrient/mass gains from daily addition of manure (feces/urine, bedding, wash water) to storage, and precipitation volume entering storage, are tracked. Gas emissions are calculated daily based on the quantity of nutrients in stored manure, manure temperature, storage type, use of a cover, and storage duration. Manure composition is then updated according to net nutrient losses/gains. Manure accumulates in storage until the end of the user-defned storage interval is reached. However, quantities of manure may additionally be removed from storage according to the user-defined manure application schedule. \n", + "\n", + "**Classes**" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "tbl-mn-AL-classes", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+---------------------------+---------------------+\n", + "| Anaerobic Lagoon | Description |\n", + "+:=========================:+:===================:+\n", + "| AnaerobicLagoon (Storage) | anaerobic_lagoon.py |\n", + "+---------------------------+---------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-AL-classes\n", + "#| tbl-cap: List of classes for anaerobic lagoon.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-AL-classes.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "c84ca9b8", + "metadata": {}, + "source": [ + "### Required User Inputs" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "tbl-mn-AL-inputs", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Variable | Units | Description |\n", + "+:====================+:========:+:==============================================================================================================================================================+\n", + "| Name | -- | Unique identifier of the specific anaerobic lagoon configuration used. |\n", + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Capacity | m$^3$ | The volumetric capacity of the anaerobic lagoon, in m$^3$. Note that this variable is a placeholder at this time, and does not influence model calculations. |\n", + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Cover | -- | The type of cover used with the anaerobic lagoon. |\n", + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Surface_area | m$^2$ | The surface area of the anaerobic lagoon at the minimum operating level. |\n", + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Storage_time_period | days | The number of days that manure is stored between emptying events. At the end of this interval, the manure storage is emptied completely. |\n", + "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-AL-inputs\n", + "#| tbl-cap: Required inputs for the anaerobic lagoon section (`refreshed_manure_management.json`)\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-AL-inputs.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "016b62f5", + "metadata": {}, + "source": [ + "**Other inputs**\n", + "\n", + "Instance(s) of ManureStream for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. ManureStream instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$/kgVS):\n", + "\n", + "* water \n", + "* `ammoniacal_nitrogen`\n", + "* nitrogen\n", + "* phosphorus\n", + "* potassium\n", + "* ash\n", + "* `manure_degradable_volatile_solids`\n", + "* `manure_non_degradable_volatile_solids`\n", + "* `bedding_non_degradable_volatile_solids`\n", + "* `total_solids`\n", + "* mass (equal to sum of water and total solids)\n", + "* `total volatile solids` (equal to sum of degradable and non-degradable volatile solids)\n", + "* volume\n", + "* `methane_production_potential`\n", + "\n", + "### Expected Outputs\n", + "\n", + "* ManureStream variables representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses\n", + "* `storage_methane`(kg): Daily emission of CH4 from accumulated manure in an anaerobic lagoon. \n", + "* `storage_ammonia`(kg): Daily emission of NH3 from accumulated manure in an anaerobic lagoon. \n", + "* `storage_nitrous_oxide`(kg): Daily emission of N2O from accumulated manure in an anaerobic lagoon. \n", + "\n", + "### Methodology\n", + "\n", + "**Calculate manure temperature** \n", + "`_determine_outdoor_storage_temperature`\n", + "\n", + "Manure temperature is modeled using a cosine function whose parameters are derived from a least-squares fit of simulation-wide weather data. The air temperature amplitude is reduced using a damping factor to reflect the smaller annual variation in manure temperature relative to air. The phase shift (i.e., timing of peak temperature) is determined based on the least squares function and is adjusted by a fixed lag constant representing the delayed thermal response of manure temperature relative to air temperature.\n", + "\n", + "First, we determine the amplitude of the manure temperature function by applying the damping factor. \n", + "\n", + ":::{#eq-mn-sto-13}\n", + "[[**MN.STO.13**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{manure\\_amplitude} = \\text{amplitude} \\times \\text{MANURE\\_DAMPING\\_FACTOR}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* amplitude: modeled amplitude of the seasonal air temperature function, calculated from user-supplied, simulation-wide weather data\n", + "* MANURE_DAMPING_FACTOR: a fixed damping factor applied to the air temperature amplitude, set to 0.65\n", + "\n", + "Second, we use this amplitude in the following function to determine modeled manure temperature (℃) each simulation day. Note the function includes a 'max' term to implement a lower temperature bound for manure temperature. \n", + "\n", + ":::{#eq-mn-sto-14 style=\"font-size:90%\"}\n", + "[[**MN.STO.14**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{manure\\_temp} &= \\text{max}( \\\\\n", + "&\\text{mean\\_temp} \\times \\text{manure\\_amplitude} \\times \\text{cos}(\\frac{2\\pi}{365}) \\\\\n", + " &\\times (\\text{jday} - \\text{phase\\_shift} - \\text{MANURE\\_TEMPERATURE\\_LAG})), \\\\\n", + " & \\text{min\\_temp})\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* mean_temp (℃): simulation_wide mean air temperature\n", + "* manure_amplitude: amplitude of the manure temperature function, determined in [MN.STO.13]{#eq-mn-sto-13}\n", + "* jday: Julian day of the simulation [MN.MET.3]{#eq-mn-met-3}r temperature in the simulation\n", + "* MANURE_TEMPERATURE_LAG (days): fixed lag constant representing the delayed thermal response of manure temperature relative to air temperature, set to 30. \n", + "* min_temp (℃): A fixed minimum temperature constant, dependent on the type of storage: \n", + "- Anaerobic lagoon: 1℃\n", + "- Slurry storage outdoor: -20℃\n", + "\n", + "**Calculate storage surface area** \n", + "Exposed surface area (m$^2$) of the manure in storage is important in determining NH3-N emissions, as well as in determining precipitation volume added to storage if the storage is not covered or indoors. Wherever possible, this value should be provided by the user if modeling a real farm. If farm-specific information is unavailable or the farm being modeled is theoretical, the surface area should be estimated using tools like the USDA's Animal Waste Management Version 2.4.1. However, the RuFaS team recognizes that minimizing required inputs is desirable, though a fixed storage surface area is undesirable due to the variability in storage structure size and surface area. With this, an equation was developed that estimates storage surface area based on the following assumptions:\n", + "\n", + "* All manure excreted by animals on the farm enters the specified storage. At this time, the Manure module is not capable of assessing the proportion of manure excreted that is stored in the defined storages, therefore, all manure is assumed to be stored in the current storage, for the purposes of surface are estimation. \n", + "* The storage is 15 ft deep, with vertical walls. \n", + "* The storage receives 2500 mm of precipitation per year. \n", + "* Herd composition, and thus manure excretion, is fixed, and the number of animals in each life stage class is proportional to the number of mature cows. \n", + "\n", + "A constant value was derived to calculate estimated manure excretion based on the number of mature cows housed on the farm (a user input). The average number of animals in each class was determined according to default RuFaS animal life cycle inputs, and the total mass and volume of manure excreted by the herd was calculated. This resulted in an estimated daily herd-wide manure excretion of 168.6 kg or 0.118 m$^3$ of manure per mature cow housed on the farm. The resulting equation is used to calculate storage surface area (m$^2$). \n", + "\n", + ":::{#eq-mn-sto-1 style=\"font-size:90%\"}\n", + "[[**MN.STO.1**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "&\\text{surface\\_area(m$^2$)} = \\\\\n", + "&\\frac{\\text{cow\\_num} \\times \\text{MANURE\\_CONVERSION\\_CONSTANT} \\times \\text{storage\\_time} \\times \\text{FREEBOARD\\_CONSTANT}}{\\text{DEPTH\\_CONSTANT} - \\text{PRECIPITATION\\_CONSTANT}}\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* cow_num: user-inputted number of mature cows housed on the farm\n", + "* MANURE_CONVERSION_CONSTANT: Factor to estimate m$^3$ of herd-wide manure produced per day per mature cow housed on teh farm, set to 0.1175 m$^3$. \n", + "* storage_time (days): user-inputted number of days that manure is stored in this storage for before being emptied\n", + "* FREEBOARD_CONSTANT: the volume allowance above the maximum volume of a slurry or liquid manure storage, set to 1.20 (20%). \n", + "* DEPTH_CONSTANT: value for slurry or liquid manure storage depth, set to 4.572 m (15 feet)\n", + "* PRECIPITATION_CONSTANT: the annual precipitation constant value, used only in determination of storage surface area if surface area is not provided by the user, set to 0.25m. \n", + "\n", + "**Calculate Precipitation Volume**\n", + "\n", + "The use of covers has implications for inclusion or exclusion of precipitation volume, as well as for N2O emissions. Four cover options exist for anaerobic lagoons: \n", + "\n", + "* Cover\n", + "* Cover and flare\n", + "* Crust\n", + "* No cover \n", + "\n", + "Detailed descriptions are outlined in the Slurry Storage section of this module. Precipitation volume for anaerobic lagoons that are uncovered or have a crust is calculated as follows: \n", + "\n", + ":::{#eq-mn-sto-2}\n", + "[[**MN.STO.2**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Daily\\_precipitation\\_volume}(\\text{m}^3) = \\text{storage\\_surface\\_area} \\times \\text{precipitation}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Storage surface area: the user-defined or model-estimated storage surface area (m$^2$). \n", + "* Precipitation: the daily amount of precipitation (m).\n", + "\n", + "**Calculate Methane Emissions `_calculate_methane_emissions`**\n", + "\n", + "We use an adaptation of a method originally conceived by @Sommer2004 to calculate daily emissions of CH4 from degradable and non-degradable VS in anaerobic lagoons. These equations focus on the degradation of degradable and non-degradable volatile solids (VS) present in the manure. Factors like degradable and non-degradable VS (VSd and VSnd) content in storage, temperature, and location (indoor/outdoor) affect estimated CH4 emissions. We apply the original method from @Sommer2022 with updated dairy manure Arrhenius and activation energy values from @Elsgaard2016 and @Petersen2024. The same equation is utilized to calculate CH4 emissions from VSd and VSnd (from both manure and bedding sources), though the rate-correcting factor differs between the two.\n", + "\n", + "First, we must calculate the value of the Arrhenius exponent (`_calculate_arrhenius_exponent`). This value directly represents the responsiveness of biological reaction speed to temperature, and in the context of this empirical equation, may also be related to the methane potential of manure in storage and activity of the microbial population:\n", + "\n", + ":::{#eq-mn-met-2}\n", + "[[**MN.MET.2**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Arrh\\_exp g}(\\text{CH}_4\\text{ kg}^{-1}\\text{VS h}^{-1}) = e^{\\text{Ln(A)} - \\frac{\\text{ACTIVATION\\_ENERGY}}{\\text{Gas constant} \\times \\text{manure temperature}}}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Ln(A): The natural log of the Arrhenius parameter (NATURAL\\_LOG\\_ARRHENIUS\\_CONSTANT constant), set at 30.6 based on @Petersen2024. This is an empirically-derived value determined based on observed manure CH4 emission values.\n", + "* `ACTIVATION_ENERGY`: the apparent activation energy of methanogenesis in cattle slurry (J/mol), set at 81,000 J/mol, based on @Elsgaard2016. \n", + "* Gas constant: ideal gas constant, set at 8.314 J K/mol.\n", + "* Manure temperature (K): temperature of manure in storage. \n", + "\n", + "Now we can calculate actual daily CH4 emission, based on the total quantity of VSd and VSnd in stored manure. The basic equation, used to calculate CH4 emissions for each VS fraction, is as follows:\n", + "\n", + ":::{#eq-mn-met-3}\n", + "[[**MN.MET.3**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{CH}_4 \\text{ emission from VS}_{\\text{d or nd}} (\\text{kg d}^{-1}) = 24 \\times \\text{Arrh\\_exp} \\times \\text{VS}_{\\text{d or nd}} \\times \\text{rate\\_factor}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* 24: conversion factor from hours to day. \n", + "* `Arrh_exp`: Arrhenius parameter for CH4 emission rate (g CH4 kg$^{-1}$ VS h$^{-1}$), calculated in [MN.MET.2]{#eq-mn-met-2}. \n", + "* VSd or nd: The mass (kg) of VS~d~ or VS~nd~ in manure in slurry storage.\n", + "* `rate_factor`: The unitless rate-correcting factor, set to 1 for VSd and 0.01 for VSnd. \n", + "\n", + "The total daily CH4 emission is equal to the sum of emissions from the VS~d~ and VS~nd~ fractions.\n", + "\n", + "**Calculate Cover and Flare Emissions `_calculate_cover_and_flare_methane`**\n", + "\n", + " If the cover and flare option is selected, daily CH4 emission from an anaerobic lagoon is multiplied by a methane destruction efficiency value. The set value for methane destruction efficiency is 81%, based on a white paper commissioned by Dairy Management, Inc. on cover and flare efficiency [@wallaceDMI]. The updated daily CH4 emission (kg) from a cover and flare lagoon is as follows:\n", + "\n", + ":::{#eq-mn-met-4}\n", + "[[**MN.MET.4**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Daily storage CH}_4 (\\text{kg}) = \\text{storage CH}_4 \\times (1 - \\text{METHANE\\_DESTRUCTION\\_EFFICIENCY})\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Storage CH4 (kg): total daily kg of CH4 emitted from stored manure, calculated in [MN.MET.3]{#eq-mn-met-3}.\n", + "* `METHANE_DESTRUCTION_EFFICIENCY`: coefficient for destruction of methane by the flare, set to 0.81.\n", + "\n", + "**Calculate Volatile Solids Losses `_apply_methane_emissions`**\n", + "\n", + "Daily emissions of CH4 and CO2 from anaerobic lagoons occur through microbial degradation of VS in manure, among other processes [@Petersen2024]. Therefore, gaseous emissions from slurry storage result in a decrease in the quantity of VS in stored slurry. VSd and VSnd remaining in manure are updated separately according to their respective loss via CH4 [MN.STO.4]{#eq-mn-sto-4}. Here, we assume a fixed 1:3 molar ratio of CH4-C to CO2-C emissions from stored slurry from @Petersen2024. This enables calculation of the total amount of C and thus VSd and VSnd lost through CH4 and CO2 emissions based on the quantity of CH4 emitted from each VS fraction.\n", + "\n", + "Given that C is assumed to be lost via CH4 and CO2 emissions in a ratio of 1:3, we assume for each C lost as CH4, 3 C are lost as CO2. CH4 is ~75% C by mass, thus for each kg of CH4 emitted, 0.7498 C are lost via CH4 and (3 x 0.7498) are lost from CO2, for a total of 2.992 kg C per kg of CH4 emitted. We assume manure VS are 45% C [@Petersen2024]; therefore, 2.9992 kg C / 45% C = 6.665 kg VS are lost per kg of CH4 emitted.\n", + "\n", + ":::{#eq-mn-sto-3}\n", + "[[**MN.STO.3**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{VS}_\\text{d or nd}\\text{loss (kg)} = \\text{CH}_4\\text{ emission from VS}_\\text{d or nd} \\times \\text{VS\\_TO\\_METHANE\\_LOSS\\_RATIO}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* CH4 emission from VSd or nd (kg): total daily kg of CH4 emitted from VSd or nd, calculated in [MN.MET.3]{#eq-mn-met-3}\n", + "* `VS_TO_METHANE_LOSS_RATIO`: default ratio of VS degraded per kg of CH4 emitted from slurry storage, set to 6.665\n", + "\n", + "**Calculate manure retention at emptying `_emptying_fraction`**\n", + "\n", + "Anaerobic lagoons, through their settling action, accumulate and retain a bottom layer of solids often\n", + "referred to as \"sludge\". Additionally, depending on the frequency and extent of lagoon agitation, retention time of volatile solids in lagoons is typically explicitly managed to promote biological degradation of\n", + "solids. These factors contribute to the generally greater CH4 emissions per unit of volatile solids loaded into anaerobic lagoons compared to in-ground basin or tank manure storages. To directly capture the\n", + "greater retention of manure at emptying events, and to indirectly capture the greater biological activity\n", + "in anaerobic lagoons, a default manure retention factor is implemented in RuFaS. This factor dictates\n", + "the portion of manure which, when the storage time interval is reached, is retained in the lagoon. This\n", + "factor is applied evenly to all manure constituents (i.e., ManureStream variables). \n", + "\n", + ":::{#eq-mn-sto-15 style=\"font-size:90%\"}\n", + "[[**MN.STO.15**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{retained\\_manure}_i = \\text{accumulated\\_manure}_i \\times \\text{ANAEROBIC\\_LAGOON\\_MANURE\\_RETENTION}\n", + "$$\n", + ":::\n", + "\n", + "*Where:*\n", + "\n", + "* *i*: manure constituent *i*\n", + "* accumulated_manurei: quantity of manure constituent *i* present in the accumulate anaerobic lagoon manure when the storage time interval is reached\n", + "* ANAEROBIC_LAGOON_MANURE_RETENTION: constant fraction of the accumulated stored manure that is retained in the anaerobic lagoon when the storage time interval is reached, set to 0.10 \n", + "\n", + "**Calculate ammonia emissions `_calculate_ammonia_emissions`** \n", + "\n", + "Emission of NH3-N from anaerobic lagoons is determined using equations from @Rotz2006, which are also utilized in the IFSM [@Rotz2023]. Ammonia emissions are influenced by the quantity of TAN accumulated in manure storage, manure temperature, and manure storage surface area. First, we must derive the various parameters utilized in the calculation.\n", + "\n", + "First, we need to derive the value of the equilibrium coefficient Q for the NH3 gas in the air for a given concentration of TAN in stored manure using Henry’s law. Note that the concentration of NH3 in the free atmosphere is assumed to be zero. Since Q is a function of the Henry’s law coefficient Kh and a dissociation of ammonium coefficient Ka, we will calculate those first. \n", + " \n", + "*Henry’s law coefficient (Kh)*:\n", + "\n", + ":::{#eq-mn-amm-1}\n", + "[[**MN.AMM.1**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{K}_\\text{h} = 10^{\\frac{1478}{\\text{manure temperature}}} - 1.69\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Manure temperature (K): temperature of manure storage.\n", + "\n", + "*Dissociation coefficient of ammonium (Ka)*\n", + "\n", + ":::{#eq-mn-amm-2}\n", + "[[**MN.AMM.2**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{K}_\\text{h} = 1 + 10^{(0.09018 + \\frac{2729.9}{\\text{manure temperature}} - \\text{pH})}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Manure temperature (K): temperature of stored manure.\n", + "* `DEFAULT_STORED_MANURE_PH`: the pH of the manure in storage, set to 7.5 by default\n", + "\n", + "*Equilibrium coefficient (Q)*\n", + "\n", + ":::{#eq-mn-amm-3}\n", + "[[**MN.AMM.3**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{Q} = \\text{K}_\\text{h} \\times \\text{K}_\\text{a}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* Kh: Henry’s law coefficient, calculated in [MN.AMM.1]{#eq-mn-amm-1}.\n", + "* Ka: Dissociation coefficient of ammonium, calculated in [MN.AMM.2]{#-eq-mn-amm-2}.\n", + "\n", + "Next, the rate of NH3-N loss in kg N/m$^2$ from stored manure is calculated:\n", + "\n", + ":::{#eq-mn-amm-5}\n", + "[[**MN.AMM.5**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{NH}_3\\text{N emission rate} (\\text{kg N/m}^2) = \\frac{\\text{TAN} \\times \\text{c} \\times \\text{y}}{\\text{STORAGE\\_RESISTANCE} \\times \\text{M} \\times \\text{Q}}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* TAN (kg): Mass of ammoniacal N in stored manure\n", + "* c: time conversion constant (86400 s per d)\n", + "* y: manure density, set to 990 kg/m$^3$ \n", + "* `STORAGE_RESISTANCE`: A constant value representing the sum of resistance of NH3 transfer from solution to manure surface, and from manure surface to atmosphere, set at 23.1 s/m.\n", + "* M (kg): Total mass of stored manure\n", + "* Q: Equilibrium coefficient calculated in [MN.AMM.3]{#eq-mn-amm-3}\n", + "\n", + "Lastly, we calculate total NH3-N emissions (kg), based on the emission rate we just calculated and the manure storage surface area.\n", + "\n", + ":::{#eq-mn-amm-7}\n", + "[[**MN.AMM.7**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{NH}_3\\text{ emissions (kg)} = \\text{NH}_3\\text{N\\_rate} \\times \\text{surface\\_area}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `NH3N_rate` (kg N/m$^2$): Rate of NH3-N loss (kg/m$^2$) from manure, calculated in [MN.AMM.5]{#eq-m-amm-5}.\n", + "* `surface_area` (m$^2$): Total manure storage surface area.\n", + "\n", + "**Calculate Nitrous Oxide Emissions `_calculate_nitrous_oxide_emissions`**\n", + "\n", + "N2O emissions (kg N2O-N) are based on the daily quantity of manure N loaded into the lagoon, and whether the lagoon is covered or uncovered. This method is based on @IPCC2019; however, it should be noted that the original @IPCC2006 method is based on daily manure N excretion by animals, whereas the current method is based on manure N loading into storage, which may reflect upstream N losses from NH3 emissions in housing, solid liquid separation, etc. The calculation is as follows:\n", + "\n", + ":::{#eq-mn-nit-1}\n", + "[[**MN.NIT.1**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{N}_2\\text{O-N emissions (kg)} = \\text{Received\\_N} \\times \\text{N}_2\\text{O factor}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `Received_N` (kg): Quantity of manure total N loaded into storage on the current day\n", + "* N2O factor: kg of N2O-N emitted per kg of manure N added per day to storage, based on the following logic:\n", + " * Cover type = crust OR cover; 0.005\n", + " * Cover type = no cover; 0 (no N2O emissions)\n", + "\n", + "### Received, stored, and emptied outputs\n", + "\n", + "Manure storages in RuFaS report two types of outputs to OutputManager each day: received manure and stored manure. \n", + "\n", + "**Received Manure**\n", + "\n", + "Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values. \n", + "\n", + "**Stored Manure**\n", + "\n", + "Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In anaerobic lagoon processors, daily losses include CH4, NH3, and N2O emissions. The order of operations in updating accumulated manure values is:\n", + "\n", + "* Add received manure values to stored manure values\n", + "* Calculate gas emissions and total nutrient losses based on stored manure values\n", + "* Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. \n", + "\n", + "For anaerobic lagoons and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. \n", + "\n", + "**Emptied Manure**\n", + "\n", + "Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and Manure Stream attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage.\n", + "\n", + "### Manure Composition Update\n", + "\n", + "**Received manure**\n", + "\n", + "In anaerobic lagoon processors, the following nutrient sources are represented in received manure values:\n", + "\n", + "* `ManureStream` values, as received from the previous processor(s) in the manure management chain\n", + "* Precipitation water (kg), calculated in [MN.STO.2]{#eq-mn-sto-2} (if applicable), is added to the water value in `ManureStream`\n", + "\n", + "**Stored manure**\n", + "\n", + "Below is a summary of updates to ManureStream variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", + "\n", + "Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. Received manure simply refers to the manure being loaded into the manure storage each day. " + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "tbl-mn-AL-calc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| Variable | Units | Calculation |\n", + "+:=======================================+:========:+:==========================================================================================================+\n", + "| water | kg | stored manure water + received manure water |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| total_ammoniacal_nitrogen | kg | max(0,stored manure ammoniacal nitrogen + received ammoniacal nitrogen - NH$_3$N emissions) |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| nitrogen | kg | stored manure nitrogen + received manure nitrogen - NH$_3$N emissions - N$_2$O-N emissions |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| phosphorus | kg | stored manure phosphorus + received manure phosphorus |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| potassium | kg | stored manure potassium + received manure potassium |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| ash | kg | stored manure ash + received manure ash |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| degradable_volatile_solids | -- | stored degradable VS + received degradable VS - VSd loss |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| manure_non_degradable_volatile_solids | -- | stored manure non-degradable VS + received manure non-degradable VS - manure VSnd loss |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| bedding_non_degradable_volatile_solids | -- | stored bedding non-degradable VS + received bedding non-degradable VS - bedding VSnd loss |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| total_solids | kg | stored total solids + received total solids - VSd loss - VSnd los) |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", + "| volume | m$^3$ | stored volume + Received volume- $\\frac{\\text{VSd loss}+\\text{VSnd loss}}{\\text{SLURRY\\_MANURE\\_DENSITY}$ |\n", + "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-AL-calc\n", + "#| tbl-cap: Manure storage variable calculations.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-SS-calc.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "e6a57dce", + "metadata": {}, + "source": [ + "## Bedded Pack\n", + "\n", + "### Introduction\n", + "\n", + "Traditional dairy housing systems typically involve concrete flooring and limited bedding, which can lead to cow discomfort, suboptimal health, and laborious manure management. Bedded pack pens aim to address these issues by providing a soft, comfortable, and dry bedding surface for cows, enhancing their comfort and overall well-being.\n", + "\n", + "Bedded packs fall into one of two management methods: a traditional bedded pack, or a compost bedded pack. See @endresUWMadison for further detail. Though the names are often used interchangeably, note here that the primary difference between the two types is the presence or absence of active mixing, and the length of time between complete removal of the accumulated bedding/manure mixture from the pen.\n", + "\n", + "*Traditional Bedded Pack*\n", + "\n", + "Traditional bedded packs, referred to here as simply “bedded packs”, are typically bedded using straw. Fresh material is added daily without any mixing activity, which causes the manure/bedding mix (pack) to compact and become anaerobic. The pack material is typically removed every 4 to 6 weeks.\n", + "\n", + "*Compost Bedded Pack*\n", + "\n", + "Compost bedded packs are typically bedded with sawdust, shavings, or other fine, dense, absorbent material. Bedding is added daily, accompanied by mixing of the pack material to promote aeration and aerobic decomposition (composting). This composting action leads to the production of heat and microbial activity that promotes breakdown of organic components and reductions in moisture content, resulting in a drier and more stable pack. The pack material is typically removed after several months.\n", + "\n", + "**Implementation in RuFaS**\n", + "\n", + "The two types of bedded pack are modeled differently in RuFaS as their decomposition conditions and thus emission profiles differ. Bedded packs, where mixing does not occur, promote anaerobic decomposition, whereas compost bedded packs promote aerobic decomposition through regular mixing and aeration of the pack. Sawdust or shavings bedded pens may be used in situations where pens are cleaned more frequently, e.g. weekly, but these pens are not considered to be bedded packs in RuFaS. \n", + "\n", + "**Classes**" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "tbl-mn-BP-classes", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+--------------------------------+-----------------+\n", + "| Digester | Description |\n", + "+:==============================:+:===============:+\n", + "| CompostBeddedPackBarn(Storage) | bedded_pack.py |\n", + "+--------------------------------+-----------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-BP-classes\n", + "#| tbl-cap: List of classes for bedded pack.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-BP-classes.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "47890a3a", + "metadata": {}, + "source": [ + "### Required User Inputs" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "tbl-mn-BP-inputs", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+---------------------+---------------+------------------------------------------------------------------------------------------------------------------------------+\n", + "| Variable | Definition | Description |\n", + "+:====================+:=============:+:=============================================================================================================================+\n", + "| Name | -- | Unique identifier of the specific bedded pack configuration used. |\n", + "+---------------------+---------------+------------------------------------------------------------------------------------------------------------------------------+\n", + "| storage_time_period | days | The number of days that the manure/bedding pack accumulates in the pen before being removed and replaced with fresh bedding. |\n", + "+---------------------+---------------+------------------------------------------------------------------------------------------------------------------------------+\n", + "| is_mixed | true/false | A boolean indicator for whether the bedded pack is routinely mixed to intentionally promote composting activity. |\n", + "+---------------------+---------------+------------------------------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-BP-inputs\n", + "#| tbl-cap: Required inputs for the bedded pack section (`refreshed_manure_management.json`)\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-BP-inputs.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "4f136b55", + "metadata": {}, + "source": [ + "**Other Inputs**\n", + "\n", + "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. ManureStream instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$ / kgVS):\n", + "\n", + "* water \n", + "* `ammoniacal_nitrogen`\n", + "* nitrogen \n", + "* phosphorus\n", + "* potassium\n", + "* ash\n", + "* `manure_degradable_volatile_solids`\n", + "* `manure_non_degradable_volatile_solids`\n", + "* `bedding_non_degradable_volatile_solids`\n", + "* `total_solids`\n", + "* mass (equal to sum of water and total solids)\n", + "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", + "* volume\n", + "* `methane_production_potential`\n", + "\n", + "### Expected Outputs\n", + "\n", + "`ManureStream` variables representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses\n", + "\n", + "* `storage_methane` (kg): Total mass of CH4 emitted from the bedded pack each day.\n", + "* `storage_ammonia_N` (kg): Total mass of NH3-N emitted from the bedded pack each day.\n", + "* `storage_nitrous_oxide_N` (kg): Total mass of N2O-N emitted from the bedded pack each day.\n", + "* `storage_nitrogen_leached` (kg): Total mass of N leached from the bedded pack each day. Leached N is assumed to be lost to the environment, and is not captured in runoff that may enter a manure storage.\n", + "* `carbon_decomposition` (kg): the total quantity of manure C lost through microbial degradation of volatile solids. \n", + "\n", + "### Methodology\n", + "\n", + "**Calculate Daily Methane Generation**\n", + "\n", + "Calculates the daily mass of methane emitted from the bedded pack based on daily manure VS added to the bedded pack (through animal excretion and bedding addition) and an emission factor based on mixing activity and simulation average temperature @Hanson2024. Here and in other equations, ‘daily’ denotes the value associated with received manure added to the bedded pack on a specified simulation day.\n", + "\n", + "::: {.callout-note}\n", + "The quantity of volatile solids utilized in determination of CH4 includes only manure-excreted volatile solids; bedding volatile solids are excluded\n", + ":::" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "tbl-mn-BP-met-conv", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+---------------+-----------------------------+-----------+------------+-------------+-------------+-----+\n", + "| Mixing T/F | Average air temp (°C) | | .1 | .2 | | |\n", + "+:==============+:===========================:+:=========:+:==========:+:===========:+:===========:+:====+\n", + "| | $\\leq$ 4.6 | 4.7 - 5.8 | 5.8 - 13.9 | 14.0 - 25.1 | $\\geq$ 25.2 | |\n", + "+---------------+-----------------------------+-----------+------------+-------------+-------------+-----+\n", + "| Mixing | 0.5 | 0.5 | 1 | 1 | 1.5 | |\n", + "+---------------+-----------------------------+-----------+------------+-------------+-------------+-----+\n", + "| No mixing | 21 | 26 | 37 | 41 | 74 | |\n", + "+---------------+-----------------------------+-----------+------------+-------------+-------------+-----+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-BP-met-conv\n", + "#| tbl-cap: Methane conversion factor values for bedded pack pens, based on presence or absence of mixing and average annual air temperature.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-BP-met-conv.csv\",\n", + " colalign = [\"left\", \"center\", \"center\",\"center\",\"center\",\"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "1e86c50f", + "metadata": {}, + "source": [ + ":::{#eq-mn-met-6}\n", + "[[**MN.MET.6**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{methane (kg)} = \\text{B}_0 \\times \\text{MCF} \\times \\text{tVS}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* B$_0$ = methane production potential (kg CH4 per kg manure VS) of manure excreted onto the lot on a specified simulation day\n", + "* Constant Value: 0.24 m$^3$ CH4/kg VS\n", + "* MCF = methane conversion factor (@tbl-mn-BP-met-conv), based on simulation average ambient temperature\n", + "* tVS (kg) = daily mass (kg) of manure-excreted total VS in the bedded pack manure, received from `ManureStream(s)`; note that bedding VS are not included in this value\n", + "\n", + "**Calculate Carbon Decomposition**\n", + "\n", + "In addition to microbial processes that occur in anaerobic conditions, which generate primarily CH4 and CO2, carbon in the manure/bedding mixture is also degraded through aerobic microbial processes. This process is a function of substrate availability/degradability, temperature, moisture, aeration, and microbial population. This series of calculations is based on the IFSM composting simulation method [@bonifacio2017a; @bonifacio2017b]. Simplifications/assumptions that have been made which diverge from the original method are explicitly noted below. \n", + "\n", + "First, we calculate the maximum decomposition rate per day, and decomposition rate of the slow fraction per day. We use the same equation for both rates, however, the temperature value used in calculating maximum decomposition rate is 60 ℃, versus 30 ℃ in calculating slow fraction degradation. The maximum decomposition rate value is set to 0.04195 and the slow fraction decomposition rate is set to 0.00846, but the equations and set values are shown below for reference.\n", + "\n", + ":::{#eq-mn-sto-4 style=\"font-size:90%\"}\n", + "[[**MN.STO.4**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{max\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", + "&\\qquad \\times (1.066^{(\\text{DECOMPOSITION\\_TEMPERATURE}-10)} - 1.21^{(\\text{DECOMPOSITION\\_TEMPERATURE}-50)})\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", + "* `DECOMPOSITION_TEMPERATURE`: temperature of the inner compost layer, set to 60℃ (reflective of temperature at which microbial growth, and thus decomposition, is maximized)\n", + "\n", + ":::{#eq-mn-sto-5 style=\"font-size:90%\"}\n", + "[[**MN.STO.5**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{slow\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", + "&\\qquad \\times (1.066^{(\\text{DEFAULT\\_LAYER\\_TEMPERATURE}-10)} - 1.21^{(\\text{DECOMPOSITION\\_TEMPERATURE}-50)})\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", + "* `DEFAULT_LAYER_TEMPERATURE`: temperature of the pack layer, set to 30℃ Setting the layer temperature to a constant value is a simplification as manure pack temperature is not modeled dynamically at this time.\n", + "\n", + "Second, we calculate the carbon decomposition rate per day (`calculate_carbon_decomposition_rate`). The value of this parameter is equal to 0.03876, but the equation and set values are included below for reference. \n", + "\n", + ":::{#eq-mn-sto-6 style=\"font-size:90%\"}\n", + "[[**MN.STO.6**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{C\\_decomp\\_rate} &= (\\text{max\\_decomp\\_rate} - \\text{slow\\_decomp\\_rate}) \\\\[8pt] \n", + "&\\qquad \\times e^{\\text{FIRST\\_ORDER\\_DECAYING\\_COEFFICIENT} \\times (\\text{DEFAULT\\_DAYS\\_SINCE\\_LAST\\_MIXING} - \\text{DEFAULT\\_LAG\\_TIME})} \\\\[8pt]\n", + "&\\qquad + \\text{slow\\_decomp\\_rate}\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `max_decomp_rate` and `slow_decomp_rate` calculated with [MN.STO.4]{#eq-mn-sto-4}, set to 0.04195 and 0.00846, respectively \n", + "* `FIRST_ORDER_DECAYING_COEFFICIENT`: First-order decaying coefficient constant, set to 0.10\n", + "* `DEFAULT_DAYS_SINCE_LAST_MIXING`: number of days from the start of pack formation or last mixing event, set to 1 by default\n", + "* `lag`: lag time in days to reach maximum decomposition rate, set to 2\n", + "\n", + "Third, we calculate the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. This value is set to 0.9664, but the equation and fixed values are provided below for reference. \n", + "\n", + ":::{style=\"font-size:90%\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{max\\_decomp\\_rate} &= \\frac{\\text{oxygen\\_mole\\_fraction}}{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_mole\\_fraction}} \\\\[8pt]\n", + "&\\qquad \\times \\frac{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_ambient\\_air\\_mole\\_fraction}}{\\text{oxygen\\_ambient\\_air\\_mole\\_fraction}} \\\\[8pt]\n", + "&\\qquad = \\frac{0.15}{0.02+0.15} \\times \\frac{0.02+0.21}{0.21} = 0.9664\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `oxygen_mole_fraction`: mole fraction of oxygen in the air within the bedded pack, unitless, set at 0.15. This is a simplification as oxygen content of the manure pack is not currently modeled.\n", + "* `oxygen_half_saturation_constant`: the half-saturation constant, unitless, set at 0.02 by the original publication.\n", + "* `oxygen_ambient_air_mole_fraction`: the mole fraction of oxygen in ambient air, unitless, set at 0.21 (ambient air is approximately 21% oxygen).\n", + "\n", + "Fourth, we calculate total carbon in the manure/bedding pack available for decomposition. Here we make some assumptions on the carbon content of manure degradable vs. non-degradable volatile solids. Degradable volatile solids, which originate from fecal excretion by animals, are considered to be 50\\% carbon by weight [@larney2011]. Non-degradable volatile solids, which originate primarily from bedding addition, are assumed to contain 35% carbon by weight. The total carbon available is the sum of these two quantities. \n", + "\n", + ":::{#eq-mn-sto-7}\n", + "[[**MN.STO.7**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{carbon\\_from\\_VSd (kg)} &= \\text{degradable\\_volatile\\_solids} \\\\[8pt]\n", + "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSD}\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `degradable_volatile_solids`: The degradable volatile solids (kg) in the daily manure added to the bedded pack.\n", + "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSD`: the carbon content (%) of manure degradable volatile solids, set to 50% by default. \n", + " \n", + "\n", + ":::{#eq-mn-sto-8}\n", + "[[**MN.STO.8**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{carbon\\_from\\_VSnd (kg)} &= \\text{non\\_degradable\\_volatile\\_solids} \\\\[8pt] \n", + "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSND}\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `nondegradable_volatile_solids`: The non-degradable volatile solids (kg) in the daily bedding and manure added to the bedded pack. \n", + "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSND`: the carbon content (%) of manure non-degradable volatile solids, set to 35% by default. \n", + "\n", + ":::{#eq-mn-sto-9}\n", + "[[**MN.STO.9**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{total\\_carbon (kg)} = \\text{carbon\\_from\\_VSnd} + \\text{carbon\\_from\\_VSd}\n", + "$$\n", + ":::\n", + "\n", + "Finally, we calculate total carbon decomposition in kg/d using the coefficients and values calculated in the steps above (`calculate_carbon_decomposition`): \n", + "\n", + ":::{#eq-mn-sto-10 style=\"font-size:90%\"}\n", + "[[**MN.STO.10**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{total\\_carbon\\_decomposition (kg)} &= \\text{total\\_carbon} \\times \\text{C\\_decomp\\_rate} \\times \\text{anaerobic\\_effect} \\\\[8pt]\n", + "&\\qquad \\times \\text{DEFAULT\\_MOISTURE\\_EFFECT\\_MICROBIAL\\_DECOMP} \n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `total_carbon`: total carbon available in manure pack (kg); [MN.STO.9]{#eq-mn-sto-9}\n", + "* `C_decomp_rate`: carbon decomposition rate per day; [MN.STO.6]{#eq-mn-sto-6}\n", + "* `DEFAULT_MOISTURE_EFFECT_MICROBIAL_DECOMP`: The effect of moisture on microbial decomposition, set at 0.65. This is a simplification as moisture content of the manure pack is not currently modeled. \n", + "* `anaerobic_effect`: the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. Set to 0.9664 by default.\n", + "\n", + "**Calculate Total VS Loss** `_apply_dry_matter_loss`\n", + "\n", + "The quantity of total and volatile solids remaining in the accumulated bedded pack must be updated according to estimated CH4 and C decomposition losses. To do this, we calculate the total loss of VS through CH4 emission and C decomposition. Loss of mass through CH4 emissions is assumed to be equal to the mass of CH4 emitted. Manure volatile solids are assumed to be 50% C, therefore, to determine total mass loss through C decomposition, we divide the mass of C decomposition by 0.50. Importantly, volatile solids destruction is attributed only to manure-excreted volatile solids; bedding volatile solids destruction is not considered at this time.\n", + "\n", + ":::{#eq-mn-sto-11}\n", + "[[**MN.STO.11**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{total\\_volatile\\_solids\\_loss (kg)} = \\text{methane} + \\frac{\\text{total\\_carbon\\_decomposition}}{0.50}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `methane` (kg): The daily methane loss, calculated with [MN.MET.6]{#eq-mn-met-6}, based on the daily quantity of manure VS added to the bedded pack\n", + "* `total_carbon_decomposition` (kg): quantity of C lost through microbial decomposition (kg), calculated with [MN.STO.10]{#eq-mn-sto-10}, based on the daily quantity of manure VS added to the bedded pack\n", + "\n", + "**Calculate N Loss to Ammonia** `_calculate_cbpb_ammonia_emission`\n", + "\n", + "Manure nitrogen being deposited and accumulating in the bedded pack results in NH3 emissions. Here we utilize an emission factor based on mixing activity [@Hanson2024] to estimate total kg of ammonia loss based on the daily manure N deposition by animals. \n", + "\n", + ":::{#eq-mn-amm-8}\n", + "[[**MN.AMM.8**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{storage\\_ammonia\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{ammonia\\_coefficient}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `daily_maure_N`: Daily kg of manure N added to the bedded pack\n", + "* `ammonia_coefficient`: kg of NH3-N emitted per kg of manure N added per day to the bedded pack, based on the style of management:\n", + " * Bedded pack (no mixing) = `AMMONIA_EMISSION_COEFFICIENT_WITH_UNTILLED_BEDDING` (0.25) \n", + " * Compost bedded pack (mixing) = `AMMONIA_EMISSION_COEFFICIENT_WITH_TILLED_BEDDING` (0.50)\n", + "\n", + "**Calculate N loss to Nitrous Oxide** `_calculate_cbpb_nitrous_oxide_emission`\n", + "\n", + "In addition to NH3-N emissions, manure nitrogen deposition in the bedded pack also results in N2O emissions. Similar to NH3, we estimate daily N2O-N loss using an emissions factor from Hanson et al. (2024) based on the type of management used. \n", + "\n", + ":::{}\n", + "[See [MN.NIT.1](#eq-mn-nit-1)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{storage\\_nitrous\\_oxide\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{nitrous\\_oxide\\_coefficient}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `daily_maure_N`: Daily kg of manure N added to the bedded pack\n", + "* `ammonia_coefficient`: kg of NH3-N emitted per kg of manure N added per day to the bedded pack, based on the style of management:\n", + " * Bedded pack (no mixing) = `NITROUS_OXIDE_EMISSION_COEFFICIENT_WITH_UNTILLED_BEDDING` (0.01) \n", + " * Compost bedded pack (mixing) = `NITROUS_OXIDE_EMISSION_COEFFICIENT_WITH_TILLED_BEDDING` (0.07)\n", + "\n", + "**Calculate N Loss to Leaching** `calculate_nitrogen_loss_to_leaching`\n", + "\n", + "Manure nitrogen deposited in bedded packs may also be lost to leaching. Leaching of manure N may occur when fecal and urinary N are converted to nitrate in the soil beneath the bedded pack, if the pack is not concrete, lined, or otherwise sealed. Nitrate can then be carried away via water movement through the subsoil. Similar to NH3 and N2O, we estimate daily leaching-N loss using an emissions factor from @Hanson2024, which is not influenced by management of the bedded pack (i.e., mixing activity). \n", + "\n", + ":::{#eq-mn-sto-12}\n", + "[[**MN.STO.12**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{storage\\_leached\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{LEACHING\\_COEFFICIENT}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `daily_maure_N`: Daily kg of manure N added to the bedded pack\n", + "* `LEACHING_COEFFICIENT`: kg of N leached per kg of manure N added per day to the open lot; set at 0.035.\n", + "\n", + "### Received, stored, and emptied outputs\n", + "\n", + "Manure storages in RuFaS report two types of outputs to OutputManager each day: received manure and stored manure. \n", + "\n", + "**Received Manure**\n", + "\n", + "Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values. \n", + "\n", + "**Stored Manure**\n", + "\n", + "Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In bedded pack processors, daily losses include CH4, NH3, and N2O emissions, and N leaching. The order of operations in updating accumulated manure values is: \n", + "\n", + "* Add received manure values to stored manure values\n", + "* Calculate gas emissions and total nutrient losses based on stored manure values\n", + "* Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. \n", + "\n", + "For bedded pack and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. \n", + "\n", + "**Emptied Manure**\n", + "\n", + "Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and `ManureStream` attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage.\n", + "\n", + "### Manure Composition Update\n", + "\n", + "**Received Manure**\n", + "\n", + "Received manure simply refers to the manure being loaded into the manure storage each day (i.e., deposited in the bedded pack). In bedded pack processors, the following nutrient sources are represented in received manure values:\n", + "\n", + "* `ManureStream` values, as received from the previous processor(s) in the manure management chain. In bedded pack processors, which are placed first in the manure management chain as there are no intermediary steps between animal excretion and the bedded pack, this `ManureStream` instance typically represents manure and bedding received directly from the Animal module.\n", + "* Daily precipitation volume/mass is **not** currently represented in received bedded pack manure.\n", + "\n", + "**Stored Manure**\n", + "\n", + "Below is a summary of updates to `ManureStream` variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", + "\n", + "Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. Received manure simply refers to the manure being loaded into the manure storage each day. " + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "tbl-mn-BP-calc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| Variable | Units | Calculation |\n", + "+:=======================================+:========:+:=======================================================================================+\n", + "| water | kg | Stored manure water + received manure water |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| total_ammoniacal_nitrogen | kg | max (0, stored manure ammoniacal N + received ammoniacal N - NH$_3$-N emissions) |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| nitrogen | kg | Stored manure N + received manure N - NH$_3$-N - N$_2$O-N emissions |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| phosphorus | kg | Stored manure P + received manure P |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| potassium | kg | Stored manure K + received manure K |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| ash | kg | Stored manure ash + received manure ash |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| degradable_volatile_solids | kg | stored degradable VS + received degradable VS - VSd loss |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| manure_non_degradable_volatile_solids | kg | stored manure non-degradable VS + received manure non-degradable VS - VSnd loss |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| bedding_non_degradable_volatile_solids | kg | stored bedding non-degradable VS + received bedding non-degradable VS |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| total_solids | kg | Stored TS + received TS - VS loss |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| volume | m$^3$ | Stored volume + received volume - \\frac{\\text{VS_loss}}{\\text{SOLID\\_MANURE\\_DENSITY}} |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-BP-calc\n", + "#| tbl-cap: Calculated manure storage variables and their units.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-BP-calc.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "ef23cf6f", + "metadata": {}, + "source": [ + "## Open Lot\n", + "\n", + "### Introduction\n", + "\n", + "Open or dry lot dairy systems are systems in which cows are housed outdoors in earthen or concrete pens. The open lot surface typically consists of natural or compacted soil covered with accumulated dry manure. Open lot pens often contain some form of shelter to provide shade and protection from harsh weather conditions, under which bedding may be applied, especially during winter. In addition to the dirt/manure pack lot, these systems also typically have a segregated feed feeding area, which may include a concrete apron that cows stand and deposit manure upon while eating. Manure deposited in this area may be managed differently from manure deposited on the lot surface.\n", + "\n", + "To manage the manure on the lot surface, farmers commonly harrow the surface to spread out, break up, and mix fresh manure into the existing dry pack, to facilitate drying and create a standing and lying surface mainly consisting of dry manure solids. Harrowing is usually performed daily, which results in mixing of the soil/dry manure pack and fresh manure and urine. When cows deposit urine and manure on the lot surface, the dry climate and low humidity typical to regions where these systems are common facilitate rapid drying and ammonia (NH3) volatilization from urine. Harrowing activity also promotes volatilization of NH3 through mixing of fresh urine and manure. Though NH3 losses may be high, the harrowing/spreading action also serves to create a lighter, more aerated pack that emits less methane (CH4) than other manure storage methods, such as slurry or liquid manure storage; however, these same aerobic conditions can also lead to greater nitrous oxide (N2O) emissions from the lot surface.\n", + "\n", + "Manure is allowed to accumulate on the lot surface for several weeks to months, and may be either spread flat or partially piled in the pen during this period. Lots are cleaned out typically via scraping with large equipment 1-2 times per year. Manure removed from lots may be immediately field applied, stacked/piled until field application, composted, or managed in other ways. Of note is that, while the majority of manure on open lot dairies may be managed as a solid, open lot dairies with milking animals will also utilize a slurry or liquid manure storage to store, at a minimum, milking parlor waste. Feed apron waste, lot runoff, or other waste may also be stored as a liquid.\n", + "\n", + "**Implementation in RuFaS**\n", + "\n", + "In the Open Lot processor, we receive manure information from the animal module and manure management information from user inputs. Given weather data, we then calculate daily nutrient losses through CH4, N2O, and NH3 emissions, as well as N leaching and C decomposition. We update the composition of the accumulated manure mix each day as manure and urine are added and nutrients are lost through the processes mentioned.\n", + "\n", + "Important assumptions:\n", + "\n", + "* Harrowing is assumed to be performed daily. At this time, differences in lot manure harrowing or piling frequency are not reflected in calculation of emissions/losses.\n", + "* Gas emissions in this processor are based on annual emissions factors that are extrapolated to a daily timestep, meaning that calculations are made based on daily excretion of manure VS or N, rather than accumulated quantities of the nutrients. With this, for N and NH3 emissions for example, manure is assumed to lose all estimated NH3-N on the day it is excreted. Manure N accumulation in lot manure is tracked, but accumulated manure N does not influence NH3 emissions.\n", + "\n", + "**Classes**" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "tbl-mn-OL-classes", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+------------------+-----------------+\n", + "| | Description |\n", + "+:================:+:===============:+\n", + "| Storage(OpenLot) | open_lot.py |\n", + "+------------------+-----------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-OL-classes\n", + "#| tbl-cap: Classes available in open lots.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-OL-classes.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "c1ac4b7c", + "metadata": {}, + "source": [ + "### Required User Inputs" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "tbl-mn-OL-inputs", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+---------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Variable | Units | Description |\n", + "+:===================:+:========:+:============================================================================================================================================================================================================================+\n", + "| storage_time_period | days | The interval in days that the open lot pen is cleaned out, i.e. the majority of manure, either already in piles or spread across the lot surface, is scraped or otherwise collected from the lot and removed from the pen. |\n", + "+---------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-OL-inputs\n", + "#| tbl-cap: Required inputs for the open lots section.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-OL-inputs.csv\",\n", + " colalign = [\"center\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "03aca473", + "metadata": {}, + "source": [ + "**Other Inputs**\n", + "\n", + "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. `ManureStream` instances include the following variables (all in kg except for volume, m$^3$ and manure methane potential, m$^3$ / kgVS):\n", + "\n", + "* water \n", + "* `ammoniacal_nitrogen`\n", + "* nitrogen \n", + "* phosphorus\n", + "* potassium\n", + "* ash\n", + "* `manure_degradable_volatile_solids`\n", + "* `manure_non_degradable_volatile_solids`\n", + "* `bedding_non_degradable_volatile_solids`\n", + "* `total_solids`\n", + "* mass (equal to sum of water and total solids)\n", + "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", + "* volume\n", + "* `methane_production_potential`\n", + "\n", + "### Expected Outputs\n", + "\n", + "* `ManureStream` variables representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses\n", + "* `storage_methane` (kg): Total mass of CH4 emitted from the open lot manure each day.\n", + "* `storage_ammonia_N` (kg): Total mass of NH3-N emitted from the open lot manure each day.\n", + "* `storage_nitrous_oxide_N` (kg): Total mass of N2O-N emitted from the open lot manure each day.\n", + "* `storage_nitrogen_leached` (kg): Total mass of N leached from the open lot manure each day. Leached N is assumed to be lost to the environment, and is not captured in lot runoff that may enter a manure storage.\n", + "* `carbon_decomposition` (kg): the total quantity of manure C lost through microbial degradation of volatile solids. \n", + "\n", + "### Methodology\n", + "\n", + "**Calculate Methane Conversion Factor** `calculate_ifsm_methane_emission`\n", + "\n", + "Calculates the methane conversion factor for open lot manure given the ambient air temperature using an equation from IFSM [@Rotz2023]. This method is an adaptation of the @IPCC2006 tier 2 approach. Note that the MCF cannot be lower than 0.\n", + "\n", + ":::{#eq-mn-met-5}\n", + "[[**MN.MET-5**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{MCF} = max(0, \\frac{0.0625 \\times \\text{T} - 0.25}{100})\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* T = ambient air temperature, 0 to 30℃\n", + "\n", + "**Calculate Daily Methane Generation** `calculate_ifsm_methane_emission`\n", + "\n", + "Calculates the daily mass of methane emitted from the open lot based on daily manure volatile solids (VS) added to lot manure (through animal excretion and bedding addition) and the emission factor calculated in [MN.MET.5]{#eq-mn-met-5}. Here and in other equations, ‘daily’ denotes the value associated with received manure added to the open lot on a specified simulation day.\n", + "\n", + "::: {.callout-note}\n", + "The quantity of volatile solids utilized in determination of CH4 includes only manure-excreted volatile solids; bedding volatile solids are excluded\n", + ":::\n", + "\n", + ":::{#eq-mn-met-6}\n", + "[[**MN.MET-6**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{methane (kg)} = \\text{B}_0 \\times \\text{MCF} \\times \\text{tVS} \\times \\text{METHANE\\_FACTOR}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* B$_0$ = methane production potential (kg CH4 per kg manure VS) of manure excreted onto the lot on a specified simulation day\n", + "* MCF = methane conversion factor calculated in [MN.MET.5]{#eq-mn-met-5}, based on daily ambient temperature\n", + "* tVS (kg) = daily mass (kg) of manure-excreted volatile solids in the open lot pen, received from `ManureStream(s)`; bedding volatile solids are not included in this value\n", + "* `METHANE_FACTOR` = 0.67; unit conversion factor for CH4 volume to mass (kg).\n", + "\n", + "**Calculate Carbon Decomposition** `calculate_carbon_decomposition`\n", + "\n", + "In addition to microbial processes that occur in anaerobic conditions, which generate primarily CH4 and CO2, open lot manure C is also degraded through aerobic microbial processes. This process is a function of substrate availability/degradability, temperature, moisture, aeration, and microbial population. This series of calculations is based on the IFSM composting simulation method, which is described in detail in @bonifacio2017a and @bonifacio2017b. Simplifications/assumptions that have been made which diverge from the original method are explicitly noted below. \n", + "\n", + "First, we calculate the maximum decomposition rate per day, and decomposition rate of the slow fraction per day. We use the same equation for both rates, however, the temperature value used in calculating maximum decomposition rate is 60℃, versus 30℃ in calculating slow fraction degradation. The maximum decomposition rate value is set to 0.04195 and the slow fraction decomposition rate is set to 0.00846, but the equations and set values are shown below for reference. \n", + "\n", + ":::{style=\"font-size:90%\"}\n", + "[See [MN.STO.4](#eq-mn-sto-4)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{max\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", + "&\\qquad \\times (1.066^{(\\text{DECOMPOSITION\\_TEMPERATURE}-10)} - 1.21^{(\\text{DECOMPOSITION\\_TEMPERATURE}-50)})\n", + "\\end{aligned}\n", + "$$\n", + "::: \n", + " \n", + "*Where*:\n", + "\n", + "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", + "* `DECOMPOSITION_TEMPERATURE`: temperature of the inner compost layer, set to 60℃ (reflective of temperature at which microbial growth, and thus decomposition, is maximized)\n", + "\n", + ":::{style=\"font-size:90%\"}\n", + "[See [MN.STO.5](#eq-mn-sto-5)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{slow\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", + "&\\qquad \\times (1.066^{(\\text{DEFAULT\\_LAYER\\_TEMPERATURE}-10)} - 1.21^{(\\text{DEFAULT\\_LAYER\\_TEMPERATURE}-50)})\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + " \n", + "*Where*:\n", + "\n", + "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", + "* `DEFAULT_LAYER_TEMPERATURE`: temperature of the inner compost layer, set to 30℃. Setting the layer temperature to a constant value is a simplification as manure pack temperature is not modeled dynamically at this time.\n", + "\n", + "Second, we calculate the carbon decomposition rate per day (`calculate_carbon_decomposition_rate`). The value of this parameter is equal to 0.03876, but the equation and set values are included below for reference. \n", + "\n", + ":::{style=\"font-size:90%\"}\n", + "[See [MN.STO.6](#eq-mn-sto-6)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{C\\_decomp\\_rate} &= (\\text{max\\_decomp\\_rate} - \\text{slow\\_decomp\\_rate}) \\\\[8pt] \n", + "&\\qquad \\times e^{\\text{FIRST\\_ORDER\\_DECAYING\\_COEFFICIENT} \\times (\\text{DEFAULT\\_DAYS\\_SINCE\\_LAST\\_MIXING} - \\text{DEFAULT\\_LAG\\_TIME})} \\\\[8pt]\n", + "&\\qquad + \\text{slow\\_decomp\\_rate}\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `max_decomp_rate` and `slow_decomp_rate` calculated with [MN.STO.4]{#eq-mn-sto-4}, set to 0.04195 and 0.00846, respectively \n", + "* `FIRST_ORDER_DECAYING_COEFFICIENT`: First-order decaying coefficient constant, set to 0.10\n", + "* `DEFAULT_DAYS_SINCE_LAST_MIXING`: number of days from the start of pack formation or last mixing event, set to 1 by default\n", + "* `lag`: lag time in days to reach maximum decomposition rate, set to 2\n", + "\n", + "Third, we calculate the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. This value is set to 0.9664, but the equation and fixed values are provided below for reference. \n", + " \n", + ":::{style=\"font-size:90%\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{max\\_decomp\\_rate} &= \\frac{\\text{oxygen\\_mole\\_fraction}}{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_mole\\_fraction}} \\\\[8pt]\n", + "&\\qquad \\times \\frac{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_ambient\\_air\\_mole\\_fraction}}{\\text{oxygen\\_ambient\\_air\\_mole\\_fraction}} \\\\[8pt]\n", + "&\\qquad = \\frac{0.15}{0.02+0.15} \\times \\frac{0.02+0.21}{0.21} = 0.9664\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + " \n", + "*Where*:\n", + "\n", + "* `oxygen_mole_fraction`: mole fraction of oxygen in the air within the lot manure pack, unitless, set at 0.15. This is a simplification as oxygen content of the manure pack is not currently modeled.\n", + "* `oxygen_half_saturation_constant`: the half-saturation constant, unitless, set at 0.02 by the original publication.\n", + "* `oxygen_ambient_air_mole_fraction`: the mole fraction of oxygen in ambient air, unitless, set at 0.21 (ambient air is approximately 21% oxygen).\n", + "\n", + "Fourth, we calculate total carbon in the manure/bedding pack available for decomposition. Here we make some assumptions on the carbon content of manure degradable vs. non-degradable volatile solids. Degradable volatile solids, which originate from fecal excretion by animals, are considered to be 50% carbon by weight [@larney2011]. Non-degradable volatile solids, which originate primarily from bedding addition, are assumed to contain 35% carbon by weight. The total carbon available is the sum of these two quantities. \n", + "\n", + ":::{}\n", + "[See [MN.STO.7](#eq-mn-sto-7)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{carbon\\_from\\_VSd (kg)} &= \\text{degradable\\_volatile\\_solids} \\\\[8pt]\n", + "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSD}\n", + "\\end{aligned}\n", + "$$\n", + "::: \n", + "\n", + "*Where*:\n", + "\n", + "* `degradable_volatile_solids`: The degradable volatile solids (kg) in the daily manure added to the open lot.\n", + "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSD`: the carbon content (%) of manure degradable volatile solids, set to 50% by default. \n", + "\n", + ":::{}\n", + "[See [MN.STO.8](#eq-mn-sto-8)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{carbon\\_from\\_VSnd (kg)} &= \\text{non\\_degradable\\_volatile\\_solids} \\\\[8pt] \n", + "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSND}\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `non_degradable_volatile_solids`: The non-degradable volatile solids (kg) in the daily manure added to the open lot.\n", + "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSD`: the carbon content (%) of manure non-degradable volatile solids, set to 35% by default. \n", + "\n", + ":::{}\n", + "[See [MN.STO.9](#eq-mn-sto-9)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{total\\_carbon (kg)} = \\text{carbon\\_from\\_VSnd} + \\text{carbon\\_from\\_VSd}\n", + "$$\n", + ":::\n", + "\n", + "Finally, we calculate total carbon decomposition in kg/d using the coefficients and values calculated in the steps above (`_apply_dry_matter_loss`): \n", + "\n", + ":::{style=\"font-size:90%\"}\n", + "[See [MN.STO.10](#eq-mn-sto-10)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{total\\_carbon\\_decomposition (kg)} &= \\text{total\\_carbon} \\times \\text{C\\_decomp\\_rate} \\times \\text{anaerobic\\_effect} \\\\[8pt]\n", + "&\\qquad \\times \\text{DEFAULT\\_MOISTURE\\_EFFECT\\_MICROBIAL\\_DECOMP} \n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + " \n", + "*Where*:\n", + "\n", + "* `total_carbon`: total carbon available in manure pack (kg); [MN.STO.9]{#eq-mn-sto-9}\n", + "* `C_decomp_rate`: carbon decomposition rate per day; [MN.STO.10]{#eq-mn-sto-10}\n", + "* `DEFAULT_MOISTURE_EFFECT_MICROBIAL_DECOMP`: The effect of moisture on microbial decomposition, set at 0.65. This is a simplification as moisture content of the manure pack is not currently modeled. \n", + "* `anaerobic_effect`: the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. Set to 0.9664 by default.\n", + "\n", + "**Calculate Total VS Loss**\n", + "\n", + "The quantity of total and volatile solids remaining in the accumulated bedded pack must be updated according to estimated CH4 and C decomposition losses. To do this, we calculate the total loss of VS through CH4 emission and C decomposition. Loss of mass through CH4 emissions is assumed to be equal to the mass of CH4 emitted. Manure volatile solids are assumed to be 50% C, therefore, to determine total mass loss through C decomposition, we divide the mass of C decomposition by 0.50. Importantly, volatile solids destruction is attributed only to manure-excreted volatile solids; bedding volatile solids destruction is not considered at this time.\n", + "\n", + ":::{}\n", + "[See [MN.STO.11](#eq-mn-sto-11)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{total\\_volatile\\_solids\\_loss (kg)} = \\text{methane} + \\frac{\\text{total\\_carbon\\_decomposition}}{0.50}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* methane (kg): The daily methane loss, calculated with [MN.MET.6]{#eq-mn-met-6}, based on the daily quantity of manure VS added to the open lot\n", + "* `total_carbon_decomposition` (kg): quantity of C lost through microbial decomposition (kg), calculated with [MN.STO.10]{#eq-mn-sto-10}, based on the daily quantity of manure VS added to the open lot\n", + "\n", + "**Calculate N Loss to Ammonia** `_calculate_cbcp_ammonia_emission`\n", + "\n", + "Manure nitrogen being deposited and accumulating in the bedded pack results in NH3 emissions. Here we utilize an emission factor based on mixing activity [@Hanson2024] to estimate total kg of ammonia loss based on the daily manure N deposition by animals. \n", + " \n", + ":::{#eq-mn-amm-8}\n", + "[[**MN.AMM.8**]]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{storage\\_ammonia\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{ammonia\\_coefficient}\n", + "$$\n", + "::: \n", + " \n", + "*Where*:\n", + "\n", + "* `daily_manure_N`: Daily kg of manure N added to the open lot\n", + "* `AMMONIA_EMISSION_COEFFICIENT_IN_OPEN_LOTS`: kg of NH3-N emitted per kg of manure N added per day to the open lot; set at 0.36.\n", + "\n", + "**Calculate N loss to Nitrous Oxide** `_calculate_cbpb_nitrous_oxide`\n", + "\n", + "In addition to NH3-N emissions, manure nitrogen deposition in the bedded pack also results in N2O emissions. Similar to NH3, we estimate daily N2O-N loss using an emissions factor from @Hanson2024 based on the type of management used. \n", + "\n", + ":::{}\n", + "[See [MN.NIT.1](#eq-mn-nit-1)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{storage\\_nitrous\\_oxide\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{nitrous\\_oxide\\_coefficient}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `daily_manure_N`: Daily kg of manure N added to the open lot\n", + "* `NITROUS_OXIDE_COEFFICIENT_IN_OPEN_LOTS`: kg of N2O-N emitted per kg of manure N added per day to the open lot; set at 0.02.\n", + "\n", + "**Calculate N Loss to Leaching** `calculate_nitrogen_loss_to_leaching`\n", + "\n", + "Manure nitrogen deposited in bedded packs may also be lost to leaching. Leaching of manure N may occur when fecal and urinary N are converted to nitrate in the soil beneath the bedded pack, if the pack is not concrete, lined, or otherwise sealed. Nitrate can then be carried away via water movement through the subsoil. Similar to NH3 and N2O, we estimate daily leaching-N loss using an emissions factor from @Hanson2024, which is not influenced by management of the bedded pack (i.e., mixing activity). \n", + "\n", + ":::{}\n", + "[See [MN.STO.12](#eq-mn-sto-12)]{.aside .content-visible when-format=\"html\"} \n", + "$$\n", + "\\text{storage\\_leached\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{LEACHING\\_COEFFICIENT}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `daily_manure_N`: Daily kg of manure N added to the open lot\n", + "* `LEACHING_COEFFICIENT`: kg of N leached per kg of manure N added per day to the open lot; set at 0.035.\n", + "\n", + "### Received, stored, and emptied outputs\n", + "\n", + "Manure storages in RuFaS report two types of outputs to OutputManager each day: received manure and stored manure. \n", + "\n", + "**Received Manure**\n", + "\n", + "Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values. \n", + "\n", + "**Stored Manure**\n", + "\n", + "Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In open lot processors, daily losses include CH4, NH3, and N2O emissions, and N leaching. The order of operations in updating accumulated manure values is: \n", + "\n", + "* Add received manure values to stored manure values\n", + "* Calculate gas emissions and total nutrient losses based on stored manure values\n", + "* Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. \n", + "\n", + "For open lot and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. \n", + "\n", + "**Emptied Manure**\n", + "\n", + "Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and Manure Stream attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage.\n", + "\n", + "### Manure Composition Update\n", + "\n", + "**Received Manure**\n", + "\n", + "Received manure simply refers to the manure being loaded into the manure storage each day (i.e., deposited on the lot). In open lot processors, the following nutrient sources are represented in received manure values:\n", + "\n", + "* `ManureStream` values, as received from the previous processor(s) in the manure management chain. In open lot processors, which are placed first in the manure management chain as there are no intermediary steps between animal excretion and the open lot, this ManureStream instance typically represents manure and bedding received directly from the Animal module.\n", + "* Daily precipitation volume/mass is **not** currently represented in received open lot manure.\n", + "\n", + "**Stored Manure**\n", + "\n", + "Below is a summary of updates to ManureStream variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", + "\n", + "Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. Received manure simply refers to the manure being loaded into the manure storage each day. " + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "tbl-mn-OL-calc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| Variable | Units | Calculation |\n", + "+:=======================================+:========:+:=========================================================================================+\n", + "| water | kg | Stored manure water + received manure water |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| total_ammoniacal_nitrogen | kg | max(0, stored manure ammoniacal N + received ammoniacal N-NH$_3$N emissions) |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| nitrogen | kg | Stored manure N + received manure N - NH$_3$-N - N$_2$O-N emissions |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| phosphorus | kg | Stored manure P + received manure P |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| potassium | kg | Stored manure K + received manure K |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| ash | kg | Stored manure ash + received manure ash |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| degradable_volatile_solids | kg | stored degradable VS + received degradable VS - VSd loss |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| manure_non_degradable_volatile_solids | kg | stored manure non-degradable VS + received manure non-degradable VS - VSnd loss |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| bedding_non_degradable_volatile_solids | kg | stored bedding non-degradable VS + received bedding non-degradable VS |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| total_solids | kg | Stored TS + received TS - VS loss |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", + "| volume | m$^3$ | Stored volume + received volume - $\\frac{\\text{VS loss}}{\\text{SOLID\\_MANURE\\_DENSITY}}$ |\n", + "+----------------------------------------+----------+------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-OL-calc\n", + "#| tbl-cap: Calculated manure storage variables and their units.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-OL-calc.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "6eba11e4", + "metadata": {}, + "source": [ + "::: {.callout-note}\n", + "The “Max(0, )” notation prevents the ammoniacal N value from becoming negative. This is especially important early in a simulation when accumulated manure quantities that are very small compared to the fixed surface area value can lead to high ammonia emissions.\n", + "\n", + "degradable_volatile_solids_frac = received manure degradable_volatile_solids / received manure total_volatile_solids\n", + "::: \n", + "\n", + "\n", + "## Composting\n", + "\n", + "### Introduction\n", + "\n", + "Composting is a method of treating manure in which solid manure, generally with bedding or other carbon-rich material added, is purposefully managed in order to promote microbial decomposition. This naturally occurring decomposition process results in losses of both water and organic matter, resulting in a smaller volume and mass of manure the farm is required to store and handle. Composting also helps to stabilize manure by killing pathogens and weed seeds via heat generated from the decomposition process, and reduced odors. Finished compost is a useful end-product (like all well-managed manure) that can be land-applied, sold, or otherwise exported. \n", + "\n", + "To promote optimal conditions for microbial decomposition, compost requires airflow through the pile to prevent anaerobic conditions from forming. While turning is the traditional way to achieve this, several methods to accomplish the necessary aeration of compost exist on farms today.\n", + "\n", + "**Implementation in RuFaS**\n", + "\n", + "The following composting methods are represented in RuFaS:\n", + "\n", + "* Static pile: material to be composted is piled and not turned/moved throughout the composting process. Aeration is maintained using either bulking agents to create airspace in the pile, or through forced air introduction via pipes.\n", + "* Intensive windrow: material to be composted is piled into long rows that are regularly turned to redistribute moisture, nutrients, and air through the pile.\n", + "* Passive windrow: material to be composted is piled into long rows, but is not regularly turned, and instead relies on passive air diffusion to aerate the pile.\n", + "* In-vessel: material to be composted is loaded into a large vessel, often a drum, which is mechanically rotated to promote uniform air circulation and heating.\n", + "\n", + "At this time, turning frequency, pile composition, composting duration, C:N ratio, and other factors do not directly affect emissions or nutrient loss calculations. Only the general composting method and the basic composition (kg of N, volatile solids, etc.) of material added to the pile is factored into this submodule’s calculations at this time.\n", + "\n", + "**Classes**" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "tbl-mn-CP-classes", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+---------------------+-----------------+\n", + "| | Description |\n", + "+:===================:+:===============:+\n", + "| Storage(Composting) | composting.py |\n", + "+---------------------+-----------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-CP-classes\n", + "#| tbl-cap: Classes available in composting.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-CP-classes.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "bdfda126", + "metadata": {}, + "source": [ + "### Required User Inputs" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "tbl-mn-CP-inputs", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+---------------------+---------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Variable | Definition | Description |\n", + "+:====================+:=============================================================:+:=============================================================================================================================================+\n", + "| Name | -- | Unique identifier of the specific handler configuration used. |\n", + "+---------------------+---------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| storage_time_period | days | The number of days that the manure is stored between emptying events. At the end of this interval, the manure storage is emptied completely. |\n", + "+---------------------+---------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| composting_type | static pile, passive windrow, intensive windrow, or in-vessel | The type of method used for composting. |\n", + "+---------------------+---------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-CP-inputs\n", + "#| tbl-cap: Required inputs for the composting section (`refreshed_manure_management.json`).\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-CP-inputs.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "779e91f9", + "metadata": {}, + "source": [ + "**Other Inputs**\n", + "\n", + "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. `ManureStream` instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$ / kgVS):\n", + "\n", + "* water \n", + "* `ammoniacal_nitrogen`\n", + "* nitrogen \n", + "* phosphorus\n", + "* potassium\n", + "* ash\n", + "* `manure_degradable_volatile_solids`\n", + "* `manure_non_degradable_volatile_solids`\n", + "* `bedding_non_degradable_volatile_solids`\n", + "* `total_solids`\n", + "* mass (equal to sum of water and total solids)\n", + "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", + "* volume\n", + "* `methane_production_potential`\n", + "\n", + "### Expected Outputs\n", + "\n", + "* `ManureStream variables` representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses\n", + "* `storage_methane` (kg): Total mass of CH4 emitted from the compost each day.\n", + "* `storage_ammonia_N` (kg): Total mass of NH3-N emitted from the compost each day.\n", + "* `storage_nitrous_oxide_N` (kg): Total mass of N2O-N emitted from the compost each day.\n", + "* `storage_nitrogen_leached` (kg): Total mass of N leached from the compost each day. Leached N is assumed to be lost to the environment, and is not captured in runoff that may enter a manure storage.\n", + "* `carbon_decomposition` (kg): the total quantity of manure C lost through microbial degradation of volatile solids. \n", + "\n", + "### Methodology\n", + "\n", + "**Calculate Daily Methane Generation** `_calculate_composting_methane_emissions`\n", + "\n", + "Calculates the daily mass of methane emitted from the compost based on manure volatile solids (VS) added to compost (from animal excretion and bedding addition) and an emission factor based on composting method and simulation average temperature described in @tbl-mn-CP-met-conv [@Hanson2024]. Here and in other equations, ‘daily’ denotes the value associated with received manure added to the open lot on a specified simulation day.\n", + "\n", + "::: {.callout-note}\n", + "The quantity of volatile solids utilized in determination of CH4 includes only manure-excreted volatile solids; bedding volatile solids are excluded.\n", + "::: " + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "tbl-mn-CP-met-conv", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------+----------------------------+---------+---------+--------+\n", + "| Composting Method | Average air temp (°C) | | .1 | |\n", + "+:=====================+:==========================:+:=======:+:=======:+:=======+\n", + "| | 0 - 10 | 10 - 18 | > 18 | |\n", + "+----------------------+----------------------------+---------+---------+--------+\n", + "| In-vessel | 0.5 | 0.5 | 0.5 | |\n", + "+----------------------+----------------------------+---------+---------+--------+\n", + "| Static pile | 1.0 | 2.0 | 2.5 | |\n", + "+----------------------+----------------------------+---------+---------+--------+\n", + "| Intensive windrow | 0.5 | 1.0 | 1.5 | |\n", + "+----------------------+----------------------------+---------+---------+--------+\n", + "| Passive windrow | 1.0 | 2.0 | 2.5 | |\n", + "+----------------------+----------------------------+---------+---------+--------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-CP-met-conv\n", + "#| tbl-cap: Required inputs for the composting section (`refreshed_manure_management.json`).\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-CP-met-conv.csv\",\n", + " colalign = [\"left\", \"center\", \"center\", \"center\",]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "6c352473", + "metadata": {}, + "source": [ + ":::{}\n", + "[See [MN.MET.6](#eq-mn-met-6)]{.aside .content-visible when-format=\"html\"} \n", + "$$\n", + "\\text{methane (kg)} = \\text{B}_0 \\times \\text{MCF} \\times \\text{tVS}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* B$_0$ = methane production potential (kg CH4 per kg manure VS) of manure excreted into the bedded pack on a specified simulation day\n", + "* MCF = methane conversion factor, based on simulation average ambient temperature\n", + "* tVS (kg) = daily mass (kg) of manure-excreted total VS in the bedded pack manure, received from `ManureStream(s)`; note that bedding VS are not included in this value\n", + "* `METHANE_FACTOR` = 0.67; unite conversion factor for CH4 volume to mass (kg)\n", + "\n", + "**Calculate Carbon Decomposition** `calculate_carbon_decomposition`\n", + "\n", + "Carbon in the compost material is degraded through primarily aerobic microbial processes. This process is a function of substrate availability/degradability, temperature, moisture, aeration, and microbial population. This series of calculations is based on the IFSM composting simulation method, which is described in detail in @bonifacio2017a and @bonifacio2017b. Simplifications/assumptions that have been made which diverge from the original method are explicitly noted below. \n", + "\n", + "First, we calculate the maximum decomposition rate per day, and decomposition rate of the slow fraction per day. We use the same equation for both rates, however, the temperature value used in calculating maximum decomposition rate is 60℃, versus the actual ambient air temperature in calculating slow fraction degradation. The maximum decomposition rate value is set to 0.04195, but the equation is shown below for reference.\n", + "\n", + ":::{style=\"font-size:90%\"}\n", + "[See [MN.STO.4](#eq-mn-sto-4)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{max\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", + "&\\qquad \\times (1.066^{(\\text{DECOMPOSITION\\_TEMPERATURE}-10)} - 1.21^{(\\text{DECOMPOSITION\\_TEMPERATURE}-50)})\n", + "\\end{aligned}\n", + "$$\n", + "::: \n", + "\n", + "*Where*:\n", + "\n", + "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", + "* `DECOMPOSITION_TEMPERATURE`: temperature of the inner compost layer, set to 60℃ (reflective of temperature at which microbial growth, and thus decomposition, is maximized)\n", + "\n", + ":::{}\n", + "[See [MN.STO.5](#eq-mn-sto-5)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{slow\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", + "&\\qquad \\times (1.066^{(\\text{daily\\_temperature}-10)} - 1.21^{(\\text{daily\\_temperature}-50)})\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + " \n", + "*Where*:\n", + "\n", + "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", + "* `daily_temperature`: average ambient air temperature on a single day (℃)\n", + "\n", + "Second, we calculate the carbon decomposition rate per day (`calculate_carbon_decomposition_rate`). The value of this parameter is equal to 0.03876, but the equation and set values are included below for reference. \n", + "\n", + ":::{style=\"font-size:90%\"}\n", + "[See [MN.STO.6](#eq-mn-sto-6)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{C\\_decomp\\_rate} &= (\\text{max\\_decomp\\_rate} - \\text{slow\\_decomp\\_rate}) \\\\[8pt] \n", + "&\\qquad \\times e^{\\text{FIRST\\_ORDER\\_DECAYING\\_COEFFICIENT} \\times (\\text{DEFAULT\\_DAYS\\_SINCE\\_LAST\\_MIXING} - \\text{DEFAULT\\_LAG\\_TIME})} \\\\[8pt]\n", + "&\\qquad + \\text{slow\\_decomp\\_rate}\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `max_decomp_rate` and `slow_decomp_rate` calculated with [MN.STO.4]{@eq-mn-sto-4} and [MN.STO.5]{#eq-mn-sto-5}\n", + "* `FIRST_ORDER_DECAYING_COEFFICIENT`: First-order decaying coefficient constant, set to 0.10\n", + "* `DEFAULT_DAYS_SINCE_LAST_MIXING`: number of days from the start of composting or last turning/mixing event, set to 1 (i.e., assuming daily mixing)\n", + "* `lag`: lag time in days to reach maximum decomposition rate, set to 2\n", + "\n", + "\n", + "Third, we calculate the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. This value is set to 0.9664, but the equation and fixed values are provided below for reference. \n", + "\n", + ":::{style=\"font-size:90%\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{max\\_decomp\\_rate} &= \\frac{\\text{oxygen\\_mole\\_fraction}}{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_mole\\_fraction}} \\\\[8pt]\n", + "&\\qquad \\times \\frac{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_ambient\\_air\\_mole\\_fraction}}{\\text{oxygen\\_ambient\\_air\\_mole\\_fraction}} \\\\[8pt]\n", + "&\\qquad = \\frac{0.15}{0.02+0.15} \\times \\frac{0.02+0.21}{0.21} = 0.9664\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `oxygen_mole_fraction`: mole fraction of oxygen in the air within the windrow, unitless, set at 0.15. This is a simplification as oxygen content of the manure pack is not currently modeled.\n", + "* `oxygen_half_saturation_constant`: the half-saturation constant, unitless, set at 0.02 by the original publication.\n", + "* `oxygen_ambient_air_mole_fraction`: the mole fraction of oxygen in ambient air, unitless, set at 0.21 (ambient air is approximately 21% oxygen).\n", + " \n", + "Fourth, we calculate total carbon in the compost material available for decomposition. Here we make some assumptions on the carbon content of manure degradable vs. non-degradable volatile solids. Degradable volatile solids, which originate from fecal excretion by animals, are considered to be 50% carbon by weight @larney2011. Non-degradable volatile solids, which originate primarily from bedding addition, are assumed to contain 35\\% carbon by weight. The total carbon available is the sum of these two quantities. \n", + "\n", + ":::{}\n", + "[See [MN.STO.7](#eq-mn-sto-7)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{carbon\\_from\\_VSd (kg)} &= \\text{degradable\\_volatile\\_solids} \\\\[8pt]\n", + "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSD}\n", + "\\end{aligned}\n", + "$$\n", + "::: \n", + "\n", + "*Where*:\n", + "\n", + "* `degradable_volatile_solids`: The degradable volatile solids (kg) in the daily manure added to the compost.\n", + "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSD`: the carbon content (%) of manure degradable volatile solids, set to 50% by default. \n", + "\n", + ":::{}\n", + "[See [MN.STO.8](#eq-mn-sto-8)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{carbon\\_from\\_VSnd (kg)} &= \\text{non\\_degradable\\_volatile\\_solids} \\\\[8pt] \n", + "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSND}\n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `non_degradable_volatile_solids`: The non-degradable volatile solids (kg) in the daily bedding and manure added to the compost.\n", + "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSD`: the carbon content (%) of manure non-degradable volatile solids, set to 35% by default. \n", + "\n", + ":::{}\n", + "[See [MN.STO.9](#eq-mn-sto-9)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{total\\_carbon (kg)} = \\text{carbon\\_from\\_VSnd} + \\text{carbon\\_from\\_VSd}\n", + "$$\n", + ":::\n", + "\n", + "Finally, we calculate total carbon decomposition in kg/d using the coefficients and values calculated in the steps above (`calculate_carbon_decomposition`): \n", + "\n", + ":::{style=\"font-size:90%\"}\n", + "[See [MN.STO.10](#eq-mn-sto-10)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\begin{aligned}\n", + "\\text{total\\_carbon\\_decomposition (kg)} &= \\text{total\\_carbon} \\times \\text{C\\_decomp\\_rate} \\times \\text{anaerobic\\_effect} \\\\[8pt]\n", + "&\\qquad \\times \\text{DEFAULT\\_MOISTURE\\_EFFECT\\_MICROBIAL\\_DECOMP} \n", + "\\end{aligned}\n", + "$$\n", + ":::\n", + " \n", + "*Where*:\n", + "\n", + "* `total_carbon`: total carbon available in manure pack (kg); [MN.STO.9]{#eq-mn-sto-9}\n", + "* `C_decomp_rate`: carbon decomposition rate per day; [MN.STO.10]{#eq-mn-sto-10}\n", + "* `DEFAULT_MOISTURE_EFFECT_MICROBIAL_DECOMP`: The effect of moisture on microbial decomposition, set at 0.65. This is a simplification as moisture content of the manure pack is not currently modeled. \n", + "* `anaerobic_effect`: the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. Set to 0.9664 by default. \n", + "\n", + "**Calculate Total VS Loss** `_apply_dry_matter_loss`\n", + "\n", + "The quantity of total and volatile solids remaining in the compost each day must be updated according to estimated CH4 and C decomposition losses. To do this, we calculate the total daily loss of VS through CH4 emission and C decomposition. Loss of mass through CH4 emissions is assumed to be equal to the mass of CH4 emitted. Manure volatile solids are assumed to be 50% C, therefore, to determine total mass loss through C decomposition, we divide the mass of C decomposition by 0.50. \n", + "\n", + ":::{}\n", + "[See [MN.STO.11](#eq-mn-sto-11)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{total\\_volatile\\_solids\\_loss (kg)} = \\text{methane} + \\frac{\\text{total\\_carbon\\_decomposition}}{0.50}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* methane (kg): The daily methane loss, calculated with [MN.MET.6]{#eq-mn-met-6}, based on the daily quantity of manure VS added to the compost\n", + "* `total_carbon_decomposition` (kg): quantity of C lost through microbial decomposition (kg), calculated with [MN.STO.10]{#eq-mn-sto-10}, based on the daily quantity of manure VS added to the compost\n", + "\n", + "**Calculate N Loss to Ammonia** `_calculate_composting_ammonia_emissions`\n", + "\n", + "Manure nitrogen being added to and accumulating in the compost results in NH3 emissions. Here we utilize daily manure N addition to compost and an emission factor based on composting method @Hanson2024 to estimate total kg of NH3-N loss." + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "tbl-mn-CP-NH3-fac", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------+-----------------------------------------------------+\n", + "| Composting method | kg NH$_3$-N emitted per kg of N added to compost |\n", + "+:====================:+:===================================================:+\n", + "| In-vessel | 0.45 |\n", + "+----------------------+-----------------------------------------------------+\n", + "| Static Pile | 0.5 |\n", + "+----------------------+-----------------------------------------------------+\n", + "| Intensive Windrow | 0.5 |\n", + "+----------------------+-----------------------------------------------------+\n", + "| Passive Windrow | 0.45 |\n", + "+----------------------+-----------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-CP-NH3-fac\n", + "#| tbl-cap: NH$_3$-N emission factors for compost by composting method.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-CP-NH3-fac.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "1663a5f7", + "metadata": {}, + "source": [ + ":::{}\n", + "[See [MN.AMM.8](#eq-mn-amm-8)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{storage\\_ammonia\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{ammonia\\_coefficient}\n", + "$$\n", + "::: \n", + " \n", + "*Where*:\n", + "\n", + "* `daily_manure_N`: Daily kg of manure N added to compost\n", + "* `AMMONIA_EMISSION_COEFFICIENT_IN_OPEN_LOTS`: kg of NH3-N emitted per kg of manure N added per day to compost, based on the composting method\n", + "\n", + "**Calculate N Loss to Nitrous Oxide** `_calculate_nitrous_oxide_emissions`\n", + "\n", + "In addition to NH3-N emissions, nitrogen added to and accumulating in the compost also results in N$_2$O emissions. Similar to NH3, here we utilize daily manure N addition to compost and an emission factor based on composting method @Hanson2024 to estimate total kg of N$_2$O-N loss." + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "tbl-mn-CP-N2O-fac-a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------+-----------------------------------------------------+\n", + "| Composting method | kg NH$_3$-N emitted per kg of N added to compost |\n", + "+:====================:+:===================================================:+\n", + "| In-vessel | 0.006 |\n", + "+----------------------+-----------------------------------------------------+\n", + "| Static Pile | 0.01 |\n", + "+----------------------+-----------------------------------------------------+\n", + "| Intensive Windrow | 0.005 |\n", + "+----------------------+-----------------------------------------------------+\n", + "| Passive Windrow | 0.005 |\n", + "+----------------------+-----------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-CP-N2O-fac-a\n", + "#| tbl-cap: N$_2$O-N emission factors for compost by composting method.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-CP-N2O-fac-a.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "1419dc33", + "metadata": {}, + "source": [ + ":::{}\n", + "[See [MN.NIT.1](#eq-mn-NIT-1)]{.aside .content-visible when-format=\"html\"}\n", + "$$\n", + "\\text{storage\\_nitrous\\_oxide\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{nitrous\\_oxide\\_coefficient}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `daily_manure_N`: Daily kg of manure N added to the compost\n", + "* `NITROUS_OXIDE_COEFFICIENT_IN_OPEN_LOTS`: kg of N2O-N emitted per kg of manure N added per day to the compost, based on the composting method\n", + "\n", + "**Calculate N Loss to Leaching** `calculate_nitrogen_loss_to_leaching`\n", + "\n", + "Nitrogen in compost may also be lost to leaching. Leaching of compost N may occur when fecal and urinary N are converted to nitrate in the soil beneath the compost, if the compost is not contained in a vessel. Nitrate can then be carried away via water movement through the subsoil. Similar to NH3 and N2O, we use daily manure N addition to compost and an emission factor based on composting method @Hanson2024 to estimate total kg of leaching N loss." + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "tbl-mn-CP-N2O-fac", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------+-----------------------------------------------------+\n", + "| Composting method | kg NH$_3$-N emitted per kg of N added to compost |\n", + "+:====================:+:===================================================:+\n", + "| In-vessel | 0 |\n", + "+----------------------+-----------------------------------------------------+\n", + "| Static Pile | 0.06 |\n", + "+----------------------+-----------------------------------------------------+\n", + "| Intensive Windrow | 0.06 |\n", + "+----------------------+-----------------------------------------------------+\n", + "| Passive Windrow | 0.04 |\n", + "+----------------------+-----------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-CP-N2O-fac\n", + "#| tbl-cap: N$_2$O-N emission factors for compost by composting method.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-CP-N2O-fac.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "0195cbb9", + "metadata": {}, + "source": [ + ":::{}\n", + "[See [MN.STO.12](#eq-mn-sto-12)]{.aside .content-visible when-format=\"html\"} \n", + "$$\n", + "\\text{storage\\_leached\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{LEACHING\\_COEFFICIENT}\n", + "$$\n", + ":::\n", + "\n", + "*Where*:\n", + "\n", + "* `daily_manure_N`: Daily kg of manure N added to the compost\n", + "* `LEACHING_COEFFICIENT`: kg of N leached per kg of manure N added per day to the compost, based on composting method\n", + "\n", + "### Received, stored, and emptied outputs\n", + "\n", + "**Received Manure**\n", + "\n", + "Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values.\n", + "\n", + "**Stored Manure**\n", + "\n", + "Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In composting processors, daily losses include CH4, NH3, N leaching, and N2O emissions. The order of operations in updating accumulated manure values is: \n", + "\n", + "1. Add received manure values to stored manure values\n", + "2. Calculate gas emissions and total nutrient losses based on received manure values\n", + "3. Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. \n", + " \n", + "For composting and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. \n", + "\n", + "**Emptied Manure**\n", + "\n", + "Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and Manure Stream attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage.\n", + "\n", + "### Manure Composition Update\n", + "\n", + "**Received Manure**\n", + "\n", + "In composting processors, the following nutrient sources are represented in received manure values:\n", + "\n", + "* `ManureStream values`, as received from the previous processor(s) in the manure management chain. \n", + "* For composting processors, these `ManureStream` instance(s) typically represent an accumulated quantity of manure from an open lot or bedded pack, daily/weekly cleanout of the manure/bedding mix generated by other pen types, or daily addition of separated manure solids. \n", + "\n", + "Daily precipitation volume/mass is not currently represented in received manure added to compost (i.e., precipitation falling each day is not represented in the received manure outputs representing nutrient/mass/water additions to compost each day).\n", + "\n", + "**Stored Manure**\n", + "\n", + "Below is a summary of updates to ManureStream variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", + "\n", + "Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. " + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "tbl-mn-CP-calc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| Variable | Units | Calculation |\n", + "+:=======================================+:========:+:=======================================================================================+\n", + "| water | kg | Stored manure water + received manure water |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| total_ammoniacal_nitrogen | kg | max (0, stored manure ammoniacal N + received ammoniacal N - NH$_3$-N emissions) |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| nitrogen | kg | Stored nitrogen + received nitrogen - NH$_3$-N - N$_2$O-N emissions |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| phosphorus | kg | Stored phosphorus + received phosphorus |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| potassium | kg | Stored potassium + received potassium |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| ash | kg | Stored ash + received ash |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| degradable_volatile_solids | kg | stored degradable VS + received degradable VS - VSd loss |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| manure_non_degradable_volatile_solids | kg | stored manure non-degradable VS + received manure non-degradable VS - VSnd loss |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| bedding_non_degradable_volatile_solids | kg | stored bedding non-degradable VS + received bedding non-degradable VS |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| total_solids | kg | Stored TS + received TS - VS loss |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", + "| volume | m$^3$ | Stored volume + received volume - \\frac{\\text{VS_loss}}{\\text{SOLID\\_MANURE\\_DENSITY}} |\n", + "+----------------------------------------+----------+----------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-CP-calc\n", + "#| tbl-cap: Manure storage variable calculations\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-CP-calc.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "6b213014", + "metadata": {}, + "source": [ + "::: {.callout-note}\n", + "The “Max(0, )” notation prevents the ammoniacal N value from becoming negative. This is especially important early in a simulation when accumulated manure quantities that are very small compared to the fixed surface area value can lead to high ammonia emissions.\n", + "\n", + "degradable_volatile_solids_frac = received manure degradable_volatile_solids / received manure total_volatile_solids\n", + "::: \n", + "\n", + "## Daily Spread\n", + "\n", + "### Introduction\n", + "\n", + "Daily spread is a method of manure management in which manure is collected daily (or several times per week) directly from animal housing areas and field-applied. This manure management strategy may be more labor intensive but can greatly reduce the quantity of manure a farm must store. \n", + "\n", + "**Implementation in RuFaS**\n", + "\n", + "Daily spread in RuFaS is implemented as essentially a \"blank\" manure processor. It receives manure but does not estimate any gas emissions, nutrient losses, or changes to manure composition. \n", + "\n", + "::: {.callout-note}\n", + "Note that this section covers strictly the Manure Module daily spread functionality; the actual daily application of manure from the manure module occurs in the Crop and Soil module and is thus covered in the Crop and Soil documentation.\n", + ":::\n", + "\n", + "**Classes**" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "tbl-mn-DS-classes", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+----------------------+-----------------+\n", + "| Digester | Description |\n", + "+:====================:+:===============:+\n", + "| DailySpread(Storage) | daily_spread.py |\n", + "+----------------------+-----------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-DS-classes\n", + "#| tbl-cap: List of classes for daily spread\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-DS-classes.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "6b04442d", + "metadata": {}, + "source": [ + "### Required User Inputs" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "tbl-mn-DS-inputs", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+------------+----------+-------------------------------------------------------------------+\n", + "| Variable | Units | Description |\n", + "+:==========:+:========:+:==================================================================+\n", + "| name | -- | Unique identifier of the specific daily spread configuration used |\n", + "+------------+----------+-------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-DS-inputs\n", + "#| tbl-cap: Required inputs for the daily spread section (`refreshed_manure_management.json`)\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-DS-inputs.csv\",\n", + " colalign = [\"center\", \"center\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "8e5e223d", + "metadata": {}, + "source": [ + "**Other Inputs**\n", + "\n", + "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. `ManureStream` instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$ / kgVS):\n", + "\n", + "* water \n", + "* `ammoniacal_nitrogen`\n", + "* nitrogen \n", + "* phosphorus\n", + "* potassium\n", + "* ash\n", + "* `manure_degradable_volatile_solids`\n", + "* `manure_non_degradable_volatile_solids`\n", + "* `bedding_non_degradable_volatile_solids`\n", + "* `total_solids`\n", + "* mass (equal to sum of water and total solids)\n", + "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", + "* volume\n", + "* `methane_production_potential`\n", + "\n", + "### Expected Outputs\n", + "\n", + "* ManureStream variables representing manure received by daily spread processor each day\n", + "\n", + "## Key constants" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "tbl-mn-constants", + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| Variable | Value | Definition |\n", + "+:======================================+:===============================:+:=====================================================================================================+\n", + "| MANURE_DAMPING_FACTOR | 0.65 | Fixed damping factor applied to the air temperature amplitude |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| MANURE_TEMPERATURE_LAG | 30 d | Lag constant representing delayed thermal response of manure temperature relative to air temperature |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| ANAEROBIC_LAGOON_MANURE_RETENTION | 0.1 | Fraction of stored manure retained in anaerobic lagoon when storage interval is reached |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| ACTIVATION_ENERGY | 81 000 J/mol | Apparent activation energy of methanogenesis in dairy manure |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DEFAULT_STORED_MANURE_PH | 7.5 | Default pH of manure in slurry storage or anaerobic lagoon |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| FREEBOARD_CONSTANT | 1.2 | 20% volume allowance above max volume if surface area not user-defined |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DEPTH_CONSTANT | 4.572 m | Depth of slurry/liquid manure storage used for surface area calculation |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| PRECIPITATION_CONSTANT | 0.25 m | Annual precipitation constant for determining storage surface area |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| MANURE_CONVERSION_CONSTANT | 0.1175 m$^3$ | Factor to estimate manure volume per cow per day |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| METHANE_DESTRUCTION_EFFICIENCY | 0.81 | Percent methane destroyed with cover and flare system |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| VS_TO_METHANE_LOSS_RATIO | 6.665 kg | Mass ratio of CO2+CH4 to CH4 from storage |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| NATURAL_LOG_ARRHENIUS_CONSTANT | 30.6 g CH4/kg VS/h | Log of Arrhenius parameter for methane emissions from stored manure |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| STORAGE_RESISTANCE | 23.1 s/m | Default resistance to ammonia volatilization |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| SLURRY_MANURE_DENSITY | 990 kg/m$^3$ | Default density of manure as excreted. |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| AMMONIA_EMISSION_COEFFICIENT_UNTILLED | 0.25 | Ammonia emission coefficient (no mixing) |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| AMMONIA_EMISSION_COEFFICIENT_TILLED | 0.5 | Ammonia emission coefficient (with mixing) |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DEFAULT_DAYS_SINCE_LAST_MIXING | 1 d | Days since last mixing for C decomposition |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| NITROUS_OXIDE_EMISSION_UNTILLED | 0.01 | N2O-N emitted per kg manure N/day (no mixing) |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| NITROUS_OXIDE_EMISSION_TILLED | 0.07 | N2O-N emitted per kg manure N/day (with mixing) |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| HOUSING_SPECIFIC_CONSTANT | 260.0 s/m | Default constant for ammonia emissions from housing |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DEFAULT_PH_FOR_HOUSING_AMMONIA | 7.7 | Default pH for manure on housing floors |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| MILKING_FRESH_WATER_USE_RATE | 30 L/animal/day | Milking water use rate per animal |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| WATER_DENSITY_KG_PER_M3 | 0.997 kg/m$^3$ | Default water density |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| CARBON_DIOXIDE_MOLAR_MASS | 44.01 g/mol | Molar mass of CO2 |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| CARBON_DIOXIDE_TO_METHANE_RATIO | 4-6 | Volumetric ratio of CO2 to CH4 during digestion |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| IDEAL_GAS_LAW_R | 0.0821 L atm/mol K | Ideal gas law constant |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| METHANE_MOLAR_MASS | 16.04 g/mol | Molar mass of CH4 |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| TAN_INCREASE_FACTOR | 1.60 | TAN increase from anaerobic digestion (unitless) |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DEFAULT_LAYER_TEMPERATURE | 30°C | Default layer temperature for decomposition |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DECOMPOSITION_TEMPERATURE | 60°C | Temperature for peak microbial activity |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DEFAULT_CARBON_FRACTION_VSD | 0.5 | Carbon content of degradable VS |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DEFAULT_CARBON_FRACTION_VSND | 0.35 | Carbon content of non-degradable VS |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DEFAULT_MOISTURE_EFFECT | 0.65 | Moisture effect on microbial decomposition |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DEFAULT_LAG_TIME | 2 d | Lag time for C decomposition |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| EFFECTIVE_MICROBIAL_DECOMP_RATE | 0.00237 | Microbial decomposition rate (unitless) |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| FIRST_ORDER_DECAY_COEFFICIENT | 0.01 | First-order decay coefficient |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| LEACHING_COEFFICIENT | -- | N leached per kg manure N/day |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| DEFAULT_DAYS_SINCE_LAST_HARROW | 1 d | Days since last harrow event |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| ACHIEVABLE_METHANE_EMISSION | 0.24 m$^3$ CH4/kg VS | Achievable methane generation |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| SOLID_MANURE_DENSITY | 700 kg/m$^3$ | Default solid manure density |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", + "| LIQUID_MANURE_DENSITY | 1000 kg/m$^3$ | Default liquid manure density |\n", + "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "#| label: tbl-mn-constants\n", + "#| tbl-cap: Key constants for all equations in the Manure Module.\n", + "import_table(\n", + " \"../resources/table_data/manure/tbl-mn-constants.csv\",\n", + " colalign = [\"left\", \"center\", \"left\"]\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "614f3626", + "metadata": {}, + "source": [ + "## References" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3", + "path": "c:\\Users\\jms349\\GitHub\\RuFaS\\.venv\\share\\jupyter\\kernels\\python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.0" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-calc.csv b/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-calc.csv new file mode 100644 index 0000000000..9541e32274 --- /dev/null +++ b/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-calc.csv @@ -0,0 +1,12 @@ +Variable, Units, Calculation +water, kg , stored manure water + received manure water +total_ammoniacal_nitrogen, kg ," max(0,stored manure ammoniacal nitrogen + received ammoniacal nitrogen - NH$_3$N emissions) " +nitrogen, kg , stored manure nitrogen + received manure nitrogen - NH$_3$N emissions - N$_2$O-N emissions +phosphorus, kg , stored manure phosphorus + received manure phosphorus +potassium, kg , stored manure potassium + received manure potassium +ash, kg , stored manure ash + received manure ash +degradable_volatile_solids, kg , stored degradable VS + received degradable VS - VSd loss +manure_non_degradable_volatile_solids, kg , stored manure non-degradable VS + received manure non-degradable VS - manure VSnd loss +bedding_non_degradable_volatile_solids, kg , stored bedding non-degradable VS + received bedding non-degradable VS - bedding VSnd loss +total_solids, kg , stored total solids + received total solids - VSd loss - VSnd los) +volume, m$^3$, stored volume + Received volume- $\frac{\text{VSd loss}+\text{VSnd loss}}{\text{SLURRY\_MANURE\_DENSITY}$ diff --git a/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-classes.csv b/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-classes.csv new file mode 100644 index 0000000000..7b2030ce55 --- /dev/null +++ b/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-classes.csv @@ -0,0 +1,2 @@ +Anaerobic Lagoon, Description +AnaerobicLagoon (Storage),anaerobic_lagoon.py diff --git a/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-inputs.csv b/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-inputs.csv new file mode 100644 index 0000000000..a9e272583d --- /dev/null +++ b/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-inputs.csv @@ -0,0 +1,6 @@ +Variable, Units, Description +Name, -- , Unique identifier of the specific anaerobic lagoon configuration used. +Capacity, m$^3$," The volumetric capacity of the anaerobic lagoon, in m$^3$. Note that this variable is a placeholder at this time, and does not influence model calculations. " +Cover, -- ,The type of cover used with the anaerobic lagoon. +Surface_area, m$^2$, The surface area of the anaerobic lagoon at the minimum operating level. +Storage_time_period, days ," The number of days that manure is stored between emptying events. At the end of this interval, the manure storage is emptied completely. " From fb2af58201f2a1260e44ee0febe617ff161feece Mon Sep 17 00:00:00 2001 From: jadamchick <146877580+jadamchick@users.noreply.github.com> Date: Thu, 9 Jul 2026 10:16:13 -0400 Subject: [PATCH 3/4] more anaerobic lagoon updates --- docs/scientific/quarto-scidoc/qmd/manure.qmd | 2 +- .../quarto-scidoc/qmd/manure.quarto_ipynb_1 | 3800 ----------------- 2 files changed, 1 insertion(+), 3801 deletions(-) delete mode 100644 docs/scientific/quarto-scidoc/qmd/manure.quarto_ipynb_1 diff --git a/docs/scientific/quarto-scidoc/qmd/manure.qmd b/docs/scientific/quarto-scidoc/qmd/manure.qmd index 851bc929a9..f09546f529 100644 --- a/docs/scientific/quarto-scidoc/qmd/manure.qmd +++ b/docs/scientific/quarto-scidoc/qmd/manure.qmd @@ -1300,7 +1300,7 @@ Equations in the table below (Calculation column) are in the format of: updated #| label: tbl-mn-AL-calc #| tbl-cap: Manure storage variable calculations. import_table( - "../resources/table_data/manure/tbl-mn-SS-calc.csv", + "../resources/table_data/manure/tbl-mn-AL-calc.csv", colalign = ["left", "center", "left"] ) ``` diff --git a/docs/scientific/quarto-scidoc/qmd/manure.quarto_ipynb_1 b/docs/scientific/quarto-scidoc/qmd/manure.quarto_ipynb_1 deleted file mode 100644 index a23bb8095e..0000000000 --- a/docs/scientific/quarto-scidoc/qmd/manure.quarto_ipynb_1 +++ /dev/null @@ -1,3800 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6ff7a0ab", - "metadata": {}, - "source": [ - "![Manure module icon](../resources/images/man_icon.png){width=25%}\n", - "# Manure Module\n", - "" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "e29ac7c6", - "metadata": {}, - "outputs": [], - "source": [ - "import sys\n", - "sys.path.append(\"../scripts\")\n", - "from markdown_tables import import_table, display_md_tbl, read_tbl" - ] - }, - { - "cell_type": "markdown", - "id": "90da1b01", - "metadata": {}, - "source": [ - "## Introduction\n", - "\n", - "The responsibility of the manure module in RuFaS is to simulate the loss and/or gain of manure mass and nutrients on a daily timestep at each step of the manure management chain on a dairy farm. On the majority of farms, manure represents an important link in the cycling of nutrients through animals, land, crops, and back to animals. Therefore, modeling both greenhouse gas (GHG) emissions as well as non-GHG nutrient and losses is crucial in capturing nutrient flows through the whole-farm system. \n", - "\n", - "The manure module accomplishes its responsibilities by tracking a critical, core set of variables called `ManureStream` variables, which include key agronomic nutrients (N, P, K), carbon (e.g. total and volatile solids), water, ash, mass, and volume. The Manure Module receives manure excretion and bedding information from the animal module, then passes manure through the manure management chain, until manure is either applied to fields or exported. The specific steps of the manure management chain are user-defined, and the individual steps/options in manure management chains are referred to as `processors`. The exact chemical, physical, or other processes that occur at each step along the management chain depend on what type of processor the manure is being held in. For example, parlor cleaning processors, which represent removing manure from the milking parlor and holding areas, principally add water to manure but do not estimate GH emissions or other nutrient losses. A slurry storage outdoor processor (a type of manure storage), however, estimates daily methane CH4 and ammonia (NH3-N) losses, which are then reflected by reducing the quantity of nutrients remaining in the stored manure at the end of the day. \n", - "\n", - "### Structural setup of the Manure Module\n", - "\n", - "Processors in the Manure Module fall into four basic classes, with multiple types available within each class. The processor classes are intended to represent the common, primary steps in manure management. They include manure handling (which refers to the daily activities of cleaning and removing manure from facilities or managing it in place), storage, and manure treatment, such as anaerobic digestion or mechanical solid liquid separation. " - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "tbl-mn-process-type", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+-----------+--------------------------------------------------------------------------------------------------------+\n", - "| Classes | Types |\n", - "+:==========+:=======================================================================================================+\n", - "| Handler | Manual Scraping; Alley Scraper; Flus System; Parlor Cleaning |\n", - "+-----------+--------------------------------------------------------------------------------------------------------+\n", - "| Digester | Continuous Mix |\n", - "+-----------+--------------------------------------------------------------------------------------------------------+\n", - "| Separator | Screw Press; Rotary Press |\n", - "+-----------+--------------------------------------------------------------------------------------------------------+\n", - "| Storage | Composting; Open Lot; Bedded Pack; Slurry Storage Outdoor; Slurry Storage Underfloor; Anaerobic Lagoon |\n", - "+-----------+--------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-process-type\n", - "#| tbl-cap: Examples of processor types by class.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-process-type.csv\",\n", - " colalign = [\"left\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "04398285", - "metadata": {}, - "source": [ - "How manure moves between processors is based on defining the destination processor that any one processor should send its manure to, and the proportion(s) of manure from the originating processor that should go there. For example, if 50% of manure from a single pen is routed to storage A, and 50% to storage B, the manure handler processor assigned to that pen will have two destinations defined (storage A and storage B), with the proportion going to each defined as 0.50. By controlling destinations and proportions, the user is able to define aggregating (i.e., assigning manure from two separate processors to the same destination) and splitting (assigning manure from one processor to two or more locations) behavior. A visual example is below and illustrates the manure management chain without RuFaS-specific syntax. The next figure illustrates RuFaS-specific information (e.g. specific processor names, creation of manure streams in the animal module, etc.). Note that the splitting of manure generated from singular pens in the Animal Module is covered in the Animal to Manure Connection section. \n", - "\n", - "![Real world example of a simplistic manure management chain](../resources/images/man_flow_types.png){#fig-man-flow-types}\n", - "\n", - "![Manure management chain with RuFaS specific information reflected](../resources/images/man_flow_req_inputs.png){#fig-man-flow-req-inputs}\n", - "\n", - "### Overview of Required Inputs\n", - "\n", - "There are two general categories of input required from the user: \n", - "\n", - "1. Which processors are used and how do they work (processor-specific configurations) e.g., storage time length, use of a cover \n", - "2. Destination and proportion(s) allocated to destination(s) of manure passed from each processor \n", - "\n", - "Information on inputs required and options available for each individual processor are outlined in the individual processor documentation. \n", - "\n", - "For defining destinations and proportions, there are very few rules and restrictions on how manure can be moved between processors. The primary rule for defining processor destinations is that users cannot define loops, i.e., manure from a processor “downstream” in a manure management chain cannot return its manure to a processor “upstream”.\n", - "\n", - "::: {.callout-note}\n", - "The assignment of manure generated in the Animal Module (which also reflects the quantity of bedding used) to its destination in the Manure Module occurs in the Animal Module. See the Animal to Manure Connection section for more information. \n", - ":::\n", - "\n", - "### General Assumptions of the Manure Module\n", - "\n", - "* All manure is recovered unless otherwise specifically stated. For example, all manure excreted by animals is assumed to be captured by manure handlers, all manure in a manure storage is assumed to be completely removed when the storage is emptied (unless explicitly noted in the specific processor’s documentation), etc. \n", - "* Manure moves through the manure management chain once, and only once, per day. With this, values are reported on a daily timestep, and represent the current state at the end of the given day (e.g. CH4 emissions from this day, amount of N left in storage on this day, etc.). \n", - " * Storage processors include a user-defined “storage time”, during which manure accumulates in the storage until reaching the end of the time interval, at which point it is passed to the next processor or exported, if the storage comes last in the manure chain. The minimum storage time value is 1, thus manure cannot move through more than one storage per day. \n", - " * For processors without a storage time option, manure is assumed to move through the processor immediately. E.g., on a single day, excreted manure may move through a handler, continuous mix digester, separator, and into composting storage, with each processor reporting the quantity and composition of manure they either passed to the next processor or are holding in storage.\n", - "* The Manure Module adheres to the principle of mass balance, meaning, the quantity of manure nutrients remaining in manure is proportional to the quantity of the nutrient lost through biological or physical processes. The same is true for additions of mass/nutrients.\n", - " * One current exception to this is N loss. N losses are not currently reflected in the total mass of manure; this exception will be addressed and corrected in the near future. \n", - "\n", - "**Manure Storage Assumptions**\n", - "\n", - "* Received manure nutrients entering a storage are added to accumulated mass/nutrient quantities prior to calculating gas emissions each day.\n", - "* When the end of the storage’s user defined storage time is reached, the accumulated manure in storage is removed completely and entirely, and is passed to the next processor in the chain (e.g., a subsequent storage, field application, etc.).\n", - "* Emptying intervals (in days) are defined by the user in equal lengths at this time, e.g., manure storage can be emptied every 3 months (e.g. in April, July, October, January) but cannot be emptied in April, then 2 months later in June, and then 3 months later in September. However, timing of storage emptying (e.g. April and October emptying vs. May and November emptying) can be set according to the general simulation dates to simulate more realistic manure removal behavior.\n", - "\n", - "\n", - "## Manure Handler\n", - "\n", - "\n", - "### Introduction \n", - "\n", - "### Methodology\n", - "\n", - "#### Relevant Inputs\n", - "\n", - "#### Relevant Outputs\n", - "\n", - "### Manure Composition Update\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "## Solid Liquid Separators\n", - "\n", - "### Introduction\n", - "\n", - "A solid-liquid separator (SLS) is a specialized piece of equipment or system designed to separate larger, solid particles from the liquid component of manure. This type of system may be implemented for a variety of reasons, such as to improve ease of handling of manure liquid, improve the nutrient concentration in manure liquid, reduce storage volume required for manure lagoons or other storage systems, prevent solid accumulation in a covered manure storage, or reclaim manure solids for use as bedding or compost. \n", - " \n", - "The solid fraction of manure slurry is composed of fibers originating primarily from manure, but also from feed, bedding, and other environmental sources. Once mechanically separated, the moisture content of the solid fraction ranges from 70% to 90%, depending on the specific separator system used. To further reduce moisture content of the separated solids, an additional dewatering or drying step may be incorporated. Manure solids may be directly used or sold for animal bedding (after stabilization), composted, or land applied. \n", - " \n", - "After the manure solids are mechanically separated, the remaining liquid fraction is composed of small particles, water, and most of the nutrients present in the manure. Because the bulk of relevant nutrients (e.g., P, N, K) are mainly associated with the small particles which remain with the liquid fraction after separation occurs, separating the larger, less nutrient-dense particles out from the slurry liquid enriches the concentration of these nutrients in the liquid fraction. Solid-liquid separation also makes the manure slurry easier to pump, transport, and apply to fields, as large particles that may clog lines and sprayers are removed.\n", - "\n", - "**Implementation in RuFaS**\n", - "\n", - "In RuFaS, solid liquid separators currently represent mechanical, short retention time pieces of equipment. GHG emissions and other nutrient transformations from long-retention separators such as weeping walls or settling basins are not yet represented in the model. Because of this, the impact of these longer retention separators can only be approximated via modification of the separation efficiencies of the short retention time methods.\n", - "\n", - "Currently, SLS inputs are simply nutrient-specific separation efficiencies that reflect the proportion of a specific nutrient that is separated into the solids fraction. With this, essentially any type of mechanical manure separation system can be modeled, as long as effective separation efficiencies are known. Manure is assumed to be loaded, processed, and passed to the next processor within a single day. Default separation efficiencies exist for two common types of SLS - a screw press and a rotary screen. The separated manure solids and remaining liquid fraction are quantified and can be managed in separate, downstream manure management systems in RuFaS. However, separated solids cannot be directly recycled (i.e., utilized with the specific nutrient composition of those separated solids) “upstream” as bedding. \n", - "\n", - "**Classes**" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "tbl-mn-SLS-classes", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+-----------------------+-----------------+\n", - "| Handlers | Description |\n", - "+:=====================:+:===============:+\n", - "| Separator (Processor) | `separator.py` |\n", - "+-----------------------+-----------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-SLS-classes\n", - "#| tbl-cap: Classes for solid liquid separators.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-SLS-classes.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "2bc01383", - "metadata": {}, - "source": [ - "### Required User Inputs" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "tbl-mn-SLS-inputs", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Variable | Definition | Description |\n", - "+:===============================+:============================:+:================================================================================================================================================================================================================+\n", - "| Name | -- | Unique identifier of the specific separator configuration used |\n", - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| type | rotary screen or screw press | The type of solid liquid separator; selection of this input indicates which default separations efficiencies should be used, however, any and all separation efficiencies may also be overwritten by user input |\n", - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| separated_solids_dry_matter | -- | percent dry matter by mass of the manure solids post solid-liquid separation |\n", - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| total_solids_efficiency | -- | the proportion of manure total solids (TS) that are separated into the manure solids fraction by the separator |\n", - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| volatile_solids_efficiency | -- | the proportion of manure volatile solids (VS) that are separated into the manure solids fraction by the separator |\n", - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| nitrogen_efficiency | -- | the proportion of manure total nitrogen that is separated into the manure solids fraction by the separator |\n", - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| ammoniacal_nitrogen_efficiency | -- | the proportion of manure ammoniacal nitrogen that is separated into the manure solids fraction by the separator |\n", - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| phosphorus_efficiency | -- | the proportion of manure phosphorus that is separated into the manure solids fraction by the separator |\n", - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| potassium_efficiency | -- | the proportion of manure potassium that is separated into the manure solids fraction by the separator. |\n", - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| ash_efficiency | -- | the proportion of manure ash that is separated into the manure solids fraction by the separator |\n", - "+--------------------------------+------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-SLS-inputs\n", - "#| tbl-cap: Classes for solid liquid separators.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-SLS-inputs.csv\",\n", - " colalign = [\"left\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "cfcdb61b", - "metadata": {}, - "source": [ - "**Other Inputs**\n", - "\n", - "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. `ManureStream` instances include the following variables (all in kg except for volume, m$^3$, and manure methane potential, m$^3$ / kgVS):\n", - "\n", - "* water \n", - "* `ammoniacal_nitrogen`\n", - "* nitrogen \n", - "* phosphorus\n", - "* potassium\n", - "* ash\n", - "* `manure_degradable_volatile_solids`\n", - "* `manure_non_degradable_volatile_solids`\n", - "* `bedding_non_degradable_volatile_solids`\n", - "* `total_solids`\n", - "* mass (equal to sum of water and total solids)\n", - "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", - "* volume\n", - "* `methane_production_potential`\n", - "\n", - "### Expected Outputs\n", - "\n", - "Two sets of `ManureStream` variables:\n", - "\n", - "* Separated solids (`SeparatedSolids`) \n", - "* Liquid fraction (`SeparatedLiquid`)\n", - "\n", - "### Methodology\n", - "\n", - "**Separate Nutrients**\n", - "\n", - "The equations below describe the general process for separating nutrients between liquid and solid fractions. The general equation for nutrient removal is as follows:\n", - "\n", - ":::{#eq-mn-sep-1}\n", - "[[**MN.SEP.1**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Separated solids nutrient content} = \\text{recevied manure nutrient} \\times \\text{separation efficiency}\n", - "$$\n", - ":::\n", - "\n", - ":::{#eq-mn-sep-2}\n", - "[[**MN.SEP.2**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Separated liquid nutrient content} = \\text{recevied manure nutrient} \\times (1 - \\text{separation efficiency})\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Received manure nutrient (kg): quantity of the specific nutrient in manure being loaded into the separator on a single day. \n", - "\n", - "Nutrients that are separated according to this pattern are presented in the table below. The default separation efficiencies, as well as minimum and maximum allowable separation efficiencies, for the rotary screen and screw press separators are also provided [@Hegg1981; @Mukhtar1999; @Varma2021]. Note that separate removal efficiencies for manure degradable and non-degradable VS or bedding non-degradable VS are not specifiable at this time; all VS fractions are assumed to be removed at the rate of total VS removal. " - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "tbl-mn-SLS-sep-eff-rotary", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+-----------------+------------+--------+--------+\n", - "| Variable | Default | Min | Max |\n", - "+:================+:==========:+:======:+:======:+\n", - "| Total solids | 0.35 | 0.25 | 0.4 |\n", - "+-----------------+------------+--------+--------+\n", - "| Nitrogen | 0.3 | 0.25 | 0.35 |\n", - "+-----------------+------------+--------+--------+\n", - "| Ammoniacal N | 0.15 | 0.1 | 0.2 |\n", - "+-----------------+------------+--------+--------+\n", - "| Phosphorus | 0.4 | 0.3 | 0.45 |\n", - "+-----------------+------------+--------+--------+\n", - "| Potassium | 0.15 | 0.05 | 0.2 |\n", - "+-----------------+------------+--------+--------+\n", - "| Ash | 0.2 | 0.05 | 0.3 |\n", - "+-----------------+------------+--------+--------+\n", - "| Volatile solids | 0.35 | 0.3 | 0.45 |\n", - "+-----------------+------------+--------+--------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-SLS-sep-eff-rotary\n", - "#| tbl-cap: Classes for solid liquid separators.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-SLS-sep-eff-rotary.csv\",\n", - " colalign = [\"left\", \"center\", \"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "tbl-mn-SLS-sep-eff-screw", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+-----------------+------------+--------+--------+\n", - "| Variable | Default | Min | Max |\n", - "+:================+:==========:+:======:+:======:+\n", - "| Total solids | 0.25 | 0.15 | 0.35 |\n", - "+-----------------+------------+--------+--------+\n", - "| Nitrogen | 0.3 | 0.2 | 0.35 |\n", - "+-----------------+------------+--------+--------+\n", - "| Ammoniacal N | 0.15 | 0.05 | 0.2 |\n", - "+-----------------+------------+--------+--------+\n", - "| Phosphorus | 0.2 | 0.1 | 0.35 |\n", - "+-----------------+------------+--------+--------+\n", - "| Potassium | 0.23 | 0.15 | 0.35 |\n", - "+-----------------+------------+--------+--------+\n", - "| Ash | 0.2 | 0.05 | 0.3 |\n", - "+-----------------+------------+--------+--------+\n", - "| Volatile solids | 0.25 | 0.2 | 0.4 |\n", - "+-----------------+------------+--------+--------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-SLS-sep-eff-screw\n", - "#| tbl-cap: Classes for solid liquid separators.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-SLS-sep-eff-screw.csv\",\n", - " colalign = [\"left\", \"center\", \"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "7b2e6730", - "metadata": {}, - "source": [ - "[@Jorgensen2009; @Fournel2019]\n", - "\n", - "**Calculate Total Mass and Water**\n", - "\n", - "*Separated solids fraction*\n", - "\n", - "Total mass of the separated solids fraction is determined by dividing the mass of separated solids by the user-inputted separated solids dry matter content. \n", - "\n", - ":::{#eq-mn-sep-3}\n", - "[[**MN.SEP.3**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Separated solids mass (kg)} = \\frac{\\text{Separated solids TS}}{\\text{Separated solids %DM}}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Separated solids TS (kg): the mass of solids in the separated manure solids fraction\n", - "* Separated solids %DM: user-inputted separated solids dry matter content\n", - " \n", - "The mass of water in the separated solids fraction can then be determined as follows, given the assumption that total mass is equal to the sum of solids plus water:\n", - "\n", - "$$\n", - "\\text{Separated solids water (kg)} = \\text{Separated solids mass} - \\text{Separated solids TS}\n", - "$$\n", - "\n", - "*Separated liquids fraction*\n", - "\n", - "The total mass of the separated liquid fraction, as well as the mass of water, are simply equal to the mass and water in manure loaded into the separator, minus the quantity of each respective value partitioned into the separated solids fraction{.mark}. \n", - "\n", - "$$\n", - "\\text{Separated solids mass (kg)} = \\text{Received mass} - \\text{Separated solids mass}\n", - "$$\n", - "\n", - "$$\n", - "\\text{Separated solids water (kg)} = \\text{Received water} - \\text{Separated solids water}\n", - "$$\n", - "\n", - "**Calculate Volume**\n", - "\n", - "Volume of each separated fraction is determined by dividing the mass of each fraction by its respective density:\n", - "\n", - ":::{#eq-mn-sep-4}\n", - "[[**MN.SEP.4**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Separated solids volume}(\\text{m}^3) = \\frac{\\text{Separated solids mass}}{\\text{SOLIDS\\_MANURE\\_DENSITY}}\n", - "$$\n", - ":::\n", - "\n", - ":::{#eq-mn-sep-5}\n", - "[[**MN.SEP.5**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Separated liquid volume}(\\text{m}^3) = \\frac{\\text{Separated liquid mass}}{\\text{LIQUID\\_MANURE\\_DENSITY}}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `SOLID_MANURE_DENSITY` (kg/m$^3$): The default density of solid manure, set to 700 kg/m$^3$\n", - "* `LIQUID_MANURE_DENSITY` (kg/m$^3$): The default density of liquid manure, set to 900 kg/m$^3$\n", - "\n", - "### Manure Composition Update\n", - "\n", - "Below is a summary of updates to `ManureStream` variables. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", - "\n", - "Equations in the table below are in the format of “Output/exiting value” = “Entering processor value” +/- XYZ. “Entering” refers to the manure entering the processor (i.e., being loaded into the digester) and output variables reflect the manure leaving the processor (i.e., digestate leaving the digester). The Calculation column describes how the variable is updated in the processor." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "tbl-mn-SLS-frac-calc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| Variable | Units | Calculation (Solids Fraction) | Calculation (Liquids Fraction) |\n", - "+:=======================================+:============:+:========================================================================+:=======================================================================+\n", - "| water | kg | Separated solids mass - Separated solids TS | Entering water - Separated solids water |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| total_ammoniacal _nitrogen | kg | Entering ammoniacal nitrogen x TAN removal efficiency | Entering ammoniacal nitrogen x (1 - TAN removal efficiency) |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| nitrogen | kg | Entering nitrogen x N removal efficiency | Entering nitrogen x (1 - N removal efficiency) |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| phosphorus | kg | Entering phosphorus x phosphorus removal efficiency | Entering phosphorus x (1 - phosphorus removal efficiency) |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| potassium | kg | Entering potassium x potassium removal efficiency | Entering potassium x (1 - potassium removal efficiency) |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| ash | kg | Entering ash x potassium removal efficiency | Entering ash x (1 - potassium removal efficiency) |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| manure_degradable_volatile_solids | -- | Entering manure VSd x VS removal efficiency x degradable_VS_frac | Entering VSd x (1 - VS removal efficiency) x (1 - degradable_VS_frac) |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| manure_non_degradable_volatile_solids | -- | Entering manure VSnd x VS removal efficiency x (1 - degradable_VS_frac) | Entering VSnd x (1 - VS removal efficiency) x (1 - degradable_VS_frac) |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| bedding_non_degradable_volatile_solids | -- | Entering manure VSnd x VS removal efficiency x (1 - degradable_VS_frac) | Entering VSnd x (1 - VS removal efficiency) x (1 - degradable_VS_frac) |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| total_solids | kg | Entering TS x TS removal efficiency | Entering TS x (1 - TS removal efficiency) |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+\n", - "| volume | $\\text{m}^3$ | $\\frac{\\text{Separated solids mass}}{\\text{SOLID\\_MANURE\\_DENSITY}}$ | $\\frac{\\text{Separated liquid mass}}{\\text{LIQUID\\_MANURE\\_DENSITY}}$ |\n", - "+----------------------------------------+--------------+-------------------------------------------------------------------------+------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-SLS-frac-calc\n", - "#| tbl-cap: Solids and liquid fraction calculations for separated manure components.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-SLS-frac-calc.csv\",\n", - " colalign = [\"left\", \"center\", \"left\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "589fc055", - "metadata": {}, - "source": [ - "## Anaerobic Digestion\n", - "\n", - "### Introduction\n", - "\n", - "Anaerobic digestion is a process where dairy cow manure is treated in an oxygen-free (anaerobic) environment to produce biogas, containing approximately 60% CH4, 40% CO2, which can be utilized as an on-farm or exported energy source. Additional benefits of anaerobic digestion include reduced manure odor, improved stability and quality of manure for fertilization purposes, and reductions in nutrient losses via undesirable greenhouse gas emissions.\n", - "\n", - "Manure can undergo anaerobic digestion in a specialized anaerobic digestion chamber/system, usually referred to simply as a ‘digester’, or can occur in other manure storage systems that create anaerobic conditions, such as anaerobic lagoons. \n", - "\n", - "**Implementation in RuFaS**\n", - "\n", - "The anaerobic digestion submodule in RuFaS currently represents anaerobic digestion within an enclosed, mechanical digester system. The following assumptions are made in the RuFaS anaerobic digestion submodule:\n", - "\n", - "* The digester represented is assumed to be a mesophilic, continuous stirred-tank reactor (CSTR).\n", - "* Manure is loaded into the digester and removed from the digester once daily.\n", - "* The digester is fully functional at the start of the simulation, i.e., the digester is full of substrate and the microbial population has stabilized.\n", - "* Residence time of manure in the digester is not modeled. As a result, the composition of effluent exiting the digester each day is identical to the influent composition, with the exception of nutrient losses or transformations that occur in the digester.\n", - "* At this time, CH4 generation and volatile solids destruction is based strictly on the quantity of manure volatile solids loaded; other factors are not considered at this time.\n", - "\n", - "\n", - "The anaerobic submodule has two primary functions in RuFaS: \n", - "\n", - "* Estimate daily methane production (kg/d) based on the daily mass of manure volatile solids (VS) loaded into the digester.\n", - " * VS loading is dependent on the number and type of animals contributing manure to the digester, the diet of the animals, quantity and type of bedding, and any upstream manure handling processes, e.g., solid liquid separation, water addition, etc.\n", - "* Update the composition of the liquid manure effluent leaving the digester, which enters the anaerobic lagoon. \n", - " * Reflecting VS loss in effluent exiting the digester is essential to capture the reduction in methane emissions from digestate compared to undigested, liquid manure, as well as changes in proportion of inorganic (ammoniacal) to total nitrogen.\n", - "\n", - "**Classes**" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "tbl-mn-AD-classes", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Digester | Description |\n", - "+:==================+:================================================================================================================================================================================================================================================+\n", - "| AnaerobicDigester | anaerobic_digester.py inherits behavior from the base class, Digester; however, at this time, there is no functionality included in the base Digester class. Therefore all methods are contained within the anaerobic_digestion.py child class. |\n", - "+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-AD-classes\n", - "#| tbl-cap: List of classes for anaerobic digesters.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-AD-classes.csv\",\n", - " colalign = [\"left\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "e6966093", - "metadata": {}, - "source": [ - "### Required User Inputs" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "tbl-mn-AD-inputs", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+-------------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Variable | Units | Description |\n", - "+:==========================================+:========:+:============================================================================================================================================================================================+\n", - "| name | -- | Unique identifier of the specific anaerobic digester configuration used |\n", - "+-------------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| hydraulic_retention_time | days | Number of days manure spends in the anaerobic digester. Note that this variable is not utilized directly by the module but is utilized by the Economics Emissions and Energy module. |\n", - "+-------------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| anaerobic_digestion_temperature_set_point | ℃ | Temperature set point for the anaerobic digestion. This input is utilized in the conversion of CH$_4$ and CO$_2$ generation volume to mass; it does not directly influence CH$_4$ emissions |\n", - "+-------------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| biogas_leakage_fraction | none | Fraction of biogas generated in the anaerobic digester that escapes to the atmosphere through unintended leakage and is not collected by the gas capture system |\n", - "+-------------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-AD-inputs\n", - "#| tbl-cap: Required inputs for Anaerobic Digestion.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-AD-inputs.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "562793a9", - "metadata": {}, - "source": [ - "**Other Inputs**\n", - "\n", - "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. ManureStream instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$ / kgVS):\n", - "\n", - "* water\n", - "* `ammoniacal_nitrogen`\n", - "* nitrogen\n", - "* phosphorus\n", - "* potassium\n", - "* ash\n", - "* `manure_degradable_volatile_solids`\n", - "* `manure_non_degradable_volatile_solids`\n", - "* `bedding_non_degradable_volatile_solids`\n", - "* `total_solids`\n", - "* mass (equal to sum of water and total solids)\n", - "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", - "* volume\n", - "* `methane_production_potential`\n", - "\n", - "### Expected Outputs\n", - "\n", - "* `captured_biogas_volume` (m$^3$): Captured biogas (assumed to be composed of 40% CO2, 60% CH4) volume after accounting for leakage on the current day\n", - "* `captured_methane_volume` (m$^3$): Captured methane volume on the current day, after accounting for leakage\n", - "* `methane_leakage_mass` (kg): Mass of CH4 lost to the atmosphere through unintended leakage on the current day. This variable is expressed as mass as opposed to volume as CH4 emissions are reported in kg in the rest of the manure module and other RuFaS modules\n", - "\n", - "### Methodology\n", - "\n", - "**Calculate Daily Methane Generation**\n", - "\n", - "Calculates volume of methane (CH4) generated from a CSTR digester. Methane generation is estimated from the daily loading of manure volatile solids (VS). Degradable (VSd) and non-degradable (VSnd) VS are tracked separately but the ratio of VSd : VSnd does not affect CH4 estimation; only the total quantity of VS is considered. To perform this calculation, we make several assumptions/simplifications: \n", - "\n", - "* The ratio of chemical oxygen demand (COD): VS in dairy manure is assumed to be 1.2 to 1. 1 kg of COD can generate 0.4 kg of methane. Therefore, 1 kg VS reduction/degradation in the anaerobic digester = 1.2 kg COD = 480 L CH4. In other words, each kg VS of reduced is assumed to generate 480 L of CH4. \n", - "* A CSTR reduces manure VS content by approximately 50%. This is a generalization across CSTR digesters of varying efficiencies, based on expert opinion from W. Liao (MSU) and A. Leytem (USDA-ARS). \n", - "* Considering that 480 L of CH4 are generated per kg of VS destroyed, and approximately 50% of VS loaded are anticipated to be destroyed, we estimate CH4 generation by assuming 240 L CH4 are generated per VS kg loaded into the digester; this is also in alignment with the @IPCC2019 Tier II manure CH4 B$_0$ value.\n", - "* Lastly, the volumetric ratio of CH4 to CO2 generation in the CSTR is assumed to be 6:4 (e.g. generation of 60% CH4, 40% CO2biogas) based on commonly cited digester performance metrics (e.g., EPA, [@Fernandez2015]). The total quantity of VS destroyed in anaerobic digestion is then assumed to be equal to the quantity of CH4 and CO2 generated in the digester. This assumption is made due to a lack of data on destruction of degradable vs. non-degradable VS in anaerobic digestion.\n", - "\n", - ":::{#eq-mn-adg-1}\n", - "[[**MN.ADG.1**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{generated\\_methane\\_volume}(\\text{m}^3) &= \\text{ACHIEVABLE\\_METHANE\\_EMISSIONS} \\\\[8pt]\n", - "&\\qquad \\times \\text{total\\_volatile\\_solids (kg)}\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `ACHIEVABLE_METHANE_EMISSION` = achievable methane generation constant (m$^3$ CH4 per kg VS loaded into digester); Constant Value: 0.24 m$^3$ CH4/kg VS\n", - "* `total_volatile_solids` = daily mass (kg) of manure total volatile solids loaded into the digester, received from `ManureStream(s)`\n", - "\n", - "Lastly, we need to convert daily CH4 volume (`generated_methane_volume`) to CH4 mass. First we calculate CH4 density according to the user-provided digestion setpoint temperature, then we apply the density value to the volume of CH4 generated.\n", - "\n", - ":::{#eq-mn-adg-2 style=\"font-size:90%\"}\n", - "[[**MN.ADG.2**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{methane\\_density} = \\frac{\\text{METHANE\\_MOLAR\\_MASS}}{\\text{IDEAL\\_GAS\\_LAW\\_R} \\times (\\text{temperature\\_set\\_point} + \\text{CELSIUS\\_TO\\_KELVIN})}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `METHANE_MOLAR_MASS` (16.04 g/mol): molar mass of CH4\n", - "* `IDEAL_GAS_LAW_R` (0.0821 L atm/mol K): ideal gas law R value \n", - "* `temperature_set_point` (℃): user-provided digestion set point temperature\n", - "* `CELSIUS_TO_KELVIN` (273.15): value to convert ℃ temperature values to K\n", - "\n", - ":::{#eq-mn-adg-3}\n", - "[[**MN.ADG.3**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{generated\\_methane\\_mass}(\\text{kg}) = \\text{generated\\_methane\\_volume} \\times \\text{methane\\_density}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `generated_methane_volume` ($\\text{m}^3$): volume of CH4 generated in the digester on a single day, calculated in [MN.ADG.1]{#eq-mn-adg-1}.\n", - "\n", - "**Calculate Destroyed Volatile Solids `_destroy_volatile_solids`**\n", - "\n", - "Microbes convert (destroy) VS during anaerobic digestion and produce biogas containing primarily CH4 and CO2. Therefore, the quantity of VS is assumed to be equal to the mass of CH4 and CO2 generated. In this section, we calculate the total mass of CO2 and CH4 generated, which is used later to update the degradable and non-degradable VS values of the `ManureStream` instance passed to the next processor.\n", - "\n", - "First, we calculate the density of CO2 based on the user-provided digestion setpoint temperature.\n", - "\n", - ":::{#eq-mn-adg-4 style=\"font-size:90%\"}\n", - "[[**MN.ADG.4**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{carbon\\_dioxide\\_density} = \\frac{\\text{CARBON\\_DIOXIDE\\_MOLAR\\_MASS}}{\\text{IDEAL\\_GAS\\_LAW\\_R} \\times (\\text{temperature\\_set\\_point} + \\text{CELSIUS\\_TO\\_KELVIN})}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `CARBON_DIOXIDE_MOLAR_MASS` (44.01 g/mol): molar mass of CO2\n", - "* `IDEAL_GAS_LAW_R` (0.0821 L atm/mol K): ideal gas law R value \n", - "* `temperature_set_point` (℃): user-provided digestion set point temperature\n", - "* `CELSIUS_TO_KELVIN` (273.15): value to convert ℃ temperature values to K\n", - "\n", - "Second, we determine the quantity of CO2 volume and mass generated, assuming digester biogas contains a 60:40 volumetric ratio of CH4 to CO2. \n", - "\n", - ":::{#eq-mn-adg-5}\n", - "[[**MN.ADG.5**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{generated\\_carbon\\_dioxide} &= \\text{generated\\_methane\\_volume} \\\\[8pt]\n", - "&\\qquad \\times \\text{CARBON\\_DIOXIDE\\_TO\\_METHANE\\_RATIO} \\\\[8pt]\n", - "&\\qquad \\times \\text{CARBON\\_DIOXIDE\\_DENSITY}\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `CARBON_DIOXIDE_MOLAR_MASS` (44.01 g/mol): molar mass of CO2; Constant Value: = 4/6 L/L (0.667) \n", - "* `carbon_dioxide_density` (kg per m$^3$) = ideal gas law value to convert CO2 from mass to volume\n", - "\n", - "Third, we calculate the total destruction of total VS. \n", - "\n", - ":::{#eq-mn-adg-6 style=\"font-size:90%\"}\n", - "[[**MN.ADG.6**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{total\\_volatile\\_solids\\_destruction} = \\text{generated\\_methane\\_mass} + \\text{generated\\_carbon\\_dioxide\\_mass}\n", - "$$\n", - ":::\n", - "\n", - "We then utilize the value of `total_volatile_solids_destruction` (kg) to update VSd, manure VSnd, and bedding VSnd. As mentioned above, the total quantity of VS destroyed is partitioned between the three VS fractions according to the proportion of each fraction in manure entering the digester. E.g., if manure entering contained 60% VSd, 10% manure VSnd, and 30% bedding VSnd, 60% of destroyed VS will be subtracted from VSd, 10% from manure VSnd, and 30% from bedding VSnd.\n", - "\n", - "To do this, we calculate the ratio of VSd to VS (`degradable_volatile_solids_frac`) and manure VSd to VS and apply these fractions to the `total_volatile_solids_destruction` value to determine the updated VS fraction values.\n", - "\n", - ":::{#eq-mn-adg-7}\n", - "[[**MN.ADG.7**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{degradable\\_VS\\_frac} = \\frac{\\text{degradable\\_VS}}{\\text{total\\_VS}}\n", - "$$\n", - ":::\n", - "\n", - ":::{#eq-mn-adg-8}\n", - "[[**MN.ADG.8**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{manure\\_non\\_degradable\\_VS\\_frac} = \\frac{\\text{manure\\_non\\_degradable\\_VS}}{\\text{total\\_VS}}\n", - "$$\n", - ":::\n", - "\n", - ":::{#eq-mn-adg-9}\n", - "[[**MN.ADG.9**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{degradable\\_VS} = \\text{degradable\\_VS} - (\\text{total\\_VS\\_destruction} \\times \\text{degradable\\_VS\\_frac})\n", - "$$\n", - ":::\n", - "\n", - ":::{#eq-mn-adg-10 style=\"font-size:90%\"}\n", - "[[**MN.ADG.10**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{manure\\_non\\_degradable\\_VS} &= \\text{manure\\_non\\_degradable\\_VS} \\\\[8pt]\n", - "&\\qquad - (\\text{total\\_VS\\_destruction} \\times \\text{manure\\_non\\_degradable\\_VS\\_frac})\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - ":::{#eq-mn-adg-11 style=\"font-size:90%\"}\n", - "[[**MN.ADG.11**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{bedding\\_non\\_degradable\\_VS} &= \\text{bedding\\_non\\_degradable\\_VS} - \\text{total\\_VS\\_destruction} \\\\[8pt]\n", - "&\\qquad \\times (1 - \\text{manure\\_non\\_degradable\\_VS\\_frac} + \\text{degradable\\_VS\\_frac})\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "**Calculate Methane Leakage `_calculate_methane_leakage`**\n", - "\n", - "Calculates the volume of CH4 generated that is lost to the atmosphere via leakage. The leakage fraction is currently a user input with a default value of 1\\%, which represents a conservative leakage rate. Leakage is largely dependent on the age and type of digester and should ideally be provided by the user for specificity.\n", - "\n", - ":::{#eq-mn-adg-12}\n", - "[[**MN.ADG.12**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{methane\\_leakage\\_volume}(\\text{m}^3) = \\text{generated\\_methane\\_volume} \\times \\text{biogas\\_leakage\\_fraction}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `generated_methane_volume` (m$^3$): volume of CH4 generated in the digester on a single day, calculated in [MN.ADG.1]{#eq-mn-adg-1}\n", - "* `biogas_leakage_fraction` (%): fraction of biogas generated in the anaerobic digester that escapes to the atmosphere through unintended leakage; Default Value: 0.01 (1%)\n", - "\n", - "**Update Digestor Effluent Composition `_report_anaerobic_digestor_outputs`**\n", - "\n", - "The calculations below are some additional prerequisites to generating anaerobic digestion-specific outputs.\n", - "\n", - "The equation below is used to calculate the quantity of net, captured gas according to the quantity of biogas leakage. \n", - "\n", - ":::{#eq-mn-adg-13 style=\"font-size:90%\"}\n", - "[[**MN.ADG.13**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{captured\\_methane\\_volume}(\\text{m}^3) = \\text{generated\\_methane\\_volume} - \\text{methane\\_leakage\\_volume}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `generated_methane_volume` (m$^3$): total volume of CH4 generated in the digester on a specific day\n", - "* `methane_leakage_volume` (m$^3$): the volume of CH4 generated that is lost to the atmosphere via leakage\n", - " \n", - "The equation below is used to calculate the updated volume of manure in the digester, accounting for the volume of destroyed VS.\n", - "\n", - ":::{#eq-mn-adg-14 style=\"font-size:90%\"}\n", - "[[**MN.ADG.14**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{updated\\_volume}(\\text{m}^3) = \\text{incoming\\_volume} - \\frac{\\text{total\\_volatile\\_solids\\_destruction}}{\\text{ManureConstants.SLURRY\\_MANURE\\_DENSITY}}\n", - "$$\n", - ":::\n", - "\n", - "Microbial processes during anaerobic digestion are known to increase the proportion/mass of total ammoniacal N (TAN), though the total mass of N is generally not different pre and post-digestion [@AguirreVillegas2019]. To reflect this, the proportion of TAN in manure in the digester is multiplied by a fixed factor. The factor (`TAN_INCREASE_FACTOR`, 1.60) was chosen based on a target of ~50% loss of total N via NH3-N emissions from a subsequent digestate lagoon, as reported by the USDA GHG estimation guidelines for uncovered digestate storage [@Hanson2024].\n", - "\n", - ":::{#eq-mn-adg-15 style=\"font-size:80%\"}\n", - "[[**MN.ADG.15**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{updated\\_ammoniacal\\_nitrogen (kg)} = min(\\text{ammoniacal\\_nitrogen} \\times \\text{TAN\\_INCREASE\\_FACTOR},\\text{nitrogen})\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - " \n", - "* `ammoniacal_nitrogen` (kg): the mass of ammoniacal N in manure loaded into the digester on a single day\n", - "* `TAN_INCREASE_FACTOR`: factor by which total ammoniacal nitrogen content is increased by the anaerobic digestion process, set to 1.60\n", - "* Note that the “min” notation prevents manure TAN from exceeding manure total N\n", - "\n", - "\n", - "### Manure Composition Update\n", - "\n", - "Below is a summary of updates to `ManureStream` variables. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", - "\n", - "Equations in the table below are in the format of “Output/exiting value” = “Entering processor value” +/- XYZ. “Entering” refers to the manure entering the processor (i.e., being loaded into the digester) and output variables reflect the manure leaving the processor (i.e., digestate leaving the digester). The Calculation column describes how the variable is updated in the processor." - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "tbl-mn-AD-calc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| Variable | Units | Calculation |\n", - "+:=======================================+:========:+:==========================================================================================================================+\n", - "| water | kg | Entering water |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| total_ammoniacal_nitrogen | kg | min(entering ammoniacal_nitrogen x TAN_INCREASE_FACTOR, nitrogen |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| nitrogen | kg | Entering nitrogen |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| phosphorus | kg | Entering phosphorus |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| potassium | kg | Entering potassium |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| ash | kg | Entering ash |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| degradable_volatile_solids | -- | Entering degradable_volatile_solids - total_VS_destruction x degradable_VS_frac |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| manure_non_degradable_volatile_solids | -- | Entering non_degradable_volatile_solids - total_VS_destruction x manure_non_degradable_VS_frac |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| bedding_non_degradable_volatile_solids | -- | Entering non_degradable_volatile_solids - total_VS_destruction x (1 - degradable_VS_frac - manure_non_degradable_VS_frac) |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| total\\_solids | kg | Entering total_solids - total_VS_destruction |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+\n", - "| volume | m$^3$ | Entering volume - $\\frac{\\text{total\\_VS\\_destruction}}{\\text{ManureConstants.SLURRY\\_MANURE\\_DENSITY}}$ |\n", - "+----------------------------------------+----------+---------------------------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-AD-calc\n", - "#| tbl-cap: Calculated anaerobic digestion outputs.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-AD-calc.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "658b40da", - "metadata": {}, - "source": [ - "## Slurry Storage\n", - "\n", - "### Introduction\n", - "\n", - "Manure that is stored and managed at ~7 to 12% dry matter is generally considered to be “slurry” manure. Several common options exist for storing manure at this %DM range. Slurry may be stored in underfloor pits, where manure is deposited directly into the pit through slatted floors, or is moved to an underfloor storage via scrapers or other manure handling systems. Manure may also be transported to outdoor storage tanks or pits/basins, which may be covered or uncovered.\n", - "\n", - "Compared to anaerobic lagoons, slurry storages are typically of a smaller capacity, and do not result in controlled treatment (e.g., reduction of odor, N content reduction, organic matter decomposition) of manure. Slurry storages are typically emptied more frequently than liquid manure storages like anaerobic lagoons and contain more concentrated manure. In general, the biological processes in slurry storages and anaerobic lagoons are similar: microbes break down manure carbohydrates and proteins, resulting in CO2, CH4, and N2O emissions, and mineralization of organic to inorganic N, and N losses occur through NH3 volatilization at the manure surface. However, management of these two types of liquid manure storages differs as described above, which results in differences in emissions and nutrient losses.\n", - "\n", - "**Implementation in RuFaS**\n", - "\n", - "There are two options for slurry storage in RuFaS, slurry storage outdoor and slurry storage underfloor, which function almost identically. The key differences between the two methods are presented in @tbl-mn-SS-options Because the two methods are highly similar, both are covered in this document." - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "tbl-mn-SS-options", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+---------------------+-------------------------------------+------------------------------------------------------------------------+\n", - "| | Slurry Storage Underfloor | Slurry Storage Outdoor |\n", - "+:====================+:====================================+:=======================================================================+\n", - "| Temperature | Barn temperature method | Modeled air temperature method |\n", - "+---------------------+-------------------------------------+------------------------------------------------------------------------+\n", - "| Cover options | Only “no cover” permitted | Cover, cover and flare, crust, or no cover |\n", - "+---------------------+-------------------------------------+------------------------------------------------------------------------+\n", - "| Precipitationvolume | Precipitation excluded from storage | Precipitation excluded or included depending on cover option selection |\n", - "+---------------------+-------------------------------------+------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-SS-options\n", - "#| tbl-cap: Key differences for two options for slurry storage\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-SS-options.csv\",\n", - " colalign = [\"left\", \"left\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "e93b2266", - "metadata": {}, - "source": [ - "In the slurry storage submodules, accumulated manure in storage is modeled on a daily timestep. Nutrient/mass gains from daily addition of manure (feces/urine, bedding, wash water) to storage, and precipitation volume entering storage, are tracked. Gas emissions are calculated daily based on the quantity of nutrients in stored manure, manure temperature, storage type, use of a cover, and storage duration. Manure composition is then updated according to net nutrient losses/gains. Manure accumulates in storage until the end of the user-defined storage interval is reached. However, quantities of manure may additionally be removed from storage according to the user-defined manure application schedule. Note that at this time, water and nutrients from surface runoff, and water evaporation from storage manure, are not captured in slurry storage submodules.\n", - "\n", - "**Classes**\n", - "\n", - "Note that both slurry storage methods inherit some behavior from the base class, Storage. Because the two methods are highly similar, the content below is representative of both types of slurry storage, with specific differences between the two noted explicitly (@tbl-mn-SS-options)." - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "tbl-mn-SS-classes", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------------------+------------------------------+\n", - "| Digester | Description |\n", - "+:================================:+:============================:+\n", - "| SlurryStorageOutdoor(Storage) | slurry_storage_outdoor.py |\n", - "+----------------------------------+------------------------------+\n", - "| SlurryStorageUnderfloor(Storage) | slurry_storage_underfloor.py |\n", - "+----------------------------------+------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-SS-classes\n", - "#| tbl-cap: Classes for slurry storage\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-SS-classes.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "936c039a", - "metadata": {}, - "source": [ - "### Required User Inputs" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "tbl-mn-SS-inputs", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Variable | Units | Description |\n", - "+:====================+:========:+:==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+\n", - "| Name | -- | Unique identifier of the specific slurry storage configuration used. |\n", - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Capacity | m$^3$ | The volumetric capacity of the slurry storage, in m$^3$. Note that this variable is a placeholder at this time, and does not influence model calculations. |\n", - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Cover | -- | Default value is “no cover” for slurry storage underfloor, as these storages do not generally have a synthetic cover, and typically receive too much surface disturbance to form a crust. Note that precipitation is always excluded from slurry storage underfloor given they are assumed to be completely covered or indoors. Default value for slurry storage outdoor is “no cover”. Cover (a synthetic, precipitation-excluding cover, or an enclosed tank) or crust (a naturally-forming crust over >50% of the stored manure surface) are also options. |\n", - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Surface_area | m$^3$ | The surface area of the slurry storage. If not provided by the user, surface area is calculated based on the number of mature cows in the herd; see Calculate Surface Area section below. |\n", - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Storage_time_period | days | The number of days that manure is stored between emptying events. At the end of this interval, the manure storage is emptied completely. |\n", - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-SS-inputs\n", - "#| tbl-cap: Required inputs for the slurry storage section\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-SS-inputs.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "7f460782", - "metadata": {}, - "source": [ - "**Other inputs**\n", - "\n", - "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. ManureStream instances include the following variables (all in kg except for volume, m$^3$, and manure methane production potential, m$^3$/kgVS):\n", - "\n", - "* water \n", - "* `ammoniacal_nitrogen`\n", - "* nitrogen\n", - "* phosphorus\n", - "* potassium\n", - "* ash\n", - "* `manure_degradable_volatile_solids`\n", - "* `manure_non_degradable_volatile_solids`\n", - "* `bedding_non_degradable_volatile_solids`\n", - "* `total_solids`\n", - "* mass (equal to sum of water and total solids)\n", - "* `total volatile solids` (equal to sum of degradable and non-degradable volatile solids)\n", - "* volume\n", - "* `methane_production_potential`\n", - "\n", - "### Expected Outputs\n", - "\n", - "* `ManureStream` variables representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses\n", - "* `storage_methane` (kg): Daily emission of CH4 from accumulated manure in slurry storage\n", - "* `storage_ammonia` (kg): Daily emission of NH3 from accumulated manure in slurry storage\n", - "* `storage_nitrous_oxide` (kg): Daily emission of N2O from accumulated manure in slurry storage.\n", - "\n", - "### Methodology\n", - "\n", - "**Calculate Manure Temperature**\n", - "\n", - "*Slurry Storage Underfloor* `_determine_barn_temperature`\n", - "\n", - "Temperature of stored manure is assumed to be equal throughout the entire mass of manure. In slurry storage underfloor, manure temperature is assumed to be equal to air temperature, but is bounded to 5 to 30℃. See barn temperature determination method in Manure Handler section for more information. \n", - "\n", - "*Slurry Storage Outdoor* `_determine_outdoor_storage_temperature`\n", - "\n", - "Daily temperature of manure in slurry storage outdoors is determined using a sine/cosine least squares fit to user-provided weather data, with a fixed amplitude damping and lag (phase shift) factor. For more information, see the Calculate Stored Manure Temperature in the Anaerobic Lagoon section.\n", - "\n", - "**Calculate Storage Surface Area**\n", - "\n", - "Exposed surface area (m$^2$) of the manure in storage is important in determining NH3-N emissions, as well as in determining precipitation volume added to storage if the storage is not covered or indoors. Wherever possible, this value should be provided by the user if modeling a real farm. If farm-specific information is unavailable or the farm being modeled is theoretical, the surface area should be estimated using tools like the USDA's Animal Waste Management Version 2.4.1. However, RuFaS recognizes that minimizing required inputs is desirable, though a fixed storage surface area is undesirable due to the variability in storage structure size and surface area. With this, an equation was developed that estimates storage surface area based on the following assumptions:\n", - "\n", - "\n", - "* All manure excreted by animals on the farm enters the specified storage. At this time, the Manure module is not capable of assessing the proportion of manure excreted that is stored in the defined storages, therefore, all manure is assumed to be stored in the current storage, for the purposes of surface area estimation.\n", - "* The storage is 15 ft deep, with vertical walls.\n", - "* The storage receives 2500 mm of precipitation per year. \n", - "* Herd composition, and thus manure excretion, is fixed, and the number of animals in each life stage class is proportional to the number of mature cows. \n", - "\n", - "A constant value was derived to calculate estimated manure excretion based on the number of mature cows housed on the farm (a user input). The average number of animals in each class was determined according to default RuFaS animal lifecycle inputs, and the total mass and volume of manure excreted by the herd was calculated. This resulted in an estimated daily herd-wide manure excretion of 168.6 kg or 0.118 ($\\text{m}^3$) of manure per mature cow housed on the farm. The resulting equation is used to calculate storage surface area ($\\text{m}^2$).\n", - "\n", - ":::{#eq-mn-sto-1 style=\"font-size:80%\"}\n", - "[[**MN.STO.1**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{surface\\_area}(\\text{m}^2) = \\frac{\\text{cow\\_num} \\times \\text{MANURE\\_CONVERSION\\_CONSTANT} \\times \\text{storage\\_time} \\times \\text{FREEBOARD\\_CONSTANT}}{\\text{DEPTH\\_CONSTANT} - \\text{PRECIPITATION\\_CONSTANT}}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* cow\\_num: user-inputted number of mature cows housed on the farm\n", - "* `MANURE_CONVERSION_CONSTANT`: Factor to estimate m$^3$ of herd-wide manure produced per day per mature cow housed on the farm, set to 0.1175 m$^3$.\n", - "* `storage_time` (days): user-inputted number of days that manure is stored in this storage for before being emptied.\n", - "* `FREEBOARD_CONSTANT`: the volume allowance above the maximum volume of a slurry or liquid manure storage, set to 1.20 (20%).\n", - "* `DEPTH_CONSTANT`: value for slurry or liquid manure storage depth, set to 4.572 m (15 feet). \n", - "* `PRECIPITATION_CONSTANT`: The annual precipitation constant value, used only in determination of storage surface area if surface area is not provided by the user, set to 0.25 m.\n", - "\n", - "**Calculate Precipitation Volume**\n", - "\n", - "Covers have implications for inclusion or exclusion of precipitation volume, as well as for N2O emissions. Four cover options exist for slurry storages: \n", - "\n", - "* “Cover”: An impermeable cover that does not permit precipitation to enter the storage.\n", - "* “Cover and flare”: An impermeable cover with flaring of methane produced in storage. See Cover and Flare section. \n", - "* “Crust”: A naturally forming crust exists on the surface of the slurry storage.\n", - "* “No cover”: Storage is not covered or indoors.\n", - "\n", - "The cover type for slurry storage underfloor in the default manure management file is “uncovered”, as these storages are typically not enclosed. However, precipitation is always excluded from underfloor slurry storages, regardless of the cover type – see Precipitation below.\n", - "\n", - "Precipitation volume for uncovered outdoor slurry storages is calculated as follows:\n", - "\n", - ":::{#eq-mn-sto-2}\n", - "[[**MN.STO.2**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Daily\\_precipitation\\_volume}(\\text{m}^3) = \\text{storage\\_surface\\_area} \\times \\text{precipitation}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Storage surface area: the user-defined or model-estimated storage surface area (m$^2$). \n", - "* Precipitation: the daily amount of precipitation (m).\n", - "\n", - "**Calculate Methane Emissions `_calculate_methane_emissions`**\n", - "\n", - "We use an adaptation of a method originally conceived by @Sommer2004 to calculate daily emissions of CH4 from degradable and non-degradable VS in slurry. These equations focus on the degradation of degradable and non-degradable volatile solids (VS) present in the manure. Factors like degradable and non-degradable VS (VSd and VSnd) content in storage, temperature, and location (indoor/outdoor) affect estimated CH4 emissions. We apply the original method from @Sommer2004 with updated dairy manure Arrhenius and activation energy values from @Elsgaard2016 and @Petersen2024.\n", - "\n", - "Methane emissions are calculated in the same way for slurry storage outdoor and underfloor, with the exception that temperature of manure in outdoor vs. underfloor slurry storage is determined differently, as described below. The same equation is utilized to calculate CH4 emissions from VSd and VSnd (from both manure and bedding sources), though the rate-correcting factor differs between the two.\n", - "\n", - "First, we must calculate the value of the Arrhenius exponent (`_calculate_arrhenius_exponent`). This value directly represents the responsiveness of biological reaction speed to temperature, and in the context of this empirical equation, may also be related to the methane potential of manure in storage and activity of the microbial population:\n", - "\n", - ":::{#eq-mn-met-2}\n", - "[[**MN.MET.2**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Arrh\\_exp g}(\\text{CH}_4\\text{ kg}^{-1}\\text{VS h}^{-1}) = e^{\\text{Ln(A)} - \\frac{\\text{ACTIVATION\\_ENERGY}}{\\text{Gas constant} \\times \\text{manure temperature}}}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Ln(A): The natural log of the Arrhenius parameter (NATURAL\\_LOG\\_ARRHENIUS\\_CONSTANT constant), set at 30.7 based on @Petersen2024. This is an empirically-derived value determined based on observed manure CH4 emission values.\n", - "* `ACTIVATION_ENERGY`: the apparent activation energy of methanogenesis in cattle slurry (J/mol), set at 81,000 J/mol, based on @Elsgaard2016. \n", - "* Gas constant: ideal gas constant, set at 8.314 J K/mol.\n", - "* Manure temperature (K): temperature of manure in storage. \n", - "\n", - "Now we can calculate actual daily CH4 emission, based on the total quantity of VSd and VSnd in stored manure. The basic equation, used to calculate CH4 emissions for each VS fraction, is as follows:\n", - "\n", - ":::{#eq-mn-met-3}\n", - "[[**MN.MET.3**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{CH}_4 \\text{ emission from VS}_{\\text{d or nd}} (\\text{kg d}^{-1}) = 24 \\times \\text{Arrh\\_exp} \\times \\text{VS}_{\\text{d or nd}} \\times \\text{rate\\_factor}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* 24: conversion factor from hours to day. \n", - "* `Arrh_exp`: Arrhenius parameter for CH4 emission rate (g CH4 kg$^{-1}$ VS h$^{-1}$), calculated in [MN.MET.2]{#eq-mn-met-2}. \n", - "* `VSd or nd}`: The mass (kg) of VSd or VSnd in manure in slurry storage.\n", - "* `rate_factor`: The unitless rate-correcting factor, set to 1 for VS$_d$ and 0.01 for VS$_{nd}$. \n", - "\n", - "The total daily CH4 emission is equal to the sum of emissions from the VSd and VSnd fractions.\n", - "\n", - "**Calculate Cover and Flare Emissions `_calculate_cover_and_flare_emissions`**\n", - "\n", - "The cover and flare option is applicable to slurry storage outdoor only (i.e., not usable with slurry storage underfloor). If the cover and flare option is selected, daily CH4 emission from slurry storage is multiplied by a methane destruction efficiency value. The set value for methane destruction efficiency is 81%, based on a white paper commissioned by Dairy Management, Inc. on cover and flare efficiency [@wallaceDMI]. The updated daily CH4 emission (kg) from a cover and flare slurry storage is as follows:\n", - "\n", - ":::{#eq-mn-met-4}\n", - "[[**MN.MET.4**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Daily storage CH}_4 (\\text{kg}) = \\text{storage CH}_4 \\times (1 - \\text{METHANE\\_DESTRUCTION\\_EFFICIENCY})\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Storage CH4 (kg): total daily kg of CH4 emitted from stored manure, calculated in [MN.MET.3]{#eq-mn-met-3}.\n", - "* `METHANE_DESTRUCTION_EFFICIENCY`: coefficient for destruction of methane by the flare, set to 0.81.\n", - "\n", - "**Calculate Volatile Solids Loss `_apply_methane_emissions`**\n", - "\n", - "Daily emissions of CH4 and CO2 from slurry storage occur through microbial degradation of VS in slurry manure, among other processes [@Petersen2024]. Therefore, gaseous emissions from slurry storage result in a decrease in the quantity of VS in stored slurry. VSd and VSnd remaining in manure are updated separately according to their respective loss via CH4 [MN.STO.4]{#eq-mn-sto-4}. Here, we assume a fixed 1:3 molar ratio of CH4-C to CO2-C emissions from stored slurry from @Petersen2024. This enables calculation of the total amount of C and thus VSd and VSnd lost through CH4 and CO2 emissions based on the quantity of CH4 emitted from each VS fraction.\n", - "\n", - "Given that C is assumed to be lost via CH4 and CO2 emissions in a ratio of 1:3, we assume for each C lost as CH4, 3 C are lost as CO2. CH4 is ~75% C by mass, thus for each kg of CH4 emitted, 0.7498 C are lost via CH4 and (3 x 0.7498) are lost from CO2, for a total of 2.992 kg C per kg of CH4 emitted. We assume manure VS are 45% C [@Petersen2024]; therefore, 2.9992 kg C / 45% C = 6.665 kg VS are lost per kg of CH4 emitted.\n", - "\n", - ":::{#eq-mn-sto-3}\n", - "[[**MN.STO.3**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{VS}_\\text{d or nd}\\text{loss (kg)} = \\text{CH}_4\\text{ emission from VS}_\\text{d or nd} \\times \\text{VS\\_TO\\_METHANE\\_LOSS\\_RATIO}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* CH4 emission from VSd or nd (kg): total daily kg of CH4 emitted from VSd or nd, calculated in [MN.MET.3]{#eq-mn-met-3}\n", - "* `VS_TO_METHANE_LOSS_RATIO`: default ratio of VS degraded per kg of CH4 emitted from slurry storage, set to 6.665\n", - "\n", - "**Calculate Ammonia Emissions `_calculate_ammonia_emissions`**\n", - "\n", - "Emission of NH3-N from stored slurry is determined using equations from @Rotz2006, which are also utilized in the IFSM [@Rotz2023]. Ammonia emissions are influenced by the quantity of TAN accumulated in manure storage, manure temperature, and manure storage surface area. First, we must derive the various parameters utilized in the calculation.\n", - "\n", - "First, we need to derive the value of the equilibrium coefficient Q for the NH3 gas in the air for a given concentration of TAN in stored manure using Henry’s law. Note that the concentration of NH3 in the free atmosphere is assumed to be zero. Since Q is a function of the Henry’s law coefficient Kh and a dissociation of ammonium coefficient Ka, we will calculate those first. \n", - " \n", - "*Henry’s law coefficient (Kh)*:\n", - "\n", - ":::{#eq-mn-amm-1}\n", - "[[**MN.AMM.1**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{K}_\\text{h} = 10^{\\frac{1478}{\\text{manure temperature}}} - 1.69\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Manure temperature (K): temperature of manure storage.\n", - "\n", - "*Dissociation coefficient of ammonium (Ka)*\n", - "\n", - ":::{#eq-mn-amm-2}\n", - "[[**MN.AMM.2**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{K}_\\text{h} = 1 + 10^{(0.09018 + \\frac{2729.9}{\\text{manure temperature}} - \\text{pH})}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Manure temperature (K): temperature of stored manure.\n", - "* `DEFAULT_STORED_MANURE_PH`: the pH of the manure in storage, set to 7.5 by default\n", - "\n", - "*Equilibrium coefficient (Q)*\n", - "\n", - ":::{#eq-mn-amm-3}\n", - "[[**MN.AMM.3**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Q} = \\text{K}_\\text{h} \\times \\text{K}_\\text{a}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Kh: Henry’s law coefficient, calculated in [MN.AMM.1]{#eq-mn-amm-1}.\n", - "* Ka: Dissociation coefficient of ammonium, calculated in [MN.AMM.2]{#-eq-mn-amm-2}.\n", - "\n", - "Next, the rate of NH3-N loss in kg N/m$^2$ from stored manure is calculated:\n", - "\n", - ":::{#eq-mn-amm-5}\n", - "[[**MN.AMM.5**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{NH}_3\\text{N emission rate} (\\text{kg N/m}^2) = \\frac{\\text{TAN} \\times \\text{c} \\times \\text{y}}{\\text{STORAGE\\_RESISTANCE} \\times \\text{M} \\times \\text{Q}}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* TAN (kg): Mass of ammoniacal N in stored manure\n", - "* c: time conversion constant (86400 s per d)\n", - "* y: manure density, set to 990 kg/m$^3$ \n", - "* `STORAGE_RESISTANCE`: A constant value representing the sum of resistance of NH3 transfer from solution to manure surface, and from manure surface to atmosphere, set at 23.1 s/m.\n", - "* M (kg): Total mass of stored manure\n", - "* Q: Equilibrium coefficient calculated in [MN.AMM.3]{#eq-mn-amm-3}\n", - "\n", - "Lastly, we calculate total NH3-N emissions (kg), based on the emission rate we just calculated and the manure storage surface area.\n", - "\n", - ":::{#eq-mn-amm-7}\n", - "[[**MN.AMM.7**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{NH}_3\\text{ emissions (kg)} = \\text{NH}_3\\text{N\\_rate} \\times \\text{surface\\_area}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `NH3N_rate` (kg N/m$^2$): Rate of NH3-N loss (kg/m$^2$) from manure, calculated in [MN.AMM.5]{#eq-m-amm-5}.\n", - "* `surface_area` (m$^2$): Total manure storage surface area.\n", - "\n", - "**Calculate Nitrous Oxide Emissions `_calculate_nitrous_oxide_emissions`**\n", - "\n", - "N2O emissions (kg N2O-N) are based on the daily quantity of manure N loaded into storage, whether the manure storage is covered or uncovered. This method is based on @IPCC2019; however, it should be noted that the original @IPCC2006 method is based on daily manure N excretion by animals, whereas the current method is based on manure N loading into storage, which may reflect upstream N losses from NH3 emissions in housing, solid liquid separation, etc. The calculation is as follows:\n", - "\n", - ":::{#eq-mn-nit-1}\n", - "[[**MN.NIT.1**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{N}_2\\text{O-N emissions (kg)} = \\text{Received\\_N} \\times \\text{N}_2\\text{O factor}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `Received_N` (kg): Quantity of manure total N loaded into storage on the current day\n", - "* N2O factor: kg of N2O-N emitted per kg of manure N added per day to storage, based on the following logic:\n", - " * Cover type = crust OR cover; 0.005\n", - " * Cover type = no cover; 0 (no N2O emissions)\n", - "\n", - "### Received, stored, and emptied outputs\n", - "\n", - "Manure storages in RuFaS report two types of outputs to OutputManager each day: received manure and stored manure. \n", - "\n", - "**Received Manure**\n", - "\n", - "Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values. \n", - "\n", - "**Stored Manure**\n", - "\n", - "Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In slurry storage processors, daily losses include CH4, NH3, and N2O emissions. The order of operations in updating accumulated manure values is:\n", - "\n", - "* Add received manure values to stored manure values\n", - "* Calculate gas emissions and total nutrient losses based on stored manure values\n", - "* Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. \n", - "\n", - "For slurry storage and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. \n", - "\n", - "**Emptied Manure**\n", - "\n", - "Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and Manure Stream attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage.\n", - "\n", - "### Manure Composition Update\n", - "\n", - "**Received manure**\n", - "\n", - "In slurry storage processors, the following nutrient sources are represented in received manure values:\n", - "\n", - "* `ManureStream` values, as received from the previous processor(s) in the manure management chain\n", - "* Precipitation water (kg), calculated in [MN.STO.2]{#eq-mn-sto-2} (if applicable), is added to the water value in `ManureStream`\n", - "\n", - "**Stored manure**\n", - "\n", - "Below is a summary of updates to ManureStream variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", - "\n", - "Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. Received manure simply refers to the manure being loaded into the manure storage each day. " - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "tbl-mn-SS-calc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| Variable | Units | Calculation |\n", - "+:=======================================+:========:+:==========================================================================================================+\n", - "| water | kg | stored manure water + received manure water |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| total_ammoniacal_nitrogen | kg | max(0,stored manure ammoniacal nitrogen + received ammoniacal nitrogen - NH$_3$N emissions) |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| nitrogen | kg | stored manure nitrogen + received manure nitrogen - NH$_3$N emissions - N$_2$O-N emissions |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| phosphorus | kg | stored manure phosphorus + received manure phosphorus |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| potassium | kg | stored manure potassium + received manure potassium |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| ash | kg | stored manure ash + received manure ash |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| degradable_volatile_solids | -- | stored degradable VS + received degradable VS - VSd loss |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| manure_non_degradable_volatile_solids | -- | stored manure non-degradable VS + received manure non-degradable VS - manure VSnd loss |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| bedding_non_degradable_volatile_solids | -- | stored bedding non-degradable VS + received bedding non-degradable VS - bedding VSnd loss |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| total_solids | kg | stored total solids + received total solids - VSd loss - VSnd los) |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| volume | m$^3$ | stored volume + Received volume- $\\frac{\\text{VSd loss}+\\text{VSnd loss}}{\\text{SLURRY\\_MANURE\\_DENSITY}$ |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-SS-calc\n", - "#| tbl-cap: Manure storage variable calculations.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-SS-calc.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "f22be40d", - "metadata": {}, - "source": [ - "## Anaerobic Lagoon\n", - "\n", - "### Introduction\n", - "Manure that is stored and managed at less than 5% dry matter is generally considered to be liquid manure. Liquid manure is generated by either dilution of raw or slurry manure, generally through the addition of wash or flush water, or removal of a portion of manure solids through solid liquid separation methods (mechanical separator, settling basin, etc.) or anaerobic digestion. Liquid manure is generally stored in a type of large, outdoor storage structure called an anaerobic lagoon, or simply a lagoon. Anaerobic lagoons are not simply structures in which to store manure. Lagoons facilitate biological breakdown of organic materials, which reduces volatile solids content and odor, though also increases N mineralization and loss as ammonia, particularly if the lagoon is uncovered. Accordingly,\n", - "anaerobic lagoons have specific design and management requirements to facilitate biological treatment activity [@NRCS2017]. Some characteristics that separate an anaerobic lagoon from slurry or liquid manure storage are:\n", - "\n", - "* Greater storage capacity\n", - "* Less frequent and less complete emptying, resulting in longer solids/sludge retention time\n", - "* Storage of liquid rather than slurry manure\n", - "* Controlled volatile solids loading rate\n", - "* Lagoons are generally a lined or unlined in-ground basin, whereas slurry storage may be either in-ground or above-ground tanks or other structures \n", - "\n", - "**Implementation in RuFaS**\n", - "\n", - "In RuFaS, the underlying biological and gas emission methods are identical for slurry storages vs. anaerobic lagoons, as the biological process of organic matter breakdown is very similar between the two in reality. However, the differences in size, dilution, management, and other factors differ between the two in reality, leading to generally greater GHG emissions from lagoons compared to slurry storages. In the anaerobic lagoon submodule, accumulated manure in storage (i.e., held in the lagoon) is modeled on a daily timestep. Nutrient/mass gains from daily addition of manure (feces/urine, bedding, wash water) to storage, and precipitation volume entering storage, are tracked. Gas emissions are calculated daily based on the quantity of nutrients in stored manure, manure temperature, storage type, use of a cover, and storage duration. Manure composition is then updated according to net nutrient losses/gains. Manure accumulates in storage until the end of the user-defned storage interval is reached. However, quantities of manure may additionally be removed from storage according to the user-defined manure application schedule. \n", - "\n", - "**Classes**" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "tbl-mn-AL-classes", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+---------------------------+---------------------+\n", - "| Anaerobic Lagoon | Description |\n", - "+:=========================:+:===================:+\n", - "| AnaerobicLagoon (Storage) | anaerobic_lagoon.py |\n", - "+---------------------------+---------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-AL-classes\n", - "#| tbl-cap: List of classes for anaerobic lagoon.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-AL-classes.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "c84ca9b8", - "metadata": {}, - "source": [ - "### Required User Inputs" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "tbl-mn-AL-inputs", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Variable | Units | Description |\n", - "+:====================+:========:+:==============================================================================================================================================================+\n", - "| Name | -- | Unique identifier of the specific anaerobic lagoon configuration used. |\n", - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Capacity | m$^3$ | The volumetric capacity of the anaerobic lagoon, in m$^3$. Note that this variable is a placeholder at this time, and does not influence model calculations. |\n", - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Cover | -- | The type of cover used with the anaerobic lagoon. |\n", - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Surface_area | m$^2$ | The surface area of the anaerobic lagoon at the minimum operating level. |\n", - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Storage_time_period | days | The number of days that manure is stored between emptying events. At the end of this interval, the manure storage is emptied completely. |\n", - "+---------------------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-AL-inputs\n", - "#| tbl-cap: Required inputs for the anaerobic lagoon section (`refreshed_manure_management.json`)\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-AL-inputs.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "016b62f5", - "metadata": {}, - "source": [ - "**Other inputs**\n", - "\n", - "Instance(s) of ManureStream for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. ManureStream instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$/kgVS):\n", - "\n", - "* water \n", - "* `ammoniacal_nitrogen`\n", - "* nitrogen\n", - "* phosphorus\n", - "* potassium\n", - "* ash\n", - "* `manure_degradable_volatile_solids`\n", - "* `manure_non_degradable_volatile_solids`\n", - "* `bedding_non_degradable_volatile_solids`\n", - "* `total_solids`\n", - "* mass (equal to sum of water and total solids)\n", - "* `total volatile solids` (equal to sum of degradable and non-degradable volatile solids)\n", - "* volume\n", - "* `methane_production_potential`\n", - "\n", - "### Expected Outputs\n", - "\n", - "* ManureStream variables representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses\n", - "* `storage_methane`(kg): Daily emission of CH4 from accumulated manure in an anaerobic lagoon. \n", - "* `storage_ammonia`(kg): Daily emission of NH3 from accumulated manure in an anaerobic lagoon. \n", - "* `storage_nitrous_oxide`(kg): Daily emission of N2O from accumulated manure in an anaerobic lagoon. \n", - "\n", - "### Methodology\n", - "\n", - "**Calculate manure temperature** \n", - "`_determine_outdoor_storage_temperature`\n", - "\n", - "Manure temperature is modeled using a cosine function whose parameters are derived from a least-squares fit of simulation-wide weather data. The air temperature amplitude is reduced using a damping factor to reflect the smaller annual variation in manure temperature relative to air. The phase shift (i.e., timing of peak temperature) is determined based on the least squares function and is adjusted by a fixed lag constant representing the delayed thermal response of manure temperature relative to air temperature.\n", - "\n", - "First, we determine the amplitude of the manure temperature function by applying the damping factor. \n", - "\n", - ":::{#eq-mn-sto-13}\n", - "[[**MN.STO.13**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{manure\\_amplitude} = \\text{amplitude} \\times \\text{MANURE\\_DAMPING\\_FACTOR}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* amplitude: modeled amplitude of the seasonal air temperature function, calculated from user-supplied, simulation-wide weather data\n", - "* MANURE_DAMPING_FACTOR: a fixed damping factor applied to the air temperature amplitude, set to 0.65\n", - "\n", - "Second, we use this amplitude in the following function to determine modeled manure temperature (℃) each simulation day. Note the function includes a 'max' term to implement a lower temperature bound for manure temperature. \n", - "\n", - ":::{#eq-mn-sto-14 style=\"font-size:90%\"}\n", - "[[**MN.STO.14**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{manure\\_temp} &= \\text{max}( \\\\\n", - "&\\text{mean\\_temp} \\times \\text{manure\\_amplitude} \\times \\text{cos}(\\frac{2\\pi}{365}) \\\\\n", - " &\\times (\\text{jday} - \\text{phase\\_shift} - \\text{MANURE\\_TEMPERATURE\\_LAG})), \\\\\n", - " & \\text{min\\_temp})\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* mean_temp (℃): simulation_wide mean air temperature\n", - "* manure_amplitude: amplitude of the manure temperature function, determined in [MN.STO.13]{#eq-mn-sto-13}\n", - "* jday: Julian day of the simulation [MN.MET.3]{#eq-mn-met-3}r temperature in the simulation\n", - "* MANURE_TEMPERATURE_LAG (days): fixed lag constant representing the delayed thermal response of manure temperature relative to air temperature, set to 30. \n", - "* min_temp (℃): A fixed minimum temperature constant, dependent on the type of storage: \n", - "- Anaerobic lagoon: 1℃\n", - "- Slurry storage outdoor: -20℃\n", - "\n", - "**Calculate storage surface area** \n", - "Exposed surface area (m$^2$) of the manure in storage is important in determining NH3-N emissions, as well as in determining precipitation volume added to storage if the storage is not covered or indoors. Wherever possible, this value should be provided by the user if modeling a real farm. If farm-specific information is unavailable or the farm being modeled is theoretical, the surface area should be estimated using tools like the USDA's Animal Waste Management Version 2.4.1. However, the RuFaS team recognizes that minimizing required inputs is desirable, though a fixed storage surface area is undesirable due to the variability in storage structure size and surface area. With this, an equation was developed that estimates storage surface area based on the following assumptions:\n", - "\n", - "* All manure excreted by animals on the farm enters the specified storage. At this time, the Manure module is not capable of assessing the proportion of manure excreted that is stored in the defined storages, therefore, all manure is assumed to be stored in the current storage, for the purposes of surface are estimation. \n", - "* The storage is 15 ft deep, with vertical walls. \n", - "* The storage receives 2500 mm of precipitation per year. \n", - "* Herd composition, and thus manure excretion, is fixed, and the number of animals in each life stage class is proportional to the number of mature cows. \n", - "\n", - "A constant value was derived to calculate estimated manure excretion based on the number of mature cows housed on the farm (a user input). The average number of animals in each class was determined according to default RuFaS animal life cycle inputs, and the total mass and volume of manure excreted by the herd was calculated. This resulted in an estimated daily herd-wide manure excretion of 168.6 kg or 0.118 m$^3$ of manure per mature cow housed on the farm. The resulting equation is used to calculate storage surface area (m$^2$). \n", - "\n", - ":::{#eq-mn-sto-1 style=\"font-size:90%\"}\n", - "[[**MN.STO.1**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "&\\text{surface\\_area(m$^2$)} = \\\\\n", - "&\\frac{\\text{cow\\_num} \\times \\text{MANURE\\_CONVERSION\\_CONSTANT} \\times \\text{storage\\_time} \\times \\text{FREEBOARD\\_CONSTANT}}{\\text{DEPTH\\_CONSTANT} - \\text{PRECIPITATION\\_CONSTANT}}\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* cow_num: user-inputted number of mature cows housed on the farm\n", - "* MANURE_CONVERSION_CONSTANT: Factor to estimate m$^3$ of herd-wide manure produced per day per mature cow housed on teh farm, set to 0.1175 m$^3$. \n", - "* storage_time (days): user-inputted number of days that manure is stored in this storage for before being emptied\n", - "* FREEBOARD_CONSTANT: the volume allowance above the maximum volume of a slurry or liquid manure storage, set to 1.20 (20%). \n", - "* DEPTH_CONSTANT: value for slurry or liquid manure storage depth, set to 4.572 m (15 feet)\n", - "* PRECIPITATION_CONSTANT: the annual precipitation constant value, used only in determination of storage surface area if surface area is not provided by the user, set to 0.25m. \n", - "\n", - "**Calculate Precipitation Volume**\n", - "\n", - "The use of covers has implications for inclusion or exclusion of precipitation volume, as well as for N2O emissions. Four cover options exist for anaerobic lagoons: \n", - "\n", - "* Cover\n", - "* Cover and flare\n", - "* Crust\n", - "* No cover \n", - "\n", - "Detailed descriptions are outlined in the Slurry Storage section of this module. Precipitation volume for anaerobic lagoons that are uncovered or have a crust is calculated as follows: \n", - "\n", - ":::{#eq-mn-sto-2}\n", - "[[**MN.STO.2**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Daily\\_precipitation\\_volume}(\\text{m}^3) = \\text{storage\\_surface\\_area} \\times \\text{precipitation}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Storage surface area: the user-defined or model-estimated storage surface area (m$^2$). \n", - "* Precipitation: the daily amount of precipitation (m).\n", - "\n", - "**Calculate Methane Emissions `_calculate_methane_emissions`**\n", - "\n", - "We use an adaptation of a method originally conceived by @Sommer2004 to calculate daily emissions of CH4 from degradable and non-degradable VS in anaerobic lagoons. These equations focus on the degradation of degradable and non-degradable volatile solids (VS) present in the manure. Factors like degradable and non-degradable VS (VSd and VSnd) content in storage, temperature, and location (indoor/outdoor) affect estimated CH4 emissions. We apply the original method from @Sommer2022 with updated dairy manure Arrhenius and activation energy values from @Elsgaard2016 and @Petersen2024. The same equation is utilized to calculate CH4 emissions from VSd and VSnd (from both manure and bedding sources), though the rate-correcting factor differs between the two.\n", - "\n", - "First, we must calculate the value of the Arrhenius exponent (`_calculate_arrhenius_exponent`). This value directly represents the responsiveness of biological reaction speed to temperature, and in the context of this empirical equation, may also be related to the methane potential of manure in storage and activity of the microbial population:\n", - "\n", - ":::{#eq-mn-met-2}\n", - "[[**MN.MET.2**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Arrh\\_exp g}(\\text{CH}_4\\text{ kg}^{-1}\\text{VS h}^{-1}) = e^{\\text{Ln(A)} - \\frac{\\text{ACTIVATION\\_ENERGY}}{\\text{Gas constant} \\times \\text{manure temperature}}}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Ln(A): The natural log of the Arrhenius parameter (NATURAL\\_LOG\\_ARRHENIUS\\_CONSTANT constant), set at 30.6 based on @Petersen2024. This is an empirically-derived value determined based on observed manure CH4 emission values.\n", - "* `ACTIVATION_ENERGY`: the apparent activation energy of methanogenesis in cattle slurry (J/mol), set at 81,000 J/mol, based on @Elsgaard2016. \n", - "* Gas constant: ideal gas constant, set at 8.314 J K/mol.\n", - "* Manure temperature (K): temperature of manure in storage. \n", - "\n", - "Now we can calculate actual daily CH4 emission, based on the total quantity of VSd and VSnd in stored manure. The basic equation, used to calculate CH4 emissions for each VS fraction, is as follows:\n", - "\n", - ":::{#eq-mn-met-3}\n", - "[[**MN.MET.3**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{CH}_4 \\text{ emission from VS}_{\\text{d or nd}} (\\text{kg d}^{-1}) = 24 \\times \\text{Arrh\\_exp} \\times \\text{VS}_{\\text{d or nd}} \\times \\text{rate\\_factor}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* 24: conversion factor from hours to day. \n", - "* `Arrh_exp`: Arrhenius parameter for CH4 emission rate (g CH4 kg$^{-1}$ VS h$^{-1}$), calculated in [MN.MET.2]{#eq-mn-met-2}. \n", - "* VSd or nd: The mass (kg) of VS~d~ or VS~nd~ in manure in slurry storage.\n", - "* `rate_factor`: The unitless rate-correcting factor, set to 1 for VSd and 0.01 for VSnd. \n", - "\n", - "The total daily CH4 emission is equal to the sum of emissions from the VS~d~ and VS~nd~ fractions.\n", - "\n", - "**Calculate Cover and Flare Emissions `_calculate_cover_and_flare_methane`**\n", - "\n", - " If the cover and flare option is selected, daily CH4 emission from an anaerobic lagoon is multiplied by a methane destruction efficiency value. The set value for methane destruction efficiency is 81%, based on a white paper commissioned by Dairy Management, Inc. on cover and flare efficiency [@wallaceDMI]. The updated daily CH4 emission (kg) from a cover and flare lagoon is as follows:\n", - "\n", - ":::{#eq-mn-met-4}\n", - "[[**MN.MET.4**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Daily storage CH}_4 (\\text{kg}) = \\text{storage CH}_4 \\times (1 - \\text{METHANE\\_DESTRUCTION\\_EFFICIENCY})\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Storage CH4 (kg): total daily kg of CH4 emitted from stored manure, calculated in [MN.MET.3]{#eq-mn-met-3}.\n", - "* `METHANE_DESTRUCTION_EFFICIENCY`: coefficient for destruction of methane by the flare, set to 0.81.\n", - "\n", - "**Calculate Volatile Solids Losses `_apply_methane_emissions`**\n", - "\n", - "Daily emissions of CH4 and CO2 from anaerobic lagoons occur through microbial degradation of VS in manure, among other processes [@Petersen2024]. Therefore, gaseous emissions from slurry storage result in a decrease in the quantity of VS in stored slurry. VSd and VSnd remaining in manure are updated separately according to their respective loss via CH4 [MN.STO.4]{#eq-mn-sto-4}. Here, we assume a fixed 1:3 molar ratio of CH4-C to CO2-C emissions from stored slurry from @Petersen2024. This enables calculation of the total amount of C and thus VSd and VSnd lost through CH4 and CO2 emissions based on the quantity of CH4 emitted from each VS fraction.\n", - "\n", - "Given that C is assumed to be lost via CH4 and CO2 emissions in a ratio of 1:3, we assume for each C lost as CH4, 3 C are lost as CO2. CH4 is ~75% C by mass, thus for each kg of CH4 emitted, 0.7498 C are lost via CH4 and (3 x 0.7498) are lost from CO2, for a total of 2.992 kg C per kg of CH4 emitted. We assume manure VS are 45% C [@Petersen2024]; therefore, 2.9992 kg C / 45% C = 6.665 kg VS are lost per kg of CH4 emitted.\n", - "\n", - ":::{#eq-mn-sto-3}\n", - "[[**MN.STO.3**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{VS}_\\text{d or nd}\\text{loss (kg)} = \\text{CH}_4\\text{ emission from VS}_\\text{d or nd} \\times \\text{VS\\_TO\\_METHANE\\_LOSS\\_RATIO}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* CH4 emission from VSd or nd (kg): total daily kg of CH4 emitted from VSd or nd, calculated in [MN.MET.3]{#eq-mn-met-3}\n", - "* `VS_TO_METHANE_LOSS_RATIO`: default ratio of VS degraded per kg of CH4 emitted from slurry storage, set to 6.665\n", - "\n", - "**Calculate manure retention at emptying `_emptying_fraction`**\n", - "\n", - "Anaerobic lagoons, through their settling action, accumulate and retain a bottom layer of solids often\n", - "referred to as \"sludge\". Additionally, depending on the frequency and extent of lagoon agitation, retention time of volatile solids in lagoons is typically explicitly managed to promote biological degradation of\n", - "solids. These factors contribute to the generally greater CH4 emissions per unit of volatile solids loaded into anaerobic lagoons compared to in-ground basin or tank manure storages. To directly capture the\n", - "greater retention of manure at emptying events, and to indirectly capture the greater biological activity\n", - "in anaerobic lagoons, a default manure retention factor is implemented in RuFaS. This factor dictates\n", - "the portion of manure which, when the storage time interval is reached, is retained in the lagoon. This\n", - "factor is applied evenly to all manure constituents (i.e., ManureStream variables). \n", - "\n", - ":::{#eq-mn-sto-15 style=\"font-size:90%\"}\n", - "[[**MN.STO.15**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{retained\\_manure}_i = \\text{accumulated\\_manure}_i \\times \\text{ANAEROBIC\\_LAGOON\\_MANURE\\_RETENTION}\n", - "$$\n", - ":::\n", - "\n", - "*Where:*\n", - "\n", - "* *i*: manure constituent *i*\n", - "* accumulated_manurei: quantity of manure constituent *i* present in the accumulate anaerobic lagoon manure when the storage time interval is reached\n", - "* ANAEROBIC_LAGOON_MANURE_RETENTION: constant fraction of the accumulated stored manure that is retained in the anaerobic lagoon when the storage time interval is reached, set to 0.10 \n", - "\n", - "**Calculate ammonia emissions `_calculate_ammonia_emissions`** \n", - "\n", - "Emission of NH3-N from anaerobic lagoons is determined using equations from @Rotz2006, which are also utilized in the IFSM [@Rotz2023]. Ammonia emissions are influenced by the quantity of TAN accumulated in manure storage, manure temperature, and manure storage surface area. First, we must derive the various parameters utilized in the calculation.\n", - "\n", - "First, we need to derive the value of the equilibrium coefficient Q for the NH3 gas in the air for a given concentration of TAN in stored manure using Henry’s law. Note that the concentration of NH3 in the free atmosphere is assumed to be zero. Since Q is a function of the Henry’s law coefficient Kh and a dissociation of ammonium coefficient Ka, we will calculate those first. \n", - " \n", - "*Henry’s law coefficient (Kh)*:\n", - "\n", - ":::{#eq-mn-amm-1}\n", - "[[**MN.AMM.1**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{K}_\\text{h} = 10^{\\frac{1478}{\\text{manure temperature}}} - 1.69\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Manure temperature (K): temperature of manure storage.\n", - "\n", - "*Dissociation coefficient of ammonium (Ka)*\n", - "\n", - ":::{#eq-mn-amm-2}\n", - "[[**MN.AMM.2**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{K}_\\text{h} = 1 + 10^{(0.09018 + \\frac{2729.9}{\\text{manure temperature}} - \\text{pH})}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Manure temperature (K): temperature of stored manure.\n", - "* `DEFAULT_STORED_MANURE_PH`: the pH of the manure in storage, set to 7.5 by default\n", - "\n", - "*Equilibrium coefficient (Q)*\n", - "\n", - ":::{#eq-mn-amm-3}\n", - "[[**MN.AMM.3**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{Q} = \\text{K}_\\text{h} \\times \\text{K}_\\text{a}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* Kh: Henry’s law coefficient, calculated in [MN.AMM.1]{#eq-mn-amm-1}.\n", - "* Ka: Dissociation coefficient of ammonium, calculated in [MN.AMM.2]{#-eq-mn-amm-2}.\n", - "\n", - "Next, the rate of NH3-N loss in kg N/m$^2$ from stored manure is calculated:\n", - "\n", - ":::{#eq-mn-amm-5}\n", - "[[**MN.AMM.5**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{NH}_3\\text{N emission rate} (\\text{kg N/m}^2) = \\frac{\\text{TAN} \\times \\text{c} \\times \\text{y}}{\\text{STORAGE\\_RESISTANCE} \\times \\text{M} \\times \\text{Q}}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* TAN (kg): Mass of ammoniacal N in stored manure\n", - "* c: time conversion constant (86400 s per d)\n", - "* y: manure density, set to 990 kg/m$^3$ \n", - "* `STORAGE_RESISTANCE`: A constant value representing the sum of resistance of NH3 transfer from solution to manure surface, and from manure surface to atmosphere, set at 23.1 s/m.\n", - "* M (kg): Total mass of stored manure\n", - "* Q: Equilibrium coefficient calculated in [MN.AMM.3]{#eq-mn-amm-3}\n", - "\n", - "Lastly, we calculate total NH3-N emissions (kg), based on the emission rate we just calculated and the manure storage surface area.\n", - "\n", - ":::{#eq-mn-amm-7}\n", - "[[**MN.AMM.7**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{NH}_3\\text{ emissions (kg)} = \\text{NH}_3\\text{N\\_rate} \\times \\text{surface\\_area}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `NH3N_rate` (kg N/m$^2$): Rate of NH3-N loss (kg/m$^2$) from manure, calculated in [MN.AMM.5]{#eq-m-amm-5}.\n", - "* `surface_area` (m$^2$): Total manure storage surface area.\n", - "\n", - "**Calculate Nitrous Oxide Emissions `_calculate_nitrous_oxide_emissions`**\n", - "\n", - "N2O emissions (kg N2O-N) are based on the daily quantity of manure N loaded into the lagoon, and whether the lagoon is covered or uncovered. This method is based on @IPCC2019; however, it should be noted that the original @IPCC2006 method is based on daily manure N excretion by animals, whereas the current method is based on manure N loading into storage, which may reflect upstream N losses from NH3 emissions in housing, solid liquid separation, etc. The calculation is as follows:\n", - "\n", - ":::{#eq-mn-nit-1}\n", - "[[**MN.NIT.1**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{N}_2\\text{O-N emissions (kg)} = \\text{Received\\_N} \\times \\text{N}_2\\text{O factor}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `Received_N` (kg): Quantity of manure total N loaded into storage on the current day\n", - "* N2O factor: kg of N2O-N emitted per kg of manure N added per day to storage, based on the following logic:\n", - " * Cover type = crust OR cover; 0.005\n", - " * Cover type = no cover; 0 (no N2O emissions)\n", - "\n", - "### Received, stored, and emptied outputs\n", - "\n", - "Manure storages in RuFaS report two types of outputs to OutputManager each day: received manure and stored manure. \n", - "\n", - "**Received Manure**\n", - "\n", - "Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values. \n", - "\n", - "**Stored Manure**\n", - "\n", - "Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In anaerobic lagoon processors, daily losses include CH4, NH3, and N2O emissions. The order of operations in updating accumulated manure values is:\n", - "\n", - "* Add received manure values to stored manure values\n", - "* Calculate gas emissions and total nutrient losses based on stored manure values\n", - "* Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. \n", - "\n", - "For anaerobic lagoons and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. \n", - "\n", - "**Emptied Manure**\n", - "\n", - "Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and Manure Stream attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage.\n", - "\n", - "### Manure Composition Update\n", - "\n", - "**Received manure**\n", - "\n", - "In anaerobic lagoon processors, the following nutrient sources are represented in received manure values:\n", - "\n", - "* `ManureStream` values, as received from the previous processor(s) in the manure management chain\n", - "* Precipitation water (kg), calculated in [MN.STO.2]{#eq-mn-sto-2} (if applicable), is added to the water value in `ManureStream`\n", - "\n", - "**Stored manure**\n", - "\n", - "Below is a summary of updates to ManureStream variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", - "\n", - "Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. Received manure simply refers to the manure being loaded into the manure storage each day. " - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "tbl-mn-AL-calc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| Variable | Units | Calculation |\n", - "+:=======================================+:========:+:==========================================================================================================+\n", - "| water | kg | stored manure water + received manure water |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| total_ammoniacal_nitrogen | kg | max(0,stored manure ammoniacal nitrogen + received ammoniacal nitrogen - NH$_3$N emissions) |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| nitrogen | kg | stored manure nitrogen + received manure nitrogen - NH$_3$N emissions - N$_2$O-N emissions |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| phosphorus | kg | stored manure phosphorus + received manure phosphorus |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| potassium | kg | stored manure potassium + received manure potassium |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| ash | kg | stored manure ash + received manure ash |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| degradable_volatile_solids | -- | stored degradable VS + received degradable VS - VSd loss |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| manure_non_degradable_volatile_solids | -- | stored manure non-degradable VS + received manure non-degradable VS - manure VSnd loss |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| bedding_non_degradable_volatile_solids | -- | stored bedding non-degradable VS + received bedding non-degradable VS - bedding VSnd loss |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| total_solids | kg | stored total solids + received total solids - VSd loss - VSnd los) |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+\n", - "| volume | m$^3$ | stored volume + Received volume- $\\frac{\\text{VSd loss}+\\text{VSnd loss}}{\\text{SLURRY\\_MANURE\\_DENSITY}$ |\n", - "+----------------------------------------+----------+-----------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-AL-calc\n", - "#| tbl-cap: Manure storage variable calculations.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-SS-calc.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "e6a57dce", - "metadata": {}, - "source": [ - "## Bedded Pack\n", - "\n", - "### Introduction\n", - "\n", - "Traditional dairy housing systems typically involve concrete flooring and limited bedding, which can lead to cow discomfort, suboptimal health, and laborious manure management. Bedded pack pens aim to address these issues by providing a soft, comfortable, and dry bedding surface for cows, enhancing their comfort and overall well-being.\n", - "\n", - "Bedded packs fall into one of two management methods: a traditional bedded pack, or a compost bedded pack. See @endresUWMadison for further detail. Though the names are often used interchangeably, note here that the primary difference between the two types is the presence or absence of active mixing, and the length of time between complete removal of the accumulated bedding/manure mixture from the pen.\n", - "\n", - "*Traditional Bedded Pack*\n", - "\n", - "Traditional bedded packs, referred to here as simply “bedded packs”, are typically bedded using straw. Fresh material is added daily without any mixing activity, which causes the manure/bedding mix (pack) to compact and become anaerobic. The pack material is typically removed every 4 to 6 weeks.\n", - "\n", - "*Compost Bedded Pack*\n", - "\n", - "Compost bedded packs are typically bedded with sawdust, shavings, or other fine, dense, absorbent material. Bedding is added daily, accompanied by mixing of the pack material to promote aeration and aerobic decomposition (composting). This composting action leads to the production of heat and microbial activity that promotes breakdown of organic components and reductions in moisture content, resulting in a drier and more stable pack. The pack material is typically removed after several months.\n", - "\n", - "**Implementation in RuFaS**\n", - "\n", - "The two types of bedded pack are modeled differently in RuFaS as their decomposition conditions and thus emission profiles differ. Bedded packs, where mixing does not occur, promote anaerobic decomposition, whereas compost bedded packs promote aerobic decomposition through regular mixing and aeration of the pack. Sawdust or shavings bedded pens may be used in situations where pens are cleaned more frequently, e.g. weekly, but these pens are not considered to be bedded packs in RuFaS. \n", - "\n", - "**Classes**" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "tbl-mn-BP-classes", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+--------------------------------+-----------------+\n", - "| Digester | Description |\n", - "+:==============================:+:===============:+\n", - "| CompostBeddedPackBarn(Storage) | bedded_pack.py |\n", - "+--------------------------------+-----------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-BP-classes\n", - "#| tbl-cap: List of classes for bedded pack.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-BP-classes.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "47890a3a", - "metadata": {}, - "source": [ - "### Required User Inputs" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "tbl-mn-BP-inputs", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+---------------------+---------------+------------------------------------------------------------------------------------------------------------------------------+\n", - "| Variable | Definition | Description |\n", - "+:====================+:=============:+:=============================================================================================================================+\n", - "| Name | -- | Unique identifier of the specific bedded pack configuration used. |\n", - "+---------------------+---------------+------------------------------------------------------------------------------------------------------------------------------+\n", - "| storage_time_period | days | The number of days that the manure/bedding pack accumulates in the pen before being removed and replaced with fresh bedding. |\n", - "+---------------------+---------------+------------------------------------------------------------------------------------------------------------------------------+\n", - "| is_mixed | true/false | A boolean indicator for whether the bedded pack is routinely mixed to intentionally promote composting activity. |\n", - "+---------------------+---------------+------------------------------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-BP-inputs\n", - "#| tbl-cap: Required inputs for the bedded pack section (`refreshed_manure_management.json`)\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-BP-inputs.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "4f136b55", - "metadata": {}, - "source": [ - "**Other Inputs**\n", - "\n", - "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. ManureStream instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$ / kgVS):\n", - "\n", - "* water \n", - "* `ammoniacal_nitrogen`\n", - "* nitrogen \n", - "* phosphorus\n", - "* potassium\n", - "* ash\n", - "* `manure_degradable_volatile_solids`\n", - "* `manure_non_degradable_volatile_solids`\n", - "* `bedding_non_degradable_volatile_solids`\n", - "* `total_solids`\n", - "* mass (equal to sum of water and total solids)\n", - "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", - "* volume\n", - "* `methane_production_potential`\n", - "\n", - "### Expected Outputs\n", - "\n", - "`ManureStream` variables representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses\n", - "\n", - "* `storage_methane` (kg): Total mass of CH4 emitted from the bedded pack each day.\n", - "* `storage_ammonia_N` (kg): Total mass of NH3-N emitted from the bedded pack each day.\n", - "* `storage_nitrous_oxide_N` (kg): Total mass of N2O-N emitted from the bedded pack each day.\n", - "* `storage_nitrogen_leached` (kg): Total mass of N leached from the bedded pack each day. Leached N is assumed to be lost to the environment, and is not captured in runoff that may enter a manure storage.\n", - "* `carbon_decomposition` (kg): the total quantity of manure C lost through microbial degradation of volatile solids. \n", - "\n", - "### Methodology\n", - "\n", - "**Calculate Daily Methane Generation**\n", - "\n", - "Calculates the daily mass of methane emitted from the bedded pack based on daily manure VS added to the bedded pack (through animal excretion and bedding addition) and an emission factor based on mixing activity and simulation average temperature @Hanson2024. Here and in other equations, ‘daily’ denotes the value associated with received manure added to the bedded pack on a specified simulation day.\n", - "\n", - "::: {.callout-note}\n", - "The quantity of volatile solids utilized in determination of CH4 includes only manure-excreted volatile solids; bedding volatile solids are excluded\n", - ":::" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "tbl-mn-BP-met-conv", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+---------------+-----------------------------+-----------+------------+-------------+-------------+-----+\n", - "| Mixing T/F | Average air temp (°C) | | .1 | .2 | | |\n", - "+:==============+:===========================:+:=========:+:==========:+:===========:+:===========:+:====+\n", - "| | $\\leq$ 4.6 | 4.7 - 5.8 | 5.8 - 13.9 | 14.0 - 25.1 | $\\geq$ 25.2 | |\n", - "+---------------+-----------------------------+-----------+------------+-------------+-------------+-----+\n", - "| Mixing | 0.5 | 0.5 | 1 | 1 | 1.5 | |\n", - "+---------------+-----------------------------+-----------+------------+-------------+-------------+-----+\n", - "| No mixing | 21 | 26 | 37 | 41 | 74 | |\n", - "+---------------+-----------------------------+-----------+------------+-------------+-------------+-----+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-BP-met-conv\n", - "#| tbl-cap: Methane conversion factor values for bedded pack pens, based on presence or absence of mixing and average annual air temperature.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-BP-met-conv.csv\",\n", - " colalign = [\"left\", \"center\", \"center\",\"center\",\"center\",\"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "1e86c50f", - "metadata": {}, - "source": [ - ":::{#eq-mn-met-6}\n", - "[[**MN.MET.6**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{methane (kg)} = \\text{B}_0 \\times \\text{MCF} \\times \\text{tVS}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* B$_0$ = methane production potential (kg CH4 per kg manure VS) of manure excreted onto the lot on a specified simulation day\n", - "* Constant Value: 0.24 m$^3$ CH4/kg VS\n", - "* MCF = methane conversion factor (@tbl-mn-BP-met-conv), based on simulation average ambient temperature\n", - "* tVS (kg) = daily mass (kg) of manure-excreted total VS in the bedded pack manure, received from `ManureStream(s)`; note that bedding VS are not included in this value\n", - "\n", - "**Calculate Carbon Decomposition**\n", - "\n", - "In addition to microbial processes that occur in anaerobic conditions, which generate primarily CH4 and CO2, carbon in the manure/bedding mixture is also degraded through aerobic microbial processes. This process is a function of substrate availability/degradability, temperature, moisture, aeration, and microbial population. This series of calculations is based on the IFSM composting simulation method [@bonifacio2017a; @bonifacio2017b]. Simplifications/assumptions that have been made which diverge from the original method are explicitly noted below. \n", - "\n", - "First, we calculate the maximum decomposition rate per day, and decomposition rate of the slow fraction per day. We use the same equation for both rates, however, the temperature value used in calculating maximum decomposition rate is 60 ℃, versus 30 ℃ in calculating slow fraction degradation. The maximum decomposition rate value is set to 0.04195 and the slow fraction decomposition rate is set to 0.00846, but the equations and set values are shown below for reference.\n", - "\n", - ":::{#eq-mn-sto-4 style=\"font-size:90%\"}\n", - "[[**MN.STO.4**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{max\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", - "&\\qquad \\times (1.066^{(\\text{DECOMPOSITION\\_TEMPERATURE}-10)} - 1.21^{(\\text{DECOMPOSITION\\_TEMPERATURE}-50)})\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", - "* `DECOMPOSITION_TEMPERATURE`: temperature of the inner compost layer, set to 60℃ (reflective of temperature at which microbial growth, and thus decomposition, is maximized)\n", - "\n", - ":::{#eq-mn-sto-5 style=\"font-size:90%\"}\n", - "[[**MN.STO.5**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{slow\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", - "&\\qquad \\times (1.066^{(\\text{DEFAULT\\_LAYER\\_TEMPERATURE}-10)} - 1.21^{(\\text{DECOMPOSITION\\_TEMPERATURE}-50)})\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", - "* `DEFAULT_LAYER_TEMPERATURE`: temperature of the pack layer, set to 30℃ Setting the layer temperature to a constant value is a simplification as manure pack temperature is not modeled dynamically at this time.\n", - "\n", - "Second, we calculate the carbon decomposition rate per day (`calculate_carbon_decomposition_rate`). The value of this parameter is equal to 0.03876, but the equation and set values are included below for reference. \n", - "\n", - ":::{#eq-mn-sto-6 style=\"font-size:90%\"}\n", - "[[**MN.STO.6**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{C\\_decomp\\_rate} &= (\\text{max\\_decomp\\_rate} - \\text{slow\\_decomp\\_rate}) \\\\[8pt] \n", - "&\\qquad \\times e^{\\text{FIRST\\_ORDER\\_DECAYING\\_COEFFICIENT} \\times (\\text{DEFAULT\\_DAYS\\_SINCE\\_LAST\\_MIXING} - \\text{DEFAULT\\_LAG\\_TIME})} \\\\[8pt]\n", - "&\\qquad + \\text{slow\\_decomp\\_rate}\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `max_decomp_rate` and `slow_decomp_rate` calculated with [MN.STO.4]{#eq-mn-sto-4}, set to 0.04195 and 0.00846, respectively \n", - "* `FIRST_ORDER_DECAYING_COEFFICIENT`: First-order decaying coefficient constant, set to 0.10\n", - "* `DEFAULT_DAYS_SINCE_LAST_MIXING`: number of days from the start of pack formation or last mixing event, set to 1 by default\n", - "* `lag`: lag time in days to reach maximum decomposition rate, set to 2\n", - "\n", - "Third, we calculate the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. This value is set to 0.9664, but the equation and fixed values are provided below for reference. \n", - "\n", - ":::{style=\"font-size:90%\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{max\\_decomp\\_rate} &= \\frac{\\text{oxygen\\_mole\\_fraction}}{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_mole\\_fraction}} \\\\[8pt]\n", - "&\\qquad \\times \\frac{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_ambient\\_air\\_mole\\_fraction}}{\\text{oxygen\\_ambient\\_air\\_mole\\_fraction}} \\\\[8pt]\n", - "&\\qquad = \\frac{0.15}{0.02+0.15} \\times \\frac{0.02+0.21}{0.21} = 0.9664\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `oxygen_mole_fraction`: mole fraction of oxygen in the air within the bedded pack, unitless, set at 0.15. This is a simplification as oxygen content of the manure pack is not currently modeled.\n", - "* `oxygen_half_saturation_constant`: the half-saturation constant, unitless, set at 0.02 by the original publication.\n", - "* `oxygen_ambient_air_mole_fraction`: the mole fraction of oxygen in ambient air, unitless, set at 0.21 (ambient air is approximately 21% oxygen).\n", - "\n", - "Fourth, we calculate total carbon in the manure/bedding pack available for decomposition. Here we make some assumptions on the carbon content of manure degradable vs. non-degradable volatile solids. Degradable volatile solids, which originate from fecal excretion by animals, are considered to be 50\\% carbon by weight [@larney2011]. Non-degradable volatile solids, which originate primarily from bedding addition, are assumed to contain 35% carbon by weight. The total carbon available is the sum of these two quantities. \n", - "\n", - ":::{#eq-mn-sto-7}\n", - "[[**MN.STO.7**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{carbon\\_from\\_VSd (kg)} &= \\text{degradable\\_volatile\\_solids} \\\\[8pt]\n", - "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSD}\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `degradable_volatile_solids`: The degradable volatile solids (kg) in the daily manure added to the bedded pack.\n", - "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSD`: the carbon content (%) of manure degradable volatile solids, set to 50% by default. \n", - " \n", - "\n", - ":::{#eq-mn-sto-8}\n", - "[[**MN.STO.8**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{carbon\\_from\\_VSnd (kg)} &= \\text{non\\_degradable\\_volatile\\_solids} \\\\[8pt] \n", - "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSND}\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `nondegradable_volatile_solids`: The non-degradable volatile solids (kg) in the daily bedding and manure added to the bedded pack. \n", - "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSND`: the carbon content (%) of manure non-degradable volatile solids, set to 35% by default. \n", - "\n", - ":::{#eq-mn-sto-9}\n", - "[[**MN.STO.9**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{total\\_carbon (kg)} = \\text{carbon\\_from\\_VSnd} + \\text{carbon\\_from\\_VSd}\n", - "$$\n", - ":::\n", - "\n", - "Finally, we calculate total carbon decomposition in kg/d using the coefficients and values calculated in the steps above (`calculate_carbon_decomposition`): \n", - "\n", - ":::{#eq-mn-sto-10 style=\"font-size:90%\"}\n", - "[[**MN.STO.10**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{total\\_carbon\\_decomposition (kg)} &= \\text{total\\_carbon} \\times \\text{C\\_decomp\\_rate} \\times \\text{anaerobic\\_effect} \\\\[8pt]\n", - "&\\qquad \\times \\text{DEFAULT\\_MOISTURE\\_EFFECT\\_MICROBIAL\\_DECOMP} \n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `total_carbon`: total carbon available in manure pack (kg); [MN.STO.9]{#eq-mn-sto-9}\n", - "* `C_decomp_rate`: carbon decomposition rate per day; [MN.STO.6]{#eq-mn-sto-6}\n", - "* `DEFAULT_MOISTURE_EFFECT_MICROBIAL_DECOMP`: The effect of moisture on microbial decomposition, set at 0.65. This is a simplification as moisture content of the manure pack is not currently modeled. \n", - "* `anaerobic_effect`: the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. Set to 0.9664 by default.\n", - "\n", - "**Calculate Total VS Loss** `_apply_dry_matter_loss`\n", - "\n", - "The quantity of total and volatile solids remaining in the accumulated bedded pack must be updated according to estimated CH4 and C decomposition losses. To do this, we calculate the total loss of VS through CH4 emission and C decomposition. Loss of mass through CH4 emissions is assumed to be equal to the mass of CH4 emitted. Manure volatile solids are assumed to be 50% C, therefore, to determine total mass loss through C decomposition, we divide the mass of C decomposition by 0.50. Importantly, volatile solids destruction is attributed only to manure-excreted volatile solids; bedding volatile solids destruction is not considered at this time.\n", - "\n", - ":::{#eq-mn-sto-11}\n", - "[[**MN.STO.11**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{total\\_volatile\\_solids\\_loss (kg)} = \\text{methane} + \\frac{\\text{total\\_carbon\\_decomposition}}{0.50}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `methane` (kg): The daily methane loss, calculated with [MN.MET.6]{#eq-mn-met-6}, based on the daily quantity of manure VS added to the bedded pack\n", - "* `total_carbon_decomposition` (kg): quantity of C lost through microbial decomposition (kg), calculated with [MN.STO.10]{#eq-mn-sto-10}, based on the daily quantity of manure VS added to the bedded pack\n", - "\n", - "**Calculate N Loss to Ammonia** `_calculate_cbpb_ammonia_emission`\n", - "\n", - "Manure nitrogen being deposited and accumulating in the bedded pack results in NH3 emissions. Here we utilize an emission factor based on mixing activity [@Hanson2024] to estimate total kg of ammonia loss based on the daily manure N deposition by animals. \n", - "\n", - ":::{#eq-mn-amm-8}\n", - "[[**MN.AMM.8**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{storage\\_ammonia\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{ammonia\\_coefficient}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `daily_maure_N`: Daily kg of manure N added to the bedded pack\n", - "* `ammonia_coefficient`: kg of NH3-N emitted per kg of manure N added per day to the bedded pack, based on the style of management:\n", - " * Bedded pack (no mixing) = `AMMONIA_EMISSION_COEFFICIENT_WITH_UNTILLED_BEDDING` (0.25) \n", - " * Compost bedded pack (mixing) = `AMMONIA_EMISSION_COEFFICIENT_WITH_TILLED_BEDDING` (0.50)\n", - "\n", - "**Calculate N loss to Nitrous Oxide** `_calculate_cbpb_nitrous_oxide_emission`\n", - "\n", - "In addition to NH3-N emissions, manure nitrogen deposition in the bedded pack also results in N2O emissions. Similar to NH3, we estimate daily N2O-N loss using an emissions factor from Hanson et al. (2024) based on the type of management used. \n", - "\n", - ":::{}\n", - "[See [MN.NIT.1](#eq-mn-nit-1)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{storage\\_nitrous\\_oxide\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{nitrous\\_oxide\\_coefficient}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `daily_maure_N`: Daily kg of manure N added to the bedded pack\n", - "* `ammonia_coefficient`: kg of NH3-N emitted per kg of manure N added per day to the bedded pack, based on the style of management:\n", - " * Bedded pack (no mixing) = `NITROUS_OXIDE_EMISSION_COEFFICIENT_WITH_UNTILLED_BEDDING` (0.01) \n", - " * Compost bedded pack (mixing) = `NITROUS_OXIDE_EMISSION_COEFFICIENT_WITH_TILLED_BEDDING` (0.07)\n", - "\n", - "**Calculate N Loss to Leaching** `calculate_nitrogen_loss_to_leaching`\n", - "\n", - "Manure nitrogen deposited in bedded packs may also be lost to leaching. Leaching of manure N may occur when fecal and urinary N are converted to nitrate in the soil beneath the bedded pack, if the pack is not concrete, lined, or otherwise sealed. Nitrate can then be carried away via water movement through the subsoil. Similar to NH3 and N2O, we estimate daily leaching-N loss using an emissions factor from @Hanson2024, which is not influenced by management of the bedded pack (i.e., mixing activity). \n", - "\n", - ":::{#eq-mn-sto-12}\n", - "[[**MN.STO.12**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{storage\\_leached\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{LEACHING\\_COEFFICIENT}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `daily_maure_N`: Daily kg of manure N added to the bedded pack\n", - "* `LEACHING_COEFFICIENT`: kg of N leached per kg of manure N added per day to the open lot; set at 0.035.\n", - "\n", - "### Received, stored, and emptied outputs\n", - "\n", - "Manure storages in RuFaS report two types of outputs to OutputManager each day: received manure and stored manure. \n", - "\n", - "**Received Manure**\n", - "\n", - "Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values. \n", - "\n", - "**Stored Manure**\n", - "\n", - "Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In bedded pack processors, daily losses include CH4, NH3, and N2O emissions, and N leaching. The order of operations in updating accumulated manure values is: \n", - "\n", - "* Add received manure values to stored manure values\n", - "* Calculate gas emissions and total nutrient losses based on stored manure values\n", - "* Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. \n", - "\n", - "For bedded pack and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. \n", - "\n", - "**Emptied Manure**\n", - "\n", - "Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and `ManureStream` attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage.\n", - "\n", - "### Manure Composition Update\n", - "\n", - "**Received Manure**\n", - "\n", - "Received manure simply refers to the manure being loaded into the manure storage each day (i.e., deposited in the bedded pack). In bedded pack processors, the following nutrient sources are represented in received manure values:\n", - "\n", - "* `ManureStream` values, as received from the previous processor(s) in the manure management chain. In bedded pack processors, which are placed first in the manure management chain as there are no intermediary steps between animal excretion and the bedded pack, this `ManureStream` instance typically represents manure and bedding received directly from the Animal module.\n", - "* Daily precipitation volume/mass is **not** currently represented in received bedded pack manure.\n", - "\n", - "**Stored Manure**\n", - "\n", - "Below is a summary of updates to `ManureStream` variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", - "\n", - "Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. Received manure simply refers to the manure being loaded into the manure storage each day. " - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "tbl-mn-BP-calc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| Variable | Units | Calculation |\n", - "+:=======================================+:========:+:=======================================================================================+\n", - "| water | kg | Stored manure water + received manure water |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| total_ammoniacal_nitrogen | kg | max (0, stored manure ammoniacal N + received ammoniacal N - NH$_3$-N emissions) |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| nitrogen | kg | Stored manure N + received manure N - NH$_3$-N - N$_2$O-N emissions |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| phosphorus | kg | Stored manure P + received manure P |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| potassium | kg | Stored manure K + received manure K |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| ash | kg | Stored manure ash + received manure ash |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| degradable_volatile_solids | kg | stored degradable VS + received degradable VS - VSd loss |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| manure_non_degradable_volatile_solids | kg | stored manure non-degradable VS + received manure non-degradable VS - VSnd loss |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| bedding_non_degradable_volatile_solids | kg | stored bedding non-degradable VS + received bedding non-degradable VS |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| total_solids | kg | Stored TS + received TS - VS loss |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| volume | m$^3$ | Stored volume + received volume - \\frac{\\text{VS_loss}}{\\text{SOLID\\_MANURE\\_DENSITY}} |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-BP-calc\n", - "#| tbl-cap: Calculated manure storage variables and their units.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-BP-calc.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "ef23cf6f", - "metadata": {}, - "source": [ - "## Open Lot\n", - "\n", - "### Introduction\n", - "\n", - "Open or dry lot dairy systems are systems in which cows are housed outdoors in earthen or concrete pens. The open lot surface typically consists of natural or compacted soil covered with accumulated dry manure. Open lot pens often contain some form of shelter to provide shade and protection from harsh weather conditions, under which bedding may be applied, especially during winter. In addition to the dirt/manure pack lot, these systems also typically have a segregated feed feeding area, which may include a concrete apron that cows stand and deposit manure upon while eating. Manure deposited in this area may be managed differently from manure deposited on the lot surface.\n", - "\n", - "To manage the manure on the lot surface, farmers commonly harrow the surface to spread out, break up, and mix fresh manure into the existing dry pack, to facilitate drying and create a standing and lying surface mainly consisting of dry manure solids. Harrowing is usually performed daily, which results in mixing of the soil/dry manure pack and fresh manure and urine. When cows deposit urine and manure on the lot surface, the dry climate and low humidity typical to regions where these systems are common facilitate rapid drying and ammonia (NH3) volatilization from urine. Harrowing activity also promotes volatilization of NH3 through mixing of fresh urine and manure. Though NH3 losses may be high, the harrowing/spreading action also serves to create a lighter, more aerated pack that emits less methane (CH4) than other manure storage methods, such as slurry or liquid manure storage; however, these same aerobic conditions can also lead to greater nitrous oxide (N2O) emissions from the lot surface.\n", - "\n", - "Manure is allowed to accumulate on the lot surface for several weeks to months, and may be either spread flat or partially piled in the pen during this period. Lots are cleaned out typically via scraping with large equipment 1-2 times per year. Manure removed from lots may be immediately field applied, stacked/piled until field application, composted, or managed in other ways. Of note is that, while the majority of manure on open lot dairies may be managed as a solid, open lot dairies with milking animals will also utilize a slurry or liquid manure storage to store, at a minimum, milking parlor waste. Feed apron waste, lot runoff, or other waste may also be stored as a liquid.\n", - "\n", - "**Implementation in RuFaS**\n", - "\n", - "In the Open Lot processor, we receive manure information from the animal module and manure management information from user inputs. Given weather data, we then calculate daily nutrient losses through CH4, N2O, and NH3 emissions, as well as N leaching and C decomposition. We update the composition of the accumulated manure mix each day as manure and urine are added and nutrients are lost through the processes mentioned.\n", - "\n", - "Important assumptions:\n", - "\n", - "* Harrowing is assumed to be performed daily. At this time, differences in lot manure harrowing or piling frequency are not reflected in calculation of emissions/losses.\n", - "* Gas emissions in this processor are based on annual emissions factors that are extrapolated to a daily timestep, meaning that calculations are made based on daily excretion of manure VS or N, rather than accumulated quantities of the nutrients. With this, for N and NH3 emissions for example, manure is assumed to lose all estimated NH3-N on the day it is excreted. Manure N accumulation in lot manure is tracked, but accumulated manure N does not influence NH3 emissions.\n", - "\n", - "**Classes**" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "tbl-mn-OL-classes", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+------------------+-----------------+\n", - "| | Description |\n", - "+:================:+:===============:+\n", - "| Storage(OpenLot) | open_lot.py |\n", - "+------------------+-----------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-OL-classes\n", - "#| tbl-cap: Classes available in open lots.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-OL-classes.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "c1ac4b7c", - "metadata": {}, - "source": [ - "### Required User Inputs" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "id": "tbl-mn-OL-inputs", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+---------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Variable | Units | Description |\n", - "+:===================:+:========:+:============================================================================================================================================================================================================================+\n", - "| storage_time_period | days | The interval in days that the open lot pen is cleaned out, i.e. the majority of manure, either already in piles or spread across the lot surface, is scraped or otherwise collected from the lot and removed from the pen. |\n", - "+---------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-OL-inputs\n", - "#| tbl-cap: Required inputs for the open lots section.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-OL-inputs.csv\",\n", - " colalign = [\"center\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "03aca473", - "metadata": {}, - "source": [ - "**Other Inputs**\n", - "\n", - "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. `ManureStream` instances include the following variables (all in kg except for volume, m$^3$ and manure methane potential, m$^3$ / kgVS):\n", - "\n", - "* water \n", - "* `ammoniacal_nitrogen`\n", - "* nitrogen \n", - "* phosphorus\n", - "* potassium\n", - "* ash\n", - "* `manure_degradable_volatile_solids`\n", - "* `manure_non_degradable_volatile_solids`\n", - "* `bedding_non_degradable_volatile_solids`\n", - "* `total_solids`\n", - "* mass (equal to sum of water and total solids)\n", - "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", - "* volume\n", - "* `methane_production_potential`\n", - "\n", - "### Expected Outputs\n", - "\n", - "* `ManureStream` variables representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses\n", - "* `storage_methane` (kg): Total mass of CH4 emitted from the open lot manure each day.\n", - "* `storage_ammonia_N` (kg): Total mass of NH3-N emitted from the open lot manure each day.\n", - "* `storage_nitrous_oxide_N` (kg): Total mass of N2O-N emitted from the open lot manure each day.\n", - "* `storage_nitrogen_leached` (kg): Total mass of N leached from the open lot manure each day. Leached N is assumed to be lost to the environment, and is not captured in lot runoff that may enter a manure storage.\n", - "* `carbon_decomposition` (kg): the total quantity of manure C lost through microbial degradation of volatile solids. \n", - "\n", - "### Methodology\n", - "\n", - "**Calculate Methane Conversion Factor** `calculate_ifsm_methane_emission`\n", - "\n", - "Calculates the methane conversion factor for open lot manure given the ambient air temperature using an equation from IFSM [@Rotz2023]. This method is an adaptation of the @IPCC2006 tier 2 approach. Note that the MCF cannot be lower than 0.\n", - "\n", - ":::{#eq-mn-met-5}\n", - "[[**MN.MET-5**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{MCF} = max(0, \\frac{0.0625 \\times \\text{T} - 0.25}{100})\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* T = ambient air temperature, 0 to 30℃\n", - "\n", - "**Calculate Daily Methane Generation** `calculate_ifsm_methane_emission`\n", - "\n", - "Calculates the daily mass of methane emitted from the open lot based on daily manure volatile solids (VS) added to lot manure (through animal excretion and bedding addition) and the emission factor calculated in [MN.MET.5]{#eq-mn-met-5}. Here and in other equations, ‘daily’ denotes the value associated with received manure added to the open lot on a specified simulation day.\n", - "\n", - "::: {.callout-note}\n", - "The quantity of volatile solids utilized in determination of CH4 includes only manure-excreted volatile solids; bedding volatile solids are excluded\n", - ":::\n", - "\n", - ":::{#eq-mn-met-6}\n", - "[[**MN.MET-6**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{methane (kg)} = \\text{B}_0 \\times \\text{MCF} \\times \\text{tVS} \\times \\text{METHANE\\_FACTOR}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* B$_0$ = methane production potential (kg CH4 per kg manure VS) of manure excreted onto the lot on a specified simulation day\n", - "* MCF = methane conversion factor calculated in [MN.MET.5]{#eq-mn-met-5}, based on daily ambient temperature\n", - "* tVS (kg) = daily mass (kg) of manure-excreted volatile solids in the open lot pen, received from `ManureStream(s)`; bedding volatile solids are not included in this value\n", - "* `METHANE_FACTOR` = 0.67; unit conversion factor for CH4 volume to mass (kg).\n", - "\n", - "**Calculate Carbon Decomposition** `calculate_carbon_decomposition`\n", - "\n", - "In addition to microbial processes that occur in anaerobic conditions, which generate primarily CH4 and CO2, open lot manure C is also degraded through aerobic microbial processes. This process is a function of substrate availability/degradability, temperature, moisture, aeration, and microbial population. This series of calculations is based on the IFSM composting simulation method, which is described in detail in @bonifacio2017a and @bonifacio2017b. Simplifications/assumptions that have been made which diverge from the original method are explicitly noted below. \n", - "\n", - "First, we calculate the maximum decomposition rate per day, and decomposition rate of the slow fraction per day. We use the same equation for both rates, however, the temperature value used in calculating maximum decomposition rate is 60℃, versus 30℃ in calculating slow fraction degradation. The maximum decomposition rate value is set to 0.04195 and the slow fraction decomposition rate is set to 0.00846, but the equations and set values are shown below for reference. \n", - "\n", - ":::{style=\"font-size:90%\"}\n", - "[See [MN.STO.4](#eq-mn-sto-4)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{max\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", - "&\\qquad \\times (1.066^{(\\text{DECOMPOSITION\\_TEMPERATURE}-10)} - 1.21^{(\\text{DECOMPOSITION\\_TEMPERATURE}-50)})\n", - "\\end{aligned}\n", - "$$\n", - "::: \n", - " \n", - "*Where*:\n", - "\n", - "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", - "* `DECOMPOSITION_TEMPERATURE`: temperature of the inner compost layer, set to 60℃ (reflective of temperature at which microbial growth, and thus decomposition, is maximized)\n", - "\n", - ":::{style=\"font-size:90%\"}\n", - "[See [MN.STO.5](#eq-mn-sto-5)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{slow\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", - "&\\qquad \\times (1.066^{(\\text{DEFAULT\\_LAYER\\_TEMPERATURE}-10)} - 1.21^{(\\text{DEFAULT\\_LAYER\\_TEMPERATURE}-50)})\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - " \n", - "*Where*:\n", - "\n", - "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", - "* `DEFAULT_LAYER_TEMPERATURE`: temperature of the inner compost layer, set to 30℃. Setting the layer temperature to a constant value is a simplification as manure pack temperature is not modeled dynamically at this time.\n", - "\n", - "Second, we calculate the carbon decomposition rate per day (`calculate_carbon_decomposition_rate`). The value of this parameter is equal to 0.03876, but the equation and set values are included below for reference. \n", - "\n", - ":::{style=\"font-size:90%\"}\n", - "[See [MN.STO.6](#eq-mn-sto-6)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{C\\_decomp\\_rate} &= (\\text{max\\_decomp\\_rate} - \\text{slow\\_decomp\\_rate}) \\\\[8pt] \n", - "&\\qquad \\times e^{\\text{FIRST\\_ORDER\\_DECAYING\\_COEFFICIENT} \\times (\\text{DEFAULT\\_DAYS\\_SINCE\\_LAST\\_MIXING} - \\text{DEFAULT\\_LAG\\_TIME})} \\\\[8pt]\n", - "&\\qquad + \\text{slow\\_decomp\\_rate}\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `max_decomp_rate` and `slow_decomp_rate` calculated with [MN.STO.4]{#eq-mn-sto-4}, set to 0.04195 and 0.00846, respectively \n", - "* `FIRST_ORDER_DECAYING_COEFFICIENT`: First-order decaying coefficient constant, set to 0.10\n", - "* `DEFAULT_DAYS_SINCE_LAST_MIXING`: number of days from the start of pack formation or last mixing event, set to 1 by default\n", - "* `lag`: lag time in days to reach maximum decomposition rate, set to 2\n", - "\n", - "Third, we calculate the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. This value is set to 0.9664, but the equation and fixed values are provided below for reference. \n", - " \n", - ":::{style=\"font-size:90%\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{max\\_decomp\\_rate} &= \\frac{\\text{oxygen\\_mole\\_fraction}}{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_mole\\_fraction}} \\\\[8pt]\n", - "&\\qquad \\times \\frac{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_ambient\\_air\\_mole\\_fraction}}{\\text{oxygen\\_ambient\\_air\\_mole\\_fraction}} \\\\[8pt]\n", - "&\\qquad = \\frac{0.15}{0.02+0.15} \\times \\frac{0.02+0.21}{0.21} = 0.9664\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - " \n", - "*Where*:\n", - "\n", - "* `oxygen_mole_fraction`: mole fraction of oxygen in the air within the lot manure pack, unitless, set at 0.15. This is a simplification as oxygen content of the manure pack is not currently modeled.\n", - "* `oxygen_half_saturation_constant`: the half-saturation constant, unitless, set at 0.02 by the original publication.\n", - "* `oxygen_ambient_air_mole_fraction`: the mole fraction of oxygen in ambient air, unitless, set at 0.21 (ambient air is approximately 21% oxygen).\n", - "\n", - "Fourth, we calculate total carbon in the manure/bedding pack available for decomposition. Here we make some assumptions on the carbon content of manure degradable vs. non-degradable volatile solids. Degradable volatile solids, which originate from fecal excretion by animals, are considered to be 50% carbon by weight [@larney2011]. Non-degradable volatile solids, which originate primarily from bedding addition, are assumed to contain 35% carbon by weight. The total carbon available is the sum of these two quantities. \n", - "\n", - ":::{}\n", - "[See [MN.STO.7](#eq-mn-sto-7)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{carbon\\_from\\_VSd (kg)} &= \\text{degradable\\_volatile\\_solids} \\\\[8pt]\n", - "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSD}\n", - "\\end{aligned}\n", - "$$\n", - "::: \n", - "\n", - "*Where*:\n", - "\n", - "* `degradable_volatile_solids`: The degradable volatile solids (kg) in the daily manure added to the open lot.\n", - "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSD`: the carbon content (%) of manure degradable volatile solids, set to 50% by default. \n", - "\n", - ":::{}\n", - "[See [MN.STO.8](#eq-mn-sto-8)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{carbon\\_from\\_VSnd (kg)} &= \\text{non\\_degradable\\_volatile\\_solids} \\\\[8pt] \n", - "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSND}\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `non_degradable_volatile_solids`: The non-degradable volatile solids (kg) in the daily manure added to the open lot.\n", - "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSD`: the carbon content (%) of manure non-degradable volatile solids, set to 35% by default. \n", - "\n", - ":::{}\n", - "[See [MN.STO.9](#eq-mn-sto-9)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{total\\_carbon (kg)} = \\text{carbon\\_from\\_VSnd} + \\text{carbon\\_from\\_VSd}\n", - "$$\n", - ":::\n", - "\n", - "Finally, we calculate total carbon decomposition in kg/d using the coefficients and values calculated in the steps above (`_apply_dry_matter_loss`): \n", - "\n", - ":::{style=\"font-size:90%\"}\n", - "[See [MN.STO.10](#eq-mn-sto-10)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{total\\_carbon\\_decomposition (kg)} &= \\text{total\\_carbon} \\times \\text{C\\_decomp\\_rate} \\times \\text{anaerobic\\_effect} \\\\[8pt]\n", - "&\\qquad \\times \\text{DEFAULT\\_MOISTURE\\_EFFECT\\_MICROBIAL\\_DECOMP} \n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - " \n", - "*Where*:\n", - "\n", - "* `total_carbon`: total carbon available in manure pack (kg); [MN.STO.9]{#eq-mn-sto-9}\n", - "* `C_decomp_rate`: carbon decomposition rate per day; [MN.STO.10]{#eq-mn-sto-10}\n", - "* `DEFAULT_MOISTURE_EFFECT_MICROBIAL_DECOMP`: The effect of moisture on microbial decomposition, set at 0.65. This is a simplification as moisture content of the manure pack is not currently modeled. \n", - "* `anaerobic_effect`: the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. Set to 0.9664 by default.\n", - "\n", - "**Calculate Total VS Loss**\n", - "\n", - "The quantity of total and volatile solids remaining in the accumulated bedded pack must be updated according to estimated CH4 and C decomposition losses. To do this, we calculate the total loss of VS through CH4 emission and C decomposition. Loss of mass through CH4 emissions is assumed to be equal to the mass of CH4 emitted. Manure volatile solids are assumed to be 50% C, therefore, to determine total mass loss through C decomposition, we divide the mass of C decomposition by 0.50. Importantly, volatile solids destruction is attributed only to manure-excreted volatile solids; bedding volatile solids destruction is not considered at this time.\n", - "\n", - ":::{}\n", - "[See [MN.STO.11](#eq-mn-sto-11)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{total\\_volatile\\_solids\\_loss (kg)} = \\text{methane} + \\frac{\\text{total\\_carbon\\_decomposition}}{0.50}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* methane (kg): The daily methane loss, calculated with [MN.MET.6]{#eq-mn-met-6}, based on the daily quantity of manure VS added to the open lot\n", - "* `total_carbon_decomposition` (kg): quantity of C lost through microbial decomposition (kg), calculated with [MN.STO.10]{#eq-mn-sto-10}, based on the daily quantity of manure VS added to the open lot\n", - "\n", - "**Calculate N Loss to Ammonia** `_calculate_cbcp_ammonia_emission`\n", - "\n", - "Manure nitrogen being deposited and accumulating in the bedded pack results in NH3 emissions. Here we utilize an emission factor based on mixing activity [@Hanson2024] to estimate total kg of ammonia loss based on the daily manure N deposition by animals. \n", - " \n", - ":::{#eq-mn-amm-8}\n", - "[[**MN.AMM.8**]]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{storage\\_ammonia\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{ammonia\\_coefficient}\n", - "$$\n", - "::: \n", - " \n", - "*Where*:\n", - "\n", - "* `daily_manure_N`: Daily kg of manure N added to the open lot\n", - "* `AMMONIA_EMISSION_COEFFICIENT_IN_OPEN_LOTS`: kg of NH3-N emitted per kg of manure N added per day to the open lot; set at 0.36.\n", - "\n", - "**Calculate N loss to Nitrous Oxide** `_calculate_cbpb_nitrous_oxide`\n", - "\n", - "In addition to NH3-N emissions, manure nitrogen deposition in the bedded pack also results in N2O emissions. Similar to NH3, we estimate daily N2O-N loss using an emissions factor from @Hanson2024 based on the type of management used. \n", - "\n", - ":::{}\n", - "[See [MN.NIT.1](#eq-mn-nit-1)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{storage\\_nitrous\\_oxide\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{nitrous\\_oxide\\_coefficient}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `daily_manure_N`: Daily kg of manure N added to the open lot\n", - "* `NITROUS_OXIDE_COEFFICIENT_IN_OPEN_LOTS`: kg of N2O-N emitted per kg of manure N added per day to the open lot; set at 0.02.\n", - "\n", - "**Calculate N Loss to Leaching** `calculate_nitrogen_loss_to_leaching`\n", - "\n", - "Manure nitrogen deposited in bedded packs may also be lost to leaching. Leaching of manure N may occur when fecal and urinary N are converted to nitrate in the soil beneath the bedded pack, if the pack is not concrete, lined, or otherwise sealed. Nitrate can then be carried away via water movement through the subsoil. Similar to NH3 and N2O, we estimate daily leaching-N loss using an emissions factor from @Hanson2024, which is not influenced by management of the bedded pack (i.e., mixing activity). \n", - "\n", - ":::{}\n", - "[See [MN.STO.12](#eq-mn-sto-12)]{.aside .content-visible when-format=\"html\"} \n", - "$$\n", - "\\text{storage\\_leached\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{LEACHING\\_COEFFICIENT}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `daily_manure_N`: Daily kg of manure N added to the open lot\n", - "* `LEACHING_COEFFICIENT`: kg of N leached per kg of manure N added per day to the open lot; set at 0.035.\n", - "\n", - "### Received, stored, and emptied outputs\n", - "\n", - "Manure storages in RuFaS report two types of outputs to OutputManager each day: received manure and stored manure. \n", - "\n", - "**Received Manure**\n", - "\n", - "Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values. \n", - "\n", - "**Stored Manure**\n", - "\n", - "Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In open lot processors, daily losses include CH4, NH3, and N2O emissions, and N leaching. The order of operations in updating accumulated manure values is: \n", - "\n", - "* Add received manure values to stored manure values\n", - "* Calculate gas emissions and total nutrient losses based on stored manure values\n", - "* Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. \n", - "\n", - "For open lot and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. \n", - "\n", - "**Emptied Manure**\n", - "\n", - "Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and Manure Stream attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage.\n", - "\n", - "### Manure Composition Update\n", - "\n", - "**Received Manure**\n", - "\n", - "Received manure simply refers to the manure being loaded into the manure storage each day (i.e., deposited on the lot). In open lot processors, the following nutrient sources are represented in received manure values:\n", - "\n", - "* `ManureStream` values, as received from the previous processor(s) in the manure management chain. In open lot processors, which are placed first in the manure management chain as there are no intermediary steps between animal excretion and the open lot, this ManureStream instance typically represents manure and bedding received directly from the Animal module.\n", - "* Daily precipitation volume/mass is **not** currently represented in received open lot manure.\n", - "\n", - "**Stored Manure**\n", - "\n", - "Below is a summary of updates to ManureStream variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", - "\n", - "Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. Received manure simply refers to the manure being loaded into the manure storage each day. " - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "tbl-mn-OL-calc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| Variable | Units | Calculation |\n", - "+:=======================================+:========:+:=========================================================================================+\n", - "| water | kg | Stored manure water + received manure water |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| total_ammoniacal_nitrogen | kg | max(0, stored manure ammoniacal N + received ammoniacal N-NH$_3$N emissions) |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| nitrogen | kg | Stored manure N + received manure N - NH$_3$-N - N$_2$O-N emissions |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| phosphorus | kg | Stored manure P + received manure P |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| potassium | kg | Stored manure K + received manure K |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| ash | kg | Stored manure ash + received manure ash |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| degradable_volatile_solids | kg | stored degradable VS + received degradable VS - VSd loss |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| manure_non_degradable_volatile_solids | kg | stored manure non-degradable VS + received manure non-degradable VS - VSnd loss |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| bedding_non_degradable_volatile_solids | kg | stored bedding non-degradable VS + received bedding non-degradable VS |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| total_solids | kg | Stored TS + received TS - VS loss |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+\n", - "| volume | m$^3$ | Stored volume + received volume - $\\frac{\\text{VS loss}}{\\text{SOLID\\_MANURE\\_DENSITY}}$ |\n", - "+----------------------------------------+----------+------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-OL-calc\n", - "#| tbl-cap: Calculated manure storage variables and their units.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-OL-calc.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "6eba11e4", - "metadata": {}, - "source": [ - "::: {.callout-note}\n", - "The “Max(0, )” notation prevents the ammoniacal N value from becoming negative. This is especially important early in a simulation when accumulated manure quantities that are very small compared to the fixed surface area value can lead to high ammonia emissions.\n", - "\n", - "degradable_volatile_solids_frac = received manure degradable_volatile_solids / received manure total_volatile_solids\n", - "::: \n", - "\n", - "\n", - "## Composting\n", - "\n", - "### Introduction\n", - "\n", - "Composting is a method of treating manure in which solid manure, generally with bedding or other carbon-rich material added, is purposefully managed in order to promote microbial decomposition. This naturally occurring decomposition process results in losses of both water and organic matter, resulting in a smaller volume and mass of manure the farm is required to store and handle. Composting also helps to stabilize manure by killing pathogens and weed seeds via heat generated from the decomposition process, and reduced odors. Finished compost is a useful end-product (like all well-managed manure) that can be land-applied, sold, or otherwise exported. \n", - "\n", - "To promote optimal conditions for microbial decomposition, compost requires airflow through the pile to prevent anaerobic conditions from forming. While turning is the traditional way to achieve this, several methods to accomplish the necessary aeration of compost exist on farms today.\n", - "\n", - "**Implementation in RuFaS**\n", - "\n", - "The following composting methods are represented in RuFaS:\n", - "\n", - "* Static pile: material to be composted is piled and not turned/moved throughout the composting process. Aeration is maintained using either bulking agents to create airspace in the pile, or through forced air introduction via pipes.\n", - "* Intensive windrow: material to be composted is piled into long rows that are regularly turned to redistribute moisture, nutrients, and air through the pile.\n", - "* Passive windrow: material to be composted is piled into long rows, but is not regularly turned, and instead relies on passive air diffusion to aerate the pile.\n", - "* In-vessel: material to be composted is loaded into a large vessel, often a drum, which is mechanically rotated to promote uniform air circulation and heating.\n", - "\n", - "At this time, turning frequency, pile composition, composting duration, C:N ratio, and other factors do not directly affect emissions or nutrient loss calculations. Only the general composting method and the basic composition (kg of N, volatile solids, etc.) of material added to the pile is factored into this submodule’s calculations at this time.\n", - "\n", - "**Classes**" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "tbl-mn-CP-classes", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+---------------------+-----------------+\n", - "| | Description |\n", - "+:===================:+:===============:+\n", - "| Storage(Composting) | composting.py |\n", - "+---------------------+-----------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-CP-classes\n", - "#| tbl-cap: Classes available in composting.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-CP-classes.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "bdfda126", - "metadata": {}, - "source": [ - "### Required User Inputs" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "id": "tbl-mn-CP-inputs", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+---------------------+---------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Variable | Definition | Description |\n", - "+:====================+:=============================================================:+:=============================================================================================================================================+\n", - "| Name | -- | Unique identifier of the specific handler configuration used. |\n", - "+---------------------+---------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| storage_time_period | days | The number of days that the manure is stored between emptying events. At the end of this interval, the manure storage is emptied completely. |\n", - "+---------------------+---------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| composting_type | static pile, passive windrow, intensive windrow, or in-vessel | The type of method used for composting. |\n", - "+---------------------+---------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-CP-inputs\n", - "#| tbl-cap: Required inputs for the composting section (`refreshed_manure_management.json`).\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-CP-inputs.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "779e91f9", - "metadata": {}, - "source": [ - "**Other Inputs**\n", - "\n", - "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. `ManureStream` instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$ / kgVS):\n", - "\n", - "* water \n", - "* `ammoniacal_nitrogen`\n", - "* nitrogen \n", - "* phosphorus\n", - "* potassium\n", - "* ash\n", - "* `manure_degradable_volatile_solids`\n", - "* `manure_non_degradable_volatile_solids`\n", - "* `bedding_non_degradable_volatile_solids`\n", - "* `total_solids`\n", - "* mass (equal to sum of water and total solids)\n", - "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", - "* volume\n", - "* `methane_production_potential`\n", - "\n", - "### Expected Outputs\n", - "\n", - "* `ManureStream variables` representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses\n", - "* `storage_methane` (kg): Total mass of CH4 emitted from the compost each day.\n", - "* `storage_ammonia_N` (kg): Total mass of NH3-N emitted from the compost each day.\n", - "* `storage_nitrous_oxide_N` (kg): Total mass of N2O-N emitted from the compost each day.\n", - "* `storage_nitrogen_leached` (kg): Total mass of N leached from the compost each day. Leached N is assumed to be lost to the environment, and is not captured in runoff that may enter a manure storage.\n", - "* `carbon_decomposition` (kg): the total quantity of manure C lost through microbial degradation of volatile solids. \n", - "\n", - "### Methodology\n", - "\n", - "**Calculate Daily Methane Generation** `_calculate_composting_methane_emissions`\n", - "\n", - "Calculates the daily mass of methane emitted from the compost based on manure volatile solids (VS) added to compost (from animal excretion and bedding addition) and an emission factor based on composting method and simulation average temperature described in @tbl-mn-CP-met-conv [@Hanson2024]. Here and in other equations, ‘daily’ denotes the value associated with received manure added to the open lot on a specified simulation day.\n", - "\n", - "::: {.callout-note}\n", - "The quantity of volatile solids utilized in determination of CH4 includes only manure-excreted volatile solids; bedding volatile solids are excluded.\n", - "::: " - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "id": "tbl-mn-CP-met-conv", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------+----------------------------+---------+---------+--------+\n", - "| Composting Method | Average air temp (°C) | | .1 | |\n", - "+:=====================+:==========================:+:=======:+:=======:+:=======+\n", - "| | 0 - 10 | 10 - 18 | > 18 | |\n", - "+----------------------+----------------------------+---------+---------+--------+\n", - "| In-vessel | 0.5 | 0.5 | 0.5 | |\n", - "+----------------------+----------------------------+---------+---------+--------+\n", - "| Static pile | 1.0 | 2.0 | 2.5 | |\n", - "+----------------------+----------------------------+---------+---------+--------+\n", - "| Intensive windrow | 0.5 | 1.0 | 1.5 | |\n", - "+----------------------+----------------------------+---------+---------+--------+\n", - "| Passive windrow | 1.0 | 2.0 | 2.5 | |\n", - "+----------------------+----------------------------+---------+---------+--------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-CP-met-conv\n", - "#| tbl-cap: Required inputs for the composting section (`refreshed_manure_management.json`).\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-CP-met-conv.csv\",\n", - " colalign = [\"left\", \"center\", \"center\", \"center\",]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "6c352473", - "metadata": {}, - "source": [ - ":::{}\n", - "[See [MN.MET.6](#eq-mn-met-6)]{.aside .content-visible when-format=\"html\"} \n", - "$$\n", - "\\text{methane (kg)} = \\text{B}_0 \\times \\text{MCF} \\times \\text{tVS}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* B$_0$ = methane production potential (kg CH4 per kg manure VS) of manure excreted into the bedded pack on a specified simulation day\n", - "* MCF = methane conversion factor, based on simulation average ambient temperature\n", - "* tVS (kg) = daily mass (kg) of manure-excreted total VS in the bedded pack manure, received from `ManureStream(s)`; note that bedding VS are not included in this value\n", - "* `METHANE_FACTOR` = 0.67; unite conversion factor for CH4 volume to mass (kg)\n", - "\n", - "**Calculate Carbon Decomposition** `calculate_carbon_decomposition`\n", - "\n", - "Carbon in the compost material is degraded through primarily aerobic microbial processes. This process is a function of substrate availability/degradability, temperature, moisture, aeration, and microbial population. This series of calculations is based on the IFSM composting simulation method, which is described in detail in @bonifacio2017a and @bonifacio2017b. Simplifications/assumptions that have been made which diverge from the original method are explicitly noted below. \n", - "\n", - "First, we calculate the maximum decomposition rate per day, and decomposition rate of the slow fraction per day. We use the same equation for both rates, however, the temperature value used in calculating maximum decomposition rate is 60℃, versus the actual ambient air temperature in calculating slow fraction degradation. The maximum decomposition rate value is set to 0.04195, but the equation is shown below for reference.\n", - "\n", - ":::{style=\"font-size:90%\"}\n", - "[See [MN.STO.4](#eq-mn-sto-4)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{max\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", - "&\\qquad \\times (1.066^{(\\text{DECOMPOSITION\\_TEMPERATURE}-10)} - 1.21^{(\\text{DECOMPOSITION\\_TEMPERATURE}-50)})\n", - "\\end{aligned}\n", - "$$\n", - "::: \n", - "\n", - "*Where*:\n", - "\n", - "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", - "* `DECOMPOSITION_TEMPERATURE`: temperature of the inner compost layer, set to 60℃ (reflective of temperature at which microbial growth, and thus decomposition, is maximized)\n", - "\n", - ":::{}\n", - "[See [MN.STO.5](#eq-mn-sto-5)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{slow\\_decomp\\_rate} &= \\text{EFFECTIVE\\_MICROBIAL\\_DECOMP\\_RATE} \\\\[8pt]\n", - "&\\qquad \\times (1.066^{(\\text{daily\\_temperature}-10)} - 1.21^{(\\text{daily\\_temperature}-50)})\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - " \n", - "*Where*:\n", - "\n", - "* `EFFECTIVE_MICROBIAL_DECOMP_RATE` (unitless): The effectiveness of microbial decomposition rate per day, set to 0.00237\n", - "* `daily_temperature`: average ambient air temperature on a single day (℃)\n", - "\n", - "Second, we calculate the carbon decomposition rate per day (`calculate_carbon_decomposition_rate`). The value of this parameter is equal to 0.03876, but the equation and set values are included below for reference. \n", - "\n", - ":::{style=\"font-size:90%\"}\n", - "[See [MN.STO.6](#eq-mn-sto-6)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{C\\_decomp\\_rate} &= (\\text{max\\_decomp\\_rate} - \\text{slow\\_decomp\\_rate}) \\\\[8pt] \n", - "&\\qquad \\times e^{\\text{FIRST\\_ORDER\\_DECAYING\\_COEFFICIENT} \\times (\\text{DEFAULT\\_DAYS\\_SINCE\\_LAST\\_MIXING} - \\text{DEFAULT\\_LAG\\_TIME})} \\\\[8pt]\n", - "&\\qquad + \\text{slow\\_decomp\\_rate}\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `max_decomp_rate` and `slow_decomp_rate` calculated with [MN.STO.4]{@eq-mn-sto-4} and [MN.STO.5]{#eq-mn-sto-5}\n", - "* `FIRST_ORDER_DECAYING_COEFFICIENT`: First-order decaying coefficient constant, set to 0.10\n", - "* `DEFAULT_DAYS_SINCE_LAST_MIXING`: number of days from the start of composting or last turning/mixing event, set to 1 (i.e., assuming daily mixing)\n", - "* `lag`: lag time in days to reach maximum decomposition rate, set to 2\n", - "\n", - "\n", - "Third, we calculate the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. This value is set to 0.9664, but the equation and fixed values are provided below for reference. \n", - "\n", - ":::{style=\"font-size:90%\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{max\\_decomp\\_rate} &= \\frac{\\text{oxygen\\_mole\\_fraction}}{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_mole\\_fraction}} \\\\[8pt]\n", - "&\\qquad \\times \\frac{\\text{oxygen\\_half\\_saturation\\_constant} + \\text{oxygen\\_ambient\\_air\\_mole\\_fraction}}{\\text{oxygen\\_ambient\\_air\\_mole\\_fraction}} \\\\[8pt]\n", - "&\\qquad = \\frac{0.15}{0.02+0.15} \\times \\frac{0.02+0.21}{0.21} = 0.9664\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `oxygen_mole_fraction`: mole fraction of oxygen in the air within the windrow, unitless, set at 0.15. This is a simplification as oxygen content of the manure pack is not currently modeled.\n", - "* `oxygen_half_saturation_constant`: the half-saturation constant, unitless, set at 0.02 by the original publication.\n", - "* `oxygen_ambient_air_mole_fraction`: the mole fraction of oxygen in ambient air, unitless, set at 0.21 (ambient air is approximately 21% oxygen).\n", - " \n", - "Fourth, we calculate total carbon in the compost material available for decomposition. Here we make some assumptions on the carbon content of manure degradable vs. non-degradable volatile solids. Degradable volatile solids, which originate from fecal excretion by animals, are considered to be 50% carbon by weight @larney2011. Non-degradable volatile solids, which originate primarily from bedding addition, are assumed to contain 35\\% carbon by weight. The total carbon available is the sum of these two quantities. \n", - "\n", - ":::{}\n", - "[See [MN.STO.7](#eq-mn-sto-7)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{carbon\\_from\\_VSd (kg)} &= \\text{degradable\\_volatile\\_solids} \\\\[8pt]\n", - "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSD}\n", - "\\end{aligned}\n", - "$$\n", - "::: \n", - "\n", - "*Where*:\n", - "\n", - "* `degradable_volatile_solids`: The degradable volatile solids (kg) in the daily manure added to the compost.\n", - "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSD`: the carbon content (%) of manure degradable volatile solids, set to 50% by default. \n", - "\n", - ":::{}\n", - "[See [MN.STO.8](#eq-mn-sto-8)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{carbon\\_from\\_VSnd (kg)} &= \\text{non\\_degradable\\_volatile\\_solids} \\\\[8pt] \n", - "&\\qquad \\times \\text{DEFAULT\\_CARBON\\_FRACTION\\_AVAILABLE\\_IN\\_VSND}\n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `non_degradable_volatile_solids`: The non-degradable volatile solids (kg) in the daily bedding and manure added to the compost.\n", - "* `DEFAULT_CARBON_FRACTION_AVAILABLE_IN_VSD`: the carbon content (%) of manure non-degradable volatile solids, set to 35% by default. \n", - "\n", - ":::{}\n", - "[See [MN.STO.9](#eq-mn-sto-9)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{total\\_carbon (kg)} = \\text{carbon\\_from\\_VSnd} + \\text{carbon\\_from\\_VSd}\n", - "$$\n", - ":::\n", - "\n", - "Finally, we calculate total carbon decomposition in kg/d using the coefficients and values calculated in the steps above (`calculate_carbon_decomposition`): \n", - "\n", - ":::{style=\"font-size:90%\"}\n", - "[See [MN.STO.10](#eq-mn-sto-10)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\begin{aligned}\n", - "\\text{total\\_carbon\\_decomposition (kg)} &= \\text{total\\_carbon} \\times \\text{C\\_decomp\\_rate} \\times \\text{anaerobic\\_effect} \\\\[8pt]\n", - "&\\qquad \\times \\text{DEFAULT\\_MOISTURE\\_EFFECT\\_MICROBIAL\\_DECOMP} \n", - "\\end{aligned}\n", - "$$\n", - ":::\n", - " \n", - "*Where*:\n", - "\n", - "* `total_carbon`: total carbon available in manure pack (kg); [MN.STO.9]{#eq-mn-sto-9}\n", - "* `C_decomp_rate`: carbon decomposition rate per day; [MN.STO.10]{#eq-mn-sto-10}\n", - "* `DEFAULT_MOISTURE_EFFECT_MICROBIAL_DECOMP`: The effect of moisture on microbial decomposition, set at 0.65. This is a simplification as moisture content of the manure pack is not currently modeled. \n", - "* `anaerobic_effect`: the anaerobic effect coefficient, related to the effect of the degree of aeration in the manure pack on decomposition. Set to 0.9664 by default. \n", - "\n", - "**Calculate Total VS Loss** `_apply_dry_matter_loss`\n", - "\n", - "The quantity of total and volatile solids remaining in the compost each day must be updated according to estimated CH4 and C decomposition losses. To do this, we calculate the total daily loss of VS through CH4 emission and C decomposition. Loss of mass through CH4 emissions is assumed to be equal to the mass of CH4 emitted. Manure volatile solids are assumed to be 50% C, therefore, to determine total mass loss through C decomposition, we divide the mass of C decomposition by 0.50. \n", - "\n", - ":::{}\n", - "[See [MN.STO.11](#eq-mn-sto-11)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{total\\_volatile\\_solids\\_loss (kg)} = \\text{methane} + \\frac{\\text{total\\_carbon\\_decomposition}}{0.50}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* methane (kg): The daily methane loss, calculated with [MN.MET.6]{#eq-mn-met-6}, based on the daily quantity of manure VS added to the compost\n", - "* `total_carbon_decomposition` (kg): quantity of C lost through microbial decomposition (kg), calculated with [MN.STO.10]{#eq-mn-sto-10}, based on the daily quantity of manure VS added to the compost\n", - "\n", - "**Calculate N Loss to Ammonia** `_calculate_composting_ammonia_emissions`\n", - "\n", - "Manure nitrogen being added to and accumulating in the compost results in NH3 emissions. Here we utilize daily manure N addition to compost and an emission factor based on composting method @Hanson2024 to estimate total kg of NH3-N loss." - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "id": "tbl-mn-CP-NH3-fac", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------+-----------------------------------------------------+\n", - "| Composting method | kg NH$_3$-N emitted per kg of N added to compost |\n", - "+:====================:+:===================================================:+\n", - "| In-vessel | 0.45 |\n", - "+----------------------+-----------------------------------------------------+\n", - "| Static Pile | 0.5 |\n", - "+----------------------+-----------------------------------------------------+\n", - "| Intensive Windrow | 0.5 |\n", - "+----------------------+-----------------------------------------------------+\n", - "| Passive Windrow | 0.45 |\n", - "+----------------------+-----------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-CP-NH3-fac\n", - "#| tbl-cap: NH$_3$-N emission factors for compost by composting method.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-CP-NH3-fac.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "1663a5f7", - "metadata": {}, - "source": [ - ":::{}\n", - "[See [MN.AMM.8](#eq-mn-amm-8)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{storage\\_ammonia\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{ammonia\\_coefficient}\n", - "$$\n", - "::: \n", - " \n", - "*Where*:\n", - "\n", - "* `daily_manure_N`: Daily kg of manure N added to compost\n", - "* `AMMONIA_EMISSION_COEFFICIENT_IN_OPEN_LOTS`: kg of NH3-N emitted per kg of manure N added per day to compost, based on the composting method\n", - "\n", - "**Calculate N Loss to Nitrous Oxide** `_calculate_nitrous_oxide_emissions`\n", - "\n", - "In addition to NH3-N emissions, nitrogen added to and accumulating in the compost also results in N$_2$O emissions. Similar to NH3, here we utilize daily manure N addition to compost and an emission factor based on composting method @Hanson2024 to estimate total kg of N$_2$O-N loss." - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "id": "tbl-mn-CP-N2O-fac-a", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------+-----------------------------------------------------+\n", - "| Composting method | kg NH$_3$-N emitted per kg of N added to compost |\n", - "+:====================:+:===================================================:+\n", - "| In-vessel | 0.006 |\n", - "+----------------------+-----------------------------------------------------+\n", - "| Static Pile | 0.01 |\n", - "+----------------------+-----------------------------------------------------+\n", - "| Intensive Windrow | 0.005 |\n", - "+----------------------+-----------------------------------------------------+\n", - "| Passive Windrow | 0.005 |\n", - "+----------------------+-----------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-CP-N2O-fac-a\n", - "#| tbl-cap: N$_2$O-N emission factors for compost by composting method.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-CP-N2O-fac-a.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "1419dc33", - "metadata": {}, - "source": [ - ":::{}\n", - "[See [MN.NIT.1](#eq-mn-NIT-1)]{.aside .content-visible when-format=\"html\"}\n", - "$$\n", - "\\text{storage\\_nitrous\\_oxide\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{nitrous\\_oxide\\_coefficient}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `daily_manure_N`: Daily kg of manure N added to the compost\n", - "* `NITROUS_OXIDE_COEFFICIENT_IN_OPEN_LOTS`: kg of N2O-N emitted per kg of manure N added per day to the compost, based on the composting method\n", - "\n", - "**Calculate N Loss to Leaching** `calculate_nitrogen_loss_to_leaching`\n", - "\n", - "Nitrogen in compost may also be lost to leaching. Leaching of compost N may occur when fecal and urinary N are converted to nitrate in the soil beneath the compost, if the compost is not contained in a vessel. Nitrate can then be carried away via water movement through the subsoil. Similar to NH3 and N2O, we use daily manure N addition to compost and an emission factor based on composting method @Hanson2024 to estimate total kg of leaching N loss." - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "id": "tbl-mn-CP-N2O-fac", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------+-----------------------------------------------------+\n", - "| Composting method | kg NH$_3$-N emitted per kg of N added to compost |\n", - "+:====================:+:===================================================:+\n", - "| In-vessel | 0 |\n", - "+----------------------+-----------------------------------------------------+\n", - "| Static Pile | 0.06 |\n", - "+----------------------+-----------------------------------------------------+\n", - "| Intensive Windrow | 0.06 |\n", - "+----------------------+-----------------------------------------------------+\n", - "| Passive Windrow | 0.04 |\n", - "+----------------------+-----------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-CP-N2O-fac\n", - "#| tbl-cap: N$_2$O-N emission factors for compost by composting method.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-CP-N2O-fac.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "0195cbb9", - "metadata": {}, - "source": [ - ":::{}\n", - "[See [MN.STO.12](#eq-mn-sto-12)]{.aside .content-visible when-format=\"html\"} \n", - "$$\n", - "\\text{storage\\_leached\\_N (kg)} = \\text{daily\\_manure\\_N} \\times \\text{LEACHING\\_COEFFICIENT}\n", - "$$\n", - ":::\n", - "\n", - "*Where*:\n", - "\n", - "* `daily_manure_N`: Daily kg of manure N added to the compost\n", - "* `LEACHING_COEFFICIENT`: kg of N leached per kg of manure N added per day to the compost, based on composting method\n", - "\n", - "### Received, stored, and emptied outputs\n", - "\n", - "**Received Manure**\n", - "\n", - "Received manure outputs represent the quantity of manure mass and nutrients added to the manure storage on a single day. No nutrient losses from gas or other emissions/losses are reflected in these output values.\n", - "\n", - "**Stored Manure**\n", - "\n", - "Stored manure outputs represent the accumulated quantity of manure and nutrients present in storage on a single day. These values are the net quantity of mass/nutrients remaining each day after adding received manure values and subtracting any losses to gas emissions or other losses. In composting processors, daily losses include CH4, NH3, N leaching, and N2O emissions. The order of operations in updating accumulated manure values is: \n", - "\n", - "1. Add received manure values to stored manure values\n", - "2. Calculate gas emissions and total nutrient losses based on received manure values\n", - "3. Update stored manure values based on the day’s nutrient losses. See the Manure composition update section for specific details on how nutrient gains and losses are accounted for on a daily timestep. \n", - " \n", - "For composting and all other storage processor types, the stored manure values (not received manure) are passed to the next processor in the chain (e.g. another storage, field application, export, etc.) when the storage time interval is complete. \n", - "\n", - "**Emptied Manure**\n", - "\n", - "Manure may be removed from storage via requests made by the Crop and Soil module. The user specifies the days and years for manure removal (i.e. application), as well as the application type (liquid or solid) and quantity of N or P required for each application date within year. Note that these actions are the responsibility of the Crop and Soil module; more information on manure application inputs and methodology can be found in the Crop and Soil module documentation. When manure is removed from storage by the Crop and Soil module, emptied manure outputs report the quantity of manure and nutrients removed on that day, and Manure Stream attributes representing stored manure are updated accordingly to reflect post-removal amounts remaining in storage.\n", - "\n", - "### Manure Composition Update\n", - "\n", - "**Received Manure**\n", - "\n", - "In composting processors, the following nutrient sources are represented in received manure values:\n", - "\n", - "* `ManureStream values`, as received from the previous processor(s) in the manure management chain. \n", - "* For composting processors, these `ManureStream` instance(s) typically represent an accumulated quantity of manure from an open lot or bedded pack, daily/weekly cleanout of the manure/bedding mix generated by other pen types, or daily addition of separated manure solids. \n", - "\n", - "Daily precipitation volume/mass is not currently represented in received manure added to compost (i.e., precipitation falling each day is not represented in the received manure outputs representing nutrient/mass/water additions to compost each day).\n", - "\n", - "**Stored Manure**\n", - "\n", - "Below is a summary of updates to ManureStream variables representing the stored manure. Note that the formulas below may be a summarization of multiple steps detailed above, and are intended to provide an overview of what mass losses/gains are reflected in the value of each variable.\n", - "\n", - "Equations in the table below (Calculation column) are in the format of: updated stored manure value = yesterday’s stored manure value + today’s manure value +/- XYZ. The updated stored manure values reflect the total quantity of manure/nutrients in storage on a single day after accounting for all gains/losses that occurred on that day. " - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "id": "tbl-mn-CP-calc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| Variable | Units | Calculation |\n", - "+:=======================================+:========:+:=======================================================================================+\n", - "| water | kg | Stored manure water + received manure water |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| total_ammoniacal_nitrogen | kg | max (0, stored manure ammoniacal N + received ammoniacal N - NH$_3$-N emissions) |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| nitrogen | kg | Stored nitrogen + received nitrogen - NH$_3$-N - N$_2$O-N emissions |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| phosphorus | kg | Stored phosphorus + received phosphorus |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| potassium | kg | Stored potassium + received potassium |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| ash | kg | Stored ash + received ash |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| degradable_volatile_solids | kg | stored degradable VS + received degradable VS - VSd loss |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| manure_non_degradable_volatile_solids | kg | stored manure non-degradable VS + received manure non-degradable VS - VSnd loss |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| bedding_non_degradable_volatile_solids | kg | stored bedding non-degradable VS + received bedding non-degradable VS |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| total_solids | kg | Stored TS + received TS - VS loss |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+\n", - "| volume | m$^3$ | Stored volume + received volume - \\frac{\\text{VS_loss}}{\\text{SOLID\\_MANURE\\_DENSITY}} |\n", - "+----------------------------------------+----------+----------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-CP-calc\n", - "#| tbl-cap: Manure storage variable calculations\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-CP-calc.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "6b213014", - "metadata": {}, - "source": [ - "::: {.callout-note}\n", - "The “Max(0, )” notation prevents the ammoniacal N value from becoming negative. This is especially important early in a simulation when accumulated manure quantities that are very small compared to the fixed surface area value can lead to high ammonia emissions.\n", - "\n", - "degradable_volatile_solids_frac = received manure degradable_volatile_solids / received manure total_volatile_solids\n", - "::: \n", - "\n", - "## Daily Spread\n", - "\n", - "### Introduction\n", - "\n", - "Daily spread is a method of manure management in which manure is collected daily (or several times per week) directly from animal housing areas and field-applied. This manure management strategy may be more labor intensive but can greatly reduce the quantity of manure a farm must store. \n", - "\n", - "**Implementation in RuFaS**\n", - "\n", - "Daily spread in RuFaS is implemented as essentially a \"blank\" manure processor. It receives manure but does not estimate any gas emissions, nutrient losses, or changes to manure composition. \n", - "\n", - "::: {.callout-note}\n", - "Note that this section covers strictly the Manure Module daily spread functionality; the actual daily application of manure from the manure module occurs in the Crop and Soil module and is thus covered in the Crop and Soil documentation.\n", - ":::\n", - "\n", - "**Classes**" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "id": "tbl-mn-DS-classes", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+----------------------+-----------------+\n", - "| Digester | Description |\n", - "+:====================:+:===============:+\n", - "| DailySpread(Storage) | daily_spread.py |\n", - "+----------------------+-----------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-DS-classes\n", - "#| tbl-cap: List of classes for daily spread\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-DS-classes.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "6b04442d", - "metadata": {}, - "source": [ - "### Required User Inputs" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "id": "tbl-mn-DS-inputs", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+------------+----------+-------------------------------------------------------------------+\n", - "| Variable | Units | Description |\n", - "+:==========:+:========:+:==================================================================+\n", - "| name | -- | Unique identifier of the specific daily spread configuration used |\n", - "+------------+----------+-------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-DS-inputs\n", - "#| tbl-cap: Required inputs for the daily spread section (`refreshed_manure_management.json`)\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-DS-inputs.csv\",\n", - " colalign = [\"center\", \"center\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "8e5e223d", - "metadata": {}, - "source": [ - "**Other Inputs**\n", - "\n", - "Instance(s) of `ManureStream` for each manure stream defined by the user that represent the attributes of the manure in the specific manure stream. `ManureStream` instances include the following variables (all in kg except for volume, m$^3$ and manure methane production potential, m$^3$ / kgVS):\n", - "\n", - "* water \n", - "* `ammoniacal_nitrogen`\n", - "* nitrogen \n", - "* phosphorus\n", - "* potassium\n", - "* ash\n", - "* `manure_degradable_volatile_solids`\n", - "* `manure_non_degradable_volatile_solids`\n", - "* `bedding_non_degradable_volatile_solids`\n", - "* `total_solids`\n", - "* mass (equal to sum of water and total solids)\n", - "* total volatile solids (equal to sum of degradable and non-degradable volatile solids)\n", - "* volume\n", - "* `methane_production_potential`\n", - "\n", - "### Expected Outputs\n", - "\n", - "* ManureStream variables representing manure received by daily spread processor each day\n", - "\n", - "## Key constants" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "id": "tbl-mn-constants", - "metadata": {}, - "outputs": [ - { - "data": { - "text/markdown": [ - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| Variable | Value | Definition |\n", - "+:======================================+:===============================:+:=====================================================================================================+\n", - "| MANURE_DAMPING_FACTOR | 0.65 | Fixed damping factor applied to the air temperature amplitude |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| MANURE_TEMPERATURE_LAG | 30 d | Lag constant representing delayed thermal response of manure temperature relative to air temperature |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| ANAEROBIC_LAGOON_MANURE_RETENTION | 0.1 | Fraction of stored manure retained in anaerobic lagoon when storage interval is reached |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| ACTIVATION_ENERGY | 81 000 J/mol | Apparent activation energy of methanogenesis in dairy manure |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DEFAULT_STORED_MANURE_PH | 7.5 | Default pH of manure in slurry storage or anaerobic lagoon |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| FREEBOARD_CONSTANT | 1.2 | 20% volume allowance above max volume if surface area not user-defined |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DEPTH_CONSTANT | 4.572 m | Depth of slurry/liquid manure storage used for surface area calculation |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| PRECIPITATION_CONSTANT | 0.25 m | Annual precipitation constant for determining storage surface area |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| MANURE_CONVERSION_CONSTANT | 0.1175 m$^3$ | Factor to estimate manure volume per cow per day |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| METHANE_DESTRUCTION_EFFICIENCY | 0.81 | Percent methane destroyed with cover and flare system |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| VS_TO_METHANE_LOSS_RATIO | 6.665 kg | Mass ratio of CO2+CH4 to CH4 from storage |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| NATURAL_LOG_ARRHENIUS_CONSTANT | 30.6 g CH4/kg VS/h | Log of Arrhenius parameter for methane emissions from stored manure |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| STORAGE_RESISTANCE | 23.1 s/m | Default resistance to ammonia volatilization |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| SLURRY_MANURE_DENSITY | 990 kg/m$^3$ | Default density of manure as excreted. |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| AMMONIA_EMISSION_COEFFICIENT_UNTILLED | 0.25 | Ammonia emission coefficient (no mixing) |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| AMMONIA_EMISSION_COEFFICIENT_TILLED | 0.5 | Ammonia emission coefficient (with mixing) |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DEFAULT_DAYS_SINCE_LAST_MIXING | 1 d | Days since last mixing for C decomposition |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| NITROUS_OXIDE_EMISSION_UNTILLED | 0.01 | N2O-N emitted per kg manure N/day (no mixing) |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| NITROUS_OXIDE_EMISSION_TILLED | 0.07 | N2O-N emitted per kg manure N/day (with mixing) |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| HOUSING_SPECIFIC_CONSTANT | 260.0 s/m | Default constant for ammonia emissions from housing |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DEFAULT_PH_FOR_HOUSING_AMMONIA | 7.7 | Default pH for manure on housing floors |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| MILKING_FRESH_WATER_USE_RATE | 30 L/animal/day | Milking water use rate per animal |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| WATER_DENSITY_KG_PER_M3 | 0.997 kg/m$^3$ | Default water density |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| CARBON_DIOXIDE_MOLAR_MASS | 44.01 g/mol | Molar mass of CO2 |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| CARBON_DIOXIDE_TO_METHANE_RATIO | 4-6 | Volumetric ratio of CO2 to CH4 during digestion |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| IDEAL_GAS_LAW_R | 0.0821 L atm/mol K | Ideal gas law constant |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| METHANE_MOLAR_MASS | 16.04 g/mol | Molar mass of CH4 |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| TAN_INCREASE_FACTOR | 1.60 | TAN increase from anaerobic digestion (unitless) |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DEFAULT_LAYER_TEMPERATURE | 30°C | Default layer temperature for decomposition |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DECOMPOSITION_TEMPERATURE | 60°C | Temperature for peak microbial activity |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DEFAULT_CARBON_FRACTION_VSD | 0.5 | Carbon content of degradable VS |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DEFAULT_CARBON_FRACTION_VSND | 0.35 | Carbon content of non-degradable VS |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DEFAULT_MOISTURE_EFFECT | 0.65 | Moisture effect on microbial decomposition |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DEFAULT_LAG_TIME | 2 d | Lag time for C decomposition |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| EFFECTIVE_MICROBIAL_DECOMP_RATE | 0.00237 | Microbial decomposition rate (unitless) |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| FIRST_ORDER_DECAY_COEFFICIENT | 0.01 | First-order decay coefficient |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| LEACHING_COEFFICIENT | -- | N leached per kg manure N/day |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| DEFAULT_DAYS_SINCE_LAST_HARROW | 1 d | Days since last harrow event |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| ACHIEVABLE_METHANE_EMISSION | 0.24 m$^3$ CH4/kg VS | Achievable methane generation |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| SOLID_MANURE_DENSITY | 700 kg/m$^3$ | Default solid manure density |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+\n", - "| LIQUID_MANURE_DENSITY | 1000 kg/m$^3$ | Default liquid manure density |\n", - "+---------------------------------------+---------------------------------+------------------------------------------------------------------------------------------------------+" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "#| label: tbl-mn-constants\n", - "#| tbl-cap: Key constants for all equations in the Manure Module.\n", - "import_table(\n", - " \"../resources/table_data/manure/tbl-mn-constants.csv\",\n", - " colalign = [\"left\", \"center\", \"left\"]\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "614f3626", - "metadata": {}, - "source": [ - "## References" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3", - "path": "c:\\Users\\jms349\\GitHub\\RuFaS\\.venv\\share\\jupyter\\kernels\\python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.0" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} From 7a7fe6ad5cf6e3416c7e40889fa0999cda5eb3a4 Mon Sep 17 00:00:00 2001 From: LisaM-kiwi Date: Fri, 17 Jul 2026 17:16:41 -0400 Subject: [PATCH 4/4] formating updates --- docs/scientific/quarto-scidoc/qmd/manure.qmd | 139 +++++++----------- .../table_data/manure/tbl-mn-AL-calc.csv | 2 +- 2 files changed, 53 insertions(+), 88 deletions(-) diff --git a/docs/scientific/quarto-scidoc/qmd/manure.qmd b/docs/scientific/quarto-scidoc/qmd/manure.qmd index f09546f529..07d43f3330 100644 --- a/docs/scientific/quarto-scidoc/qmd/manure.qmd +++ b/docs/scientific/quarto-scidoc/qmd/manure.qmd @@ -658,7 +658,7 @@ $$ *Where*: -* cow\_num: user-inputted number of mature cows housed on the farm +* `cow_num`: user-inputted number of mature cows housed on the farm * `MANURE_CONVERSION_CONSTANT`: Factor to estimate m$^3$ of herd-wide manure produced per day per mature cow housed on the farm, set to 0.1175 m$^3$. * `storage_time` (days): user-inputted number of days that manure is stored in this storage for before being emptied. * `FREEBOARD_CONSTANT`: the volume allowance above the maximum volume of a slurry or liquid manure storage, set to 1.20 (20%). @@ -926,20 +926,20 @@ In RuFaS, the underlying biological and gas emission methods are identical for s **Classes** ```{python} -#| label: tbl-mn-AL-classes +#| label: tbl-mn-al-classes #| tbl-cap: List of classes for anaerobic lagoon. import_table( - "../resources/table_data/manure/tbl-mn-AL-classes.csv", + "../resources/table_data/manure/tbl-mn-al-classes.csv", colalign = ["center", "center"] ) ``` ### Required User Inputs ```{python} -#| label: tbl-mn-AL-inputs +#| label: tbl-mn-al-inputs #| tbl-cap: Required inputs for the anaerobic lagoon section (`refreshed_manure_management.json`) import_table( - "../resources/table_data/manure/tbl-mn-AL-inputs.csv", + "../resources/table_data/manure/tbl-mn-al-inputs.csv", colalign = ["left", "center", "left"] ) ``` @@ -968,12 +968,11 @@ Instance(s) of ManureStream for each manure stream defined by the user that repr * ManureStream variables representing manure loaded (received) into storage each day, and accumulated manure after accounting for nutrient and mass gains/losses * `storage_methane`(kg): Daily emission of CH4 from accumulated manure in an anaerobic lagoon. * `storage_ammonia`(kg): Daily emission of NH3 from accumulated manure in an anaerobic lagoon. -* `storage_nitrous_oxide`(kg): Daily emission of N2O from accumulated manure in an anaerobic lagoon. +* `storage_nitrous_oxide`(kg): Daily emission of N2O from accumulated manure in an anaerobic lagoon. ### Methodology -**Calculate manure temperature** -`_determine_outdoor_storage_temperature` +**Calculate manure temperature** `_determine_outdoor_storage_temperature` Manure temperature is modeled using a cosine function whose parameters are derived from a least-squares fit of simulation-wide weather data. The air temperature amplitude is reduced using a damping factor to reflect the smaller annual variation in manure temperature relative to air. The phase shift (i.e., timing of peak temperature) is determined based on the least squares function and is adjusted by a fixed lag constant representing the delayed thermal response of manure temperature relative to air temperature. @@ -989,7 +988,7 @@ $$ *Where*: * amplitude: modeled amplitude of the seasonal air temperature function, calculated from user-supplied, simulation-wide weather data -* MANURE_DAMPING_FACTOR: a fixed damping factor applied to the air temperature amplitude, set to 0.65 +* `MANURE_DAMPING_FACTOR`: a fixed damping factor applied to the air temperature amplitude, set to 0.65 Second, we use this amplitude in the following function to determine modeled manure temperature (℃) each simulation day. Note the function includes a 'max' term to implement a lower temperature bound for manure temperature. @@ -997,10 +996,8 @@ Second, we use this amplitude in the following function to determine modeled man [[**MN.STO.14**]]{.aside .content-visible when-format="html"} $$ \begin{aligned} -\text{manure\_temp} &= \text{max}( \\ -&\text{mean\_temp} \times \text{manure\_amplitude} \times \text{cos}(\frac{2\pi}{365}) \\ - &\times (\text{jday} - \text{phase\_shift} - \text{MANURE\_TEMPERATURE\_LAG})), \\ - & \text{min\_temp}) +\text{manure\_temp} &= \text{max}(\text{mean\_temp} \times \text{manure\_amplitude} \times \text{cos}(\frac{2\pi}{365}) \\[8pt] +&\qquad \times (\text{jday} - \text{phase\_shift} - \text{MANURE\_TEMPERATURE\_LAG}), \text{min\_temp}) \\ \end{aligned} $$ ::: @@ -1008,15 +1005,16 @@ $$ *Where*: * mean_temp (℃): simulation_wide mean air temperature -* manure_amplitude: amplitude of the manure temperature function, determined in [MN.STO.13]{#eq-mn-sto-13} -* jday: Julian day of the simulation [MN.MET.3]{#eq-mn-met-3}r temperature in the simulation -* MANURE_TEMPERATURE_LAG (days): fixed lag constant representing the delayed thermal response of manure temperature relative to air temperature, set to 30. -* min_temp (℃): A fixed minimum temperature constant, dependent on the type of storage: -- Anaerobic lagoon: 1℃ -- Slurry storage outdoor: -20℃ +* `manure_amplitude`: amplitude of the manure temperature function, determined in [MN.STO.13](#eq-mn-sto-13) +* jday: Julian day of the simulation [MN.MET.3](#eq-mn-met-3) temperature in the simulation +* `MANURE_TEMPERATURE_LAG` (days): fixed lag constant representing the delayed thermal response of manure temperature relative to air temperature, set to 30. +* `min_temp` (℃): A fixed minimum temperature constant, dependent on the type of storage: + * Anaerobic lagoon: 1℃ + * Slurry storage outdoor: -20℃ -**Calculate storage surface area** -Exposed surface area (m$^2$) of the manure in storage is important in determining NH3-N emissions, as well as in determining precipitation volume added to storage if the storage is not covered or indoors. Wherever possible, this value should be provided by the user if modeling a real farm. If farm-specific information is unavailable or the farm being modeled is theoretical, the surface area should be estimated using tools like the USDA's Animal Waste Management Version 2.4.1. However, the RuFaS team recognizes that minimizing required inputs is desirable, though a fixed storage surface area is undesirable due to the variability in storage structure size and surface area. With this, an equation was developed that estimates storage surface area based on the following assumptions: +**Calculate Storage Surface Area** + +Exposed surface area (m$^2$) of the manure in storage is important in determining NH3-N emissions, as well as in determining precipitation volume added to storage if the storage is not covered or indoors. Wherever possible, this value should be provided by the user if modeling a real farm. If farm-specific information is unavailable or the farm being modeled is theoretical, the surface area should be estimated using tools like the USDA's Animal Waste Management Version 2.4.1. However, the RuFaS team recognizes that minimizing required inputs is desirable, though a fixed storage surface area is undesirable due to the variability in storage structure size and surface area. With this, an equation was developed that estimates storage surface area based on the following assumptions: * All manure excreted by animals on the farm enters the specified storage. At this time, the Manure module is not capable of assessing the proportion of manure excreted that is stored in the defined storages, therefore, all manure is assumed to be stored in the current storage, for the purposes of surface are estimation. * The storage is 15 ft deep, with vertical walls. @@ -1025,24 +1023,21 @@ Exposed surface area (m$^2$) of the manure in storage is important in determinin A constant value was derived to calculate estimated manure excretion based on the number of mature cows housed on the farm (a user input). The average number of animals in each class was determined according to default RuFaS animal life cycle inputs, and the total mass and volume of manure excreted by the herd was calculated. This resulted in an estimated daily herd-wide manure excretion of 168.6 kg or 0.118 m$^3$ of manure per mature cow housed on the farm. The resulting equation is used to calculate storage surface area (m$^2$). -:::{#eq-mn-sto-1 style="font-size:90%"} -[[**MN.STO.1**]]{.aside .content-visible when-format="html"} +:::{style="font-size:75%"} +[See [MN.STO.1](#eq-mn-sto-1)]{.aside .content-visible when-format="html"} $$ -\begin{aligned} -&\text{surface\_area(m$^2$)} = \\ -&\frac{\text{cow\_num} \times \text{MANURE\_CONVERSION\_CONSTANT} \times \text{storage\_time} \times \text{FREEBOARD\_CONSTANT}}{\text{DEPTH\_CONSTANT} - \text{PRECIPITATION\_CONSTANT}} -\end{aligned} +\text{surface\_area}(\text{m}^2) = \frac{\text{cow\_num} \times \text{MANURE\_CONVERSION\_CONSTANT} \times \text{storage\_time} \times \text{FREEBOARD\_CONSTANT}}{\text{DEPTH\_CONSTANT} - \text{PRECIPITATION\_CONSTANT}} $$ ::: *Where*: -* cow_num: user-inputted number of mature cows housed on the farm -* MANURE_CONVERSION_CONSTANT: Factor to estimate m$^3$ of herd-wide manure produced per day per mature cow housed on teh farm, set to 0.1175 m$^3$. -* storage_time (days): user-inputted number of days that manure is stored in this storage for before being emptied -* FREEBOARD_CONSTANT: the volume allowance above the maximum volume of a slurry or liquid manure storage, set to 1.20 (20%). -* DEPTH_CONSTANT: value for slurry or liquid manure storage depth, set to 4.572 m (15 feet) -* PRECIPITATION_CONSTANT: the annual precipitation constant value, used only in determination of storage surface area if surface area is not provided by the user, set to 0.25m. +* `cow_num`: user-inputted number of mature cows housed on the farm +* `MANURE_CONVERSION_CONSTANT`: Factor to estimate m$^3$ of herd-wide manure produced per day per mature cow housed on the farm, set to 0.1175 m$^3$. +* `storage_time` (days): user-inputted number of days that manure is stored in this storage for before being emptied +* `FREEBOARD_CONSTANT`: the volume allowance above the maximum volume of a slurry or liquid manure storage, set to 1.20 (20%). +* `DEPTH_CONSTANT`: value for slurry or liquid manure storage depth, set to 4.572 m (15 feet) +* `PRECIPITATION_CONSTANT`: the annual precipitation constant value, used only in determination of storage surface area if surface area is not provided by the user, set to 0.25m. **Calculate Precipitation Volume** @@ -1055,12 +1050,10 @@ The use of covers has implications for inclusion or exclusion of precipitation v Detailed descriptions are outlined in the Slurry Storage section of this module. Precipitation volume for anaerobic lagoons that are uncovered or have a crust is calculated as follows: -:::{#eq-mn-sto-2} -[[**MN.STO.2**]]{.aside .content-visible when-format="html"} +[See [MN.STO.2](#eq-mn-sto-2)]{.aside .content-visible when-format="html"} $$ \text{Daily\_precipitation\_volume}(\text{m}^3) = \text{storage\_surface\_area} \times \text{precipitation} $$ -::: *Where*: @@ -1073,12 +1066,10 @@ We use an adaptation of a method originally conceived by @Sommer2004 to calculat First, we must calculate the value of the Arrhenius exponent (`_calculate_arrhenius_exponent`). This value directly represents the responsiveness of biological reaction speed to temperature, and in the context of this empirical equation, may also be related to the methane potential of manure in storage and activity of the microbial population: -:::{#eq-mn-met-2} -[[**MN.MET.2**]]{.aside .content-visible when-format="html"} +[See [MN.MET.2](#eq-mn-met-2)]{.aside .content-visible when-format="html"} $$ \text{Arrh\_exp g}(\text{CH}_4\text{ kg}^{-1}\text{VS h}^{-1}) = e^{\text{Ln(A)} - \frac{\text{ACTIVATION\_ENERGY}}{\text{Gas constant} \times \text{manure temperature}}} $$ -::: *Where*: @@ -1089,17 +1080,15 @@ $$ Now we can calculate actual daily CH4 emission, based on the total quantity of VSd and VSnd in stored manure. The basic equation, used to calculate CH4 emissions for each VS fraction, is as follows: -:::{#eq-mn-met-3} -[[**MN.MET.3**]]{.aside .content-visible when-format="html"} +[See [MN.MET.3](#eq-mn-met-3)]{.aside .content-visible when-format="html"} $$ \text{CH}_4 \text{ emission from VS}_{\text{d or nd}} (\text{kg d}^{-1}) = 24 \times \text{Arrh\_exp} \times \text{VS}_{\text{d or nd}} \times \text{rate\_factor} $$ -::: *Where*: * 24: conversion factor from hours to day. -* `Arrh_exp`: Arrhenius parameter for CH4 emission rate (g CH4 kg$^{-1}$ VS h$^{-1}$), calculated in [MN.MET.2]{#eq-mn-met-2}. +* `Arrh_exp`: Arrhenius parameter for CH4 emission rate (g CH4 kg$^{-1}$ VS h$^{-1}$), calculated in [MN.MET.2](#eq-mn-met-2). * VSd or nd: The mass (kg) of VS~d~ or VS~nd~ in manure in slurry storage. * `rate_factor`: The unitless rate-correcting factor, set to 1 for VSd and 0.01 for VSnd. @@ -1107,47 +1096,37 @@ The total daily CH4 emission is equal to the sum of emissions from th **Calculate Cover and Flare Emissions `_calculate_cover_and_flare_methane`** - If the cover and flare option is selected, daily CH4 emission from an anaerobic lagoon is multiplied by a methane destruction efficiency value. The set value for methane destruction efficiency is 81%, based on a white paper commissioned by Dairy Management, Inc. on cover and flare efficiency [@wallaceDMI]. The updated daily CH4 emission (kg) from a cover and flare lagoon is as follows: +If the cover and flare option is selected, daily CH4 emission from an anaerobic lagoon is multiplied by a methane destruction efficiency value. The set value for methane destruction efficiency is 81%, based on a white paper commissioned by Dairy Management, Inc. on cover and flare efficiency [@wallaceDMI]. The updated daily CH4 emission (kg) from a cover and flare lagoon is as follows: -:::{#eq-mn-met-4} -[[**MN.MET.4**]]{.aside .content-visible when-format="html"} +[See [MN.MET.4](#eq-mn-met-4)]{.aside .content-visible when-format="html"} $$ \text{Daily storage CH}_4 (\text{kg}) = \text{storage CH}_4 \times (1 - \text{METHANE\_DESTRUCTION\_EFFICIENCY}) $$ -::: *Where*: -* Storage CH4 (kg): total daily kg of CH4 emitted from stored manure, calculated in [MN.MET.3]{#eq-mn-met-3}. +* Storage CH4 (kg): total daily kg of CH4 emitted from stored manure, calculated in [MN.MET.3](#eq-mn-met-3). * `METHANE_DESTRUCTION_EFFICIENCY`: coefficient for destruction of methane by the flare, set to 0.81. **Calculate Volatile Solids Losses `_apply_methane_emissions`** -Daily emissions of CH4 and CO2 from anaerobic lagoons occur through microbial degradation of VS in manure, among other processes [@Petersen2024]. Therefore, gaseous emissions from slurry storage result in a decrease in the quantity of VS in stored slurry. VSd and VSnd remaining in manure are updated separately according to their respective loss via CH4 [MN.STO.4]{#eq-mn-sto-4}. Here, we assume a fixed 1:3 molar ratio of CH4-C to CO2-C emissions from stored slurry from @Petersen2024. This enables calculation of the total amount of C and thus VSd and VSnd lost through CH4 and CO2 emissions based on the quantity of CH4 emitted from each VS fraction. +Daily emissions of CH4 and CO2 from anaerobic lagoons occur through microbial degradation of VS in manure, among other processes [@Petersen2024]. Therefore, gaseous emissions from slurry storage result in a decrease in the quantity of VS in stored slurry. VSd and VSnd remaining in manure are updated separately according to their respective loss via CH4 [MN.STO.4](#eq-mn-sto-4). Here, we assume a fixed 1:3 molar ratio of CH4-C to CO2-C emissions from stored slurry from @Petersen2024. This enables calculation of the total amount of C and thus VSd and VSnd lost through CH4 and CO2 emissions based on the quantity of CH4 emitted from each VS fraction. Given that C is assumed to be lost via CH4 and CO2 emissions in a ratio of 1:3, we assume for each C lost as CH4, 3 C are lost as CO2. CH4 is ~75% C by mass, thus for each kg of CH4 emitted, 0.7498 C are lost via CH4 and (3 x 0.7498) are lost from CO2, for a total of 2.992 kg C per kg of CH4 emitted. We assume manure VS are 45% C [@Petersen2024]; therefore, 2.9992 kg C / 45% C = 6.665 kg VS are lost per kg of CH4 emitted. -:::{#eq-mn-sto-3} -[[**MN.STO.3**]]{.aside .content-visible when-format="html"} +[See [MN.STO.3](#eq-mn-sto-3)]{.aside .content-visible when-format="html"} $$ \text{VS}_\text{d or nd}\text{loss (kg)} = \text{CH}_4\text{ emission from VS}_\text{d or nd} \times \text{VS\_TO\_METHANE\_LOSS\_RATIO} $$ -::: *Where*: -* CH4 emission from VSd or nd (kg): total daily kg of CH4 emitted from VSd or nd, calculated in [MN.MET.3]{#eq-mn-met-3} +* CH4 emission from VSd or nd (kg): total daily kg of CH4 emitted from VSd or nd, calculated in [MN.MET.3](#eq-mn-met-3) * `VS_TO_METHANE_LOSS_RATIO`: default ratio of VS degraded per kg of CH4 emitted from slurry storage, set to 6.665 **Calculate manure retention at emptying `_emptying_fraction`** -Anaerobic lagoons, through their settling action, accumulate and retain a bottom layer of solids often -referred to as "sludge". Additionally, depending on the frequency and extent of lagoon agitation, retention time of volatile solids in lagoons is typically explicitly managed to promote biological degradation of -solids. These factors contribute to the generally greater CH4 emissions per unit of volatile solids loaded into anaerobic lagoons compared to in-ground basin or tank manure storages. To directly capture the -greater retention of manure at emptying events, and to indirectly capture the greater biological activity -in anaerobic lagoons, a default manure retention factor is implemented in RuFaS. This factor dictates -the portion of manure which, when the storage time interval is reached, is retained in the lagoon. This -factor is applied evenly to all manure constituents (i.e., ManureStream variables). +Anaerobic lagoons, through their settling action, accumulate and retain a bottom layer of solids often referred to as "sludge". Additionally, depending on the frequency and extent of lagoon agitation, retention time of volatile solids in lagoons is typically explicitly managed to promote biological degradation of solids. These factors contribute to the generally greater CH4 emissions per unit of volatile solids loaded into anaerobic lagoons compared to in-ground basin or tank manure storages. To directly capture the greater retention of manure at emptying events, and to indirectly capture the greater biological activity in anaerobic lagoons, a default manure retention factor is implemented in RuFaS. This factor dictates the portion of manure which, when the storage time interval is reached, is retained in the lagoon. This factor is applied evenly to all manure constituents (i.e., ManureStream variables). :::{#eq-mn-sto-15 style="font-size:90%"} [[**MN.STO.15**]]{.aside .content-visible when-format="html"} @@ -1159,8 +1138,8 @@ $$ *Where:* * *i*: manure constituent *i* -* accumulated_manurei: quantity of manure constituent *i* present in the accumulate anaerobic lagoon manure when the storage time interval is reached -* ANAEROBIC_LAGOON_MANURE_RETENTION: constant fraction of the accumulated stored manure that is retained in the anaerobic lagoon when the storage time interval is reached, set to 0.10 +* `accumulated_manure_i`: quantity of manure constituent *i* present in the accumulate anaerobic lagoon manure when the storage time interval is reached +* `ANAEROBIC_LAGOON_MANURE_RETENTION`: constant fraction of the accumulated stored manure that is retained in the anaerobic lagoon when the storage time interval is reached, set to 0.10 **Calculate ammonia emissions `_calculate_ammonia_emissions`** @@ -1170,12 +1149,10 @@ First, we need to derive the value of the equilibrium coefficient Q for the NHh)*: -:::{#eq-mn-amm-1} -[[**MN.AMM.1**]]{.aside .content-visible when-format="html"} +[See [MN.AMM.1](#eq-mn-amm-1)]{.aside .content-visible when-format="html"} $$ \text{K}_\text{h} = 10^{\frac{1478}{\text{manure temperature}}} - 1.69 $$ -::: *Where*: @@ -1183,12 +1160,10 @@ $$ *Dissociation coefficient of ammonium (Ka)* -:::{#eq-mn-amm-2} -[[**MN.AMM.2**]]{.aside .content-visible when-format="html"} +[See [MN.AMM.2](#eq-mn-amm-2)]{.aside .content-visible when-format="html"} $$ \text{K}_\text{h} = 1 + 10^{(0.09018 + \frac{2729.9}{\text{manure temperature}} - \text{pH})} $$ -::: *Where*: @@ -1197,26 +1172,22 @@ $$ *Equilibrium coefficient (Q)* -:::{#eq-mn-amm-3} -[[**MN.AMM.3**]]{.aside .content-visible when-format="html"} +[See [MN.AMM.3](#eq-mn-amm-3)]{.aside .content-visible when-format="html"} $$ \text{Q} = \text{K}_\text{h} \times \text{K}_\text{a} $$ -::: *Where*: -* Kh: Henry’s law coefficient, calculated in [MN.AMM.1]{#eq-mn-amm-1}. -* Ka: Dissociation coefficient of ammonium, calculated in [MN.AMM.2]{#-eq-mn-amm-2}. +* Kh: Henry’s law coefficient, calculated in [MN.AMM.1](#eq-mn-amm-1). +* Ka: Dissociation coefficient of ammonium, calculated in [MN.AMM.2](#eq-mn-amm-2). Next, the rate of NH3-N loss in kg N/m$^2$ from stored manure is calculated: -:::{#eq-mn-amm-5} -[[**MN.AMM.5**]]{.aside .content-visible when-format="html"} +[See [MN.AMM.5](#eq-mn-amm-5)]{.aside .content-visible when-format="html"} $$ \text{NH}_3\text{N emission rate} (\text{kg N/m}^2) = \frac{\text{TAN} \times \text{c} \times \text{y}}{\text{STORAGE\_RESISTANCE} \times \text{M} \times \text{Q}} $$ -::: *Where*: @@ -1225,32 +1196,28 @@ $$ * y: manure density, set to 990 kg/m$^3$ * `STORAGE_RESISTANCE`: A constant value representing the sum of resistance of NH3 transfer from solution to manure surface, and from manure surface to atmosphere, set at 23.1 s/m. * M (kg): Total mass of stored manure -* Q: Equilibrium coefficient calculated in [MN.AMM.3]{#eq-mn-amm-3} +* Q: Equilibrium coefficient calculated in [MN.AMM.3](#eq-mn-amm-3) Lastly, we calculate total NH3-N emissions (kg), based on the emission rate we just calculated and the manure storage surface area. -:::{#eq-mn-amm-7} -[[**MN.AMM.7**]]{.aside .content-visible when-format="html"} +[See [MN.AMM.7](#eq-mn-amm-7)]{.aside .content-visible when-format="html"} $$ \text{NH}_3\text{ emissions (kg)} = \text{NH}_3\text{N\_rate} \times \text{surface\_area} $$ -::: *Where*: -* `NH3N_rate` (kg N/m$^2$): Rate of NH3-N loss (kg/m$^2$) from manure, calculated in [MN.AMM.5]{#eq-m-amm-5}. +* `NH3N_rate` (kg N/m$^2$): Rate of NH3-N loss (kg/m$^2$) from manure, calculated in [MN.AMM.5](#eq-mn-amm-5). * `surface_area` (m$^2$): Total manure storage surface area. **Calculate Nitrous Oxide Emissions `_calculate_nitrous_oxide_emissions`** N2O emissions (kg N2O-N) are based on the daily quantity of manure N loaded into the lagoon, and whether the lagoon is covered or uncovered. This method is based on @IPCC2019; however, it should be noted that the original @IPCC2006 method is based on daily manure N excretion by animals, whereas the current method is based on manure N loading into storage, which may reflect upstream N losses from NH3 emissions in housing, solid liquid separation, etc. The calculation is as follows: -:::{#eq-mn-nit-1} -[[**MN.NIT.1**]]{.aside .content-visible when-format="html"} +[See [MN.NIT.1](#eq-mn-nit-1)]{.aside .content-visible when-format="html"} $$ \text{N}_2\text{O-N emissions (kg)} = \text{Received\_N} \times \text{N}_2\text{O factor} $$ -::: *Where*: @@ -1288,7 +1255,7 @@ Manure may be removed from storage via requests made by the Crop and Soil module In anaerobic lagoon processors, the following nutrient sources are represented in received manure values: * `ManureStream` values, as received from the previous processor(s) in the manure management chain -* Precipitation water (kg), calculated in [MN.STO.2]{#eq-mn-sto-2} (if applicable), is added to the water value in `ManureStream` +* Precipitation water (kg), calculated in [MN.STO.2](#eq-mn-sto-2) (if applicable), is added to the water value in `ManureStream` **Stored manure** @@ -1305,8 +1272,6 @@ import_table( ) ``` - - ## Bedded Pack ### Introduction diff --git a/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-calc.csv b/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-calc.csv index 9541e32274..582a466415 100644 --- a/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-calc.csv +++ b/docs/scientific/quarto-scidoc/resources/table_data/manure/tbl-mn-AL-calc.csv @@ -9,4 +9,4 @@ degradable_volatile_solids, kg , stored degradable VS + received degradable VS - manure_non_degradable_volatile_solids, kg , stored manure non-degradable VS + received manure non-degradable VS - manure VSnd loss bedding_non_degradable_volatile_solids, kg , stored bedding non-degradable VS + received bedding non-degradable VS - bedding VSnd loss total_solids, kg , stored total solids + received total solids - VSd loss - VSnd los) -volume, m$^3$, stored volume + Received volume- $\frac{\text{VSd loss}+\text{VSnd loss}}{\text{SLURRY\_MANURE\_DENSITY}$ +volume, m$^3$, stored volume + Received volume- $\frac{\text{VSd loss}+\text{VSnd loss}}{\text{SLURRY\_MANURE\_DENSITY}}$